diff --git a/src/main/java/com/biutag/supervisiondata/event/ApplicationEvent.java b/src/main/java/com/biutag/supervisiondata/event/ApplicationEvent.java index fa60daa..c3eb68b 100644 --- a/src/main/java/com/biutag/supervisiondata/event/ApplicationEvent.java +++ b/src/main/java/com/biutag/supervisiondata/event/ApplicationEvent.java @@ -113,23 +113,24 @@ 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 // 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))); +// 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.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.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.syncPoliceAttack(initDomain(List.of(64))); +// gBaseJJDService.syncPoliceAttack(initDomain(List.of(64))); // gBaseJJDService.syncHomeViolence(initDomain(List.of(65,66))); // pointService.syncPointType(initDomain(List.of(67))); // gBaseSHRWFRService.hadWork(initDomain(List.of(68))); diff --git a/src/main/java/com/biutag/supervisiondata/mapper/mine/DataCaseVerifMapper.java b/src/main/java/com/biutag/supervisiondata/mapper/mine/DataCaseVerifMapper.java index 35f7852..6459702 100644 --- a/src/main/java/com/biutag/supervisiondata/mapper/mine/DataCaseVerifMapper.java +++ b/src/main/java/com/biutag/supervisiondata/mapper/mine/DataCaseVerifMapper.java @@ -10,9 +10,8 @@ import org.apache.ibatis.annotations.Select; import java.util.List; public interface DataCaseVerifMapper extends BaseMapper { - @Select(" select a.origin_id as id, b.name as name,b.id_code as idCode,b.mobile_number as mobile, a.third_depart_id as departId, a.third_depart_name as departName, a.discovery_time as eventTime, a.thing_desc as content " + - " from data_case_verif as a " + - " INNER join risk_personal as b on a.responder_phone = b.mobile_number and a.responder_name = b.name" + - " where a.discovery_time >= #{time}") + @Select(" select originId as id, responder_phone as mobile, third_depart_id as departId, third_depart_name as departName, discovery_time as eventTime, thing_desc as content " + + " from data_case_verif where responder_phone in (select mobile_number from risk_personal where del = 0) " + + " and discovery_time >= #{time}") List selectRiskPerson(@Param("time")String time); } diff --git a/src/main/java/com/biutag/supervisiondata/mapper/mine/DataPetition12337Mapper.java b/src/main/java/com/biutag/supervisiondata/mapper/mine/DataPetition12337Mapper.java index caa0478..91f954c 100644 --- a/src/main/java/com/biutag/supervisiondata/mapper/mine/DataPetition12337Mapper.java +++ b/src/main/java/com/biutag/supervisiondata/mapper/mine/DataPetition12337Mapper.java @@ -10,10 +10,9 @@ import org.apache.ibatis.annotations.Select; import java.util.List; public interface DataPetition12337Mapper extends BaseMapper { - @Select(" select a.only_id as id, b.name as name,b.id_code as idCode,b.mobile_number as mobile, a.third_depart_id as departId, a.third_depart_name as departName, a.discover_time as eventTime, a.review_des as content " + - " from data_petition_12337 as a " + - " INNER join risk_personal as b on a.id_code = b.id_code " + - " where a.discover_time >= #{time}") + @Select(" select only_id as id, id_code as idCode, third_depart_id as departId, third_depart_name as departName, discover_time as eventTime, review_des as content " + + " from data_petition_12337 where id_code in (select id_code from risk_personal where del = 0 ) " + + " and discover_time >= #{time}") List selectRiskPerson(@Param("time")String time); } diff --git a/src/main/java/com/biutag/supervisiondata/mapper/mine/DataPetitionComplaintMapper.java b/src/main/java/com/biutag/supervisiondata/mapper/mine/DataPetitionComplaintMapper.java index 16d4676..3e047fb 100644 --- a/src/main/java/com/biutag/supervisiondata/mapper/mine/DataPetitionComplaintMapper.java +++ b/src/main/java/com/biutag/supervisiondata/mapper/mine/DataPetitionComplaintMapper.java @@ -9,9 +9,8 @@ import org.apache.ibatis.annotations.Select; import java.util.List; public interface DataPetitionComplaintMapper extends BaseMapper { - @Select(" select a.origin_id as id,b.name as name,b.id_code as idCode,b.mobile_number as mobile, a.third_depart_id as departId, a.third_depart_name as departName, a.discovery_time as eventTime, a.thing_desc as content " + - " from data_petition_complaint as a " + - " INNER join risk_personal as b on a.responder_id_code = b.id_code " + - " where a.discovery_time >= #{time}") + @Select(" select origin_id as id, responder_id_code as idCode, third_depart_id as departId, third_depart_name as departName, discovery_time as eventTime, thing_desc as content " + + " from data_petition_complaint where responder_id_code in (select id_code from risk_personal where del = 0) " + + " and discovery_time >= #{time}") List selectRiskPerson(@Param("time")String time); } 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 d53336d..c716789 100644 --- a/src/main/java/com/biutag/supervisiondata/service/impl/GBaseJJDServiceImpl.java +++ b/src/main/java/com/biutag/supervisiondata/service/impl/GBaseJJDServiceImpl.java @@ -306,10 +306,10 @@ public class GBaseJJDServiceImpl implements GBaseJJDService { CompletableFutureUtil.runSyncObject(() -> { List jjdList = gBaseJJDRepository.getBaseMapper().selectRevenge(startTime, endTime); RiskTask task = taskRepository.create(jjdList.size(), 58); - List list =collectJJD(task, "表达报复社会", jjdList, domain); + List list = collectJJD(task, "表达报复社会", jjdList, domain); if (!list.isEmpty()) { log.info("保存复仇者联盟:{}", list.size()); - clueService.saveClues(list, "表达报复社会"); + clueService.saveClues(list, "B83表达报复社会"); } taskRepository.updateTask(task.getId(), list.size(), 0); }), @@ -319,7 +319,7 @@ public class GBaseJJDServiceImpl implements GBaseJJDService { List list = collectJJD(task, "表达厌世情绪", jjdList, domain); if (!list.isEmpty()) { log.info("厌世强者:{}", list.size()); - clueService.saveClues(list, "表达厌世情绪"); + clueService.saveClues(list, "B80表达厌世情绪"); } taskRepository.updateTask(task.getId(), list.size(), 0); }), @@ -329,7 +329,7 @@ public class GBaseJJDServiceImpl implements GBaseJJDService { List list = collectJJD(task, "表达遭受不公", jjdList, domain); if (!list.isEmpty()) { log.info("我命由我不由天:{}", list.size()); - clueService.saveClues(list, "表达遭受不公"); + clueService.saveClues(list, "B82表达遭受不公"); } taskRepository.updateTask(task.getId(), list.size(), 0); }), @@ -339,7 +339,7 @@ public class GBaseJJDServiceImpl implements GBaseJJDService { List list = collectJJD(task, "尝试自杀", jjdList, domain); if (!list.isEmpty()) { log.info("毁灭吧:{}", list.size()); - clueService.saveClues(list, "尝试自杀"); + clueService.saveClues(list, "B81尝试自杀"); } taskRepository.updateTask(task.getId(), list.size(), 0); }) @@ -414,17 +414,17 @@ public class GBaseJJDServiceImpl implements GBaseJJDService { } jjdList = jjdList.stream().filter(StreamUtil.distinctByKey(GBaseJJD::getJjdbh)).toList(); List olds = personOldMap.get(person.getIdCode()); - if(olds != null) { + if (olds != null) { // 是否类型只有一个 continue; } LocalDateTime eventTime = null; - StringBuilder sb = new StringBuilder("该人员存在"+jjdList.size()+"起平台涉警事件警情,相关警情接警单编号为:"); + StringBuilder sb = new StringBuilder("该人员存在" + jjdList.size() + "起平台涉警事件警情,相关警情接警单编号为:"); for (GBaseJJD gBaseJJD : jjdList) { sb.append(gBaseJJD.getJjdbh()).append(","); try { LocalDateTime tmp = gBaseJJD.getBjsj().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); - if(eventTime == null) { + if (eventTime == null) { eventTime = tmp; continue; } @@ -440,10 +440,10 @@ public class GBaseJJDServiceImpl implements GBaseJJDService { .id("ptsjsj") .idCode(person.getIdCode()) .tags(List.of("平台涉警事件")) - .sourceData(sb.substring(0, sb.length()-1)) + .sourceData(sb.substring(0, sb.length() - 1)) .eventTime(Optional.ofNullable(eventTime).orElse(LocalDateTime.now())) .personId(person.getId()) - .score(Math.min(5,jjdList.size())) + .score(Math.min(5, jjdList.size())) .build(); toInsert.add(DataUtil.createClueData(task, data)); } @@ -563,14 +563,14 @@ public class GBaseJJDServiceImpl implements GBaseJJDService { log.info("被家暴:{} | {}", toInsert.size(), toUpdate.size()); if (!toInsert.isEmpty()) { - clueService.saveClues(toInsert, Default.HOME_VIOLENCE); + clueService.saveClues(toInsert, "B53被他人家暴"); } if (!toUpdate.isEmpty()) { clueService.deleteCluesAndDeleteTag(toUpdate, deleteIdCards, "被家暴"); } log.info("家暴:{} | {}", toInsert2.size(), toUpdate2.size()); if (!toInsert.isEmpty()) { - clueService.saveClues(toInsert2, Default.HOME_VIOLENCE); + clueService.saveClues(toInsert2, "B52对他人家暴"); } if (!toUpdate2.isEmpty()) { clueService.deleteCluesAndDeleteTag(toUpdate2, deleteIdCards, "家暴"); @@ -602,11 +602,11 @@ public class GBaseJJDServiceImpl implements GBaseJJDService { if (!toInsert.isEmpty()) { log.info("父亲矛盾增加 {}", toInsert.size()); - clueService.saveClues(toInsert, "家庭、人际、两性关系"); + clueService.saveClues(toInsert, "B48与父亲关系"); } if (!toInsert2.isEmpty()) { log.info("母亲矛盾增加 {}", toInsert2.size()); - clueService.saveClues(toInsert2, "家庭、人际、两性关系"); + clueService.saveClues(toInsert2, "B49与母亲关系"); } taskRepository.updateTask(task.getId(), toInsert.size(), 0); taskRepository.updateTask(task2.getId(), toInsert2.size(), 0); @@ -693,7 +693,7 @@ public class GBaseJJDServiceImpl implements GBaseJJDService { } log.info("恋爱创伤:{} | {}", toInsert.size(), toUpdate.size()); if (!toInsert.isEmpty()) { - clueService.saveClues(toInsert, "较大影响负性事件"); + clueService.saveClues(toInsert, "B68个人恋爱创伤"); } if (!toUpdate.isEmpty()) { clueService.deleteCluesAndDeleteTag(toUpdate, deleteIdCards, "个人恋爱创伤"); @@ -782,7 +782,7 @@ public class GBaseJJDServiceImpl implements GBaseJJDService { } log.info("与配偶关系不和:{} | {}", toInsert.size(), toUpdate.size()); if (!toInsert.isEmpty()) { - clueService.saveClues(toInsert, Default.HOME_VIOLENCE); + clueService.saveClues(toInsert, "B55与配偶关系"); } if (!toUpdate.isEmpty()) { clueService.deleteCluesAndDeleteTag(toUpdate, deleteIdCards, "与配偶关系不和"); @@ -871,7 +871,7 @@ public class GBaseJJDServiceImpl implements GBaseJJDService { } log.info("邻里和同事:{} | {}", toInsert.size(), toUpdate.size()); if (!toInsert.isEmpty()) { - clueService.saveClues(toInsert, Default.HOME_VIOLENCE); + clueService.saveClues(toInsert, "B55同事与邻居关系"); } if (!toUpdate.isEmpty()) { clueService.deleteCluesAndDeleteTag(toUpdate, deleteIdCards, "与邻居或同事纠纷"); @@ -955,38 +955,41 @@ public class GBaseJJDServiceImpl implements GBaseJJDService { if (jjdList == null) { continue; } - List olds = Optional.ofNullable(personMap.get(person.getIdCode())).orElse(new ArrayList<>()); - Map oldMap = olds.stream().collect(Collectors.toMap(RiskModelTaskClue::getCaseIds, Function.identity(), (val, old) -> val)); + List olds = personMap.get(person.getIdCode()); + if (olds != null) { + continue; + } + StringBuilder sb = new StringBuilder("该人员存在" + jjdList.size() + "起被欺凌警情,接警单编号:"); + LocalDateTime time = null; for (GBaseJJD jjd : jjdList) { - if (oldMap.get(BhUtil.jjdBh(jjd.getJjdbh())) != null) { - continue; - } - ClueData data = ClueData.builder() - .name(person.getName()) - .id(BhUtil.jjdBh(jjd.getJjdbh())) - .idCode(person.getIdCode()) - .tag("存在被欺凌警情") - .personId(person.getId()) - .build(); - StringBuilder sb = new StringBuilder("存在被欺凌警情,接警单编号:" + jjd.getJjdbh()); - if (jjd.getBjnr() != null && !jjd.getBjnr().isEmpty()) { - sb.append(",报警内容;" + jjd.getBjnr()); - } - if (jjd.getCjqk() != null && !jjd.getCjqk().isEmpty()) { - sb.append(",处警情况;" + jjd.getCjqk()); - } - data.setSourceData(sb.toString()); + sb.append(jjd.getJjdbh()).append(","); try { - data.setEventTime(jjd.getBjsj().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()); + LocalDateTime tmp = jjd.getBjsj().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); + if (time == null) { + time = tmp; + continue; + } + if (time.isBefore(tmp)) { + time = tmp; + } } catch (Exception ignored) { - data.setEventTime(LocalDateTime.now()); } - toInsert.add(createClue(task.getModelId(), 5, task.getId(), data)); } + ClueData data = ClueData.builder() + .name(person.getName()) + .id("") + .idCode(person.getIdCode()) + .tags(List.of("被欺凌")) + .score(Math.min(jjdList.size(), 5)) + .sourceData(sb.substring(0, sb.length() - 1)) + .personId(person.getId()) + .eventTime(time) + .build(); + toInsert.add(DataUtil.createClueData(task, data)); } log.info("欺凌:{}", toInsert.size()); if (!toInsert.isEmpty()) { - clueService.saveClues(toInsert, Default.HOME_VIOLENCE); + clueService.saveClues(toInsert, "B73遭遇暴力欺凌"); } taskRepository.updateTask(task.getId(), toInsert.size(), 0); } @@ -1052,7 +1055,7 @@ public class GBaseJJDServiceImpl implements GBaseJJDService { List toInsert = new ArrayList<>(); for (RiskPersonal person : domain.getPersons()) { - if(manMap.get(person.getIdCode()) != null) { + if (manMap.get(person.getIdCode()) != null) { // 非其他纠纷 continue; } @@ -1069,10 +1072,10 @@ public class GBaseJJDServiceImpl implements GBaseJJDService { /** * 遍历接警单 * - * @param task 任务 - * @param tag 标签 - * @param result 接警单数据 - * @param domain domain + * @param task 任务 + * @param tag 标签 + * @param result 接警单数据 + * @param domain domain * @return 要新增的结果 */ List collectJJD(RiskTask task, String tag, List result, TaskParamDomain domain) { @@ -1109,8 +1112,7 @@ public class GBaseJJDServiceImpl implements GBaseJJDService { } List tmp = Arrays.stream(mobile.split(",")).toList(); switch (tmp.size()) { - case 0 -> { - } + case 0 -> {} case 1 -> mobilesMap.computeIfAbsent(tmp.getFirst(), k -> new ArrayList<>()).add(gBaseJJD); default -> { for (int i = 1; i < tmp.size(); i++) { @@ -1201,37 +1203,39 @@ public class GBaseJJDServiceImpl implements GBaseJJDService { for (RiskPersonal person : domain.getPersons()) { List jjdList = Optional.ofNullable(fatherIdCodeMap.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()); + if (olds != null) { continue; } - List olds = Optional.ofNullable(personMap.get(person.getIdCode())).orElse(new ArrayList<>()); - Map oldMap = olds.stream().collect(Collectors.toMap(RiskModelTaskClue::getCaseIds, Function.identity(), (val, old) -> val)); + LocalDateTime time = null; + StringBuilder sb = new StringBuilder("该人员与" + tag + "存在" + jjdList.size() + "起矛盾,接警单编号:"); for (GBaseJJD jjd : jjdList) { - if (oldMap.get(BhUtil.jjdBh(jjd.getJjdbh())) != null) { - continue; - } - ClueData data = ClueData.builder() - .name(person.getName()) - .id(BhUtil.jjdBh(jjd.getJjdbh())) - .idCode(person.getIdCode()) - .tag("与" + tag + "存在矛盾") - .personId(person.getId()) - .build(); - StringBuilder sb = new StringBuilder("该人员与" + tag + "存在矛盾,接警单编号:" + jjd.getJjdbh()); - if (jjd.getBjnr() != null && !jjd.getBjnr().isEmpty()) { - sb.append(",报警内容;" + jjd.getBjnr()); - } - if (jjd.getCjqk() != null && !jjd.getCjqk().isEmpty()) { - sb.append(",处警情况;" + jjd.getCjqk()); - } - data.setSourceData(sb.toString()); + sb.append(jjd.getJjdbh()).append(","); try { - data.setEventTime(jjd.getBjsj().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()); + LocalDateTime tmp = jjd.getBjsj().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); + if (time == null) { + time = tmp; + continue; + } + if (time.isBefore(tmp)) { + time = tmp; + } } catch (Exception ignored) { - data.setEventTime(LocalDateTime.now()); } - toInsert.add(createClue(task.getModelId(), 5, task.getId(), data)); } + toInsert.add(DataUtil.createClueData(task, ClueData.builder() + .name(person.getName()) + .id("") + .idCode(person.getIdCode()) + .tags(List.of("与" + tag + "存在矛盾")) + .eventTime(time) + .score(Math.min(5, jjdList.size())) + .sourceData(sb.substring(0, sb.length() - 1)) + .personId(person.getId()) + .build())); } return toInsert; } @@ -1273,35 +1277,38 @@ public class GBaseJJDServiceImpl implements GBaseJJDService { return new ArrayList<>(); } jjdList = jjdList.stream().filter(StreamUtil.distinctByKey(GBaseJJD::getJjdbh)).toList(); - List olds = Optional.ofNullable(personOldMap.get(personal.getIdCode())).orElse(new ArrayList<>()); - Map oldMap = olds.stream().collect(Collectors.toMap(RiskModelTaskClue::getCaseIds, Function.identity(), (val, old) -> val)); + List olds = personOldMap.get(personal.getIdCode()); + if (olds != null) { + return new ArrayList<>(); + } List toInsert = new ArrayList<>(); + StringBuilder sb = new StringBuilder("该人员存在" + jjdList.size() + "起" + tag + "警情,接警单编号:"); + LocalDateTime time = null; for (GBaseJJD gBaseJJD : jjdList) { - if (oldMap.get(BhUtil.jjdBh(gBaseJJD.getJjdbh())) != null) { - continue; - } - ClueData data = ClueData.builder() - .name(personal.getName()) - .id(BhUtil.jjdBh(gBaseJJD.getJjdbh())) - .idCode(personal.getIdCode()) - .tag(tag) - .personId(personal.getId()) - .build(); - StringBuilder sb = new StringBuilder("该人员存在" + tag + "警情,接警单编号:" + gBaseJJD.getJjdbh()); - if (gBaseJJD.getBjnr() != null && !gBaseJJD.getBjnr().isEmpty()) { - sb.append(",报警内容;" + gBaseJJD.getBjnr()); - } - if (gBaseJJD.getCjqk() != null && !gBaseJJD.getCjqk().isEmpty()) { - sb.append(",处警情况;" + gBaseJJD.getCjqk()); - } - data.setSourceData(sb.toString()); + sb.append(gBaseJJD.getJjdbh()).append(","); try { - data.setEventTime(gBaseJJD.getBjsj().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()); + LocalDateTime tmp = gBaseJJD.getBjsj().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); + if (time == null) { + time = tmp; + continue; + } + if (time.isBefore(tmp)) { + time = tmp; + } } catch (Exception ignored) { - data.setEventTime(LocalDateTime.now()); } - toInsert.add(createClue(task.getModelId(), 5, task.getId(), data)); + } + toInsert.add(DataUtil.createClueData(task, ClueData.builder() + .name(personal.getName()) + .id("") + .idCode(personal.getIdCode()) + .tags(List.of(tag)) + .personId(personal.getId()) + .eventTime(time) + .sourceData(sb.substring(0, sb.length() - 1)) + .score(Math.min(jjdList.size(), 5)) + .build())); return toInsert; } @@ -1408,20 +1415,4 @@ public class GBaseJJDServiceImpl implements GBaseJJDService { } return tmp; } - - RiskModelTaskClue createClue(Integer modelId, Integer score, Integer taskId, ClueData data) { - RiskModelTaskClue clue = new RiskModelTaskClue(); - clue.setModelId(modelId); - clue.setScore(score); - clue.setName(data.getName()); - clue.setIdCode(data.getIdCode()); - clue.setTaskId(taskId); - clue.setData(data.getSourceData()); - clue.setEventTime(data.getEventTime()); - clue.setCreateTime(LocalDateTime.now()); - clue.setUpdateTime(LocalDateTime.now()); - clue.setCaseIds(data.getId()); - clue.setRiskReason(data.getTag()); - return clue; - } } 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 c33cfab..c353903 100644 --- a/src/main/java/com/biutag/supervisiondata/service/impl/GBaseSHRWFRServiceImpl.java +++ b/src/main/java/com/biutag/supervisiondata/service/impl/GBaseSHRWFRServiceImpl.java @@ -2,12 +2,14 @@ package com.biutag.supervisiondata.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.biutag.supervisiondata.common.interfaces.CompletableFutureUtil; +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.domain.TaskParamDomain; import com.biutag.supervisiondata.pojo.domain.WFSHPerson; import com.biutag.supervisiondata.pojo.entity.ads.GBaseSYRKXX; +import com.biutag.supervisiondata.pojo.entity.dwd.GBaseJJD; import com.biutag.supervisiondata.pojo.entity.dwd.GBaseWFRXX; import com.biutag.supervisiondata.pojo.entity.mine.RiskModelTaskClue; import com.biutag.supervisiondata.pojo.entity.mine.RiskPersonal; @@ -24,6 +26,7 @@ import com.biutag.supervisiondata.util.DataUtil; import com.biutag.supervisiondata.util.IdCodeUtil; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.cglib.core.Local; import org.springframework.stereotype.Service; import java.time.LocalDate; @@ -162,38 +165,38 @@ public class GBaseSHRWFRServiceImpl implements GBaseSHRWFRService { } List olds = personOldMap.get(person.getIdCode()); // 是否只有一个 - if(olds!=null) { + if (olds != null) { continue; } StringBuilder zm = new StringBuilder(); StringBuilder aj = new StringBuilder(); LocalDateTime eventTime = null; for (GBaseWFRXX xx : wfxxList) { - if(zm.indexOf(xx.getSxzm()+",") == -1) { + if (zm.indexOf(xx.getSxzm() + ",") == -1) { zm.append(xx.getSxzm()).append(","); } - if(aj.indexOf(xx.getAjbh()+",") == -1) { + if (aj.indexOf(xx.getAjbh() + ",") == -1) { aj.append(xx.getAjbh()).append(","); } try { LocalDateTime tmp = xx.getLrsj().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); - if(eventTime == null) { + if (eventTime == null) { eventTime = tmp; continue; } - if(eventTime.isBefore(tmp)) { + if (eventTime.isBefore(tmp)) { eventTime = tmp; } } catch (Exception ignored) { } } StringBuilder tmp = new StringBuilder("该人员"); - if(zm.length() > 0) { - tmp.append("因:").append(zm.substring(0, zm.length()-1)); + if (zm.length() > 0) { + tmp.append("因:").append(zm.substring(0, zm.length() - 1)); } tmp.append(" 已被打击处理过"); - if(aj.length() > 0) { - tmp.append("具体案件编号:").append(aj.substring(0, aj.length()-1)); + if (aj.length() > 0) { + tmp.append("具体案件编号:").append(aj.substring(0, aj.length() - 1)); } toInsert.add(DataUtil.createClueData(task, ClueData.builder() // 案件编号、接警单编号之类 @@ -238,33 +241,54 @@ public class GBaseSHRWFRServiceImpl implements GBaseSHRWFRService { if (wfxxList == null) { continue; } - List olds = Optional.ofNullable(personOldMap.get(person.getIdCode())).orElse(new ArrayList<>()); - Map oldMap = olds.stream().collect(Collectors.toMap(RiskModelTaskClue::getCaseIds, Function.identity(), (val, old) -> val)); + List olds = personOldMap.get(person.getIdCode()); + if (olds != null) continue; + List zblxList = new ArrayList<>(); + LocalDateTime time = null; + StringBuilder sb = new StringBuilder(); for (GBaseWFRXX xx : wfxxList) { - if (oldMap.get(BhUtil.ajBh(xx.getAjbh())) != null) { - continue; - } WdpcGrjdZblx zblx = map.get(xx.getSxzmdm()); if (zblx == null) { continue; } - ClueData data = ClueData.builder() - .name(person.getName()) - .id(BhUtil.ajBh(xx.getAjbh())) - .idCode(person.getIdCode()) - .tag(zblx.getDmmc()) - .personId(person.getId()) - .sourceData("该人员有犯罪前科,刑事处罚罪名:" + zblx.getDmmc() + ",案件编号:" + xx.getAjbh() ) - .build(); + zblxList.add(zblx); + if (sb.indexOf(xx.getAjbh()) != -1) { + continue; + } + sb.append(xx.getAjbh()).append(","); try { - data.setEventTime(xx.getLrsj().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()); + LocalDateTime tmp = xx.getLrsj().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); + if(time == null) { + time = tmp; + continue; + } + if(time.isBefore(tmp)) { + time = tmp; + } } catch (Exception ignored) { - data.setEventTime(LocalDateTime.now()); } - toInsert.add(createClue(task.getModelId(), zblx.getScore().intValue(), task.getId(), data)); } + zblxList = zblxList.stream().filter(StreamUtil.distinctByKey(WdpcGrjdZblx::getDmmc)).toList(); + List tags = new ArrayList<>(); + int score = 0; + StringBuilder zm = new StringBuilder(); + for (WdpcGrjdZblx wdpcGrjdZblx : zblxList) { + tags.add(wdpcGrjdZblx.getDmmc()); + score += wdpcGrjdZblx.getScore().intValue(); + zm.append(wdpcGrjdZblx.getDmmc()).append(","); + } + ClueData data = ClueData.builder() + .name(person.getName()) + .id("") + .idCode(person.getIdCode()) + .tags(tags) + .score(Math.min(5, score)) + .personId(person.getId()) + .sourceData("发现该人员存在" + zblxList.size() + "起刑事处罚罪名:" + zm.substring(0, zm.length() - 1) + ",案件编号为:" + sb.substring(0, sb.length() - 1)) + .eventTime(time) + .build(); + toInsert.add(DataUtil.createClueData(task, data)); } - if (!toInsert.isEmpty()) { clueService.saveClues(toInsert, "B27刑事处罚罪名"); } @@ -324,9 +348,9 @@ public class GBaseSHRWFRServiceImpl implements GBaseSHRWFRService { .personId(person.getId()) .build(); if (zblx.getScore() < 5.0) { - data.setSourceData("该人员从事" + zblx.getDmmc() ); + data.setSourceData("该人员从事" + zblx.getDmmc()); } else { - data.setSourceData("该人员" + zblx.getDmmc() ); + data.setSourceData("该人员" + zblx.getDmmc()); ClueData data2 = ClueData.builder() .name(person.getName()) .id("zy") @@ -388,24 +412,6 @@ public class GBaseSHRWFRServiceImpl implements GBaseSHRWFRService { taskRepository.updateTask(task2.getId(), toInsert2.size(), 0); } - /** - * 多身份证对比名称 - * - * @param infos 信息 - * @param name 名称 - * @return 正确信息 - */ - GBaseSYRKXX compare(List infos, String name) { - GBaseSYRKXX info = null; - for (GBaseSYRKXX gBaseSYRKXX : infos) { - if (gBaseSYRKXX.getXm().equals(name)) { - info = gBaseSYRKXX; - break; - } - } - return info; - } - RiskPersonal createPerson(WFSHPerson person, GBaseSYRKXX xx, String tag) { RiskPersonal personal = new RiskPersonal(); personal.setIdCode(person.getIdCode()); @@ -430,7 +436,7 @@ public class GBaseSHRWFRServiceImpl implements GBaseSHRWFRService { } List createInsertData(String tag, List list, Map tmpMap, Map idCodeMap, - Map orgCodeMap, Map orgIdMap, Map externalDepart) { + Map orgCodeMap, Map orgIdMap, Map externalDepart) { Map departMap = new WeakHashMap<>(); Map exist = new WeakHashMap<>(); List toInsert = new ArrayList<>(); @@ -450,7 +456,7 @@ public class GBaseSHRWFRServiceImpl implements GBaseSHRWFRService { GBaseSYRKXX xx = idCodeMap.get(person.getIdCode()); personal = createPerson(person, xx, tag); personal.setControlDepartType(DepartType.HUMAN.getType()); - if(xx != null) { + if (xx != null) { departId = xx.getSspcsdm(); } } 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 4b0ab0e..08f3dc0 100644 --- a/src/main/java/com/biutag/supervisiondata/service/impl/PointServiceImpl.java +++ b/src/main/java/com/biutag/supervisiondata/service/impl/PointServiceImpl.java @@ -160,6 +160,7 @@ public class PointServiceImpl implements PointService { Map> personMap = olds.stream().collect(Collectors.groupingBy(RiskModelTaskClue::getIdCode)); List toInsert = new ArrayList<>(); Map> mapPerson = new WeakHashMap<>(); + for (GBaseZDRY ry : list) { RiskPersonal person = personalMap.get(ry.getSfzh()); if (person == null) { @@ -169,12 +170,14 @@ public class PointServiceImpl implements PointService { if (codes.isEmpty()) { continue; } - List oldList = Optional.ofNullable(personMap.get(ry.getSfzh())).orElse(new ArrayList<>()); - Map oldClue = oldList.stream().collect(Collectors.toMap(RiskModelTaskClue::getCaseIds, Function.identity(), (val, old) -> val)); + List oldList = personMap.get(ry.getSfzh()); + if(oldList != null) { + continue; + } codes = codes.stream().distinct().toList(); for (String index : codes) { WdpcGrjdZblx zblx = map.get(index); - if (oldClue.get(index) != null || zblx == null) { + if (zblx == null) { continue; } ClueData data = ClueData.builder() @@ -199,15 +202,16 @@ public class PointServiceImpl implements PointService { int score = 0; List tags = new ArrayList<>(); for (ClueData clue : tmp) { + tags.add(clue.getTag()); + sb.append(clue.getTag()).append(","); + score += clue.getScore(); if (tmpDateTime == null) { tmpDateTime = clue.getEventTime(); + continue; } if (tmpDateTime.isBefore(clue.getEventTime())) { tmpDateTime = clue.getEventTime(); } - tags.add(clue.getTag()); - sb.append(clue.getTag()).append(","); - score += clue.getScore(); } toInsert.add(DataUtil.createClueData(task, ClueData.builder() // 案件编号、接警单编号之类