From 3506585acaeba8cb2b54d9fcc7943064f676274b Mon Sep 17 00:00:00 2001 From: yangwei <867012372@qq.com> Date: Thu, 27 Mar 2025 17:31:12 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=201=E3=80=81=E5=BC=80=E5=8F=91=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=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 --- .../system/api/RemoteLabelPostService.java | 1 + .../system/api/domain/vo/RemotePostVo.java | 8 +- .../BusinessAlertStatisticsController.java | 30 +++- .../business/mapper/BusinessAlertMapper.java | 10 ++ .../service/IBusinessAlertService.java | 3 + .../IBusinessAlertStatisticsService.java | 1 + .../impl/BusinessAlertServiceImpl.java | 105 ++++++++++++- .../BusinessAlertStatisticsServiceImpl.java | 142 +++++++++++++++--- .../mapper/business/BusinessAlertMapper.xml | 102 ++++++++++++- .../dubbo/RemoteLabelPostServicelmpl.java | 13 ++ .../system/dubbo/RemotePostServiceImpl.java | 15 +- .../system/mapper/AiLabelPostMapper.java | 3 + .../dromara/system/mapper/SysDeptMapper.java | 2 +- .../system/service/IAiLabelPostService.java | 2 + .../service/impl/AiLablePostServiceImpl.java | 7 + .../mapper/system/AiLabelPostMapper.xml | 4 + 16 files changed, 413 insertions(+), 35 deletions(-) diff --git a/dk-api/api-system/src/main/java/org/dromara/system/api/RemoteLabelPostService.java b/dk-api/api-system/src/main/java/org/dromara/system/api/RemoteLabelPostService.java index 5bfa201..33dabb0 100644 --- a/dk-api/api-system/src/main/java/org/dromara/system/api/RemoteLabelPostService.java +++ b/dk-api/api-system/src/main/java/org/dromara/system/api/RemoteLabelPostService.java @@ -18,4 +18,5 @@ public interface RemoteLabelPostService { * */ List selectLabelByList(String postCode, Long deptId); + List getAiLabelList(); } diff --git a/dk-api/api-system/src/main/java/org/dromara/system/api/domain/vo/RemotePostVo.java b/dk-api/api-system/src/main/java/org/dromara/system/api/domain/vo/RemotePostVo.java index 99f83ac..bb868aa 100644 --- a/dk-api/api-system/src/main/java/org/dromara/system/api/domain/vo/RemotePostVo.java +++ b/dk-api/api-system/src/main/java/org/dromara/system/api/domain/vo/RemotePostVo.java @@ -2,14 +2,20 @@ package org.dromara.system.api.domain.vo; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; +import lombok.NoArgsConstructor; import org.dromara.common.excel.annotation.ExcelDictFormat; import org.dromara.common.excel.convert.ExcelDictConvert; import java.io.Serial; +import java.io.Serializable; import java.util.Date; @Data -public class RemotePostVo { +@NoArgsConstructor +public class RemotePostVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; /** * 岗位ID 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 279dbd9..42b1a93 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 @@ -4,8 +4,10 @@ import cn.hutool.core.lang.Dict; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; +import org.dromara.business.domain.BusinessAlert; import org.dromara.business.domain.bo.BusinessAlertBo; import org.dromara.business.domain.model.StatObj; +import org.dromara.business.service.IBusinessAlertService; import org.dromara.business.service.IBusinessAlertStatisticsService; import org.dromara.common.core.domain.R; import org.dromara.common.web.core.BaseController; @@ -27,6 +29,8 @@ public class BusinessAlertStatisticsController extends BaseController { private final IBusinessAlertStatisticsService statisticsService; + private final IBusinessAlertService businessAlertService; + @Operation(summary="panel看板数据", description="panel看板数据") @GetMapping(value = "/panel/count") @@ -88,10 +92,34 @@ public class BusinessAlertStatisticsController extends BaseController { */ @Operation(summary="出警效率", description="出警效率") @GetMapping(value = "/handler/rate") - public R> handlerRate(BusinessAlertBo businessAlertBo,Dict dict) { + public R> handlerRate(BusinessAlertBo businessAlertBo) { return R.ok(statisticsService.handlerRate(businessAlertBo)); } + /** + * 综治管理 + * @param businessAlertBo + * @return + */ + @Operation(summary="综治管理", description="综治管理") + @GetMapping(value = "/comprehensive/manage") + public R> comprehensiveManage(BusinessAlertBo businessAlertBo) { + return R.ok(statisticsService.comprehensiveManage(businessAlertBo)); + } + + /** + * 预警信息 + * @param businessAlertBo + * @return + */ + @Operation(summary="预警信息", description="预警信息") + @GetMapping(value = "/alert/list") + public R>> listAlert(BusinessAlertBo businessAlertBo) { + return R.ok(businessAlertService.listAlert(businessAlertBo)); + } + + + //饼图显示每个月根据部门 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 335f53a..1b03b01 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 @@ -78,4 +78,14 @@ public interface BusinessAlertMapper extends BaseMapperPlus countCurrentDayAlert(@Param("param") BusinessAlertBo businessAlertBo); Map handlerRate(@Param("param") BusinessAlertBo businessAlertBo,@Param("month") String month); + + Map countPastYearAlert(@Param("param") BusinessAlertBo businessAlertBo,@Param("startTime") String startTime,@Param("endTime") String endTime); + + List> countAiLabel(@Param("param") BusinessAlertBo businessAlertBo,@Param("startTime") String startTime,@Param("endTime") String endTime); + + Integer countStreetAlert(@Param("param") BusinessAlertBo businessAlertBo,@Param("startTime") String startTime,@Param("endTime") String endTime); + + List listAlert(@Param("param") BusinessAlertBo businessAlertBo,@Param("startTime") String startTime,@Param("endTime") String endTime); + + Integer countStreetRateAlert(@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/IBusinessAlertService.java b/dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertService.java index 0be6d43..282c879 100644 --- a/dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertService.java +++ b/dk-modules/business/src/main/java/org/dromara/business/service/IBusinessAlertService.java @@ -6,6 +6,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.PageQuery; import java.util.List; +import java.util.Map; /** * 预警任务Service接口 @@ -65,4 +66,6 @@ public interface IBusinessAlertService { void updateAlertStatus(String businessId, String flowStatus,Boolean isIllegal,String alertType,String message,String assignName); TableDataInfo getInfo(BusinessAlertBo bo, PageQuery pageQuery, String alertCode); + + List> listAlert(BusinessAlertBo businessAlertBo); } 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 11b8a2c..3579eae 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 @@ -32,4 +32,5 @@ public interface IBusinessAlertStatisticsService { List handlerRate(BusinessAlertBo businessAlertBo); + Map comprehensiveManage(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 c82409b..912a0c8 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 @@ -25,6 +25,8 @@ import org.dromara.workflow.api.RemoteWorkflowService; import org.springframework.stereotype.Service; import java.lang.reflect.Method; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; import java.util.Collections; import java.util.Date; import java.util.List; @@ -146,6 +148,10 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { public TableDataInfo pageBusinessAlertAll(BusinessAlertBo bo, PageQuery pageQuery) { QueryWrapper wrapper = buildQueryWrapper(bo); + if (ObjectUtil.isEmpty(wrapper)){ + return new TableDataInfo<>(); + } + Page page = this.baseMapper.pageBusinessAlert(pageQuery.build(), wrapper); return TableDataInfo.build(page); @@ -162,6 +168,10 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { bo.setHandleType(BusinessStatusEnum.INVALID.getStatus()); QueryWrapper wrapper = buildQueryWrapper(bo); + if (ObjectUtil.isEmpty(wrapper)){ + return new TableDataInfo<>(); + } + wrapper.in("t.flowStatus", BusinessStatusEnum.INVALID.getStatus()); Page page = this.baseMapper.pageBusinessAlertCancel(pageQuery.build(), wrapper); @@ -179,6 +189,11 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { @Override public TableDataInfo pageBusinessAlertFinish(BusinessAlertBo bo, PageQuery pageQuery) { QueryWrapper wrapper = buildQueryWrapper(bo); + + if (ObjectUtil.isEmpty(wrapper)){ + return new TableDataInfo<>(); + } + wrapper.notIn("t.flowStatus", BusinessStatusEnum.INVALID.getStatus()); wrapper.apply(" EXISTS(select * from dk_workflow.flow_his_task ht where ht.approver ='" + LoginHelper.getUserId() + "' and ht.instance_id = t.instanceId)"); @@ -199,6 +214,10 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { public TableDataInfo pageBusinessAlertTodo(BusinessAlertBo bo, PageQuery pageQuery) { QueryWrapper wrapper = buildQueryWrapper(bo); + if (ObjectUtil.isEmpty(wrapper)){ + return new TableDataInfo<>(); + } + wrapper.eq("t.node_type", 1); wrapper.in("t.approver", remoteWorkflowService.getPermissions()); wrapper.in("t.flow_status", BusinessStatusEnum.WAITING.getStatus()); @@ -230,12 +249,17 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { private QueryWrapper buildQueryWrapper(BusinessAlertBo bo) { QueryWrapper wrapper = new QueryWrapper<>(); - //根据当前用户职能获取识别类型 - List postVoList = remoteLablePostService.selectLabelByList(bo.getPostCode(), LoginHelper.getDeptId()); + if (ObjectUtil.isNotEmpty(bo.getPostCode())){ + //根据当前用户职能获取识别类型 + List postVoList = remoteLablePostService.selectLabelByList(bo.getPostCode(), LoginHelper.getDeptId()); + if (ObjectUtil.isEmpty(postVoList)) { + return null; + } - if (ObjectUtil.isNotEmpty(postVoList)) { - wrapper.in("t.label_en",StreamUtils.toList(postVoList, RemoteAiLabelPostVo::getLabelEn)); + if (ObjectUtil.isNotEmpty(postVoList)) { + wrapper.in("t.label_en",StreamUtils.toList(postVoList, RemoteAiLabelPostVo::getLabelEn)); + } } //排除状态为验证状态预警 @@ -254,7 +278,7 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { wrapper.eq("DATE_FORMAT(t.create_time, '%Y-%m-%d')", bo.getCreateTime()); } - wrapper.orderByAsc("t.create_time"); + wrapper.orderByDesc("t.create_time","t.complete_date"); return wrapper; } @@ -284,4 +308,75 @@ public class BusinessAlertServiceImpl implements IBusinessAlertService { } return null; } + + + @Override + public List> listAlert(BusinessAlertBo businessAlertBo) { + List> resultList = new ArrayList<>(); + + //生成近一周开始时间、结束时间 + List dayList = getLastSixDays(); + String startTime = dayList.get(dayList.size() - 1); + String endTime = dayList.get(0); + + //查看的是总览的预警信息 + if (ObjectUtil.isEmpty(businessAlertBo.getPostCode())) { + Map result = new HashMap<>(); + + result.put("date", startTime + "~" + endTime); + + result.put("list",this.baseMapper.listAlert(businessAlertBo,startTime,endTime)); + + resultList.add(result); + + return resultList; + } + + //不是空的话查看是对应各局的 + List postVoList = remoteLablePostService.selectLabelByList(businessAlertBo.getPostCode(), LoginHelper.getDeptId()); + + postVoList.forEach(postVo -> { + Map result = new HashMap<>(); + + businessAlertBo.setAiLabelEnList(List.of(postVo.getLabelEn())); + + Map handlerMap = new HashMap<>(); + + 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()); + + result.put("panel",handlerMap); + + result.put("list",alertList); + + result.put("date", startTime + "~" + endTime); + + resultList.add(result); + }); + + + return resultList; + + } + + + public static List getLastSixDays() { + List days = new ArrayList<>(7); + LocalDate currentDate = LocalDate.now(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + + for (int i = 0; i < 7; i++) { + LocalDate date = currentDate.minusDays(i); + days.add(date.format(formatter)); + } + + return days; + } + + public static void main(String[] args) { + System.out.println(getLastSixDays()); + } } 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 5736142..dc6fbd6 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 @@ -8,6 +8,7 @@ import org.dromara.business.domain.bo.BusinessAlertBo; import org.dromara.business.domain.model.StatObj; import org.dromara.business.mapper.BusinessAlertMapper; import org.dromara.business.service.IBusinessAlertStatisticsService; +import org.dromara.common.core.exception.ServiceException; import org.dromara.common.satoken.utils.LoginHelper; import org.dromara.system.api.RemoteDeptService; import org.dromara.system.api.RemoteLabelPostService; @@ -45,6 +46,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist @DubboReference RemotePostService remotePostService; + /** * 按照月份分类预警数量(包含权限) * @param businessAlertBo @@ -129,7 +131,13 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist @Override public List countPanelAlert(BusinessAlertBo businessAlertBo) { - businessAlertBo.setAiLabelEnList(getAiLabel(businessAlertBo.getPostCode())); + if (ObjectUtil.isNotEmpty(businessAlertBo.getPostCode())){ + LocalDate today = LocalDate.now(); + + businessAlertBo.setCreateTime(today.getYear()+"-"+today.getMonthValue()+"-"+today.getDayOfMonth()); + businessAlertBo.setAiLabelEnList(getAiLabel(businessAlertBo.getPostCode())); + } + List> mapList = baseMapper.countPanelAlert(businessAlertBo); return mapList.stream() @@ -157,12 +165,15 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist @Override public Map countPanelTotalAlert(BusinessAlertBo businessAlertBo) { Map result = new HashMap<>(); - List labelList = getAiLabel(businessAlertBo.getPostCode()); - businessAlertBo.setAiLabelEnList(labelList); - //2024一直到当前年份处理预警个数 + if (ObjectUtil.isNotEmpty(businessAlertBo.getPostCode())){ + List labelList = getAiLabel(businessAlertBo.getPostCode()); + businessAlertBo.setAiLabelEnList(labelList); + } + + // 1、2024一直到当前年份处理预警个数 Integer totalFinishCount = baseMapper.countFromOldToCurrent(businessAlertBo); result.put("totalFinishCount", totalFinishCount); - //今年处理率 今年的预警总数 今年处理个数 + //2、今年处理率 今年的预警总数 今年处理个数 Map currentYearMap = baseMapper.countCurrentAlert(businessAlertBo); // 四舍五入保留两位小数 double yearTotal = Double.parseDouble(String.valueOf(currentYearMap.get("total"))); @@ -173,7 +184,7 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist result.put("yearFinishCount", currentYearMap.get("finishCount")); result.put("yearRate", currentYearAverage); - //本月处理率 本月预警总数 本月处理个数 + //3、本月处理率 本月预警总数 本月处理个数 Map monthMap = baseMapper.countMonthAlert(businessAlertBo); // 四舍五入保留两位小数 @@ -186,6 +197,13 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist result.put("monthFinishCount", monthMap.get("finishCount")); result.put("monthRate", currentMonthAverage); + //4、今日预警总数 今日处理个数 今日未处理个数 + Map dayMap = this.baseMapper.countCurrentDayAlert(businessAlertBo); + + result.put("dayTotal", dayMap.get("total")); + result.put("dayFinishCount", dayMap.get("finishCount")); + result.put("dayTodo", dayMap.get("todoCount")); + return result; } @@ -197,8 +215,11 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist @Override public Map countCurrentDayAlert(BusinessAlertBo businessAlertBo) { Map result = new HashMap<>(); - List labelList = getAiLabel(businessAlertBo.getPostCode()); - businessAlertBo.setAiLabelEnList(labelList); + + if (ObjectUtil.isNotEmpty(businessAlertBo.getPostCode())){ + List labelList = getAiLabel(businessAlertBo.getPostCode()); + businessAlertBo.setAiLabelEnList(labelList); + } Map dayMap = this.baseMapper.countCurrentDayAlert(businessAlertBo); @@ -252,12 +273,11 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist postVoList.forEach(postVo -> { List labelList = getAiLabel(postVo.getPostCode()); businessAlertBo.setAiLabelEnList(labelList); - Map dateMap = switch (businessAlertBo.getDateType()) { - case 1 -> baseMapper.countCurrentAlert(businessAlertBo); - case 2 -> baseMapper.countMonthAlert(businessAlertBo); - case 3 -> baseMapper.countCurrentDayAlert(businessAlertBo); - default -> baseMapper.countCurrentAlert(businessAlertBo); - }; + List monthList = getLastSixMonths(); + String startTime = monthList.get(monthList.size() - 1); + String endTime = monthList.get(0); + + Map dateMap = baseMapper.countPastYearAlert(businessAlertBo,startTime,endTime); result.add(new StatObj( postVo.getPostName(), @@ -291,11 +311,20 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist List statObjs = new ArrayList<>(); postVoList.forEach(postVo -> { List labelList = getAiLabel(postVo.getPostCode()); - businessAlertBo.setAiLabelEnList(labelList); - Map rateMap = baseMapper.handlerRate(businessAlertBo,month); StatObj statObj1 = new StatObj(); - statObj1.setStatKey(postVo.getPostName()); - statObj1.setStatVal(rateMap.get("avgInfo")); + if (ObjectUtil.isEmpty(labelList)){ + statObj1.setStatVal(0); + }else { + businessAlertBo.setAiLabelEnList(labelList); + Map rateMap = baseMapper.handlerRate(businessAlertBo,month); + statObj1.setStatKey(postVo.getPostName()); + if (ObjectUtil.isNotEmpty(rateMap)) { + statObj1.setStatVal(rateMap.get("avgInfo")); + }else { + statObj1.setStatVal(0); + } + } + statObjs.add(statObj1); }); statObj.setNextStatList(statObjs); @@ -305,6 +334,83 @@ public class BusinessAlertStatisticsServiceImpl implements IBusinessAlertStatist return result; } + @Override + public Map comprehensiveManage(BusinessAlertBo businessAlertBo) { + if (ObjectUtil.isEmpty(businessAlertBo.getPostCode())) { + throw new ServiceException("【postCode】 岗位编码为空!"); + } + + Map result = new HashMap<>(); + + List aiLabelList = getAiLabel(businessAlertBo.getPostCode()); + businessAlertBo.setAiLabelEnList(aiLabelList); + + List monthList = getLastSixMonths(); + String startTime = monthList.get(monthList.size() - 1); + String endTime = monthList.get(0); + + + List> labelMapList = this.baseMapper.countAiLabel(businessAlertBo,startTime,endTime); + + Map labelMap = new HashMap<>(); + labelMapList.forEach(label -> { + labelMap.put(label.get("labelCn")+ "",label.get("total")); + }); + + //识别类型存储 + result.put("label", labelMap); + + //事件高发区 + Long deptId = LoginHelper.getDeptId(); + //获取街道信息 + List streetList = remoteDeptService.selectListByParentId(String.valueOf(deptId)); + + Map streeMap = new HashMap<>(); + streetList.forEach(street -> { + businessAlertBo.setDeptId(String.valueOf(street.getDeptId())); + Integer alertCount = this.baseMapper.countStreetAlert(businessAlertBo,startTime,endTime); + streeMap.put(street.getDeptName(),alertCount); + }); + + //降序排序,取前五个 + Map top5Map = streeMap.entrySet().stream() + .sorted(Map.Entry.comparingByValue().reversed()) + .limit(5) + .collect(Collectors.toMap( + Map.Entry::getKey, + Map.Entry::getValue, + (e1, e2) -> e1, + LinkedHashMap::new + )); + result.put("streetCount", top5Map); + + //处理效率top5 + Map streeRateMap = new HashMap<>(); + streetList.forEach(street -> { + businessAlertBo.setDeptId(String.valueOf(street.getDeptId())); + Integer alertCount = this.baseMapper.countStreetRateAlert(businessAlertBo,startTime,endTime); + if (ObjectUtil.isEmpty(alertCount)) { + streeRateMap.put(street.getDeptName(),0); + }else { + streeRateMap.put(street.getDeptName(),alertCount); + } + }); + + Map streeRatetop5Map = streeRateMap.entrySet().stream() + .sorted(Map.Entry.comparingByValue().reversed()) + .limit(5) + .collect(Collectors.toMap( + Map.Entry::getKey, + Map.Entry::getValue, + (e1, e2) -> e1, + LinkedHashMap::new + )); + + result.put("handlerRate", streeRatetop5Map); + + return result; + } + /** * 获取近6个月的月份集合(格式:yyyy-MM) */ 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 9009c93..1e80118 100644 --- a/dk-modules/business/src/main/resources/mapper/business/BusinessAlertMapper.xml +++ b/dk-modules/business/src/main/resources/mapper/business/BusinessAlertMapper.xml @@ -13,7 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - and DATE_FORMAT(ba.create_time,'%Y-%m') = DATE_FORMAT(#{param.createTime},'%Y-%m') + and DATE_FORMAT(ba.create_time,'%Y-%m-%d') = #{param.createTime} and ba.dept_id in @@ -387,10 +387,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ORDER BY md.dept_id, md.dateMonth - select - IFNULL(SUM( ba.handle_type = 'finish' ),0) AS finishCount, - IFNULL(SUM( ba.handle_type = 'waiting' ),0) AS todoCount, + COUNT(DISTINCT ba.id) AS total from business_alert ba where 1=1 and = '2024' ]]> @@ -401,7 +400,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select COUNT(DISTINCT ba.id) AS total, IFNULL(SUM( ba.handle_type = 'finish' ),0) AS finishCount, - IFNULL(SUM( ba.handle_type = 'waiting' ),0) AS todoCount, + IFNULL(SUM( ba.handle_type = 'waiting' ),0) AS todoCount from business_alert ba where 1=1 and @@ -430,10 +429,97 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + + + diff --git a/dk-modules/system/src/main/java/org/dromara/system/dubbo/RemoteLabelPostServicelmpl.java b/dk-modules/system/src/main/java/org/dromara/system/dubbo/RemoteLabelPostServicelmpl.java index 592601a..659e667 100644 --- a/dk-modules/system/src/main/java/org/dromara/system/dubbo/RemoteLabelPostServicelmpl.java +++ b/dk-modules/system/src/main/java/org/dromara/system/dubbo/RemoteLabelPostServicelmpl.java @@ -50,4 +50,17 @@ public class RemoteLabelPostServicelmpl implements RemoteLabelPostService { } return new ArrayList<>(); } + + @Override + public List getAiLabelList() { + return aiLabelPostService.getAiLabelList().stream() + .map(aiLabel -> { + RemoteAiLabelPostVo remoteAiLabelPostVo = new RemoteAiLabelPostVo(); + remoteAiLabelPostVo.setLabelId(aiLabel.getLabelId()); + remoteAiLabelPostVo.setLabelEn(aiLabel.getLabelEn()); + remoteAiLabelPostVo.setLabelCn(aiLabel.getLabelCn()); + return remoteAiLabelPostVo; + }) + .collect(Collectors.toList()); + } } diff --git a/dk-modules/system/src/main/java/org/dromara/system/dubbo/RemotePostServiceImpl.java b/dk-modules/system/src/main/java/org/dromara/system/dubbo/RemotePostServiceImpl.java index 7c2795c..c94d62e 100644 --- a/dk-modules/system/src/main/java/org/dromara/system/dubbo/RemotePostServiceImpl.java +++ b/dk-modules/system/src/main/java/org/dromara/system/dubbo/RemotePostServiceImpl.java @@ -4,13 +4,17 @@ import lombok.RequiredArgsConstructor; import org.apache.dubbo.config.annotation.DubboService; import org.dromara.common.core.utils.MapstructUtils; import org.dromara.system.api.RemotePostService; +import org.dromara.system.api.domain.vo.RemoteAiLabelPostVo; import org.dromara.system.api.domain.vo.RemotePostVo; import org.dromara.system.domain.bo.SysPostBo; import org.dromara.system.domain.vo.SysPostVo; import org.dromara.system.service.ISysPostService; +import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; @RequiredArgsConstructor @Service @@ -23,6 +27,15 @@ public class RemotePostServiceImpl implements RemotePostService { @Override public List listPost() { List sysPostVos = sysPostService.selectPostList(new SysPostBo()); - return MapstructUtils.convert(sysPostVos, RemotePostVo.class); + + return sysPostVos.stream() + .map(aiLabel -> { + RemotePostVo remotePostVo = new RemotePostVo(); + remotePostVo.setPostId(aiLabel.getPostId()); + remotePostVo.setPostName(aiLabel.getPostName()); + remotePostVo.setPostCode(aiLabel.getPostCode()); + return remotePostVo; + }) + .collect(Collectors.toList()); } } diff --git a/dk-modules/system/src/main/java/org/dromara/system/mapper/AiLabelPostMapper.java b/dk-modules/system/src/main/java/org/dromara/system/mapper/AiLabelPostMapper.java index 4cd408d..e8daa63 100644 --- a/dk-modules/system/src/main/java/org/dromara/system/mapper/AiLabelPostMapper.java +++ b/dk-modules/system/src/main/java/org/dromara/system/mapper/AiLabelPostMapper.java @@ -19,4 +19,7 @@ public interface AiLabelPostMapper extends BaseMapperPlus selectAiLabelPostPage(@Param("page") Page page, @Param("ew") QueryWrapper wrapper); List queryListByLabel(@Param("postId") Long postId); + + List selectAiLabelPost(); + } diff --git a/dk-modules/system/src/main/java/org/dromara/system/mapper/SysDeptMapper.java b/dk-modules/system/src/main/java/org/dromara/system/mapper/SysDeptMapper.java index 7d942c4..3d0f3e4 100644 --- a/dk-modules/system/src/main/java/org/dromara/system/mapper/SysDeptMapper.java +++ b/dk-modules/system/src/main/java/org/dromara/system/mapper/SysDeptMapper.java @@ -55,7 +55,7 @@ public interface SysDeptMapper extends BaseMapperPlus { */ default List selectListByParentId(Long parentId) { return this.selectList(new LambdaQueryWrapper() - .select(SysDept::getDeptId) + .select(SysDept::getDeptId,SysDept::getDeptName) .apply(DataBaseHelper.findInSet(parentId, "ancestors"))); } diff --git a/dk-modules/system/src/main/java/org/dromara/system/service/IAiLabelPostService.java b/dk-modules/system/src/main/java/org/dromara/system/service/IAiLabelPostService.java index e067c24..9bf3b88 100644 --- a/dk-modules/system/src/main/java/org/dromara/system/service/IAiLabelPostService.java +++ b/dk-modules/system/src/main/java/org/dromara/system/service/IAiLabelPostService.java @@ -73,4 +73,6 @@ public interface IAiLabelPostService { List queryListByLabel(Long postId); Boolean insertByBatchBo(AiLabelPostBindBo aiLablePostBindBo); + + List getAiLabelList(); } diff --git a/dk-modules/system/src/main/java/org/dromara/system/service/impl/AiLablePostServiceImpl.java b/dk-modules/system/src/main/java/org/dromara/system/service/impl/AiLablePostServiceImpl.java index 1ffda2d..b5cc7b5 100644 --- a/dk-modules/system/src/main/java/org/dromara/system/service/impl/AiLablePostServiceImpl.java +++ b/dk-modules/system/src/main/java/org/dromara/system/service/impl/AiLablePostServiceImpl.java @@ -1,5 +1,7 @@ package org.dromara.system.service.impl; +import cn.hutool.core.collection.ListUtil; +import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.mybatis.core.page.TableDataInfo; @@ -160,4 +162,9 @@ public class AiLablePostServiceImpl implements IAiLabelPostService { } return this.baseMapper.insertBatch(resultlist); } + + @Override + public List getAiLabelList() { + return ObjectUtil.isNotEmpty(this.baseMapper.selectAiLabelPost())?this.baseMapper.selectAiLabelPost(): ListUtil.empty(); + } } diff --git a/dk-modules/system/src/main/resources/mapper/system/AiLabelPostMapper.xml b/dk-modules/system/src/main/resources/mapper/system/AiLabelPostMapper.xml index 73ee604..b77464e 100644 --- a/dk-modules/system/src/main/resources/mapper/system/AiLabelPostMapper.xml +++ b/dk-modules/system/src/main/resources/mapper/system/AiLabelPostMapper.xml @@ -11,4 +11,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" SELECT p.*,a.label_cn ,label_en FROM ai_label_post p inner JOIN ai_label a ON p.label_id = a.label_id where p.post_id = #{postId} + +