From 9696a663c6da62281d0971d67bfbae7a96f752ba Mon Sep 17 00:00:00 2001 From: pengwei Date: Sat, 24 May 2025 16:47:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:1=E3=80=81=E5=A4=A7=E5=B1=8F=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=B7=A5=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/datav/DataVJwpyController.java | 51 +++++++++++++++++++ .../datav/DataVRightsComfortController.java | 10 +++- .../supervision/mapper/NegativeMapper.java | 15 ++++++ .../supervision/mapper/RpcApplyMapper.java | 19 +++++-- .../supervision/pojo/vo/DistributionVo.java | 18 +++++++ .../supervision/service/DataVJwpyService.java | 18 +++++++ 6 files changed, 124 insertions(+), 7 deletions(-) create mode 100644 src/main/java/com/biutag/supervision/controller/datav/DataVJwpyController.java create mode 100644 src/main/java/com/biutag/supervision/pojo/vo/DistributionVo.java create mode 100644 src/main/java/com/biutag/supervision/service/DataVJwpyService.java diff --git a/src/main/java/com/biutag/supervision/controller/datav/DataVJwpyController.java b/src/main/java/com/biutag/supervision/controller/datav/DataVJwpyController.java new file mode 100644 index 0000000..0237910 --- /dev/null +++ b/src/main/java/com/biutag/supervision/controller/datav/DataVJwpyController.java @@ -0,0 +1,51 @@ +package com.biutag.supervision.controller.datav; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.biutag.supervision.mapper.NegativeMapper; +import com.biutag.supervision.pojo.Result; +import com.biutag.supervision.pojo.entity.SupDictData; +import com.biutag.supervision.pojo.vo.DistributionVo; +import com.biutag.supervision.service.DataVJwpyService; +import com.biutag.supervision.service.SupDictDataService; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +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.Date; +import java.util.List; +import java.util.Optional; + +@RestController +@RequiredArgsConstructor +@RequestMapping("datav/Jwpy") +public class DataVJwpyController { + + private final NegativeMapper negativeMapper; + + private final SupDictDataService supDictDataService; + + @GetMapping + public Result selectDistribution(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, + @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime){ + List list = negativeMapper.getDistributionByTime(beginTime,endTime); + List supDictDataList = supDictDataService.list( new LambdaQueryWrapper().eq(SupDictData::getDictType,"businessType")); + list.forEach(s->{ + Optional supDictData = supDictDataList.stream().filter(v->v.getDictValue().equals(s.getName())).findFirst(); + supDictData.ifPresent(dictData -> s.setName(dictData.getDictLabel())); + }); + JSONObject jsonObject =new JSONObject() + .fluentPut("name",list.stream().map(DistributionVo::getName).toList()) + .fluentPut("checkStatus",list.stream().map(DistributionVo::getCheckStatusNum).toList()) + .fluentPut("total",list.stream().map(DistributionVo::getTotalNum).toList()) + .fluentPut("processing",list.stream().map(DistributionVo::getProcessingNum).toList()); + + return Result.success(jsonObject); + + } + +} diff --git a/src/main/java/com/biutag/supervision/controller/datav/DataVRightsComfortController.java b/src/main/java/com/biutag/supervision/controller/datav/DataVRightsComfortController.java index a860f03..9093997 100644 --- a/src/main/java/com/biutag/supervision/controller/datav/DataVRightsComfortController.java +++ b/src/main/java/com/biutag/supervision/controller/datav/DataVRightsComfortController.java @@ -239,13 +239,19 @@ public class DataVRightsComfortController { // 发案环节 List incidentLinkList =rpcApplyMapper.getIncidentLink(beginTime, endTime); // 发案警种 - List incidentPoliceTypeList = new ArrayList<>(); + List incidentPoliceList = rpcApplyMapper.getIncidentPolice(beginTime, endTime); + List supDictDataList = supDictDataService.list( new LambdaQueryWrapper().eq(SupDictData::getDictType,"personType")); + incidentPoliceList.forEach(s->{ + Optional supDictData = supDictDataList.stream().filter(v->v.getDictValue().equals(s.getName())).findFirst(); + supDictData.ifPresent(dictData -> s.setName(dictData.getDictLabel())); + }); + // 发案单位 List incidentOrgList = rpcApplyMapper.getIncidentOrg(beginTime, endTime); JSONObject data = new JSONObject() .fluentPut("incidentLinkList", incidentLinkList) - .fluentPut("incidentPoliceTypeList", incidentPoliceTypeList) + .fluentPut("incidentPoliceTypeList", incidentPoliceList) .fluentPut("incidentOrgList", incidentOrgList); 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 c6f3831..fae89ce 100644 --- a/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java +++ b/src/main/java/com/biutag/supervision/mapper/NegativeMapper.java @@ -83,6 +83,21 @@ public interface NegativeMapper extends BaseMapper { List getGlobalRecentlyTrendByMonth(String year); + + @Select(" SELECT " + + " businessTypeCode as name, " + + " SUM(CASE WHEN checkStatus IN (1, 2) THEN 1 ELSE 0 END) AS checkStatusNum, " + + " SUM(CASE WHEN processing_status = 'completed' THEN 1 ELSE 0 END) AS processingNum, " + + " COUNT(*) AS totalNum " + + " FROM " + + " negative " + + " WHERE " + + " problemSourcesCode = 2 " + + " and crtTime BETWEEN #{beginTime} and #{endTime}" + + " GROUP BY " + + " businessTypeCode ") + List getDistributionByTime(Date beginTime, Date endTime); + /** * 首页大屏突出问题排名 * diff --git a/src/main/java/com/biutag/supervision/mapper/RpcApplyMapper.java b/src/main/java/com/biutag/supervision/mapper/RpcApplyMapper.java index cabe438..a4ae334 100644 --- a/src/main/java/com/biutag/supervision/mapper/RpcApplyMapper.java +++ b/src/main/java/com/biutag/supervision/mapper/RpcApplyMapper.java @@ -70,6 +70,14 @@ public interface RpcApplyMapper extends BaseMapper { "GROUP BY Incident_link_name ") List getIncidentLink(Date beginTime, Date endTime); + + @Select("SELECT person_type as name,COUNT(*) from rpc_apply a " + + "LEFT JOIN (SELECT emp_no,person_type from sup_police WHERE del = 0) as b " + + "ON a.input_emp_no = b.emp_no " + + "WHERE a.crt_time BETWEEN #{beginTime} and #{endTime}" + + " GROUP BY person_type HAVING name is NOT NULL") + List getIncidentPolice(Date beginTime, Date endTime); + @Select("SELECT " + "sd1.short_name AS `name`, " + "count(*) AS `value` " + @@ -185,12 +193,13 @@ public interface RpcApplyMapper extends BaseMapper { * 按事发时间进行筛选 * 维权案件情况 * */ - @Select(" SELECT ra.handle_depart_name label ,COUNT(*) value from rpc_apply as ra LEFT JOIN sup_depart sdp " + - " on ra.handle_depart_id = sdp.id where sdp.statistics_group_id=#{departGroupId} " + - " and ra.crt_time between #{beginTime} and #{endTime} "+ - " and ra.type = 1 " + - " GROUP BY ra.handle_depart_name order by value desc") + @Select(" select sdp.short_name,COUNT(*) from rpc_apply ra " + + " LEFT JOIN sup_depart sdp on ra.second_depart_id = sdp.id " + + " WHERE sdp.statistics_group_id = #{departGroupId} and ra.type =1 " + + " and ra.crt_time BETWEEN #{beginTime} and #{endTime} " + + " GROUP BY sdp.short_name order by value desc ") List selectProtectRightsBarList(Date beginTime, Date endTime, Integer departGroupId); + //民辅警受伤表 @Select( "SELECT person_type as name, COUNT(*) as val FROM rpc_apply_person as a " + " LEFT JOIN (SELECT emp_no,person_type from sup_police WHERE del = 0) as b " + diff --git a/src/main/java/com/biutag/supervision/pojo/vo/DistributionVo.java b/src/main/java/com/biutag/supervision/pojo/vo/DistributionVo.java new file mode 100644 index 0000000..2e23bc0 --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/vo/DistributionVo.java @@ -0,0 +1,18 @@ +package com.biutag.supervision.pojo.vo; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class DistributionVo { + //项目类型名 + private String name; + //查实数 + private String checkStatusNum; + //办结数 + private String processingNum; + //总数 + private String totalNum; + +} diff --git a/src/main/java/com/biutag/supervision/service/DataVJwpyService.java b/src/main/java/com/biutag/supervision/service/DataVJwpyService.java new file mode 100644 index 0000000..98f3952 --- /dev/null +++ b/src/main/java/com/biutag/supervision/service/DataVJwpyService.java @@ -0,0 +1,18 @@ +package com.biutag.supervision.service; + +import com.alibaba.fastjson.JSONObject; +import com.biutag.supervision.mapper.NegativeMapper; +import com.biutag.supervision.pojo.vo.DistributionVo; +import com.biutag.supervision.util.JSON; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + + +@Service +public class DataVJwpyService { + +}