Преглед изворни кода

fix 数据看板 接口推送,上传新增type返回

tags/B.2.2.0.0_20230922_base
yk пре 2 година
родитељ
комит
bf97ca3123
6 измењених фајлова са 95 додато и 26 уклоњено
  1. +2
    -0
      xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/resource/domain/po/DmResourcesPo.java
  2. +12
    -0
      xueyi-common/xueyi-common-core/src/main/java/com/xueyi/common/core/utils/core/NumberUtil.java
  3. +46
    -0
      xueyi-common/xueyi-common-redis/src/main/java/com/xueyi/common/redis/utils/RedisUtil.java
  4. +2
    -1
      xueyi-common/xueyi-common-redis/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
  5. +29
    -25
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/controller/DmDigitalmanController.java
  6. +4
    -0
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/resource/controller/DmResourcesController.java

+ 2
- 0
xueyi-api/xueyi-api-system/src/main/java/com/xueyi/system/api/resource/domain/po/DmResourcesPo.java Прегледај датотеку

@@ -26,6 +26,8 @@ public class DmResourcesPo extends TBaseEntity {
public static final Integer TYPE_PIC = 1;
public static final Integer TYPE_VIDEO = 2;

public static final Integer TYPE_PDF = 3;

/** 资源tag */
@Excel(name = "资源tag")
protected String tag;


+ 12
- 0
xueyi-common/xueyi-common-core/src/main/java/com/xueyi/common/core/utils/core/NumberUtil.java Прегледај датотеку

@@ -8,4 +8,16 @@ import com.xueyi.common.core.utils.core.pool.NumberPool;
* @author xueyi
*/
public class NumberUtil extends cn.hutool.core.util.NumberUtil implements NumberPool {

/**
* @Author yangkai
* @Description 判断数字是否为null,为null返回0
* @Date 2023/9/21
* @Param
* @return
**/
public static int getNumber(Integer number) {
return number == null ? 0 : number;
}

}

+ 46
- 0
xueyi-common/xueyi-common-redis/src/main/java/com/xueyi/common/redis/utils/RedisUtil.java Прегледај датотеку

@@ -0,0 +1,46 @@
package com.xueyi.common.redis.utils;

import com.alibaba.fastjson2.JSONObject;
import com.xueyi.common.core.utils.core.NumberUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;

import javax.annotation.PostConstruct;
import java.io.Serializable;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

/**
* @author yk
* @description
* @date 2023-09-21 13:57
*/
public class RedisUtil {

private static RedisTemplate<String, Serializable> redisTemplate;

@Autowired
RedisTemplate<String, Serializable> redisTemplate2;

@PostConstruct
public void init() {
redisTemplate = redisTemplate2;
}

public static Integer getNumberVal(String key) {
return NumberUtil.getNumber((Integer) redisTemplate.opsForValue().get(key));
}

public static void expire(String key, int seconds) {
redisTemplate.expire(key, seconds, TimeUnit.SECONDS);
}

public static List<JSONObject> getJsonList(String key) {
return redisTemplate.opsForList().range(key, 0, -1).stream().map(json-> JSONObject.parseObject(json.toString())).collect(Collectors.toList());
}

public static Boolean existed(String key){
return redisTemplate.hasKey(key);
}
}

+ 2
- 1
xueyi-common/xueyi-common-redis/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports Прегледај датотеку

@@ -1,2 +1,3 @@
com.xueyi.common.redis.configure.RedisConfig
com.xueyi.common.redis.service.RedisService
com.xueyi.common.redis.service.RedisService
com.xueyi.common.redis.utils.RedisUtil

+ 29
- 25
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/digitalmans/controller/DmDigitalmanController.java Прегледај датотеку

@@ -15,6 +15,7 @@ import com.xueyi.common.core.web.validate.V_E;
import com.xueyi.common.datasource.annotation.Master;
import com.xueyi.common.log.annotation.Log;
import com.xueyi.common.log.enums.BusinessType;
import com.xueyi.common.redis.utils.RedisUtil;
import com.xueyi.common.security.annotation.InnerAuth;
import com.xueyi.common.security.annotation.RequiresPermissions;
import com.xueyi.common.web.entity.controller.BaseController;
@@ -406,54 +407,57 @@ public class DmDigitalmanController extends BaseController<DmDigitalmanQuery, Dm
serviceTimeCount += (System.currentTimeMillis() - dto.getActivateTime().getTime())/3600000;
}

Integer meetingServiceCount = (Integer) redisTemplate.opsForValue().get("dashboard:meeting");
Integer serverTimes = (Integer) redisTemplate.opsForValue().get("dashboard:server");
Integer recognition = (Integer) redisTemplate.opsForValue().get("dashboard:recognition");
Integer receptionCount = (Integer) redisTemplate.opsForValue().get("dashboard:create_visitor_info");
Integer visitorCount = (Integer) redisTemplate.opsForValue().get("dashboard:register_visitor");
Integer attendanceCount = (Integer) redisTemplate.opsForValue().get("dashboard:attendance");
Integer openDoorCount = (Integer) redisTemplate.opsForValue().get("dashboard:open_door");
Integer conversationDuration = (Integer) redisTemplate.opsForValue().get("dashboard:conversation-duration");
Integer conversationTimes = (Integer) redisTemplate.opsForValue().get("dashboard:conversation-times");
Integer broadcastCount = (Integer) redisTemplate.opsForValue().get("dashboard:broadcast-count");
Integer meetingServiceCount = RedisUtil.getNumberVal("dashboard:meeting");
Integer serverTimes = RedisUtil.getNumberVal("dashboard:server");
Integer recognition = RedisUtil.getNumberVal("dashboard:recognition");
Integer receptionCount = RedisUtil.getNumberVal("dashboard:create_visitor_info");
Integer visitorCount = RedisUtil.getNumberVal("dashboard:register_visitor");
Integer attendanceCount = RedisUtil.getNumberVal("dashboard:attendance");
Integer openDoorCount = RedisUtil.getNumberVal("dashboard:open_door");
Integer conversationDuration = RedisUtil.getNumberVal("dashboard:conversation-duration");
Integer conversationTimes = RedisUtil.getNumberVal("dashboard:conversation-times");
Integer broadcastCount = RedisUtil.getNumberVal("dashboard:broadcast-count");
List<JSONObject> knowledgeList = new ArrayList<>();
if (redisTemplate.hasKey("dashboard:knowledge-consume")) {
Long knowledgeCount = redisTemplate.opsForList().size("dashboard:knowledge-consume");
if (knowledgeCount > 0)
knowledgeList = redisTemplate.opsForList().range("dashboard:knowledge-consume", 0, -1).stream().map(json -> JSONObject.parseObject(json.toString())).collect(Collectors.toList());
if (RedisUtil.existed("dashboard:knowledge-consume")) {
knowledgeList = RedisUtil.getJsonList("dashboard:knowledge-consume");
//取值后清除缓存list,5秒后过期
RedisUtil.expire("dashboard:knowledge-consume", 5);
}
List<JSONObject> skillList = new ArrayList<>();
if (redisTemplate.hasKey("dashboard:skill-consume")) {
Long skillCount = redisTemplate.opsForList().size("dashboard:skill-consume");
if (skillCount > 0)
skillList = redisTemplate.opsForList().range("dashboard:skill-consume", 0, -1).stream().map(json -> JSONObject.parseObject(json.toString())).collect(Collectors.toList());
if (RedisUtil.existed("dashboard:skill-consume")) {
skillList = RedisUtil.getJsonList("dashboard:skill-consume");
//取值后清除缓存list,5秒后过期
RedisUtil.expire("dashboard:skill-consume", 5);
}
JSONArray jsonArray = new JSONArray();
// JSONArray jsonArray2 = new JSONArray();
for (int i = 0; i < 7; i++) {
// 最近三十天的数据,服务人次,知识库增量
for (int i = 0; i < 30; i++) {
Date date = DateUtils.addDays(new Date(), -i);
String dateStr2 = DateUtils.formatDate(date, "yyyy-MM-dd");
JSONObject json2 = new JSONObject();
json2.put("date", dateStr2);
json2.put("serviceTimes", (Integer) redisTemplate.opsForValue().get("dashboard:server-chart:"+dateStr2));
json2.put("knowledgeNums", (Integer) redisTemplate.opsForValue().get("dashboard:server-chart:"+dateStr2));
json2.put("serviceTimes", RedisUtil.getNumberVal("dashboard:server-chart:"+dateStr2));
json2.put("knowledgeNums", RedisUtil.getNumberVal("dashboard:server-chart:"+dateStr2));
jsonArray.add(json2);
}

JSONObject json = new JSONObject();
json.put("manCount",dtos2.size());//数字人数
json.put("recognizedPersonCount",recognition);//注册人员总数
json.put("recognizedPersonCount", recognition);//注册人员总数
json.put("serviceTimeCount",serviceTimeCount);//总服务时间
json.put("chatTimes",conversationTimes);//对话次数
json.put("chatDurationCount",conversationDuration);//对话时长

json.put("servicePerCount",serverTimes);//用户使用频次
json.put("meetingServiceCount",meetingServiceCount);//会议
json.put("servicePerCount",serverTimes);//用户使用频次?改成服务人次
json.put("serviceTotal",meetingServiceCount+receptionCount+visitorCount+attendanceCount+openDoorCount+broadcastCount);

json.put("meetingServiceCount", meetingServiceCount);//会议
json.put("receptionCount",receptionCount);//接待
json.put("visitorCount",visitorCount);//访客
json.put("attendanceCount",attendanceCount);//考勤
json.put("openDoorCount",openDoorCount);//门禁
json.put("broadcastCount",broadcastCount);//播报

json.put("knowledgeConsume",knowledgeList);//实时知识库调用
json.put("skillConsume",skillList);//实时技能调用
json.put("serverCharts",jsonArray);//


+ 4
- 0
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/resource/controller/DmResourcesController.java Прегледај датотеку

@@ -138,6 +138,8 @@ public class DmResourcesController extends BaseController<DmResourcesQuery, DmRe

private static final String PARAM_RESOURCE_ID = "resource_id";
private static final String PARAM_URL = "url";

private static final String PARAM_TYPE = "type";
/**
* 头像上传
*/
@@ -168,6 +170,7 @@ public class DmResourcesController extends BaseController<DmResourcesQuery, DmRe
JSONObject jo = new JSONObject();
jo.put(PARAM_RESOURCE_ID, dto.getId());
jo.put(PARAM_URL, url);
jo.put(PARAM_TYPE, dto.getType());
ja.add(jo);
}
AjaxResult ajax = success();
@@ -194,6 +197,7 @@ public class DmResourcesController extends BaseController<DmResourcesQuery, DmRe
JSONObject jo = new JSONObject();
jo.put(PARAM_RESOURCE_ID, dto.getId());
jo.put(PARAM_URL, url);
jo.put(PARAM_TYPE, dto.getType());

AjaxResult ajax = success();
ajax.put(AjaxResult.RESULT_TAG, jo);


Loading…
Откажи
Сачувај