From 058c79996c59becd19fc9dc9b406e888ad056b95 Mon Sep 17 00:00:00 2001 From: kami <605128600@qq.com> Date: Mon, 16 Dec 2024 16:47:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=BA=E5=91=98=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E5=92=8C=E9=A3=8E=E9=99=A9=E9=A1=B9=E7=9A=84=E5=85=A5?= =?UTF-8?q?=E5=BA=93=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../event/ApplicationEvent.java | 13 +- .../service/impl/GBaseJJDServiceImpl.java | 8 +- .../service/impl/GBaseSHRWFRServiceImpl.java | 120 +++++++++++++----- .../service/impl/PointServiceImpl.java | 31 ++--- 4 files changed, 108 insertions(+), 64 deletions(-) diff --git a/src/main/java/com/biutag/supervisiondata/event/ApplicationEvent.java b/src/main/java/com/biutag/supervisiondata/event/ApplicationEvent.java index c3eb68b..62a33f3 100644 --- a/src/main/java/com/biutag/supervisiondata/event/ApplicationEvent.java +++ b/src/main/java/com/biutag/supervisiondata/event/ApplicationEvent.java @@ -113,20 +113,20 @@ public class ApplicationEvent { // personalService.syncPerson(LocalDate.now()); // 32,33,34,39,41,51,53,43,63 // 36 60 61 62 44 45 48 52 59 64 - // 76 74 73 72 71 70 69 67 66 65 55 56 57 58 + // 76 74 73 72 71 70 69 67 66 65 55 56 57 58 68 // petitionService.petitionModelTask(initDomain(List.of(40))); // riskTaskService.eduAndAreaModelTask(initDomain(List.of(34,41))); // riskTaskService.infoModelTask(initDomain(List.of(32,33))); // marriageService.marriageModelTask(initDomain(List.of(39,51))); -// pointService.syncSecurity(initDomain(List.of(37))); + // habitService.habitModelTask(LocalDateTime.of(2023, 12, 6, 0, 0, 0), initDomain(List.of(36,60,61,62))); // pointService.syncCarUser(initDomain(List.of(53))); // pointService.syncScore(initDomain(List.of(43))); // pointService.syncViolence(initDomain(List.of(44))); // noControlService.syncNoControlData(initDomain(List.of(45))); -// pointService.syncDrug(initDomain(List.of(37))); + // pointService.syncControlNoPower(initDomain(List.of(48))); -// pointService.syncOilBuy(initDomain(List.of(52))); + 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))); // gBaseSHRWFRService.combatCrime(initDomain(List.of(63))); @@ -139,7 +139,7 @@ public class ApplicationEvent { // gBaseJJDService.syncMarryDispute(initDomain(List.of(72))); // gBaseJJDService.syncNeighborAndColleagueDispute(initDomain(List.of(73))); // gBaseJJDService.syncBullying(initDomain(List.of(74))); -// gBaseSHRWFRService.crimeName(initDomain(List.of(76))); + gBaseSHRWFRService.crimeName(initDomain(List.of(76))); // pointService.syncIsPetition(initDomain(List.of(40))); // pointService.syncFatherEducation(initDomain(List.of(112))); // pointService.syncMotherEducation(initDomain(List.of(113))); @@ -169,6 +169,9 @@ public class ApplicationEvent { // riskTaskService.heightFight(initDomain(List.of(42))); // pointService.syncKillSelf(initDomain(List.of(46))); // policeService.contradictModelTask(initDomain(List.of(38))); +//// 整合到68模型 +// pointService.syncSecurity(initDomain(List.of(37))); +// pointService.syncDrug(initDomain(List.of(37))); }); } diff --git a/src/main/java/com/biutag/supervisiondata/service/impl/GBaseJJDServiceImpl.java b/src/main/java/com/biutag/supervisiondata/service/impl/GBaseJJDServiceImpl.java index c716789..dc55e87 100644 --- a/src/main/java/com/biutag/supervisiondata/service/impl/GBaseJJDServiceImpl.java +++ b/src/main/java/com/biutag/supervisiondata/service/impl/GBaseJJDServiceImpl.java @@ -596,6 +596,8 @@ public class GBaseJJDServiceImpl implements GBaseJJDService { // ****母亲矛盾***** Map> motherIdCodeMap = findTargetJJD(mothers); + log.info("父亲条数:{} | 母亲条数:{}", fatherIdCodeMap.size(), motherIdCodeMap.size()); + List toInsert = eachClue2Save(domain, task, fatherIdCodeMap, "父亲"); List toInsert2 = eachClue2Save(domain, task2, motherIdCodeMap, "母亲"); @@ -952,7 +954,7 @@ public class GBaseJJDServiceImpl implements GBaseJJDService { for (RiskPersonal person : domain.getPersons()) { List jjdList = Optional.ofNullable(idCodesMap.get(person.getIdCode())).orElse(new ArrayList<>()); jjdList = jjdList.stream().filter(StreamUtil.distinctByKey(GBaseJJD::getJjdbh)).toList(); - if (jjdList == null) { + if (jjdList == null || jjdList.isEmpty()) { continue; } List olds = personMap.get(person.getIdCode()); @@ -1196,12 +1198,12 @@ public class GBaseJJDServiceImpl implements GBaseJJDService { return fatherIdCodeMap; } - List eachClue2Save(TaskParamDomain domain, RiskTask task, Map> fatherIdCodeMap, String tag) { + List eachClue2Save(TaskParamDomain domain, RiskTask task, Map> idCodeMap, String tag) { List oldList = Optional.ofNullable(domain.getMap().get(task.getModelId())).orElse(new ArrayList<>()); Map> personMap = oldList.stream().collect(Collectors.groupingBy(RiskModelTaskClue::getIdCode)); List toInsert = new ArrayList<>(); for (RiskPersonal person : domain.getPersons()) { - List jjdList = Optional.ofNullable(fatherIdCodeMap.get(person.getIdCode())).orElse(new ArrayList<>()); + List jjdList = Optional.ofNullable(idCodeMap.get(person.getIdCode())).orElse(new ArrayList<>()); jjdList = jjdList.stream().filter(StreamUtil.distinctByKey(GBaseJJD::getJjdbh)).toList(); if (jjdList == null || jjdList.isEmpty()) { continue; diff --git a/src/main/java/com/biutag/supervisiondata/service/impl/GBaseSHRWFRServiceImpl.java b/src/main/java/com/biutag/supervisiondata/service/impl/GBaseSHRWFRServiceImpl.java index c353903..bc79ebf 100644 --- a/src/main/java/com/biutag/supervisiondata/service/impl/GBaseSHRWFRServiceImpl.java +++ b/src/main/java/com/biutag/supervisiondata/service/impl/GBaseSHRWFRServiceImpl.java @@ -6,6 +6,8 @@ import com.biutag.supervisiondata.common.utils.StreamUtil; import com.biutag.supervisiondata.pojo.ClueData; import com.biutag.supervisiondata.pojo.constants.Default; import com.biutag.supervisiondata.pojo.database.PointOrg; +import com.biutag.supervisiondata.pojo.database.SecurityMan; +import com.biutag.supervisiondata.pojo.domain.Drug; import com.biutag.supervisiondata.pojo.domain.TaskParamDomain; import com.biutag.supervisiondata.pojo.domain.WFSHPerson; import com.biutag.supervisiondata.pojo.entity.ads.GBaseSYRKXX; @@ -268,6 +270,9 @@ public class GBaseSHRWFRServiceImpl implements GBaseSHRWFRService { } catch (Exception ignored) { } } + if(zblxList.isEmpty()) { + continue; + } zblxList = zblxList.stream().filter(StreamUtil.distinctByKey(WdpcGrjdZblx::getDmmc)).toList(); List tags = new ArrayList<>(); int score = 0; @@ -323,12 +328,49 @@ public class GBaseSHRWFRServiceImpl implements GBaseSHRWFRService { List toInsert = new ArrayList<>(); // 有无职业 List toInsert2 = new ArrayList<>(); + // 涉药 + Map> drugMap = drug(); + Map> securityMenMap = security(); + // 实有人口要查的 List personalList = new ArrayList<>(); + Map noJob = new WeakHashMap<>(); for (RiskPersonal person : domain.getPersons()) { if (oldMap.get(person.getIdCode()) != null) { continue; } + // 先看是不是涉药或保安 + List drugMan = drugMap.get(person.getIdCode()); + if(drugMan != null) { + ClueData data = ClueData.builder() + .name(person.getName()) + .id("zy") + .idCode(person.getIdCode()) + .score(5) + .sourceData("该人员从事涉药工作") + .tags(List.of("涉药工作")) + .eventTime(LocalDateTime.now()) + .personId(person.getId()) + .build(); + toInsert.add(DataUtil.createClueData(task, data)); + continue; + } + List securityMen = securityMenMap.get(person.getIdCode()); + if(securityMen != null) { + ClueData data = ClueData.builder() + .name(person.getName()) + .id("zy") + .idCode(person.getIdCode()) + .score(5) + .sourceData("该人员从事保安工作") + .tags(List.of("保安工作")) + .eventTime(LocalDateTime.now()) + .personId(person.getId()) + .build(); + toInsert.add(DataUtil.createClueData(task, data)); + continue; + } + String zydm = wfrMap.get(person.getIdCode()); if (zydm == null) { personalList.add(person); @@ -339,32 +381,22 @@ public class GBaseSHRWFRServiceImpl implements GBaseSHRWFRService { personalList.add(person); continue; } - ClueData data = ClueData.builder() - .name(person.getName()) - .id("zy") - .idCode(person.getIdCode()) - .tag(zblx.getDmmc()) - .eventTime(LocalDateTime.now()) - .personId(person.getId()) - .build(); - if (zblx.getScore() < 5.0) { - data.setSourceData("该人员从事" + zblx.getDmmc()); - } else { - data.setSourceData("该人员" + zblx.getDmmc()); - ClueData data2 = ClueData.builder() + if(zblx.getScore() < 5.0) { + ClueData data = ClueData.builder() .name(person.getName()) .id("zy") .idCode(person.getIdCode()) - .tag(zblx.getDmmc()) + .score(zblx.getScore().intValue()) + .sourceData("该人员从事"+zblx.getDmmc()+"工作") + .tags(List.of(zblx.getDmmc())) .eventTime(LocalDateTime.now()) .personId(person.getId()) - .sourceData("该人员无固定职业") .build(); - toInsert2.add(createClue(task2.getModelId(), zblx.getScore().intValue(), task2.getId(), data2)); + toInsert.add(DataUtil.createClueData(task, data)); + } else { + noJob.put(person.getIdCode(), person); } - toInsert.add(createClue(task.getModelId(), zblx.getScore().intValue(), task.getId(), data)); } - List xxList = gBaseSYRKXXRepository.getBaseMapper().selectWork(); Map syMap = xxList.stream().collect(Collectors.toMap(GBaseSYRKXX::getGmsfhm, GBaseSYRKXX::getZydm, (val, old) -> val)); @@ -373,45 +405,63 @@ public class GBaseSHRWFRServiceImpl implements GBaseSHRWFRService { if (zydm == null) continue; WdpcGrjdZblx zblx = wfzyMap.get(zydm); if (zblx == null) continue; - ClueData data = ClueData.builder() - .name(person.getName()) - .id("zy") - .idCode(person.getIdCode()) - .tag(zblx.getDmmc()) - .eventTime(LocalDateTime.now()) - .personId(person.getId()) - .build(); if (zblx.getScore() < 5.0) { - data.setSourceData("该人员从事" + zblx.getDmmc() + "的职业"); - } else { - data.setSourceData("该人员" + zblx.getDmmc()); - ClueData data2 = ClueData.builder() + ClueData data = ClueData.builder() .name(person.getName()) .id("zy") .idCode(person.getIdCode()) - .tag(zblx.getDmmc()) + .score(zblx.getScore().intValue()) + .sourceData("该人员从事"+zblx.getDmmc()+"工作") + .tags(List.of(zblx.getDmmc())) .eventTime(LocalDateTime.now()) .personId(person.getId()) - .sourceData("该人员无固定职业") .build(); - toInsert2.add(createClue(task2.getModelId(), zblx.getScore().intValue(), task2.getId(), data2)); + toInsert.add(DataUtil.createClueData(task, data)); + } else { + noJob.put(person.getIdCode(), person); } - toInsert.add(createClue(task.getModelId(), zblx.getScore().intValue(), task.getId(), data)); } if (!toInsert.isEmpty()) { log.info("保存职业类型: {}", toInsert.size()); clueService.saveClues(toInsert, Default.IMPORT_IG); } + for (Map.Entry entry : noJob.entrySet()) { + ClueData data = ClueData.builder() + .name(entry.getValue().getName()) + .id("zy") + .idCode(entry.getValue().getIdCode()) + .score(5) + .sourceData("该人员无固定职业") + .tags(List.of("无固定职业")) + .eventTime(LocalDateTime.now()) + .personId(entry.getValue().getId()) + .build(); + toInsert2.add(DataUtil.createClueData(task2, data)); + } + if (!toInsert2.isEmpty()) { log.info("保存无职业: {}", toInsert2.size()); clueService.saveClues(toInsert2, Default.IMPORT_IG); } - taskRepository.updateTask(task.getId(), toInsert.size(), 0); taskRepository.updateTask(task2.getId(), toInsert2.size(), 0); } + Map> security() { + List securityList = new ArrayList<>(); + CompletableFuture.allOf( + CompletableFutureUtil.runSyncObject(() -> securityList.addAll(zdryRepository.getBaseMapper().syncSecurityMan1())), + CompletableFutureUtil.runSyncObject(() -> securityList.addAll(zdryRepository.getBaseMapper().syncSecurityMan2())) + ).join(); + return securityList.stream().collect(Collectors.groupingBy(SecurityMan::getIdCode)); + } + + Map> drug() { + List list = zdryRepository.getBaseMapper().selectDrugMan(); + return list.stream().collect(Collectors.groupingBy(Drug::getSfzh)); + } + RiskPersonal createPerson(WFSHPerson person, GBaseSYRKXX xx, String tag) { RiskPersonal personal = new RiskPersonal(); personal.setIdCode(person.getIdCode()); diff --git a/src/main/java/com/biutag/supervisiondata/service/impl/PointServiceImpl.java b/src/main/java/com/biutag/supervisiondata/service/impl/PointServiceImpl.java index 17f3bc3..9544964 100644 --- a/src/main/java/com/biutag/supervisiondata/service/impl/PointServiceImpl.java +++ b/src/main/java/com/biutag/supervisiondata/service/impl/PointServiceImpl.java @@ -1693,13 +1693,7 @@ public class PointServiceImpl implements PointService { if (!toInsert.isEmpty()) { modelTaskClueService.saveClues(toInsert, Default.IMPORT_IG); } - RiskTask updateTask = new RiskTask(); - updateTask.setId(task.getId()); - updateTask.setInsertSize(toInsert.size()); - updateTask.setUpdateSize(0); - updateTask.setState(1); - updateTask.setEndTime(LocalDateTime.now()); - taskRepository.updateById(updateTask); + taskRepository.updateTask(task.getId(), toInsert.size(), 0); } @Override @@ -1862,7 +1856,7 @@ public class PointServiceImpl implements PointService { // 旧数据 List oldList = Optional.ofNullable(domain.getMap().get(task.getModelId())).orElse(new ArrayList<>()); - Map oldMap = oldList.stream().collect(Collectors.toMap(RiskModelTaskClue::getCaseIds, Function.identity(), (val, old) -> val)); + Map oldMap = oldList.stream().collect(Collectors.toMap(RiskModelTaskClue::getIdCode, Function.identity(), (val, old) -> val)); Map> buyMap = buys.stream().collect(Collectors.groupingBy(GBaseOilBuy::getIdCode)); @@ -1881,6 +1875,9 @@ public class PointServiceImpl implements PointService { // 新增记录 List toInsert = new ArrayList<>(); for (RiskPersonal person : domain.getPersons()) { + if (oldMap.get(person.getIdCode()) != null) { + continue; + } List mineBuy = buyMap.get(person.getIdCode()); if (mineBuy == null) { continue; @@ -1888,9 +1885,6 @@ public class PointServiceImpl implements PointService { LocalDateTime time = null; int count = 0; for (GBaseOilBuy item : mineBuy) { - if (oldMap.get(BhUtil.oilBh(item.getXh())) != null) { - continue; - } if (carMt.get(person.getIdCode()) != null) { continue; } @@ -1908,6 +1902,9 @@ public class PointServiceImpl implements PointService { log.error("散装油时间转化异常"); } } + if(count <= 0) { + continue; + } ClueData data = ClueData.builder() .name(person.getName()) .id("") @@ -1936,8 +1933,7 @@ public class PointServiceImpl implements PointService { CompletableFutureUtil.runSyncObject(() -> securityList.addAll(zdryRepository.getBaseMapper().syncSecurityMan2())) ).join(); Map> map = securityList.stream().collect(Collectors.groupingBy(SecurityMan::getIdCode)); - RiskTask task = createTask(map.size(), 37); - taskRepository.save(task); + RiskTask task = taskRepository.create(map.size(), 37); Map oldMap = domain.getOldMap(task.getModelId(), false); List toInsert = new ArrayList<>(); for (RiskPersonal person : domain.getPersons()) { @@ -1985,14 +1981,7 @@ public class PointServiceImpl implements PointService { log.info("新增保安人员:{}", toInsert.size()); modelTaskClueService.saveClues(toInsert, Default.IMPORT_IG); } - - RiskTask updateTask = new RiskTask(); - updateTask.setId(task.getId()); - updateTask.setInsertSize(toInsert.size()); - updateTask.setUpdateSize(0); - updateTask.setState(1); - updateTask.setEndTime(LocalDateTime.now()); - taskRepository.updateById(updateTask); + taskRepository.updateTask(task.getId(), toInsert.size(), 0); } @Override