|
|
|
@ -492,4 +492,239 @@ public class Job { |
|
|
|
log.info("值班数据录入完成"); |
|
|
|
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("部分属实");
|
|
|
|
|
|
|
|
// } else if ("不属实".equals(mail.getVerifyIsTrue())) {
|
|
|
|
|
|
|
|
// cc.setCheckStatus("5");
|
|
|
|
|
|
|
|
// cc.setCheckStatusName("不属实");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
if (StrUtil.equalsAny(mail.getSatisfactionStatus(),"非常满意","基本满意")){ |
|
|
|
|
|
|
|
cc.setPublicRecognition(ComplaintCollectionPublicApprovalEnum.APPROVED.getCode()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ("不满意".equals(mail.getSatisfactionStatus())){ |
|
|
|
|
|
|
|
cc.setPublicRecognition(ComplaintCollectionPublicApprovalEnum.NOT_APPROVED.getCode()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
cc.setCheckStatusDesc(mail.getCompletionComment()); |
|
|
|
|
|
|
|
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()); |
|
|
|
|
|
|
|
complaintCollection.setGwf3(ComplaintCollectionInitialEnum.UN_UPLOADED.getCode()); |
|
|
|
|
|
|
|
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 = null; |
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(item.getDocxFilepath())){ |
|
|
|
|
|
|
|
filepath = "http://65.47.60.145/lan-api/api/file/stream/" + item.getDocxFilepath(); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
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(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|