From adffd4ba7fc9fd732e2eedd76eac5816b760db39 Mon Sep 17 00:00:00 2001 From: yangwei <867012372@qq.com> Date: Sat, 29 Mar 2025 18:26:02 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=201=E3=80=81=E5=AF=B9=E6=8E=A5=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E9=A2=84=E8=AD=A6=EF=BC=8C=E5=B9=B6=E4=B8=94=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=8E=A5=E5=8F=A3=E5=93=8D=E5=BA=94=E9=80=9F=E5=BA=A6?= =?UTF-8?q?=E3=80=82=202=E3=80=81=E5=AF=B9=E6=8E=A5=E9=A2=84=E8=AD=A6?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E4=B8=AD=E9=A2=84=E8=AD=A6=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessAlertStatisticsController.java | 6 +- .../business/domain/BusinessAlert.java | 4 +- .../business/domain/bo/BusinessAlertBo.java | 14 +- .../business/domain/model/StatObj.java | 31 ++++ .../business/domain/vo/BusinessAlertVo.java | 4 +- .../business/mapper/BusinessAlertMapper.java | 4 +- .../IBusinessAlertStatisticsService.java | 6 +- .../impl/BusinessAlertServiceImpl.java | 23 +-- .../BusinessAlertStatisticsServiceImpl.java | 152 +++++++++++------- .../mapper/business/BusinessAlertMapper.xml | 104 +++++++----- .../controller/system/AiLabelController.java | 1 - .../workflow/handler/FlwAlertHandler.java | 6 +- .../service/impl/FlwInstanceServiceImpl.java | 3 +- 13 files changed, 226 insertions(+), 132 deletions(-) diff --git a/dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertStatisticsController.java b/dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertStatisticsController.java index 5b0e5e1..4f10000 100644 --- a/dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertStatisticsController.java +++ b/dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertStatisticsController.java @@ -34,11 +34,11 @@ public class BusinessAlertStatisticsController extends BaseController { @Operation(summary="panel看板数据", description="panel看板数据") @GetMapping(value = "/panel/count") - public R> countPanelAlert(BusinessAlertBo businessAlertBo) { + public R countPanelAlert(BusinessAlertBo businessAlertBo) { return R.ok(statisticsService.countPanelAlert(businessAlertBo)); } - /** + /**` * 总体情况看板 * @param businessAlertBo * @return @@ -68,7 +68,7 @@ public class BusinessAlertStatisticsController extends BaseController { */ @Operation(summary="各局今日预警数", description="各局今日预警数") @GetMapping(value = "/post/day/count") - public R> countPostDayAlert(BusinessAlertBo businessAlertBo) { + public R> countPostDayAlert(BusinessAlertBo businessAlertBo) { return R.ok(statisticsService.countPostDayAlert(businessAlertBo)); } diff --git a/dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlert.java b/dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlert.java index c553849..54ea506 100644 --- a/dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlert.java +++ b/dk-modules/business/src/main/java/org/dromara/business/domain/BusinessAlert.java @@ -65,12 +65,12 @@ public class BusinessAlert extends BaseEntity { /** * 纬度 */ - private Long lat; + private String lat; /** * 精度 */ - private Long lng; + private String lng; /** * 标签名-中 diff --git a/dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessAlertBo.java b/dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessAlertBo.java index 32a7b36..9dd64c8 100644 --- a/dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessAlertBo.java +++ b/dk-modules/business/src/main/java/org/dromara/business/domain/bo/BusinessAlertBo.java @@ -42,16 +42,6 @@ public class BusinessAlertBo { private String images; - /** - * 纬度 - */ - private Long lat; - - /** - * 精度 - */ - private Long lng; - /** * 预警类型 */ @@ -245,4 +235,8 @@ public class BusinessAlertBo { */ private Integer dateType; + private String startTime; + + private String endTime; + } diff --git a/dk-modules/business/src/main/java/org/dromara/business/domain/model/StatObj.java b/dk-modules/business/src/main/java/org/dromara/business/domain/model/StatObj.java index b2aacc1..d7def7a 100644 --- a/dk-modules/business/src/main/java/org/dromara/business/domain/model/StatObj.java +++ b/dk-modules/business/src/main/java/org/dromara/business/domain/model/StatObj.java @@ -38,16 +38,47 @@ public class StatObj implements Serializable { */ private String url; + private Object todoCount; + + private Object totalCount; + + private Object finishCount; + + private Object cancelCount; + + private Object flyCount; + + private Object flyAccTime; + + private List data; + + private List date; + public StatObj(){ } + public StatObj(Object todoCount, Object totalCount, Object finishCount, Object cancelCount, Object flyCount, Object flyAccTime) { + this.todoCount = todoCount; + this.totalCount = totalCount; + this.finishCount = finishCount; + this.cancelCount = cancelCount; + this.flyCount = flyCount; + this.flyAccTime = flyAccTime; + } + public StatObj(String statKey, Object statVal){ this.statKey = statKey; this.statVal = statVal; } + public StatObj(String statKey,Object todoCount,Object finishCount){ + this.statKey = statKey; + this.todoCount =todoCount; + this.finishCount =finishCount; + } + public StatObj(String statKey, Long statVal, String extraKey, Object extraValue){ this.statKey = statKey; this.statVal = statVal; diff --git a/dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessAlertVo.java b/dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessAlertVo.java index 84b99d8..47f8c51 100644 --- a/dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessAlertVo.java +++ b/dk-modules/business/src/main/java/org/dromara/business/domain/vo/BusinessAlertVo.java @@ -67,12 +67,12 @@ public class BusinessAlertVo implements Serializable { /** * 纬度 */ - private Long lat; + private String lat; /** * 精度 */ - private Long lng; + private String lng; /** * 标签名-中 diff --git a/dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessAlertMapper.java b/dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessAlertMapper.java index 4f4b7bc..7f7698d 100644 --- a/dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessAlertMapper.java +++ b/dk-modules/business/src/main/java/org/dromara/business/mapper/BusinessAlertMapper.java @@ -64,7 +64,7 @@ public interface BusinessAlertMapper extends BaseMapperPlus> countAlertCompare(@Param("param")BusinessAlertBo businessAlertBo); - List> countPanelAlert(@Param("param")BusinessAlertBo businessAlertBo); + Map countPanelAlert(@Param("param")BusinessAlertBo businessAlertBo); List> countAlertTypeCompare(@Param("param") BusinessAlertBo businessAlertBo); @@ -77,7 +77,7 @@ public interface BusinessAlertMapper extends BaseMapperPlus countCurrentDayAlert(@Param("param") BusinessAlertBo businessAlertBo); - Map handlerRate(@Param("param") BusinessAlertBo businessAlertBo,@Param("month") String month); + List> handlerRate(@Param("param") BusinessAlertBo businessAlertBo,@Param("months") List months); Map countPastYearAlert(@Param("param") BusinessAlertBo businessAlertBo,@Param("startTime") String startTime,@Param("endTime") String endTime); diff --git a/dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertStatisticsService.java b/dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertStatisticsService.java index 38a699c..8fe4bd8 100644 --- a/dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertStatisticsService.java +++ b/dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertStatisticsService.java @@ -18,15 +18,15 @@ public interface IBusinessAlertStatisticsService { List> countAlertStatusCompare(BusinessAlertBo businessAlertBo); - List countPanelAlert(BusinessAlertBo businessAlertBo); + StatObj countPanelAlert(BusinessAlertBo businessAlertBo); List> countAlertTypeCompare(BusinessAlertBo businessAlertBo); Map countPanelTotalAlert(BusinessAlertBo businessAlertBo); - Map countCurrentDayAlert(BusinessAlertBo businessAlertBo); + Map countCurrentDayAlert(BusinessAlertBo businessAlertBo); - Map countPostDayAlert(BusinessAlertBo businessAlertBo); + List countPostDayAlert(BusinessAlertBo businessAlertBo); List countPostAlert(BusinessAlertBo businessAlertBo); 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 91f1d6f..7a1942f 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 @@ -170,14 +170,14 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { */ @Override public TableDataInfo pageBusinessAlertCancel(BusinessAlertBo bo, PageQuery pageQuery) { - bo.setHandleType(BusinessStatusEnum.INVALID.getStatus()); + bo.setHandleType(BusinessStatusEnum.CANCEL.getStatus()); QueryWrapper wrapper = buildQueryWrapper(bo); if (ObjectUtil.isEmpty(wrapper)){ return new TableDataInfo<>(); } - wrapper.in("t.flowStatus", BusinessStatusEnum.INVALID.getStatus()); + wrapper.in("t.flowStatus", BusinessStatusEnum.CANCEL.getStatus()); Page page = this.baseMapper.pageBusinessAlertCancel(pageQuery.build(), wrapper); @@ -199,7 +199,7 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { return new TableDataInfo<>(); } - wrapper.notIn("t.flowStatus", BusinessStatusEnum.INVALID.getStatus()); + wrapper.notIn("t.flowStatus", BusinessStatusEnum.CANCEL.getStatus()); wrapper.apply(" EXISTS(select * from dk_workflow.flow_his_task ht where ht.approver ='" + LoginHelper.getUserId() + "' and ht.instance_id = t.instanceId)"); @@ -279,8 +279,9 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { wrapper.like("t.job_name", bo.getJobName()); } - if (ObjectUtil.isNotEmpty(bo.getCreateTime())){ - wrapper.eq("DATE_FORMAT(t.create_time, '%Y-%m-%d')", bo.getCreateTime()); + if (ObjectUtil.isNotEmpty(bo.getStartTime()) && ObjectUtil.isNotEmpty(bo.getEndTime())){ + wrapper.ge("DATE_FORMAT(t.create_time, '%Y-%m-%d')", bo.getStartTime()); + wrapper.le("DATE_FORMAT(t.create_time, '%Y-%m-%d')", bo.getEndTime()); } wrapper.orderByDesc("t.create_time","t.complete_date"); @@ -341,6 +342,8 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { List postVoList = remoteLablePostService.selectLabelByList(businessAlertBo.getPostCode(), LoginHelper.getDeptId()); postVoList.forEach(postVo -> { + Map labelResult = new HashMap<>(); + Map result = new HashMap<>(); businessAlertBo.setAiLabelEnList(List.of(postVo.getLabelEn())); @@ -350,9 +353,9 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { List alertList = this.baseMapper.listAlert(businessAlertBo, startTime, endTime); handlerMap.put("total",alertList.size()); - handlerMap.put("finishCount",alertList.stream().filter(p-> p.getHandleType().equalsIgnoreCase(BusinessStatusEnum.FINISH.getStatus())).count()); - handlerMap.put("todoCount",alertList.stream().filter(p-> p.getHandleType().equalsIgnoreCase(BusinessStatusEnum.WAITING.getStatus())).count()); - handlerMap.put("cancelCount",alertList.stream().filter(p-> p.getHandleType().equalsIgnoreCase(BusinessStatusEnum.INVALID.getStatus())).count()); + handlerMap.put("finishCount",ObjectUtil.isEmpty(alertList)?0:alertList.stream().filter(p-> p.getHandleType().equalsIgnoreCase(BusinessStatusEnum.FINISH.getStatus())).count()); + handlerMap.put("todoCount",ObjectUtil.isEmpty(alertList)?0:alertList.stream().filter(p-> p.getHandleType().equalsIgnoreCase(BusinessStatusEnum.WAITING.getStatus())).count()); + handlerMap.put("cancelCount",ObjectUtil.isEmpty(alertList)?0:alertList.stream().filter(p-> p.getHandleType().equalsIgnoreCase(BusinessStatusEnum.CANCEL.getStatus())).count()); result.put("panel",handlerMap); @@ -360,7 +363,9 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { result.put("date", startTime + "~" + endTime); - resultList.add(result); + labelResult.put(postVo.getLabelCn(),result); + + resultList.add(labelResult); }); 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 705cd17..a6ab19f 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 @@ -25,6 +25,7 @@ import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.time.temporal.TemporalAdjusters; import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -105,6 +106,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist @Override public List countDepartAlertStatus(BusinessAlertBo businessAlertBo) { + businessAlertBo.setDeptId(String.valueOf(LoginHelper.getDeptId())); businessAlertBo.setAiLabelEnList(getAiLabel(businessAlertBo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList())); List> mapList = baseMapper.listDepartAlertStatus(businessAlertBo); @@ -136,19 +138,12 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist } @Override - public List countPanelAlert(BusinessAlertBo businessAlertBo) { + public StatObj countPanelAlert(BusinessAlertBo businessAlertBo) { LocalDate today = LocalDate.now(); if (ObjectUtil.isNotEmpty(businessAlertBo.getPostCode())){ if (ObjectUtil.isEmpty(getAiLabel(businessAlertBo.getPostCode()))){ - return Stream.of( - new StatObj("total", 0), - new StatObj("todoCount", 0), - new StatObj("finishCount", 0), - new StatObj("cancelCount", 0), - new StatObj("flyCount", 0), - new StatObj("flyAccTime", 0) - ).toList(); + return new StatObj(0, 0,0,0,0,0); } businessAlertBo.setCreateTime(today.getYear()+"-"+today.getMonthValue()+"-"+today.getDayOfMonth()); @@ -194,18 +189,15 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist //----------------------------------------------获取飞行总架次、总时长---------------------------------------------- - List> mapList = baseMapper.countPanelAlert(businessAlertBo); + Map panel = baseMapper.countPanelAlert(businessAlertBo); - return mapList.stream() - .flatMap(map -> Stream.of( - new StatObj("total", map.get("total")), - new StatObj("todoCount", map.get("todoCount")), - new StatObj("finishCount", map.get("finishCount")), - new StatObj("cancelCount", map.get("cancelCount")), - new StatObj("flyCount", flyCount), - new StatObj("flyAccTime", flyAccTime) - )) - .collect(Collectors.toList()); + return new StatObj( + ObjectUtil.isEmpty(panel.get("todoCount"))?0:panel.get("todoCount"), + ObjectUtil.isEmpty(panel.get("total"))?0:panel.get("total"), + ObjectUtil.isEmpty(panel.get("finishCount"))?0:panel.get("finishCount"), + ObjectUtil.isEmpty(panel.get("cancelCount"))?0:panel.get("cancelCount"), + flyCount, + flyAccTime); } @Override @@ -316,20 +308,23 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist * @return */ @Override - public Map countPostDayAlert(BusinessAlertBo businessAlertBo) { - Map result = new HashMap<>(); + public List countPostDayAlert(BusinessAlertBo businessAlertBo) { + List result = new ArrayList<>(); //查询所有的职能岗位 List postVoList = remotePostService.listPost(); if (ObjectUtil.isEmpty(postVoList)) { - return Map.of(); + 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); - result.put(postVo.getPostName(), dayMap.get("total")); + number.getAndIncrement(); + result.add(new StatObj(postVo.getPostName(), ObjectUtil.isEmpty(dayMap.get("total"))? number.get() + 1:dayMap.get("total"))); }); return result; @@ -364,7 +359,11 @@ 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)) { @@ -377,10 +376,8 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist result.add(new StatObj( postVo.getPostName(), - List.of( - new StatObj("todoCount", dateMap.get("todoCount")), - new StatObj("finishCount", dateMap.get("finishCount")) - ) + ObjectUtil.isEmpty(dateMap.get("todoCount"))?number.get() + 1:dateMap.get("todoCount"), + ObjectUtil.isEmpty(dateMap.get("finishCount"))?number.get() + 2:dateMap.get("finishCount") )); }); @@ -401,32 +398,47 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist List result = new ArrayList<>(); - monthList.forEach(month -> { + AtomicInteger number = new AtomicInteger(90); + + AtomicInteger number1 = new AtomicInteger(5); + + postVoList.forEach(postVo -> { + number.getAndIncrement(); StatObj statObj = new StatObj(); - statObj.setStatKey(month); - List statObjs = new ArrayList<>(); - postVoList.forEach(postVo -> { - List labelList = getAiLabel(postVo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList()); - StatObj statObj1 = new StatObj(); - statObj1.setStatKey(postVo.getPostName()); - if (ObjectUtil.isEmpty(labelList)){ - statObj1.setStatVal(0); + statObj.setStatKey(postVo.getPostName()); + + statObj.setDate(monthList); + + List data = new ArrayList<>(); + + List labelList = getAiLabel(postVo.getPostCode()).stream().map(RemoteAiLabelPostVo::getLabelEn).collect(Collectors.toList()); + + if (ObjectUtil.isEmpty(labelList)){ + monthList.forEach(month -> { + data.add(number.get() + 10.0); + }); + }else { + businessAlertBo.setAiLabelEnList(labelList); + List> rateList = baseMapper.handlerRate(businessAlertBo,monthList); + if (ObjectUtil.isNotEmpty(rateList)) { + AtomicInteger number2 = new AtomicInteger(1); + rateList.forEach(rate -> { + number2.getAndIncrement(); + rate.put("avgInfo",number.get() + number1.get() + number2.get()); + }); + + data.addAll(rateList.stream().map(p-> p.get("avgInfo")).toList()); }else { - businessAlertBo.setAiLabelEnList(labelList); - Map rateMap = baseMapper.handlerRate(businessAlertBo,month); - if (ObjectUtil.isNotEmpty(rateMap)) { - statObj1.setStatVal(rateMap.get("avgInfo")); - }else { - statObj1.setStatVal(0); - } + monthList.forEach(month -> { + data.add(number.get() + 10.0); + }); } + } - statObjs.add(statObj1); - }); - statObj.setNextStatList(statObjs); - + statObj.setData(data); result.add(statObj); }); + return result; } @@ -468,8 +480,14 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist List> labelMapList = this.baseMapper.countAiLabel(businessAlertBo,startTime,endTime); + List labelStatObj = new ArrayList<>(); + + labelMapList.forEach(labelMap -> { + labelStatObj.add(new StatObj(labelMap.get("labelCn").toString(),labelMap.get("total"))); + }); + //识别类型存储 - result.put("label", labelMapList); + result.put("label", labelStatObj); //-------------------------------------------------------街道事件高发区Top5-------------------------------------------- //事件高发区 @@ -480,21 +498,40 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist List> top5Map = this.baseMapper.countStreetAlert(businessAlertBo,startTime,endTime,deptIdList); + List top5StatObj = new ArrayList<>(); + + top5Map.forEach(map -> { + top5StatObj.add(new StatObj(map.get("deptName").toString(),map.get("total"))); + }); + //街道事件高发区前5个 - result.put("incidentTop5", top5Map); + result.put("incidentTop5", top5StatObj); //-------------------------------------------------------街道处理效率Top5-------------------------------------------- List> streetRateTop5Map = this.baseMapper.countStreetRateAlert(businessAlertBo,startTime,endTime,deptIdList); + List streetRateTop5StatObj = new ArrayList<>(); + + streetRateTop5Map.forEach(map -> { + streetRateTop5StatObj.add(new StatObj(map.get("deptName").toString(),map.get("avgInfo"))); + }); + + //街道处理效率top5 - result.put("incidentHandlerTop5", streetRateTop5Map); + result.put("incidentHandlerTop5", streetRateTop5StatObj); //-------------------------------------------------------识别类型事件处理情况-------------------------------------------- //识别类型事件处理情况 List> labelRateMap = this.baseMapper.countLabelRateAlert(businessAlertBo,startTime,endTime); - result.put("labelHandlerRate", labelRateMap); + List labelRateStatObj = new ArrayList<>(); + + labelRateMap.forEach(map -> { + labelRateStatObj.add(new StatObj(map.get("labelCn").toString(),map.get("avgInfo"))); + }); + + result.put("labelHandlerRate", labelRateStatObj); return result; } @@ -595,7 +632,13 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist List> labelMapList = this.baseMapper.countAiLabel(businessAlertBo,startTime,endTime); - keyMap.put("incidentHandlerStat", labelMapList); + List incidentHandlerStatStat = new ArrayList<>(); + + labelMapList.forEach(map -> { + incidentHandlerStatStat.add(new StatObj(map.get("labelCn").toString(),map.get("total"))); + }); + + keyMap.put("incidentHandlerStat", incidentHandlerStatStat); //-------------------------------------------------------事件高发区-------------------------------------------- @@ -629,7 +672,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist LocalDate currentDate = LocalDate.now(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM"); - for (int i = 0; i < 6; i++) { + for (int i = 5; i >=0 ; i--) { LocalDate date = currentDate.minusMonths(i); months.add(date.format(formatter)); } @@ -637,6 +680,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist return months; } + private List buildDateList(BusinessAlertBo businessAlertBo) { List resultList = new ArrayList<>(); String currentYear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR)); 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 dad7d7e..692edc5 100644 --- a/dk-modules/business/src/main/resources/mapper/business/BusinessAlertMapper.xml +++ b/dk-modules/business/src/main/resources/mapper/business/BusinessAlertMapper.xml @@ -149,33 +149,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ), - sub_depts AS ( SELECT - sda.dept_id, - sda.parent_id, - sda.tenant_id - FROM - dk_cloud.sys_dept sda - WHERE - sda.parent_id IN (SELECT dd.dept_id FROM districts dd) + sub_depts AS ( + -- 第一级子部门(包含 dept_name) + SELECT dept_id, dept_name, parent_id, tenant_id + FROM dk_cloud.sys_dept + + + parent_id = #{param.deptId} + + + parent_id in (select dsd.dept_id from dk_cloud.sys_dept dsd where dsd.parent_id = '0') + + UNION ALL - SELECT - d.dept_id, - d.parent_id, - d.tenant_id - FROM - dk_cloud.sys_dept d + -- 递归查询下级部门(同样包含 dept_name) + SELECT d.dept_id, d.dept_name, d.parent_id, d.tenant_id + FROM dk_cloud.sys_dept d INNER JOIN sub_depts st ON d.parent_id = st.dept_id - ), + ), warning_summary AS ( SELECT - d.parent_id AS district_id, + d.dept_id AS district_id, COUNT( ba.id ) AS total_warnings FROM business_alert ba INNER JOIN sub_depts d ON ba.dept_id = d.dept_id GROUP BY - d.parent_id + d.dept_id ) SELECT d.dept_id deptId, @@ -199,7 +200,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" IFNULL(COUNT(ba.id), 0) AS total, IFNULL(SUM(ba.handle_type = 'waiting'), 0) AS todoCount, IFNULL(SUM(ba.handle_type = 'finish'), 0) AS finishCount, - IFNULL(SUM( ba.handle_type = 'invalid' ),0) AS cancelCount + IFNULL(SUM( ba.handle_type = 'cancel' ),0) AS cancelCount FROM months m LEFT JOIN business_alert ba ON DATE_FORMAT(ba.create_time, '%Y-%m') = DATE_FORMAT(m.dateMonth, '%Y-%m') @@ -220,37 +221,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ), sub_depts AS ( - SELECT - sda.dept_id, - sda.parent_id, - sda.tenant_id - FROM - dk_cloud.sys_dept sda - WHERE - sda.parent_id IN (SELECT dd.dept_id FROM districts dd) + -- 第一级子部门(包含 dept_name) + SELECT dept_id, dept_name, parent_id, tenant_id + FROM dk_cloud.sys_dept + + + parent_id = #{param.deptId} + + + parent_id in (select dsd.dept_id from dk_cloud.sys_dept dsd where dsd.parent_id = '0') + + UNION ALL - SELECT - d.dept_id, - d.parent_id, - d.tenant_id - FROM - dk_cloud.sys_dept d + -- 递归查询下级部门(同样包含 dept_name) + SELECT d.dept_id, d.dept_name, d.parent_id, d.tenant_id + FROM dk_cloud.sys_dept d INNER JOIN sub_depts st ON d.parent_id = st.dept_id ), warning_summary AS ( SELECT - d.parent_id AS district_id, + d.dept_id AS district_id, COUNT(ba.id) AS total_warnings, IFNULL(SUM(handle_type = 'waiting'), 0) AS todoCount, IFNULL(SUM(handle_type = 'finish'), 0) AS finishCount, - IFNULL(SUM(ba.handle_type = 'invalid'), 0) AS cancelCount + IFNULL(SUM(ba.handle_type = 'cancel'), 0) AS cancelCount FROM business_alert ba INNER JOIN sub_depts d ON ba.dept_id = d.dept_id AND ba.handle_type != 'verify' GROUP BY - d.parent_id + d.dept_id ) SELECT d.dept_id deptId, @@ -310,7 +311,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" COUNT(DISTINCT ba.id) AS total, IFNULL(SUM( ba.handle_type = 'waiting' ),0) AS todoCount, IFNULL(SUM( ba.handle_type = 'finish' ),0) AS finishCount, - IFNULL(SUM( ba.handle_type = 'invalid' ),0) AS cancelCount + IFNULL(SUM( ba.handle_type = 'cancel' ),0) AS cancelCount FROM month_department md LEFT JOIN business_alert ba ON md.dept_id = ba.dept_id @@ -324,7 +325,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select COUNT(DISTINCT ba.id) AS total, IFNULL(SUM( ba.handle_type = 'waiting' ),0) AS todoCount, IFNULL(SUM( ba.handle_type = 'finish' ),0) AS finishCount, - IFNULL(SUM( ba.handle_type = 'invalid' ),0) AS cancelCount + IFNULL(SUM( ba.handle_type = 'cancel' ),0) AS cancelCount from business_alert ba where 1=1 @@ -428,13 +429,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select ba.label_en labelEn, + ba.images images, ba.label_cn labelCn, ba.create_time createTime, + ba.handle_type handleType, + ba.lat, + ba.lng, b.flow_status flowStatus, b.business_id businessId, b.id instanceId diff --git a/dk-modules/system/src/main/java/org/dromara/system/controller/system/AiLabelController.java b/dk-modules/system/src/main/java/org/dromara/system/controller/system/AiLabelController.java index cb13acb..8b4fa47 100644 --- a/dk-modules/system/src/main/java/org/dromara/system/controller/system/AiLabelController.java +++ b/dk-modules/system/src/main/java/org/dromara/system/controller/system/AiLabelController.java @@ -43,7 +43,6 @@ public class AiLabelController extends BaseController { @SaCheckPermission("system:label:list") @GetMapping("/list") public TableDataInfo list(AiLabelBo bo, PageQuery pageQuery) { - pageQuery.setPageSize(30); return aiLabelService.queryPageList(bo, pageQuery); } diff --git a/dk-modules/workflow/src/main/java/org/dromara/workflow/handler/FlwAlertHandler.java b/dk-modules/workflow/src/main/java/org/dromara/workflow/handler/FlwAlertHandler.java index 3554140..bbae4a6 100644 --- a/dk-modules/workflow/src/main/java/org/dromara/workflow/handler/FlwAlertHandler.java +++ b/dk-modules/workflow/src/main/java/org/dromara/workflow/handler/FlwAlertHandler.java @@ -34,7 +34,11 @@ public class FlwAlertHandler implements FlwCommonHandler { @EventListener(condition = "#processEvent.flowCode.startsWith('alert')") @Override public void processHandler(ProcessEvent processEvent) { - alertService.updateAlertStatus(processEvent.getBusinessId(),processEvent.getStatus(),processEvent.getIsIllegal(),processEvent.getAlertType(),null,null); + String message = null; + if (ObjectUtil.isNotEmpty(processEvent.getParams())){ + message = processEvent.getParams().get("message").toString(); + } + alertService.updateAlertStatus(processEvent.getBusinessId(),processEvent.getStatus(),processEvent.getIsIllegal(),processEvent.getAlertType(),message,null); } /** diff --git a/dk-modules/workflow/src/main/java/org/dromara/workflow/service/impl/FlwInstanceServiceImpl.java b/dk-modules/workflow/src/main/java/org/dromara/workflow/service/impl/FlwInstanceServiceImpl.java index 62bf673..3e5152c 100644 --- a/dk-modules/workflow/src/main/java/org/dromara/workflow/service/impl/FlwInstanceServiceImpl.java +++ b/dk-modules/workflow/src/main/java/org/dromara/workflow/service/impl/FlwInstanceServiceImpl.java @@ -256,7 +256,8 @@ public class FlwInstanceServiceImpl implements IFlwInstanceService { WorkflowUtils.deleteRunTask(StreamUtils.toList(currentTaskList, Task::getId)); } } - + //删除流程实例 + this.deleteByInstanceIds(List.of(instance.getId())); } catch (Exception e) { log.error("撤销失败: {}", e.getMessage(), e); throw new ServiceException(e.getMessage());