Browse Source

fix:1、维权抚慰大屏优化工作

master
pengwei 6 months ago
parent
commit
4a22c5c4d9
  1. 3
      sql/20250522.sql
  2. 127
      src/main/java/com/biutag/supervision/controller/datav/DataVRightsComfortController.java
  3. 59
      src/main/java/com/biutag/supervision/mapper/RpcApplyMapper.java
  4. 17
      src/main/java/com/biutag/supervision/mapper/RpcInfringerResultMapper.java
  5. 13
      src/main/java/com/biutag/supervision/pojo/entity/RpcApply.java
  6. 13
      src/main/java/com/biutag/supervision/pojo/model/DataRightsComfortModel.java
  7. 28
      src/main/java/com/biutag/supervision/pojo/vo/ComfortMapIconVo.java
  8. 5
      src/main/java/com/biutag/supervision/service/RpcApplyService.java

3
sql/20250522.sql

@ -0,0 +1,3 @@
-- 补充案件类型
ALTER TABLE rpc_apply add COLUMN case_type VARCHAR(40) COMMENT '案件类型(1、刑事案件;2、行政案件)';
ALTER TABLE rpc_apply add COLUMN case_category VARCHAR(40) COMMENT '案件类别';

127
src/main/java/com/biutag/supervision/controller/datav/DataVRightsComfortController.java

@ -1,30 +1,42 @@
package com.biutag.supervision.controller.datav;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.biutag.supervision.constants.enums.RpcApplyTypeEnum;
import com.biutag.supervision.mapper.RpcApplyMapper;
import com.biutag.supervision.mapper.RpcInfringerResultMapper;
import com.biutag.supervision.mapper.SupDepartMapper;
import com.biutag.supervision.mapper.SupDictDataMapper;
import com.biutag.supervision.pojo.Result;
import com.biutag.supervision.pojo.dto.common.PieItem;
import com.biutag.supervision.pojo.entity.RpcApply;
import com.biutag.supervision.pojo.entity.RpcInfringerResult;
import com.biutag.supervision.pojo.entity.SupDepart;
import com.biutag.supervision.pojo.entity.SupDictData;
import com.biutag.supervision.pojo.model.DataRightsComfortModel;
import com.biutag.supervision.pojo.vo.ComfortMapIconVo;
import com.biutag.supervision.pojo.vo.EchartsVo;
import com.biutag.supervision.pojo.vo.MailMapIconVo;
import com.biutag.supervision.service.DataRightsComfortService;
import com.biutag.supervision.service.RpcApplyService;
import com.biutag.supervision.service.RpcInfringerResultService;
import com.biutag.supervision.service.SupDictDataService;
import com.biutag.supervision.util.CompletableUtils.CompletableFutureUtil;
import io.swagger.v3.oas.annotations.tags.Tag;
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 org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
import static com.biutag.supervision.constants.enums.DepartGroupEnum.COUNTY_CITY_BUREAUS;
/**
* 维权抚慰大屏相关
*
@ -41,7 +53,10 @@ public class DataVRightsComfortController {
private final RpcApplyService rpcApplyService;
private final RpcApplyMapper rpcApplyMapper;
private final RpcInfringerResultMapper rpcInfringerResultMapper;
private final SupDictDataService supDictDataService;
private final SupDepartMapper supDepartMapper;
@GetMapping
public Result<DataRightsComfortModel> rightsComfort(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
@ -59,9 +74,20 @@ public class DataVRightsComfortController {
// 受侵害人数
result.setVictimNumber(list.size());
// 打击处理人数
result.setHitPersonNumber(list.size() + 1);
List<String> tortNames = rpcInfringerResultMapper.selectNamesByTime(beginTime, finalEndTime);
long initialListSize = tortNames.size();
long hitPersonNumber = tortNames.stream()
.filter(s -> s.contains(",")) // 筛选出包含逗号的名称
.mapToLong(s -> s.split(",").length) // 拆分每个名称并计算拆分后的数组长度
.sum();// 计算所有拆分后数组长度的总和
if(tortNames.stream().noneMatch(s -> s.contains(","))){
result.setHitPersonNumber(initialListSize );
}else{
result.setHitPersonNumber(initialListSize + hitPersonNumber);
}
Map<String, List<RpcApply>> collect = list.stream().collect(Collectors.groupingBy(RpcApply::getInfringerHandle));
Map<String, List<RpcApply>> collect = list.stream().filter(s-> StrUtil.isNotEmpty(s.getInfringerHandle()) && "1".equals(s.getType()))
.collect(Collectors.groupingBy(RpcApply::getInfringerHandle));
// 打处情况
result.setPunishmentSituation(collect.keySet().stream().map(name -> {
return new PieItem(name, collect.get(name).size());
@ -79,13 +105,42 @@ public class DataVRightsComfortController {
// 抚慰金额情况 - 分县市局
result.setCountyComfortMoneyBarList(rpcApplyMapper.selectComfortMoneyBarList(beginTime, finalEndTime, 3));
}),
CompletableFutureUtil.runSyncObject(() -> {
// 抚慰金额情况 - 局属单位
result.setBureauComfortMoneyBarList(rpcApplyMapper.selectComfortMoneyBarList(beginTime, finalEndTime, 4));
}),
CompletableFutureUtil.runSyncObject(()->{
// 维权案件情况 - 分县市局
result.setCountyRightsBarList(rpcApplyMapper.selectProtectRightsBarList(beginTime, finalEndTime, 3));
}),
CompletableFutureUtil.runSyncObject(()->{
// 维权案件情况 - 局属单位
result.setBureauRightsBarList(rpcApplyMapper.selectProtectRightsBarList(beginTime, finalEndTime, 4));
}),
CompletableFutureUtil.runSyncObject(()->{
//案件类别 - 刑事
result.setCrownCaseBarList(rpcApplyMapper.selectCaseData(beginTime, finalEndTime,"1"));
}),
CompletableFutureUtil.runSyncObject(()->{
//案件类别 - 行政
result.setAdministrativeCaseList(rpcApplyMapper.selectCaseData( beginTime, endTime,"2"));
}),
CompletableFutureUtil.runSyncObject(() -> {
// 民辅警受伤情况
result.setComfortPoliceInjurySituation(rpcApplyMapper.selectComfortPoliceInjurySituation(beginTime, finalEndTime));
List<PieItem> data = rpcApplyMapper.selectComfortPoliceInjurySituation(beginTime, finalEndTime);
//获取字典中的民警类型
List<SupDictData> supDictDataList = supDictDataService.list( new LambdaQueryWrapper<SupDictData>().eq(SupDictData::getDictType,"personType"));
data.forEach(s->{
Optional<SupDictData> supDictData = supDictDataList.stream().filter(v->v.getDictValue().equals(s.getName())).findFirst();
supDictData.ifPresent(dictData -> s.setName(dictData.getDictLabel()));
});
result.setComfortPoliceInjurySituation(data);
}),
CompletableFutureUtil.runSyncObject(() -> {
// 民辅警受伤类别
@ -104,7 +159,65 @@ public class DataVRightsComfortController {
return Result.success(data);
}
// endregion
@GetMapping("getComfortMapIcon")
public Result<JSONObject> getComfortMapIcon(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) {
// 信访数据总数概览
List<ComfortMapIconVo> res = new ArrayList<>();
// 查询所有分县市局
List<SupDepart> supDeparts = supDepartMapper.selectDepartsByGroupType(COUNTY_CITY_BUREAUS.getId());
for (SupDepart supDepart : supDeparts) {
ComfortMapIconVo iconVo = new ComfortMapIconVo();
iconVo.setName(supDepart.getShortName());
iconVo.setDepartId(supDepart.getId());
res.add(iconVo);
}
for (ComfortMapIconVo re : res) {
String departId = re.getDepartId();
List<RpcApply> list = rpcApplyService.list(new LambdaQueryWrapper<RpcApply>()
.between(RpcApply::getCrtTime, beginTime, endTime)
.eq(RpcApply::getSecondDepartId,departId)
.eq(RpcApply::getType, RpcApplyTypeEnum.RIGHTS_PROTECTION.getValue()));
Set<String> caseNumbers = list.stream().map(RpcApply::getCaseNumber).collect(Collectors.toSet());
// 维权案件总数
re.setRightsNumber(caseNumbers.size());
// 受侵害人数
re.setVictimNumber(list.size());
// 打击处理人数
List<String> tortNames = rpcInfringerResultMapper.selectNamesByOrgTime(beginTime, endTime,departId);
long initialListSize = tortNames.size();
long hitPersonNumber = tortNames.stream()
.filter(s -> s.contains(",")) // 筛选出包含逗号的名称
.mapToLong(s -> s.split(",").length) // 拆分每个名称并计算拆分后的数组长度
.sum();// 计算所有拆分后数组长度的总和
if(tortNames.stream().noneMatch(s -> s.contains(","))){
re.setHitPersonNumber(initialListSize );
}else{
re.setHitPersonNumber(initialListSize + hitPersonNumber);
}
//抚慰金额
CompletableFutureUtil.runSyncObject(() -> {
re.setComfortMoney(rpcApplyMapper.selectComfortMoneyBarByOrg(beginTime, endTime, departId));
});
CompletableFutureUtil.runSyncObject(() -> {
// 抚慰人数
re.setComfortPersonNumber(rpcApplyService.orgCount(beginTime, endTime, RpcApplyTypeEnum.COMFORT.getValue(), departId));
});
}
JSONObject data = new JSONObject().fluentPut("comfortMapVoList", res);
return Result.success(data);
}
// region 右边
// 民辅警受伤人数情况和受伤类别

59
src/main/java/com/biutag/supervision/mapper/RpcApplyMapper.java

@ -7,27 +7,38 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.supervision.pojo.dto.common.BarItem;
import com.biutag.supervision.pojo.dto.common.PieItem;
import com.biutag.supervision.pojo.entity.RpcApply;
import com.biutag.supervision.pojo.entity.RpcInfringerResult;
import com.biutag.supervision.pojo.vo.EchartsVo;
import com.biutag.supervision.pojo.vo.RpcApplyVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
public interface RpcApplyMapper extends BaseMapper<RpcApply> {
@Select("SELECT COALESCE(SUM(a.provide_relief), 0.0) 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")
"WHERE b.crt_time BETWEEN #{beginTime} AND #{endTime} AND b.type = 2")
Double countComfortMoney(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 " +
"WHERE b.crt_time 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);
@Select("SELECT " +
" ra.case_category as name,COUNT(*) as value" +
" from rpc_apply as ra LEFT JOIN sup_depart sdp on ra.handle_depart_id = sdp.id " +
"WHERE ra.case_type = #{type} " +
" and ra.crt_time between #{beginTime} and #{endTime} " +
" and ra.case_category is NOT NULL GROUP BY ra.case_category "
)
List<EchartsVo> selectCaseData(Date beginTime, Date endTime,String type);
@Select("SELECT " +
"sdd.dict_label AS `name`, " +
"count(*) AS `value` " +
@ -55,7 +66,7 @@ public interface RpcApplyMapper extends BaseMapper<RpcApply> {
"Incident_link_name AS `name`, " +
"count(*) AS `value` " +
"FROM rpc_apply ra " +
"WHERE ra.happen_time BETWEEN #{beginTime} AND #{endTime} " +
"WHERE ra.crt_time BETWEEN #{beginTime} AND #{endTime} " +
"GROUP BY Incident_link_name ")
List<EchartsVo> getIncidentLink(Date beginTime, Date endTime);
@ -67,7 +78,7 @@ public interface RpcApplyMapper extends BaseMapper<RpcApply> {
"AND sd.`level`=3 " +
"LEFT JOIN sup_depart sd1 ON sd.pid=sd1.id " +
"AND sd1.`level`=2 " +
"WHERE ra.happen_time BETWEEN #{beginTime} AND #{endTime} " +
"WHERE ra.crt_time BETWEEN #{beginTime} AND #{endTime} " +
"GROUP BY sd1.short_name " +
"HAVING `name` is NOT NULL")
List<EchartsVo> getIncidentOrg(Date beginTime, Date endTime);
@ -133,12 +144,12 @@ public interface RpcApplyMapper extends BaseMapper<RpcApply> {
"count(*) AS `value` " +
"FROM rpc_apply ra " +
"LEFT JOIN sup_depart sd ON ra.depart_id=sd.id " +
"WHERE ra.happen_time BETWEEN #{beginTime} AND #{endTime} " +
"WHERE ra.crt_time BETWEEN #{beginTime} AND #{endTime} " +
"AND sd.pid=#{departId} " +
"GROUP BY Incident_link_name")
List<EchartsVo> getSubOneIncidentLink(Date beginTime, Date endTime, Integer departId);
@Select("SELECT " +
"sd.short_name AS `name`, " +
"count(*) AS `value` " +
@ -147,7 +158,7 @@ public interface RpcApplyMapper extends BaseMapper<RpcApply> {
"AND sd.`level`=3 " +
"LEFT JOIN sup_depart sd1 ON sd.pid=sd1.id " +
"AND sd1.`level`=2 " +
"WHERE ra.happen_time BETWEEN #{beginTime} AND #{endTime} " +
"WHERE ra.crt_time BETWEEN #{beginTime} AND #{endTime} " +
"AND sd1.id=#{departId} " +
"GROUP BY sd.short_name " +
"HAVING `name` is NOT NULL ")
@ -161,9 +172,35 @@ public interface RpcApplyMapper extends BaseMapper<RpcApply> {
@Select("select d.short_name label, ROUND(sum(p.provide_relief) / 10000, 2) value from rpc_apply_person p left join rpc_apply r on p.rpc_id = r.rpc_id left join sup_depart d on r.second_depart_id = d.id where d.statistics_group_id = #{departGroupId} and r.crt_time between #{beginTime} and #{endTime} and r.type = 2 GROUP BY d.short_name order by value desc")
List<BarItem> selectComfortMoneyBarList(Date beginTime, Date endTime, Integer departGroupId);
@Select("select p.person_type_name name, count(r.rpc_id) value from rpc_apply r left join rpc_apply_person p on r.rpc_id = p.rpc_id where r.crt_time between #{beginTime} and #{endTime} and r.type = 2 GROUP BY p.person_type_name")
@Select("select " +
" ROUND(sum(p.provide_relief) / 10000, 2) " +
"from rpc_apply_person p " +
"left join rpc_apply r on p.rpc_id = r.rpc_id " +
" where " +
" r.second_depart_id = #{orgId} and " +
" r.crt_time between #{beginTime} " +
" and #{endTime} and r.type = 2 ")
BigDecimal selectComfortMoneyBarByOrg(Date beginTime, Date endTime, String orgId);
/**
* 按事发时间进行筛选
* 维权案件情况
* */
@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")
List<BarItem> 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 " +
" ON a.emp_no = b.emp_no " +
" where a.creat_time between #{beginTime} and #{endTime} and a.type = 2 " +
" GROUP BY person_type HAVING name is NOT NULL "
)
List<PieItem> selectComfortPoliceInjurySituation(Date beginTime, Date endTime);
@Select("select p.injury_severity_name name, count(r.rpc_id) value from rpc_apply r left join rpc_apply_person p on r.rpc_id = p.rpc_id where r.crt_time between #{beginTime} and #{endTime} and r.type = 2 GROUP BY p.injury_severity_name")
List<PieItem> selectComfortInjuryCategory(Date beginTime, Date endTime);
}
}

17
src/main/java/com/biutag/supervision/mapper/RpcInfringerResultMapper.java

@ -2,7 +2,22 @@ package com.biutag.supervision.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.biutag.supervision.pojo.entity.RpcInfringerResult;
import org.apache.ibatis.annotations.Select;
import java.util.Date;
import java.util.List;
public interface RpcInfringerResultMapper extends BaseMapper<RpcInfringerResult> {
//根据时间查询打击处理人数
@Select(" SELECT rir.tort_name from rpc_infringer_result rir LEFT JOIN rpc_apply as rpa" +
" on rpa.rpc_id = rir.rpc_id" +
" WHERE rpa.crt_time between #{beginTime} and #{endTime} " +
" and rpa.type = 1 ")
List<String> selectNamesByTime(Date beginTime, Date endTime);
}
@Select(" SELECT rir.tort_name from rpc_infringer_result rir LEFT JOIN rpc_apply as rpa" +
" on rpa.rpc_id = rir.rpc_id " +
" WHERE rpa.crt_time between #{beginTime} and #{endTime} " +
" and rpa.type = 1 and rpa.second_depart_id = #{orgId} ")
List<String> selectNamesByOrgTime(Date beginTime, Date endTime,String orgId);
}

13
src/main/java/com/biutag/supervision/pojo/entity/RpcApply.java

@ -19,6 +19,14 @@ public class RpcApply {
private String number;
//案件类型 1、刑事案件 2、行政案件
@TableField("case_type")
private String caseType;
//案件类别
@TableField("case_category")
private String caseCategory;
// 申请时间
@TableField("apply_date")
@JsonFormat(pattern="yyyy-MM-dd")
@ -49,6 +57,9 @@ public class RpcApply {
@TableField("rpc_status")
private String rpcStatus;
@TableField("second_depart_id")
private String secondDepartId;
// 事实及理由
private String factReason;
@ -102,4 +113,4 @@ public class RpcApply {
// 数据来源
private String source;
}
}

13
src/main/java/com/biutag/supervision/pojo/model/DataRightsComfortModel.java

@ -2,6 +2,7 @@ package com.biutag.supervision.pojo.model;
import com.biutag.supervision.pojo.dto.common.BarItem;
import com.biutag.supervision.pojo.dto.common.PieItem;
import com.biutag.supervision.pojo.vo.EchartsVo;
import lombok.Getter;
import lombok.Setter;
@ -20,20 +21,24 @@ public class DataRightsComfortModel {
// 抚慰人数
private Long comfortPersonNumber;
// 打击处理人数
Integer hitPersonNumber;
long hitPersonNumber;
// 抚慰金额(万元)
Double comfortMoney;
// 维权案件情况 - 分县市局
// List<BarItem> countyRightsBarList = new ArrayList<>();
List<BarItem> countyRightsBarList = new ArrayList<>();
// // 维权案件情况 - 局属单位
// List<BarItem> bureauRightsBarList = new ArrayList<>();
List<BarItem> bureauRightsBarList = new ArrayList<>();
// 抚慰金额情况 - 分县市局
List<BarItem> countyComfortMoneyBarList = new ArrayList<>();
// 抚慰金额情况 - 局属单位
List<BarItem> bureauComfortMoneyBarList = new ArrayList<>();
// 案件类别占比
// 刑事案件类别占比
List<EchartsVo> crownCaseBarList = new ArrayList<>();
// 行政案件类别占比
List<EchartsVo> administrativeCaseList = new ArrayList<>();
// 打处情况
List<PieItem> punishmentSituation = new ArrayList<>();
// 民辅警抚慰情况占比

28
src/main/java/com/biutag/supervision/pojo/vo/ComfortMapIconVo.java

@ -0,0 +1,28 @@
package com.biutag.supervision.pojo.vo;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.math.BigDecimal;
@Getter
@Setter
public class ComfortMapIconVo implements Serializable {
private String name; // 名字
private String departId; // id
// 维权案件总数
private Integer rightsNumber;
// 受侵害人数
private Integer victimNumber;
// 抚慰人数
private Long comfortPersonNumber;
// 打击处理人数
long hitPersonNumber;
// 抚慰金额(万元)
BigDecimal comfortMoney;
}

5
src/main/java/com/biutag/supervision/service/RpcApplyService.java

@ -163,4 +163,9 @@ public class RpcApplyService extends ServiceImpl<RpcApplyMapper, RpcApply> {
public Long count(Date beginTime, Date endTime, String type) {
return count(new LambdaQueryWrapper<RpcApply>().between(RpcApply::getCrtTime, beginTime, endTime).eq(RpcApply::getType, type));
}
// 抚慰人数
public Long orgCount(Date beginTime, Date endTime, String type, String orgId) {
return count(new LambdaQueryWrapper<RpcApply>().between(RpcApply::getCrtTime, beginTime, endTime).eq(RpcApply::getSecondDepartId,orgId).eq(RpcApply::getType, type));
}
}

Loading…
Cancel
Save