|
|
|
|
@ -8,6 +8,7 @@ import com.biutag.supervisiondata.mapper.mine.SupDepartMapper;
|
|
|
|
|
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.PointOrg; |
|
|
|
|
import com.biutag.supervisiondata.pojo.database.SecurityMan; |
|
|
|
|
import com.biutag.supervisiondata.pojo.domain.*; |
|
|
|
|
import com.biutag.supervisiondata.pojo.entity.dwd.GBaseOilBuy; |
|
|
|
|
@ -593,6 +594,69 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
taskRepository.updateById(updateTask); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void syncCarUser(TaskParamDomain domain) { |
|
|
|
|
int count = domain.getIdCards().size(); |
|
|
|
|
List<String> carUsers = new ArrayList<>(); |
|
|
|
|
for (List<String> idCard : domain.getIdCards()) { |
|
|
|
|
carUsers.addAll(zdryRepository.getBaseMapper().syncCarUser(idCard)); |
|
|
|
|
log.info("车主进度:{}", --count); |
|
|
|
|
} |
|
|
|
|
RiskTask task = createTask(carUsers.size(), 53); |
|
|
|
|
taskRepository.save(task); |
|
|
|
|
|
|
|
|
|
Map<String, RiskModelTaskClue> clueMap = domain.getOldMap(task.getModelId(), false); |
|
|
|
|
Map<String, Byte[]> exist = new WeakHashMap<>(); |
|
|
|
|
for (String carUser : carUsers) { |
|
|
|
|
exist.put(carUser, new Byte[0]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<RiskModelTaskClue> toInsert = new ArrayList<>(); |
|
|
|
|
List<RiskModelTaskClue> toDelete = new ArrayList<>(); |
|
|
|
|
List<String> idCodes = new ArrayList<>(); |
|
|
|
|
for (RiskPersonal person : domain.getPersons()) { |
|
|
|
|
// 增加
|
|
|
|
|
if(exist.get(person.getIdCode())!=null && clueMap.get(person.getIdCode()) == null) { |
|
|
|
|
ClueData data = ClueData.builder() |
|
|
|
|
.name(person.getName()) |
|
|
|
|
.id("car_man") |
|
|
|
|
.tag(Default.CAR_TAG) |
|
|
|
|
.idCode(person.getIdCode()) |
|
|
|
|
.departId(person.getControlDepartId()) |
|
|
|
|
.departName(person.getControlDepartName()) |
|
|
|
|
.personId(person.getId()) |
|
|
|
|
.sourceData("发现该人员有车,增加风险分1分。") |
|
|
|
|
.build(); |
|
|
|
|
toInsert.add(createClue(task.getModelId(), 1, task.getId(), data)); |
|
|
|
|
} |
|
|
|
|
// 减少
|
|
|
|
|
if(exist.get(person.getIdCode())==null && clueMap.get(person.getIdCode())!=null) { |
|
|
|
|
RiskModelTaskClue old = clueMap.get(person.getIdCode()); |
|
|
|
|
RiskModelTaskClue delete = new RiskModelTaskClue(); |
|
|
|
|
delete.setId(old.getId()); |
|
|
|
|
delete.setDel(1); |
|
|
|
|
toDelete.add(delete); |
|
|
|
|
idCodes.add(person.getIdCode()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!toInsert.isEmpty()) { |
|
|
|
|
log.info("增加有车人员:{}", toInsert.size()); |
|
|
|
|
modelTaskClueService.saveClues(toInsert, Default.CAR_IG); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!toDelete.isEmpty()) { |
|
|
|
|
modelTaskClueService.deleteCluesAndDeleteTag(toDelete, idCodes, Default.CAR_TAG); |
|
|
|
|
} |
|
|
|
|
RiskTask updateTask = new RiskTask(); |
|
|
|
|
updateTask.setId(task.getId()); |
|
|
|
|
updateTask.setInsertSize(toInsert.size()); |
|
|
|
|
updateTask.setUpdateSize(toDelete.size()); |
|
|
|
|
updateTask.setState(1); |
|
|
|
|
updateTask.setEndTime(LocalDateTime.now()); |
|
|
|
|
taskRepository.updateById(updateTask); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
RiskModelTaskClue createClue(Integer modelId, Integer score, Integer taskId, ClueData data) { |
|
|
|
|
RiskModelTaskClue clue = new RiskModelTaskClue(); |
|
|
|
|
clue.setModelId(modelId); |
|
|
|
|
@ -654,21 +718,21 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
List<RiskPersonal> getPersons() { |
|
|
|
|
List<GBaseTbDZdrylb> lbList = zdrylbRepository.list(new LambdaQueryWrapper<GBaseTbDZdrylb>() |
|
|
|
|
.select(GBaseTbDZdrylb::getCode, GBaseTbDZdrylb::getDefine)); |
|
|
|
|
List<SupDepart> supDeparts = supDepartMapper.selectList(new LambdaQueryWrapper<SupDepart>() |
|
|
|
|
.select(SupDepart::getId, SupDepart::getCode, SupDepart::getLevel, SupDepart::getShortName, SupDepart::getPid) |
|
|
|
|
.ge(SupDepart::getLevel, 3)); |
|
|
|
|
|
|
|
|
|
Map<String, Integer> supExternalDepartMap = new WeakHashMap<>(); |
|
|
|
|
List<SupExternalDepart> externalDeparts = new ArrayList<>(); |
|
|
|
|
List<SupExternalDepart> supDeparts = externalDepartRepository.list(new LambdaQueryWrapper<SupExternalDepart>() |
|
|
|
|
.select(SupExternalDepart::getExternalId, SupExternalDepart::getInternalId, SupExternalDepart::getInternalName) |
|
|
|
|
.eq(SupExternalDepart::getSource, "重点人员")); |
|
|
|
|
|
|
|
|
|
List<PointOrg> orgs = zdryRepository.getBaseMapper().selectOrg(); |
|
|
|
|
Map<String, PointOrg> orgIdMap = new WeakHashMap<>(); |
|
|
|
|
Map<String, PointOrg> orgCodeMap = new WeakHashMap<>(); |
|
|
|
|
for (PointOrg org : orgs) { |
|
|
|
|
orgIdMap.put(org.getId(), org); |
|
|
|
|
orgCodeMap.put(org.getDm(), org); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Map<Integer, String> lbMap = new WeakHashMap<>(); |
|
|
|
|
Map<String, SupDepart> supDepartCodeMap = new WeakHashMap<>(); |
|
|
|
|
Map<String, SupDepart> supDepartIdMap = new WeakHashMap<>(); |
|
|
|
|
Map<String, SupExternalDepart> supExternalDepartMap = supDeparts.stream().collect(Collectors.toMap(SupExternalDepart::getExternalId, Function.identity(), (val,old) -> val)); |
|
|
|
|
|
|
|
|
|
for (SupDepart supDepart : supDeparts) { |
|
|
|
|
supDepartCodeMap.put(supDepart.getCode(), supDepart); |
|
|
|
|
supDepartIdMap.put(supDepart.getId(), supDepart); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (GBaseTbDZdrylb lb : lbList) { |
|
|
|
|
if (lb.getCode().startsWith("0")) { |
|
|
|
|
@ -685,6 +749,7 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
Map<String, Map<String, Integer>> map = new HashMap<>(); |
|
|
|
|
int zdCount = 0; |
|
|
|
|
int noDepartCount = 0; |
|
|
|
|
int noOrgCount = 0; |
|
|
|
|
for (GBaseZDRY ry : list) { |
|
|
|
|
List<Integer> codes = PatternUtil.takeMarkPosition(ry.getZdrylbbj()); |
|
|
|
|
if (codes.isEmpty()) { |
|
|
|
|
@ -704,20 +769,16 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
zdCount++; |
|
|
|
|
sb = sb.stream().distinct().toList(); |
|
|
|
|
Map<String, Integer> tmp = Optional.ofNullable(map.get(ry.getSfzh())).orElse(new HashMap<>()); |
|
|
|
|
|
|
|
|
|
SupDepart depart = supDepartCodeMap.get(ry.getGxdwjgdm()); |
|
|
|
|
depart = findLevelThreeDepart(depart, supDepartIdMap); |
|
|
|
|
Integer exist = supExternalDepartMap.get(ry.getGxdwjgdm()); |
|
|
|
|
if (exist == null) { |
|
|
|
|
SupExternalDepart externalDepart = new SupExternalDepart(); |
|
|
|
|
externalDepart.setExternalId(ry.getGxdwjgdm()); |
|
|
|
|
externalDepart.setExternalName(ry.getGxdw()); |
|
|
|
|
externalDepart.setSource("重点人员"); |
|
|
|
|
externalDeparts.add(externalDepart); |
|
|
|
|
supExternalDepartMap.put(ry.getGxdwjgdm(), 1); |
|
|
|
|
PointOrg org = orgCodeMap.get(ry.getGxdwjgdm()); |
|
|
|
|
org = findOrg(org, orgIdMap); |
|
|
|
|
if(org == null) { |
|
|
|
|
noOrgCount++; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
SupExternalDepart depart = supExternalDepartMap.get(org.getDm()); |
|
|
|
|
if (depart == null) { |
|
|
|
|
noDepartCount++; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
for (String s : sb) { |
|
|
|
|
if (tmp.get(s) != null) { |
|
|
|
|
@ -730,8 +791,8 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
personal.setIdCode(ry.getSfzh()); |
|
|
|
|
personal.setName(ry.getXm()); |
|
|
|
|
|
|
|
|
|
personal.setControlDepartName(Optional.ofNullable(depart).map(SupDepart::getShortName).orElse(ry.getGxdw())); |
|
|
|
|
personal.setControlDepartId(Optional.ofNullable(depart).map(SupDepart::getId).orElse(ry.getGxdwjgdm())); |
|
|
|
|
personal.setControlDepartName(depart.getInternalName()); |
|
|
|
|
personal.setControlDepartId(depart.getInternalId()); |
|
|
|
|
try { |
|
|
|
|
personal.setControlTime(LocalDateTime.parse(ry.getJlbgsj(), DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
@ -763,9 +824,18 @@ public class PointServiceImpl implements PointService {
|
|
|
|
|
} |
|
|
|
|
map.put(ry.getSfzh(), tmp); |
|
|
|
|
} |
|
|
|
|
log.info("重点人员入库数:{} 未匹配到本地组织机构数:{}", zdCount, noDepartCount); |
|
|
|
|
externalDepartRepository.saveBatch(externalDeparts); |
|
|
|
|
log.info("重点人员入库数:{} | 外部机构未匹配:{} | 本地组织机构未匹配:{}", zdCount, noOrgCount, noDepartCount); |
|
|
|
|
return personals; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
PointOrg findOrg(PointOrg org, Map<String, PointOrg> orgIdMap) { |
|
|
|
|
if(org == null) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
if(org.getPcs() == null || !org.getPcs().equals("1")) { |
|
|
|
|
return findOrg(orgIdMap.get(org.getPid()), orgIdMap); |
|
|
|
|
} |
|
|
|
|
return org; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|