From 5b348e0fa0e4a37985bae83f2089e5db71a2f6e9 Mon Sep 17 00:00:00 2001 From: kami <605128600@qq.com> Date: Fri, 20 Dec 2024 14:44:09 +0800 Subject: [PATCH] . --- .../event/ApplicationEvent.java | 10 +++--- .../mapper/wdpc2/WdpcGrjdJsbryMapper.java | 3 ++ .../impl/WdpcGrjdJsbryServiceService.java | 35 ++++++------------- 3 files changed, 18 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/biutag/supervisiondata/event/ApplicationEvent.java b/src/main/java/com/biutag/supervisiondata/event/ApplicationEvent.java index 0a95499..2c9685f 100644 --- a/src/main/java/com/biutag/supervisiondata/event/ApplicationEvent.java +++ b/src/main/java/com/biutag/supervisiondata/event/ApplicationEvent.java @@ -104,7 +104,7 @@ public class ApplicationEvent { DepartUtil.init(ryRepository, departRepository); LocalDateTime end = LocalDate.now().minusDays(1).atTime(23, 59, 59); CompletableFutureUtil.runSync(() -> { - personalService.init(List.of(45, 59, 15, 116)); +// personalService.init(List.of(115)); // personalService.pullInvestigate(); // personalService.pullPsychosis(); // gBaseSHRWFRService.pullAndSave(LocalDateTime.of(2019,12,6,0,0,0), end); @@ -124,12 +124,12 @@ public class ApplicationEvent { // pointService.syncCarUser(initDomain(List.of(53))); // pointService.syncScore(initDomain(List.of(43))); // pointService.syncViolence(initDomain(List.of(44))); - noControlService.syncNoControlData(initDomain(List.of(45))); +// noControlService.syncNoControlData(initDomain(List.of(45))); // // pointService.syncControlNoPower(initDomain(List.of(48))); // pointService.syncOilBuy(initDomain(List.of(52))); // gBaseJJDService.pullPoliceInstance(LocalDateTime.of(2023, 12, 6, 0, 0, 0), end, initDomain(List.of(55,56,57,58))); - jsbryService.syncPys(initDomain(List.of(59))); +// jsbryService.syncPys(initDomain(List.of(59))); // gBaseSHRWFRService.combatCrime(initDomain(List.of(63))); // gBaseJJDService.warningInstance(initDomain(List.of(64))); // gBaseJJDService.syncHomeViolence(initDomain(List.of(65,66))); @@ -145,8 +145,8 @@ public class ApplicationEvent { // pointService.syncFatherEducation(initDomain(List.of(112))); // pointService.syncMotherEducation(initDomain(List.of(113))); // pointService.syncDomicileType(initDomain(List.of(114))); - pointService.syncCriminalPunishment(initDomain(List.of(115))); - pointService.syncAdministrativePunishment(initDomain(List.of(116))); +// pointService.syncCriminalPunishment(initDomain(List.of(115))); +// pointService.syncAdministrativePunishment(initDomain(List.of(116))); // pointService.syncParentsDivorce(initDomain(List.of(117))); // gBaseJJDService.syncOtherContradict(initDomain(List.of(75))); // pointService.syncFamilyDie(initDomain(List.of(118))); diff --git a/src/main/java/com/biutag/supervisiondata/mapper/wdpc2/WdpcGrjdJsbryMapper.java b/src/main/java/com/biutag/supervisiondata/mapper/wdpc2/WdpcGrjdJsbryMapper.java index 70c9778..50fa069 100644 --- a/src/main/java/com/biutag/supervisiondata/mapper/wdpc2/WdpcGrjdJsbryMapper.java +++ b/src/main/java/com/biutag/supervisiondata/mapper/wdpc2/WdpcGrjdJsbryMapper.java @@ -15,4 +15,7 @@ public interface WdpcGrjdJsbryMapper extends BaseMapper { @Select("select a.id_code, a.actual_time, a.actual_id from wdpc_grjd_jsbry a inner join negative.risk_personal b on a.id_code = b.id_code;") List selectByIdNos(); + + @Select(" select id_code, max(actual_time) as actual_time,GROUP_CONCAT(DISTINCT actual_id SEPARATOR ',') as actual_id from csga_wdpcdb.wdpc_grjd_jsbry group by id_code ") + List selectJSB(); } diff --git a/src/main/java/com/biutag/supervisiondata/service/impl/WdpcGrjdJsbryServiceService.java b/src/main/java/com/biutag/supervisiondata/service/impl/WdpcGrjdJsbryServiceService.java index c9d0c47..c66e540 100644 --- a/src/main/java/com/biutag/supervisiondata/service/impl/WdpcGrjdJsbryServiceService.java +++ b/src/main/java/com/biutag/supervisiondata/service/impl/WdpcGrjdJsbryServiceService.java @@ -45,9 +45,7 @@ public class WdpcGrjdJsbryServiceService implements WdpcGrjdJsbryService { @Override public void syncPys(TaskParamDomain domain) { - List jsbryList = jsbryRepository.list(new LambdaQueryWrapper() - .select(WdpcGrjdJsbry::getName, WdpcGrjdJsbry::getIdCode, WdpcGrjdJsbry::getActualTime, - WdpcGrjdJsbry::getActualId, WdpcGrjdJsbry::getSuicideNumber, WdpcGrjdJsbry::getHurtSelfNumber,WdpcGrjdJsbry::getIllegalNumber,WdpcGrjdJsbry::getDiseaseDescribe)); + List jsbryList = jsbryRepository.getBaseMapper().selectJSB(); RiskTask task = taskRepository.create(jsbryList.size(), 59); List oldList = Optional.ofNullable(domain.getMap().get(task.getModelId())).orElse(new ArrayList<>()); @@ -57,41 +55,28 @@ public class WdpcGrjdJsbryServiceService implements WdpcGrjdJsbryService { List toInsert = new ArrayList<>(); - Map> map = jsbryList.stream().collect(Collectors.groupingBy(WdpcGrjdJsbry::getIdCode)); - - for (Map.Entry> entry : map.entrySet()) { - RiskPersonal personal = personalMap.get(entry.getKey()); - if(oldClueMap.get(entry.getKey()) != null || personal==null) { + for (WdpcGrjdJsbry entry : jsbryList) { + RiskPersonal personal = personalMap.get(entry.getIdCode()); + if (oldClueMap.get(entry.getIdCode()) != null || personal == null) { continue; } - StringBuilder text = new StringBuilder(); LocalDateTime time = null; - for (WdpcGrjdJsbry wdpcGrjdJsbry : jsbryList) { - if(text.indexOf(wdpcGrjdJsbry.getActualId().concat(",")) != -1) continue; - text.append(wdpcGrjdJsbry.getActualId()).append(","); - try { - if(time == null) { - time = LocalDate.parse(wdpcGrjdJsbry.getActualTime(), DateTimeFormatter.ofPattern("yyyyMMdd")).atTime(0,0,0); - continue; - } - LocalDateTime tmp = LocalDate.parse(wdpcGrjdJsbry.getActualTime(), DateTimeFormatter.ofPattern("yyyyMMdd")).atTime(0,0,0); - if (time.isBefore(tmp)) { - time = tmp; - } - } catch (Exception ignored) {} - } + try { + time = LocalDate.parse(entry.getActualTime(), DateTimeFormatter.ofPattern("yyyyMMdd")).atTime(0, 0, 0); + } catch (Exception e) {} + ClueData data = ClueData.builder() .name(personal.getName()) .id("psychosis") .idCode(personal.getIdCode()) .tags(List.of(Default.PSYCHOSIS_TAG)) .score(5) - .sourceData("该人员是精神障碍患者,诊断为:".concat(text.toString())) + .sourceData("该人员是精神障碍患者,诊断为:".concat(entry.getActualId())) .eventTime(time) .build(); toInsert.add(DataUtil.createClueData(task, data)); } - if(!toInsert.isEmpty()) { + if (!toInsert.isEmpty()) { clueService.saveClues(toInsert, "B31是否有精神疾病"); } taskRepository.updateTask(task.getId(), toInsert.size(), 0);