Browse Source

修改人员标签和风险项的入库逻辑

master
kami 1 year ago
parent
commit
6bd185ae74
  1. 15
      src/main/java/com/biutag/supervisiondata/event/ApplicationEvent.java
  2. 2
      src/main/java/com/biutag/supervisiondata/mapper/dwd/GBaseZDRYMapper.java
  3. 62
      src/main/java/com/biutag/supervisiondata/service/impl/NoControlServiceImpl.java
  4. 144
      src/main/java/com/biutag/supervisiondata/service/impl/PointServiceImpl.java
  5. 6
      src/main/java/com/biutag/supervisiondata/service/impl/WdpcGrjdJsbryServiceService.java

15
src/main/java/com/biutag/supervisiondata/event/ApplicationEvent.java

@ -111,7 +111,8 @@ public class ApplicationEvent {
// gBaseJJDService.pullAndSave(LocalDateTime.of(2023, 12, 6, 0, 0, 0), end); // gBaseJJDService.pullAndSave(LocalDateTime.of(2023, 12, 6, 0, 0, 0), end);
// riskPersonalService.fixed(); // riskPersonalService.fixed();
// personalService.syncPerson(LocalDate.now()); // personalService.syncPerson(LocalDate.now());
// 32,33,34,39,41,51 // 32,33,34,39,41,51,53,43,63
// 36 60 61 62 44 45 48 52 59
// petitionService.petitionModelTask(initDomain(List.of(40))); // petitionService.petitionModelTask(initDomain(List.of(40)));
// riskTaskService.eduAndAreaModelTask(initDomain(List.of(34,41))); // riskTaskService.eduAndAreaModelTask(initDomain(List.of(34,41)));
// riskTaskService.infoModelTask(initDomain(List.of(32,33))); // riskTaskService.infoModelTask(initDomain(List.of(32,33)));
@ -120,14 +121,14 @@ public class ApplicationEvent {
habitService.habitModelTask(LocalDateTime.of(2023, 12, 6, 0, 0, 0), initDomain(List.of(36,60,61,62))); habitService.habitModelTask(LocalDateTime.of(2023, 12, 6, 0, 0, 0), initDomain(List.of(36,60,61,62)));
// pointService.syncCarUser(initDomain(List.of(53))); // pointService.syncCarUser(initDomain(List.of(53)));
// pointService.syncScore(initDomain(List.of(43))); // pointService.syncScore(initDomain(List.of(43)));
// pointService.syncViolence(initDomain(List.of(44))); pointService.syncViolence(initDomain(List.of(44)));
// noControlService.syncNoControlData(initDomain(List.of(45))); noControlService.syncNoControlData(initDomain(List.of(45)));
// pointService.syncDrug(initDomain(List.of(37))); // pointService.syncDrug(initDomain(List.of(37)));
// pointService.syncControlNoPower(initDomain(List.of(48))); pointService.syncControlNoPower(initDomain(List.of(48)));
// pointService.syncOilBuy(initDomain(List.of(52))); pointService.syncOilBuy(initDomain(List.of(52)));
// gBaseJJDService.pullPoliceInstance(LocalDateTime.of(2023, 12, 6, 0, 0, 0), end, initDomain(List.of(55,56,57,58))); // gBaseJJDService.pullPoliceInstance(LocalDateTime.of(2023, 12, 6, 0, 0, 0), end, initDomain(List.of(55,56,57,58)));
// jsbryService.syncPys(initDomain(List.of(59))); jsbryService.syncPys(initDomain(List.of(59)));
gBaseSHRWFRService.combatCrime(initDomain(List.of(63))); // gBaseSHRWFRService.combatCrime(initDomain(List.of(63)));
// gBaseJJDService.syncPoliceAttack(initDomain(List.of(64))); // gBaseJJDService.syncPoliceAttack(initDomain(List.of(64)));
// gBaseJJDService.syncHomeViolence(initDomain(List.of(65,66))); // gBaseJJDService.syncHomeViolence(initDomain(List.of(65,66)));
// pointService.syncPointType(initDomain(List.of(67))); // pointService.syncPointType(initDomain(List.of(67)));

2
src/main/java/com/biutag/supervisiondata/mapper/dwd/GBaseZDRYMapper.java

@ -24,7 +24,7 @@ public interface GBaseZDRYMapper extends BaseMapper<GBaseZDRY> {
@Select(" select a.AJBH as ajbh, a.AJMC as ajmc, a.JYAQ as jyaq, a.BARQ as barq, b.XM as xm, b.XBmc as xbmc, b.ZJHM as zjhm, a.AJLBmc as ajlbmc, b.WFSS as wfss, a.BADWIDdm as badwiddm, a.BADWIDmc as badwidmc " + @Select(" select a.AJBH as ajbh, a.AJMC as ajmc, a.JYAQ as jyaq, a.BARQ as barq, b.XM as xm, b.XBmc as xbmc, b.ZJHM as zjhm, a.AJLBmc as ajlbmc, b.WFSS as wfss, a.BADWIDdm as badwiddm, a.BADWIDmc as badwidmc " +
" from csga_dwd.dwd_asj_zfba_ajjbxx a, csga_dwd.dwd_ry_zfba_wfryxx b, csga_wdpcdb.wdpc_grjd_flxx c " + " from csga_dwd.dwd_asj_zfba_ajjbxx a, csga_dwd.dwd_ry_zfba_wfryxx b, csga_wdpcdb.wdpc_grjd_flxx c " +
" where a.ajbh = b.ajbh and a.AJLBdm = c.AJLBdm and c.LXDM = '3' AND a.BARQ > DATE_ADD(now(), INTERVAL -12 MONTH) ") " where a.ajbh = b.ajbh and a.AJLBdm = c.AJLBdm and c.LXDM = '3' and b.ZJHM is not null AND a.BARQ > DATE_ADD(now(), INTERVAL -12 MONTH) ")
List<Violence> syncViolencePerson(); List<Violence> syncViolencePerson();
@Select("SELECT jjdbh, bjsj, bjrxm, IF(LENGTH(bjrlxdh) < 11, REGEXP_SUBSTR(bjnr, '[0-9]{11}'), bjrlxdh) AS bjrlxdh, IF(bjrzjhm IS NULL, REGEXP_SUBSTR(bjnr, '[0-9]{17}[0-9Xx]'), bjrzjhm) as bjrzjhm, bjnr, cjqk, gxdwdm, gxdwmc FROM `dwd_asj_zhtx_jjd` where (jqxzdm like '020107%' OR jqbz like '%个人极端%' ) AND bjsj > DATE_ADD(now(), INTERVAL -12 MONTH)") @Select("SELECT jjdbh, bjsj, bjrxm, IF(LENGTH(bjrlxdh) < 11, REGEXP_SUBSTR(bjnr, '[0-9]{11}'), bjrlxdh) AS bjrlxdh, IF(bjrzjhm IS NULL, REGEXP_SUBSTR(bjnr, '[0-9]{17}[0-9Xx]'), bjrzjhm) as bjrzjhm, bjnr, cjqk, gxdwdm, gxdwmc FROM `dwd_asj_zhtx_jjd` where (jqxzdm like '020107%' OR jqbz like '%个人极端%' ) AND bjsj > DATE_ADD(now(), INTERVAL -12 MONTH)")
List<Extreme> syncKillSelf(); List<Extreme> syncKillSelf();

62
src/main/java/com/biutag/supervisiondata/service/impl/NoControlServiceImpl.java

@ -1,5 +1,7 @@
package com.biutag.supervisiondata.service.impl; package com.biutag.supervisiondata.service.impl;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.biutag.supervisiondata.common.interfaces.CompletableFutureUtil; import com.biutag.supervisiondata.common.interfaces.CompletableFutureUtil;
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;
@ -14,6 +16,7 @@ import com.biutag.supervisiondata.repository.RiskTaskRepository;
import com.biutag.supervisiondata.service.NoControlService; import com.biutag.supervisiondata.service.NoControlService;
import com.biutag.supervisiondata.service.RiskModelTaskClueService; import com.biutag.supervisiondata.service.RiskModelTaskClueService;
import com.biutag.supervisiondata.service.RiskPersonalTagService; import com.biutag.supervisiondata.service.RiskPersonalTagService;
import com.biutag.supervisiondata.util.DataUtil;
import com.biutag.supervisiondata.util.IdCodeUtil; import com.biutag.supervisiondata.util.IdCodeUtil;
import com.biutag.supervisiondata.util.BhUtil; import com.biutag.supervisiondata.util.BhUtil;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -69,7 +72,7 @@ public class NoControlServiceImpl implements NoControlService {
for (ClueData clueDatum : clueData) { for (ClueData clueDatum : clueData) {
RiskPersonal personal = idCodes.get(clueDatum.getIdCode()); RiskPersonal personal = idCodes.get(clueDatum.getIdCode());
if(personal.getTags().indexOf(Default.NO_CONTROL) == -1) { if (personal.getTags().indexOf(Default.NO_CONTROL) == -1) {
RiskPersonal newOne = new RiskPersonal(); RiskPersonal newOne = new RiskPersonal();
newOne.setId(personal.getId()); newOne.setId(personal.getId());
newOne.setTags(personal.getTags().concat(",".concat(Default.NO_CONTROL))); newOne.setTags(personal.getTags().concat(",".concat(Default.NO_CONTROL)));
@ -77,36 +80,19 @@ public class NoControlServiceImpl implements NoControlService {
idCodes.put(clueDatum.getIdCode(), personal); idCodes.put(clueDatum.getIdCode(), personal);
toUpdate.add(newOne); toUpdate.add(newOne);
} }
clues.add(createClue(task.getModelId(), 5, task.getId(), clueDatum)); clues.add(DataUtil.createClueData(task, clueDatum));
} }
if(!toUpdate.isEmpty()) { if (!toUpdate.isEmpty()) {
log.info("修改人数:{}", toUpdate.size()); log.info("修改人数:{}", toUpdate.size());
personalRepository.updateBatchById(toUpdate); personalRepository.updateBatchById(toUpdate);
} }
if(!clues.isEmpty()) { if (!clues.isEmpty()) {
clueService.saveClues(clues, Default.CONTROLLER2_IG); clueService.saveClues(clues, Default.CONTROLLER2_IG);
} }
riskTaskRepository.updateTask(task.getId(), clues.size(), toUpdate.size()); riskTaskRepository.updateTask(task.getId(), clues.size(), toUpdate.size());
} }
RiskModelTaskClue createClue(Integer modelId, Integer score, Integer taskId, ClueData data) {
RiskModelTaskClue clue = new RiskModelTaskClue();
clue.setModelId(modelId);
clue.setScore(score);
clue.setName(data.getName());
clue.setIdCode(data.getIdCode());
clue.setTaskId(taskId);
clue.setData(data.getSourceData());
clue.setEventTime(data.getEventTime());
clue.setCreateTime(LocalDateTime.now());
clue.setUpdateTime(LocalDateTime.now());
clue.setCaseIds(BhUtil.ajBh(data.getId()));
data.setPersonId(null);
clue.setRiskReason(data.getTag());
return clue;
}
List<ClueData> crazyControl(Map<String, RiskPersonal> idCodes, Map<String, RiskPersonal> mobiles) { List<ClueData> crazyControl(Map<String, RiskPersonal> idCodes, Map<String, RiskPersonal> mobiles) {
// 精神病人属于重点人员,发现多起警情 疑似存在管控不到位的现象 // 精神病人属于重点人员,发现多起警情 疑似存在管控不到位的现象
List<Extreme> extremeList = zdryRepository.getBaseMapper().syncPointNoControlCrazy(); List<Extreme> extremeList = zdryRepository.getBaseMapper().syncPointNoControlCrazy();
@ -116,10 +102,10 @@ public class NoControlServiceImpl implements NoControlService {
if (extreme.getBjrzjhm() != null) { if (extreme.getBjrzjhm() != null) {
person = idCodes.get(extreme.getBjrzjhm()); person = idCodes.get(extreme.getBjrzjhm());
} }
if(person == null && extreme.getBjrlxdh() != null) { if (person == null && extreme.getBjrlxdh() != null) {
person = mobiles.get(extreme.getBjrlxdh()); person = mobiles.get(extreme.getBjrlxdh());
} }
if(person == null) { if (person == null) {
continue; continue;
} }
ClueData data = ClueData.builder() ClueData data = ClueData.builder()
@ -127,8 +113,9 @@ public class NoControlServiceImpl implements NoControlService {
.idCode(person.getIdCode()) .idCode(person.getIdCode())
.name(person.getName()) .name(person.getName())
.personId(person.getId()) .personId(person.getId())
.tag("精神病人管控不到位") .tags(List.of("精神病人管控不到位"))
.sourceData("该人员属于精神病人,涉及到有关警情,"+Optional.ofNullable(extreme.getJjdbh()).map(it -> "接警单编号:"+it).orElse("")+"属于管控不到位"+Optional.ofNullable(extreme.getCjqk()).map(it -> ",具体情况:"+it).orElse("")) .score(5)
.sourceData("该人员属于精神病人,涉及到有关警情," + Optional.ofNullable(extreme.getJjdbh()).map(it -> "接警单编号:" + it).orElse("") + "属于管控不到位" + Optional.ofNullable(extreme.getCjqk()).map(it -> ",具体情况:" + it).orElse(""))
.departName(extreme.getGxdwmc()) .departName(extreme.getGxdwmc())
.departId(extreme.getGxdwdm()) .departId(extreme.getGxdwdm())
.build(); .build();
@ -151,7 +138,7 @@ public class NoControlServiceImpl implements NoControlService {
if (violence.getZjhm() != null) { if (violence.getZjhm() != null) {
person = idCodes.get(violence.getZjhm()); person = idCodes.get(violence.getZjhm());
} }
if(person == null) { if (person == null) {
continue; continue;
} }
ClueData data = ClueData.builder() ClueData data = ClueData.builder()
@ -159,8 +146,9 @@ public class NoControlServiceImpl implements NoControlService {
.idCode(person.getIdCode()) .idCode(person.getIdCode())
.name(person.getName()) .name(person.getName())
.personId(person.getId()) .personId(person.getId())
.tag("刑事、吸毒人员管控不到位") .tags(List.of("刑事、吸毒人员管控不到位"))
.sourceData("该人员属于故意犯罪并作出刑事判决人员(排除仍在羁押状态的)、公安机关查处吸毒人员(排除仍在羁押状态的),涉及到案件,"+Optional.ofNullable(violence.getAjbh()).map(it -> "案件编号:"+it).orElse("")+"属于管控不到位"+Optional.ofNullable(violence.getAjmc()).map(it -> ",案件名称:"+it).orElse("")+Optional.ofNullable(violence.getWfss()).map(it -> ",违法事实:"+it).orElse("")) .score(5)
.sourceData("该人员属于故意犯罪并作出刑事判决人员(排除仍在羁押状态的)、公安机关查处吸毒人员(排除仍在羁押状态的),涉及到案件," + Optional.ofNullable(violence.getAjbh()).map(it -> "案件编号:" + it).orElse("") + "属于管控不到位" + Optional.ofNullable(violence.getAjmc()).map(it -> ",案件名称:" + it).orElse("") + Optional.ofNullable(violence.getWfss()).map(it -> ",违法事实:" + it).orElse(""))
.departName(violence.getBadwidmc()) .departName(violence.getBadwidmc())
.departId(violence.getBadwiddm()) .departId(violence.getBadwiddm())
.build(); .build();
@ -183,7 +171,7 @@ public class NoControlServiceImpl implements NoControlService {
if (noControl.getIdCardNo() != null) { if (noControl.getIdCardNo() != null) {
person = idCodes.get(noControl.getIdCardNo()); person = idCodes.get(noControl.getIdCardNo());
} }
if(person == null) { if (person == null) {
continue; continue;
} }
ClueData data = ClueData.builder() ClueData data = ClueData.builder()
@ -191,8 +179,9 @@ public class NoControlServiceImpl implements NoControlService {
.idCode(person.getIdCode()) .idCode(person.getIdCode())
.name(person.getName()) .name(person.getName())
.personId(person.getId()) .personId(person.getId())
.tag("刑满释放人管控不到位") .tags(List.of("刑满释放人管控不到位"))
.sourceData("该人员属于看守所故意犯罪刑满释放不满5年人员,发现在重点人员中 未纳入或未按要求落实双列管,"+Optional.ofNullable(noControl.getCrime()).map(it -> "涉及犯罪事实:"+it).orElse("")+""+Optional.ofNullable(noControl.getBriefCase()).map(it -> ",,具体事件表现为:"+it).orElse("")) .score(5)
.sourceData("该人员属于看守所故意犯罪刑满释放不满5年人员,发现在重点人员中 未纳入或未按要求落实双列管," + Optional.ofNullable(noControl.getCrime()).map(it -> "涉及犯罪事实:" + it).orElse("") + "" + Optional.ofNullable(noControl.getBriefCase()).map(it -> ",,具体事件表现为:" + it).orElse(""))
.departName(noControl.getCaseUnit()) .departName(noControl.getCaseUnit())
.departId(noControl.getCaseUnitId()) .departId(noControl.getCaseUnitId())
.build(); .build();
@ -206,7 +195,7 @@ public class NoControlServiceImpl implements NoControlService {
return clueData; return clueData;
} }
List<ClueData> crazyLevelThreeControl(Map<String, RiskPersonal> idCodes,Map<String, RiskPersonal> mobiles) { List<ClueData> crazyLevelThreeControl(Map<String, RiskPersonal> idCodes, Map<String, RiskPersonal> mobiles) {
// 卫健委精神疾病三级以上人员,发现在重点人员中 未纳入或未按要求落实双列管 // 卫健委精神疾病三级以上人员,发现在重点人员中 未纳入或未按要求落实双列管
List<CrazyLevelThree> crazyLevelThreeList = zdryRepository.getBaseMapper().syncCrazyLevelThree(); List<CrazyLevelThree> crazyLevelThreeList = zdryRepository.getBaseMapper().syncCrazyLevelThree();
List<ClueData> clueData = new ArrayList<>(); List<ClueData> clueData = new ArrayList<>();
@ -215,10 +204,10 @@ public class NoControlServiceImpl implements NoControlService {
if (crazyLevelThree.getSfzh() != null) { if (crazyLevelThree.getSfzh() != null) {
person = idCodes.get(crazyLevelThree.getSfzh()); person = idCodes.get(crazyLevelThree.getSfzh());
} }
if(person == null && crazyLevelThree.getLxdh() != null) { if (person == null && crazyLevelThree.getLxdh() != null) {
person = mobiles.get(crazyLevelThree.getLxdh()); person = mobiles.get(crazyLevelThree.getLxdh());
} }
if(person == null) { if (person == null) {
continue; continue;
} }
clueData.add(ClueData.builder() clueData.add(ClueData.builder()
@ -226,8 +215,9 @@ public class NoControlServiceImpl implements NoControlService {
.idCode(person.getIdCode()) .idCode(person.getIdCode())
.name(person.getName()) .name(person.getName())
.personId(person.getId()) .personId(person.getId())
.tag("神疾病三级以上人员管控不到位") .tags(List.of("神疾病三级以上人员管控不到位"))
.sourceData("卫健委精神疾病三级以上人员,发现在重点人员中 未纳入或未按要求落实双列管"+Optional.ofNullable(crazyLevelThree.getTsqksm()).map(it -> ",备注:"+it).orElse("")) .score(5)
.sourceData("卫健委精神疾病三级以上人员,发现在重点人员中 未纳入或未按要求落实双列管" + Optional.ofNullable(crazyLevelThree.getTsqksm()).map(it -> ",备注:" + it).orElse(""))
.build()); .build());
} }
return clueData; return clueData;

144
src/main/java/com/biutag/supervisiondata/service/impl/PointServiceImpl.java

@ -231,54 +231,56 @@ public class PointServiceImpl implements PointService {
@Override @Override
public void syncViolence(TaskParamDomain domain) { public void syncViolence(TaskParamDomain domain) {
RiskTask task = taskRepository.create(domain.getPersons().size(), 44); RiskTask task = taskRepository.create(domain.getPersons().size(), 44);
Map<String, RiskPersonal> personalMap = domain.getPersons().stream().collect(Collectors.toMap(RiskPersonal::getIdCode, Function.identity(), (oldValue, newValue) -> newValue));
List<Violence> list = zdryRepository.getBaseMapper().syncViolencePerson(); List<Violence> list = zdryRepository.getBaseMapper().syncViolencePerson();
Map<String, List<Violence>> violenceMap = list.stream().collect(Collectors.groupingBy(Violence::getZjhm));
Map<String, Map<String, Integer>> map = new HashMap<>(); Map<String, Map<String, Integer>> map = new HashMap<>();
List<RiskModelTaskClue> olds = Optional.ofNullable(domain.getMap().get(task.getId())).orElse(new ArrayList<>()); List<RiskModelTaskClue> olds = Optional.ofNullable(domain.getMap().get(task.getId())).orElse(new ArrayList<>());
Map<String, List<RiskModelTaskClue>> maps = olds.stream().collect(Collectors.groupingBy(RiskModelTaskClue::getIdCode)); Map<String, List<RiskModelTaskClue>> maps = olds.stream().collect(Collectors.groupingBy(RiskModelTaskClue::getIdCode));
List<RiskModelTaskClue> toInsert = new ArrayList<>(); List<RiskModelTaskClue> toInsert = new ArrayList<>();
for (Violence violence : list) {
if (violence.getZjhm() == null || personalMap.get(violence.getZjhm()) == null) { for (RiskPersonal person : domain.getPersons()) {
continue; List<Violence> tmp = violenceMap.get(person.getIdCode());
if (tmp == null) continue;
List<RiskModelTaskClue> old = maps.get(person.getIdCode());
if (old != null) continue;
tmp = tmp.stream().filter(StreamUtil.distinctByKey(Violence::getAjbh)).toList();
StringBuilder sb = new StringBuilder("通过核查案件信息,发现该人员有暴力伤害行为,案件编号为:");
List<String> tags = new ArrayList<>();
LocalDateTime date = null;
for (Violence violence : tmp) {
sb.append(violence.getAjbh()).append(",");
if(!tags.contains(violence.getAjlbmc())) {
tags.add(violence.getAjlbmc());
} }
Map<String, Integer> old = Optional.ofNullable(map.get(violence.getZjhm())).orElse(new HashMap<>()); try {
if (old.get(violence.getAjbh()) != null) { LocalDateTime ld = violence.getBarq().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
if(date == null) {
date = ld;
continue; continue;
} }
if(date.isAfter(ld)) {
List<RiskModelTaskClue> oldClues = Optional.ofNullable(maps.get(violence.getZjhm())).orElse(new ArrayList<>()); date = ld;
Map<String, RiskModelTaskClue> oldMap = oldClues.stream().collect(Collectors.toMap(RiskModelTaskClue::getCaseIds, Function.identity(), (oldValue, newValue) -> newValue)); }
if (oldMap.get(BhUtil.ajBh(violence.getAjbh())) != null) { } catch (Exception ignored) {
continue; }
} }
old.put(violence.getAjbh(), 1);
map.put(violence.getZjhm(), old);
RiskPersonal person = personalMap.get(violence.getZjhm());
ClueData data = ClueData.builder() ClueData data = ClueData.builder()
.name(person.getName()) .name(person.getName())
.id(violence.getAjbh()) .id("")
.personId(person.getId()) .personId(person.getId())
.idCode(person.getIdCode()) .idCode(person.getIdCode())
.sourceData("通过核查案件信息,发现该人员有暴力伤害行为,案件编号为:" + violence.getAjbh() + Optional.ofNullable(violence.getWfss()).map(it -> ",具体情况为:" + it).orElse("")) .sourceData(sb.substring(0, sb.length()-1))
.tag(violence.getAjlbmc()) .tags(tags)
.score(Math.min(tmp.size(), 5))
.eventTime(date)
.build(); .build();
if (violence.getBadwiddm() != null) { toInsert.add(DataUtil.createClueData(task, data));
data.setDepartId(violence.getBadwiddm());
data.setDepartId(violence.getBadwidmc());
} }
try {
data.setEventTime(violence.getBarq().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
} catch (Exception ignored) {
data.setEventTime(LocalDateTime.now());
}
toInsert.add(createClue2(task.getModelId(), 5, task.getId(), data));
}
if (!toInsert.isEmpty()) { if (!toInsert.isEmpty()) {
modelTaskClueService.saveClues(toInsert, Default.VIOLENCE_IG); modelTaskClueService.saveClues(toInsert, "B89暴力伤害行为");
} }
taskRepository.updateTask(task.getId(), toInsert.size(), 0); taskRepository.updateTask(task.getId(), toInsert.size(), 0);
} }
@ -1687,14 +1689,13 @@ public class PointServiceImpl implements PointService {
.name(personal.getName()) .name(personal.getName())
.id(personal.getId().toString()) .id(personal.getId().toString())
.idCode(personal.getIdCode()) .idCode(personal.getIdCode())
.tag("重点对象日常管控不到位") .tags(List.of("重点对象日常管控不到位"))
.departId(gBaseZDRY.getXzdpcsdm())
.departName(gBaseZDRY.getXzdpcs())
.personId(personal.getId()) .personId(personal.getId())
.score(5)
.eventTime(LocalDateTime.of(2024, 10, 7, 12, 11, 23)) .eventTime(LocalDateTime.of(2024, 10, 7, 12, 11, 23))
.sourceData("发现该人员属于重点人员,该人员的管控民警所管控的重点人员达到100人以上\n属于未落实日常管控要求") .sourceData("发现该人员属于重点人员,该人员的管控民警所管控的重点人员达到100人以上\n属于未落实日常管控要求")
.build(); .build();
toInsert.add(createClue(task.getModelId(), 5, task.getId(), data)); toInsert.add(DataUtil.createClueData(task, data));
} }
if (!toInsert.isEmpty()) { if (!toInsert.isEmpty()) {
log.info("增加特定对象日常管控不到位人员:{}", toInsert.size()); log.info("增加特定对象日常管控不到位人员:{}", toInsert.size());
@ -1823,8 +1824,7 @@ public class PointServiceImpl implements PointService {
GBaseOilBuy::getName, GBaseOilBuy::getCompanyName, GBaseOilBuy::getType, GBaseOilBuy::getTime, GBaseOilBuy::getName, GBaseOilBuy::getCompanyName, GBaseOilBuy::getType, GBaseOilBuy::getTime,
GBaseOilBuy::getUseTo, GBaseOilBuy::getMobile, GBaseOilBuy::getIdCode) GBaseOilBuy::getUseTo, GBaseOilBuy::getMobile, GBaseOilBuy::getIdCode)
.ge(GBaseOilBuy::getTime, currentTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))); .ge(GBaseOilBuy::getTime, currentTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))));
RiskTask task = createTask(buys.size(), 52); RiskTask task = taskRepository.create(buys.size(), 52);
taskRepository.save(task);
// 旧数据 // 旧数据
List<RiskModelTaskClue> oldList = Optional.ofNullable(domain.getMap().get(task.getModelId())).orElse(new ArrayList<>()); List<RiskModelTaskClue> oldList = Optional.ofNullable(domain.getMap().get(task.getModelId())).orElse(new ArrayList<>());
@ -1851,6 +1851,8 @@ public class PointServiceImpl implements PointService {
if (mineBuy == null) { if (mineBuy == null) {
continue; continue;
} }
LocalDateTime time = null;
int count = 0;
for (GBaseOilBuy item : mineBuy) { for (GBaseOilBuy item : mineBuy) {
if (oldMap.get(BhUtil.oilBh(item.getXh())) != null) { if (oldMap.get(BhUtil.oilBh(item.getXh())) != null) {
continue; continue;
@ -1858,68 +1860,38 @@ public class PointServiceImpl implements PointService {
if (carMt.get(person.getIdCode()) != null) { if (carMt.get(person.getIdCode()) != null) {
continue; continue;
} }
ClueData data = ClueData.builder() count++;
.name(person.getName())
.id(BhUtil.oilBh(item.getXh()))
.idCode(person.getIdCode())
.departId(item.getOrgId())
.departName(item.getOrgName())
.personId(person.getId())
.build();
try { try {
data.setEventTime(LocalDateTime.parse(item.getTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); 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) { } catch (Exception e) {
data.setEventTime(LocalDateTime.now());
log.error("散装油时间转化异常"); log.error("散装油时间转化异常");
} }
data.setTag(Default.NO_CAR_OIL_BUY);
data.setSourceData("发现该人员属于无车人员,于" + item.getTime() + "在" + item.getCompanyName() + "购买容量为" + item.getNumber() + "L的" + item.getType() + ",用作" + item.getUseTo());
toInsert.add(createClue(task.getModelId(), 5, task.getId(), data));
} }
ClueData data = ClueData.builder()
.name(person.getName())
.id("")
.idCode(person.getIdCode())
.score(Math.min(5, count))
.tags(List.of(Default.NO_CAR_OIL_BUY))
.personId(person.getId())
.sourceData("发现该人员属于无车人员,买了" + count + "次散装油")
.eventTime(time)
.build();
toInsert.add(DataUtil.createClueData(task, data));
} }
if (!toInsert.isEmpty()) { if (!toInsert.isEmpty()) {
log.info("增加散装油人员:{}", toInsert.size()); log.info("增加散装油人员:{}", toInsert.size());
modelTaskClueService.saveClues(toInsert, Default.GOODS_IG); modelTaskClueService.saveClues(toInsert, Default.GOODS_IG);
} }
taskRepository.updateTask(task.getId(), toInsert.size(), 0);
List<RiskModelTaskClue> toDelete = new ArrayList<>();
Map<String, Byte[]> deletePerson = new WeakHashMap<>();
Map<String, Byte[]> livePerson = new WeakHashMap<>();
for (RiskModelTaskClue entry : oldList) {
// 删除记录
if (entry.getEventTime().isBefore(currentTime)) {
RiskModelTaskClue delete = new RiskModelTaskClue();
delete.setId(entry.getId());
delete.setDel(1);
toDelete.add(delete);
deletePerson.put(entry.getIdCode(), new Byte[0]);
} else {
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) {
idCodes.add(s);
}
}
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(toDelete.size());
updateTask.setState(1);
updateTask.setEndTime(LocalDateTime.now());
taskRepository.updateById(updateTask);
} }
@Override @Override

6
src/main/java/com/biutag/supervisiondata/service/impl/WdpcGrjdJsbryServiceService.java

@ -11,6 +11,7 @@ import com.biutag.supervisiondata.repository.RiskTaskRepository;
import com.biutag.supervisiondata.repository.WdpcGrjdJsbryRepository; import com.biutag.supervisiondata.repository.WdpcGrjdJsbryRepository;
import com.biutag.supervisiondata.service.RiskModelTaskClueService; import com.biutag.supervisiondata.service.RiskModelTaskClueService;
import com.biutag.supervisiondata.service.WdpcGrjdJsbryService; import com.biutag.supervisiondata.service.WdpcGrjdJsbryService;
import com.biutag.supervisiondata.util.DataUtil;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -66,7 +67,8 @@ public class WdpcGrjdJsbryServiceService implements WdpcGrjdJsbryService {
.name(wdpcGrjdJsbry.getName()) .name(wdpcGrjdJsbry.getName())
.id("psychosis") .id("psychosis")
.idCode(wdpcGrjdJsbry.getIdCode()) .idCode(wdpcGrjdJsbry.getIdCode())
.tag(Default.PSYCHOSIS_TAG) .tags(List.of(Default.PSYCHOSIS_TAG))
.score(5)
.sourceData(text.toString()) .sourceData(text.toString())
.build(); .build();
try { try {
@ -75,7 +77,7 @@ public class WdpcGrjdJsbryServiceService implements WdpcGrjdJsbryService {
} catch (Exception e) { } catch (Exception e) {
data.setEventTime(LocalDateTime.now()); data.setEventTime(LocalDateTime.now());
} }
toInsert.add(createClue(task.getModelId(), 5, task.getId(), data)); toInsert.add(DataUtil.createClueData(task, data));
} }
if(!toInsert.isEmpty()) { if(!toInsert.isEmpty()) {

Loading…
Cancel
Save