|
|
|
|
@ -281,51 +281,68 @@ public class PetitionServiceImpl implements PetitionService {
|
|
|
|
|
CompletableFuture.allOf( |
|
|
|
|
// CompletableFutureUtil.runSyncObject(() -> dataList1.addAll(dataCaseVerifRepository.getBaseMapper().selectRiskPerson(time.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))),
|
|
|
|
|
CompletableFutureUtil.runSyncObject(() -> dataList2.addAll(complaintRepository.getBaseMapper().selectRiskPerson(time.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))), |
|
|
|
|
CompletableFutureUtil.runSyncObject(() -> dataList3.addAll(petition12337Repository.getBaseMapper().selectRiskPerson(time.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))) |
|
|
|
|
CompletableFutureUtil.runSyncObject(() -> dataList2.addAll(petition12337Repository.getBaseMapper().selectRiskPerson(time.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))) |
|
|
|
|
).join(); |
|
|
|
|
|
|
|
|
|
Map<String, RiskPersonal> idCodeMan = domain.getPersons().stream().collect(Collectors.toMap(RiskPersonal::getIdCode, Function.identity(), (oldValue, newValue) -> newValue)); |
|
|
|
|
|
|
|
|
|
List<RiskModelTaskClue> oldList = Optional.ofNullable(domain.getMap().get(task.getModelId())).orElse(new ArrayList<>()); |
|
|
|
|
Map<String, RiskModelTaskClue> oldMap = oldList.stream().collect(Collectors.toMap(RiskModelTaskClue::getCaseIds, Function.identity(), (val, old) -> val)); |
|
|
|
|
Map<String, RiskModelTaskClue> oldMap = domain.getOldMap(task.getModelId(), true); |
|
|
|
|
|
|
|
|
|
// List<RiskModelTaskClue> toInsert1 = new ArrayList<>(createClues(dataList1, oldMap, idCodeMan, task, Default.PETITION_CASE_TAG));
|
|
|
|
|
List<RiskModelTaskClue> toInsert2 = new ArrayList<>(createClues(dataList2, oldMap, idCodeMan, task, "存在上访")); |
|
|
|
|
List<RiskModelTaskClue> toInsert3 = new ArrayList<>(createClues(dataList3, oldMap, idCodeMan, task, "存在上访")); |
|
|
|
|
toInsert2.addAll(toInsert3); |
|
|
|
|
|
|
|
|
|
Map<String, List<RiskModelTaskClue>> map = toInsert2.stream().collect(Collectors.groupingBy(RiskModelTaskClue::getIdCode)); |
|
|
|
|
List<RiskModelTaskClue> toInsert = new ArrayList<>(); |
|
|
|
|
for (Map.Entry<String, List<RiskModelTaskClue>> entry : map.entrySet()) { |
|
|
|
|
toInsert.add(entry.getValue().getFirst()); |
|
|
|
|
} |
|
|
|
|
if (!toInsert.isEmpty()) { |
|
|
|
|
riskModelTaskClueService.saveClues(toInsert, "B20是否上访"); |
|
|
|
|
} |
|
|
|
|
riskTaskRepository.updateTask(task.getId(), toInsert.size(), 0); |
|
|
|
|
} |
|
|
|
|
List<RiskModelTaskClue> toDelete = new ArrayList<>(); |
|
|
|
|
List<RiskModelTaskClue> toUpdate = new ArrayList<>(); |
|
|
|
|
List<String> toDeleteIds = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
List<RiskModelTaskClue> createClues(List<PetitionData> dataList, Map<String, RiskModelTaskClue> oldMap, Map<String, RiskPersonal> idCodeMan, RiskTask task, String tag) { |
|
|
|
|
List<RiskModelTaskClue> toInsert = new ArrayList<>(); |
|
|
|
|
for (PetitionData data : dataList) { |
|
|
|
|
if (oldMap.get(BhUtil.petBh(data.getId())) != null) { |
|
|
|
|
continue; |
|
|
|
|
Map<String, List<PetitionData>> map = dataList2.stream().collect(Collectors.groupingBy(PetitionData::getIdCode)); |
|
|
|
|
|
|
|
|
|
for (Map.Entry<String, List<PetitionData>> entry : map.entrySet()) { |
|
|
|
|
RiskPersonal person = idCodeMan.get(entry.getKey()); |
|
|
|
|
if (person == null) continue; |
|
|
|
|
|
|
|
|
|
LocalDateTime maxTime = entry.getValue().stream() |
|
|
|
|
.filter(it -> it.getEventTime() != null) |
|
|
|
|
.max(Comparator.comparing(PetitionData::getEventTime)).get().getEventTime(); |
|
|
|
|
RiskModelTaskClue old = oldMap.get(entry.getKey()); |
|
|
|
|
if (old != null) { |
|
|
|
|
oldMap.remove(entry.getKey()); |
|
|
|
|
if (maxTime.isAfter(old.getEventTime())) { |
|
|
|
|
RiskModelTaskClue update = new RiskModelTaskClue(); |
|
|
|
|
update.setId(old.getId()); |
|
|
|
|
update.setEventTime(maxTime); |
|
|
|
|
toUpdate.add(update); |
|
|
|
|
} |
|
|
|
|
RiskPersonal person = idCodeMan.get(data.getIdCode()); |
|
|
|
|
if (person == null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
toInsert.add(DataUtil.createClueData(task, ClueData.builder() |
|
|
|
|
.score(5) |
|
|
|
|
.personId(person.getId()) |
|
|
|
|
.tags(List.of(tag)) |
|
|
|
|
.tags(List.of("存在上访")) |
|
|
|
|
.sourceData("该人员存在上访行为") |
|
|
|
|
.name(person.getName()) |
|
|
|
|
.idCode(person.getIdCode()) |
|
|
|
|
.eventTime(null) |
|
|
|
|
.eventTime(maxTime) |
|
|
|
|
.build())); |
|
|
|
|
} |
|
|
|
|
return toInsert; |
|
|
|
|
for (Map.Entry<String, RiskModelTaskClue> entry : oldMap.entrySet()) { |
|
|
|
|
RiskModelTaskClue delete = new RiskModelTaskClue(); |
|
|
|
|
delete.setId(entry.getValue().getId()); |
|
|
|
|
delete.setDel(1); |
|
|
|
|
toDelete.add(delete); |
|
|
|
|
toDeleteIds.add(entry.getKey()); |
|
|
|
|
} |
|
|
|
|
if (!toInsert.isEmpty()) { |
|
|
|
|
log.info("新增是否上访{}条", toInsert.size()); |
|
|
|
|
riskModelTaskClueService.saveClues(toInsert, "B20是否上访"); |
|
|
|
|
} |
|
|
|
|
if (!toUpdate.isEmpty()) { |
|
|
|
|
log.info("修改是否上访{}条", toUpdate.size()); |
|
|
|
|
riskModelTaskClueService.updateClues(toUpdate, task.getModelId()); |
|
|
|
|
} |
|
|
|
|
if (!toDelete.isEmpty()) { |
|
|
|
|
log.info("删除是否上访{}条", toDelete.size()); |
|
|
|
|
riskModelTaskClueService.deleteCluesAndDeleteTag(toDelete, toDeleteIds, task.getModelId()); |
|
|
|
|
} |
|
|
|
|
riskTaskRepository.updateTask(task.getId(), toInsert.size(), toDelete.size()+toUpdate.size()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
GBaseSYRKXX compare(List<GBaseSYRKXX> infos, String name) { |
|
|
|
|
@ -349,13 +366,9 @@ public class PetitionServiceImpl implements PetitionService {
|
|
|
|
|
} |
|
|
|
|
personal.setAge(age); |
|
|
|
|
if (personal.getGender() == null) { |
|
|
|
|
try { |
|
|
|
|
int gender = personal.getIdCode().length() == 18 ? Integer.valueOf(personal.getIdCode().substring(16, 17)) : Integer.valueOf(personal.getIdCode().substring(14, 15)); |
|
|
|
|
// 结果0男1女 余数偶女奇男
|
|
|
|
|
personal.setGender(gender % 2 == 0 ? "2" : "1"); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
String gender = IdCodeUtil.idCard2Gender(personal.getIdCode()); |
|
|
|
|
if (gender == null) return null; |
|
|
|
|
personal.setGender(gender); |
|
|
|
|
} |
|
|
|
|
return personal; |
|
|
|
|
} |
|
|
|
|
|