Browse Source

不良嗜好多合一

master
kami 1 year ago
parent
commit
33a77cf81b
  1. 2
      src/main/java/com/biutag/supervisiondata/service/impl/GBaseJJDServiceImpl.java
  2. 54
      src/main/java/com/biutag/supervisiondata/service/impl/HabitServiceImpl.java

2
src/main/java/com/biutag/supervisiondata/service/impl/GBaseJJDServiceImpl.java

@ -422,7 +422,7 @@ public class GBaseJJDServiceImpl implements GBaseJJDService {
continue; continue;
} }
LocalDateTime eventTime = null; LocalDateTime eventTime = null;
StringBuilder sb = new StringBuilder("该人员存在平台涉警事件警情,相关警情接警单编号为:"); StringBuilder sb = new StringBuilder("该人员存在"+jjdList.size()+"起平台涉警事件警情,相关警情接警单编号为:");
for (GBaseJJD gBaseJJD : jjdList) { for (GBaseJJD gBaseJJD : jjdList) {
sb.append(gBaseJJD.getJjdbh()).append(","); sb.append(gBaseJJD.getJjdbh()).append(",");
try { try {

54
src/main/java/com/biutag/supervisiondata/service/impl/HabitServiceImpl.java

@ -3,10 +3,12 @@ package com.biutag.supervisiondata.service.impl;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.biutag.supervisiondata.common.interfaces.CompletableFutureUtil; 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.ClueData;
import com.biutag.supervisiondata.pojo.constants.Default; import com.biutag.supervisiondata.pojo.constants.Default;
import com.biutag.supervisiondata.pojo.domain.TaskParamDomain; import com.biutag.supervisiondata.pojo.domain.TaskParamDomain;
import com.biutag.supervisiondata.pojo.entity.dwd.GBaseAJJBXX; import com.biutag.supervisiondata.pojo.entity.dwd.GBaseAJJBXX;
import com.biutag.supervisiondata.pojo.entity.dwd.GBaseJJD;
import com.biutag.supervisiondata.pojo.entity.dwd.GBaseWFRXX; import com.biutag.supervisiondata.pojo.entity.dwd.GBaseWFRXX;
import com.biutag.supervisiondata.pojo.entity.mine.RiskModelTaskClue; import com.biutag.supervisiondata.pojo.entity.mine.RiskModelTaskClue;
import com.biutag.supervisiondata.pojo.entity.mine.RiskPersonal; import com.biutag.supervisiondata.pojo.entity.mine.RiskPersonal;
@ -183,44 +185,56 @@ public class HabitServiceImpl implements HabitService {
Map<String, List<GBaseWFRXX>> wfrMap = wfrList.stream().filter(it -> it.getZjhm() != null).collect(Collectors.groupingBy(GBaseWFRXX::getZjhm)); Map<String, List<GBaseWFRXX>> wfrMap = wfrList.stream().filter(it -> it.getZjhm() != null).collect(Collectors.groupingBy(GBaseWFRXX::getZjhm));
// 案件信息 // 案件信息
Map<String, GBaseAJJBXX> ajMap = targetAjList.stream().collect(Collectors.toMap(GBaseAJJBXX::getAjbh, Function.identity(), (oldValue, newValue) -> newValue)); Map<String, GBaseAJJBXX> ajMap = targetAjList.stream().collect(Collectors.toMap(GBaseAJJBXX::getAjbh, Function.identity(), (oldValue, newValue) -> newValue));
List<RiskModelTaskClue> oldList = Optional.ofNullable(domain.getMap().get(36)).orElse(new ArrayList<>()); List<RiskModelTaskClue> oldList = Optional.ofNullable(domain.getMap().get(task.getModelId())).orElse(new ArrayList<>());
// 人员的旧线索 // 人员的旧线索
Map<String, List<RiskModelTaskClue>> clueMap = oldList.stream().collect(Collectors.groupingBy(RiskModelTaskClue::getIdCode)); Map<String, List<RiskModelTaskClue>> clueMap = oldList.stream().collect(Collectors.groupingBy(RiskModelTaskClue::getIdCode));
List<RiskModelTaskClue> clues; List<RiskModelTaskClue> clues;
Map<String, RiskModelTaskClue> clueTmpMap;
// 创建新数据 // 创建新数据
List<RiskModelTaskClue> toInsert = new ArrayList<>(); List<RiskModelTaskClue> toInsert = new ArrayList<>();
log.info("开始遍历人员", wfrMap.size()); log.info("开始遍历人员", wfrMap.size());
for (RiskPersonal person : domain.getPersons()) { for (RiskPersonal person : domain.getPersons()) {
List<GBaseWFRXX> wfTmp = Optional.ofNullable(wfrMap.get(person.getIdCode())).orElse(new ArrayList<>()); List<GBaseWFRXX> wfTmp = Optional.ofNullable(wfrMap.get(person.getIdCode())).orElse(new ArrayList<>());
wfTmp = wfTmp.stream().filter(StreamUtil.distinctByKey(GBaseWFRXX::getAjbh)).toList();
if(wfTmp.isEmpty()){
continue;
}
// 该人员旧的线索 // 该人员旧的线索
clues = Optional.ofNullable(clueMap.get(person.getIdCode())).orElse(new ArrayList<>()); clues = clueMap.get(person.getIdCode());
clueTmpMap = clues.stream().collect(Collectors.toMap(RiskModelTaskClue::getCaseIds, Function.identity(), (oldValue, newValue) -> newValue)); if(clues != null) {
continue;
}
StringBuilder sb = new StringBuilder("结合案件信息和违法人信息相关数据,发现该人员有"+wfTmp.size()+"起"+tag+"相关案件,相关案件编号为:");
LocalDateTime eventTime = null;
for (GBaseWFRXX gBaseWFRXX : wfTmp) { for (GBaseWFRXX gBaseWFRXX : wfTmp) {
GBaseAJJBXX aj = ajMap.get(gBaseWFRXX.getAjbh()); GBaseAJJBXX aj = ajMap.get(gBaseWFRXX.getAjbh());
if (aj == null) { if (aj == null) {
continue; continue;
} }
// 通过案件编号获取查看是否有入库记录 sb.append(gBaseWFRXX.getAjbh()).append(",");
if (clueTmpMap.get(BhUtil.ajBh(aj.getAjbh())) != null) {
continue;
}
// 没有旧记录
ClueData data = ClueData.builder()
.id(aj.getAjbh())
.name(person.getName())
.idCode(person.getIdCode())
.tag(tag)
.personId(person.getId())
.sourceData("结合案件信息和违法人信息相关数据,发现该人员有:"+aj.getAjlbmc()+"类型的案件,案件编号为:"+aj.getAjbh()+",存在"+tag)
.build();
try { try {
data.setEventTime(aj.getBarq().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime()); LocalDateTime tmp = aj.getBarq().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
if(eventTime == null) {
eventTime = tmp;
continue;
}
if(eventTime.isBefore(tmp)) {
eventTime = tmp;
}
} catch (Exception e) { } catch (Exception e) {
log.error("报案日期转LocalDateTime异常");
} }
toInsert.add(createClue(task.getModelId(), 5, task.getId(), data));
} }
ClueData data = ClueData.builder()
.id("habit")
.name(person.getName())
.idCode(person.getIdCode())
.tag(tag)
.personId(person.getId())
.sourceData(sb.substring(0, sb.length()-1))
.eventTime(Optional.ofNullable(eventTime).orElse(LocalDateTime.now()))
.build();
toInsert.add(createClue(task.getModelId(), 5, task.getId(), data));
} }
return toInsert; return toInsert;
} }

Loading…
Cancel
Save