Browse Source

新增维权抚慰大屏展示模块2:抚慰相关

main
sjh 1 year ago
parent
commit
566dc9c3df
  1. 75
      src/main/java/com/biutag/supervision/controller/datav/DatavRightsComfortController.java
  2. 29
      src/main/java/com/biutag/supervision/mapper/RpcApplyMapper.java
  3. 2
      src/main/java/com/biutag/supervision/pojo/dto/common/PieItem.java
  4. 28
      src/main/java/com/biutag/supervision/pojo/model/DataRightsComfortModel.java
  5. 10
      src/main/java/com/biutag/supervision/service/BusinessDepartService.java
  6. 59
      src/main/java/com/biutag/supervision/service/DataRightsComfortService.java
  7. 2
      src/main/java/com/biutag/supervision/service/RpcInfringerResultService.java

75
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<JSONObject> rightsComfort(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
// 抚慰人数
long total = rpcApplyService.count(new LambdaQueryWrapper<RpcApply>().between(RpcApply::getApplyDate, beginTime, endTime));
long confirmed = 0;
JSONObject overview = new JSONObject()
// 抚慰人数
.fluentPut("total", total);
/* // 维权案件总数
.fluentPut("confirmed", 0)
public Result<DataRightsComfortModel> rightsComfort(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
DataRightsComfortModel result = new DataRightsComfortModel();
// 维权案件总数
// 受侵害人数
.fluentPut("investigateAndPunish", 0)
// 抚慰人数
result.setComfortPersonNumber(dataRightsComfortService.countComfortPersonNumber(beginTime, endTime));
// 打击处理人数
.fluentPut("accountablePeopleNumber", 0)
result.setHitPersonNumber(dataRightsComfortService.countHitPersonNumber(beginTime, endTime));
// 抚慰金额(万元)
.fluentPut("accountableDepartNumber", 0)
// 查实率
.fluentPut("confirmedRate", total == 0 ? 0 : BigDecimal.valueOf(NumberUtil.div(confirmed, total) * 100).intValue());
// 分县市局排名
List<CaseVerifDepart> fxsjBarList = dataCaseVerifMapper.selectDepartStatistic(DepartGroupEnum.COUNTY_CITY_BUREAUS.getId(), beginTime, endTime);
// 局属单位排名
List<CaseVerifDepart> jsdwBarList = dataCaseVerifMapper.selectDepartStatistic(DepartGroupEnum.BUREAU_AFFILIATED.getId(), beginTime, endTime);
// 执法办案
List<PieItem> zfbaPieList = dataCaseVerifMapper.selectInvolveProblemGroupByBusinessTypeName(CaseVerifProblemNatureEnum.ZFBA.getLaebl(), beginTime, endTime);
// 服务管理
List<PieItem> fwglPieList = dataCaseVerifMapper.selectInvolveProblemGroupByBusinessTypeName(CaseVerifProblemNatureEnum.FWGL.getLaebl(), beginTime, endTime);
// 警察纪警规
List<PieItem> jjjgPieList = dataCaseVerifMapper.selectInvolveProblemGroupByBusinessTypeName(CaseVerifProblemNatureEnum.JJJG.getLaebl(), beginTime, endTime);
// 案件来源占比
List<PieItem> ajlyPieList = dataCaseVerifMapper.selectGroupByProblemSources(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);
}
}

29
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<RpcApply> {
@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<String> 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<RpcInfringerResult> 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<PieItem> selectComfortSituation(Date beginTime, Date endTime);
}

2
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;

28
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<PieItem> punishmentSituation;
// 抚慰情况
List<PieItem> comfortSituation;
// 民辅警受伤情况
// 发案情况占比
}

10
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<BusinessDepartMapper, Bus
private final SupExternalDepartMapper supExternalDepartMapper;
private final DataRightsComfortService dataRightsComfortService;
public Page<BusinessPoliceModel> page(BusinessQueryParam businessQueryParam) {
// 测基础数据
if (businessQueryParam.getDepartName() != null && businessQueryParam.getDepartName().equals("开始导入今年所有的数据")) {
@ -75,6 +78,13 @@ public class BusinessDepartService extends ServiceImpl<BusinessDepartMapper, Bus
modelClueService.generate(testNumber);
System.out.println("测试" + testNumber + "执行完毕");
}
if (departName != null && departName.equals("测大屏")) {
Date beginTime = Date.from(LocalDateTime.parse("2024-10-01T00:00:00", DateTimeFormatter.ISO_DATE_TIME).atZone(ZoneId.systemDefault()).toInstant());
Date endTime = Date.from(LocalDateTime.parse("2024-10-02T00:00:00", DateTimeFormatter.ISO_DATE_TIME).atZone(ZoneId.systemDefault()).toInstant());
DataRightsComfortModel result = new DataRightsComfortModel();
int i = 0;
}
// 测导入单位关联表
if (businessQueryParam.getDepartName() != null && businessQueryParam.getDepartName().equals("导入单位")) {
System.out.println("开始导入单位");

59
src/main/java/com/biutag/supervision/service/DataRightsComfortService.java

@ -1,11 +1,14 @@
package com.biutag.supervision.service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.supervision.mapper.DataRightsComfortMapper;
import com.biutag.supervision.pojo.entity.DataRightsComfort;
import com.biutag.supervision.mapper.RpcApplyMapper;
import com.biutag.supervision.pojo.dto.common.PieItem;
import com.biutag.supervision.pojo.entity.RpcInfringerResult;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
@RequiredArgsConstructor
@Service
public class DataRightsComfortService {
@ -16,5 +19,55 @@ public class DataRightsComfortService {
private final RpcInfringerResultService rpcInfringerResultService;
private final RpcApplyMapper rpcApplyMapper;
// 抚慰人数
public Integer countComfortPersonNumber(Date beginTime, Date endTime) {
return rpcApplyMapper.countComfortPersonNumber(beginTime, endTime);
}
// 打击处理人数
public Integer countHitPersonNumber(Date beginTime, Date endTime) {
List<String> 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<PieItem> selectPunishmentSituation(Date beginTime, Date endTime) {
List<RpcInfringerResult> rpcInfringerResults = rpcApplyMapper.selectPunishmentSituation(beginTime, endTime);
if (rpcInfringerResults == null || rpcInfringerResults.isEmpty()) {
return new ArrayList<>();
}
Map<String, Integer> 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<PieItem> selectComfortSituation(Date beginTime, Date endTime) {
return rpcApplyMapper.selectComfortSituation(beginTime, endTime);
}
}

2
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

Loading…
Cancel
Save