Browse Source

Merge remote-tracking branch 'origin/master'

main
parent
commit
93e4df1156
  1. 79
      src/main/java/com/biutag/supervision/controller/datav/DatavRightsComfortController.java
  2. 166
      src/main/java/com/biutag/supervision/controller/system/PoliceController.java
  3. 2
      src/main/java/com/biutag/supervision/mapper/ModelClueDataMapper.java
  4. 8
      src/main/java/com/biutag/supervision/mapper/ModelClueTaskMapper.java
  5. 29
      src/main/java/com/biutag/supervision/mapper/RpcApplyMapper.java
  6. 2
      src/main/java/com/biutag/supervision/mapper/SupExternalDepartMapper.java
  7. 39
      src/main/java/com/biutag/supervision/pojo/dto/PoliceImport.java
  8. 2
      src/main/java/com/biutag/supervision/pojo/dto/common/PieItem.java
  9. 6
      src/main/java/com/biutag/supervision/pojo/entity/ModelClue.java
  10. 28
      src/main/java/com/biutag/supervision/pojo/model/DataRightsComfortModel.java
  11. 38
      src/main/java/com/biutag/supervision/service/BusinessDepartService.java
  12. 33
      src/main/java/com/biutag/supervision/service/BusinessPoliceService.java
  13. 59
      src/main/java/com/biutag/supervision/service/DataRightsComfortService.java
  14. 4
      src/main/java/com/biutag/supervision/service/HolidayService.java
  15. 292
      src/main/java/com/biutag/supervision/service/ModelClueService.java
  16. 2
      src/main/java/com/biutag/supervision/service/RpcInfringerResultService.java
  17. 6
      src/main/java/com/biutag/supervision/service/SupExternalDepartService.java
  18. 29
      src/main/resources/mapper/ModelClueTaskMapper.xml
  19. BIN
      src/main/resources/static/templates/数字督察警员权限导入模板.xlsx

79
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) {
public Result<DataRightsComfortModel> 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<RpcApply>().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<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.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);
}
}

166
src/main/java/com/biutag/supervision/controller/system/PoliceController.java

@ -2,27 +2,35 @@ package com.biutag.supervision.controller.system;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelReader;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.ReadSheet;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.supervision.constants.enums.DepartLevelEnum;
import com.biutag.supervision.constants.enums.InitialPetition;
import com.biutag.supervision.pojo.Result;
import com.biutag.supervision.pojo.domain.PoliceAuth;
import com.biutag.supervision.pojo.entity.NegDepartAuthority;
import com.biutag.supervision.pojo.entity.NegSourceAuthority;
import com.biutag.supervision.pojo.entity.SupDepart;
import com.biutag.supervision.pojo.entity.SupPolice;
import com.biutag.supervision.pojo.dto.PoliceImport;
import com.biutag.supervision.pojo.entity.*;
import com.biutag.supervision.pojo.model.PoliceModel;
import com.biutag.supervision.pojo.param.PoliceQueryParam;
import com.biutag.supervision.service.NegDepartAuthorityService;
import com.biutag.supervision.service.NegSourceAuthorityService;
import com.biutag.supervision.service.SupDepartService;
import com.biutag.supervision.service.SupPoliceService;
import com.biutag.supervision.service.*;
import jakarta.validation.ConstraintViolation;
import jakarta.validation.Validator;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
@RequestMapping("police")
@RequiredArgsConstructor
@ -37,6 +45,8 @@ public class PoliceController {
private final NegSourceAuthorityService negSourceAuthorityService;
private final Validator validator;
@GetMapping
public Result<Page<PoliceModel>> list(PoliceQueryParam param) {
return Result.success(policeService.page(param));
@ -105,4 +115,138 @@ public class PoliceController {
return Result.success();
}
private final BaseUserService userService;
private final BaseAccountService accountService;
private final SupDictProblemSourceService dictProblemSourceService;
@PostMapping("import")
public Result<List<PoliceImport>> importExcel(@RequestPart("file") MultipartFile file) throws IOException {
String fileNameType = FileUtil.extName(file.getOriginalFilename());
if (!"xls".equals(fileNameType) && !"xlsx".equals(fileNameType)) {
throw new RuntimeException("仅支持 xls/xlsx 格式文件的导入");
}
List<PoliceImport> list = new ArrayList<>();
List<SupDictProblemSource> problemSources = dictProblemSourceService.list();
ExcelReader excelReader = EasyExcel.read(file.getInputStream(), PoliceImport.class, new ReadListener<PoliceImport>() {
@Override
public void invoke(PoliceImport data, AnalysisContext analysisContext) {
Set<ConstraintViolation<PoliceImport>> validate = validator.validate(data);
if (!validate.isEmpty()) {
String message = validate.stream().map(ConstraintViolation::getMessage).collect(Collectors.joining("\n"));
throw new RuntimeException(String.format("第%s条数据的异常:%s", list.size() + 1, message));
}
list.add(data);
}
@Override
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
}
}).build();
ReadSheet sheet = EasyExcel.readSheet(0).build();
excelReader.read(sheet);
excelReader.close();
for (int i = 0; i < list.size(); i++) {
PoliceImport police = list.get(i);
SupDepart depart;
if (StrUtil.isBlank(police.getThirdDepartName())) {
depart = departService.getOne(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getShortName, police.getSecondDepartName()).eq(SupDepart::getLevel, 2));
} else {
SupDepart secondDepart = departService.getOne(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getShortName, police.getSecondDepartName()).eq(SupDepart::getLevel, 2));
depart = departService.getOne(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getPid, secondDepart.getId())
.eq(SupDepart::getShortName, police.getThirdDepartName()).eq(SupDepart::getLevel, 3));
}
SupPolice supPolice = policeService.getByIdCode(list.get(i).getIdCode());
if (supPolice == null) {
supPolice = new SupPolice();
supPolice.setName(police.getName());
supPolice.setIdCode(police.getIdCode());
supPolice.setEmpNo(police.getEmpNo());
supPolice.setOrgId(depart.getId());
if (police.getEmpNo().contains("A")) {
supPolice.setPersonType("3");
} else {
supPolice.setPersonType("1");
}
policeService.save(supPolice);
} else {
supPolice.setName(police.getName());
supPolice.setIdCode(police.getIdCode());
supPolice.setEmpNo(police.getEmpNo());
supPolice.setOrgId(depart.getId());
if (police.getEmpNo().contains("A")) {
supPolice.setPersonType("3");
} else {
supPolice.setPersonType("1");
}
policeService.updateById(supPolice);
}
if ("三级机构专班".equals(police.getRole()) || "二级机构专班".equals(police.getRole())) {
String userId = saveOrUpdateUser(police);
// 角色
addRoleUser(userId, police.getRole());
// 权限
addAuth(police.getIdCode(), supPolice.getOrgId(), problemSources);
}
}
return Result.success(list);
}
public String saveOrUpdateUser(PoliceImport police) {
BaseUser user = userService.getByUserName(police.getIdCode());
if (user != null) {
return user.getUserId();
}
BaseUser baseUser = new BaseUser();
baseUser.setUserName(police.getIdCode());
baseUser.setNickName(police.getName());
baseUser.setUserType("admin");
baseUser.setCreateTime(LocalDateTime.now());
baseUser.setUpdateTime(LocalDateTime.now());
userService.save(baseUser);
BaseAccount account = new BaseAccount();
account.setAccount(police.getIdCode());
account.setUserId(baseUser.getUserId());
account.setAccountType("username");
account.setDomain("@admin.com");
account.setPassword("$2a$10$q0NbHH1fbkDotxJ1dT7PbOcV4G47R8n15uVxz2.imTiDqdCwAJYBC");
account.setDomain("@admin.com");
account.setCreateTime(LocalDateTime.now());
account.setUpdateTime(LocalDateTime.now());
accountService.save(account);
return baseUser.getUserId();
}
private final BaseRoleUserService roleUserService;
public void addRoleUser(String userId, String role) {
roleUserService.remove(new LambdaQueryWrapper<BaseRoleUser>().eq(BaseRoleUser::getUserId, userId));
BaseRoleUser baseRoleUser = new BaseRoleUser();
baseRoleUser.setUserId(userId);
if ("三级机构专班".equals(role)) {
baseRoleUser.setRoleId("5");
}
if ("二级机构专班".equals(role)) {
baseRoleUser.setRoleId("4");
}
baseRoleUser.setCreateTime(LocalDateTime.now());
baseRoleUser.setUpdateTime(LocalDateTime.now());
roleUserService.save(baseRoleUser);
}
public void addAuth(String idCode, String orgId, List<SupDictProblemSource> problemSources) {
negDepartAuthorityService.remove(new LambdaQueryWrapper<NegDepartAuthority>().eq(NegDepartAuthority::getIdCode, idCode));
NegDepartAuthority authority = new NegDepartAuthority();
authority.setDepartId(orgId);
authority.setIdCode(idCode);
negDepartAuthorityService.save(authority);
negSourceAuthorityService.remove(new LambdaQueryWrapper<NegSourceAuthority>().eq(NegSourceAuthority::getIdCode, idCode));
List<NegSourceAuthority> list = problemSources.stream().map(item -> {
NegSourceAuthority sourceAuthority = new NegSourceAuthority();
sourceAuthority.setIdCode(idCode);
sourceAuthority.setSource(item.getId());
return sourceAuthority;
}).toList();
negSourceAuthorityService.saveBatch(list);
}
}

2
src/main/java/com/biutag/supervision/mapper/ModelClueDataMapper.java

@ -17,4 +17,6 @@ public interface ModelClueDataMapper extends BaseMapper<ModelClue> {
@Select("${newSql}")
List<Map<String, Object>> selectByUniqueKeys(@org.apache.ibatis.annotations.Param("newSql") String newSql);
@Select("SELECT XM, JH FROM dwd_ry_zfba_baryxx WHERE ZJ = #{barID}")
Map<String, Object> selectBAR(String barID);
}

8
src/main/java/com/biutag/supervision/mapper/ModelClueTaskMapper.java

@ -1,8 +1,16 @@
package com.biutag.supervision.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.biutag.supervision.pojo.entity.ModelClueTask;
import com.biutag.supervision.pojo.model.ModelClueTaskModel;
import com.biutag.supervision.pojo.model.NegativeWorkModel;
import org.apache.ibatis.annotations.Param;
public interface ModelClueTaskMapper extends BaseMapper<ModelClueTask> {
Page<ModelClueTaskModel> queryPage(@Param("page") Page<ModelClueTask> page, @Param(Constants.WRAPPER) QueryWrapper<ModelClueTask> queryWrapper);
}

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/mapper/SupExternalDepartMapper.java

@ -10,7 +10,7 @@ import java.util.Map;
public interface SupExternalDepartMapper extends BaseMapper<SupExternalDepart> {
@Select("<script>"
+ "SELECT DISTINCT external_id, internal_id FROM sup_external_depart WHERE external_id IN "
+ "SELECT DISTINCT external_id, internal_id, internal_short_name FROM sup_external_depart WHERE external_id IN "
+ "<foreach item='item' index='index' collection='list' open='(' separator=',' close=')'>"
+ "#{item}"
+ "</foreach>"

39
src/main/java/com/biutag/supervision/pojo/dto/PoliceImport.java

@ -0,0 +1,39 @@
package com.biutag.supervision.pojo.dto;
import com.alibaba.excel.annotation.ExcelProperty;
import jakarta.validation.constraints.NotBlank;
import lombok.Getter;
import lombok.Setter;
/**
* @author wxc
* @date 2024/10/30
*/
@Setter
@Getter
public class PoliceImport {
@NotBlank(message = "姓名为空")
@ExcelProperty("姓名")
private String name;
@NotBlank(message = "警号为空")
@ExcelProperty("警号")
private String empNo;
@NotBlank(message = "身份证为空")
@ExcelProperty("身份证")
private String idCode;
@NotBlank(message = "二级单位为空")
@ExcelProperty("二级单位")
private String secondDepartName;
@ExcelProperty("三级单位")
private String thirdDepartName;
@NotBlank(message = "角色为空")
@ExcelProperty("角色")
private String role;
}

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;

6
src/main/java/com/biutag/supervision/pojo/entity/ModelClue.java

@ -30,7 +30,7 @@ public class ModelClue {
private String involveDepartId;
// 涉及人员
@TableField("involve_depart_name")
@TableField("involve_police_name")
private String involvePoliceName;
// 涉及人员警号
@ -68,6 +68,10 @@ public class ModelClue {
@TableField("unique_key")
private String uniqueKey;
// 任务ID
private Integer taskId;
// 总警情数
@TableField(exist = false)
private Long zjjs;

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;
// 民辅警受伤情况
// 发案情况占比
}

38
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("开始导入单位");
@ -116,6 +126,10 @@ public class BusinessDepartService extends ServiceImpl<BusinessDepartMapper, Bus
map -> map.get("internal_id") == null ? "" : (String) map.get("internal_id")
));
List<String> values = resultMap2.values().stream().filter(Objects::nonNull).toList();// 1011
Map<String, String> resultMap3 = idsByDepartIds.stream().filter(map -> map.get("external_id") != null).collect(Collectors.toMap(
map -> (String) map.get("external_id"),
map -> map.get("internal_short_name") == null ? "" : (String) map.get("internal_short_name")
));
List<Map<String, Object>> resultList = new ArrayList<>();
if (!values.isEmpty()) {
resultList = statisticsDepartMapper.getGroupIdsByDepartIds(values);
@ -127,7 +141,7 @@ public class BusinessDepartService extends ServiceImpl<BusinessDepartMapper, Bus
}
Map<String, Long> resultMap = resultList.stream().collect(Collectors.toMap(map -> (String) map.get("departId"), map -> (Long) map.get("groupId")));
List<Long> groupIds = new ArrayList<>();
generateBusinessDepartList(happenTime, gBaseJJDSList, resultMap, resultMap2, groupIds, businessDepartList, gBaseAJJBXXListSA, gBaseAJJBXXListLA, gBaseAJJBXXListPA);
generateBusinessDepartList(happenTime, gBaseJJDSList, resultMap, resultMap2, resultMap3, groupIds, businessDepartList, gBaseAJJBXXListSA, gBaseAJJBXXListLA, gBaseAJJBXXListPA);
List<Map<Long, Object>> nameList = statisticsGroupMapper.getNameByGroupIds(groupIds);
Map<Long, String> names = nameList.stream().collect(Collectors.toMap(map -> (Long) map.get("groupId"), map -> (String) map.get("name")));
for (BusinessDepart businessDepart : businessDepartList) {
@ -141,14 +155,14 @@ public class BusinessDepartService extends ServiceImpl<BusinessDepartMapper, Bus
businessLogMapper.insert(new BusinessLog().setType("单位业务数据").setNum(gBaseJJDSList.size() + gBaseAJJBXXListSA.size() + gBaseAJJBXXListLA.size() + gBaseAJJBXXListPA.size()).setActualNum(actualNum).setCreateTime(LocalDateTime.now()));
}
private static void generateBusinessDepartList(List<Date> happenTime, List<GBaseJJD> gBaseJJDSList, Map<String, Long> resultMap, Map<String, String> resultMap2, List<Long> groupIds, List<BusinessDepart> businessDepartList, List<GBaseAJJBXX> gBaseAJJBXXListSA, List<GBaseAJJBXX> gBaseAJJBXXListLA, List<GBaseAJJBXX> gBaseAJJBXXListPA) {
private static void generateBusinessDepartList(List<Date> happenTime, List<GBaseJJD> gBaseJJDSList, Map<String, Long> resultMap, Map<String, String> resultMap2, Map<String, String> resultMap3, List<Long> groupIds, List<BusinessDepart> businessDepartList, List<GBaseAJJBXX> gBaseAJJBXXListSA, List<GBaseAJJBXX> gBaseAJJBXXListLA, List<GBaseAJJBXX> gBaseAJJBXXListPA) {
for (GBaseJJD gBaseJJD : gBaseJJDSList) {
Long groupId = resultMap.get(resultMap2.get(gBaseJJD.getGxdwdm()));
if (groupId == null) {
continue;
}
groupIds.add(groupId);
BusinessDepart businessDepart = getJJDBusinessDepart(happenTime, gBaseJJD, groupId);
BusinessDepart businessDepart = getJJDBusinessDepart(happenTime, gBaseJJD, groupId, resultMap2, resultMap3);
businessDepartList.add(businessDepart);
}
for (GBaseAJJBXX gBaseAJJBXX : gBaseAJJBXXListSA) {
@ -157,7 +171,7 @@ public class BusinessDepartService extends ServiceImpl<BusinessDepartMapper, Bus
continue;
}
groupIds.add(groupId);
BusinessDepart businessDepart = getAJJBXXBusinessDepart(happenTime, gBaseAJJBXX, groupId, 1);
BusinessDepart businessDepart = getAJJBXXBusinessDepart(happenTime, gBaseAJJBXX, groupId, 1, resultMap2, resultMap3);
businessDepartList.add(businessDepart);
}
for (GBaseAJJBXX gBaseAJJBXX : gBaseAJJBXXListLA) {
@ -166,7 +180,7 @@ public class BusinessDepartService extends ServiceImpl<BusinessDepartMapper, Bus
continue;
}
groupIds.add(groupId);
BusinessDepart businessDepart = getAJJBXXBusinessDepart(happenTime, gBaseAJJBXX, groupId, 2);
BusinessDepart businessDepart = getAJJBXXBusinessDepart(happenTime, gBaseAJJBXX, groupId, 2, resultMap2, resultMap3);
businessDepartList.add(businessDepart);
}
for (GBaseAJJBXX gBaseAJJBXX : gBaseAJJBXXListPA) {
@ -175,7 +189,7 @@ public class BusinessDepartService extends ServiceImpl<BusinessDepartMapper, Bus
continue;
}
groupIds.add(groupId);
BusinessDepart businessDepart = getAJJBXXBusinessDepart(happenTime, gBaseAJJBXX, groupId, 3);
BusinessDepart businessDepart = getAJJBXXBusinessDepart(happenTime, gBaseAJJBXX, groupId, 3, resultMap2, resultMap3);
businessDepartList.add(businessDepart);
}
}
@ -195,11 +209,11 @@ public class BusinessDepartService extends ServiceImpl<BusinessDepartMapper, Bus
}
}
private static BusinessDepart getJJDBusinessDepart(List<Date> happenTime, GBaseJJD gBaseJJD, Long groupId) {
private static BusinessDepart getJJDBusinessDepart(List<Date> happenTime, GBaseJJD gBaseJJD, Long groupId, Map<String, String> resultMap2, Map<String, String> resultMap3) {
BusinessDepart businessDepart = new BusinessDepart();
businessDepart.setDate(happenTime.get(0));
businessDepart.setDepartId(gBaseJJD.getGxdwdm());
businessDepart.setDepartName(gBaseJJD.getGxdwmc());
businessDepart.setDepartId(resultMap2.get(gBaseJJD.getGxdwdm()));
businessDepart.setDepartName(resultMap3.get(gBaseJJD.getGxdwdm()));
businessDepart.setGroupId(groupId);
businessDepart.setNumber(gBaseJJD.getJjdbhTotal());
if (groupId != null) {
@ -214,11 +228,11 @@ public class BusinessDepartService extends ServiceImpl<BusinessDepartMapper, Bus
return businessDepart;
}
private static BusinessDepart getAJJBXXBusinessDepart(List<Date> happenTime, GBaseAJJBXX gBasAJJBXX, Long groupId, int type) {
private static BusinessDepart getAJJBXXBusinessDepart(List<Date> happenTime, GBaseAJJBXX gBasAJJBXX, Long groupId, int type, Map<String, String> resultMap2, Map<String, String> resultMap3) {
BusinessDepart businessDepart = new BusinessDepart();
businessDepart.setDate(happenTime.get(0));
businessDepart.setDepartId(gBasAJJBXX.getBADWIDdm());
businessDepart.setDepartName(gBasAJJBXX.getBADWIDmc());
businessDepart.setDepartId(resultMap2.get(gBasAJJBXX.getBADWIDdm()));
businessDepart.setDepartName(resultMap3.get(gBasAJJBXX.getBADWIDdm()));
businessDepart.setGroupId(groupId);
businessDepart.setNumber(gBasAJJBXX.getBADWNum());
if (type == 1) {

33
src/main/java/com/biutag/supervision/service/BusinessPoliceService.java

@ -40,12 +40,8 @@ public class BusinessPoliceService extends ServiceImpl<BusinessPoliceMapper, Bus
private final BusinessLogMapper businessLogMapper;
private final BusinessDepartService businessDepartService;
public final ModelClueDataMapper modelClueDataMapper;
private final SupDepartMapper supDepartMapper;
private final SupExternalDepartMapper supExternalDepartMapper;
public Page<BusinessPoliceModel> page(BusinessQueryParam businessQueryParam) {
@ -59,7 +55,6 @@ public class BusinessPoliceService extends ServiceImpl<BusinessPoliceMapper, Bus
happenTime.add(startDate);
happenTime.add(endDate);
generate(happenTime);
businessDepartService.generate(happenTime);
log.info("已经导入{}的个人数据", date.format(DateTimeFormatter.ofPattern("yyyy年M月d日")));
}
} else if (businessQueryParam.getDepartName() != null && businessQueryParam.getDepartName().equals("开始导入今天所有的数据")) {
@ -113,13 +108,17 @@ public class BusinessPoliceService extends ServiceImpl<BusinessPoliceMapper, Bus
map -> map.get("internal_id") == null ? "" : (String) map.get("internal_id")
));
List<String> values = resultMap2.values().stream().filter(Objects::nonNull).toList();// 1011
Map<String, String> resultMap3 = idsByDepartIds.stream().filter(map -> map.get("external_id") != null).collect(Collectors.toMap(
map -> (String) map.get("external_id"),
map -> map.get("internal_short_name") == null ? "" : (String) map.get("internal_short_name")
));
List<Map<String, Object>> resultList = statisticsDepartMapper.getGroupIdsByDepartIds(values);
Map<String, Long> resultMap = resultList.stream().collect(Collectors.toMap(
map -> (String) map.get("departId"),
map -> (Long) map.get("groupId")
));
List<Long> groupIds = new ArrayList<>();
generateBusinessPoliceList(happenTime, gBaseCJDSList, resultMap, resultMap2, groupIds, businessPoliceList, gBaseAJJBXXMapSR, gBaseAJJBXXMapLR, gBaseAJJBXXMapPR);
generateBusinessPoliceList(happenTime, gBaseCJDSList, resultMap, resultMap2, resultMap3, groupIds, businessPoliceList, gBaseAJJBXXMapSR, gBaseAJJBXXMapLR, gBaseAJJBXXMapPR);
List<Map<Long, Object>> nameList = statisticsGroupMapper.getNameByGroupIds(groupIds);
Map<Long, String> names = nameList.stream().collect(Collectors.toMap(
map -> (Long) map.get("groupId"),
@ -136,14 +135,14 @@ public class BusinessPoliceService extends ServiceImpl<BusinessPoliceMapper, Bus
businessLogMapper.insert(new BusinessLog().setType("个人业务数据").setNum(gBaseCJDSList.size()).setActualNum(actualNum).setCreateTime(LocalDateTime.now()));
}
private static void generateBusinessPoliceList(List<Date> happenTime, List<GBaseCJD> gBaseCJDSList, Map<String, Long> resultMap, Map<String, String> resultMap2, List<Long> groupIds, List<BusinessPolice> businessPoliceList, Map<String, GBaseAJJBXX> gBaseAJJBXXMapSR, Map<String, GBaseAJJBXX> gBaseAJJBXXMapLR, Map<String, GBaseAJJBXX> gBaseAJJBXXMapPR) {
private static void generateBusinessPoliceList(List<Date> happenTime, List<GBaseCJD> gBaseCJDSList, Map<String, Long> resultMap, Map<String, String> resultMap2, Map<String, String> resultMap3, List<Long> groupIds, List<BusinessPolice> businessPoliceList, Map<String, GBaseAJJBXX> gBaseAJJBXXMapSR, Map<String, GBaseAJJBXX> gBaseAJJBXXMapLR, Map<String, GBaseAJJBXX> gBaseAJJBXXMapPR) {
for (GBaseCJD gBaseCJD : gBaseCJDSList) {
Long groupId = resultMap.get(resultMap2.get(gBaseCJD.getCjdxssdwdm()));
if (groupId == null) {
continue;
}
groupIds.add(groupId);
BusinessPolice businessPolice = getJJDBusinessPolice(happenTime, gBaseCJD, groupId);
BusinessPolice businessPolice = getJJDBusinessPolice(happenTime, gBaseCJD, groupId, resultMap2, resultMap3);
businessPoliceList.add(businessPolice);
}
for (GBaseAJJBXX gBaseAJJBXX : gBaseAJJBXXMapSR.values()) {
@ -152,7 +151,7 @@ public class BusinessPoliceService extends ServiceImpl<BusinessPoliceMapper, Bus
continue;
}
groupIds.add(groupId);
BusinessPolice businessPolice = getAJJBXXBusinessPolice(happenTime, gBaseAJJBXX, groupId, 4);
BusinessPolice businessPolice = getAJJBXXBusinessPolice(happenTime, gBaseAJJBXX, groupId, 4, resultMap2, resultMap3);
businessPoliceList.add(businessPolice);
}
for (GBaseAJJBXX gBaseAJJBXX : gBaseAJJBXXMapLR.values()) {
@ -161,7 +160,7 @@ public class BusinessPoliceService extends ServiceImpl<BusinessPoliceMapper, Bus
continue;
}
groupIds.add(groupId);
BusinessPolice businessPolice = getAJJBXXBusinessPolice(happenTime, gBaseAJJBXX, groupId, 5);
BusinessPolice businessPolice = getAJJBXXBusinessPolice(happenTime, gBaseAJJBXX, groupId, 5, resultMap2, resultMap3);
businessPoliceList.add(businessPolice);
}
for (GBaseAJJBXX gBaseAJJBXX : gBaseAJJBXXMapPR.values()) {
@ -170,7 +169,7 @@ public class BusinessPoliceService extends ServiceImpl<BusinessPoliceMapper, Bus
continue;
}
groupIds.add(groupId);
BusinessPolice businessPolice = getAJJBXXBusinessPolice(happenTime, gBaseAJJBXX, groupId, 6);
BusinessPolice businessPolice = getAJJBXXBusinessPolice(happenTime, gBaseAJJBXX, groupId, 6, resultMap2, resultMap3);
businessPoliceList.add(businessPolice);
}
}
@ -351,11 +350,11 @@ public class BusinessPoliceService extends ServiceImpl<BusinessPoliceMapper, Bus
private record ZFBAResult(List<Map<String, Object>> bar1, List<Map<String, Object>> bar2, List<Map<String, Object>> bar3, List<Map<String, Object>> bar4, List<Map<String, Object>> bar5, List<Map<String, Object>> bar6) {
}
private static BusinessPolice getJJDBusinessPolice(List<Date> happenTime, GBaseCJD gBaseCJD, Long groupId) {
private static BusinessPolice getJJDBusinessPolice(List<Date> happenTime, GBaseCJD gBaseCJD, Long groupId, Map<String, String> resultMap2, Map<String, String> resultMap3) {
BusinessPolice businessPolice = new BusinessPolice();
businessPolice.setDate(happenTime.get(0));
businessPolice.setDepartId(gBaseCJD.getCjdxssdwdm());
businessPolice.setDepartName(gBaseCJD.getCjdxssdwmc());
businessPolice.setDepartId(resultMap2.get(gBaseCJD.getCjdxssdwdm()));
businessPolice.setDepartName(resultMap3.get(gBaseCJD.getCjdxssdwdm()));
businessPolice.setGroupId(groupId);
businessPolice.setNumber(gBaseCJD.getClwbrxmTotal());
businessPolice.setPoliceName(gBaseCJD.getClwbrxm());
@ -373,11 +372,11 @@ public class BusinessPoliceService extends ServiceImpl<BusinessPoliceMapper, Bus
return businessPolice;
}
private static BusinessPolice getAJJBXXBusinessPolice(List<Date> happenTime, GBaseAJJBXX gBaseAJJBXX, Long groupId, int type) {
private static BusinessPolice getAJJBXXBusinessPolice(List<Date> happenTime, GBaseAJJBXX gBaseAJJBXX, Long groupId, int type, Map<String, String> resultMap2, Map<String, String> resultMap3) {
BusinessPolice businessPolice = new BusinessPolice();
businessPolice.setDate(happenTime.get(0));
businessPolice.setDepartId(gBaseAJJBXX.getBADWIDdm());
businessPolice.setDepartName(gBaseAJJBXX.getBADWIDmc());
businessPolice.setDepartId(resultMap2.get(gBaseAJJBXX.getBADWIDdm()));
businessPolice.setDepartName(resultMap3.get(gBaseAJJBXX.getBADWIDdm()));
businessPolice.setGroupId(groupId);
businessPolice.setNumber(gBaseAJJBXX.getBARNum());
businessPolice.setPoliceName(gBaseAJJBXX.getXM());

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);
}
}

4
src/main/java/com/biutag/supervision/service/HolidayService.java

@ -28,16 +28,14 @@ public class HolidayService extends ServiceImpl<HolidayMapper, Holiday> {
long l = System.currentTimeMillis();
Boolean result = (Boolean) redisTemplate.opsForValue().get(String.format("holiday:%s", date));
if (Objects.nonNull(result)) {
System.out.println(String.format("查询节假日耗时:%sms", System.currentTimeMillis() - l));
return result;
}
Holiday holiday = getOne(new LambdaUpdateWrapper<Holiday>().eq(Holiday::getDate, date));
if (Objects.isNull(holiday)) {
log.error("节假日 {} 数据未找到", date);
// log.error("节假日 {} 数据未找到", date);
return false;
}
redisTemplate.opsForValue().set(String.format("holiday:%s", date), holiday.getFlag());
System.out.println(String.format("查询节假日耗时(sql):%sms", System.currentTimeMillis() - l));
return holiday.getFlag();
}

292
src/main/java/com/biutag/supervision/service/ModelClueService.java

@ -52,8 +52,6 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
public final ModelClueRecordMapper modelClueRecordMapper;
public final SupDepartMapper supDepartMapper;
public final SupExternalDepartMapper supExternalDepartMapper;
public Page<ModelClueModel> page(ModelClueQueryParam param) {
@ -173,7 +171,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
for (ModelClue modelClue : modelClues) {
modelClue.setModelId(modelId);
modelClue.setCreateTime(LocalDateTime.now());
SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper<SupExternalDepart>().eq(SupExternalDepart::getExternalId, modelClue.getInvolveDepartId()));
SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper<SupExternalDepart>().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());
@ -193,9 +191,9 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
} else if (modelId == 4) { // 4号模型:疑似漏登执法办案场所问题监督模型
return getModelCluesForModel4(sql, modelClues);
} else {
System.out.println("测试" + modelId + "开始查询数据库");
System.out.println("模型" + modelId + "开始查询数据库");
modelClues = modelClueDataMapper.selectDataByDynamicSql(sql);
System.out.println("测试" + modelId + "查询数据库完毕,数量为:" + modelClues.size());
System.out.println("模型" + modelId + "查询数据库完毕,数量为:" + modelClues.size());
}
List<String> uniqueKeys = modelClues.stream().map(ModelClue::getUniqueKey).filter(k -> k != null && !k.isEmpty()).toList();
List<String> oldUniqueKeys = this.listObjs(new LambdaQueryWrapper<ModelClue>().select(ModelClue::getUniqueKey).eq(ModelClue::getStatus, 0).eq(ModelClue::getModelId, modelId), String::valueOf);
@ -217,53 +215,184 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
if (Objects.equals(keyColumn, modelClue.getUniqueKey())) {
modelClue.setData(JSONObject.toJSONString(data));
modelClue.setStatus(0);
List<Integer> modelNos = new ArrayList<>(List.of(1)); // 1号模型:行政、刑事案件受理30天仍未立案问题监督模型
if (modelNos.contains(modelId)) {
String thingDesc = modelClue.getThingDesc();
modelClue.setThingDesc("该" + data.get("AJBZmc")
+ "案件编号为" + data.get("AJBH")
+ ",报案日期为" + getDateString(data.get("BARQ"))
+ ",受理日期为" + getDateString(data.get("SLRQ"))
+ ",当前案件状态为“" + data.get("AJZTmc")
+ "”,已经超过" + "30"
+ "日仍未受理。案件详情:" + thingDesc);
} else if (modelId == 3) { // 3号模型:执法办案场所登记时长超时问题监督模型
if (data.get("lksj") != null && !data.get("lksj").equals("")) {
modelClue.setThingDesc("姓名" + data.get("xm")
+ ",身份证号" + data.get("zjhm")
+ ",于" + formatStringDate((String) data.get("djsj"))
+ "登记进入" + data.get("csmc")
+ ",离开时间为" + formatStringDate((String) data.get("lksj"))
+ ",超过了48小时。");
setPerson(modelId, modelClue, data);
generateZFBAThingDesc(modelId, modelClue, data);
break;
}
}
}
return needsInsertModelClues;
}
private void setPerson(Integer modelId, ModelClue modelClue, Map<String, Object> data) {
if (modelId == 3) {
if (data.get("bar1") != null && !data.get("bar1").equals("")) {
if (data.get("bar2") != null && !data.get("bar2").equals("")) {
modelClue.setInvolvePoliceName(data.get("bar1") + "," + data.get("bar2"));
} else {
modelClue.setInvolvePoliceName((String) data.get("bar1"));
}
} else {
if (data.get("bar2") != null && !data.get("bar2").equals("")) {
modelClue.setInvolvePoliceName((String) data.get("bar2"));
} else {
modelClue.setInvolvePoliceName("无数据");
}
}
if (data.get("bar1jh") != null && !data.get("bar1jh").equals("")) {
if (data.get("bar2jh") != null && !data.get("bar2jh").equals("")) {
modelClue.setInvolvePoliceEmpNo(data.get("bar1jh") + "," + data.get("bar2jh"));
} else {
modelClue.setInvolvePoliceEmpNo((String) data.get("bar1jh"));
}
} else {
if (data.get("bar2jh") != null && !data.get("bar2jh").equals("")) {
modelClue.setInvolvePoliceEmpNo((String) data.get("bar2jh"));
} else {
modelClue.setInvolvePoliceEmpNo("无数据");
}
}
}
if (modelId == 10 || modelId == 11 || modelId == 12 || modelId == 13 || modelId == 14) {
Map<String, Object> bar1;
Map<String, Object> bar2;
if (data.get("BAR1ID") != null && !data.get("BAR1ID").equals("")) {
bar1 = modelClueDataMapper.selectBAR((String) data.get("BAR1ID"));
if (data.get("BAR2ID") != null && !data.get("BAR2ID").equals("")) {
bar2 = modelClueDataMapper.selectBAR((String) data.get("BAR2ID"));
if (bar1 != null) {
if (bar2 != null) {
modelClue.setInvolvePoliceEmpNo(bar1.get("JH") + "," + bar2.get("JH"));
modelClue.setInvolvePoliceName(bar1.get("XM") + "," + bar2.get("XM"));
} else {
modelClue.setThingDesc("姓名" + data.get("xm")
+ ",身份证号" + data.get("zjhm")
+ ",于" + formatStringDate((String) data.get("djsj"))
+ "登记进入" + data.get("csmc")
+ ",没有离开时间。");
modelClue.setInvolvePoliceEmpNo((String) bar1.get("JH"));
modelClue.setInvolvePoliceName((String) bar1.get("XM"));
}
} else if (bar2 != null) {
modelClue.setInvolvePoliceEmpNo((String) bar2.get("JH"));
modelClue.setInvolvePoliceName((String) bar2.get("XM"));
} else {
modelClue.setInvolvePoliceEmpNo("无数据");
modelClue.setInvolvePoliceName("无数据");
}
} else {
if (bar1 != null) {
modelClue.setInvolvePoliceEmpNo((String) bar1.get("JH"));
modelClue.setInvolvePoliceName((String) bar1.get("XM"));
} else {
modelClue.setInvolvePoliceEmpNo("无数据");
modelClue.setInvolvePoliceName("无数据");
}
break;
}
} else {
if (data.get("bar2jh") != null && !data.get("bar2jh").equals("")) {
bar2 = modelClueDataMapper.selectBAR((String) data.get("BAR2ID"));
if (bar2 != null) {
modelClue.setInvolvePoliceEmpNo((String) bar2.get("JH"));
modelClue.setInvolvePoliceName((String) bar2.get("XM"));
} else {
modelClue.setInvolvePoliceEmpNo("无数据");
modelClue.setInvolvePoliceName("无数据");
}
} else {
modelClue.setInvolvePoliceEmpNo("无数据");
modelClue.setInvolvePoliceName("无数据");
}
}
}
return needsInsertModelClues;
}
private static void generateZFBAThingDesc(Integer modelId, ModelClue modelClue, Map<String, Object> data) {
if (modelId == 1) { // 1号模型:行政、刑事案件受理30天仍未立案问题监督模型
String thingDesc = modelClue.getThingDesc();
modelClue.setThingDesc("该" + data.get("AJBZmc")
+ "案件编号为" + data.get("AJBH")
+ ",报案日期为" + getDateString(data.get("BARQ"))
+ ",受理日期为" + getDateString(data.get("SLRQ"))
+ ",当前案件状态为“" + data.get("AJZTmc")
+ "”,已经超过" + "30"
+ "日仍未受理。" + thingDesc);
} else if (modelId == 3) { // 3号模型:执法办案场所登记时长超时问题监督模型
if (data.get("lksj") != null && !data.get("lksj").equals("")) {
modelClue.setThingDesc("姓名" + data.get("xm")
+ ",身份证号" + data.get("zjhm")
+ ",于" + formatStringDate((String) data.get("djsj"))
+ "登记进入" + data.get("csmc")
+ ",离开时间为" + formatStringDate((String) data.get("lksj"))
+ ",超过了48小时。");
} else {
modelClue.setThingDesc("姓名" + data.get("xm")
+ ",身份证号" + data.get("zjhm")
+ ",于" + formatStringDate((String) data.get("djsj"))
+ "登记进入" + data.get("csmc")
+ ",没有离开时间。");
}
} else if (modelId == 10) { // 10号模型:案件受理不及时的异常数据
modelClue.setThingDesc("该" + data.get("AJBZmc")
+ "案件编号为" + getAjbh(data)
+ ",报案日期为" + getDateString(data.get("BARQ"))
+ ",受理日期为" + getDateString(data.get("SLRQ"))
+ ",当前案件状态为“" + data.get("AJZTmc")
+ "”,超过" + "3"
+ "日未受理。");
} else if (modelId == 11) { // 11号模型:立案不及时的异常数据(7天)
modelClue.setThingDesc("该" + data.get("AJBZmc")
+ "案件编号为" + getAjbh(data)
+ ",受理日期为" + getDateString(data.get("SLRQ"))
+ ",立案日期为" + getDateString(data.get("LARQ"))
+ ",当前案件状态为“" + data.get("AJZTmc")
+ "”,超过" + "7"
+ "日未受理。");
} else if (modelId == 12) { // 12号模型:立案不及时的异常数据(30天)
modelClue.setThingDesc("该" + data.get("AJBZmc")
+ "案件编号为" + getAjbh(data)
+ ",受理日期为" + getDateString(data.get("SLRQ"))
+ ",立案日期为" + getDateString(data.get("LARQ"))
+ ",当前案件状态为“" + data.get("AJZTmc")
+ "”,超过" + "30"
+ "日未受理。");
} else if (modelId == 13) { // 13号模型:立案不及时的异常数据(60天)
modelClue.setThingDesc("该" + data.get("AJBZmc")
+ "案件编号为" + getAjbh(data)
+ ",受理日期为" + getDateString(data.get("SLRQ"))
+ ",立案日期为" + getDateString(data.get("LARQ"))
+ ",当前案件状态为“" + data.get("AJZTmc")
+ "”,超过" + "60"
+ "日未受理。");
} else if (modelId == 14) { // 14号模型:立案不及时的异常数据(无数据)
modelClue.setThingDesc("该" + data.get("AJBZmc")
+ "案件编号为" + getAjbh(data)
+ ",受理日期为" + getDateString(data.get("SLRQ"))
+ ",立案日期 无数据"
+ ",当前案件状态为“" + data.get("AJZTmc")
+ "”,立案不及时。");
}
}
private static String getAjbh(Map<String, Object> data) {
String AJBH;
if (data.get("AJBH") == null || data.get("AJBH").equals("")) {
AJBH = "空";
} else {
AJBH = (String) data.get("AJBH");
}
return AJBH;
}
private List<ModelClue> getModelCluesForModel4(String param, List<ModelClue> modelClues) {
System.out.println("测试4开始查询数据库");
System.out.println("模型4开始查询数据库");
List<String> params = parseSqlForModel2(param);
String jjdSql = "SELECT gxdwdm AS involve_depart_id, gxdwmc AS involve_depart_name, COUNT(*) AS zjjs FROM dwd_asj_zhtx_jjd WHERE cjsj BETWEEN '" + params.get(0) + " 00:00:00' AND '" + params.get(1) + " 00:00:00' GROUP BY gxdwdm, gxdwmc;";
String zfqySql = "SELECT csid AS involve_depart_id, COUNT(*) AS zfcsdjs FROM dwd_ry_zfba_zfqywfryb WHERE STR_TO_DATE( djsj, '%Y%m%d%H%i%s' ) BETWEEN '" + params.get(0) + " 00:00:00' AND '" + params.get(1) + " 00:00:00' GROUP BY csid;";
List<Map<String, Object>> jjdmaps = modelClueDataMapper.selectByUniqueKeys(jjdSql);
List<Map<String, Object>> zfqymaps = modelClueDataMapper.selectByUniqueKeys(zfqySql);
System.out.println("测试4查询数据库完毕");
System.out.println("模型4查询数据库完毕");
if (jjdmaps.isEmpty()) {
return modelClues;
}
List<ModelClue> jjdModelClues = new ArrayList<>();
for (Map<String, Object> data : jjdmaps) {
SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper<SupExternalDepart>().eq(SupExternalDepart::getExternalId, data.get("involve_depart_id")));
SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper<SupExternalDepart>().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 +412,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
mergeModelClues(jjdModelClues4, jjdModelClues3, 1);
List<ModelClue> zfqymModelClues = new ArrayList<>();
for (Map<String, Object> data : zfqymaps) {
SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper<SupExternalDepart>().eq(SupExternalDepart::getExternalId, data.get("involve_depart_id")));
SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper<SupExternalDepart>().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));
@ -300,7 +429,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
List<ModelClue> zfqymModelClues5 = new ArrayList<>(zfqymModelClues.stream().filter(clue -> clue.getDepartLevel() == 5).toList());
mergeModelClues(zfqymModelClues5, zfqymModelClues4, 2);
mergeModelClues(zfqymModelClues4, zfqymModelClues3, 2);
BigDecimal avgPercentage = null;
BigDecimal avgPercentage;
if (!zfqymModelClues3.isEmpty()) {
BigDecimal zjjsTotal = BigDecimal.valueOf(jjdModelClues3.stream().mapToLong(ModelClue::getZjjs).sum());
BigDecimal zfcsdjsTotal = BigDecimal.valueOf(zfqymModelClues3.stream().mapToLong(ModelClue::getZfcsdjs).sum());
@ -356,59 +485,6 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
return modelClues;
}
/*
private List<ModelClue> getModelCluesForModel4(String sql, List<ModelClue> modelClues) {
System.out.println("测试4开始查询数据库");
List<Map<String, Object>> maps = modelClueDataMapper.selectByUniqueKeys(sql);
System.out.println("测试4查询数据库完毕");
// 全市平均数
BigDecimal avgPercentage = null;
if (!maps.isEmpty()) {
avgPercentage = (BigDecimal) maps.get(0).get("avg_percentage");
}
List<ModelClue> oriModelClues = new ArrayList<>();
for (Map<String, Object> data : maps) {
SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper<SupExternalDepart>().eq(SupExternalDepart::getExternalId, data.get("involve_depart_id")));
if (supExternalDepart != null) {
ModelClue modelClue = new ModelClue();
modelClue.setData(JSONObject.toJSONString(data));
modelClue.setInvolveDepartId(supExternalDepart.getExternalId());
modelClue.setInvolveDepartName(supExternalDepart.getExternalName());
modelClue.setZjjs((Long) data.get("zjjs"));
modelClue.setZfcsdjs((Long) data.get("zfcsdjs"));
modelClue.setBl((BigDecimal) data.get("bl"));
modelClue.setDepartLevel(supExternalDepart.getLevel());
modelClue.setParentId(supExternalDepart.getPid());
modelClue.setThisId(supExternalDepart.getInternalId());
oriModelClues.add(modelClue);
}
}
List<ModelClue> modelClues3 = new ArrayList<>(oriModelClues.stream().filter(clue -> clue.getDepartLevel() == 3).toList());
List<ModelClue> modelClues4 = new ArrayList<>(oriModelClues.stream().filter(clue -> clue.getDepartLevel() == 4).toList());
List<ModelClue> modelClues5 = new ArrayList<>(oriModelClues.stream().filter(clue -> clue.getDepartLevel() == 5).toList());
mergeModelClues(modelClues5, modelClues3);
mergeModelClues(modelClues4, modelClues3);
Iterator<ModelClue> iterator = modelClues3.iterator();
while (iterator.hasNext()) {
ModelClue modelClue = iterator.next();
if (modelClue.getBl().compareTo(avgPercentage) > 0) {
iterator.remove();
}
}
for (ModelClue modelClue : modelClues3) {
modelClue.setStatus(0);
modelClue.setThingDesc("在" + getNowTime() + "之前的1个月内," + modelClue.getInvolveDepartName()
+ "的总警情数为" + modelClue.getZjjs()
+ ",执法场所登记数为" + modelClue.getZfcsdjs()
+ ",每100起警情执法场所登记比例为" + modelClue.getBl()
+ ",低于全市平均值(" + avgPercentage
+ "%),疑似漏登执法办案场所。");
}
modelClues.addAll(modelClues3);
return modelClues;
}
*/
private void mergeModelClues(List<ModelClue> modelClues2, List<ModelClue> modelClues1 , int no) {
for (ModelClue modelClue2 : modelClues2) {
Iterator<ModelClue> iterator1 = modelClues1.iterator();
@ -427,7 +503,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
}
}
if (!found) {
SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper<SupExternalDepart>().eq(SupExternalDepart::getInternalId, modelClue2.getParentId()));
SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper<SupExternalDepart>().eq(SupExternalDepart::getInternalId, modelClue2.getParentId()).last("LIMIT 1"));
if (supExternalDepart != null) {
ModelClue newModelClue = new ModelClue();
newModelClue.setData(modelClue2.getData());
@ -486,9 +562,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
List<String> uniqueKeys2 = modelClues2.stream().map(ModelClue::getUniqueKey).filter(k -> k != null && !k.isEmpty()).toList();
if (!uniqueKeys2.isEmpty()) {
String newSql2 = "SELECT a.*, b.ajbh, b.lasj FROM dwd_asj_zhtx_jjd a LEFT JOIN dwd_asj_sjjhygx_jjcjxxb b ON b.BARLXDH = a.bjdh WHERE a.jjdbh IN " + "(" + uniqueKeys2.stream().map(k -> "'" + k + "'").collect(Collectors.joining(",")) + ");";
System.out.println("测试2开始查询数据库 newSql2");
List<Map<String, Object>> allData2 = modelClueDataMapper.selectByUniqueKeys(newSql2);
System.out.println("测试2查询数据库newSql2记录条数:" + allData2.size());
for (ModelClue modelClue : modelClues2) {
for (Map<String, Object> data : allData2) {
String keyColumn = (String) data.get("jjdbh");
@ -513,35 +587,35 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
}
private void genarateModelCluesForModel2(String preSql, String postSql, List<ModelClue> modelClues) {
System.out.println("测试2开始查询数据库 盗");
System.out.println("模型2开始查询数据库 盗");
List<ModelClue> modelClues1 = modelClueDataMapper.selectDataByDynamicSql(preSql + "盗" + postSql);
System.out.println("测试2开始查询数据库 骗");
System.out.println("模型2开始查询数据库 骗");
List<ModelClue> modelClues2 = modelClueDataMapper.selectDataByDynamicSql(preSql + "骗" + postSql);
System.out.println("测试2开始查询数据库 强奸");
System.out.println("模型2开始查询数据库 强奸");
List<ModelClue> modelClues3 = modelClueDataMapper.selectDataByDynamicSql(preSql + "强奸" + postSql);
System.out.println("测试2开始查询数据库 抢");
System.out.println("模型2开始查询数据库 抢");
List<ModelClue> modelClues4 = modelClueDataMapper.selectDataByDynamicSql(preSql + "抢" + postSql);
System.out.println("测试2开始查询数据库 10岁");
System.out.println("模型2开始查询数据库 10岁");
List<ModelClue> modelClues5 = modelClueDataMapper.selectDataByDynamicSql(preSql + "10岁" + postSql);
System.out.println("测试2开始查询数据库 11岁");
System.out.println("模型2开始查询数据库 11岁");
List<ModelClue> modelClues6 = modelClueDataMapper.selectDataByDynamicSql(preSql + "11岁" + postSql);
System.out.println("测试2开始查询数据库 12岁");
System.out.println("模型2开始查询数据库 12岁");
List<ModelClue> modelClues7 = modelClueDataMapper.selectDataByDynamicSql(preSql + "12岁" + postSql);
System.out.println("测试2开始查询数据库 13岁");
System.out.println("模型2开始查询数据库 13岁");
List<ModelClue> modelClues8 = modelClueDataMapper.selectDataByDynamicSql(preSql + "13岁" + postSql);
System.out.println("测试2开始查询数据库 14岁");
System.out.println("模型2开始查询数据库 14岁");
List<ModelClue> modelClues9 = modelClueDataMapper.selectDataByDynamicSql(preSql + "14岁" + postSql);
System.out.println("测试2开始查询数据库 15岁");
System.out.println("模型2开始查询数据库 15岁");
List<ModelClue> modelClues10 = modelClueDataMapper.selectDataByDynamicSql(preSql + "15岁" + postSql);
System.out.println("测试2开始查询数据库 16岁");
System.out.println("模型2开始查询数据库 16岁");
List<ModelClue> modelClues11 = modelClueDataMapper.selectDataByDynamicSql(preSql + "16岁" + postSql);
System.out.println("测试2开始查询数据库 未成年");
System.out.println("模型2开始查询数据库 未成年");
List<ModelClue> modelClues12 = modelClueDataMapper.selectDataByDynamicSql(preSql + "未成年" + postSql);
modelClues.addAll(Stream.of(modelClues1, modelClues2, modelClues3, modelClues4, modelClues5, modelClues6, modelClues7, modelClues8, modelClues9, modelClues10, modelClues11, modelClues12)
.flatMap(List::stream)
.collect(Collectors.toMap(ModelClue::getUniqueKey, data -> data, (existing, replacement) -> existing))
.values());
System.out.println("测试2查询数据库完毕,数量为:" + modelClues.size());
System.out.println("模型2查询数据库完毕,数量为:" + modelClues.size());
}
private static String getDateString(Object param) {
@ -571,7 +645,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
}
}
}
return " ";
return " 无时间数据 ";
}
public static String generateNewSql(String originalSql, List<String> uniqueKeys) {
@ -614,13 +688,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
log.info("日期转换异常", ex);
}
}
return " ";
}
public static String getNowTime() {
LocalDateTime now = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
return now.format(formatter);
return " 无时间数据 ";
}
public static List<String> parseSqlForModel2(String param) {

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

6
src/main/java/com/biutag/supervision/service/SupExternalDepartService.java

@ -88,12 +88,12 @@ public class SupExternalDepartService extends ServiceImpl<SupExternalDepartMappe
List<Map<String, Object>> jjdmaps = modelClueDataMapper.selectByUniqueKeys("SELECT DISTINCT csid, csmc FROM dwd_ry_zfba_zfqywfryb WHERE STR_TO_DATE(djsj, '%Y%m%d%H%i%s') > '2022-10-01';");
if (!jjdmaps.isEmpty()) {
jjdmaps.forEach(item -> {
if (item != null && (String)item.get("csid") != null && !Objects.equals(item.get("csid"), "") && !dms.contains((String)item.get("csid"))) {
if (item != null && item.get("csid") != null && !Objects.equals(item.get("csid"), "") && !dms.contains((String)item.get("csid"))) {
SupExternalDepart supExternalDepart = new SupExternalDepart();
supExternalDepart.setExternalId((String)item.get("csid"));
supExternalDepart.setExternalName(item.get("csmc") == null ? "" : (String)item.get("csmc"));
dms.add((String)item.get("csid"));
supExternalDepart.setSource("情指行");
supExternalDepart.setSource("执法办案");
supExternalDeparts.add(supExternalDepart);
}
});
@ -129,7 +129,7 @@ public class SupExternalDepartService extends ServiceImpl<SupExternalDepartMappe
supExternalDepart.setExternalName(item.getBADWIDmc() == null ? "" : item.getBADWIDmc());
dms.add(item.getBADWIDdm());
}
supExternalDepart.setSource("情指行");
supExternalDepart.setSource("执法办案");
result.add(supExternalDepart);
}
});

29
src/main/resources/mapper/ModelClueTaskMapper.xml

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.biutag.supervision.mapper.ModelClueTaskMapper">
<select id="queryPage" resultType="com.biutag.supervision.pojo.model.ModelClueTaskModel">
SELECT
mt.id,
mt.task_name,
mt.create_time,
m.model_name,
mt.size,
sum( CASE WHEN n.processing_status = 'completed' THEN 1 ELSE 0 END ) completed_size,
sum( CASE WHEN n.checkStatus IN ( '1', '2' ) THEN 1 ELSE 0 END ) verify_size,
count( DISTINCT n.involveDepartId ) depart_size,
count( DISTINCT nb.blameIdCode ) personal_size
FROM
model_clue_task mt
LEFT JOIN model m ON mt.model_id = m.id
LEFT JOIN model_clue mc ON mc.task_id = mt.id
LEFT JOIN negative n ON mc.negative_id = n.id
LEFT JOIN negative_blame nb ON n.id = nb.negativeId
AND type = 'personal'
${ew.getCustomSqlSegment}
</select>
</mapper>

BIN
src/main/resources/static/templates/数字督察警员权限导入模板.xlsx

Binary file not shown.
Loading…
Cancel
Save