Browse Source

fiex:维权定时任务调整时间阶段

master
pengwei 4 weeks ago
parent
commit
75e80e6a4f
  1. 254
      src/main/java/com/biutag/supervision/job/Job.java

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

@ -128,262 +128,18 @@ public class Job {
// 每天一次 23:30:00
//todo 维权信息
// @Scheduled(cron = "0 30 23 * * ?")
public void testFun() throws ParseException {
public void rights() throws ParseException {
log.info("rights--------------------");
log.info("维权信息抓取中---------------------");
// 维权
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date startTime = sdf.parse("2025-01-01 00:00:00");
Date endTime = sdf.parse("2025-12-30 00:00:00");
List<DwdAsjZfbaShrxx> shrxxList = dwdAsjZfbaShrxxService.list(startTime,endTime);
if(CollectionUtil.isEmpty(shrxxList)){
log.info("时间范围内无受害人信息");
return;
}
log.info("数据:{}条", shrxxList.size());
List<String> zjList = shrxxList.stream().map(s->s.getZj()).toList();
List<TXsshrxxb> tXsshrxxbs = tXsshrxxbService.getListAllByZjs(zjList);
if(CollectionUtil.isEmpty(tXsshrxxbs)){
log.info("未找到受伤民辅警");
return;
}
log.info("受害人信息数量数据:{}条", tXsshrxxbs.size());
Map<String,DwdAsjZfbaAjjbxx> ajjbxxMap = new HashMap<>();
tXsshrxxbs.forEach(item -> {
RpcApplySupervise rpcApply = new RpcApplySupervise();
RpcApply apply=new RpcApply();
apply.setRpcId(item.getZj());
apply.setNumber(item.getAjbh());
apply.setType("1");
rpcApply.setRpcId(item.getZj());
rpcApply.setCrtTime(LocalDateTime.now());
rpcApply.setUptTime(LocalDateTime.now());
// 姓名
rpcApply.setApplicantEmpName(item.getXm());
// 受害日期
if (Objects.nonNull(item.getShrq())) {
rpcApply.setHappenTime(item.getShrq().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
apply.setHappenTime(item.getShrq().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
}
// 案件编号
rpcApply.setCaseNumber(item.getAjbh());
// 受害人警号
SupPolice police = policeService.getByIdCode(item.getGmsfhm());
if (Objects.nonNull(police)) {
// 警号
apply.setApplicantEmpNo(police.getEmpNo());
rpcApply.setApplicantEmpNo(police.getEmpNo());
RpcPerson person = new RpcPerson();
person.setRpcId(item.getZj());
if(ObjectUtil.isNotEmpty(police)){
person.setJob(police.getJobType());
// Date startTime = sdf.parse("2025-01-01 00:00:00");
// Date endTime = sdf.parse("2025-12-30 00:00:00");
}
person.setEmpNo(rpcApply.getApplicantEmpNo());
person.setName(police.getName());
apply.setApplicantEmpName(police.getName());
if(!police.getOrgId().isEmpty()){
person.setDepartId(police.getOrgId());
apply.setDepartId(police.getOrgId());
SupDepart departs = departService.getOne(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getId,police.getOrgId()));
person.setDepartName(departs.getShortName());
apply.setDepartName(departs.getShortName());
}
rpcPersonService.saveOrUpdate(person);
Date startTime = Date.from(LocalDateTime.now().minusDays(1).withHour(0).withMinute(0).withSecond(0).withNano(0).atZone(ZoneId.systemDefault()).toInstant());
Date endTime = Date.from(LocalDateTime.now().minusDays(1).withHour(23).withMinute(59).withSecond(59).atZone(ZoneId.systemDefault()).toInstant());
}
if (StrUtil.isNotBlank(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
if(StrUtil.isNotEmpty(ajjbxx.getBar1id())){
DwdRyZfbaBaryxx dwdRyZfbaBaryxx = dwdRyZfbaBaryxxService.selectDataById(ajjbxx.getBar1id());
if(ObjectUtil.isNotEmpty(dwdRyZfbaBaryxx)){
SupPolice policeData = policeService.getByIdCode(dwdRyZfbaBaryxx.getZjhm());
if(ObjectUtil.isNotEmpty(policeData)){
rpcApply.setInputEmpNo(policeData.getEmpNo());
}else{
log.info("身份证:"+dwdRyZfbaBaryxx.getZjhm()+"未找到");
}
}
log.info("没有相关案件基本信息");
}
if(StrUtil.isNotBlank(ajjbxx.getAjmc())){
rpcApply.setCaseName(ajjbxx.getAjmc());
}
//获取办理单位进行处理
if(StrUtil.isNotEmpty(ajjbxx.getBadwidmc())){
String unitName = ajjbxx.getBadwidmc();
log.info("单位名称:",ajjbxx.getBadwidmc());
if(!unitName.contains("长沙市公安局")){
unitName = unitName.split("湖南省")[1];
}
SupDepart supDepart=supDepartMapper.selectOne(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getName,unitName));
if(ObjectUtil.isNotEmpty(supDepart)){
rpcApply.setHandleDepartId(supDepart.getId());
rpcApply.setHandleDepartName(supDepart.getShortName());
}
//获取二级单位的信息
String statisticsGroupName = null;
final String CHANGSHA_POLICE = "长沙市公安局";
// 判断是否为非长沙市公安局
if (unitName != null && !unitName.contains(CHANGSHA_POLICE)) {
// 非长沙市公安局
String badwidmc = ajjbxx.getBadwidmc();
if (badwidmc != null && !badwidmc.isEmpty()) {
// 优化字符串处理,使用indexOf代替split以提高性能
int juIndex = badwidmc.indexOf('局');
if (juIndex > 0) {
String beforeJu = badwidmc.substring(0, juIndex);
int shengIndex = beforeJu.indexOf('省');
if (shengIndex > 0 && shengIndex < beforeJu.length() - 1) {
String afterSheng = beforeJu.substring(shengIndex + 1);
statisticsGroupName = "湖南省长沙市公安局" + afterSheng + "局";
} else {
log.info("无法分割'省'或'省'后没有有效内容: {}", beforeJu);
}
} else {
log.info("无法在{}中找到'局'字", badwidmc);
}
} else {
log.info("获取到的办案单位名称为空或null");
}
}
SupDepart groupDept= supDepartMapper.selectOne(new LambdaQueryWrapper<SupDepart>().eq(SupDepart::getName,statisticsGroupName));
if(ObjectUtil.isNotEmpty(groupDept)){
rpcApply.setSecondDepartId(groupDept.getId());
}
}
log.info("单位信息处理完毕");
// 案件信息
rpcApply.setFactReason(ajjbxx.getJyaq());
if ("刑事".equals(ajjbxx.getAjbzmc())) {
rpcApply.setInfringerHandle("刑事追究");
rpcApply.setCaseType("1");
apply.setInfringerHandle("刑事追究");
}
if ("行政".equals(ajjbxx.getAjbzmc())) {
rpcApply.setInfringerHandle("行政处罚");
rpcApply.setCaseType("2");
apply.setInfringerHandle("行政处罚");
}
rpcApply.setCaseCategory(ajjbxx.getAjlbmc());
}
// 申请类型
rpcApply.setType(RpcApplyTypeEnum.RIGHTS_PROTECTION.getValue());
// 已办结
rpcApply.setRpcStatus(ComfortStatus.completed.name());
// 数据来源
rpcApply.setSource("gbase");
rpcApplySuperviseService.saveOrUpdate(rpcApply);
//受害人列表
rpcApplyPersonService.remove(new LambdaQueryWrapper<RpcApplyPerson>().eq(RpcApplyPerson::getRpcId,item.getZj()));
RpcApplyPerson rpcApplyPerson= new RpcApplyPerson();
rpcApplyPerson.setRpcId(item.getZj());
rpcApplyPerson.setType(RpcApplyTypeEnum.RIGHTS_PROTECTION.getValue());
//受伤程度屏蔽
// if(StrUtil.isNotBlank(item.getShcdmc())){
// rpcApplyPerson.setInjurySeverity(item.getShcdmc());
// }
rpcApplyPerson.setCreatTime(LocalDateTime.now());
rpcApplyPerson.setUdpTime(LocalDateTime.now());
rpcApplyPerson.setId(IdUtil.fastSimpleUUID());
//身份证
rpcApplyPerson.setIdCode(item.getGmsfhm());
//受到侵权形式
// rpcApplyPerson.setFormsOfTort(item.getShxsmc());
rpcApplyPerson.setEmpName(item.getXm());
if(StrUtil.isNotEmpty(item.getXbmc())){
rpcApplyPerson.setGender("1".equals(item.getXbmc())?"男":"女");
}
if(Objects.nonNull(police)){
rpcApply.setApplicantEmpNo(police.getEmpNo());
}
rpcApplyPerson.setRpcId(item.getZj());
//警员身份
if(ObjectUtil.isNotEmpty(police)){
rpcApplyPerson.setEmpType(police.getJobType());
}
rpcApplyPerson.setEmpNo(rpcApply.getApplicantEmpNo());
//存储受害人信息
rpcApplyPersonService.saveOrUpdate(rpcApplyPerson);
//存储犯人信息
List<DwdAsjZfbaWfrwfxx> wfrwfxxes = dwdAsjZfbaWfrwfxxMapper.selectList(new LambdaQueryWrapper<DwdAsjZfbaWfrwfxx>().eq(DwdAsjZfbaWfrwfxx::getAjbh,item.getAjbh()));
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->{
rpcInfringerResultService.remove(new LambdaQueryWrapper<RpcInfringerResult>().eq(RpcInfringerResult::getRpcId,item.getZj()));
RpcInfringerResult rpcInfringerResult =new RpcInfringerResult();
rpcInfringerResult.setId(IdUtil.fastSimpleUUID());
rpcInfringerResult.setRpcId(item.getZj());
rpcInfringerResult.setTortName(x.getXm());
rpcInfringerResult.setDefendHandleWayName(x.getClfs());
//身份证
rpcInfringerResult.setIdCode(x.getZjhm());
//性别
if(StrUtil.isNotEmpty(x.getXbmc())){
rpcInfringerResult.setGender( x.getXbmc().split("性")[0]);
}
//保存犯人信息
rpcInfringerResultService.saveOrUpdate(rpcInfringerResult);
});
}
rpcApplyService.saveOrUpdate(apply);
});
log.info("录入完成-------------");
}
//todo 维权信息
public void rights() throws ParseException {
log.info("rights--------------------");
log.info("维权信息抓取中---------------------");
// 维权
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date startTime = sdf.parse("2025-01-01 00:00:00");
Date endTime = sdf.parse("2025-12-30 00:00:00");
List<DwdAsjZfbaShrxx> shrxxList = dwdAsjZfbaShrxxService.list(startTime,endTime);
if(CollectionUtil.isEmpty(shrxxList)){
log.info("时间范围内无受害人信息");

Loading…
Cancel
Save