diff --git a/dk-api/api-resource/src/main/java/org/dromara/resource/api/domain/RemoteFile.java b/dk-api/api-resource/src/main/java/org/dromara/resource/api/domain/RemoteFile.java index 7140fe6..6c4360e 100644 --- a/dk-api/api-resource/src/main/java/org/dromara/resource/api/domain/RemoteFile.java +++ b/dk-api/api-resource/src/main/java/org/dromara/resource/api/domain/RemoteFile.java @@ -41,4 +41,9 @@ public class RemoteFile implements Serializable { */ private String fileSuffix; + /** + * 文件名称 + */ + private String fileName; + } diff --git a/dk-common/common-bus/pom.xml b/dk-common/common-bus/pom.xml index 4a04b67..5d12802 100644 --- a/dk-common/common-bus/pom.xml +++ b/dk-common/common-bus/pom.xml @@ -27,9 +27,14 @@ + + + + - com.alibaba.cloud - spring-cloud-starter-bus-rocketmq + org.springframework.cloud + spring-cloud-bus + ${spring.cloud.bus.version} diff --git a/dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertServiceImpl.java b/dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertServiceImpl.java index ad7c797..f291ecc 100644 --- a/dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertServiceImpl.java +++ b/dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertServiceImpl.java @@ -300,7 +300,8 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { if (ObjectUtil.isNotEmpty(bo.getPostCode())){ //根据当前用户职能获取识别类型 - List postVoList = remoteLablePostService.selectLabelByList(bo.getPostCode(), LoginHelper.getDeptId()); +// List postVoList = remoteLablePostService.selectLabelByList(bo.getPostCode(), LoginHelper.getDeptId()); + List postVoList = remoteLablePostService.selectLabelByList(bo.getPostCode(), null); if (ObjectUtil.isEmpty(postVoList)) { return null; diff --git a/dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertStatisticsServiceImpl.java b/dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertStatisticsServiceImpl.java index 14dcade..5304f9f 100644 --- a/dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertStatisticsServiceImpl.java +++ b/dk-modules/business/src/main/java/org/dromara/business/service/impl/BusinessAlertStatisticsServiceImpl.java @@ -316,14 +316,11 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist return ListUtil.empty(); } - AtomicInteger number = new AtomicInteger(1); - postVoList.forEach(postVo -> { List labelList = getAiLabel(postVo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList()); businessAlertBo.setAiLabelEnList(labelList); Map dayMap = this.baseMapper.countCurrentDayAlert(businessAlertBo); - number.getAndIncrement(); - result.add(new StatObj(postVo.getPostName(), ObjectUtil.isEmpty(dayMap.get("total"))? number.get() + 1:dayMap.get("total"))); + result.add(new StatObj(postVo.getPostName(), dayMap.get("total"))); }); return result; @@ -358,11 +355,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist endTime = dateMap.get("endTime"); } - AtomicInteger number = new AtomicInteger(1); - postVoList.forEach(postVo -> { - number.getAndIncrement(); - List labelList = getAiLabel(postVo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList()); Map dateMap = new HashMap<>(); if (ObjectUtil.isEmpty(labelList)) { @@ -375,8 +368,8 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist result.add(new StatObj( postVo.getPostName(), - ObjectUtil.isEmpty(dateMap.get("todoCount"))?number.get() + 1:dateMap.get("todoCount"), - ObjectUtil.isEmpty(dateMap.get("finishCount"))?number.get() + 2:dateMap.get("finishCount") + dateMap.get("todoCount"), + dateMap.get("finishCount") )); }); @@ -409,29 +402,16 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist if (ObjectUtil.isEmpty(labelList)){ monthList.forEach(month -> { - int randomValue = 90 + (int)(Math.random() * 31); // 90~120(含120) - data.add(randomValue); + data.add(0.0); }); }else { businessAlertBo.setAiLabelEnList(labelList); List> rateList = baseMapper.handlerRate(businessAlertBo,monthList); if (ObjectUtil.isNotEmpty(rateList)) { - rateList.forEach(p->{ - if (ObjectUtil.isNotEmpty(p.get("avgInfo"))){ - data.add(p.get("avgInfo")); - }else { - int randomValue = 90 + (int)(Math.random() * 31); - data.add(randomValue); - } - }); -// data.addAll(rateList.stream().map(p-> p.get("avgInfo")).toList()); + data.addAll(rateList.stream().map(p-> p.get("avgInfo")).toList()); }else { -// monthList.forEach(month -> { -// data.add(0.0); -// }); monthList.forEach(month -> { - int randomValue = 90 + (int)(Math.random() * 31); - data.add(randomValue); + data.add(0.0); }); } } @@ -696,6 +676,6 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist } private List getAiLabel(String postCode) { - return remoteLabelPostService.selectLabelByList(postCode,LoginHelper.getDeptId()); + return remoteLabelPostService.selectLabelByList(postCode,null); } } diff --git a/dk-modules/business/src/main/resources/mapper/business/BusinessAlertMapper.xml b/dk-modules/business/src/main/resources/mapper/business/BusinessAlertMapper.xml index b73248b..b32d8c9 100644 --- a/dk-modules/business/src/main/resources/mapper/business/BusinessAlertMapper.xml +++ b/dk-modules/business/src/main/resources/mapper/business/BusinessAlertMapper.xml @@ -494,7 +494,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" dept_name AS root_dept_name, dept_id, dept_name - FROM dk_cloud.sys_dept + FROM + dk_cloud.sys_dept WHERE dept_id IN #{deptId} @@ -505,31 +506,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" dt.root_dept_name, d.dept_id, d.dept_name - FROM dk_cloud.sys_dept d - JOIN warning_summary dt - ON d.parent_id = dt.dept_id - WHERE d.del_flag = '0' + FROM + dk_cloud.sys_dept d + JOIN warning_summary dt ON d.parent_id = dt.dept_id + WHERE + d.del_flag = '0' ) SELECT - root_dept_name deptName, - total - FROM ( - SELECT - dt.root_dept_id, - dt.root_dept_name, - COUNT(ba.id) total - FROM business_alert ba - JOIN warning_summary dt - ON ba.dept_id = dt.dept_id - WHERE - 1=1 + ws.root_dept_name AS deptName, + IFNULL(COUNT(ba.id), 0) AS total + FROM + warning_summary ws + LEFT JOIN business_alert ba ON ws.dept_id = ba.dept_id and = #{startTime} ]]> and - GROUP BY dt.root_dept_id,dt.root_dept_name - ) dept_stats - ORDER BY total DESC - LIMIT 5; + GROUP BY + ws.root_dept_id, + ws.root_dept_name + ORDER BY + CASE WHEN total IS NULL THEN 1 ELSE 0 END, + total DESC + LIMIT 5