From be38ad47af4f74e24bc88d64576fc2f0bd407b5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E7=88=B1=E5=AD=A6=E4=B9=A0=E7=9A=84=E7=9F=B3?= =?UTF-8?q?=E5=90=8C=E5=AD=A6?= <2936013465@qq.com> Date: Sat, 16 Nov 2024 10:01:15 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=A4=A7=E5=B1=8F1.6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/datav/DataGobalController.java | 24 ++-- .../datav/SupervisionNotifyController.java | 20 +-- .../mapper/NegativeBlameMapper.java | 2 + .../supervision/mapper/NegativeMapper.java | 81 ++++++++++- .../mapper/NegativeProblemRelationMapper.java | 2 +- .../supervision/mapper/SupDepartMapper.java | 4 + .../biutag/supervision/pojo/vo/RankVo.java | 1 + .../supervision/service/DataGobalService.java | 16 ++- .../service/DataMigrationServiceImpl.java | 14 +- .../DataSupervisionNotifyServiceImpl.java | 128 ++++++++---------- 10 files changed, 178 insertions(+), 114 deletions(-) diff --git a/src/main/java/com/biutag/supervision/controller/datav/DataGobalController.java b/src/main/java/com/biutag/supervision/controller/datav/DataGobalController.java index b8d21fe..4000a52 100644 --- a/src/main/java/com/biutag/supervision/controller/datav/DataGobalController.java +++ b/src/main/java/com/biutag/supervision/controller/datav/DataGobalController.java @@ -36,12 +36,12 @@ public class DataGobalController { private final DataGobalService dataGobalService; /** - * 获取数据大屏总数概览 + * 获取数据大屏概览 * @param beginTime * @param endTime * @return */ - @Operation(summary = "初始化大屏中央数据") + @Operation(summary = "初始化大屏数据") @GetMapping public Result getAllGobalCount(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { @@ -77,22 +77,22 @@ public class DataGobalController { List policeProList = dataGobalService.getPoliceProTotal(beginTime, endTime); List reviewProList = dataGobalService.getReviewProTotal(beginTime, endTime); List gobalTempMapVoList = new ArrayList<>(); - if (false) { + if (!gobalMapVoList.isEmpty()) { updateProList(superviseProList, gobalMapVoList, GobalMapIconVo::setSupervisePro); updateProList(caseVerifyProList, gobalMapVoList, GobalMapIconVo::setCaseVerifyPro); updateProList(mailProList, gobalMapVoList, GobalMapIconVo::setMailPro); updateProList(policeProList, gobalMapVoList, GobalMapIconVo::setPolicePro); updateProList(reviewProList, gobalMapVoList, GobalMapIconVo::setReviewPro); }else { - gobalTempMapVoList.add(new GobalMapIconVo("芙蓉分局", 1,11,11,11,11,11)); - gobalTempMapVoList.add(new GobalMapIconVo("天心分局", 2,22,22,22,22,22)); - gobalTempMapVoList.add(new GobalMapIconVo("岳麓分局", 3,33,33,33,33,33)); - gobalTempMapVoList.add(new GobalMapIconVo("开福分局", 4,44,44,44,44,44)); - gobalTempMapVoList.add(new GobalMapIconVo("雨花分局", 5,55,55,55,55,55)); - gobalTempMapVoList.add(new GobalMapIconVo("长沙县局", 6,66,66,66,66,66)); - gobalTempMapVoList.add(new GobalMapIconVo("望城分局", 7,77,77,77,77,77)); - gobalTempMapVoList.add(new GobalMapIconVo("宁乡市局", 8,88,88,88,88,88)); - gobalTempMapVoList.add(new GobalMapIconVo("浏阳市局", 9,99,99,99,99,99)); +// gobalTempMapVoList.add(new GobalMapIconVo("芙蓉分局", 1,11,11,11,11,11)); +// gobalTempMapVoList.add(new GobalMapIconVo("天心分局", 2,22,22,22,22,22)); +// gobalTempMapVoList.add(new GobalMapIconVo("岳麓分局", 3,33,33,33,33,33)); +// gobalTempMapVoList.add(new GobalMapIconVo("开福分局", 4,44,44,44,44,44)); +// gobalTempMapVoList.add(new GobalMapIconVo("雨花分局", 5,55,55,55,55,55)); +// gobalTempMapVoList.add(new GobalMapIconVo("长沙县局", 6,66,66,66,66,66)); +// gobalTempMapVoList.add(new GobalMapIconVo("望城分局", 7,77,77,77,77,77)); +// gobalTempMapVoList.add(new GobalMapIconVo("宁乡市局", 8,88,88,88,88,88)); +// gobalTempMapVoList.add(new GobalMapIconVo("浏阳市局", 9,99,99,99,99,99)); } JSONObject data = new JSONObject().fluentPut("overview", overview) diff --git a/src/main/java/com/biutag/supervision/controller/datav/SupervisionNotifyController.java b/src/main/java/com/biutag/supervision/controller/datav/SupervisionNotifyController.java index fb280fb..7bb8b05 100644 --- a/src/main/java/com/biutag/supervision/controller/datav/SupervisionNotifyController.java +++ b/src/main/java/com/biutag/supervision/controller/datav/SupervisionNotifyController.java @@ -30,16 +30,17 @@ import java.util.List; @Tag(name = "现场督察相关") public class SupervisionNotifyController { - private final DataSupervisionNotifyServiceImpl dataSupervisionNotifyService; + private final DataSupervisionNotifyServiceImpl dataSupervisionNotifyService; /** * 获取所有现场督察钟中央总数数量 + * * @return */ @Operation(summary = "获取所有督察通知相关数量") @GetMapping public Result getAllSupervisionNotifyCount(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, - @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime){ + @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { JSONObject overview = dataSupervisionNotifyService.getAllSupervisionNotifyCount(beginTime, endTime); JSONObject data = new JSONObject().fluentPut("overview", overview); return Result.success(data); @@ -48,20 +49,23 @@ public class SupervisionNotifyController { /** * 获取日常督察排行 - * @param groupType 分组类型 1: 分县市局 2: 局属单位 + * + * @param groupType 分组类型 1: 分县市局 2: 局属单位 * @return */ - @Operation(summary = "获取日常督察排行") + @Operation(summary = "获取日常督察数量概览和整改率排名") @GetMapping("/rank") public Result getChangedRank(@RequestParam Integer groupType, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, - @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime){ - List changedRank = dataSupervisionNotifyService.getChangedRank(groupType, beginTime, endTime); - JSONObject data = new JSONObject().fluentPut("changedRank", changedRank); + @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { + JSONObject rankOverview = dataSupervisionNotifyService.getDailySupervisionCount(groupType, beginTime, endTime); + List changedRankList = dataSupervisionNotifyService.getChangedRateRank(groupType, beginTime, endTime); + JSONObject data = new JSONObject() + .fluentPut("rankOverview", rankOverview) + .fluentPut("changedRankList", changedRankList); return Result.success(data); } - } diff --git a/src/main/java/com/biutag/supervision/mapper/NegativeBlameMapper.java b/src/main/java/com/biutag/supervision/mapper/NegativeBlameMapper.java index 83c1f06..35e39a2 100644 --- a/src/main/java/com/biutag/supervision/mapper/NegativeBlameMapper.java +++ b/src/main/java/com/biutag/supervision/mapper/NegativeBlameMapper.java @@ -5,6 +5,7 @@ import com.biutag.supervision.pojo.entity.NegativeBlame; import org.apache.ibatis.annotations.Select; import java.time.LocalDateTime; +import java.util.Date; import java.util.List; public interface NegativeBlameMapper extends BaseMapper { @@ -24,4 +25,5 @@ public interface NegativeBlameMapper extends BaseMapper { "where n.checkStatus in ('1', '2') and n.processing_status = 'completed' and pr.threeLevelCode is not null") List selectVerifyTrue(); + } \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java b/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java index 750a8a4..c1e822a 100644 --- a/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java +++ b/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java @@ -1,5 +1,6 @@ package com.biutag.supervision.mapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.biutag.supervision.pojo.entity.Negative; import com.biutag.supervision.pojo.vo.EchartsVo; @@ -13,8 +14,11 @@ import java.util.List; public interface NegativeMapper extends BaseMapper { +// region 首页大屏 + /** * 查询机构问题问题排名 + * * @param beginTime * @param endTime */ @@ -33,7 +37,7 @@ public interface NegativeMapper extends BaseMapper { "WHERE " + "discoveryTime BETWEEN #{beginTime} and #{endTime} and checkStatus=1 " + "GROUP BY businessTypeName") - List selectBusinessRate(Date beginTime,Date endTime); + List selectBusinessRate(Date beginTime, Date endTime); @Select("SELECT DATE_FORMAT(ng.discoveryTime, '%Y-%m') AS monthTime, COUNT(*) total FROM negative ng " + @@ -41,14 +45,79 @@ public interface NegativeMapper extends BaseMapper { "GROUP BY monthTime " + "order BY monthTime asc") List selectRecentTrendByMonth(String year); +// endregion + + +// region 现场督察大屏 + + /** + * 获取现场督察和专项督察的通报问题数 + * + * @param beginTime + * @param endTime + * @return + */ + @Select("SELECT count(*) FROM negative WHERE checkStatus = #{checkStatus} " + + "AND problemSourcesCode IN (13, 15) " + + "AND discoveryTime BETWEEN #{beginTime} AND #{endTime}") + Long selectSupervisionNotifyCount(Date beginTime, Date endTime, String checkStatus); + + + /** + * 获取现场督察和专项督察属实的已经整改的问题数 + * @param beginTime + * @param endTime + * @return + */ + @Select("SELECT count(*) FROM negative WHERE checkStatus = #{checkStatus} " + + "AND problemSourcesCode IN (13, 15) " + + "AND isRectifyCode=#{isRectify}" + + "AND discoveryTime BETWEEN #{beginTime} AND #{endTime}") + Long selectChangSupervisionNotifyCount(Date beginTime, Date endTime, String checkStatus, String isRectify); /** - * @Select("SELECT sd.short_name as label, sd.statistics_group_id, count(*) as value FROM sup_depart sd INNER JOIN " + - * "(SELECT ng.handle_second_depart_id, ng.handle_second_depart_name FROM negative ng WHERE " + - * " crtTime BETWEEN #{beginTime} and #{endTime} and checkStatus=1 ) temp " + - * " on sd.id=temp.handle_second_depart_id GROUP BY short_name HAVING statistics_group_id=#{groupType} " + - * " ORDER BY value desc") + * 获取现场督察和专项督察属实的涉及单位数 + * + * @param beginTime + * @param endTime + * @return */ + @Select("SELECT count(*) FROM " + + " ( SELECT DISTINCT involveDepartName FROM negative " + + " WHERE checkStatus=1 AND problemSourcesCode in (13, 15) AND discoveryTime " + + " BETWEEN '2024-01-01' AND '2024-11-17'" + + " )" + + "AS distinct_departments;") + Long selectRelationOrgCount(Date beginTime, Date endTime, String checkStatus); + + + @Select("SELECT COUNT(*) FROM negative n " + + "INNER JOIN ( " + + " SELECT DISTINCT sd.id " + + " FROM sup_depart sd " + + " INNER JOIN sup_depart sd1 ON sd.pid = sd1.id " + + " WHERE sd1.statistics_group_id = #{groupType}" + + ") AS filtered_sd ON n.involveDepartId = filtered_sd.id " + + "WHERE n.checkStatus = 1 " + + "AND n.problemSourcesCode = 15;") + Long getCountByGroupType(Integer groupType, Date beginTime, Date endTime); + + + @Select("SELECT COUNT(*) FROM negative n " + + "INNER JOIN ( " + + " SELECT DISTINCT sd.id " + + " FROM sup_depart sd " + + " INNER JOIN sup_depart sd1 ON sd.pid = sd1.id " + + " WHERE sd1.statistics_group_id = #{groupType}" + + ") AS filtered_sd ON n.involveDepartId = filtered_sd.id " + + "WHERE n.checkStatus = 1 " + + "AND n.problemSourcesCode = 15 " + + "AND n.isRectifyCode=#{isRectify} " + + "AND n.discoveryTime BETWEEN #{beginTime} AND #{endTime}") + Long getChangCountByGroupType(Integer groupType, Date beginTime, Date endTime, Integer isRectify); + + +// endregion } diff --git a/src/main/java/com/biutag/supervision/mapper/NegativeProblemRelationMapper.java b/src/main/java/com/biutag/supervision/mapper/NegativeProblemRelationMapper.java index 2d20b21..480ec8b 100644 --- a/src/main/java/com/biutag/supervision/mapper/NegativeProblemRelationMapper.java +++ b/src/main/java/com/biutag/supervision/mapper/NegativeProblemRelationMapper.java @@ -19,7 +19,7 @@ public interface NegativeProblemRelationMapper extends BaseMapper selectProblemRate(Date beginTime, Date endTime); - @Select("SELECT threeLevelContent as name, count(*) as `value` " + + @Select("SELECT threeLevelContent as label, count(*) as `value` " + "FROM negative_problem_relation " + "WHERE negativeId " + "in ( SELECT id FROM negative WHERE discoveryTime BETWEEN #{beginTime} AND #{endTime}) " + diff --git a/src/main/java/com/biutag/supervision/mapper/SupDepartMapper.java b/src/main/java/com/biutag/supervision/mapper/SupDepartMapper.java index af017f0..3ba57be 100644 --- a/src/main/java/com/biutag/supervision/mapper/SupDepartMapper.java +++ b/src/main/java/com/biutag/supervision/mapper/SupDepartMapper.java @@ -30,4 +30,8 @@ public interface SupDepartMapper extends BaseMapper { + "" + "") List> getIdsByCode(List departIds); + + + @Select("select * from sup_depart where statistics_group_id = #{groupType} ") + List selectDepartsByGroupType(Integer groupType); } \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/pojo/vo/RankVo.java b/src/main/java/com/biutag/supervision/pojo/vo/RankVo.java index 169b8c5..10aed34 100644 --- a/src/main/java/com/biutag/supervision/pojo/vo/RankVo.java +++ b/src/main/java/com/biutag/supervision/pojo/vo/RankVo.java @@ -13,6 +13,7 @@ public class RankVo { private String label; // 部门名称 private String departId; // 部门id private Integer value; // 数量 + private Double rate; // 整改率 private String numerator; // 分子 已整改 private String denominator; // 分母 问题数 } diff --git a/src/main/java/com/biutag/supervision/service/DataGobalService.java b/src/main/java/com/biutag/supervision/service/DataGobalService.java index 4641512..6f02de2 100644 --- a/src/main/java/com/biutag/supervision/service/DataGobalService.java +++ b/src/main/java/com/biutag/supervision/service/DataGobalService.java @@ -40,16 +40,17 @@ public class DataGobalService { * @return 返回所有大屏统计数据 */ public JSONObject getAllGobalCount(Date beginTime, Date endTime) { - // 获取案件核查问题数量(查实版本) - Long caseVerificationPro = getCountByConditions( - Integer.parseInt(InspectCaseEnum.TRUE.getValue()), - beginTime, endTime, - 17, 18, 19, 20); + // 督察问题数量(查实版本) Long supervisionPro = getCountByConditions( Integer.parseInt(InspectCaseEnum.TRUE.getValue()), beginTime, endTime, 13, 15, 16); + // 获取案件核查问题数量(查实版本) + Long caseVerificationPro = getCountByConditions( + Integer.parseInt(InspectCaseEnum.TRUE.getValue()), + beginTime, endTime, + 17, 18, 19, 20); // 信访投诉问题数量(查实版本) Long complaintPro = getCountByConditions( Integer.parseInt(InspectCaseEnum.TRUE.getValue()), @@ -133,9 +134,10 @@ public class DataGobalService { */ public List getStrongProblemRank(Date beginTime, Date endTime) { // 1.获取这段时间的negative id - // - List res= negativeProblemRelationMapper.selectStrongProblemRank(beginTime, endTime); + for (int i = 1; i <= res.size(); i++) { + res.get(i - 1).setSort(i); + } return res; } diff --git a/src/main/java/com/biutag/supervision/service/DataMigrationServiceImpl.java b/src/main/java/com/biutag/supervision/service/DataMigrationServiceImpl.java index 53738e9..141b027 100644 --- a/src/main/java/com/biutag/supervision/service/DataMigrationServiceImpl.java +++ b/src/main/java/com/biutag/supervision/service/DataMigrationServiceImpl.java @@ -65,7 +65,7 @@ public class DataMigrationServiceImpl extends ServiceImpl negativeQueryWrapper = new QueryWrapper<>(); - negativeQueryWrapper.between("crtTime", beginTime, endTime); - negativeQueryWrapper.eq("problemSourcesCode", ProblemSourcesEnum.XCDC.getValue()); - Long supervisionNotifyTotal = negativeMapper.selectCount(negativeQueryWrapper); // 通报问题数 - /* QueryWrapper changingQueryWrapper = new QueryWrapper<>(); - changingQueryWrapper.between("crtTime", beginTime, endTime); - changingQueryWrapper.eq("problemSourcesCode", ProblemSourcesEnum.XCDC.getValue()); - changingQueryWrapper.eq("isRectifyCode", 1); - Long supervisionNotifyChangingTotal = negativeMapper.selectCount(changingQueryWrapper); */ // 整改中问题数 - QueryWrapper changedQueryWrapper = new QueryWrapper<>(); - changedQueryWrapper.between("crtTime", beginTime, endTime); - changedQueryWrapper.eq("problemSourcesCode", ProblemSourcesEnum.XCDC.getValue()); - changedQueryWrapper.eq("isRectifyCode", 1); - Long supervisionNotifyChangedTotal = negativeMapper.selectCount(changedQueryWrapper); // 已整改问题数 - QueryWrapper orgQueryWrapper = new QueryWrapper<>(); - orgQueryWrapper.between("crtTime", beginTime, endTime); - orgQueryWrapper.eq("problemSourcesCode", ProblemSourcesEnum.XCDC.getValue()); - orgQueryWrapper.select("distinct involveDepartId"); - Long supervisionNotifyOrgTotal = negativeMapper.selectCount(orgQueryWrapper); // 涉及单位数 + + // 通报问题数 + Long supervisionNotifyTotal = negativeMapper.selectSupervisionNotifyCount(beginTime, endTime, InspectCaseEnum.TRUE.getValue()); + + // 整改中 + Long supervisionNotifyChangingTotal = negativeMapper.selectChangSupervisionNotifyCount(beginTime, endTime, InspectCaseEnum.TRUE.getValue(), "0"); + + // 已整改 + Long supervisionNotifyChangedTotal = negativeMapper.selectChangSupervisionNotifyCount(beginTime, endTime, InspectCaseEnum.TRUE.getValue(), "1"); + + // 涉及单位数 + Long supervisionNotifyOrgTotal = negativeMapper.selectRelationOrgCount(beginTime, endTime, "1"); /** * 涉及人数 * 1、查出在 negative中的id集合 @@ -71,7 +70,8 @@ public class DataSupervisionNotifyServiceImpl extends ServiceImpl preQueryWrapper = new QueryWrapper<>(); preQueryWrapper.eq("problemSourcesCode", ProblemSourcesEnum.XCDC.getValue()); - ArrayList negatives = (ArrayList) negativeMapper.selectList(preQueryWrapper); + + List negatives = negativeMapper.selectList(preQueryWrapper); Long supervisionNotifyPreTotal = 0L; for (Negative negative : negatives) { String id = negative.getId(); @@ -79,68 +79,60 @@ public class DataSupervisionNotifyServiceImpl extends ServiceImpl getChangedRank(Integer groupType, Date beginTime, Date endTime) { -// List changedList = negativeMapper.rank(groupType, beginTime, endTime); - // 计算整改率 -// return changedList; - return null; - } - - - + /** + * 获取日常督察数量概览 + * + * @param groupType + * @param beginTime + * @param endTime + * @return + */ + public JSONObject getDailySupervisionCount(Integer groupType, Date beginTime, Date endTime) { - private JSONObject getJsonObject(Date beginTime, Date endTime) { - // 通报问题数 - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.between("dis_date", beginTime, endTime); - queryWrapper.select("distinct tb_name"); - Long supervisionNotifyTotal = dataSupervisionNotifyMapper.selectCount(queryWrapper); - // 涉及单位数 - QueryWrapper orgQueryWrapper = new QueryWrapper<>(); - orgQueryWrapper.between("dis_date", beginTime, endTime); - orgQueryWrapper.select("distinct th_org_name"); - Long supervisionNotifyOrgTotal = dataSupervisionNotifyMapper.selectCount(orgQueryWrapper); - // 涉及人数 - QueryWrapper preQueryWrapper = new QueryWrapper<>(); - preQueryWrapper.between("dis_date", beginTime, endTime); - preQueryWrapper.select("distinct pro_person_name"); - Long supervisionNotifyPreTotal = dataSupervisionNotifyMapper.selectCount(preQueryWrapper); - // 整改中 - QueryWrapper changingQueryWrapper = new QueryWrapper<>(); - changingQueryWrapper.between("dis_date", beginTime, endTime); - changingQueryWrapper.isNull("rep_content"); - Long supervisionNotifyChangingTotal = dataSupervisionNotifyMapper.selectCount(changingQueryWrapper); - // 已整改 - QueryWrapper changedQueryWrapper = new QueryWrapper<>(); - changedQueryWrapper.between("dis_date", beginTime, endTime); - changedQueryWrapper.isNotNull("rep_content"); - Long supervisionNotifyChangedTotal = dataSupervisionNotifyMapper.selectCount(changedQueryWrapper); + Long proTotal = negativeMapper.getCountByGroupType(groupType, beginTime, endTime); + Long changing = negativeMapper.getChangCountByGroupType(groupType, beginTime, endTime, 0); + Long changed = negativeMapper.getChangCountByGroupType(groupType, beginTime, endTime, 1); // 整改率 - long count = this.count(); // 库里面总数 - double correctionRate = count != 0 ? (supervisionNotifyChangedTotal * 1.0 / count) * 100 : 0; - JSONObject jsonObject = new JSONObject(); - jsonObject.fluentPut("supervisionNotifyTotal", supervisionNotifyTotal) - .fluentPut("supervisionNotifyOrgTotal", supervisionNotifyOrgTotal) - .fluentPut("supervisionNotifyPreTotal", supervisionNotifyPreTotal) - .fluentPut("supervisionNotifyChangingTotal", supervisionNotifyChangingTotal) - .fluentPut("supervisionNotifyChangedTotal", supervisionNotifyChangedTotal) + double correctionRate = proTotal != 0 ? (changed * 1.0 / proTotal) * 100 : 0; + JSONObject res = new JSONObject() + .fluentPut("proTotal", proTotal) + .fluentPut("changing", changing) + .fluentPut("changed", changed) .fluentPut("correctionRate", correctionRate); - return jsonObject; + return res; } + /** + * 获取日常督察整改率排名 + * + * @param groupType + * @param beginTime + * @param endTime + * @return + */ + public List getChangedRateRank(Integer groupType, Date beginTime, Date endTime) { + List rankVos = new ArrayList<>(); + List departs = supDepartMapper.selectDepartsByGroupType(groupType); +// negativeMapper.select + + return null; + } }