From b102789d46f80d8b1b0bf9d7a7c21b50d8b9a30d 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: Mon, 16 Dec 2024 18:51:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E9=A2=91=E7=9D=A3=E5=AF=9F=E4=BA=8C?= =?UTF-8?q?=E7=BA=A7=E5=A4=A7=E5=B1=8F1.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datav/DataMailViewController.java | 20 +++ .../{datav => subdatav}/SubOneController.java | 67 +++++-- .../SubOneVideoSuperviseController.java | 170 ++++++++++++++++++ .../mapper/DataPetition12337Mapper.java | 6 + .../mapper/DataPetitionComplaintMapper.java | 7 +- .../supervision/mapper/NegativeMapper.java | 70 +++++++- .../supervision/pojo/vo/MailMapIconVo.java | 23 +++ .../supervision/pojo/vo/SubOneOverViewVo.java | 12 +- .../service/DataGlobalService.java | 4 +- .../supervision/service/DataMailService.java | 81 +++++---- .../supervision/service/SubOneService.java | 15 ++ .../service/SubOneVideoSuperviseService.java | 45 +++++ src/main/resources/mapper/NegativeMapper.xml | 51 ++++++ .../service/DataMailServiceTest.java | 33 ++++ 14 files changed, 540 insertions(+), 64 deletions(-) rename src/main/java/com/biutag/supervision/controller/{datav => subdatav}/SubOneController.java (66%) create mode 100644 src/main/java/com/biutag/supervision/controller/subdatav/SubOneVideoSuperviseController.java create mode 100644 src/main/java/com/biutag/supervision/pojo/vo/MailMapIconVo.java create mode 100644 src/main/java/com/biutag/supervision/service/SubOneVideoSuperviseService.java create mode 100644 src/test/java/com/biutag/supervision/service/DataMailServiceTest.java diff --git a/src/main/java/com/biutag/supervision/controller/datav/DataMailViewController.java b/src/main/java/com/biutag/supervision/controller/datav/DataMailViewController.java index 39c0660..c035d90 100644 --- a/src/main/java/com/biutag/supervision/controller/datav/DataMailViewController.java +++ b/src/main/java/com/biutag/supervision/controller/datav/DataMailViewController.java @@ -11,6 +11,7 @@ import com.biutag.supervision.service.DataMailService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; +import org.springframework.cache.annotation.Cacheable; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -98,6 +99,25 @@ public class DataMailViewController { } + /** + * 信访数据中央地图小图标数据 + * @param beginTime 开始时间 + * @param endTime 结束时间 + * @return Result + */ + @Operation(summary = "信访数据中央地图小图标数据") + @GetMapping("/getMailMapIcon") + @Cacheable(cacheNames = "MailMap", key = "'p_'+ #endTime") + public Result getMailMapIcon(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, + @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { + // 信访数据总数概览 + List mailMapIconList = dataMailService.getMailMapIcon(beginTime, endTime); + JSONObject data = new JSONObject().fluentPut("mailMapIconList", mailMapIconList); + return Result.success(data); + } + + + /** * 信访数据大屏信访趋势统计 * @param year 年份 diff --git a/src/main/java/com/biutag/supervision/controller/datav/SubOneController.java b/src/main/java/com/biutag/supervision/controller/subdatav/SubOneController.java similarity index 66% rename from src/main/java/com/biutag/supervision/controller/datav/SubOneController.java rename to src/main/java/com/biutag/supervision/controller/subdatav/SubOneController.java index ad9f8a8..68c23a5 100644 --- a/src/main/java/com/biutag/supervision/controller/datav/SubOneController.java +++ b/src/main/java/com/biutag/supervision/controller/subdatav/SubOneController.java @@ -1,4 +1,4 @@ -package com.biutag.supervision.controller.datav; +package com.biutag.supervision.controller.subdatav; import com.alibaba.fastjson.JSONObject; import com.biutag.supervision.pojo.Result; @@ -28,9 +28,9 @@ import static com.biutag.supervision.constants.enums.ProblemSourcesEnum.*; /** * @Auther: sh * @Date: 2024/12/4 16:30 - * @Description: 一级子屏 + * @Description: 首页一级子屏 */ -@Tag(name = "一级子屏") +@Tag(name = "首页一级子屏") @RequestMapping("datav/sub1/") @RequiredArgsConstructor @RestController @@ -40,9 +40,51 @@ public class SubOneController { private final CountyStreetDeptService countyStreetDeptService; private final SubOneService subOneService; + + // region右边 + @Operation(summary = "获取首页一级子屏督察问题排名") + @GetMapping("/getSubOneSupervisionRank") + public Result getSubOneSupervisionRank(@RequestParam Integer departPId, + @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, + @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { + SubOneOverViewVo supervisionPrecinctOverView = subOneService.getSubOneSupervisionRankOverView(departPId, 10, beginTime, endTime, XCDC.getValue(), ZXDC.getValue(), SPDC.getValue()); + SubOneOverViewVo supervisionTeamOverView = subOneService.getSubOneSupervisionRankOverView(departPId, -1, beginTime, endTime, XCDC.getValue(), ZXDC.getValue(), SPDC.getValue()); + List supervisionPrecinctList = subOneService.getSubOneSupervisionRank(departPId, 10, beginTime, endTime, A12389.getValue(), SLDJB.getValue(), ZDDJB.getValue(), SJJB.getValue()); // 案件核查派出所排名 + List supervisionTeamList = subOneService.getSubOneSupervisionRank(departPId, -1, beginTime, endTime, A12389.getValue(), SLDJB.getValue(), ZDDJB.getValue(), SJJB.getValue()); // 案件核查派出所排名 + JSONObject jsonObject = new JSONObject(); + jsonObject.fluentPut("supervisionPrecinctOverView", supervisionPrecinctOverView) + .fluentPut("supervisionTeamOverView", supervisionTeamOverView) + .fluentPut("supervisionPrecinctList", supervisionPrecinctList) + .fluentPut("supervisionTeamList", supervisionTeamList); + return Result.success(jsonObject); + } + + +// endregion + + // region 中间 + /** + * 获取一级子屏总览 + * @param departPId 2级单位的id + * @param beginTime 开始时间 + * @param endTime 结束时间 + * @return + */ + @Operation(summary = "获取一级子屏总览") + @GetMapping("/getSubOneOverView") + public Result getSubOneOverView(@RequestParam Integer departPId, + @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, + @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { + SubOneOverViewVo subOneOverViewVo = subOneService.getSubOneOverView(departPId, beginTime, endTime); + JSONObject jsonObject = new JSONObject(); + jsonObject.fluentPut("subOneOverViewVo",subOneOverViewVo); + return Result.success(jsonObject); + } + + /** * 获取问题趋势 * @@ -68,6 +110,7 @@ public class SubOneController { /** * 获取地图数据 + * * @param departPId 2级单位的id * @return json格式的地图数据 */ @@ -105,16 +148,17 @@ public class SubOneController { /** * 获取首页一级子屏案件核查排名 - * @param departPId 2级单位的id - * @param beginTime 开始时间 - * @param endTime 结束时间 - * @return 总览和排名 + * + * @param departPId 2级单位的id + * @param beginTime 开始时间 + * @param endTime 结束时间 + * @return 总览和排名 */ @Operation(summary = "获取首页一级子屏案件核查排名") - @GetMapping("/getCaseVerifyRank") - public Result getCaseVerifyRank(@RequestParam Integer departPId, - @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, - @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { + @GetMapping("/getSubOneCaseVerifyRank") + public Result getSubOneCaseVerifyRank(@RequestParam Integer departPId, + @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, + @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { SubOneOverViewVo caseVerifyPrecinctOverView = subOneService.getCaseVerifyOverView(departPId, 10, beginTime, endTime, A12389.getValue(), SLDJB.getValue(), ZDDJB.getValue(), SJJB.getValue()); SubOneOverViewVo caseVerifyTeamOverView = subOneService.getCaseVerifyOverView(departPId, -1, beginTime, endTime, A12389.getValue(), SLDJB.getValue(), ZDDJB.getValue(), SJJB.getValue()); List caseVerifyPrecinctList = subOneService.getCaseVerifyRank(departPId, 10, beginTime, endTime, A12389.getValue(), SLDJB.getValue(), ZDDJB.getValue(), SJJB.getValue()); // 案件核查派出所排名 @@ -129,3 +173,4 @@ public class SubOneController { // endregion } + diff --git a/src/main/java/com/biutag/supervision/controller/subdatav/SubOneVideoSuperviseController.java b/src/main/java/com/biutag/supervision/controller/subdatav/SubOneVideoSuperviseController.java new file mode 100644 index 0000000..cd747d1 --- /dev/null +++ b/src/main/java/com/biutag/supervision/controller/subdatav/SubOneVideoSuperviseController.java @@ -0,0 +1,170 @@ +package com.biutag.supervision.controller.subdatav; + +import com.alibaba.fastjson.JSONObject; +import com.biutag.supervision.pojo.Result; +import com.biutag.supervision.pojo.vo.EchartsVo; +import com.biutag.supervision.pojo.vo.OrganizeProblemRankVo; +import com.biutag.supervision.pojo.vo.VideoSuperviseCountVo; +import com.biutag.supervision.pojo.vo.VideoSuperviseMapIconVo; +import com.biutag.supervision.service.SubOneVideoSuperviseService; +import com.biutag.supervision.service.VideoSuperviseService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Optional; + +import static com.biutag.supervision.constants.enums.ProblemSourcesEnum.SPDC; + +/** + * @Auther: sh + * @Date: 2024/12/16 17:12 + * @Description: + */ +@Tag(name = "视频督察子屏", description = "视频督察子屏") +@RestController +@RequiredArgsConstructor +@RequestMapping("datav/sub1/videoSupervise") +public class SubOneVideoSuperviseController { + + private final SubOneVideoSuperviseService subOneVideoSuperviseService; + + +// //region 左边 +// +// /** +// * 获取视频督察大屏问题数排名 +// * @param beginTime 开始时间 +// * @param endTime 结束时间 +// * @return +// */ +// @Operation(summary = "视频督察大屏问题数排名") +// @GetMapping("/getVideoSuperviseProblemRank") +// public Result getVideoSuperviseProblemRank(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, +// @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { +// List fxsjVideoSuperviseProblemRankList = videoSuperviseService.getVideoSuperviseProblemRank(beginTime, endTime, 3); +// List jsdwVideoSuperviseProblemRankList = videoSuperviseService.getVideoSuperviseProblemRank(beginTime, endTime, 4); +// JSONObject data = new JSONObject(); +// data.fluentPut("fxsjVideoSuperviseProblemRankList", fxsjVideoSuperviseProblemRankList); +// data.fluentPut("jsdwVideoSuperviseProblemRankList", jsdwVideoSuperviseProblemRankList); +// return Result.success(data); +// } +// //endregion +// +// //region 中间 +// +// /** +// * 获取视频督察中央数据 +// * @param beginTime 开始时间 +// * @param endTime 结束时间 +// * @return Result +// */ +// @Operation(summary = "视频督察大屏中央数据") +// @GetMapping("/getAllVideoSuperviseCount") +// public Result getAllVideoSuperviseCount(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, +// @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { +// // 获取视频督察中央数据 +// VideoSuperviseCountVo overview = videoSuperviseService.getAllVideoSuperviseCount(beginTime, endTime); +// JSONObject data = new JSONObject().fluentPut("overview", overview); +// return Result.success(data); +// } +// +// /** +// * 获取视频督察地图数据 +// * @param beginTime 开始时间 +// * @param endTime 结束时间 +// * @return +// */ +// @Operation(summary = "视频督察大屏地图数据") +// @GetMapping("/getVideoSuperviseMap") +// @Cacheable(cacheNames = "videoSuperviseMap", key = "'p_'+ #endTime") +// public Result getVideoSuperviseMap(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, +// @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { +// +// // 地图数据 +// List videoSuperviseMapIconVoList = Optional.ofNullable(videoSuperviseService.getVideoSuperviseMapIconInfo(beginTime, endTime)). +// orElseGet(ArrayList::new); +// JSONObject data = new JSONObject().fluentPut("videoSuperviseMapIconVoList", videoSuperviseMapIconVoList); +// return Result.success(data); +// } +// +// // 获取视频督察大屏中央问题趋势统计 +// @Operation(summary = "数据大屏问题趋势统计") +// @GetMapping("/getVideoSuperviseTrend") +// public Result getVideoSuperviseTrend(@RequestParam Integer year) { +// List videoSuperviseTrendList = videoSuperviseService.getVideoSuperviseTrend(String.valueOf(year), SPDC.getValue()); +// JSONObject jsonObject = new JSONObject().fluentPut("videoSuperviseTrendList", videoSuperviseTrendList); +// return Result.success(jsonObject); +// } +// //endregion +// +// +// // region 右边 +// +// // 问题类型占比 +// @Operation(summary = "数据大屏问题类型占比") +// @GetMapping("/getVideoSuperviseProblemTypeRate") +// public Result getVideoSuperviseProblemTypeRate(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, +// @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { +// List videoSuperviseProblemTypeRate = videoSuperviseService.getVideoSuperviseProblemTypeRate(beginTime, endTime); +// JSONObject jsonObject = new JSONObject().fluentPut("videoSuperviseProblemTypeRate", videoSuperviseProblemTypeRate); +// return Result.success(jsonObject); +// } +// +// +// // endregion + + + @Operation(summary = "视频督察二级大屏问题数排名") + @GetMapping("/getSubOneVideoSuperviseProblemRank") + public Result getSubOneVideoSuperviseProblemRank(@RequestParam Integer departId, + @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, + @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { + List policeVideoSuperviseProblemRankList = subOneVideoSuperviseService.getSuboOneVideoSuperviseProblemRank(beginTime, endTime, 10, departId); + List teamVideoSuperviseProblemRankList = subOneVideoSuperviseService.getSuboOneVideoSuperviseProblemRank(beginTime, endTime, -1, departId); + JSONObject data = new JSONObject(); + data.fluentPut("policeVideoSuperviseProblemRankList", policeVideoSuperviseProblemRankList); + data.fluentPut("teamVideoSuperviseProblemRankList", teamVideoSuperviseProblemRankList); + return Result.success(data); + } + + + /** + * 视频督察二级大屏中央数据 + * + * @param beginTime 开始时间 + * @param endTime 结束时间 + * @return Result + */ + @Operation(summary = "视频督察二级大屏中央数据") + @GetMapping("/getSubOneAllVideoSuperviseCount") + public Result getSubOneAllVideoSuperviseCount(@RequestParam Integer departId, + @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, + @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { + VideoSuperviseCountVo overview = subOneVideoSuperviseService.getSubOneAllVideoSuperviseCount(beginTime, endTime, departId); + JSONObject data = new JSONObject().fluentPut("overview", overview); + return Result.success(data); + } + + + // 获取视频督察大屏中央问题趋势统计 + @Operation(summary = "数据大屏问题趋势统计") + @GetMapping("/getSubOneVideoSuperviseTrend") + public Result getSubOneVideoSuperviseTrend(@RequestParam Integer departId, @RequestParam Integer year) { + List videoSuperviseTrendList = subOneVideoSuperviseService.getSubOneVideoSuperviseTrend(String.valueOf(year), SPDC.getValue(), departId.toString()); + JSONObject jsonObject = new JSONObject().fluentPut("videoSuperviseTrendList", videoSuperviseTrendList); + return Result.success(jsonObject); + } + + +} + diff --git a/src/main/java/com/biutag/supervision/mapper/DataPetition12337Mapper.java b/src/main/java/com/biutag/supervision/mapper/DataPetition12337Mapper.java index 5c92aa0..d959b3d 100644 --- a/src/main/java/com/biutag/supervision/mapper/DataPetition12337Mapper.java +++ b/src/main/java/com/biutag/supervision/mapper/DataPetition12337Mapper.java @@ -6,6 +6,7 @@ import com.biutag.supervision.pojo.vo.EchartsVo; import com.biutag.supervision.pojo.vo.RecentMailTrendByMonthVo; import org.apache.ibatis.annotations.Select; +import java.util.Date; import java.util.List; /** @@ -25,6 +26,11 @@ public interface DataPetition12337Mapper extends BaseMapper { List selectRecentlyMailTrendByMonth12337(String year); List getMailTrend12337(Integer year); + + @Select("select count(*) from data_petition_12337 " + + "where discover_time between #{beginTime} and #{endTime} " + + "and second_depart_id=#{departId}") + Integer select12337MailBySourceCode(Date beginTime, Date endTime, String departId); } diff --git a/src/main/java/com/biutag/supervision/mapper/DataPetitionComplaintMapper.java b/src/main/java/com/biutag/supervision/mapper/DataPetitionComplaintMapper.java index ed948bb..e104b28 100644 --- a/src/main/java/com/biutag/supervision/mapper/DataPetitionComplaintMapper.java +++ b/src/main/java/com/biutag/supervision/mapper/DataPetitionComplaintMapper.java @@ -50,6 +50,7 @@ public interface DataPetitionComplaintMapper extends BaseMapper getMassMailRank(Date beginTime, Date endTime, int groupId); - + @Select("select count(*) from data_petition_complaint dpc " + + "where problem_sources_code=#{problemSourcesCode} " + + "and second_depart_id=#{departId} " + + "and discovery_time between #{beginTime} and #{endTime}") + Integer selectMailBySourceCode(Date beginTime, Date endTime, String problemSourcesCode, String departId); } diff --git a/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java b/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java index 97f7e51..0b5c65a 100644 --- a/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java +++ b/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java @@ -12,7 +12,7 @@ import java.util.List; public interface NegativeMapper extends BaseMapper { -// region 首页大屏 + // region 首页大屏 /** * 查询机构问题问题排名 @@ -57,7 +57,7 @@ public interface NegativeMapper extends BaseMapper { " and sd1.LEVEL=2 AND sd1.statistics_group_id=3" + " ) " + "as temp on ng.involveDepartId=temp.id " + - "WHERE ng.checkStatus<>3 AND problemSourcesCode=11 " + + "WHERE ng.checkStatus<>3 AND problemSourcesCode=(17, 18, 19, 20) " + "AND temp.pid=#{departId} AND discoveryTime BETWEEN #{beginTime} AND #{endTime}") Integer seleGlobalMapIconInfoAjhc(Date beginTime, Date endTime, Integer departId); @@ -98,7 +98,7 @@ public interface NegativeMapper extends BaseMapper { // endregion -// region 现场督察大屏 + // region 现场督察大屏 @Select("SELECT count(DISTINCT(ng.id)) as proTotal, " + "count(DISTINCT IF(ng.isRectifyCode = 1, ng.id, null) ) as changed, " + @@ -140,7 +140,8 @@ public interface NegativeMapper extends BaseMapper { @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, " + + "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 " + @@ -337,12 +338,67 @@ public interface NegativeMapper extends BaseMapper { List getSubOneTrend(@Param("departPId") Integer departPId, @Param("year") Integer year, @Param("args") String[] args); +// endregion - - List getCaseVerifyRank(Integer departPId, Integer statisticsGroupId, Date beginTime, Date endTime, String[] args); + // region 首页大屏的子屏 + List getCaseVerifyRank(Integer departPId, Integer statisticsGroupId, Date beginTime, Date endTime, String[] args); SubOneOverViewVo getCaseVerifyOverView(Integer departPId, Integer statisticsGroupId, Date beginTime, Date endTime, String[] args); + SubOneOverViewVo getSubOneSupervisionRankOverView(Integer departPId, Integer statisticsGroupId, Date beginTime, Date endTime, String[] args); -// endregion + + List getSubOneSupervisionRank(Integer departPId, Integer statisticsGroupId, Date beginTime, Date endTime, String[] args); + + @Select("SELECT count(DISTINCT ng.id) AS one, " + + "COUNT(processing_status='processing' ) AS two, " + + "count(DISTINCT involveDepartId) AS three, " + + "count(DISTINCT nb.blameIdCode) AS four, " + + "COALESCE( ROUND( COUNT(processing_status='completed' ) / NULLIF(COUNT(DISTINCT ng.id), 0) * 100, 1), 0) AS five " + + "FROM negative ng " + + "INNER JOIN (SELECT id, short_name FROM sup_depart sd WHERE sd.pid = #{departPId} ) AS temp ON ng.involveDepartId=temp.id " + + "LEFT JOIN negative_blame nb ON ng.id=nb.negativeId " + + " WHERE discoveryTime BETWEEN #{beginTime} and #{endTime}") + SubOneOverViewVo getSubOneOverView(Integer departPId, Date beginTime, Date endTime); + // endregion + + @Select("SELECT COUNT(DISTINCT ng.id) AS discoverProblem, " + + "COUNT(DISTINCT IF(ng.isRectifyCode=1, ng.id, NULL)) AS changedProblem, " + + "COUNT(DISTINCT ng.involveDepartId) AS relativeOrg, " + + "COUNT(DISTINCT nb.blameName) AS relativePer, " + + "IFNULL( ROUND((COUNT(DISTINCT IF(ng.isRectifyCode=1, ng.id, NULL)) / COUNT(DISTINCT ng.id)) * 100, 1), 0) AS changedRate " + + "FROM sup_depart sd " + + "INNER JOIN negative ng ON sd.id = ng.involveDepartId AND sd.pid=#{departId} " + + "LEFT JOIN negative_blame nb ON ng.id = nb.negativeId " + + "WHERE ng.checkStatus IN ('1','2') " + + "AND problemSourcesCode = 16 " + + "AND discoveryTime BETWEEN #{beginTime} AND #{endTime}; ") + VideoSuperviseCountVo getSubOneAllVideoSuperviseCount(Date beginTime, Date endTime, Integer departId); + + @Select("SELECT sd.short_name AS label, " + + "count(*) as `value` " + + " FROM negative ng " + + "INNER JOIN sup_depart sd ON ng.involveDepartId=sd.id " + + "AND sd.pid=#{departId} AND sd.statistics_group_id=10 " + + "WHERE checkStatus <> 3 " + + "AND problemSourcesCode=16 " + + "AND discoveryTime BETWEEN #{beginTime} AND #{endTime} " + + "GROUP BY sd.short_name " + + "ORDER BY `value` DESC ") + List getSuboOneVideoSupervisePoliceProblemRank(Date beginTime, Date endTime, Integer groupId, Integer departId); + + @Select("SELECT sd.short_name AS label, " + + "count(*) as `value` " + + " FROM negative ng " + + "INNER JOIN sup_depart sd ON ng.involveDepartId=sd.id " + + "AND sd.pid=#{departId} AND sd.statistics_group_id!=10 " + + "WHERE checkStatus <> 3 " + + "AND problemSourcesCode=16 " + + "AND discoveryTime BETWEEN #{beginTime} AND #{endTime} " + + "GROUP BY sd.short_name " + + "ORDER BY `value` DESC ") + List getSuboOneVideoSuperviseTeamProblemRank(Date beginTime, Date endTime, Integer groupId, Integer departId); + + + List getSubOneVideoSuperviseTrend(String year, String problemCode, String departId); } diff --git a/src/main/java/com/biutag/supervision/pojo/vo/MailMapIconVo.java b/src/main/java/com/biutag/supervision/pojo/vo/MailMapIconVo.java new file mode 100644 index 0000000..8b3b9d5 --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/vo/MailMapIconVo.java @@ -0,0 +1,23 @@ +package com.biutag.supervision.pojo.vo; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Auther: sh + * @Date: 2024/12/16 09:26 + * @Description: 信访大屏地图vo + */ +@Data +public class MailMapIconVo implements Serializable { + private String name; // 分县市局名字 + private String departId; // 分县市局id + + private String total; + private String countryTotal; + private String policeTotal; + private String commissionerTotal; + private String numTotal; // 12337 +} + diff --git a/src/main/java/com/biutag/supervision/pojo/vo/SubOneOverViewVo.java b/src/main/java/com/biutag/supervision/pojo/vo/SubOneOverViewVo.java index 4535649..dd19f0d 100644 --- a/src/main/java/com/biutag/supervision/pojo/vo/SubOneOverViewVo.java +++ b/src/main/java/com/biutag/supervision/pojo/vo/SubOneOverViewVo.java @@ -16,11 +16,11 @@ import java.io.Serializable; @NoArgsConstructor public class SubOneOverViewVo implements Serializable { // 首页大屏一级子屏的各种总览,从左到右对应 - private String one; - private String two; - private String three; - private String four; - private String five; - private String six; + private Integer one; + private Integer two; + private Integer three; + private Integer four; + private Integer five; + private Integer six; } diff --git a/src/main/java/com/biutag/supervision/service/DataGlobalService.java b/src/main/java/com/biutag/supervision/service/DataGlobalService.java index 5f24a2a..ff0c7cb 100644 --- a/src/main/java/com/biutag/supervision/service/DataGlobalService.java +++ b/src/main/java/com/biutag/supervision/service/DataGlobalService.java @@ -14,6 +14,8 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; +import static com.biutag.supervision.constants.enums.DepartGroupEnum.COUNTY_CITY_BUREAUS; + /** * 数据大屏服务层 * @@ -97,7 +99,7 @@ public class DataGlobalService { // 地图数据 public List getMapIconInfo(Date beginTime, Date endTime) { List res = new ArrayList<>(); - List supDeparts = supDepartMapper.selectDepartsByGroupType(3); + List supDeparts = supDepartMapper.selectDepartsByGroupType(COUNTY_CITY_BUREAUS.getId()); for (SupDepart supDepart : supDeparts) { GlobalMapIconVo mapIconVo = new GlobalMapIconVo(); mapIconVo.setName(supDepart.getShortName()); diff --git a/src/main/java/com/biutag/supervision/service/DataMailService.java b/src/main/java/com/biutag/supervision/service/DataMailService.java index bf47793..4ef1291 100644 --- a/src/main/java/com/biutag/supervision/service/DataMailService.java +++ b/src/main/java/com/biutag/supervision/service/DataMailService.java @@ -12,21 +12,29 @@ import com.biutag.supervision.constants.enums.*; import com.biutag.supervision.mapper.DataPetition12337Mapper; import com.biutag.supervision.mapper.DataPetitionComplaintMapper; import com.biutag.supervision.mapper.NegativeMapper; +import com.biutag.supervision.mapper.SupDepartMapper; import com.biutag.supervision.pojo.dto.*; import com.biutag.supervision.pojo.entity.DataPetition12337; import com.biutag.supervision.pojo.entity.DataPetitionComplaint; +import com.biutag.supervision.pojo.entity.SupDepart; import com.biutag.supervision.pojo.param.DataPetitionComplaintQueryParam; import com.biutag.supervision.pojo.vo.*; import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; + import java.time.LocalDate; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; +import java.util.ArrayList; import java.util.Date; import java.util.List; +import static com.biutag.supervision.constants.enums.DepartGroupEnum.COUNTY_CITY_BUREAUS; +import static com.biutag.supervision.constants.enums.ProblemSourcesEnum.*; + @RequiredArgsConstructor @Service public class DataMailService extends ServiceImpl { @@ -36,8 +44,10 @@ public class DataMailService extends ServiceImpl page(DataPetitionComplaintQueryParam queryParam) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(DataPetitionComplaint::getProblemSourcesCode, queryParam.getProblemSourcesCode()) @@ -145,41 +155,11 @@ public class DataMailService extends ServiceImpl queryWrapper12337 = new QueryWrapper<>(); + QueryWrapper queryWrapper12337 = new QueryWrapper<>(); Long numberMail = dataPetition12337Mapper.selectCount(queryWrapper12337); System.out.println("12337信访数量:" + numberMail); -// // 初访 -// QueryWrapper firstQueryWrapper = new QueryWrapper<>(); -// firstQueryWrapper.eq("initial_petition", 1); -// firstQueryWrapper.between("discovery_time", beginTime, endTime); -// Long firstMail = dataPetitionComplaintMapper.selectCount(firstQueryWrapper); -// // 重访 -// QueryWrapper secondQueryWrapper = new QueryWrapper<>(); -// secondQueryWrapper.eq("initial_petition", 2); -// secondQueryWrapper.between("discovery_time", beginTime, endTime); -// Long secondMail = dataPetitionComplaintMapper.selectCount(secondQueryWrapper); -// // 领导接访 -// QueryWrapper leaderQueryWrapper = new QueryWrapper<>(); -// leaderQueryWrapper.isNotNull("receiving_leader_name"); -// leaderQueryWrapper.between("discovery_time", beginTime, endTime); -// Long leaderReceiveMail = dataPetitionComplaintMapper.selectCount(leaderQueryWrapper); -// // 领导督办 -// QueryWrapper leaderViewQueryWrapper = new QueryWrapper<>(); -// leaderViewQueryWrapper.isNotNull("receiving_leader_name"); -// leaderViewQueryWrapper.between("discovery_time", beginTime, endTime); -// Long leaderViewMail = dataPetitionComplaintMapper.selectCount(leaderViewQueryWrapper); -// // 闹访 1:闹 0:不闹 -// QueryWrapper tangleQueryWrapper = new QueryWrapper<>(); -// tangleQueryWrapper.eq("entanglement_visits", 1); -// tangleQueryWrapper.between("discovery_time", beginTime, endTime); -// Long tangleMail = dataPetitionComplaintMapper.selectCount(tangleQueryWrapper); -// // 集访 1:集 0:不集 -// QueryWrapper massQueryWrapper = new QueryWrapper<>(); -// massQueryWrapper.eq("mass_visits", 1); -// massQueryWrapper.between("discovery_time", beginTime, endTime); -// Long massMail = dataPetitionComplaintMapper.selectCount(massQueryWrapper); // 总数 - long totalMail = countryMail+policeMail+numberMail; + long totalMail = countryMail + policeMail + numberMail; JSONObject overview = new JSONObject() // 信访总数(起) @@ -204,7 +184,7 @@ public class DataMailService extends ServiceImpl getRecentlyMailTrendByDay(Integer sourcesCode, Integer days, Date endTime) { + public List getRecentlyMailTrendByDay(Integer sourcesCode, Integer days, Date endTime) { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd"); // 将 endTime 转换为 LocalDate LocalDate endLocalDate = endTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); @@ -231,24 +211,23 @@ public class DataMailService extends ServiceImpl getMailTrend(Integer year, Integer type) { - List res = negativeMapper.getMailTrend(year, type); + List res = negativeMapper.getMailTrend(year, type); return res; } - public MailFirstAndRepeatOverviewVo getFirstAndRepeatOverview(Date beginTime, Date endTime) { MailFirstAndRepeatOverviewVo res = dataPetitionComplaintMapper.getFirstAndRepeatOverview(beginTime, endTime); return res; } public List getMailRank(Date beginTime, Date endTime, int groupId, Integer isRepeat) { - List res = dataPetitionComplaintMapper.getMailRank(beginTime, endTime, groupId, isRepeat); + List res = dataPetitionComplaintMapper.getMailRank(beginTime, endTime, groupId, isRepeat); return res; } @@ -263,7 +242,6 @@ public class DataMailService extends ServiceImpl getEntanglementMailRank(Date beginTime, Date endTime, int groupId) { List res = dataPetitionComplaintMapper.getEntanglementMailRank(beginTime, endTime, groupId); return res; @@ -278,4 +256,31 @@ public class DataMailService extends ServiceImpl res = dataPetition12337Mapper.getMailTrend12337(year); return res; } + + public List getMailMapIcon(Date beginTime, Date endTime) { + List res = new ArrayList<>(); + List supDeparts = supDepartMapper.selectDepartsByGroupType(COUNTY_CITY_BUREAUS.getId()); + for (SupDepart supDepart : supDeparts) { + MailMapIconVo mapIconVo = new MailMapIconVo(); + mapIconVo.setName(supDepart.getShortName()); + mapIconVo.setDepartId(supDepart.getId()); + res.add(mapIconVo); + } + for (MailMapIconVo re : res) { + String departId = re.getDepartId(); + Integer countryTotal = dataPetitionComplaintMapper.selectMailBySourceCode(beginTime, endTime, GJXFPT.getValue(), departId); + Integer policeTotal = dataPetitionComplaintMapper.selectMailBySourceCode(beginTime, endTime, GABXF.getValue(), departId); +// String commissionerTotal = dataPetitionComplaintMapper.selectMailBySourceCode(beginTime, endTime, JZXX.getValue(), departId); + Integer commissionerTotal = 0; + Integer numTotal = dataPetition12337Mapper.select12337MailBySourceCode(beginTime, endTime, departId); + Integer total = countryTotal + policeTotal + commissionerTotal + numTotal; +// if (StringUtils.isAnyBlank(departId, total.toString() )) + re.setCountryTotal(countryTotal.toString()); + re.setPoliceTotal(policeTotal.toString()); + re.setCommissionerTotal(commissionerTotal.toString()); + re.setNumTotal(numTotal.toString()); + re.setTotal(total.toString()); + } + return res; + } } diff --git a/src/main/java/com/biutag/supervision/service/SubOneService.java b/src/main/java/com/biutag/supervision/service/SubOneService.java index 75de3a7..1270fac 100644 --- a/src/main/java/com/biutag/supervision/service/SubOneService.java +++ b/src/main/java/com/biutag/supervision/service/SubOneService.java @@ -39,5 +39,20 @@ public class SubOneService { SubOneOverViewVo res = negativeMapper.getCaseVerifyOverView(departPId, statisticsGroupId, beginTime, endTime, args); return res; } + + public SubOneOverViewVo getSubOneSupervisionRankOverView(Integer departPId, Integer statisticsGroupId, Date beginTime, Date endTime, String... args) { + SubOneOverViewVo res = negativeMapper.getSubOneSupervisionRankOverView(departPId, statisticsGroupId, beginTime, endTime, args); + return res; + } + + public List getSubOneSupervisionRank(Integer departPId, Integer statisticsGroupId, Date beginTime, Date endTime, String... args) { + List res = negativeMapper.getSubOneSupervisionRank(departPId, statisticsGroupId, beginTime, endTime, args); + return res; + } + + public SubOneOverViewVo getSubOneOverView(Integer departPId, Date beginTime, Date endTime) { + SubOneOverViewVo res = negativeMapper.getSubOneOverView(departPId, beginTime, endTime); + return res; + } } diff --git a/src/main/java/com/biutag/supervision/service/SubOneVideoSuperviseService.java b/src/main/java/com/biutag/supervision/service/SubOneVideoSuperviseService.java new file mode 100644 index 0000000..7d46203 --- /dev/null +++ b/src/main/java/com/biutag/supervision/service/SubOneVideoSuperviseService.java @@ -0,0 +1,45 @@ +package com.biutag.supervision.service; + +import com.biutag.supervision.mapper.NegativeMapper; +import com.biutag.supervision.pojo.vo.EchartsVo; +import com.biutag.supervision.pojo.vo.OrganizeProblemRankVo; +import com.biutag.supervision.pojo.vo.VideoSuperviseCountVo; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * @Auther: sh + * @Date: 2024/12/16 17:18 + * @Description: + */ + +@RequiredArgsConstructor +@Service +public class SubOneVideoSuperviseService { + private final NegativeMapper negativeMapper; + + public VideoSuperviseCountVo getSubOneAllVideoSuperviseCount(Date beginTime, Date endTime, Integer departId) { + VideoSuperviseCountVo res = negativeMapper.getSubOneAllVideoSuperviseCount(beginTime, endTime, departId); + return res; + } + + public List getSuboOneVideoSuperviseProblemRank(Date beginTime, Date endTime, Integer groupId, Integer departId) { + List res ; + if (groupId == 10) { + res = negativeMapper.getSuboOneVideoSupervisePoliceProblemRank(beginTime, endTime, groupId, departId); + } else { + res = negativeMapper.getSuboOneVideoSuperviseTeamProblemRank(beginTime, endTime, groupId, departId); + } + return res; + } + + public List getSubOneVideoSuperviseTrend(String year, String problemCode, String departId) { + List res = negativeMapper.getSubOneVideoSuperviseTrend(year, problemCode, departId); + return res; + } +} + diff --git a/src/main/resources/mapper/NegativeMapper.xml b/src/main/resources/mapper/NegativeMapper.xml index d37451c..97778bc 100644 --- a/src/main/resources/mapper/NegativeMapper.xml +++ b/src/main/resources/mapper/NegativeMapper.xml @@ -141,6 +141,57 @@ AND discoveryTime BETWEEN #{beginTime} AND #{endTime}; + + + + + + diff --git a/src/test/java/com/biutag/supervision/service/DataMailServiceTest.java b/src/test/java/com/biutag/supervision/service/DataMailServiceTest.java new file mode 100644 index 0000000..078fb0b --- /dev/null +++ b/src/test/java/com/biutag/supervision/service/DataMailServiceTest.java @@ -0,0 +1,33 @@ +package com.biutag.supervision.service; + +import com.biutag.supervision.pojo.vo.MailMapIconVo; +import jakarta.annotation.Resource; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +import javax.xml.crypto.Data; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.*; + +@SpringBootTest +class DataMailServiceTest { + + @Resource + private DataMailService dataMailService; + @Test + void getMailMapIcon() throws ParseException { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + Date begin = formatter.parse("2024-01-01"); + Date end = formatter.parse("2024-12-29"); + List mailMapIcon = dataMailService.getMailMapIcon(begin, end); + for (MailMapIconVo mailMapIconVo : mailMapIcon) { + System.out.println(mailMapIconVo.toString()); + } + + } +} \ No newline at end of file