diff --git a/src/main/java/com/biutag/supervision/controller/datav/DataVGlobalController.java b/src/main/java/com/biutag/supervision/controller/datav/DataVGlobalController.java index afb84f8..bd42c6e 100644 --- a/src/main/java/com/biutag/supervision/controller/datav/DataVGlobalController.java +++ b/src/main/java/com/biutag/supervision/controller/datav/DataVGlobalController.java @@ -1,13 +1,16 @@ package com.biutag.supervision.controller.datav; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.biutag.supervision.constants.enums.ProblemSourcesEnum; import com.biutag.supervision.mapper.NegativeMapper; +import com.biutag.supervision.mapper.SupDepartMapper; import com.biutag.supervision.pojo.Result; import com.biutag.supervision.pojo.entity.Negative; +import com.biutag.supervision.pojo.entity.SupDepart; import com.biutag.supervision.pojo.vo.*; import com.biutag.supervision.service.DataMailService; import com.biutag.supervision.service.NegativeService; @@ -23,6 +26,7 @@ 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; @@ -46,6 +50,7 @@ public class DataVGlobalController { private final NegativeService negativeService; + private final SupDepartMapper supDepartMapper; //region 左边 /** @@ -128,8 +133,28 @@ public class DataVGlobalController { public Result getGlobalMap(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { // 地图数据 - List list = negativeMapper.getGlobalMap(beginTime, endTime); - JSONObject data = new JSONObject().fluentPut("globalTempMapVoList", list); + List mapIconVos = new ArrayList<>(); + List list = supDepartMapper.selectList(new LambdaQueryWrapper().eq(SupDepart::getStatisticsGroupId,"3")); + list.forEach((s)->{ + Integer departId =Integer.valueOf(s.getId()); + GlobalMapIconVo vos=new GlobalMapIconVo(); + GlobalOverViewVo overview = negativeMapper.getSuoOneAllGlobalCount(departId, beginTime, endTime); + MailOverviewVo vo = dataMailService.mailCount(departId,beginTime, endTime); + // 局长信箱 + 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()); + BeanUtil.copyProperties(overview,vos); + vos.setName(s.getShortName()); + vos.setDepartId(s.getId()); + mapIconVos.add(vos); + }); + JSONObject data = new JSONObject().fluentPut("globalTempMapVoList", mapIconVos); return Result.success(data); } diff --git a/src/main/java/com/biutag/supervision/controller/datav/DataVVideoSuperviseController.java b/src/main/java/com/biutag/supervision/controller/datav/DataVVideoSuperviseController.java index d837b8b..af33523 100644 --- a/src/main/java/com/biutag/supervision/controller/datav/DataVVideoSuperviseController.java +++ b/src/main/java/com/biutag/supervision/controller/datav/DataVVideoSuperviseController.java @@ -1,6 +1,7 @@ package com.biutag.supervision.controller.datav; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ArrayUtil; import com.alibaba.fastjson.JSONObject; import com.biutag.supervision.mapper.NegativeMapper; import com.biutag.supervision.mapper.WvpDeviceChannelMapper; @@ -128,8 +129,11 @@ public class DataVVideoSuperviseController { orElseGet(ArrayList::new); List list =negativeMapper.selectRelativePer(beginTime,endTime); videoSuperviseMapIconVoList.forEach(s->{ - int relativePer = list.stream().filter(b->b.getName().contains(s.getDepartId())).toList().get(0).getValue(); - s.setRelativePer(relativePer); + List echartsVoList= list.stream().filter(b->b.getName().contains(s.getDepartId())).toList(); + if(!echartsVoList.isEmpty()){ + int relativePer = echartsVoList.get(0).getValue(); + s.setRelativePer(relativePer); + } }); JSONObject data = new JSONObject().fluentPut("videoSuperviseMapIconVoList", videoSuperviseMapIconVoList); 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 13ce64c..af11dce 100644 --- a/src/main/java/com/biutag/supervision/controller/subdatav/SubOneGlobalController.java +++ b/src/main/java/com/biutag/supervision/controller/subdatav/SubOneGlobalController.java @@ -1,13 +1,14 @@ package com.biutag.supervision.controller.subdatav; import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.biutag.supervision.constants.enums.ProblemSourcesEnum; import com.biutag.supervision.mapper.NegativeMapper; import com.biutag.supervision.mapper.NegativeProblemRelationMapper; import com.biutag.supervision.pojo.Result; +import com.biutag.supervision.pojo.entity.Negative; import com.biutag.supervision.pojo.vo.*; -import com.biutag.supervision.service.CountyStreetDeptService; -import com.biutag.supervision.service.DataGlobalService; -import com.biutag.supervision.service.SubOneService; +import com.biutag.supervision.service.*; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; @@ -37,8 +38,8 @@ public class SubOneGlobalController { private final NegativeMapper negativeMapper; private final CountyStreetDeptService countyStreetDeptService; - - + private final DataMailService dataMailService; + private final NegativeService negativeService; /** * 获取地图数据, 所有二级地图的json数据 * @@ -118,6 +119,18 @@ public class SubOneGlobalController { @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { // 获取数据大屏中央总数概览 GlobalOverViewVo overview = negativeMapper.getSuoOneAllGlobalCount(departId, beginTime, endTime); + + MailOverviewVo vo = dataMailService.mailCount(departId,beginTime, endTime); + // 局长信箱 + 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); } @@ -136,9 +149,21 @@ public class SubOneGlobalController { public Result getSubOneMap(@RequestParam Integer departId, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { + // 地图数据 - List GlobalTempMapVoList = negativeMapper.getSubOneGlobalMap(beginTime, endTime, departId); - JSONObject data = new JSONObject().fluentPut("globalTempMapVoList", GlobalTempMapVoList); + List globalMapIconVoList = negativeMapper.getSubOneGlobalMap(beginTime, endTime, departId); + globalMapIconVoList.forEach(s->{ + long mailboxNumber = negativeService.count(new LambdaQueryWrapper() + .between(Negative::getCrtTime, beginTime, endTime) + .eq(Negative::getProblemSourcesCode, ProblemSourcesEnum.JZXX.getValue()) + .eq(Negative::getThreeInvolveDepartId,s.getDepartId()) + ); + s.setMailboxNumber(mailboxNumber); + MailOverviewVo vo = dataMailService.mailCount(Integer.valueOf(s.getDepartId()),beginTime, endTime); + s.setComplaintPro(vo.getCountryMail() + vo.getPoliceMail() + vo.getNumberMail()); + }); + + JSONObject data = new JSONObject().fluentPut("globalTempMapVoList", globalMapIconVoList); 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 d837144..e852dcf 100644 --- a/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java +++ b/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java @@ -47,21 +47,34 @@ public interface NegativeMapper extends BaseMapper { "and checkStatus in (1, 2) " + "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.second_involve_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); - // 中央总览 + // 中央总览 todo @Select("SELECT " + "count(ng.id) AS totalPro, " + "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 (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}; ") GlobalOverViewVo getAllGlobalCount(Date beginTime, Date endTime); + + + // 地图卡片 @Select("SELECT " + "sd.short_name AS `name`, " + @@ -382,7 +395,7 @@ public interface NegativeMapper extends BaseMapper { "WHERE ng.crtTime BETWEEN #{beginTime} AND #{endTime} " + "AND sd.statistics_group_id=10 " + "AND sd.pid=#{departId} " + - "AND problemSourcesCode IN (2,13,15,16,17,18,19,20,21,22,23,24,25,27,28,29,30) " + + "AND problemSourcesCode IN (2,13,14,15,16,17,18,19,20,21,22,23,24,25,27,28,29,30) " + "GROUP BY sd.short_name " + "ORDER BY `value` DESC;") List selectPoliceOrganizeProblemRank(Integer departId, Date beginTime, Date endTime); @@ -395,7 +408,7 @@ public interface NegativeMapper extends BaseMapper { "WHERE ng.crtTime BETWEEN #{beginTime} AND #{endTime} " + "AND sd.statistics_group_id!=10 " + "AND sd.pid=#{departId} " + - "AND problemSourcesCode IN (2,13,15,16,17,18,19,20,21,22,23,24,25,27,28,29,30) " + + "AND problemSourcesCode IN (2,13,14,15,16,17,18,19,20,21,22,23,24,25,27,28,29,30) " + "GROUP BY sd.short_name " + "ORDER BY `value` DESC;") List selectTeamOrganizeProblemRank(Integer departId, Date beginTime, Date endTime); @@ -410,33 +423,25 @@ public interface NegativeMapper extends BaseMapper { "GROUP BY businessTypeName") List selectSubOneBusinessRate(Integer departId, Date beginTime, Date endTime); - @Select("SELECT " + - "COALESCE(SUM(IF(problemSourcesCode IN (2, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 28, 29, 30), 1, 0)), 0) AS totalPro, " + - "COALESCE(SUM(IF(problemSourcesCode IN (13, 15, 16), 1, 0)), 0) AS supervisionPro, " + - "COALESCE(SUM(IF(problemSourcesCode IN (17, 18, 19, 20), 1, 0)), 0) AS caseVerificationPro, " + - "COALESCE(SUM(IF(problemSourcesCode IN (21, 22, 23, 24, 25), 1, 0)), 0) AS complaintPro, " + - "COALESCE(SUM(IF(problemSourcesCode IN (2), 1, 0)), 0) AS talkPro, " + - "COALESCE(SUM(IF(problemSourcesCode IN (27, 28, 29, 30), 1, 0)), 0) AS auditPro " + - "FROM negative ng WHERE ng.crtTime BETWEEN #{beginTime} AND #{endTime} " + - "AND ng.second_involve_depart_id=#{departId} ") - GlobalOverViewVo getSuoOneAllGlobalCount(Integer departId, Date beginTime, Date endTime); - @Select("SELECT " + - "csd.`name` AS `name`, " + - "csd.dept_name AS policeName, " + - "csd.dept_pid, " + - "csd.dept_id AS departId, " + - "COUNT( DISTINCT ng.id ) AS totalPro, " + - "SUM( IF(problemSourcesCode IN (13,15,16), 1, 0) ) AS supervisePro, " + - "SUM( IF(problemSourcesCode IN (17,18,19,20), 1, 0) ) AS caseVerifyPro, " + - "SUM( IF(problemSourcesCode IN (21,22,23,24,25),1, 0) ) AS mailPro, " + - "SUM( IF(problemSourcesCode IN (2),1, 0) ) AS policePro, " + - "SUM( IF(problemSourcesCode IN (27,28,29,30),1, 0) ) AS reviewPro " + - "FROM county_street_dept csd " + - "LEFT JOIN negative ng ON ng.three_involve_depart_id=csd.dept_id " + - "AND ng.crtTime BETWEEN #{beginTime} AND #{endTime} " + - "AND ng.second_involve_depart_id=#{departId} " + - "GROUP BY csd.dept_name " + - "HAVING csd.dept_pid=#{departId} ") + + + @Select(" SELECT " + + " csd.name as `name`, " + + " csd.dept_name as policeName, " + + " csd.dept_id as departId, " + + " csd.dept_pid, " + + " COUNT(ng.id) as totalPro ,"+ + " COALESCE(SUM(IF(ng.problemSourcesCode IN (13), 1, 0)), 0) AS supervisionPro, " + + " COALESCE(SUM(IF(ng.problemSourcesCode IN (14,15,16), 1, 0)), 0) AS numSupervisionPro, " + + " COALESCE(SUM(IF(ng.problemSourcesCode IN (17,18,19,20), 1, 0)), 0) AS caseVerificationPro, " + + " COALESCE(SUM(IF(ng.problemSourcesCode IN (27,28,29,30), 1, 0)), 0) AS auditPro, " + + " COALESCE(SUM(IF(ng.problemSourcesCode IN (2), 1, 0)), 0) AS talkPro " + + " from county_street_dept csd " + + " LEFT JOIN negative ng ON ng.three_involve_depart_id=csd.dept_id " + + " WHERE ng.crtTime BETWEEN #{beginTime} AND #{endTime} " + + " and ng.second_involve_depart_id = #{departId} " + + " GROUP BY csd.dept_name " + + " HAVING csd.dept_pid= #{departId} ") List getSubOneGlobalMap(Date beginTime, Date endTime, Integer departId); @@ -495,17 +500,29 @@ public interface NegativeMapper extends BaseMapper { List getSubOneVideoSuperviseTrend(String year, String problemCode, String departId); - @Select("SELECT COUNT(DISTINCT ng.id) AS discoverProblem, " + - "COUNT(DISTINCT IF(ng.processing_status='completed', ng.id, NULL)) AS completionProblem, " + - "COUNT(DISTINCT ng.involveDepartId) AS relativeOrg, " + - "COUNT(DISTINCT nb.blameName) AS relativePer, " + - "IFNULL( ROUND((COUNT(DISTINCT IF(ng.processing_status='completed', ng.id, NULL)) / COUNT(DISTINCT ng.id)) * 100, 1), 0) AS completionRate " + - "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 ng.crtTime BETWEEN #{beginTime} AND #{endTime}; ") +// @Select("SELECT COUNT(DISTINCT ng.id) AS discoverProblem, " + +// "COUNT(DISTINCT IF(ng.processing_status='completed', ng.id, NULL)) AS completionProblem, " + +// "COUNT(DISTINCT ng.involveDepartId) AS relativeOrg, " + +// "COUNT(DISTINCT nb.blameName) AS relativePer, " + +// "IFNULL( ROUND((COUNT(DISTINCT IF(ng.processing_status='completed', ng.id, NULL)) / COUNT(DISTINCT ng.id)) * 100, 1), 0) AS completionRate " + +// "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 ng.crtTime BETWEEN #{beginTime} AND #{endTime}; ") + @Select("SELECT " + + "COUNT(DISTINCT ng.id) total, " + + "COUNT(DISTINCT IF(ng.checkStatus IN ('1','2'), ng.id, NULL)) AS discoverProblem, " + + "COUNT(DISTINCT IF(ng.processing_status='completed', ng.id, NULL)) AS completionProblem, " + + "COUNT(IF(nb.type ='department' and ng.checkStatus IN ('1','2') and nb.handleResultName != '不予追责' and nb.handleResultCode is not null and nb.handleResultCode != '', nb.blameId, NULL)) AS relativeOrg, " + + "COUNT(IF(nb.type ='personal' and ng.checkStatus IN ('1','2') and nb.handleResultName != '不予追责' and nb.handleResultCode is not null and nb.handleResultCode != '', nb.blameId, NULL)) AS relativePer, " + + "IFNULL( ROUND((COUNT(DISTINCT IF(ng.processing_status='completed', ng.id, NULL)) / COUNT(DISTINCT ng.id)) * 100, 1), 0) AS completionRate " + + "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 problemSourcesCode = 16 " + + "AND ng.crtTime BETWEEN #{beginTime} AND #{endTime} ") VideoSuperviseCountVo getSubOneAllVideoSuperviseCount(Date beginTime, Date endTime, Integer departId); @Select("SELECT npr.threeLevelContent AS `name`, " + diff --git a/src/main/java/com/biutag/supervision/pojo/vo/GlobalMapIconVo.java b/src/main/java/com/biutag/supervision/pojo/vo/GlobalMapIconVo.java index 24971a7..fd19e06 100644 --- a/src/main/java/com/biutag/supervision/pojo/vo/GlobalMapIconVo.java +++ b/src/main/java/com/biutag/supervision/pojo/vo/GlobalMapIconVo.java @@ -16,14 +16,25 @@ import java.io.Serializable; public class GlobalMapIconVo { private String name; // 分县市局名称 - private Integer totalPro; // 总问题 - private Integer supervisePro; // 督察问题 - private Integer numSupervisePro; - private Integer caseVerifyPro; // 案件核查问题 - private Integer mailPro; // 信访投诉问题 - private Integer policePro; // 警务评议问题 - private Integer reviewPro; // 审计监督问题 - private Integer departId; // 分县市局ID + //现场督查 + Long supervisionPro; + + //数字督查(14,15,16) + Long numSupervisionPro; + //案件核查 + Long caseVerificationPro; + //信访投诉 + Long complaintPro; + // 民意感知 + Long talkPro; + //审计 + Long auditPro; + //总数 + Long totalPro; + //局长信箱 + private Long mailboxNumber; + + private String departId; // 分县市局ID } diff --git a/src/main/java/com/biutag/supervision/service/DataMailService.java b/src/main/java/com/biutag/supervision/service/DataMailService.java index ecdf3d6..2d99016 100644 --- a/src/main/java/com/biutag/supervision/service/DataMailService.java +++ b/src/main/java/com/biutag/supervision/service/DataMailService.java @@ -75,6 +75,43 @@ public class DataMailService extends ServiceImpl countryQueryWrapper = new QueryWrapper<>(); + countryQueryWrapper.eq("problem_sources_code", 21); + countryQueryWrapper.between("create_time", beginTime, endTime); + countryQueryWrapper.eq("second_depart_id",deptId); + Long countryMail = dataPetitionComplaintMapper.selectCount(countryQueryWrapper); + + + // 公安部信访 + QueryWrapper policeQueryWrapper = new QueryWrapper<>(); + policeQueryWrapper.eq("problem_sources_code", 22); + policeQueryWrapper.between("create_time", beginTime, endTime); + policeQueryWrapper.eq("second_depart_id",deptId); + Long policeMail = dataPetitionComplaintMapper.selectCount(policeQueryWrapper); + + // 12337 + long mail12337 = negativeService.count( + new LambdaQueryWrapper() + .between(Negative::getCrtTime, beginTime, endTime) + .eq(Negative::getProblemSourcesCode, ProblemSourcesEnum.XF12337.getValue()) + .eq(Negative::getSecondInvolveDepartId,deptId) + ); + // 局长信箱 + long mailCount = negativeService.count(new LambdaQueryWrapper().between(Negative::getCrtTime, beginTime, endTime).eq(Negative::getProblemSourcesCode, ProblemSourcesEnum.JZXX.getValue()) .eq(Negative::getSecondInvolveDepartId,deptId)); + + temp.setCountryMail(countryMail); + temp.setPoliceMail(policeMail); + temp.setNumberMail(mail12337); + temp.setManageMail(mailCount); + return temp; + } + + // 一级信访大屏地图数据统计 public List getMailMapIcon(Date beginTime, Date endTime) { List res = new ArrayList<>();