From 566dc9c3df90d72b1df014e8426c673855717956 Mon Sep 17 00:00:00 2001 From: sjh Date: Wed, 30 Oct 2024 14:54:41 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BB=B4=E6=9D=83?= =?UTF-8?q?=E6=8A=9A=E6=85=B0=E5=A4=A7=E5=B1=8F=E5=B1=95=E7=A4=BA=E6=A8=A1?= =?UTF-8?q?=E5=9D=972=EF=BC=9A=E6=8A=9A=E6=85=B0=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datav/DatavRightsComfortController.java | 79 +++++++------------ .../supervision/mapper/RpcApplyMapper.java | 29 +++++++ .../supervision/pojo/dto/common/PieItem.java | 2 + .../pojo/model/DataRightsComfortModel.java | 28 +++++++ .../service/BusinessDepartService.java | 10 +++ .../service/DataRightsComfortService.java | 59 +++++++++++++- .../service/RpcInfringerResultService.java | 2 +- 7 files changed, 153 insertions(+), 56 deletions(-) create mode 100644 src/main/java/com/biutag/supervision/pojo/model/DataRightsComfortModel.java 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 7dff98c..edeee4c 100644 --- a/src/main/java/com/biutag/supervision/controller/datav/DatavRightsComfortController.java +++ b/src/main/java/com/biutag/supervision/controller/datav/DatavRightsComfortController.java @@ -1,20 +1,10 @@ package com.biutag.supervision.controller.datav; -import cn.hutool.core.util.NumberUtil; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.biutag.supervision.constants.enums.CaseVerifProblemNatureEnum; -import com.biutag.supervision.constants.enums.DepartGroupEnum; -import com.biutag.supervision.mapper.DataRightsComfortMapper; -import com.biutag.supervision.mapper.RpcApplyMapper; import com.biutag.supervision.pojo.Result; -import com.biutag.supervision.pojo.dto.CaseVerifDepart; -import com.biutag.supervision.pojo.dto.common.PieItem; -import com.biutag.supervision.pojo.entity.DataCaseVerif; -import com.biutag.supervision.pojo.entity.DataRightsComfort; -import com.biutag.supervision.pojo.entity.RpcApply; +import com.biutag.supervision.pojo.model.DataRightsComfortModel; import com.biutag.supervision.service.DataRightsComfortService; import com.biutag.supervision.service.RpcApplyService; +import com.biutag.supervision.service.RpcInfringerResultService; import lombok.RequiredArgsConstructor; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.GetMapping; @@ -22,9 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import java.math.BigDecimal; import java.util.Date; -import java.util.List; @RequestMapping("datav/rightsComfort") @RequiredArgsConstructor @@ -33,47 +21,34 @@ public class DatavRightsComfortController { private final RpcApplyService rpcApplyService; - private final RpcApplyMapper rpcApplyMapper; + private final DataRightsComfortService dataRightsComfortService; + private final RpcInfringerResultService rpcInfringerResultService; @GetMapping - public Result rightsComfort(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { + public Result rightsComfort(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { + DataRightsComfortModel result = new DataRightsComfortModel(); + // 维权案件总数 + + // 受侵害人数 + // 抚慰人数 - long total = rpcApplyService.count(new LambdaQueryWrapper().between(RpcApply::getApplyDate, beginTime, endTime)); - long confirmed = 0; - JSONObject overview = new JSONObject() - // 抚慰人数 - .fluentPut("total", total); - /* // 维权案件总数 - .fluentPut("confirmed", 0) - // 受侵害人数 - .fluentPut("investigateAndPunish", 0) - // 打击处理人数 - .fluentPut("accountablePeopleNumber", 0) - // 抚慰金额(万元) - .fluentPut("accountableDepartNumber", 0) - // 查实率 - .fluentPut("confirmedRate", total == 0 ? 0 : BigDecimal.valueOf(NumberUtil.div(confirmed, total) * 100).intValue()); - // 分县市局排名 - List fxsjBarList = dataCaseVerifMapper.selectDepartStatistic(DepartGroupEnum.COUNTY_CITY_BUREAUS.getId(), beginTime, endTime); - // 局属单位排名 - List jsdwBarList = dataCaseVerifMapper.selectDepartStatistic(DepartGroupEnum.BUREAU_AFFILIATED.getId(), beginTime, endTime); - // 执法办案 - List zfbaPieList = dataCaseVerifMapper.selectInvolveProblemGroupByBusinessTypeName(CaseVerifProblemNatureEnum.ZFBA.getLaebl(), beginTime, endTime); - // 服务管理 - List fwglPieList = dataCaseVerifMapper.selectInvolveProblemGroupByBusinessTypeName(CaseVerifProblemNatureEnum.FWGL.getLaebl(), beginTime, endTime); - // 警察纪警规 - List jjjgPieList = dataCaseVerifMapper.selectInvolveProblemGroupByBusinessTypeName(CaseVerifProblemNatureEnum.JJJG.getLaebl(), beginTime, endTime); - // 案件来源占比 - List ajlyPieList = dataCaseVerifMapper.selectGroupByProblemSources(beginTime, endTime); + result.setComfortPersonNumber(dataRightsComfortService.countComfortPersonNumber(beginTime, endTime)); + // 打击处理人数 + result.setHitPersonNumber(dataRightsComfortService.countHitPersonNumber(beginTime, endTime)); + // 抚慰金额(万元) + result.setComfortMoney(dataRightsComfortService.countComfortMoney(beginTime, endTime)); + // 维权案件情况 + + // 案件类别占比 + + // 打处情况 + result.setPunishmentSituation(dataRightsComfortService.selectPunishmentSituation(beginTime, endTime)); + // 抚慰情况 + result.setComfortSituation(dataRightsComfortService.selectComfortSituation(beginTime, endTime)); + // 民辅警受伤情况 + + // 发案情况占比 - JSONObject data = new JSONObject().fluentPut("overview", overview) - .fluentPut("fxsjBarList", fxsjBarList) - .fluentPut("jsdwBarList", jsdwBarList) - .fluentPut("zfbaPieList", zfbaPieList) - .fluentPut("fwglPieList", fwglPieList) - .fluentPut("jjjgPieList", jjjgPieList) - .fluentPut("ajlyPieList", ajlyPieList); - return Result.success(data);*/ - return null; + return Result.success(result); } } diff --git a/src/main/java/com/biutag/supervision/mapper/RpcApplyMapper.java b/src/main/java/com/biutag/supervision/mapper/RpcApplyMapper.java index de061dc..293a8e0 100644 --- a/src/main/java/com/biutag/supervision/mapper/RpcApplyMapper.java +++ b/src/main/java/com/biutag/supervision/mapper/RpcApplyMapper.java @@ -1,8 +1,37 @@ package com.biutag.supervision.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.biutag.supervision.pojo.dto.common.PieItem; import com.biutag.supervision.pojo.entity.RpcApply; +import com.biutag.supervision.pojo.entity.RpcInfringerResult; +import org.apache.ibatis.annotations.Select; + +import java.util.Date; +import java.util.List; public interface RpcApplyMapper extends BaseMapper { + @Select("SELECT COUNT(a.rpc_id) FROM rpc_apply_person a LEFT JOIN rpc_apply b ON a.rpc_id = b.rpc_id " + + "WHERE b.apply_date BETWEEN #{beginTime} AND #{endTime} AND b.type = 2") + Integer countComfortPersonNumber(Date beginTime, Date endTime); + + @Select("SELECT a.tort_name FROM rpc_infringer_result a LEFT JOIN rpc_apply b ON a.rpc_id = b.rpc_id " + + "WHERE b.apply_date BETWEEN #{beginTime} AND #{endTime} AND b.type = 2") + List getHitPeople(Date beginTime, Date endTime); + + @Select("SELECT SUM(a.provide_relief) FROM rpc_apply_person a LEFT JOIN rpc_apply b ON a.rpc_id = b.rpc_id " + + "WHERE b.apply_date BETWEEN #{beginTime} AND #{endTime} AND b.type = 2") + Double countComfortMoney(Date beginTime, Date endTime); + + @Select("select tort_name, defend_handle_way_name from rpc_infringer_result a LEFT JOIN rpc_apply b ON a.rpc_id = b.rpc_id " + + "WHERE b.apply_date BETWEEN #{beginTime} AND #{endTime} AND b.type = 2") + List selectPunishmentSituation(Date beginTime, Date endTime); + + @Select("SELECT c.job name, COUNT(c.job) value FROM sup_police c JOIN " + + "(SELECT a.emp_no FROM rpc_apply_person a LEFT JOIN rpc_apply b ON a.rpc_id = b.rpc_id " + + "WHERE b.apply_date BETWEEN #{beginTime} AND #{endTime} AND b.type = 2) d on c.emp_no = d.emp_no " + + "GROUP BY c.job") + List selectComfortSituation(Date beginTime, Date endTime); + + } \ No newline at end of file diff --git a/src/main/java/com/biutag/supervision/pojo/dto/common/PieItem.java b/src/main/java/com/biutag/supervision/pojo/dto/common/PieItem.java index cd8979e..0960e65 100644 --- a/src/main/java/com/biutag/supervision/pojo/dto/common/PieItem.java +++ b/src/main/java/com/biutag/supervision/pojo/dto/common/PieItem.java @@ -1,5 +1,6 @@ package com.biutag.supervision.pojo.dto.common; +import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; @@ -9,6 +10,7 @@ import lombok.Setter; */ @Setter @Getter +@AllArgsConstructor public class PieItem { private String name; diff --git a/src/main/java/com/biutag/supervision/pojo/model/DataRightsComfortModel.java b/src/main/java/com/biutag/supervision/pojo/model/DataRightsComfortModel.java new file mode 100644 index 0000000..f7b71f4 --- /dev/null +++ b/src/main/java/com/biutag/supervision/pojo/model/DataRightsComfortModel.java @@ -0,0 +1,28 @@ +package com.biutag.supervision.pojo.model; + +import com.biutag.supervision.pojo.dto.common.PieItem; +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +@Setter +@Getter +public class DataRightsComfortModel { + // 维权案件总数 + // 受侵害人数 + // 抚慰人数 + private Integer comfortPersonNumber; + // 打击处理人数 + Integer hitPersonNumber; + // 抚慰金额(万元) + Double comfortMoney; + // 维权案件情况 + // 案件类别占比 + // 打处情况 + List punishmentSituation; + // 抚慰情况 + List comfortSituation; + // 民辅警受伤情况 + // 发案情况占比 +} diff --git a/src/main/java/com/biutag/supervision/service/BusinessDepartService.java b/src/main/java/com/biutag/supervision/service/BusinessDepartService.java index 1ef2dbd..c4a2d1e 100644 --- a/src/main/java/com/biutag/supervision/service/BusinessDepartService.java +++ b/src/main/java/com/biutag/supervision/service/BusinessDepartService.java @@ -11,6 +11,7 @@ import com.biutag.supervision.pojo.entity.BusinessLog; import com.biutag.supervision.pojo.entity.GBaseAJJBXX; import com.biutag.supervision.pojo.entity.GBaseJJD; import com.biutag.supervision.pojo.model.BusinessPoliceModel; +import com.biutag.supervision.pojo.model.DataRightsComfortModel; import com.biutag.supervision.pojo.param.BusinessQueryParam; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -45,6 +46,8 @@ public class BusinessDepartService extends ServiceImpl page(BusinessQueryParam businessQueryParam) { // 测基础数据 if (businessQueryParam.getDepartName() != null && businessQueryParam.getDepartName().equals("开始导入今年所有的数据")) { @@ -75,6 +78,13 @@ public class BusinessDepartService extends ServiceImpl hitPeople = rpcApplyMapper.getHitPeople(beginTime, endTime); + int totalPeople = 0; + if (hitPeople == null || hitPeople.isEmpty()) { + return 0; + } + for (String hitPerson : hitPeople) { + if (hitPerson.isEmpty()) { + continue; + } + if (hitPerson.contains(",")) { + String[] people = hitPerson.split(","); + totalPeople += people.length; + } else { + totalPeople += 1; + } + } + return totalPeople; + } + + public Double countComfortMoney(Date beginTime, Date endTime) { + return rpcApplyMapper.countComfortMoney(beginTime, endTime) / 10000.0; + } + + public List selectPunishmentSituation(Date beginTime, Date endTime) { + List rpcInfringerResults = rpcApplyMapper.selectPunishmentSituation(beginTime, endTime); + if (rpcInfringerResults == null || rpcInfringerResults.isEmpty()) { + return new ArrayList<>(); + } + Map countMap = new HashMap<>(); + for (RpcInfringerResult rpcInfringerResult : rpcInfringerResults) { + String defendHandleWayName = rpcInfringerResult.getDefendHandleWayName(); + String tortName = rpcInfringerResult.getTortName(); + String[] names = tortName.split(","); + int count = names.length; + countMap.put(defendHandleWayName, countMap.getOrDefault(defendHandleWayName, 0) + count); + } + return countMap.entrySet().stream().map(entry -> new PieItem(entry.getKey(), entry.getValue())).collect(Collectors.toList()); + } + public List selectComfortSituation(Date beginTime, Date endTime) { + return rpcApplyMapper.selectComfortSituation(beginTime, endTime); + } } diff --git a/src/main/java/com/biutag/supervision/service/RpcInfringerResultService.java b/src/main/java/com/biutag/supervision/service/RpcInfringerResultService.java index 2add95e..5058903 100644 --- a/src/main/java/com/biutag/supervision/service/RpcInfringerResultService.java +++ b/src/main/java/com/biutag/supervision/service/RpcInfringerResultService.java @@ -1,8 +1,8 @@ package com.biutag.supervision.service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.biutag.supervision.pojo.entity.RpcInfringerResult; import com.biutag.supervision.mapper.RpcInfringerResultMapper; +import com.biutag.supervision.pojo.entity.RpcInfringerResult; import org.springframework.stereotype.Service; @Service From f9b7b930f899e8f1ed10b0efd52a5c809f603c27 Mon Sep 17 00:00:00 2001 From: sjh Date: Wed, 30 Oct 2024 15:49:07 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A8=A1=E5=9E=8B10?= =?UTF-8?q?=EF=BC=9A=E7=AB=8B=E6=A1=88=E4=B8=8D=E5=8F=8A=E6=97=B6=E7=9A=84?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../supervision/service/ModelClueService.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/biutag/supervision/service/ModelClueService.java b/src/main/java/com/biutag/supervision/service/ModelClueService.java index 30b8722..2a1ed38 100644 --- a/src/main/java/com/biutag/supervision/service/ModelClueService.java +++ b/src/main/java/com/biutag/supervision/service/ModelClueService.java @@ -173,7 +173,7 @@ public class ModelClueService extends ServiceImpl { for (ModelClue modelClue : modelClues) { modelClue.setModelId(modelId); modelClue.setCreateTime(LocalDateTime.now()); - SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper().eq(SupExternalDepart::getExternalId, modelClue.getInvolveDepartId())); + SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper().eq(SupExternalDepart::getExternalId, modelClue.getInvolveDepartId()).last("LIMIT 1")); if (supExternalDepart != null && supExternalDepart.getInternalShortName() != null && !supExternalDepart.getInternalShortName().isEmpty()) { modelClue.setInvolveDepartName(supExternalDepart.getInternalShortName()); modelClue.setInvolveDepartId(supExternalDepart.getInternalId()); @@ -226,7 +226,7 @@ public class ModelClueService extends ServiceImpl { + ",受理日期为" + getDateString(data.get("SLRQ")) + ",当前案件状态为“" + data.get("AJZTmc") + "”,已经超过" + "30" - + "日仍未受理。案件详情:" + thingDesc); + + "日仍未受理。" + thingDesc); } else if (modelId == 3) { // 3号模型:执法办案场所登记时长超时问题监督模型 if (data.get("lksj") != null && !data.get("lksj").equals("")) { modelClue.setThingDesc("姓名" + data.get("xm") @@ -242,6 +242,14 @@ public class ModelClueService extends ServiceImpl { + "登记进入" + data.get("csmc") + ",没有离开时间。"); } + } else if (modelId == 10) { + modelClue.setThingDesc("该" + data.get("AJBZmc") + + "案件编号为" + data.get("AJBH") + + ",报案日期为" + getDateString(data.get("BARQ")) + + ",受理日期为" + getDateString(data.get("SLRQ")) + + ",当前案件状态为“" + data.get("AJZTmc") + + "”,已经超过" + "3" + + "日仍未受理。"); } break; } @@ -263,7 +271,7 @@ public class ModelClueService extends ServiceImpl { } List jjdModelClues = new ArrayList<>(); for (Map data : jjdmaps) { - SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper().eq(SupExternalDepart::getExternalId, data.get("involve_depart_id"))); + SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper().eq(SupExternalDepart::getExternalId, data.get("involve_depart_id")).last("LIMIT 1")); if (supExternalDepart != null && supExternalDepart.getExternalId() != null && supExternalDepart.getExternalName() != null && supExternalDepart.getInternalId() != null && supExternalDepart.getLevel() != null && supExternalDepart.getPid() != null) { ModelClue modelClue = new ModelClue(); modelClue.setData(JSONObject.toJSONString(data)); @@ -283,7 +291,7 @@ public class ModelClueService extends ServiceImpl { mergeModelClues(jjdModelClues4, jjdModelClues3, 1); List zfqymModelClues = new ArrayList<>(); for (Map data : zfqymaps) { - SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper().eq(SupExternalDepart::getExternalId, data.get("involve_depart_id"))); + SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper().eq(SupExternalDepart::getExternalId, data.get("involve_depart_id")).last("LIMIT 1")); if (supExternalDepart != null && supExternalDepart.getExternalId() != null && supExternalDepart.getExternalName() != null && supExternalDepart.getInternalId() != null && supExternalDepart.getLevel() != null && supExternalDepart.getPid() != null) { ModelClue modelClue = new ModelClue(); modelClue.setData(JSONObject.toJSONString(data)); @@ -427,7 +435,7 @@ public class ModelClueService extends ServiceImpl { } } if (!found) { - SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper().eq(SupExternalDepart::getInternalId, modelClue2.getParentId())); + SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper().eq(SupExternalDepart::getInternalId, modelClue2.getParentId()).last("LIMIT 1")); if (supExternalDepart != null) { ModelClue newModelClue = new ModelClue(); newModelClue.setData(modelClue2.getData()); From baebdc5dd47202d1fe3e395e24af9e09bd2f3203 Mon Sep 17 00:00:00 2001 From: sjh Date: Wed, 30 Oct 2024 18:27:17 +0800 Subject: [PATCH 3/6] =?UTF-8?q?1=E3=80=81=E4=BF=AE=E6=94=B9=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E6=95=B0=E6=8D=AE=E5=8D=95=E4=BD=8D=E5=8F=96=E5=80=BC?= =?UTF-8?q?=202=E3=80=81=E4=BF=AE=E6=94=B9=E5=8D=95=E4=BD=8D=E5=85=B3?= =?UTF-8?q?=E8=81=94=E8=A1=A8=E7=9A=84=E6=9D=A5=E6=BA=90=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/SupExternalDepartMapper.java | 2 +- .../service/BusinessDepartService.java | 28 +++++++++++-------- .../service/BusinessPoliceService.java | 28 +++++++++++-------- .../supervision/service/ModelClueService.java | 6 ++-- .../service/SupExternalDepartService.java | 6 ++-- 5 files changed, 39 insertions(+), 31 deletions(-) diff --git a/src/main/java/com/biutag/supervision/mapper/SupExternalDepartMapper.java b/src/main/java/com/biutag/supervision/mapper/SupExternalDepartMapper.java index e06405f..1ab38d0 100644 --- a/src/main/java/com/biutag/supervision/mapper/SupExternalDepartMapper.java +++ b/src/main/java/com/biutag/supervision/mapper/SupExternalDepartMapper.java @@ -10,7 +10,7 @@ import java.util.Map; public interface SupExternalDepartMapper extends BaseMapper { @Select("