|
|
|
|
@ -2,16 +2,25 @@ package com.biutag.supervision.job;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
|
import cn.hutool.core.util.*; |
|
|
|
|
import com.alibaba.fastjson2.JSON; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
|
import com.biutag.supervision.constants.enums.ComfortStatus; |
|
|
|
|
import com.biutag.supervision.constants.enums.ProcessingStatusEnum; |
|
|
|
|
import com.biutag.supervision.constants.enums.RightsCaseEnum; |
|
|
|
|
import com.biutag.supervision.constants.enums.RpcApplyTypeEnum; |
|
|
|
|
import com.biutag.supervision.constants.enums.*; |
|
|
|
|
import com.biutag.supervision.mapper.*; |
|
|
|
|
import com.biutag.supervision.pojo.dto.complaintCollection.MailBoxCaptureToComplaintCollectionSaveDTO; |
|
|
|
|
import com.biutag.supervision.pojo.dto.mail.MailAttachmentDTO; |
|
|
|
|
import com.biutag.supervision.pojo.entity.*; |
|
|
|
|
import com.biutag.supervision.pojo.entity.mailbox.Mail; |
|
|
|
|
import com.biutag.supervision.pojo.enums.complaintCollection.ComplaintCollectionHandleMethodEnum; |
|
|
|
|
import com.biutag.supervision.pojo.param.ComplaintCollection.ComplaintCollectionQueryParam; |
|
|
|
|
import com.biutag.supervision.pojo.param.SupDepartQueryParam; |
|
|
|
|
import com.biutag.supervision.pojo.param.SupExternalDepartQueryParam; |
|
|
|
|
import com.biutag.supervision.repository.complaintCollection.ComplaintCollectionResourceService; |
|
|
|
|
import com.biutag.supervision.repository.supExternalDepart.SupExternalDepartResourceService; |
|
|
|
|
import com.biutag.supervision.repository.supdepart.SupDepartResourceService; |
|
|
|
|
import com.biutag.supervision.service.*; |
|
|
|
|
import com.biutag.supervision.service.complaintCollection.ComplaintCollectionServiceJob; |
|
|
|
|
import com.biutag.supervision.util.CommonUtil; |
|
|
|
|
import com.biutag.supervision.util.TimeUtil; |
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
@ -23,11 +32,9 @@ import java.text.ParseException;
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.time.LocalDate; |
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
import java.time.Month; |
|
|
|
|
import java.time.ZoneId; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.function.Function; |
|
|
|
|
import java.util.logging.Level; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
import static com.biutag.supervision.util.TimeUtil.SECONDS_OF_A_DAY; |
|
|
|
|
@ -47,6 +54,10 @@ public class Job {
|
|
|
|
|
|
|
|
|
|
private final MailService mailService; |
|
|
|
|
|
|
|
|
|
private final SupExternalDepartResourceService supExternalDepartResourceService; |
|
|
|
|
private final SupDepartResourceService supDepartResourceService; |
|
|
|
|
private final ComplaintCollectionServiceJob complaintCollectionServiceJob; |
|
|
|
|
private final ComplaintCollectionResourceService complaintCollectionResourceService; |
|
|
|
|
// 更新办理超时
|
|
|
|
|
@Scheduled(fixedRate = 600000) |
|
|
|
|
public void updateHandleTimeout() { |
|
|
|
|
@ -58,9 +69,9 @@ public class Job {
|
|
|
|
|
.eq(Negative::getProcessingStatus, ProcessingStatusEnum.completed.name()) |
|
|
|
|
.isNull(Negative::getHandleTimeout)); |
|
|
|
|
list.forEach(item -> { |
|
|
|
|
long remainingDuration = TimeUtil.getRemainingDuration(item.getCrtTime(), item.getCompleteDate(), NumberUtil.mul(item.getMaxHandleDuration(), SECONDS_OF_A_DAY).longValue()) + NumberUtil.mul(item.getMaxExtensionDuration(), SECONDS_OF_A_DAY).longValue(); |
|
|
|
|
long remainingDuration = TimeUtil.getRemainingDuration(item.getCrtTime(), item.getCompleteDate(), NumberUtil.mul(item.getMaxHandleDuration(), SECONDS_OF_A_DAY).longValue()) + NumberUtil.mul(item.getMaxExtensionDuration(), SECONDS_OF_A_DAY).longValue(); |
|
|
|
|
negativeService.update(new LambdaUpdateWrapper<Negative>() |
|
|
|
|
.set(Negative::getHandleTimeout, remainingDuration >= 0 ? 0: -remainingDuration) |
|
|
|
|
.set(Negative::getHandleTimeout, remainingDuration >= 0 ? 0 : -remainingDuration) |
|
|
|
|
.eq(Negative::getId, item.getId())); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
@ -68,7 +79,7 @@ public class Job {
|
|
|
|
|
// 每日04:00更新基础数据
|
|
|
|
|
@Scheduled(cron = "0 0 4 * * ?") |
|
|
|
|
public void updateBaseData() { |
|
|
|
|
// 0秒
|
|
|
|
|
// 0秒
|
|
|
|
|
log.info("获取数据-------updateBaseData-----------"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -143,14 +154,14 @@ public class Job {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取过滤关键字
|
|
|
|
|
List<SupDictData> dictData =dictDataService.list(new LambdaQueryWrapper<SupDictData>().eq(SupDictData::getDictType,"protectRightsFile")); |
|
|
|
|
List<SupDictData> dictData = dictDataService.list(new LambdaQueryWrapper<SupDictData>().eq(SupDictData::getDictType, "protectRightsFile")); |
|
|
|
|
List<String> files = new ArrayList<>(); |
|
|
|
|
if(CollectionUtil.isNotEmpty(dictData)){ |
|
|
|
|
files=dictData.stream().map(s->s.getDictValue()).toList(); |
|
|
|
|
if (CollectionUtil.isNotEmpty(dictData)) { |
|
|
|
|
files = dictData.stream().map(s -> s.getDictValue()).toList(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<DwdAsjZfbaShrxx> shrxxList = dwdAsjZfbaShrxxService.list(startTime,endTime); |
|
|
|
|
if(CollectionUtil.isEmpty(shrxxList)){ |
|
|
|
|
List<DwdAsjZfbaShrxx> shrxxList = dwdAsjZfbaShrxxService.list(startTime, endTime); |
|
|
|
|
if (CollectionUtil.isEmpty(shrxxList)) { |
|
|
|
|
log.info("时间范围内无受害人信息"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
@ -159,26 +170,26 @@ public class Job {
|
|
|
|
|
.filter(StrUtil::isNotBlank) |
|
|
|
|
.distinct().toList(); |
|
|
|
|
List<TXsshrxxb> tXsshrxxbs = tXsshrxxbService.getListAllByZjs(zjList); |
|
|
|
|
if(CollectionUtil.isEmpty(tXsshrxxbs)){ |
|
|
|
|
if (CollectionUtil.isEmpty(tXsshrxxbs)) { |
|
|
|
|
log.info("未找到受伤民辅警"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
//单位数据 map
|
|
|
|
|
List<SupDepart> departs = departService.list(); |
|
|
|
|
//单位简称 map
|
|
|
|
|
Map<String,SupDepart> ShortNameMap = departs.stream().collect(Collectors.toMap( |
|
|
|
|
Map<String, SupDepart> ShortNameMap = departs.stream().collect(Collectors.toMap( |
|
|
|
|
SupDepart::getShortName, // Key提取函数
|
|
|
|
|
Function.identity(), // Value直接使用对象本身
|
|
|
|
|
(existing, replacement) -> existing // 解决键冲突(保留已有值)
|
|
|
|
|
)); |
|
|
|
|
//单位名称 map
|
|
|
|
|
Map<String,SupDepart> NameMap = departs.stream().collect(Collectors.toMap( |
|
|
|
|
Map<String, SupDepart> NameMap = departs.stream().collect(Collectors.toMap( |
|
|
|
|
SupDepart::getName, // Key提取函数
|
|
|
|
|
Function.identity(), // Value直接使用对象本身
|
|
|
|
|
(existing, replacement) -> existing // 解决键冲突(保留已有值)
|
|
|
|
|
)); |
|
|
|
|
//单位id map
|
|
|
|
|
Map<String,SupDepart> departIdMap = departs.stream().collect(Collectors.toMap( |
|
|
|
|
Map<String, SupDepart> departIdMap = departs.stream().collect(Collectors.toMap( |
|
|
|
|
SupDepart::getId, // Key提取函数
|
|
|
|
|
Function.identity(), // Value直接使用对象本身
|
|
|
|
|
(existing, replacement) -> existing // 解决键冲突(保留已有值)
|
|
|
|
|
@ -186,49 +197,49 @@ public class Job {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//受害人信息处理
|
|
|
|
|
tXsshrxxbs= tXsshrxxbs.stream().filter(s->StrUtil.isNotBlank(s.getGmsfhm())).map(s->{ |
|
|
|
|
tXsshrxxbs = tXsshrxxbs.stream().filter(s -> StrUtil.isNotBlank(s.getGmsfhm())).map(s -> { |
|
|
|
|
SupPolice police = policeService.getByIdCode(s.getGmsfhm()); |
|
|
|
|
if(ObjectUtil.isNotEmpty(police)){ |
|
|
|
|
if (ObjectUtil.isNotEmpty(police)) { |
|
|
|
|
s.setEmpNo(police.getEmpNo()); |
|
|
|
|
String departId = police.getOrgId(); |
|
|
|
|
s.setDepartId(departId); |
|
|
|
|
s.setJob(police.getJob()); |
|
|
|
|
if(departIdMap.containsKey(departId)){ |
|
|
|
|
if (departIdMap.containsKey(departId)) { |
|
|
|
|
s.setDepartName(departIdMap.get(departId).getShortName()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return s; |
|
|
|
|
}).toList(); |
|
|
|
|
log.info("受害人信息数量数据:{}条", tXsshrxxbs.size()); |
|
|
|
|
//处理为受害人map
|
|
|
|
|
Map<String,List<TXsshrxxb>> xsshrxxbMap =tXsshrxxbs.stream() |
|
|
|
|
.filter(s->StrUtil.isNotBlank(s.getAjbh())) |
|
|
|
|
//处理为受害人map
|
|
|
|
|
Map<String, List<TXsshrxxb>> xsshrxxbMap = tXsshrxxbs.stream() |
|
|
|
|
.filter(s -> StrUtil.isNotBlank(s.getAjbh())) |
|
|
|
|
.collect(Collectors.groupingBy(TXsshrxxb::getAjbh)); |
|
|
|
|
log.info("处理后受害人数量数据:{}条", xsshrxxbMap.size()); |
|
|
|
|
|
|
|
|
|
List<String> ajbhList =new ArrayList<>(xsshrxxbMap.keySet()); |
|
|
|
|
List<String> ajbhList = new ArrayList<>(xsshrxxbMap.keySet()); |
|
|
|
|
|
|
|
|
|
//办案人员信息List
|
|
|
|
|
Map<String,DwdRyZfbaBaryxx> zfbaBaryxxMap=new HashMap<>(); |
|
|
|
|
Map<String, DwdRyZfbaBaryxx> zfbaBaryxxMap = new HashMap<>(); |
|
|
|
|
//案件 rpc_apply
|
|
|
|
|
for (String ajbh : ajbhList){ |
|
|
|
|
try{ |
|
|
|
|
for (String ajbh : ajbhList) { |
|
|
|
|
try { |
|
|
|
|
//获取案件基本信息
|
|
|
|
|
DwdAsjZfbaAjjbxx ajjbxx = dwdAsjZfbaAjjbxxMapper.selectByAjbh(ajbh); |
|
|
|
|
if(ObjectUtil.isEmpty(ajjbxx)){ |
|
|
|
|
if (ObjectUtil.isEmpty(ajjbxx)) { |
|
|
|
|
log.info("案件[" + ajbh + "]未找到基本信息"); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
List<String> file = files.stream().filter(s->ajjbxx.getAjmc().contains(s)).toList(); |
|
|
|
|
if(CollectionUtil.isNotEmpty(file)){ |
|
|
|
|
log.info("案件["+ajbh+"]已过滤,案件名称为["+ajjbxx.getAjmc()+"]"); |
|
|
|
|
List<String> file = files.stream().filter(s -> ajjbxx.getAjmc().contains(s)).toList(); |
|
|
|
|
if (CollectionUtil.isNotEmpty(file)) { |
|
|
|
|
log.info("案件[" + ajbh + "]已过滤,案件名称为[" + ajjbxx.getAjmc() + "]"); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
String ajmc = ajjbxx.getAjmc(); |
|
|
|
|
String ajlbmc = ajjbxx.getAjlbmc(); |
|
|
|
|
List<String> rightsCaseEnums = Arrays.stream(RightsCaseEnum.values()).map(RightsCaseEnum::getDesc).toList(); |
|
|
|
|
if ( !rightsCaseEnums.contains(ajlbmc) && !ajmc.contains("袭警") ){ |
|
|
|
|
log.info("案件["+ajbh+"]已过滤,案件名称为["+ajjbxx.getAjmc()+"]"); |
|
|
|
|
if (!rightsCaseEnums.contains(ajlbmc) && !ajmc.contains("袭警")) { |
|
|
|
|
log.info("案件[" + ajbh + "]已过滤,案件名称为[" + ajjbxx.getAjmc() + "]"); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
//获取受害人列表
|
|
|
|
|
@ -238,18 +249,18 @@ public class Job {
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
//嫌疑人
|
|
|
|
|
List<DwdAsjZfbaWfrwfxx> wfrwfxxes = dwdAsjZfbaWfrwfxxMapper.selectList(new LambdaQueryWrapper<DwdAsjZfbaWfrwfxx>().eq(DwdAsjZfbaWfrwfxx::getAjbh,ajbh)); |
|
|
|
|
List<DwdAsjZfbaWfrwfxx> wfrwfxxes = dwdAsjZfbaWfrwfxxMapper.selectList(new LambdaQueryWrapper<DwdAsjZfbaWfrwfxx>().eq(DwdAsjZfbaWfrwfxx::getAjbh, ajbh)); |
|
|
|
|
|
|
|
|
|
//办案人
|
|
|
|
|
DwdRyZfbaBaryxx dwdRyZfbaBaryxx =zfbaBaryxxMap.computeIfAbsent( |
|
|
|
|
DwdRyZfbaBaryxx dwdRyZfbaBaryxx = zfbaBaryxxMap.computeIfAbsent( |
|
|
|
|
ajjbxx.getBar1id(), |
|
|
|
|
k-> dwdRyZfbaBaryxxService.selectDataById(k) |
|
|
|
|
k -> dwdRyZfbaBaryxxService.selectDataById(k) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
//受害人警号查询
|
|
|
|
|
TXsshrxxb oneShr = tXsshrxxbList.get(0); |
|
|
|
|
|
|
|
|
|
RpcApply rpcApply =new RpcApply(); |
|
|
|
|
RpcApply rpcApply = new RpcApply(); |
|
|
|
|
//1、案件基本信息
|
|
|
|
|
rpcApply.setNumber(ajbh); |
|
|
|
|
rpcApply.setCaseNumber(ajbh); |
|
|
|
|
@ -281,15 +292,15 @@ public class Job {
|
|
|
|
|
rpcApply.setCaseType("2"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(StrUtil.isNotEmpty(ajjbxx.getBadwidmc())){ |
|
|
|
|
if (StrUtil.isNotEmpty(ajjbxx.getBadwidmc())) { |
|
|
|
|
String unitName = ajjbxx.getBadwidmc(); |
|
|
|
|
log.info("单位名称:",ajjbxx.getBadwidmc()); |
|
|
|
|
if(!unitName.contains("长沙市公安局")){ |
|
|
|
|
log.info("单位名称:", ajjbxx.getBadwidmc()); |
|
|
|
|
if (!unitName.contains("长沙市公安局")) { |
|
|
|
|
unitName = unitName.split("湖南省")[1]; |
|
|
|
|
} |
|
|
|
|
if(NameMap.containsKey(unitName)){ |
|
|
|
|
if (NameMap.containsKey(unitName)) { |
|
|
|
|
//处理单位
|
|
|
|
|
SupDepart supDepart=NameMap.get(unitName); |
|
|
|
|
SupDepart supDepart = NameMap.get(unitName); |
|
|
|
|
rpcApply.setHandleDepartId(supDepart.getId()); |
|
|
|
|
rpcApply.setHandleDepartName(supDepart.getShortName()); |
|
|
|
|
//获取二级单位的信息
|
|
|
|
|
@ -316,13 +327,13 @@ public class Job {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(ShortNameMap.containsKey(statisticsGroupName)){ |
|
|
|
|
SupDepart groupDept= ShortNameMap.get(statisticsGroupName); |
|
|
|
|
if (ShortNameMap.containsKey(statisticsGroupName)) { |
|
|
|
|
SupDepart groupDept = ShortNameMap.get(statisticsGroupName); |
|
|
|
|
rpcApply.setSecondDepartId(groupDept.getId()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
if(StrUtil.isNotBlank(rpcApply.getHandleDepartId())){ |
|
|
|
|
if (StrUtil.isNotBlank(rpcApply.getHandleDepartId())) { |
|
|
|
|
rpcApply.setHandleDepartName(ajjbxx.getBadwidmc()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -332,16 +343,16 @@ public class Job {
|
|
|
|
|
// 已办结
|
|
|
|
|
rpcApply.setRpcStatus(ComfortStatus.completed.name()); |
|
|
|
|
//办案人
|
|
|
|
|
if(ObjectUtil.isNotEmpty(dwdRyZfbaBaryxx) && StrUtil.isNotBlank(dwdRyZfbaBaryxx.getZjhm())){ |
|
|
|
|
if (ObjectUtil.isNotEmpty(dwdRyZfbaBaryxx) && StrUtil.isNotBlank(dwdRyZfbaBaryxx.getZjhm())) { |
|
|
|
|
SupPolice policeData = policeService.getByIdCode(dwdRyZfbaBaryxx.getZjhm()); |
|
|
|
|
if(ObjectUtil.isNotEmpty(policeData)){ |
|
|
|
|
if (ObjectUtil.isNotEmpty(policeData)) { |
|
|
|
|
rpcApply.setInputEmpNo(policeData.getEmpNo()); |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
log.info("未找到身份证号[" + dwdRyZfbaBaryxx.getZjhm() + "]对应的警察信息"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//嫌疑人
|
|
|
|
|
if(ArrayUtil.isNotEmpty(wfrwfxxes)){ |
|
|
|
|
if (ArrayUtil.isNotEmpty(wfrwfxxes)) { |
|
|
|
|
String suspectNames = wfrwfxxes.stream() |
|
|
|
|
.filter(obj -> StrUtil.isNotBlank(obj.getXm())) |
|
|
|
|
.map(DwdAsjZfbaWfrwfxx::getXm) |
|
|
|
|
@ -366,7 +377,7 @@ public class Job {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//去除历史数据后,需调整为rpc_id
|
|
|
|
|
rpcApplyService.remove(new LambdaQueryWrapper<RpcApply>().eq(RpcApply::getNumber,ajbh).eq(RpcApply::getType,"1")); |
|
|
|
|
rpcApplyService.remove(new LambdaQueryWrapper<RpcApply>().eq(RpcApply::getNumber, ajbh).eq(RpcApply::getType, "1")); |
|
|
|
|
rpcApply.setCaseCategory(ajjbxx.getAjlbmc()); |
|
|
|
|
boolean saveSuccess = rpcApplyService.saveOrUpdate(rpcApply); |
|
|
|
|
if (!saveSuccess || ObjectUtils.isEmpty(rpcApply.getRpcId())) { |
|
|
|
|
@ -374,12 +385,12 @@ public class Job {
|
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
//嫌疑人
|
|
|
|
|
if(CollectionUtil.isNotEmpty(wfrwfxxes)){ |
|
|
|
|
if (CollectionUtil.isNotEmpty(wfrwfxxes)) { |
|
|
|
|
for (DwdAsjZfbaWfrwfxx suspect : wfrwfxxes) { |
|
|
|
|
try{ |
|
|
|
|
if(StrUtil.isNotEmpty(suspect.getZjhm())){ |
|
|
|
|
try { |
|
|
|
|
if (StrUtil.isNotEmpty(suspect.getZjhm())) { |
|
|
|
|
//去除历史数据后,需删除
|
|
|
|
|
rpcInfringerResultService.remove(new LambdaQueryWrapper<RpcInfringerResult>().eq(RpcInfringerResult::getIdCode,suspect.getZjhm())); |
|
|
|
|
rpcInfringerResultService.remove(new LambdaQueryWrapper<RpcInfringerResult>().eq(RpcInfringerResult::getIdCode, suspect.getZjhm())); |
|
|
|
|
} |
|
|
|
|
RpcInfringerResult result = new RpcInfringerResult(); |
|
|
|
|
result.setId(IdUtil.fastSimpleUUID()); |
|
|
|
|
@ -392,30 +403,30 @@ public class Job {
|
|
|
|
|
result.setGender(gender); |
|
|
|
|
} |
|
|
|
|
rpcInfringerResultService.saveOrUpdate(result); |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
log.info( "处理嫌疑人[" + suspect.getXm() + "]信息时发生异常:" + e.getMessage()); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.info("处理嫌疑人[" + suspect.getXm() + "]信息时发生异常:" + e.getMessage()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (TXsshrxxb victim : tXsshrxxbList){ |
|
|
|
|
try{ |
|
|
|
|
for (TXsshrxxb victim : tXsshrxxbList) { |
|
|
|
|
try { |
|
|
|
|
RpcApplyPerson person = new RpcApplyPerson(); |
|
|
|
|
person.setRpcId(rpcApply.getRpcId()); |
|
|
|
|
person.setType(RpcApplyTypeEnum.RIGHTS_PROTECTION.getValue()); |
|
|
|
|
person.setEmpNo(victim.getEmpNo()); |
|
|
|
|
person.setEmpName(victim.getXm()); |
|
|
|
|
person.setIdCode(victim.getGmsfhm()); |
|
|
|
|
if(StrUtil.isNotEmpty(victim.getXbmc()) ){ |
|
|
|
|
person.setGender("1".equals(victim.getXbmc())?"男":"女"); |
|
|
|
|
if (StrUtil.isNotEmpty(victim.getXbmc())) { |
|
|
|
|
person.setGender("1".equals(victim.getXbmc()) ? "男" : "女"); |
|
|
|
|
} |
|
|
|
|
rpcApplyPersonService.saveOrUpdate(person); |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.info("处理受害人[" + victim.getXm() + "]信息时发生异常:" + e.getMessage()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
log.info("案件[" + ajbh + "]维权信息处理完成"); |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.info("处理案件[" + ajbh + "]时发生异常:" + e.getMessage()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -423,48 +434,269 @@ public class Job {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final ZhkshDutyScheduleDcMapper zhkshDutyScheduleDcMapper; |
|
|
|
|
private final SupRotaMapper supRotaMapper; |
|
|
|
|
private final SupRotaMapper supRotaMapper; |
|
|
|
|
|
|
|
|
|
//每天一次 00:20:00
|
|
|
|
|
//值班人员
|
|
|
|
|
@Scheduled(cron = "0 20 12 * * ?") |
|
|
|
|
public void operator(){ |
|
|
|
|
public void operator() { |
|
|
|
|
log.info("operator--------------------"); |
|
|
|
|
log.info("值班人员抓取中---------------------"); |
|
|
|
|
//1、值班人员数据获取
|
|
|
|
|
LocalDate startTime = LocalDate.now(); |
|
|
|
|
LocalDate endTime = startTime.plusMonths(1); |
|
|
|
|
List<ZhkshDutyScheduleDc> zhkshDutyScheduleDcs = zhkshDutyScheduleDcMapper.selectList(startTime,endTime); |
|
|
|
|
if(CollectionUtil.isEmpty(zhkshDutyScheduleDcs)){ |
|
|
|
|
List<ZhkshDutyScheduleDc> zhkshDutyScheduleDcs = zhkshDutyScheduleDcMapper.selectList(startTime, endTime); |
|
|
|
|
if (CollectionUtil.isEmpty(zhkshDutyScheduleDcs)) { |
|
|
|
|
log.warn("无值班人员"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
//获取库中已有的值班数据(符合时间条件)
|
|
|
|
|
List<SupRota> rotas= supRotaMapper.selectList(new LambdaQueryWrapper<SupRota>().between(SupRota::getStartTime,startTime,endTime)); |
|
|
|
|
List<SupRota> rotas = supRotaMapper.selectList(new LambdaQueryWrapper<SupRota>().between(SupRota::getStartTime, startTime, endTime)); |
|
|
|
|
//剔除已录入过的数据
|
|
|
|
|
if(CollectionUtil.isNotEmpty(rotas)){ |
|
|
|
|
if (CollectionUtil.isNotEmpty(rotas)) { |
|
|
|
|
List<String> rotaIds = rotas.stream().map(SupRota::getScheduleId).toList(); |
|
|
|
|
zhkshDutyScheduleDcs=zhkshDutyScheduleDcs.stream().filter(x-> !rotaIds.contains(x.getScheduleId())).toList(); |
|
|
|
|
zhkshDutyScheduleDcs = zhkshDutyScheduleDcs.stream().filter(x -> !rotaIds.contains(x.getScheduleId())).toList(); |
|
|
|
|
} |
|
|
|
|
List<SupRota> supRotaList = CommonUtil.copyBeanList(zhkshDutyScheduleDcs,SupRota.class); |
|
|
|
|
List<SupRota> supRotaList = CommonUtil.copyBeanList(zhkshDutyScheduleDcs, SupRota.class); |
|
|
|
|
//2、值班人员数据处理
|
|
|
|
|
supRotaList.forEach(s->{ |
|
|
|
|
//获取数字督察一体系统对应的id
|
|
|
|
|
List<SupExternalDepart> supExternalDeparts= externalDepartService.list( |
|
|
|
|
new LambdaQueryWrapper<SupExternalDepart>() |
|
|
|
|
.eq(SupExternalDepart::getExternalId,s.getDeptCode()) |
|
|
|
|
); |
|
|
|
|
if(CollectionUtil.isEmpty(supExternalDeparts)){ |
|
|
|
|
log.info("值班人员对应的值班单位不存在"); |
|
|
|
|
}else{ |
|
|
|
|
SupExternalDepart depart = supExternalDeparts.get(0); |
|
|
|
|
s.setDeptCode(depart.getInternalId()); |
|
|
|
|
s.setDeptName(depart.getInternalName()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
supRotaList.forEach(s -> { |
|
|
|
|
//获取数字督察一体系统对应的id
|
|
|
|
|
List<SupExternalDepart> supExternalDeparts = externalDepartService.list( |
|
|
|
|
new LambdaQueryWrapper<SupExternalDepart>() |
|
|
|
|
.eq(SupExternalDepart::getExternalId, s.getDeptCode()) |
|
|
|
|
); |
|
|
|
|
if (CollectionUtil.isEmpty(supExternalDeparts)) { |
|
|
|
|
log.info("值班人员对应的值班单位不存在"); |
|
|
|
|
} else { |
|
|
|
|
SupExternalDepart depart = supExternalDeparts.get(0); |
|
|
|
|
s.setDeptCode(depart.getInternalId()); |
|
|
|
|
s.setDeptName(depart.getInternalName()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
//3、值班人员转存
|
|
|
|
|
supRotaMapper.insert(supRotaList); |
|
|
|
|
log.info("值班数据录入完成"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 局长信箱数据抓取到涉访涉诉
|
|
|
|
|
|
|
|
|
|
@Scheduled(cron = "0 0 1 * * ?") |
|
|
|
|
public void mailBoxCaptureToComplaintCollection() { |
|
|
|
|
LocalDateTime start = LocalDate.now().minusDays(1).atStartOfDay(); |
|
|
|
|
LocalDateTime end = LocalDate.now().atStartOfDay(); |
|
|
|
|
mailBoxCaptureToComplaintCollection(start, end); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Scheduled(cron = "0 0 * * * ?") |
|
|
|
|
public void updateMailBoxCaptureToComplaintCollection() { |
|
|
|
|
log.info("【局长信箱回填】开始同步核查信息到ComplaintCollection..."); |
|
|
|
|
ComplaintCollectionQueryParam complaintCollectionQueryParam = new ComplaintCollectionQueryParam(); |
|
|
|
|
complaintCollectionQueryParam.setSourceTable("23"); |
|
|
|
|
complaintCollectionQueryParam.setStatus("0"); |
|
|
|
|
List<ComplaintCollection> collectionList = complaintCollectionResourceService.query(complaintCollectionQueryParam); |
|
|
|
|
if (CollectionUtil.isEmpty(collectionList)) { |
|
|
|
|
log.info("【局长信箱回填】无待同步数据"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
log.info("【局长信箱回填】获取到待处理 ComplaintCollection 条数:{}", CollectionUtil.size(collectionList)); |
|
|
|
|
// 所有局长信箱编号
|
|
|
|
|
Set<String> mailIds = collectionList.stream().map(ComplaintCollection::getOriginId).filter(StrUtil::isNotBlank).collect(Collectors.toSet()); |
|
|
|
|
if (CollectionUtil.isEmpty(mailIds)) { |
|
|
|
|
log.warn("【局长信箱回填】ComplaintCollection 中无有效 originId"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
log.info("【局长信箱回填】提取到 originId 数量:{}", mailIds.size()); |
|
|
|
|
List<Mail> mailList = mailService.list(new LambdaQueryWrapper<Mail>().in(Mail::getId, mailIds)); |
|
|
|
|
if (CollectionUtil.isEmpty(mailList)) { |
|
|
|
|
log.info("【局长信箱回填】Mail 表未查到任何数据"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
log.info("【局长信箱回填】查询到 Mail 记录条数:{}", mailList.size()); |
|
|
|
|
Map<String, Mail> mailMap = mailList.stream().collect(Collectors.toMap(Mail::getId, Function.identity())); |
|
|
|
|
List<ComplaintCollection> toUpdate = new ArrayList<>(); |
|
|
|
|
Map<String, List<MailAttachmentDTO>> verifyAttachMap = new HashMap<>(); |
|
|
|
|
for (ComplaintCollection cc : collectionList) { |
|
|
|
|
Mail mail = mailMap.get(cc.getOriginId()); |
|
|
|
|
if (mail == null) { |
|
|
|
|
log.warn("【局长信箱回填】未找到 Mail,originId={},跳过。", cc.getOriginId()); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if ("属实".equals(mail.getVerifyIsTrue())) { |
|
|
|
|
cc.setCheckStatus("1"); |
|
|
|
|
cc.setCheckStatusName("属实"); |
|
|
|
|
} else if ("基本属实".equals(mail.getVerifyIsTrue())) { |
|
|
|
|
cc.setCheckStatus("2"); |
|
|
|
|
cc.setCheckStatusName("基本属实"); |
|
|
|
|
} |
|
|
|
|
cc.setCheckStatusDesc(mail.getVerifyDetails()); |
|
|
|
|
cc.setProcessingStatus(mail.getMailState()); |
|
|
|
|
toUpdate.add(cc); |
|
|
|
|
// 附件
|
|
|
|
|
List<MailAttachmentDTO> attachList = parseAttachments(mail.getVerifyAttachments()); |
|
|
|
|
if (CollectionUtil.isNotEmpty(attachList)) { |
|
|
|
|
verifyAttachMap.put(cc.getOriginId(), attachList); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (CollectionUtil.isEmpty(toUpdate)) { |
|
|
|
|
log.info("【局长信箱回填】无可更新数据"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
MailBoxCaptureToComplaintCollectionSaveDTO dto = new MailBoxCaptureToComplaintCollectionSaveDTO(); |
|
|
|
|
dto.setComplaintCollectionList(toUpdate); |
|
|
|
|
dto.setVerifyAttachMap(verifyAttachMap); |
|
|
|
|
log.info("【局长信箱回填】准备提交更新,更新条数:{},含附件的 originId 数:{}", toUpdate.size(), verifyAttachMap.size()); |
|
|
|
|
complaintCollectionServiceJob.saveComplaintAndAttachments(dto); |
|
|
|
|
log.info("【局长信箱回填】处理完成。"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void mailBoxCaptureToComplaintCollection(LocalDateTime start, LocalDateTime end) { |
|
|
|
|
log.info("【局长信箱抓取】时间范围 {} ~ {}", start, end); |
|
|
|
|
long startTimeMillis = System.currentTimeMillis(); |
|
|
|
|
log.info("开始抓取局长信箱数据到涉访涉诉--------------------"); |
|
|
|
|
log.info("【局长信箱抓取】查询条件:mailFirstCategory in [举报类, 投诉类], 时间范围 {} ~ {}", start, end); |
|
|
|
|
try { |
|
|
|
|
LambdaQueryWrapper<Mail> mailLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
mailLambdaQueryWrapper.in(Mail::getMailFirstCategory, "举报类", "投诉类"); |
|
|
|
|
mailLambdaQueryWrapper.between(Mail::getMailTime, start, end); |
|
|
|
|
List<Mail> mailList = mailService.list(mailLambdaQueryWrapper); |
|
|
|
|
log.info("【局长信箱抓取】查询到 Mail 数量:{}", mailList.size()); |
|
|
|
|
if (CollectionUtil.isEmpty(mailList)) { |
|
|
|
|
log.warn("【局长信箱抓取】未查询到任何数据,任务结束"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
List<ComplaintCollection> complaintCollectionToSave = new ArrayList<>(); |
|
|
|
|
Map<String, List<MailAttachmentDTO>> complaintAttachMap = new HashMap<>(); |
|
|
|
|
Map<String, List<MailAttachmentDTO>> verifyAttachMap = new HashMap<>(); |
|
|
|
|
int successCount = 0; |
|
|
|
|
int failCount = 0; |
|
|
|
|
for (Mail mail : mailList) { |
|
|
|
|
ComplaintCollection complaintCollection = buildComplaintCollection(mail); |
|
|
|
|
// 投诉单位
|
|
|
|
|
Integer threeDeptId = mail.getThreeDeptId(); |
|
|
|
|
if (threeDeptId == null) { |
|
|
|
|
failCount++; |
|
|
|
|
log.warn("【局长信箱抓取】跳过 mail,threeDeptId 为空,mailId={}, source={}", mail.getId(), mail.getSource()); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
SupExternalDepartQueryParam threeDepQueryParam = new SupExternalDepartQueryParam(); |
|
|
|
|
threeDepQueryParam.setSource("局长信箱"); |
|
|
|
|
threeDepQueryParam.setExternalIds(Collections.singleton(String.valueOf(threeDeptId))); |
|
|
|
|
List<SupExternalDepart> supExternalDeparts = supExternalDepartResourceService.query(threeDepQueryParam); |
|
|
|
|
if (CollectionUtil.isEmpty(supExternalDeparts)) { |
|
|
|
|
failCount++; |
|
|
|
|
log.warn("【局长信箱抓取】跳过 mail,未找到 SupExternalDepart,mailId={}, threeDeptId={}", mail.getId(), threeDeptId); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
SupExternalDepart supExternalDepart = supExternalDeparts.get(0); |
|
|
|
|
SupDepartQueryParam secondDepartQueryParam = new SupDepartQueryParam(); |
|
|
|
|
secondDepartQueryParam.setId(supExternalDepart.getInternalId()); |
|
|
|
|
List<SupDepart> threeDeparts = supDepartResourceService.query(secondDepartQueryParam); |
|
|
|
|
if (CollectionUtil.isEmpty(threeDeparts)) { |
|
|
|
|
failCount++; |
|
|
|
|
log.warn("【局长信箱抓取】跳过 mail,未找到对应三级单位,mailId={}, internalId={}", mail.getId(), supExternalDepart.getInternalId()); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
SupDepart threeDepart = threeDeparts.get(0); |
|
|
|
|
SupDepartQueryParam threeDepartQueryParam = new SupDepartQueryParam(); |
|
|
|
|
threeDepartQueryParam.setId(supExternalDepart.getPid()); |
|
|
|
|
List<SupDepart> secondDeparts = supDepartResourceService.query(threeDepartQueryParam); |
|
|
|
|
if (CollectionUtil.isEmpty(secondDeparts)) { |
|
|
|
|
failCount++; |
|
|
|
|
log.warn("【局长信箱抓取】跳过 mail,未找对应到二级单位,mailId={}, pid={}", mail.getId(), supExternalDepart.getPid()); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
SupDepart secondDepart = secondDeparts.get(0); |
|
|
|
|
complaintCollection.setSecondDepartId(secondDepart.getId()); |
|
|
|
|
complaintCollection.setSecondDepartName(secondDepart.getShortName()); |
|
|
|
|
complaintCollection.setThirdDepartId(threeDepart.getId()); |
|
|
|
|
complaintCollection.setThirdDepartName(threeDepart.getShortName()); |
|
|
|
|
complaintCollection.setThingDesc(mail.getContent()); |
|
|
|
|
complaintAttachMap.put(mail.getId(), parseAttachments(mail.getAttachments())); |
|
|
|
|
verifyAttachMap.put(mail.getId(), parseAttachments(mail.getVerifyAttachments())); |
|
|
|
|
complaintCollectionToSave.add(complaintCollection); |
|
|
|
|
successCount++; |
|
|
|
|
} |
|
|
|
|
if (CollectionUtil.isEmpty(complaintCollectionToSave)) { |
|
|
|
|
log.warn("【局长信箱抓取】所有 Mail 均被跳过,无可保存的主数据"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
MailBoxCaptureToComplaintCollectionSaveDTO mailBoxCaptureToComplaintCollectionSaveDTO = new MailBoxCaptureToComplaintCollectionSaveDTO(); |
|
|
|
|
mailBoxCaptureToComplaintCollectionSaveDTO.setComplaintCollectionList(complaintCollectionToSave); |
|
|
|
|
mailBoxCaptureToComplaintCollectionSaveDTO.setComplaintAttachMap(complaintAttachMap); |
|
|
|
|
mailBoxCaptureToComplaintCollectionSaveDTO.setVerifyAttachMap(verifyAttachMap); |
|
|
|
|
complaintCollectionServiceJob.saveComplaintAndAttachments(mailBoxCaptureToComplaintCollectionSaveDTO); |
|
|
|
|
long cost = System.currentTimeMillis() - startTimeMillis; |
|
|
|
|
log.info("【局长信箱抓取】完成,总数:{},成功:{},失败:{},耗时:{}ms", mailList.size(), successCount, failCount, cost); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("【局长信箱抓取】任务执行过程中发生严重异常,任务中断", e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private String getSfssSourceTableSubOne(String str) { |
|
|
|
|
if ("厅长信箱".equals(str)) { |
|
|
|
|
return "23_tz"; |
|
|
|
|
} |
|
|
|
|
if ("mailbox".equals(str)) { |
|
|
|
|
return "23_jz"; |
|
|
|
|
} |
|
|
|
|
if ("110_report_complaints".equals(str)) { |
|
|
|
|
return "23_jb"; |
|
|
|
|
} |
|
|
|
|
return ""; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ComplaintCollection buildComplaintCollection(Mail mail) { |
|
|
|
|
ComplaintCollection complaintCollection = new ComplaintCollection(); |
|
|
|
|
complaintCollection.setSourceTable("23"); |
|
|
|
|
complaintCollection.setSourceTableSubOne(getSfssSourceTableSubOne(mail.getSource())); |
|
|
|
|
complaintCollection.setOriginId(mail.getId()); |
|
|
|
|
complaintCollection.setDiscoveryTime(mail.getMailTime()); |
|
|
|
|
complaintCollection.setResponderName(mail.getContactName()); |
|
|
|
|
complaintCollection.setResponderPhone(mail.getContactPhone()); |
|
|
|
|
complaintCollection.setResponderIdCode(mail.getContactIdCard()); |
|
|
|
|
complaintCollection.setThingDesc(mail.getContent()); |
|
|
|
|
complaintCollection.setAccountabilityTarget(AccountabilityTargetEnum.PERSONAL.getValue()); |
|
|
|
|
// 核查情况
|
|
|
|
|
if ("属实".equals(mail.getVerifyIsTrue())) { |
|
|
|
|
complaintCollection.setCheckStatus(InspectCaseEnum.TRUE.getValue()); |
|
|
|
|
complaintCollection.setCheckStatusName(InspectCaseEnum.TRUE.getLabel()); |
|
|
|
|
} else if ("基本属实".equals(mail.getVerifyIsTrue())) { |
|
|
|
|
complaintCollection.setCheckStatus(InspectCaseEnum.PARTIALLY_TRUE.getValue()); |
|
|
|
|
complaintCollection.setCheckStatusName(InspectCaseEnum.PARTIALLY_TRUE.getLabel()); |
|
|
|
|
} |
|
|
|
|
complaintCollection.setCheckStatusDesc(mail.getVerifyDetails()); |
|
|
|
|
// 状态字段
|
|
|
|
|
complaintCollection.setProcessingStatus(mail.getMailState()); |
|
|
|
|
complaintCollection.setProblemSources(ProblemSourcesEnum.JZXX.getLabel()); |
|
|
|
|
complaintCollection.setProblemSourcesCode(ProblemSourcesEnum.JZXX.getValue()); |
|
|
|
|
// complaintCollection.setBusinessTypeCode(BusinessTypeEnum.QT.getValue());
|
|
|
|
|
// complaintCollection.setBusinessTypeName(BusinessTypeEnum.QT.getLabel());
|
|
|
|
|
complaintCollection.setHandleMethod(ComplaintCollectionHandleMethodEnum.XF.getCode()); |
|
|
|
|
complaintCollection.setStatus("0"); |
|
|
|
|
complaintCollection.setCreateTime(LocalDateTime.now()); |
|
|
|
|
complaintCollection.setCreateBy("自动抓取"); |
|
|
|
|
return complaintCollection; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<MailAttachmentDTO> parseAttachments(String json) { |
|
|
|
|
if (StrUtil.isBlank(json)) { |
|
|
|
|
return Collections.emptyList(); |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|
List<MailAttachmentDTO> mailAttachmentDTOS = JSON.parseArray(json, MailAttachmentDTO.class); |
|
|
|
|
mailAttachmentDTOS.forEach(item -> { |
|
|
|
|
String filepath = "http://65.47.60.145/lan-api/api/file/stream/" + item.getFilepath(); |
|
|
|
|
item.setFilepath(filepath); |
|
|
|
|
}); |
|
|
|
|
return mailAttachmentDTOS; |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.warn("【局长信箱抓取】附件 JSON 解析失败,json={}", json, e); |
|
|
|
|
return Collections.emptyList(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|