Browse Source

fiex:优化定时任务

master
pengwei 1 month ago
parent
commit
469cddeb8b
  1. 78
      src/main/java/com/biutag/supervision/job/Job.java

78
src/main/java/com/biutag/supervision/job/Job.java

@ -116,6 +116,8 @@ public class Job {
private final DwdRyZfbaBaryxxService dwdRyZfbaBaryxxService; private final DwdRyZfbaBaryxxService dwdRyZfbaBaryxxService;
private final RpcApplySuperviseService rpcApplySuperviseService; private final RpcApplySuperviseService rpcApplySuperviseService;
private final TXsshrxxbService tXsshrxxbService; private final TXsshrxxbService tXsshrxxbService;
private final RpcPersonService rpcPersonService;
// 每天一次 23:30:00 // 每天一次 23:30:00
//todo 维权信息 //todo 维权信息
@Scheduled(cron = "0 30 23 * * ?") @Scheduled(cron = "0 30 23 * * ?")
@ -128,6 +130,7 @@ public class Job {
Date endTime = sdf.parse("2025-12-30 00:00:00"); Date endTime = sdf.parse("2025-12-30 00:00:00");
List<DwdAsjZfbaShrxx> shrxxList = dwdAsjZfbaShrxxService.list(startTime,endTime); List<DwdAsjZfbaShrxx> shrxxList = dwdAsjZfbaShrxxService.list(startTime,endTime);
if(CollectionUtil.isEmpty(shrxxList)){ if(CollectionUtil.isEmpty(shrxxList)){
log.info("时间范围内无受害人信息"); log.info("时间范围内无受害人信息");
return; return;
@ -142,16 +145,24 @@ public class Job {
return; return;
} }
log.info("受害人信息数量数据:{}条", tXsshrxxbs.size()); log.info("受害人信息数量数据:{}条", tXsshrxxbs.size());
Map<String,DwdAsjZfbaAjjbxx> ajjbxxMap = new HashMap<>();
tXsshrxxbs.forEach(item -> { tXsshrxxbs.forEach(item -> {
RpcApplySupervise rpcApply = new RpcApplySupervise(); RpcApplySupervise rpcApply = new RpcApplySupervise();
RpcApply apply=new RpcApply();
apply.setRpcId(item.getZj());
apply.setNumber(item.getAjbh());
apply.setType("1");
rpcApply.setRpcId(item.getZj()); rpcApply.setRpcId(item.getZj());
rpcApply.setCrtTime(LocalDateTime.now()); rpcApply.setCrtTime(LocalDateTime.now());
rpcApply.setUptTime(LocalDateTime.now()); rpcApply.setUptTime(LocalDateTime.now());
// 姓名 // 姓名
rpcApply.setApplicantEmpName(item.getXm()); rpcApply.setApplicantEmpName(item.getXm());
// 受害日期 // 受害日期
if (Objects.nonNull(item.getShrq())) { if (Objects.nonNull(item.getShrq())) {
rpcApply.setHappenTime(item.getShrq().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()); rpcApply.setHappenTime(item.getShrq().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
apply.setHappenTime(item.getShrq().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
} }
// 案件编号 // 案件编号
rpcApply.setCaseNumber(item.getAjbh()); rpcApply.setCaseNumber(item.getAjbh());
@ -159,11 +170,41 @@ public class Job {
SupPolice police = policeService.getByIdCode(item.getGmsfhm()); SupPolice police = policeService.getByIdCode(item.getGmsfhm());
if (Objects.nonNull(police)) { if (Objects.nonNull(police)) {
// 警号 // 警号
apply.setApplicantEmpName(police.getEmpNo());
rpcApply.setApplicantEmpNo(police.getEmpNo()); rpcApply.setApplicantEmpNo(police.getEmpNo());
RpcPerson person = new RpcPerson();
person.setRpcId(item.getZj());
if(ObjectUtil.isNotEmpty(police)){
person.setJob(police.getJobType());
}
person.setEmpNo(rpcApply.getApplicantEmpNo());
person.setName(police.getName());
if(!police.getOrgId().isEmpty()){
person.setDepartId(police.getOrgId());
SupDepart departs = departService.getOne(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getId,police.getOrgId()));
person.setDepartName(departs.getShortName());
}
rpcPersonService.saveOrUpdate(person);
} }
if (StrUtil.isNotBlank(item.getAjbh())) { if (StrUtil.isNotBlank(item.getAjbh())) {
DwdAsjZfbaAjjbxx ajjbxx = dwdAsjZfbaAjjbxxMapper.selectByAjbh(item.getAjbh()); DwdAsjZfbaAjjbxx ajjbxx = new DwdAsjZfbaAjjbxx();
if(ajjbxxMap != null && ajjbxxMap.containsKey(item.getAjbh())){
ajjbxx = ajjbxxMap.get(item.getAjbh());
}else{
ajjbxx = dwdAsjZfbaAjjbxxMapper.selectByAjbh(item.getAjbh());
ajjbxxMap.put(item.getAjbh(),ajjbxx);
}
//案件信息
apply.setFactReason(ajjbxx.getJyaq());
apply.setIncidentLinkName(ajjbxx.getAjlbmc());
//获取办案人id //获取办案人id
if(StrUtil.isNotEmpty(ajjbxx.getBar1id())){ if(StrUtil.isNotEmpty(ajjbxx.getBar1id())){
DwdRyZfbaBaryxx dwdRyZfbaBaryxx = dwdRyZfbaBaryxxService.selectDataById(ajjbxx.getBar1id()); DwdRyZfbaBaryxx dwdRyZfbaBaryxx = dwdRyZfbaBaryxxService.selectDataById(ajjbxx.getBar1id());
@ -182,17 +223,17 @@ public class Job {
if(StrUtil.isNotBlank(ajjbxx.getAjmc())){ if(StrUtil.isNotBlank(ajjbxx.getAjmc())){
rpcApply.setCaseName(ajjbxx.getAjmc()); rpcApply.setCaseName(ajjbxx.getAjmc());
} }
//获取单位进行处理 //获取办理单位进行处理
if(StrUtil.isNotEmpty(ajjbxx.getBadwidmc())){ if(StrUtil.isNotEmpty(ajjbxx.getBadwidmc())){
String unitName = ajjbxx.getBadwidmc(); String unitName = ajjbxx.getBadwidmc();
log.info("单位名称:",ajjbxx.getBadwidmc()); log.info("单位名称:",ajjbxx.getBadwidmc());
if(!unitName.contains("长沙市公安局")){ if(!unitName.contains("长沙市公安局")){
unitName = ajjbxx.getBadwidmc().split("湖南省")[1]; unitName = unitName.split("湖南省")[1];
} }
SupDepart supDepart=supDepartMapper.selectOne(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getName,unitName)); SupDepart supDepart=supDepartMapper.selectOne(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getName,unitName));
if(ObjectUtil.isNotEmpty(supDepart)){ if(ObjectUtil.isNotEmpty(supDepart)){
rpcApply.setDepartId(supDepart.getId()); rpcApply.setHandleDepartId(supDepart.getId());
rpcApply.setDepartName(supDepart.getShortName()); rpcApply.setHandleDepartName(supDepart.getShortName());
} }
//获取二级单位的信息 //获取二级单位的信息
String statisticsGroupName = null; String statisticsGroupName = null;
@ -232,10 +273,12 @@ public class Job {
if ("刑事".equals(ajjbxx.getAjbzmc())) { if ("刑事".equals(ajjbxx.getAjbzmc())) {
rpcApply.setInfringerHandle("刑事追究"); rpcApply.setInfringerHandle("刑事追究");
rpcApply.setCaseType("1"); rpcApply.setCaseType("1");
apply.setInfringerHandle("刑事追究");
} }
if ("行政".equals(ajjbxx.getAjbzmc())) { if ("行政".equals(ajjbxx.getAjbzmc())) {
rpcApply.setInfringerHandle("行政处罚"); rpcApply.setInfringerHandle("行政处罚");
rpcApply.setCaseType("2"); rpcApply.setCaseType("2");
apply.setInfringerHandle("行政处罚");
} }
rpcApply.setCaseCategory(ajjbxx.getAjlbmc()); rpcApply.setCaseCategory(ajjbxx.getAjlbmc());
} }
@ -248,6 +291,7 @@ public class Job {
rpcApplySuperviseService.saveOrUpdate(rpcApply); rpcApplySuperviseService.saveOrUpdate(rpcApply);
//受害人列表 //受害人列表
RpcApplyPerson rpcApplyPerson= new RpcApplyPerson(); RpcApplyPerson rpcApplyPerson= new RpcApplyPerson();
rpcApplyPerson.setRpcId(item.getZj());
rpcApplyPerson.setType(RpcApplyTypeEnum.RIGHTS_PROTECTION.getValue()); rpcApplyPerson.setType(RpcApplyTypeEnum.RIGHTS_PROTECTION.getValue());
//受伤程度屏蔽 //受伤程度屏蔽
// if(StrUtil.isNotBlank(item.getShcdmc())){ // if(StrUtil.isNotBlank(item.getShcdmc())){
@ -269,16 +313,36 @@ public class Job {
rpcApply.setApplicantEmpNo(police.getEmpNo()); rpcApply.setApplicantEmpNo(police.getEmpNo());
} }
rpcApplyPerson.setRpcId(item.getZj()); rpcApplyPerson.setRpcId(item.getZj());
//警员身份 //警员身份
if(ObjectUtil.isNotEmpty(police)){ if(ObjectUtil.isNotEmpty(police)){
rpcApplyPerson.setEmpType(police.getJobType()); rpcApplyPerson.setEmpType(police.getJobType());
} }
rpcApplyPerson.setEmpNo(rpcApply.getApplicantEmpNo()); rpcApplyPerson.setEmpNo(rpcApply.getApplicantEmpNo());
//存储受害人信息 //存储受害人信息
rpcApplyPersonService.saveOrUpdate(rpcApplyPerson); rpcApplyPersonService.saveOrUpdate(rpcApplyPerson);
//存储犯人信息 //存储犯人信息
List<DwdAsjZfbaWfrwfxx> wfrwfxxes = dwdAsjZfbaWfrwfxxMapper.selectList(new LambdaQueryWrapper<DwdAsjZfbaWfrwfxx>().eq(DwdAsjZfbaWfrwfxx::getAjbh,item.getAjbh())); List<DwdAsjZfbaWfrwfxx> wfrwfxxes = dwdAsjZfbaWfrwfxxMapper.selectList(new LambdaQueryWrapper<DwdAsjZfbaWfrwfxx>().eq(DwdAsjZfbaWfrwfxx::getAjbh,item.getAjbh()));
if (ArrayUtil.isNotEmpty(wfrwfxxes)){ if (ArrayUtil.isNotEmpty(wfrwfxxes)){
String result = wfrwfxxes.stream()
.filter(obj -> obj.getXm() != null && !obj.getXm().isEmpty())
.map(DwdAsjZfbaWfrwfxx::getXm)
.collect(Collectors.joining("、"));
String clfss = wfrwfxxes.stream()
.filter(obj -> obj.getClfs() != null && !obj.getClfs().isEmpty())
.map(DwdAsjZfbaWfrwfxx::getClfs)
.collect(Collectors.joining(";"));
apply.setInfringerName(result);
apply.setInfringerHandle(clfss);
wfrwfxxes.forEach(x->{ wfrwfxxes.forEach(x->{
RpcInfringerResult rpcInfringerResult =new RpcInfringerResult(); RpcInfringerResult rpcInfringerResult =new RpcInfringerResult();
rpcInfringerResult.setId(IdUtil.fastSimpleUUID()); rpcInfringerResult.setId(IdUtil.fastSimpleUUID());
@ -295,9 +359,9 @@ public class Job {
rpcInfringerResultService.saveOrUpdate(rpcInfringerResult); rpcInfringerResultService.saveOrUpdate(rpcInfringerResult);
}); });
} }
rpcApplyService.saveOrUpdate(apply);
}); });
//案件录入
List<String> ajbhList = tXsshrxxbs.stream().map(TXsshrxxb::getAjbh).toList();
log.info("录入完成-------------"); log.info("录入完成-------------");
} }

Loading…
Cancel
Save