|
|
|
|
@ -2,14 +2,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.config.cache.RedisDao; |
|
|
|
|
import com.biutag.supervisiondata.mapper.dwd.ModelClueDataMapper; |
|
|
|
|
import com.biutag.supervisiondata.pojo.ClueData; |
|
|
|
|
import com.biutag.supervisiondata.pojo.constants.Default; |
|
|
|
|
import com.biutag.supervisiondata.pojo.database.MuchCall; |
|
|
|
|
import com.biutag.supervisiondata.pojo.database.SecurityMan; |
|
|
|
|
import com.biutag.supervisiondata.pojo.domain.*; |
|
|
|
|
import com.biutag.supervisiondata.pojo.entity.dwd.*; |
|
|
|
|
import com.biutag.supervisiondata.pojo.entity.mine.*; |
|
|
|
|
@ -33,7 +31,6 @@ import java.time.LocalDateTime;
|
|
|
|
|
import java.time.ZoneId; |
|
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.concurrent.CompletableFuture; |
|
|
|
|
import java.util.function.Function; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
import java.util.stream.IntStream; |
|
|
|
|
@ -121,12 +118,10 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
RiskModelTaskClue update = new RiskModelTaskClue(); |
|
|
|
|
update.setId(old.getId()); |
|
|
|
|
update.setData(desc); |
|
|
|
|
update.setEventTime(LocalDateTime.now()); |
|
|
|
|
toUpdate.add(update); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
toInsert.add(DataUtil.createClueData(task, ClueData.builder() |
|
|
|
|
.id("") |
|
|
|
|
.score(5) |
|
|
|
|
.personId(personals.getFirst().getId()) |
|
|
|
|
.tags(List.of("重点人员")) |
|
|
|
|
@ -167,35 +162,20 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
Map<String, WdpcGrjdZblx> map = lxList.stream().collect(Collectors.toMap(WdpcGrjdZblx::getDmbh, Function.identity(), (val, old) -> val)); |
|
|
|
|
|
|
|
|
|
List<GBaseZDRY> list = zdryRepository.getBaseMapper().syncPointPeople(); |
|
|
|
|
log.info("重点人员查询人数: {}", list.size()); |
|
|
|
|
RiskTask task = taskRepository.create(list.size(), 67); |
|
|
|
|
|
|
|
|
|
Map<String, RiskPersonal> personalMap = domain.getPersons().stream().collect(Collectors.toMap(RiskPersonal::getIdCode, Function.identity(), (val, old) -> val)); |
|
|
|
|
Map<String, RiskModelTaskClue> oldMap = domain.getOldMap(task.getModelId(), true); |
|
|
|
|
|
|
|
|
|
List<RiskModelTaskClue> olds = Optional.ofNullable(domain.getMap().get(task.getModelId())).orElse(new ArrayList<>()); |
|
|
|
|
Map<String, List<RiskModelTaskClue>> personMap = olds.stream().collect(Collectors.groupingBy(RiskModelTaskClue::getIdCode)); |
|
|
|
|
List<RiskModelTaskClue> toInsert = new ArrayList<>(); |
|
|
|
|
Map<String, List<ClueData>> mapPerson = new WeakHashMap<>(); |
|
|
|
|
|
|
|
|
|
for (GBaseZDRY ry : list) { |
|
|
|
|
RiskPersonal person = personalMap.get(ry.getSfzh()); |
|
|
|
|
if (person == null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (person == null) continue; |
|
|
|
|
List<String> codes = PatternUtil.takeMarkPositionToString(ry.getZdrylbbj()); |
|
|
|
|
if (codes.isEmpty()) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
List<RiskModelTaskClue> oldList = personMap.get(ry.getSfzh()); |
|
|
|
|
if (oldList != null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
codes = codes.stream().distinct().toList(); |
|
|
|
|
if (codes.isEmpty()) continue; |
|
|
|
|
for (String index : codes) { |
|
|
|
|
WdpcGrjdZblx zblx = map.get(index); |
|
|
|
|
if (zblx == null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (zblx == null) continue; |
|
|
|
|
ClueData data = ClueData.builder() |
|
|
|
|
.id(index) |
|
|
|
|
.personId(person.getId()) |
|
|
|
|
@ -206,17 +186,20 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
.build(); |
|
|
|
|
try { |
|
|
|
|
data.setEventTime(LocalDateTime.parse(ry.getJlbgsj(), DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); |
|
|
|
|
} catch (Exception ignored) { |
|
|
|
|
} |
|
|
|
|
} catch (Exception ignored) {} |
|
|
|
|
mapPerson.computeIfAbsent(person.getIdCode(), k -> new ArrayList<>()).add(data); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<RiskModelTaskClue> toInsert = new ArrayList<>(); |
|
|
|
|
List<RiskModelTaskClue> toUpdate = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
for (Map.Entry<String, List<ClueData>> entry : mapPerson.entrySet()) { |
|
|
|
|
LocalDateTime tmpDateTime = null; |
|
|
|
|
List<ClueData> tmp = entry.getValue().stream().filter(StreamUtil.distinctByKey(ClueData::getTag)).toList(); |
|
|
|
|
List<ClueData> tmp = entry.getValue().stream().filter(StreamUtil.distinctByKey(ClueData::getTag)).sorted().toList(); |
|
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
|
int score = 0; |
|
|
|
|
List<String> tags = new ArrayList<>(); |
|
|
|
|
LocalDateTime tmpDateTime = null; |
|
|
|
|
for (ClueData clue : tmp) { |
|
|
|
|
tags.add(clue.getTag()); |
|
|
|
|
sb.append(clue.getTag()).append(","); |
|
|
|
|
@ -229,15 +212,28 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
tmpDateTime = clue.getEventTime(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
RiskModelTaskClue old = oldMap.get(entry.getKey()); |
|
|
|
|
if(old != null && old.getData().contentEquals(sb)) { |
|
|
|
|
oldMap.remove(entry.getKey()); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if(old!= null) { |
|
|
|
|
oldMap.remove(entry.getKey()); |
|
|
|
|
RiskModelTaskClue update = new RiskModelTaskClue(); |
|
|
|
|
update.setId(old.getId()); |
|
|
|
|
update.setData(sb.substring(0, sb.length() - 1)); |
|
|
|
|
update.setScore(Math.min(5, score)); |
|
|
|
|
toUpdate.add(update); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
RiskPersonal person = personalMap.get(entry.getKey()); |
|
|
|
|
toInsert.add(DataUtil.createClueData(task, ClueData.builder() |
|
|
|
|
// 案件编号、接警单编号之类
|
|
|
|
|
.id("") |
|
|
|
|
.score(Math.min(5, score)) |
|
|
|
|
.personId(tmp.getFirst().getPersonId()) |
|
|
|
|
.personId(person.getId()) |
|
|
|
|
.tags(tags) |
|
|
|
|
.sourceData(sb.substring(0, sb.length() - 1)) |
|
|
|
|
.name(tmp.getFirst().getName()) |
|
|
|
|
.idCode(tmp.getFirst().getIdCode()) |
|
|
|
|
.name(person.getName()) |
|
|
|
|
.idCode(person.getIdCode()) |
|
|
|
|
.eventTime(tmpDateTime) |
|
|
|
|
.build())); |
|
|
|
|
} |
|
|
|
|
@ -245,7 +241,26 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
log.info("保存重点人员标签 {}", toInsert.size()); |
|
|
|
|
modelTaskClueService.saveClues(toInsert, "B12列管原因"); |
|
|
|
|
} |
|
|
|
|
taskRepository.updateTask(task.getId(), toInsert.size(), 0); |
|
|
|
|
if (!toUpdate.isEmpty()) { |
|
|
|
|
log.info("修改重点人员标签 {}", toUpdate.size()); |
|
|
|
|
modelTaskClueService.updateClues(toUpdate, task.getModelId()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<RiskModelTaskClue> toDelete = new ArrayList<>(); |
|
|
|
|
List<String> deleteIdCodes = new ArrayList<>(); |
|
|
|
|
for (Map.Entry<String, RiskModelTaskClue> entry : oldMap.entrySet()) { |
|
|
|
|
RiskModelTaskClue delete = new RiskModelTaskClue(); |
|
|
|
|
delete.setId(entry.getValue().getId()); |
|
|
|
|
delete.setDel(1); |
|
|
|
|
deleteIdCodes.add(entry.getValue().getIdCode()); |
|
|
|
|
toDelete.add(delete); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!toDelete.isEmpty()) { |
|
|
|
|
log.info("删除重点人员标签 {}", toDelete.size()); |
|
|
|
|
modelTaskClueService.deleteCluesAndDeleteTag(toDelete, deleteIdCodes, task.getModelId()); |
|
|
|
|
} |
|
|
|
|
taskRepository.updateTask(task.getId(), toInsert.size(), toUpdate.size()+toDelete.size()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@ -286,7 +301,6 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
} |
|
|
|
|
ClueData data = ClueData.builder() |
|
|
|
|
.name(person.getName()) |
|
|
|
|
.id("") |
|
|
|
|
.personId(person.getId()) |
|
|
|
|
.idCode(person.getIdCode()) |
|
|
|
|
.sourceData(desc) |
|
|
|
|
@ -315,7 +329,7 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
log.info("删除暴力伤害行为数据{}条", toDelete.size()); |
|
|
|
|
modelTaskClueService.deleteCluesAndDeleteTag(toDelete, deleteIdCodes, task.getModelId()); |
|
|
|
|
} |
|
|
|
|
taskRepository.updateTask(task.getId(), toInsert.size(), toDelete.size()+toUpdate.size()); |
|
|
|
|
taskRepository.updateTask(task.getId(), toInsert.size(), toDelete.size() + toUpdate.size()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@ -1756,72 +1770,52 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
taskRepository.updateTask(task.getId(), toInsert.size(), 0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void syncDrug(TaskParamDomain domain) { |
|
|
|
|
RiskTask task = taskRepository.create(domain.getPersons().size(), 37); |
|
|
|
|
|
|
|
|
|
Map<String, RiskModelTaskClue> oldMap = domain.getOldMap(task.getModelId(), true); |
|
|
|
|
Map<String, Integer> idCode = new HashMap<>(); |
|
|
|
|
List<Drug> list = zdryRepository.getBaseMapper().selectDrugMan(); |
|
|
|
|
Map<String, RiskPersonal> personalMap = domain.getPersons().stream().collect(Collectors.toMap(RiskPersonal::getIdCode, Function.identity(), (old, newVal) -> newVal)); |
|
|
|
|
List<RiskModelTaskClue> toInsert = new ArrayList<>(); |
|
|
|
|
for (Drug drug : list) { |
|
|
|
|
RiskPersonal personal = personalMap.get(drug.getSfzh()); |
|
|
|
|
if (personal == null) continue; |
|
|
|
|
if (idCode.get(drug.getSfzh()) != null) continue; |
|
|
|
|
if (oldMap.get(drug.getSfzh()) != null) continue; |
|
|
|
|
|
|
|
|
|
idCode.put(drug.getSfzh(), 1); |
|
|
|
|
ClueData data = ClueData.builder() |
|
|
|
|
.name(personal.getName()) |
|
|
|
|
.id(personal.getId().toString()) |
|
|
|
|
.idCode(personal.getIdCode()) |
|
|
|
|
.tag("涉药人员") |
|
|
|
|
.eventTime(LocalDateTime.now()) |
|
|
|
|
.personId(personal.getId()) |
|
|
|
|
.sourceData("发现该人员于" + drug.getGzdw() + "工作,属于特种工种中的涉药人员") |
|
|
|
|
.build(); |
|
|
|
|
toInsert.add(createClue(task.getModelId(), 5, task.getId(), data)); |
|
|
|
|
} |
|
|
|
|
if (!toInsert.isEmpty()) { |
|
|
|
|
modelTaskClueService.saveClues(toInsert, Default.IMPORT_IG); |
|
|
|
|
} |
|
|
|
|
taskRepository.updateTask(task.getId(), toInsert.size(), 0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void syncControlNoPower(TaskParamDomain domain) { |
|
|
|
|
RiskTask task = taskRepository.create(domain.getPersons().size(), 48); |
|
|
|
|
Map<String, RiskModelTaskClue> oldMap = domain.getOldMap(task.getModelId(), true); |
|
|
|
|
Map<String, Integer> idCode = new HashMap<>(); |
|
|
|
|
HashSet<String> idCode = new HashSet<>(); |
|
|
|
|
List<GBaseZDRY> list = zdryRepository.getBaseMapper().noPower(); |
|
|
|
|
|
|
|
|
|
Map<String, RiskPersonal> personalMap = domain.getPersons().stream().collect(Collectors.toMap(RiskPersonal::getIdCode, Function.identity(), (old, newVal) -> newVal)); |
|
|
|
|
List<RiskModelTaskClue> toInsert = new ArrayList<>(); |
|
|
|
|
List<RiskModelTaskClue> toDelete = new ArrayList<>(); |
|
|
|
|
List<String> deleteIdCodes = new ArrayList<>(); |
|
|
|
|
for (GBaseZDRY gBaseZDRY : list) { |
|
|
|
|
RiskPersonal personal = personalMap.get(gBaseZDRY.getSfzh()); |
|
|
|
|
if (personal == null) continue; |
|
|
|
|
if (idCode.get(gBaseZDRY.getSfzh()) != null) continue; |
|
|
|
|
if (oldMap.get(gBaseZDRY.getSfzh()) != null) continue; |
|
|
|
|
idCode.put(gBaseZDRY.getSfzh(), 1); |
|
|
|
|
|
|
|
|
|
ClueData data = ClueData.builder() |
|
|
|
|
if (idCode.contains(gBaseZDRY.getSfzh())) continue; |
|
|
|
|
idCode.add(gBaseZDRY.getSfzh()); |
|
|
|
|
if (oldMap.get(gBaseZDRY.getSfzh()) != null) { |
|
|
|
|
oldMap.remove(gBaseZDRY.getSfzh()); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
toInsert.add(DataUtil.createClueData(task, ClueData.builder() |
|
|
|
|
.name(personal.getName()) |
|
|
|
|
.id(personal.getId().toString()) |
|
|
|
|
.idCode(personal.getIdCode()) |
|
|
|
|
.tags(List.of("重点对象日常管控不到位")) |
|
|
|
|
.personId(personal.getId()) |
|
|
|
|
.score(5) |
|
|
|
|
.eventTime(LocalDateTime.of(2024, 10, 7, 12, 11, 23)) |
|
|
|
|
.sourceData("发现该人员属于重点人员,该人员的管控民警所管控的重点人员达到100人以上\n属于未落实日常管控要求") |
|
|
|
|
.build(); |
|
|
|
|
toInsert.add(DataUtil.createClueData(task, data)); |
|
|
|
|
.build())); |
|
|
|
|
} |
|
|
|
|
for (Map.Entry<String, RiskModelTaskClue> entry : oldMap.entrySet()) { |
|
|
|
|
RiskModelTaskClue clue = new RiskModelTaskClue(); |
|
|
|
|
clue.setId(entry.getValue().getId()); |
|
|
|
|
clue.setDel(1); |
|
|
|
|
toDelete.add(clue); |
|
|
|
|
deleteIdCodes.add(entry.getValue().getIdCode()); |
|
|
|
|
} |
|
|
|
|
if (!toInsert.isEmpty()) { |
|
|
|
|
log.info("增加特定对象日常管控不到位人员:{}", toInsert.size()); |
|
|
|
|
modelTaskClueService.saveClues(toInsert, Default.CONTROLLER_IG); |
|
|
|
|
} |
|
|
|
|
taskRepository.updateTask(task.getId(), toInsert.size(), 0); |
|
|
|
|
if (!toDelete.isEmpty()) { |
|
|
|
|
log.info("删除特定对象日常管控不到位人员:{}", toDelete.size()); |
|
|
|
|
modelTaskClueService.deleteCluesAndDeleteTag(toDelete, deleteIdCodes, task.getModelId()); |
|
|
|
|
} |
|
|
|
|
taskRepository.updateTask(task.getId(), toInsert.size(), toDelete.size()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private final RiskTestRepository riskTestRepository; |
|
|
|
|
@ -1933,134 +1927,76 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
.ge(GBaseOilBuy::getTime, currentTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))); |
|
|
|
|
RiskTask task = taskRepository.create(buys.size(), 52); |
|
|
|
|
// 旧数据
|
|
|
|
|
List<RiskModelTaskClue> oldList = Optional.ofNullable(domain.getMap().get(task.getModelId())).orElse(new ArrayList<>()); |
|
|
|
|
|
|
|
|
|
Map<String, RiskModelTaskClue> oldMap = oldList.stream().collect(Collectors.toMap(RiskModelTaskClue::getIdCode, Function.identity(), (val, old) -> val)); |
|
|
|
|
Map<String, RiskModelTaskClue> oldMap = domain.getOldMap(task.getModelId(), true); |
|
|
|
|
|
|
|
|
|
Map<String, List<GBaseOilBuy>> buyMap = buys.stream().collect(Collectors.groupingBy(GBaseOilBuy::getIdCode)); |
|
|
|
|
|
|
|
|
|
List<String> idCards = buyMap.keySet().stream().collect(Collectors.toList()); |
|
|
|
|
List<String> idCards = new ArrayList<>(buyMap.keySet()); |
|
|
|
|
|
|
|
|
|
List<String> carMaster = new ArrayList<>(); |
|
|
|
|
// 车主
|
|
|
|
|
if (!idCards.isEmpty()) { |
|
|
|
|
carMaster.addAll(zdryRepository.getBaseMapper().syncCarUser(idCards)); |
|
|
|
|
} |
|
|
|
|
HashSet<String> carMt = new HashSet<>(); |
|
|
|
|
for (String s : carMaster) { |
|
|
|
|
carMt.add(s); |
|
|
|
|
} |
|
|
|
|
Set<String> carMt = new HashSet<>(carMaster); |
|
|
|
|
|
|
|
|
|
// 新增记录
|
|
|
|
|
List<RiskModelTaskClue> toInsert = new ArrayList<>(); |
|
|
|
|
List<RiskModelTaskClue> toUpdate = new ArrayList<>(); |
|
|
|
|
List<RiskModelTaskClue> toDelete = new ArrayList<>(); |
|
|
|
|
List<String> toDeleteIdCodes = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
for (RiskPersonal person : domain.getPersons()) { |
|
|
|
|
if (oldMap.get(person.getIdCode()) != null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
List<GBaseOilBuy> mineBuy = buyMap.get(person.getIdCode()); |
|
|
|
|
if (mineBuy == null) { |
|
|
|
|
if (mineBuy == null || mineBuy.size() <= 0 || carMt.contains(person.getIdCode())) continue; |
|
|
|
|
|
|
|
|
|
String desc = "发现该人员属于无车人员,近3月内买了" + mineBuy.size() + "次散装油"; |
|
|
|
|
RiskModelTaskClue old = oldMap.get(person.getIdCode()); |
|
|
|
|
if (old != null && old.getData().equals(desc)) { |
|
|
|
|
oldMap.remove(person.getIdCode()); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
LocalDateTime time = null; |
|
|
|
|
int count = 0; |
|
|
|
|
for (GBaseOilBuy item : mineBuy) { |
|
|
|
|
if (carMt.contains(person.getIdCode())) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
count++; |
|
|
|
|
try { |
|
|
|
|
LocalDateTime tmp = LocalDateTime.parse(item.getTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
|
|
|
|
if (time == null) { |
|
|
|
|
time = tmp; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (tmp.isAfter(time)) { |
|
|
|
|
time = tmp; |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("散装油时间转化异常"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (count <= 0) { |
|
|
|
|
if (old != null) { |
|
|
|
|
oldMap.remove(person.getIdCode()); |
|
|
|
|
RiskModelTaskClue update = new RiskModelTaskClue(); |
|
|
|
|
update.setId(old.getId()); |
|
|
|
|
update.setUpdateTime(LocalDateTime.now()); |
|
|
|
|
update.setData(desc); |
|
|
|
|
update.setScore(Math.min(5, mineBuy.size())); |
|
|
|
|
toUpdate.add(update); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
ClueData data = ClueData.builder() |
|
|
|
|
toInsert.add(DataUtil.createClueData(task, ClueData.builder() |
|
|
|
|
.name(person.getName()) |
|
|
|
|
.id("") |
|
|
|
|
.idCode(person.getIdCode()) |
|
|
|
|
.score(Math.min(5, count)) |
|
|
|
|
.score(Math.min(5, mineBuy.size())) |
|
|
|
|
.tags(List.of(Default.NO_CAR_OIL_BUY)) |
|
|
|
|
.personId(person.getId()) |
|
|
|
|
.sourceData("发现该人员属于无车人员,买了" + count + "次散装油") |
|
|
|
|
.eventTime(time) |
|
|
|
|
.build(); |
|
|
|
|
toInsert.add(DataUtil.createClueData(task, data)); |
|
|
|
|
.sourceData(desc) |
|
|
|
|
.build())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (Map.Entry<String, RiskModelTaskClue> entry : oldMap.entrySet()) { |
|
|
|
|
RiskModelTaskClue delete = new RiskModelTaskClue(); |
|
|
|
|
delete.setId(entry.getValue().getId()); |
|
|
|
|
delete.setDel(1); |
|
|
|
|
toDelete.add(delete); |
|
|
|
|
toDeleteIdCodes.add(entry.getValue().getIdCode()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!toInsert.isEmpty()) { |
|
|
|
|
log.info("增加散装油人员:{}", toInsert.size()); |
|
|
|
|
modelTaskClueService.saveClues(toInsert, Default.GOODS_IG); |
|
|
|
|
} |
|
|
|
|
taskRepository.updateTask(task.getId(), toInsert.size(), 0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void syncSecurity(TaskParamDomain domain) { |
|
|
|
|
List<SecurityMan> securityList = new ArrayList<>(); |
|
|
|
|
CompletableFuture.allOf( |
|
|
|
|
CompletableFutureUtil.runSyncObject(() -> securityList.addAll(zdryRepository.getBaseMapper().syncSecurityMan1())), |
|
|
|
|
CompletableFutureUtil.runSyncObject(() -> securityList.addAll(zdryRepository.getBaseMapper().syncSecurityMan2())) |
|
|
|
|
).join(); |
|
|
|
|
Map<String, List<SecurityMan>> map = securityList.stream().collect(Collectors.groupingBy(SecurityMan::getIdCode)); |
|
|
|
|
RiskTask task = taskRepository.create(map.size(), 37); |
|
|
|
|
Map<String, RiskModelTaskClue> oldMap = domain.getOldMap(task.getModelId(), false); |
|
|
|
|
List<RiskModelTaskClue> toInsert = new ArrayList<>(); |
|
|
|
|
for (RiskPersonal person : domain.getPersons()) { |
|
|
|
|
List<SecurityMan> mans = map.get(person.getIdCode()); |
|
|
|
|
if (mans == null || oldMap.get(person.getIdCode()) != null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
SecurityMan real = null; |
|
|
|
|
for (SecurityMan man : mans) { |
|
|
|
|
if (real == null) { |
|
|
|
|
real = man; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (man.getDataSource() == 1) { |
|
|
|
|
real = man; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
ClueData data = ClueData.builder() |
|
|
|
|
.name(person.getName()) |
|
|
|
|
.id("security") |
|
|
|
|
.tag(Default.BA_TAG) |
|
|
|
|
.idCode(person.getIdCode()) |
|
|
|
|
.departId(person.getControlDepartId()) |
|
|
|
|
.departName(person.getControlDepartName()) |
|
|
|
|
.personId(person.getId()) |
|
|
|
|
.sourceData("发现该人员为保安人员,职位为:" + real.getJob() + ",属于特种职业") |
|
|
|
|
.build(); |
|
|
|
|
try { |
|
|
|
|
if (real.getTime().indexOf("-") != -1) { |
|
|
|
|
data.setEventTime(LocalDate.parse(real.getTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd")).atTime(0, 0, 0)); |
|
|
|
|
} else if (real.getTime().indexOf(".") != -1) { |
|
|
|
|
data.setEventTime(LocalDate.parse(real.getTime(), DateTimeFormatter.ofPattern("yyyy.M.d")).atTime(0, 0, 0)); |
|
|
|
|
} else { |
|
|
|
|
data.setEventTime(LocalDate.parse(real.getTime(), DateTimeFormatter.ofPattern("yyyy年MM月dd日")).atTime(0, 0, 0)); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.info("保安日期异常"); |
|
|
|
|
} |
|
|
|
|
toInsert.add(createClue(task.getModelId(), 5, task.getId(), data)); |
|
|
|
|
if (!toUpdate.isEmpty()) { |
|
|
|
|
log.info("修改散装油人员:{}", toUpdate.size()); |
|
|
|
|
modelTaskClueService.updateClues(toUpdate, task.getModelId()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 新增
|
|
|
|
|
if (!toInsert.isEmpty()) { |
|
|
|
|
log.info("新增保安人员:{}", toInsert.size()); |
|
|
|
|
modelTaskClueService.saveClues(toInsert, Default.IMPORT_IG); |
|
|
|
|
if (!toDelete.isEmpty()) { |
|
|
|
|
log.info("删除散装油人员:{}", toDelete.size()); |
|
|
|
|
modelTaskClueService.deleteCluesAndDeleteTag(toDelete, toDeleteIdCodes, task.getModelId()); |
|
|
|
|
} |
|
|
|
|
taskRepository.updateTask(task.getId(), toInsert.size(), 0); |
|
|
|
|
taskRepository.updateTask(task.getId(), toInsert.size(), toUpdate.size() + toDelete.size()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@ -2070,10 +2006,7 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
RiskTask task = taskRepository.create(carUsers.size(), 53); |
|
|
|
|
|
|
|
|
|
Map<String, RiskModelTaskClue> clueMap = domain.getOldMap(task.getModelId(), true); |
|
|
|
|
HashSet<String> exist = new HashSet<>(); |
|
|
|
|
for (String carUser : carUsers) { |
|
|
|
|
exist.add(carUser); |
|
|
|
|
} |
|
|
|
|
HashSet<String> exist = new HashSet<>(carUsers); |
|
|
|
|
|
|
|
|
|
List<RiskModelTaskClue> toInsert = new ArrayList<>(); |
|
|
|
|
List<RiskModelTaskClue> toDelete = new ArrayList<>(); |
|
|
|
|
@ -2082,7 +2015,6 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
// 增加
|
|
|
|
|
if (exist.contains(person.getIdCode()) && clueMap.get(person.getIdCode()) == null) { |
|
|
|
|
toInsert.add(DataUtil.createClueData(task, ClueData.builder() |
|
|
|
|
.id("") |
|
|
|
|
.score(5) |
|
|
|
|
.personId(person.getId()) |
|
|
|
|
.tags(List.of(Default.CAR_TAG)) |
|
|
|
|
@ -2141,8 +2073,6 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
|
|
|
|
|
private final GBaseTbDZdrylbRepository zdrylbRepository; |
|
|
|
|
|
|
|
|
|
private final SupExternalDepartRepository externalDepartRepository; |
|
|
|
|
|
|
|
|
|
List<RiskPersonal> getPersons() { |
|
|
|
|
List<GBaseTbDZdrylb> lbList = zdrylbRepository.list(new LambdaQueryWrapper<GBaseTbDZdrylb>() |
|
|
|
|
.select(GBaseTbDZdrylb::getCode, GBaseTbDZdrylb::getDefine)); |
|
|
|
|
@ -2206,7 +2136,7 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
personal.setControlDepartId(depart.getInternalId()); |
|
|
|
|
try { |
|
|
|
|
personal.setControlTime(LocalDateTime.parse(ry.getJlbgsj(), DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
} catch (Exception ignored) { |
|
|
|
|
} |
|
|
|
|
// 基本信息
|
|
|
|
|
try { |
|
|
|
|
@ -2214,7 +2144,7 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
int gender = personal.getIdCode().length() == 18 ? Integer.valueOf(personal.getIdCode().substring(16, 17)) : Integer.valueOf(personal.getIdCode().substring(14, 15)); |
|
|
|
|
// 结果0男1女 余数偶女奇男
|
|
|
|
|
personal.setGender(gender % 2 == 0 ? "2" : "1"); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
} catch (Exception ignored) { |
|
|
|
|
} |
|
|
|
|
if (ry.getZdrylxfs() != null) { |
|
|
|
|
String[] str = ry.getZdrylxfs().split(","); |
|
|
|
|
@ -2224,12 +2154,12 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
.filter(Character::isDigit) |
|
|
|
|
.collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append) |
|
|
|
|
.toString(); |
|
|
|
|
if (number.length() <= 8 || number.equals("00000000")) { |
|
|
|
|
if (number.length() <= 8) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
mobiles.append(m).append(","); |
|
|
|
|
} |
|
|
|
|
personal.setMobileNumber(mobiles.length() == 0 ? "" : mobiles.substring(0, mobiles.length() - 1)); |
|
|
|
|
personal.setMobileNumber(mobiles.isEmpty() ? "" : mobiles.substring(0, mobiles.length() - 1)); |
|
|
|
|
} |
|
|
|
|
personals.add(personal); |
|
|
|
|
} |
|
|
|
|
|