diff --git a/src/main/java/com/biutag/supervision/constants/enums/TrendEnum.java b/src/main/java/com/biutag/supervision/constants/enums/TrendEnum.java new file mode 100644 index 0000000..a45a3a4 --- /dev/null +++ b/src/main/java/com/biutag/supervision/constants/enums/TrendEnum.java @@ -0,0 +1,29 @@ +package com.biutag.supervision.constants.enums; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.Getter; + +/** + * @Auther: sh + * @Date: 2024/11/16 19:34 + * @Description: + */ +@Getter +@AllArgsConstructor +public enum TrendEnum { + + + DAY("日趋势", "1"), + WEEK("周趋势", "2"), + + Month("月趋势", "3"); + + + private String label; + + private String value; + + +} + 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 1a9ae16..1eeb90f 100644 --- a/src/main/java/com/biutag/supervision/controller/datav/SupervisionNotifyController.java +++ b/src/main/java/com/biutag/supervision/controller/datav/SupervisionNotifyController.java @@ -2,9 +2,10 @@ package com.biutag.supervision.controller.datav; import com.alibaba.fastjson.JSONObject; import com.biutag.supervision.pojo.Result; -import com.biutag.supervision.pojo.dto.CaseVerifDepart; import com.biutag.supervision.pojo.vo.EchartsVo; +import com.biutag.supervision.pojo.vo.GobalMapIconVo; import com.biutag.supervision.pojo.vo.RankVo; +import com.biutag.supervision.pojo.vo.SuperviseMapIconVo; import com.biutag.supervision.service.DataSupervisionNotifyServiceImpl; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -16,6 +17,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -43,18 +46,22 @@ public class SupervisionNotifyController { public Result getAllSupervisionNotifyCount(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { JSONObject overview = dataSupervisionNotifyService.getAllSupervisionNotifyCount(beginTime, endTime); - JSONObject data = new JSONObject().fluentPut("overview", overview); //问题类型占比 List wtlxList = dataSupervisionNotifyService.getProblemTypeRatio(beginTime, endTime); - // + //地图数据 + List superviseTempMapVoList = dataSupervisionNotifyService.getsupervisionMapIconInfo(beginTime, endTime); + + JSONObject data = new JSONObject().fluentPut("wtlxList", wtlxList) + .fluentPut("overview", overview); return Result.success(data); } /** * 获取日常督察排行 + * * @param groupType 分组类型 1: 分县市局 2: 局属单位 * @return */ @@ -72,8 +79,17 @@ public class SupervisionNotifyController { } + /** + * 获取督察问题趋势 + */ + @GetMapping("/getSupervisionTrend") + public Result getSupervisionTrend(@RequestParam String year) { - + String temp = year+"-12-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/NegativeMapper.java b/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java index 99cfc73..74d2adb 100644 --- a/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java +++ b/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java @@ -114,7 +114,7 @@ public interface NegativeMapper extends BaseMapper { * @param endTime * @return */ - @Select("SELECT count(*) FROM negative WHERE checkStatus = #{checkStatus} " + + @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); @@ -126,7 +126,7 @@ public interface NegativeMapper extends BaseMapper { * @param endTime * @return */ - @Select("SELECT count(*) FROM negative WHERE checkStatus = #{checkStatus} " + + @Select("SELECT count(*) FROM negative WHERE checkStatus <> #{checkStatus} " + "AND problemSourcesCode IN (13, 15) " + "AND isRectifyCode=#{isRectify}" + "AND discoveryTime BETWEEN #{beginTime} AND #{endTime}") @@ -142,8 +142,8 @@ public interface NegativeMapper extends BaseMapper { */ @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'" + + " WHERE checkStatus<>3 AND problemSourcesCode in (13, 15) AND discoveryTime " + + " BETWEEN #{beginTime} AND #{endTime}" + " )" + "AS distinct_departments;") Long selectRelationOrgCount(Date beginTime, Date endTime, String checkStatus); @@ -186,7 +186,7 @@ public interface NegativeMapper extends BaseMapper { @Select("SELECT count(*) FROM negative ng INNER JOIN " + "(SELECT sd.id, sd.pid, sd.`name`, sd1.short_name FROM sup_depart sd INNER JOIN sup_depart sd1 " + - "ON sd.pid = sd1.id AND sd1.`level`=2 AND sd1.statistics_group_id=3) as temp\n" + + "ON sd.pid = sd1.id AND sd1.`level`=2 AND sd1.statistics_group_id=3) as temp " + "ON ng.involveDepartId=temp.id " + "AND pid=#{departId} " + "AND problemSourcesCode= 13 " + @@ -194,6 +194,52 @@ public interface NegativeMapper extends BaseMapper { "AND discoveryTime BETWEEN #{beginTime} AND #{endTime}") Long getCountByGroupType(Date beginTime, Date endTime, String departId); + @Select("SELECT npr.oneLevelContent as name, count(*) value FROM negative ng, negative_problem_relation npr " + + "WHERE ng.id = npr.negativeId " + + "AND ng.problemSourcesCode in (13, 15) " + + "and ng.checkStatus<>3 " + + "AND ng.discoveryTime BETWEEN #{beginTime} AND #{endTime} " + + "AND oneLevelContent is NOT NULL " + + "GROUP BY oneLevelContent ") + List getProblemTypes(Date beginTime, Date endTime); + + + @Select("SELECT DATE_FORMAT(discoveryTime, '%m') AS `name`, COUNT(*) AS `value` FROM negative " + + "WHERE discoveryTime BETWEEN DATE_SUB(#{time}, INTERVAL 12 MONTH) AND #{time} " + + "AND checkStatus <> 3 " + + "AND problemSourcesCode in (13, 15) " + + "GROUP BY DATE_FORMAT(discoveryTime, '%Y-%m') " + + "ORDER BY DATE_FORMAT(discoveryTime, '%Y-%m');") + List getSupervisionTrend(String time); + + + @Select("SELECT count(*) FROM negative ng INNER JOIN " + + "(SELECT sd.id, sd.pid, sd.`name`, sd1.short_name FROM sup_depart sd INNER JOIN sup_depart sd1 " + + "ON sd.pid = sd1.id AND sd1.`level`=2 AND sd1.statistics_group_id=3) as temp " + + "ON ng.involveDepartId=temp.id " + + "AND pid=#{departId} " + + "AND problemSourcesCode in (13, 15) " + + "AND checkStatus <> 3 " + + "AND isRectifyCode =1 " + + "AND discoveryTime BETWEEN #{beginTime} AND #{endTime}") + Long getNotifyChanged(Date beginTime, Date endTime, String departId); + + + + @Select("SELECT count(*) FROM negative ng INNER JOIN " + + "(SELECT sd.id, sd.pid, sd.`name`, sd1.short_name FROM sup_depart sd INNER JOIN sup_depart sd1 " + + "ON sd.pid = sd1.id AND sd1.`level`=2 AND sd1.statistics_group_id=3) as temp " + + "ON ng.involveDepartId=temp.id " + + "AND pid=#{departId} " + + "AND problemSourcesCode in (13, 15) " + + "AND checkStatus <> 3 " + + "AND isRectifyCode =0 " + + "AND discoveryTime BETWEEN #{beginTime} AND #{endTime}") + Long getNotifyChanging(Date beginTime, Date endTime, String departId); + + @Select("") + Long getRelationOrgCountByDepartId(String departId); + // endregion diff --git a/src/main/java/com/biutag/supervision/pojo/vo/SuperviseMapIconVo.java b/src/main/java/com/biutag/supervision/pojo/vo/SuperviseMapIconVo.java new file mode 100644 index 0000000..979cc00 --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/vo/SuperviseMapIconVo.java @@ -0,0 +1,20 @@ +package com.biutag.supervision.pojo.vo; + +import lombok.Data; + +/** + * @Auther: sh + * @Date: 2024/11/16 21:06 + * @Description: + */ +@Data +public class SuperviseMapIconVo { + private String name; // 分县市局名 + private String totalPro; + private String changing; + private String changed; + private String relationOrg; + private String changedRate; + private String departId; +} + diff --git a/src/main/java/com/biutag/supervision/service/DataSupervisionNotifyServiceImpl.java b/src/main/java/com/biutag/supervision/service/DataSupervisionNotifyServiceImpl.java index 3b2d21b..0fa804c 100644 --- a/src/main/java/com/biutag/supervision/service/DataSupervisionNotifyServiceImpl.java +++ b/src/main/java/com/biutag/supervision/service/DataSupervisionNotifyServiceImpl.java @@ -17,7 +17,9 @@ import com.biutag.supervision.pojo.entity.Negative; import com.biutag.supervision.pojo.entity.NegativeBlame; import com.biutag.supervision.pojo.entity.SupDepart; import com.biutag.supervision.pojo.vo.EchartsVo; +import com.biutag.supervision.pojo.vo.GobalMapIconVo; import com.biutag.supervision.pojo.vo.RankVo; +import com.biutag.supervision.pojo.vo.SuperviseMapIconVo; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @@ -35,13 +37,8 @@ import java.util.stream.Collectors; @Service public class DataSupervisionNotifyServiceImpl extends ServiceImpl { - private final DataSupervisionNotifyMapper dataSupervisionNotifyMapper; - private final NegativeMapper negativeMapper; private final NegativeBlameMapper negativeBlameMapper; - - private final NegativeBlameService blameService; - private final SupDepartMapper supDepartMapper; /** @@ -55,10 +52,10 @@ public class DataSupervisionNotifyServiceImpl extends ServiceImpl totalWrapper = new QueryWrapper<>(); totalWrapper.eq("negativeId", id); + totalWrapper.eq("type", "personal"); supervisionNotifyPreTotal += negativeBlameMapper.selectCount(totalWrapper); } // 整改率 @@ -158,9 +156,70 @@ public class DataSupervisionNotifyServiceImpl extends ServiceImpl getProblemTypeRatio(Date beginTime, Date endTime) { List echartsVos = new ArrayList<>(); + echartsVos = negativeMapper.getProblemTypes(beginTime, endTime); + return echartsVos; + } + + + public List getSupervisionTrend(String year) { + List echartsVos = negativeMapper.getSupervisionTrend(year); + return echartsVos; + } + + /** + * 包括现场督察和专项 + * + * @param beginTime + * @param endTime + * @return + */ + public List getsupervisionMapIconInfo(Date beginTime, Date endTime) { + List res = new ArrayList<>(); + List supDeparts = supDepartMapper.selectDepartsByGroupType(3); + for (SupDepart supDepart : supDeparts) { + SuperviseMapIconVo SuperviseMapIconVo = new SuperviseMapIconVo(); + SuperviseMapIconVo.setName(supDepart.getShortName()); + SuperviseMapIconVo.setDepartId(supDepart.getId()); + res.add(SuperviseMapIconVo); + } + for (SuperviseMapIconVo re : res) { + String departId = re.getDepartId(); + Long changed = negativeMapper.getNotifyChanged(beginTime, endTime, departId); + Long changing = negativeMapper.getNotifyChanging(beginTime, endTime, departId); + Long totalPro = changed + changing; + Long relationOrg = negativeMapper.getRelationOrgCountByDepartId(departId); + QueryWrapper 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); + supervisionNotifyPreTotal += negativeBlameMapper.selectCount(totalWrapper); + } + } return null; } + + + /** + * 涉及人数 + * 1、查出在 negative中的id集合 + * 2、查出集合在blame中的涉及人数 + */ + /*QueryWrapper 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); + supervisionNotifyPreTotal += negativeBlameMapper.selectCount(totalWrapper); + }*/ }