|
|
|
|
@ -255,7 +255,7 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
.build(); |
|
|
|
|
toInsert.add(createClue(task.getModelId(), 2, task.getId(), data)); |
|
|
|
|
} |
|
|
|
|
if(!toInsert.isEmpty()) { |
|
|
|
|
if (!toInsert.isEmpty()) { |
|
|
|
|
modelTaskClueService.saveClues(toInsert, Default.IMPORT_IG); |
|
|
|
|
} |
|
|
|
|
RiskTask updateTask = new RiskTask(); |
|
|
|
|
@ -335,7 +335,7 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
RiskPersonal personal = entry.getValue().getFirst(); |
|
|
|
|
if(oldMap.get(personal.getIdCode()) != null) { |
|
|
|
|
if (oldMap.get(personal.getIdCode()) != null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
String[] str = personal.getMobileNumber().split(","); |
|
|
|
|
@ -356,7 +356,7 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
int count2 = Optional.ofNullable(map.get(s)).map(MuchCall::getUnNormal).orElse(0); |
|
|
|
|
noUsefulNum += count2; |
|
|
|
|
} |
|
|
|
|
if(num == 0 && noUsefulNum==0) { |
|
|
|
|
if (num == 0 && noUsefulNum == 0) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
StringBuilder mark = new StringBuilder(); |
|
|
|
|
@ -368,7 +368,7 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
call.setNoUsefulCallCount(noUsefulNum); |
|
|
|
|
call.setLabels(mark.substring(0, mark.length() - 1)); |
|
|
|
|
call.setName(personal.getName()); |
|
|
|
|
call.setMobiles(mobile.length()==0?"":mobile.substring(0, mobile.length() - 1)); |
|
|
|
|
call.setMobiles(mobile.length() == 0 ? "" : mobile.substring(0, mobile.length() - 1)); |
|
|
|
|
call.setIdCode(personal.getIdCode()); |
|
|
|
|
call.setControlId(personal.getControlDepartId()); |
|
|
|
|
call.setControlName(personal.getControlDepartName()); |
|
|
|
|
@ -422,16 +422,16 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
public void syncOilBuy(TaskParamDomain domain) { |
|
|
|
|
LocalDateTime currentTime = LocalDateTime.now().minusMonths(3); |
|
|
|
|
List<GBaseOilBuy> buys = oilBuyRepository.list(new LambdaQueryWrapper<GBaseOilBuy>() |
|
|
|
|
.select(GBaseOilBuy::getXh,GBaseOilBuy::getNumber,GBaseOilBuy::getOrgId,GBaseOilBuy::getOrgName, |
|
|
|
|
GBaseOilBuy::getName,GBaseOilBuy::getCompanyName,GBaseOilBuy::getType,GBaseOilBuy::getTime, |
|
|
|
|
GBaseOilBuy::getUseTo,GBaseOilBuy::getMobile,GBaseOilBuy::getIdCode) |
|
|
|
|
.select(GBaseOilBuy::getXh, GBaseOilBuy::getNumber, GBaseOilBuy::getOrgId, GBaseOilBuy::getOrgName, |
|
|
|
|
GBaseOilBuy::getName, GBaseOilBuy::getCompanyName, GBaseOilBuy::getType, GBaseOilBuy::getTime, |
|
|
|
|
GBaseOilBuy::getUseTo, GBaseOilBuy::getMobile, GBaseOilBuy::getIdCode) |
|
|
|
|
.ge(GBaseOilBuy::getTime, currentTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))); |
|
|
|
|
RiskTask task = createTask(buys.size(), 52); |
|
|
|
|
taskRepository.save(task); |
|
|
|
|
// 旧数据
|
|
|
|
|
List<RiskModelTaskClue> oldList = Optional.ofNullable(domain.getMap().get(task.getModelId())).orElse(new ArrayList<>()); |
|
|
|
|
|
|
|
|
|
Map<String, RiskModelTaskClue> oldMap = oldList.stream().collect(Collectors.toMap(RiskModelTaskClue::getCaseIds, Function.identity(), (val, old)-> val)); |
|
|
|
|
Map<String, RiskModelTaskClue> oldMap = oldList.stream().collect(Collectors.toMap(RiskModelTaskClue::getCaseIds, Function.identity(), (val, old) -> val)); |
|
|
|
|
|
|
|
|
|
Map<String, List<GBaseOilBuy>> buyMap = buys.stream().collect(Collectors.groupingBy(GBaseOilBuy::getIdCode)); |
|
|
|
|
|
|
|
|
|
@ -439,10 +439,10 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
|
|
|
|
|
List<String> carMaster = new ArrayList<>(); |
|
|
|
|
// 车主
|
|
|
|
|
if(!idCards.isEmpty()) { |
|
|
|
|
if (!idCards.isEmpty()) { |
|
|
|
|
carMaster.addAll(zdryRepository.getBaseMapper().syncCarUser(idCards)); |
|
|
|
|
} |
|
|
|
|
Map<String,Byte[]> carMt = new WeakHashMap<>(); |
|
|
|
|
Map<String, Byte[]> carMt = new WeakHashMap<>(); |
|
|
|
|
for (String s : carMaster) { |
|
|
|
|
carMt.put(s, new Byte[0]); |
|
|
|
|
} |
|
|
|
|
@ -451,11 +451,14 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
List<RiskModelTaskClue> toInsert = new ArrayList<>(); |
|
|
|
|
for (RiskPersonal person : domain.getPersons()) { |
|
|
|
|
List<GBaseOilBuy> mineBuy = buyMap.get(person.getIdCode()); |
|
|
|
|
if(mineBuy == null) { |
|
|
|
|
if (mineBuy == null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
for (GBaseOilBuy item : mineBuy) { |
|
|
|
|
if(oldMap.get(BhUtil.oilBh(item.getXh())) != null) { |
|
|
|
|
if (oldMap.get(BhUtil.oilBh(item.getXh())) != null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (carMt.get(person.getIdCode()) != null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
ClueData data = ClueData.builder() |
|
|
|
|
@ -472,15 +475,10 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
data.setEventTime(LocalDateTime.now()); |
|
|
|
|
log.error("散装油时间转化异常"); |
|
|
|
|
} |
|
|
|
|
if(carMt.get(person.getIdCode()) == null) { |
|
|
|
|
|
|
|
|
|
data.setTag(Default.NO_CAR_OIL_BUY); |
|
|
|
|
data.setSourceData("发现该人员属于无车人员,于"+item.getTime()+"在"+item.getCompanyName()+"购买容量为"+item.getNumber()+"L的"+item.getType()+",用作"+item.getUseTo()+",风险分增加3分"); |
|
|
|
|
data.setSourceData("发现该人员属于无车人员,于" + item.getTime() + "在" + item.getCompanyName() + "购买容量为" + item.getNumber() + "L的" + item.getType() + ",用作" + item.getUseTo() + ",风险分增加3分"); |
|
|
|
|
toInsert.add(createClue(task.getModelId(), 3, task.getId(), data)); |
|
|
|
|
} else { |
|
|
|
|
data.setTag(Default.OIL_BUY); |
|
|
|
|
data.setSourceData("发现该人员于"+item.getTime()+"在"+item.getCompanyName()+"购买容量为"+item.getNumber()+"L的"+item.getType()+",用作"+item.getUseTo()+",风险分增加2分"); |
|
|
|
|
toInsert.add(createClue(task.getModelId(), 2, task.getId(), data)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -489,44 +487,39 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
modelTaskClueService.saveClues(toInsert, Default.GOODS_IG); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, List<RiskModelTaskClue>> tmp = oldList.stream().collect(Collectors.groupingBy(RiskModelTaskClue::getRiskReason)); |
|
|
|
|
int count = 0; |
|
|
|
|
for (Map.Entry<String, List<RiskModelTaskClue>> entry : tmp.entrySet()) { |
|
|
|
|
List<RiskModelTaskClue> toDelete = new ArrayList<>(); |
|
|
|
|
Map<String, Byte[]> deletePerson = new WeakHashMap<>(); |
|
|
|
|
Map<String, Byte[]> livePerson = new WeakHashMap<>(); |
|
|
|
|
for (RiskModelTaskClue entry : oldList) { |
|
|
|
|
// 删除记录
|
|
|
|
|
for (RiskModelTaskClue clue : entry.getValue()) { |
|
|
|
|
if(clue.getEventTime().isBefore(currentTime)){ |
|
|
|
|
if (entry.getEventTime().isBefore(currentTime)) { |
|
|
|
|
RiskModelTaskClue delete = new RiskModelTaskClue(); |
|
|
|
|
delete.setId(clue.getId()); |
|
|
|
|
delete.setId(entry.getId()); |
|
|
|
|
delete.setDel(1); |
|
|
|
|
toDelete.add(delete); |
|
|
|
|
deletePerson.put(clue.getIdCode(), new Byte[0]); |
|
|
|
|
count++; |
|
|
|
|
deletePerson.put(entry.getIdCode(), new Byte[0]); |
|
|
|
|
} else { |
|
|
|
|
livePerson.put(clue.getIdCode(), new Byte[0]); |
|
|
|
|
livePerson.put(entry.getIdCode(), new Byte[0]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<String> idCodes = new ArrayList<>(); |
|
|
|
|
// 删除标签 从deletePerson遍历,存活中没有,新增没有,说明该标签就没了
|
|
|
|
|
for (String s : deletePerson.keySet()) { |
|
|
|
|
if(livePerson.get(s)==null && buyMap.get(s) == null) { |
|
|
|
|
if (livePerson.get(s) == null && buyMap.get(s) == null) { |
|
|
|
|
idCodes.add(s); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(!toDelete.isEmpty()) { |
|
|
|
|
modelTaskClueService.deleteCluesAndDeleteTag(toDelete, idCodes, entry.getKey()); |
|
|
|
|
} |
|
|
|
|
if (!toDelete.isEmpty()) { |
|
|
|
|
modelTaskClueService.deleteCluesAndDeleteTag(toDelete, idCodes, Default.NO_CAR_OIL_BUY); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RiskTask updateTask = new RiskTask(); |
|
|
|
|
updateTask.setId(task.getId()); |
|
|
|
|
updateTask.setInsertSize(toInsert.size()); |
|
|
|
|
updateTask.setUpdateSize(count); |
|
|
|
|
updateTask.setUpdateSize(toDelete.size()); |
|
|
|
|
updateTask.setState(1); |
|
|
|
|
updateTask.setEndTime(LocalDateTime.now()); |
|
|
|
|
taskRepository.updateById(updateTask); |
|
|
|
|
@ -546,16 +539,16 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
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) { |
|
|
|
|
if (mans == null || oldMap.get(person.getIdCode()) != null) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
SecurityMan real = null; |
|
|
|
|
for (SecurityMan man : mans) { |
|
|
|
|
if(real == null) { |
|
|
|
|
if (real == null) { |
|
|
|
|
real = man; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if(man.getDataSource() == 1) { |
|
|
|
|
if (man.getDataSource() == 1) { |
|
|
|
|
real = man; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
@ -569,15 +562,15 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
.departId(person.getControlDepartId()) |
|
|
|
|
.departName(person.getControlDepartName()) |
|
|
|
|
.personId(person.getId()) |
|
|
|
|
.sourceData("发现该人员为保安人员,职位为:"+real.getJob()+",属于特种职业,增加风险分2分。") |
|
|
|
|
.sourceData("发现该人员为保安人员,职位为:" + real.getJob() + ",属于特种职业,增加风险分2分。") |
|
|
|
|
.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)); |
|
|
|
|
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)); |
|
|
|
|
data.setEventTime(LocalDate.parse(real.getTime(), DateTimeFormatter.ofPattern("yyyy年MM月dd日")).atTime(0, 0, 0)); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.info("保安日期异常"); |
|
|
|
|
|