From 5e06403f9eba0eeada76c7d48f9c247249b55a2c 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: Sun, 17 Nov 2024 10:24:28 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8E=B0=E5=9C=BA=E7=9D=A3=E5=AF=9F=E5=A4=A7?= =?UTF-8?q?=E5=B1=8F2024/11/17=2010:24=20=E7=8E=B0=E5=9C=BA=E7=9D=A3?= =?UTF-8?q?=E5=AF=9F=E5=A4=A7=E5=B1=8F=E5=90=8E=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datav/SupervisionNotifyController.java | 36 +++---- .../mapper/NegativeBlameMapper.java | 6 +- .../supervision/mapper/NegativeMapper.java | 48 +++++++--- .../biutag/supervision/pojo/vo/RankVo.java | 4 +- .../biutag/supervision/pojo/vo/RankVoSup.java | 14 +-- .../supervision/pojo/vo/RankVoSupTwo.java | 12 +-- .../DataSupervisionNotifyServiceImpl.java | 95 +++++++------------ 7 files changed, 102 insertions(+), 113 deletions(-) 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 30a5b18..3644c77 100644 --- a/src/main/java/com/biutag/supervision/controller/datav/SupervisionNotifyController.java +++ b/src/main/java/com/biutag/supervision/controller/datav/SupervisionNotifyController.java @@ -49,14 +49,14 @@ public class SupervisionNotifyController { List wtlxList = dataSupervisionNotifyService.getProblemTypeRatio(beginTime, endTime); //地图数据 - List superviseTempMapVoList = dataSupervisionNotifyService.getsupervisionMapIconInfo(beginTime, endTime); + List superviseTempMapVoList = dataSupervisionNotifyService.getsupervisionMapIconInfo(beginTime, endTime); // 黄赌毒总览 - List hddzlList = dataSupervisionNotifyService.getYellowBet(beginTime, endTime); +// List hddzlList = dataSupervisionNotifyService.getYellowBet(beginTime, endTime); - // 黄毒赌列表 - List hddList = dataSupervisionNotifyService.getYellowBet(beginTime, endTime); +// // 黄毒赌列表 + List hddList = dataSupervisionNotifyService.getYellowBet(beginTime, endTime); JSONObject data = new JSONObject().fluentPut("wtlxList", wtlxList) .fluentPut("overview", overview) @@ -77,23 +77,14 @@ public class SupervisionNotifyController { public Result getChangedRank(@RequestParam Integer groupType, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { - RankVoSup temp = dataSupervisionNotifyService.getSuperversionRank( beginTime, endTime); - JSONObject rankOverview=new JSONObject(); - if ( temp != null) { - rankOverview - .fluentPut("proTotal", temp.getProblem_number()) - .fluentPut("changing", temp.getRectifing_number()) - .fluentPut("changed", temp.getRectifed_number()) - .fluentPut("correctionRate", temp.getRectify_rate()); - }else { - rankOverview - .fluentPut("proTotal",0) - .fluentPut("changing", 0) - .fluentPut("changed", 0) - .fluentPut("correctionRate", 0); - } - List changedRankList = dataSupervisionNotifyService.getChangedRateRank(groupType, beginTime, endTime); - + RankVoSup temp = dataSupervisionNotifyService.getSuperversionRank(beginTime, endTime); + JSONObject rankOverview = new JSONObject() + .fluentPut("proTotal", temp.getProblemNumber()) + .fluentPut("changing", temp.getRectifingNumber()) + .fluentPut("changed", temp.getRectifedNumber()) + .fluentPut("correctionRate", temp.getRectifyRate()); + + List changedRankList = dataSupervisionNotifyService.getChangedRateRank(groupType, beginTime, endTime); JSONObject data = new JSONObject() .fluentPut("rankOverview", rankOverview) .fluentPut("changedRankList", changedRankList); @@ -106,8 +97,7 @@ public class SupervisionNotifyController { */ @GetMapping("/getSupervisionTrend") public Result getSupervisionTrend(@RequestParam String year) { - - String temp = year+"-12-30"; + String temp = year + "-11-30"; List supervisionTrend = dataSupervisionNotifyService.getSupervisionTrend(temp); JSONObject data = new JSONObject().fluentPut("supervisionTrend", supervisionTrend); 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 752870a..78c9a04 100644 --- a/src/main/java/com/biutag/supervision/mapper/NegativeBlameMapper.java +++ b/src/main/java/com/biutag/supervision/mapper/NegativeBlameMapper.java @@ -28,17 +28,17 @@ public interface NegativeBlameMapper extends BaseMapper { @Select(" SELECT blameIdCode, blameName, count(1) as number FROM `negative_blame` " + - " where blameIdCode is not null and LENGTH(blameIdCode) > 0 and ivPersonTypeCode = '1' and crt_time > '2024-01-01 00:00:00' " + + " where blameIdCode is not null and LENGTH(blameIdCode) > 0 and ivPersonTypeCode = '1' and crtTime > '2024-01-01 00:00:00' " + " GROUP BY blameIdCode order by number desc limit 10") List statisticsBlame(); @Select(" SELECT blameIdCode, blameName, count(1) as number FROM `negative_blame` " + - " where blameIdCode is not null and LENGTH(blameIdCode) > 0 and ivPersonTypeCode != '1' and crt_time > '2024-01-01 00:00:00' " + + " where blameIdCode is not null and LENGTH(blameIdCode) > 0 and ivPersonTypeCode != '1' and crtTime > '2024-01-01 00:00:00' " + " GROUP BY blameIdCode order by number desc limit 10") List statisticsBlame2(); @Select(" SELECT leadIdCode, leadName as blameName, count(distinct blameIdCode) as number FROM `negative_blame` " + - " where leadIdCode is not null and LENGTH(leadIdCode) > 0 and crt_time > '2024-01-01 00:00:00'" + + " where leadIdCode is not null and LENGTH(leadIdCode) > 0 and crtTime > '2024-01-01 00:00:00'" + " GROUP BY leadIdCode order by number desc limit 10") List statisticsBlame3(); } diff --git a/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java b/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java index d1a1dc0..efc6ad6 100644 --- a/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java +++ b/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java @@ -245,29 +245,53 @@ public interface NegativeMapper extends BaseMapper { "GROUP BY a.name, a.departId") List getMap(Date beginTime, Date endTime); - @Select("SELECT a.name, COUNT(DISTINCT c.id) AS problem_number, COUNT(DISTINCT IF(c.isRectifyCode = 0, c.id, 0)) - 1 AS rectifing_number, COUNT(DISTINCT IF(c.isRectifyCode = 1, c.id, 0)) - 1 AS rectifed_number, COUNT(DISTINCT c.involveDepartId) AS depart_number, COUNT(DISTINCT d.blameIdCode) AS person_number, ROUND((COUNT(DISTINCT IF(c.isRectifyCode = 1, c.id, 0)) - 1) / COUNT(DISTINCT c.id) * 100, 1) AS rectify_rate\n" + - "FROM statistics_depart a INNER JOIN sup_depart b ON a.departId = b.pid " + - " INNER JOIN negative c ON b.id = c.involveDepartId " + + @Select("SELECT a.name , " + + "COUNT(DISTINCT c.id) AS problem_number, " + + "COUNT(DISTINCT IF(c.isRectifyCode = 0, c.id, 0)) - 1 AS rectifing_number, " + + "COUNT(DISTINCT IF(c.isRectifyCode = 1, c.id, 0)) - 1 AS rectifed_number, " + + "COUNT(DISTINCT c.involveDepartId) AS depart_number, " + + "COUNT(DISTINCT d.blameIdCode) AS person_number, " + + "ROUND((COUNT(DISTINCT IF(c.isRectifyCode = 1, c.id, 0)) - 1) / COUNT(DISTINCT c.id) * 100, 1) AS rectify_rate " + + "FROM statistics_depart a INNER JOIN sup_depart b ON a.departId = b.pid " + + " INNER JOIN negative c ON b.id = c.involveDepartId " + " LEFT JOIN negative_blame d ON c.id = d.negativeId " + - "WHERE a.groupId = 3 AND discoveryTime BETWEEN #{beginTime} AND #{endTime} AND checkStatus IN ('1', '2') AND special_supervision = 1\n" + - "GROUP BY a.name") + "WHERE a.groupId = 3 AND discoveryTime BETWEEN #{beginTime} AND #{endTime} AND checkStatus IN ('1', '2') AND special_supervision = 1 " + + "GROUP BY a.name " + + "order by problem_number desc") List getYellowBet(Date beginTime, Date endTime); - @Select("SELECT COUNT(DISTINCT c.id) AS problem_number, COUNT(DISTINCT IF(c.isRectifyCode = 0, c.id, 0)) - 1 AS rectifing_number, COUNT(DISTINCT IF(c.isRectifyCode = 1, c.id, 0)) - 1 AS rectifed_number, COUNT(DISTINCT c.involveDepartId) AS depart_number, COUNT(DISTINCT d.blameIdCode) AS person_number, ROUND((COUNT(DISTINCT IF(c.isRectifyCode = 1, c.id, 0)) - 1) / COUNT(DISTINCT c.id) * 100, 1) AS rectify_rate\n" + + @Select("SELECT COUNT(DISTINCT c.id) AS problem_number, COUNT(DISTINCT IF(c.isRectifyCode = 0, c.id, 0)) - 1 AS rectifing_number, COUNT(DISTINCT IF(c.isRectifyCode = 1, c.id, 0)) - 1 AS rectifed_number, COUNT(DISTINCT c.involveDepartId) AS depart_number, COUNT(DISTINCT d.blameIdCode) AS person_number, ROUND((COUNT(DISTINCT IF(c.isRectifyCode = 1, c.id, 0)) - 1) / COUNT(DISTINCT c.id) * 100, 1) AS rectify_rate " + "FROM sup_depart b INNER JOIN negative c ON b.id = c.involveDepartId " + " LEFT JOIN negative_blame d ON c.id = d.negativeId " + "WHERE discoveryTime BETWEEN #{beginTime} AND #{endTime} AND checkStatus IN ('1', '2') AND problemSourcesCode = 13 ") RankVoSup getSuperversionRank(Date beginTime, Date endTime); - @Select("SELECT a.name, COUNT(DISTINCT c.id) AS problem_number, COUNT(DISTINCT IF(c.isRectifyCode = 0, c.id, 0)) - 1 AS rectifing_number, COUNT(DISTINCT IF(c.isRectifyCode = 1, c.id, 0)) - 1 AS rectifed_number, COUNT(DISTINCT c.involveDepartId) AS depart_number, COUNT(DISTINCT d.blameIdCode) AS person_number, ROUND((COUNT(DISTINCT IF(c.isRectifyCode = 1, c.id, 0)) - 1) / COUNT(DISTINCT c.id) * 100, 1) AS rectify_rate\n" + - "FROM statistics_depart a INNER JOIN sup_depart b ON a.departId = b.pid \n" + - " INNER JOIN negative c ON b.id = c.involveDepartId \n" + - " LEFT JOIN negative_blame d ON c.id = d.negativeId\n" + - "WHERE a.groupId = 3 AND discoveryTime BETWEEN #{beginTime} AND #{endTime} AND checkStatus IN ('1', '2') AND problemSourcesCode = 13\n" + - "GROUP BY a.name") + @Select("SELECT a.name, " + + "COUNT(DISTINCT c.id) AS problem_number, " + + "COUNT(DISTINCT IF(c.isRectifyCode = 0, c.id, 0)) - 1 AS rectifing_number, " + + "COUNT(DISTINCT IF(c.isRectifyCode = 1, c.id, 0)) - 1 AS rectifed_number, " + + "COUNT(DISTINCT c.involveDepartId) AS depart_number, " + + "COUNT(DISTINCT d.blameIdCode) AS person_number, " + + "ROUND((COUNT(DISTINCT IF(c.isRectifyCode = 1, c.id, 0)) - 1) / COUNT(DISTINCT c.id) * 100, 1) AS rectify_rate " + + "FROM statistics_depart a INNER JOIN sup_depart b ON a.departId = b.pid " + + " INNER JOIN negative c ON b.id = c.involveDepartId " + + " LEFT JOIN negative_blame d ON c.id = d.negativeId " + + "WHERE a.groupId = 3 AND discoveryTime BETWEEN #{beginTime} AND #{endTime} AND checkStatus IN ('1', '2') AND problemSourcesCode = 13 " + + "GROUP BY a.name " + + "order by rectify_rate desc") List getChangedRateRank(Date beginTime, Date endTime); + @Select("SELECT COUNT(DISTINCT c.id) AS problem_number, " + + "COUNT(DISTINCT IF(c.isRectifyCode = 0, c.id, 0)) - 1 AS rectifing_number, " + + "COUNT(DISTINCT IF(c.isRectifyCode = 1, c.id, 0)) - 1 AS rectifed_number, " + + "COUNT(DISTINCT c.involveDepartId) AS depart_number, COUNT(DISTINCT d.blameIdCode) AS person_number, " + + "ROUND((COUNT(DISTINCT IF(c.isRectifyCode = 1, c.id, 0)) - 1) / COUNT(DISTINCT c.id) * 100, 1) AS rectify_rate " + + "FROM sup_depart b INNER JOIN negative c ON b.id = c.involveDepartId " + + " LEFT JOIN negative_blame d ON c.id = d.negativeId " + + "WHERE discoveryTime BETWEEN #{beginTime} AND #{endTime} AND checkStatus IN ('1', '2') AND problemSourcesCode IN (13, 15)") + RankVoSupTwo getTemp(Date beginTime, Date endTime); + // endregion 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 fc8c3c1..00c9c49 100644 --- a/src/main/java/com/biutag/supervision/pojo/vo/RankVo.java +++ b/src/main/java/com/biutag/supervision/pojo/vo/RankVo.java @@ -12,8 +12,8 @@ public class RankVo { private String label; // 部门名称 private String departId; // 部门id - private Double value; // 整改率 - private Double rate; // 整改率 + private String value; // 整改率 + private String rate; // 整改率 private String numerator; // 分子 已整改 private String denominator; // 分母 问题数 } diff --git a/src/main/java/com/biutag/supervision/pojo/vo/RankVoSup.java b/src/main/java/com/biutag/supervision/pojo/vo/RankVoSup.java index 47c43ff..f776669 100644 --- a/src/main/java/com/biutag/supervision/pojo/vo/RankVoSup.java +++ b/src/main/java/com/biutag/supervision/pojo/vo/RankVoSup.java @@ -1,5 +1,6 @@ package com.biutag.supervision.pojo.vo; +import lombok.AllArgsConstructor; import lombok.Data; /** @@ -8,12 +9,13 @@ import lombok.Data; * @Description: */ @Data +@AllArgsConstructor public class RankVoSup { - private String problem_number; // 问题数 - private String rectifing_number; // 整改中 - private String rectifed_number; // 已整改 - private String depart_number; // 部门数 - private String person_number; // 人员数 - private String rectify_rate; // 整改率 + private String problemNumber; // 问题数 + private String rectifingNumber; // 整改中 + private String rectifedNumber; // 已整改 + private String departNumber; // 部门数 + private String personNumber; // 人员数 + private String rectifyRate; // 整改率 } diff --git a/src/main/java/com/biutag/supervision/pojo/vo/RankVoSupTwo.java b/src/main/java/com/biutag/supervision/pojo/vo/RankVoSupTwo.java index 92cb8d6..567bafd 100644 --- a/src/main/java/com/biutag/supervision/pojo/vo/RankVoSupTwo.java +++ b/src/main/java/com/biutag/supervision/pojo/vo/RankVoSupTwo.java @@ -10,12 +10,12 @@ import lombok.Data; @Data public class RankVoSupTwo { private String name; // 名字 - private String problem_number; // 问题数 - private String rectifing_number; // 整改中 - private String rectifed_number; // 已整改 - private String depart_number; // - private String person_number; // 人数 - private String rectify_rate; // 整改率 + private String rectifingNumber; // 整改中 + private String rectifedNumber; // 已整改 + private String departNumber; // + private String personNumber; // 人数 + private String rectifyRate; // 整改率 + private String problemNumber; // 问题数 } diff --git a/src/main/java/com/biutag/supervision/service/DataSupervisionNotifyServiceImpl.java b/src/main/java/com/biutag/supervision/service/DataSupervisionNotifyServiceImpl.java index a84af52..eb398e1 100644 --- a/src/main/java/com/biutag/supervision/service/DataSupervisionNotifyServiceImpl.java +++ b/src/main/java/com/biutag/supervision/service/DataSupervisionNotifyServiceImpl.java @@ -18,11 +18,13 @@ import com.biutag.supervision.pojo.entity.NegativeBlame; import com.biutag.supervision.pojo.entity.SupDepart; import com.biutag.supervision.pojo.vo.*; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.apache.poi.ss.formula.functions.Intercept; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Date; +import java.util.IllegalFormatCodePointException; import java.util.List; import java.util.stream.Collectors; @@ -33,6 +35,8 @@ import java.util.stream.Collectors; */ @RequiredArgsConstructor @Service +@Slf4j + public class DataSupervisionNotifyServiceImpl extends ServiceImpl { private final NegativeMapper negativeMapper; @@ -49,37 +53,29 @@ public class DataSupervisionNotifyServiceImpl extends ServiceImpl preQueryWrapper = new QueryWrapper<>(); - preQueryWrapper.in("problemSourcesCode", ProblemSourcesEnum.XCDC.getValue(), ProblemSourcesEnum.ZXDC.getValue()); - - List negatives = negativeMapper.selectList(preQueryWrapper); - Long supervisionNotifyPreTotal = 0L; - for (Negative negative : negatives) { - String id = negative.getId(); - QueryWrapper totalWrapper = new QueryWrapper<>(); - totalWrapper.eq("negativeId", id); - totalWrapper.eq("type", "personal"); - supervisionNotifyPreTotal += negativeBlameMapper.selectCount(totalWrapper); - } - // 整改率 - Integer correctionRate = supervisionNotifyTotal != 0 ? (int) ((supervisionNotifyChangedTotal * 1.0 / supervisionNotifyTotal) * 100) : 0; + String supervisionNotifyOrgTotal = res.getDepartNumber(); + log.info("涉及单位数:{}", res.getDepartNumber()); + // 涉及人数 + String supervisionNotifyPreTotal = res.getPersonNumber(); + log.info("涉及人数:{}", res.getPersonNumber()); + String correctionRate = res.getRectifyRate(); + log.info("整改率:{}", res.getRectifyRate()); + JSONObject jsonObject = new JSONObject(); jsonObject.fluentPut("supervisionNotifyTotal", supervisionNotifyTotal) .fluentPut("supervisionNotifyOrgTotal", supervisionNotifyOrgTotal) @@ -127,10 +123,10 @@ public class DataSupervisionNotifyServiceImpl extends ServiceImpl getYellowBet(Date beginTime, Date endTime) { List res = negativeMapper.getYellowBet(beginTime, endTime); + List resv = new ArrayList<>(); + if (res == null) { + return resv; + } for (RankVoSupTwo re : res) { + log.info("名字===========" + re.getName() + "驼峰===============" + re.getProblemNumber() + "非驼峰" + re.getProblemNumber()); RankVo rankVo = new RankVo(); rankVo.setLabel(re.getName()); - rankVo.setValue(Double.parseDouble(re.getProblem_number())); + rankVo.setValue(re.getProblemNumber()); resv.add(rankVo); } return resv; @@ -175,36 +176,8 @@ public class DataSupervisionNotifyServiceImpl extends ServiceImpl