|
|
|
|
@ -3,10 +3,12 @@ package com.biutag.supervisiondata.service.impl;
|
|
|
|
|
import com.alibaba.fastjson2.JSON; |
|
|
|
|
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.domain.TaskParamDomain; |
|
|
|
|
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.mine.RiskModelTaskClue; |
|
|
|
|
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, 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)); |
|
|
|
|
List<RiskModelTaskClue> clues; |
|
|
|
|
Map<String, RiskModelTaskClue> clueTmpMap; |
|
|
|
|
// 创建新数据
|
|
|
|
|
List<RiskModelTaskClue> toInsert = new ArrayList<>(); |
|
|
|
|
log.info("开始遍历人员", wfrMap.size()); |
|
|
|
|
for (RiskPersonal person : domain.getPersons()) { |
|
|
|
|
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<>()); |
|
|
|
|
clueTmpMap = clues.stream().collect(Collectors.toMap(RiskModelTaskClue::getCaseIds, Function.identity(), (oldValue, newValue) -> newValue)); |
|
|
|
|
clues = clueMap.get(person.getIdCode()); |
|
|
|
|
if(clues != null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder("结合案件信息和违法人信息相关数据,发现该人员有"+wfTmp.size()+"起"+tag+"相关案件,相关案件编号为:"); |
|
|
|
|
LocalDateTime eventTime = null; |
|
|
|
|
for (GBaseWFRXX gBaseWFRXX : wfTmp) { |
|
|
|
|
GBaseAJJBXX aj = ajMap.get(gBaseWFRXX.getAjbh()); |
|
|
|
|
if (aj == null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
// 通过案件编号获取查看是否有入库记录
|
|
|
|
|
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(); |
|
|
|
|
sb.append(gBaseWFRXX.getAjbh()).append(","); |
|
|
|
|
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) { |
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
|