diff --git a/src/main/java/com/biutag/supervision/controller/subdatav/SubOneGlobalController.java b/src/main/java/com/biutag/supervision/controller/subdatav/SubOneGlobalController.java index 3fa6be4..7a72977 100644 --- a/src/main/java/com/biutag/supervision/controller/subdatav/SubOneGlobalController.java +++ b/src/main/java/com/biutag/supervision/controller/subdatav/SubOneGlobalController.java @@ -1,17 +1,17 @@ package com.biutag.supervision.controller.subdatav; +import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.biutag.supervision.constants.enums.ProblemSourcesEnum; -import com.biutag.supervision.mapper.MailMapper; import com.biutag.supervision.mapper.NegativeMapper; -import com.biutag.supervision.mapper.SupExternalDepartMapper; import com.biutag.supervision.pojo.Result; import com.biutag.supervision.pojo.entity.Negative; -import com.biutag.supervision.pojo.entity.mailbox.Mail; import com.biutag.supervision.pojo.request.subdatav.SubDataVRequest; -import com.biutag.supervision.pojo.vo.*; +import com.biutag.supervision.pojo.vo.EchartsVo; +import com.biutag.supervision.pojo.vo.GlobalMapIconVo; +import com.biutag.supervision.pojo.vo.MailOverviewVo; +import com.biutag.supervision.pojo.vo.StrongProblemRank; import com.biutag.supervision.service.CountyStreetDeptService; import com.biutag.supervision.service.DataMailService; import com.biutag.supervision.service.NegativeService; @@ -39,15 +39,11 @@ import java.util.List; @Slf4j public class SubOneGlobalController { - private final String VALID_SIGN = "terminated"; // 有效标识 - private final String EX_SOURCE = "局长信箱"; // 映射来源 private final NegativeMapper negativeMapper; private final CountyStreetDeptService countyStreetDeptService; private final DataMailService dataMailService; private final NegativeService negativeService; - private final MailMapper mailMapper; - private final SupExternalDepartMapper externalDepartMapper; @Resource @@ -63,14 +59,12 @@ public class SubOneGlobalController { */ @Operation(summary = "获取二级大屏地图JSON") @GetMapping("/getSubOneStreetMap") -// @Cacheable(cacheNames = "subOneStreetMap", key = "'p_'+ #departId") public Result getSubOneStreetMap(@RequestParam Integer departId) { JSONObject res = countyStreetDeptService.getSubOneStreetMap(departId); return Result.success(res); } - //region 左边 @Operation(summary = "机构问题排名") @PostMapping("/getSubOneOrganizationRank") public Result getSubOneOrganizationRank(@RequestBody SubDataVRequest request) { @@ -79,66 +73,17 @@ public class SubOneGlobalController { - /** - * 业务类型占比 - * - * @param departId 2级单位的id - * @param beginTime 开始时间 - * @param endTime 结束时间 - * @return Result - */ + @Operation(summary = "业务类型占比") @GetMapping("/getSubOneBusinessRate") public Result getSubOneBusinessRate(@RequestParam Integer departId, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { - // 业务类型占比 + endTime = DateUtil.endOfDay(endTime); List ywzblist = negativeMapper.selectSubOneBusinessRate(departId, beginTime, endTime); JSONObject res = new JSONObject().fluentPut("ywzblist", ywzblist); return Result.success(res); } - //endregion - - - //region 中间 - - /** - * 获取首页大屏中央数据 - * - * @param departId 2级单位的id - * @param beginTime 开始时间 - * @param endTime 结束时间 - * @return Result - */ - @Operation(summary = "大屏中央数据") - @GetMapping("/getSubOneAllCount") - public Result getSubOneAllCount(@RequestParam Integer departId, - @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, - @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { - // 获取数据大屏中央总数概览 - GlobalOverViewVo overview = negativeMapper.getSuoOneAllGlobalCount(departId, beginTime, endTime); - - MailOverviewVo vo = dataMailService.mailCount(departId,beginTime, endTime); - - QueryWrapper subOneMailQueryWrapper = new QueryWrapper<>(); - String exDepartId = externalDepartMapper.getExIdByInId(departId.toString(), "局长信箱"); - subOneMailQueryWrapper.ne("mail_state", VALID_SIGN); - subOneMailQueryWrapper.eq("second_dept_id", exDepartId); - subOneMailQueryWrapper.between("mail_time", beginTime, endTime); - Long mailboxNumber = mailMapper.selectCount(subOneMailQueryWrapper); - // todo 局长信箱 -// long mailboxNumber = negativeService.count(new LambdaQueryWrapper() -// .between(Negative::getCrtTime, beginTime, endTime) -// .eq(Negative::getProblemSourcesCode, ProblemSourcesEnum.JZXX.getValue()) -// .eq(Negative::getSecondInvolveDepartId,departId) -// ); - overview.setMailboxNumber(mailboxNumber); - overview.setComplaintPro(vo.getCountryMail() + vo.getPoliceMail() + vo.getNumberMail()); - - - JSONObject data = new JSONObject().fluentPut("overview", overview); - return Result.success(data); - } @Operation(summary = "大屏中央数据") @PostMapping("/getSubOneAllCount") @@ -146,17 +91,9 @@ public class SubOneGlobalController { return subDatavService.getSubOneAllCount(request); } - /** - * 地图数据 - * - * @param departId 2级单位的id - * @param beginTime 开始时间 - * @param endTime 结束时间 - * @return Result - */ + @Operation(summary = "首页大屏地图数据") @GetMapping("/getSubOneGlobalMap") -// @Cacheable(cacheNames = "Supervision:Screen:SubOneGlobalMap", key = "#departId+'_'+#beginTime.getTime()+'_'+#endTime.getTime()") public Result getSubOneMap(@RequestParam Integer departId, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { @@ -179,38 +116,22 @@ public class SubOneGlobalController { } - /** - * 数据大屏问题趋势统计 - * - * @param departId 2级单位的id - * @param year 年份 - * @return Result - */ @Operation(summary = "数据大屏问题趋势统计") @GetMapping("/getSubOneGlobalTrend") public Result getSubOneGlobalTrend(@RequestParam Integer departId, @RequestParam Integer year) { - List GlobalRecentlyTrendList = negativeMapper.getSubOneTrend(departId.toString(), year.toString(), "2", "13", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "27", "28", "29", "30"); + List GlobalRecentlyTrendList = negativeMapper.getSubOneTrend(departId.toString(), year.toString()); JSONObject jsonObject = new JSONObject().fluentPut("globalRecentlyTrendList", GlobalRecentlyTrendList); return Result.success(jsonObject); } - //endregion - //region 右边 - /** - * 突出问题排名 - * - * @param departId 2级单位的id - * @param beginTime 开始时间 - * @param endTime 结束时间 - * @return Result - */ @Operation(summary = "突出问题排名") @GetMapping("/getSubOneStrongProblemRate") public Result getSubOneStrongProblemRate(@RequestParam Integer departId, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { + endTime = DateUtil.endOfDay(endTime); // 突出问题排名 List tcwtlist = negativeMapper.selectSubOneStrongProblemRank(departId, beginTime, endTime); for (int i = 1; i <= tcwtlist.size(); i++) { @@ -221,25 +142,18 @@ public class SubOneGlobalController { } - /** - * 问题类型占比 - * - * @param departId 2级单位的id - * @param beginTime 开始时间 - * @param endTime 结束时间 - * @return Result - */ + @Operation(summary = "问题类型占比") @GetMapping("/getSubOneProblemBusinessRate") public Result getSubOneProblemBusinessRate(@RequestParam Integer departId, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { // 问题类型占比 + endTime = DateUtil.endOfDay(endTime); List wtlxlist = negativeMapper.selectSubOneProblemRate(departId, beginTime, endTime); JSONObject res = new JSONObject().fluentPut("wtlxlist", wtlxlist); return Result.success(res); } - //endregion } diff --git a/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java b/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java index 1792dce..d112da5 100644 --- a/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java +++ b/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java @@ -47,16 +47,6 @@ public interface NegativeMapper extends BaseMapper { "WHERE crtTime BETWEEN #{beginTime} and #{endTime} " + "GROUP BY businessTypeName") List selectBusinessRate(Date beginTime, Date endTime); - @Select("SELECT " + - "COALESCE(SUM(IF(problemSourcesCode IN (13), 1, 0)), 0) AS supervisionPro, " + - "COALESCE(SUM(IF(problemSourcesCode IN (14,15,16), 1, 0)), 0) AS numSupervisionPro, " + - "COALESCE(SUM(IF(problemSourcesCode IN (17,18,19,20), 1, 0)), 0) AS caseVerificationPro, " + - "COALESCE(SUM(IF(problemSourcesCode IN (27,28,29,30), 1, 0)), 0) AS auditPro, " + - "COALESCE(SUM(IF(problemSourcesCode IN (2), 1, 0)), 0) AS talkPro " + - "FROM negative ng WHERE ng.crtTime BETWEEN #{beginTime} AND #{endTime} " + - "AND ng.handle_second_depart_id=#{departId} ") -// "COALESCE(SUM(IF(problemSourcesCode IN (27, 28, 29, 30), 1, 0)), 0) AS auditPro " + - GlobalOverViewVo getSuoOneAllGlobalCount(Integer departId, Date beginTime, Date endTime); @@ -91,7 +81,7 @@ public interface NegativeMapper extends BaseMapper { "count(*) `value` " + "FROM negative_problem_relation npr INNER JOIN negative ng ON npr.negativeId=ng.id " + "WHERE npr.threeLevelContent is not NULL " + - "AND checkStatus IN (1, 2) " + + "AND ng.check_status_code IN (1, 2, 3) " + "AND crtTime BETWEEN #{beginTime} AND #{endTime} " + "GROUP BY npr.threeLevelContent " + "ORDER BY `value` desc " + @@ -244,7 +234,7 @@ public interface NegativeMapper extends BaseMapper { List getMailTrend(Integer year, Integer type); - List getSubOneTrend(String departId, String year, String... args); + List getSubOneTrend(String departId, String year); @@ -252,10 +242,12 @@ public interface NegativeMapper extends BaseMapper { @Select("SELECT " + "businessTypeName as name, " + "count(*) value " + - "FROM negative " + - "WHERE checkStatus in (1, 2) " + - "AND crtTime BETWEEN #{beginTime} AND #{endTime} " + - "AND negative.second_involve_depart_id=#{departId} " + + "FROM negative ng " + + "LEFT JOIN sup_depart sd on ng.involveDepartId = sd.id " + + "LEFT JOIN sup_depart sdd on sd.pid = sdd.id " + + "LEFT JOIN sup_depart sddd on sdd.pid = sddd.id " + + "WHERE crtTime >= #{beginTime} AND crtTime < #{endTime} " + + "AND (sd.id = #{departId} or sdd.id= #{departId} or sddd.id = #{departId} ) " + "GROUP BY businessTypeName") List selectSubOneBusinessRate(Integer departId, Date beginTime, Date endTime); @@ -285,10 +277,13 @@ public interface NegativeMapper extends BaseMapper { "npr.threeLevelContent as label, " + "count(*) `value` " + "FROM negative_problem_relation npr INNER JOIN negative ng ON npr.negativeId=ng.id " + - "WHERE npr.threeLevelContent is not NULL " + - "AND checkStatus IN (1, 2) " + + "LEFT JOIN sup_depart sd on ng.involveDepartId = sd.id " + + "LEFT JOIN sup_depart sdd on sd.pid = sdd.id " + + "LEFT JOIN sup_depart sddd on sdd.pid = sddd.id " + "AND crtTime BETWEEN #{beginTime} AND #{endTime}" + - "AND ng.second_involve_depart_id=#{departId} " + + "WHERE npr.threeLevelContent is not NULL " + + "AND ng.check_status_code IN (1, 2, 3) " + + "AND (sd.id = #{departId} or sdd.id= #{departId} or sddd.id = #{departId} ) " + "GROUP BY npr.threeLevelContent " + "ORDER BY `value` desc " + " LIMIT 10 OFFSET 1") @@ -299,10 +294,13 @@ public interface NegativeMapper extends BaseMapper { "count(*) `value` " + "FROM negative_problem_relation npr " + "LEFT JOIN negative ng ON ng.id=npr.negativeId " + - "WHERE checkStatus in (1,2) " + - "AND crtTime BETWEEN #{beginTime} AND #{endTime} " + + "LEFT JOIN sup_depart sd on ng.involveDepartId = sd.id " + + "LEFT JOIN sup_depart sdd on sd.pid = sdd.id " + + "LEFT JOIN sup_depart sddd on sdd.pid = sddd.id " + + "WHERE ng.check_status_code IN (1, 2, 3) " + + "AND crtTime >= #{beginTime} < #{endTime} " + "AND npr.oneLevelContent is not NULL " + - "AND ng.second_involve_depart_id=#{departId} " + + "AND (sd.id = #{departId} or sdd.id= #{departId} or sddd.id = #{departId} ) " + "GROUP BY npr.oneLevelContent " + "ORDER BY `value` desc") List selectSubOneProblemRate(Integer departId, Date beginTime, Date endTime); diff --git a/src/main/java/com/biutag/supervision/service/subDatav/SubDatavServiceImpl.java b/src/main/java/com/biutag/supervision/service/subDatav/SubDatavServiceImpl.java index 7ffb64a..ec65c3b 100644 --- a/src/main/java/com/biutag/supervision/service/subDatav/SubDatavServiceImpl.java +++ b/src/main/java/com/biutag/supervision/service/subDatav/SubDatavServiceImpl.java @@ -94,7 +94,6 @@ public class SubDatavServiceImpl implements SubDatavService { @Resource private AccountabilityCountUtil accountabilityCountUtil; - private static final BigDecimal WAN = new BigDecimal("10000"); private final String VALID_SIGN = "terminated"; private final String EX_SOURCE = "局长信箱"; @@ -104,22 +103,56 @@ public class SubDatavServiceImpl implements SubDatavService { // 问题排名 @Override public Result getSubOneOrganizationRank(SubDataVRequest request) { - SupDepartQueryParam supDepartQueryParam = new SupDepartQueryParam(); - supDepartQueryParam.setPid(request.getDepartId()); - List query = supDepartResourceService.query(supDepartQueryParam); + List fxsjlist = new ArrayList<>(); + List jsdwlist = new ArrayList<>(); + SupDepartQueryParam supDepartGroupParam = new SupDepartQueryParam(); + supDepartGroupParam.setLevel("3"); + supDepartGroupParam.setPid(request.getDepartId()); + List supDepartList = supDepartResourceService.query(supDepartGroupParam); + // 派出所 + List pcsList = supDepartList.stream() + .filter(one -> StrUtil.isNotBlank(one.getStatisticsGroupId())) + .filter(one -> DepartGroupEnum.PCS.getId().equals(Integer.valueOf(one.getStatisticsGroupId()))) + .toList(); + // 大队 + List dwList = supDepartList.stream() + .filter(one -> { + String groupId = one.getStatisticsGroupId(); + return !StrUtil.isNotBlank(groupId) + || !DepartGroupEnum.PCS.getId().equals(Integer.valueOf(groupId)); + }) + .toList(); - Set pcsSet = query.stream().filter(one -> "10".equals(one.getStatisticsGroupId())).map(SupDepart::getId).collect(Collectors.toSet()); - Set ddSet = query.stream().filter(one -> !"10".equals(one.getStatisticsGroupId())).map(SupDepart::getId).collect(Collectors.toSet()); - List dates = Arrays.asList(request.getBeginTime(), request.getEndTime()); - NegativeOrganizationRankQueryParam pcsParam = new NegativeOrganizationRankQueryParam(); - pcsParam.setCrtTime(dates); - pcsParam.setInvolveDepartIds(pcsSet); - List fxsjlist = negativeResourceService.getOrganizationRank(pcsParam); - NegativeOrganizationRankQueryParam ddParam = new NegativeOrganizationRankQueryParam(); - ddParam.setCrtTime(dates); - ddParam.setInvolveDepartIds(ddSet); - List jsdwlist = negativeResourceService.getOrganizationRank(ddParam); + for (SupDepart pcs : pcsList) { + List negatives = negativeMapper.getNegativeListData(pcs.getId(), request.getBeginTime(), request.getEndTime(), ALL); + if (negatives.isEmpty()) { + continue; + } + OrganizeProblemRankVo organizeProblemRankVo = new OrganizeProblemRankVo(); + organizeProblemRankVo.setLabel(pcs.getShortName()); + organizeProblemRankVo.setValue(String.valueOf(negatives.size())); + fxsjlist.add(organizeProblemRankVo); + } + for (SupDepart dw : dwList) { + List negatives = negativeMapper.getNegativeListData(dw.getId(), request.getBeginTime(), request.getEndTime(), ALL); + if (negatives.isEmpty()) { + continue; + } + OrganizeProblemRankVo organizeProblemRankVo = new OrganizeProblemRankVo(); + organizeProblemRankVo.setLabel(dw.getShortName()); + organizeProblemRankVo.setValue(String.valueOf(negatives.size())); + jsdwlist.add(organizeProblemRankVo); + } + // 排序 + fxsjlist.sort( + Comparator.comparingLong((OrganizeProblemRankVo vo) -> Long.parseLong(vo.getValue())) + .reversed() + ); + jsdwlist.sort( + Comparator.comparingLong((OrganizeProblemRankVo vo) -> Long.parseLong(vo.getValue())) + .reversed() + ); JSONObject res = new JSONObject() .fluentPut("fxsjlist", fxsjlist) .fluentPut("jsdwlist", jsdwlist); @@ -155,11 +188,15 @@ public class SubDatavServiceImpl implements SubDatavService { szdcQueryParam.setProblemSourcesCode(ProblemSourcesEnum.GROUP_14_15_16); long szdcCount = negativeResourceService.count(szdcQueryParam); // 案件核查 - NegativeQueryParam ajhcQueryParam = new NegativeQueryParam(); - ajhcQueryParam.setCrtTime(dates); - ajhcQueryParam.setInvolveDepartIds(allDepartIds); - ajhcQueryParam.setProblemSourcesCode(ProblemSourcesEnum.GROUP_17_18_19_20); - long ajhcCount = negativeResourceService.count(ajhcQueryParam); + List proCode = List.of(A12389.getValue(), SLDJB.getValue(), ZDDJB.getValue(), SJJB.getValue(), STXF.getValue()); + LambdaQueryWrapper dataCaseVerifLambdaQueryWrapper = new LambdaQueryWrapper<>(); + dataCaseVerifLambdaQueryWrapper.between(DataCaseVerif::getCreateTime, request.getBeginTime(), request.getEndTime()); + List dataCaseVerifs = dataCaseVerifMapper.getListData(request.getDepartId(), request.getBeginTime(), request.getEndTime()); + List negatives = negativeMapper.getNegativeListData(request.getDepartId(), request.getBeginTime(), request.getEndTime(), proCode); + // 交办案件数 + List jbNegatvieList = negatives.stream().filter(one -> proCode.contains(one.getProblemSourcesCode())).toList(); + long ajhcCount = dataCaseVerifs.size() + jbNegatvieList.size(); + // 局长信箱 SupExternalDepartQueryParam supExternalDepartQueryParam = new SupExternalDepartQueryParam(); diff --git a/src/main/resources/mapper/SupTaskProblemMapper.xml b/src/main/resources/mapper/SupTaskProblemMapper.xml index 8a504e8..dcd979b 100644 --- a/src/main/resources/mapper/SupTaskProblemMapper.xml +++ b/src/main/resources/mapper/SupTaskProblemMapper.xml @@ -45,10 +45,11 @@ COUNT( ng.id ) AS `value` FROM sup_month_monthname m LEFT JOIN negative ng ON DATE_FORMAT(ng.crtTime,'%m') = m.`month` + LEFT JOIN sup_depart sd on ng.involveDepartId = sd.id + LEFT JOIN sup_depart sdd on sd.pid = sdd.id + LEFT JOIN sup_depart sddd on sdd.pid = sddd.id + WHERE (sd.id = #{departId} or sdd.id= #{departId} or sddd.id = #{departId} ) AND YEAR(ng.crtTime) = #{year} - AND ng.problemSourcesCode IN - #{item} - AND ng.handle_second_depart_id=#{departId} GROUP BY m.month_name ORDER BY m.`month` ASC;