Browse Source

新增20号模型:连续7天上传散油购销记录小于10的异常数据

main
sjh 1 year ago
parent
commit
5b99524e1c
  1. 34
      src/main/java/com/biutag/supervision/service/ModelClueService.java

34
src/main/java/com/biutag/supervision/service/ModelClueService.java

@ -225,6 +225,9 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
} else if (modelId == 18) { // 18号模型:相同时间地点抓捕出现多条案件编号的异常数据 } else if (modelId == 18) { // 18号模型:相同时间地点抓捕出现多条案件编号的异常数据
getModelCluesForModel18(sql, modelClues); getModelCluesForModel18(sql, modelClues);
return modelClues; return modelClues;
} else if (modelId == 20) { // 20号模型:连续7天上传散油购销记录小于10的异常数据
getModelCluesForModel20(sql, modelClues);
return modelClues;
} else { } else {
System.out.println("模型" + modelId + "开始查询数据库"); System.out.println("模型" + modelId + "开始查询数据库");
modelClues = modelClueDataMapper.selectDataByDynamicSql(sql); modelClues = modelClueDataMapper.selectDataByDynamicSql(sql);
@ -233,7 +236,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
List<String> uniqueKeys = modelClues.stream().map(ModelClue::getUniqueKey).filter(k -> k != null && !k.isEmpty()).toList(); List<String> uniqueKeys = modelClues.stream().map(ModelClue::getUniqueKey).filter(k -> k != null && !k.isEmpty()).toList();
List<String> oldUniqueKeys = new ArrayList<>(); List<String> oldUniqueKeys = new ArrayList<>();
// 无需更新状态的模型 // 无需更新状态的模型
if (modelId != 18) { if (modelId != 19) {
oldUniqueKeys = this.listObjs(new LambdaQueryWrapper<ModelClue>().select(ModelClue::getUniqueKey).ne(ModelClue::getDistributionState, "2").eq(ModelClue::getModelId, modelId), String::valueOf); oldUniqueKeys = this.listObjs(new LambdaQueryWrapper<ModelClue>().select(ModelClue::getUniqueKey).ne(ModelClue::getDistributionState, "2").eq(ModelClue::getModelId, modelId), String::valueOf);
List<String> changeStatusIds = oldUniqueKeys.stream().filter(item -> !uniqueKeys.contains(item)).toList(); List<String> changeStatusIds = oldUniqueKeys.stream().filter(item -> !uniqueKeys.contains(item)).toList();
if (!changeStatusIds.isEmpty()) { if (!changeStatusIds.isEmpty()) {
@ -662,6 +665,35 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
} }
} }
private void getModelCluesForModel20(String param, List<ModelClue> modelClues) {
System.out.println("模型20开始查询数据库");
String sql = "select * from dwd_qb_nbgl_lxqtscsygxjl where STR_TO_DATE(tjrq, '%Y-%m-%d') = CURDATE() - INTERVAL " + param + " DAY;";
List<Map<String, Object>> sqlList = modelClueDataMapper.selectByUniqueKeys(sql);
System.out.println("模型20查询数据库完毕");
if (sqlList.isEmpty()) {
return;
}
for (Map<String, Object> map : sqlList) {
ModelClue newModelClue = new ModelClue();
newModelClue.setUniqueKey((String) map.get("tjrq") + map.get("dwmc"));
newModelClue.setNegativeIdEx((String) map.get("tjrq") + map.get("dwmc"));
newModelClue.setInvolveDepartName((String) map.get("pcsmc"));
SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper<SupExternalDepart>().eq(SupExternalDepart::getInternalShortName, map.get("pcsmc")).last("LIMIT 1"));
if (supExternalDepart != null) {
if (supExternalDepart.getInternalId() != null) {
newModelClue.setInvolveDepartId(supExternalDepart.getInternalId());
}
}
newModelClue.setData(JSONObject.toJSONString(map));
newModelClue.setDistributionState("0");
newModelClue.setThingDesc(
getDateString((String) map.get("tjrq")) + "灵敏感知系统发现" + newModelClue.getInvolveDepartName() + "合作的" + map.get("dwmc")
+ "的上报数量为" + map.get("cnt") + "," + map.get("result") +
",请予以重点关注。");
modelClues.add(newModelClue);
}
}
private void mergeModelClues(List<ModelClue> modelClues2, List<ModelClue> modelClues1 , int no) { private void mergeModelClues(List<ModelClue> modelClues2, List<ModelClue> modelClues1 , int no) {
for (ModelClue modelClue2 : modelClues2) { for (ModelClue modelClue2 : modelClues2) {
Iterator<ModelClue> iterator1 = modelClues1.iterator(); Iterator<ModelClue> iterator1 = modelClues1.iterator();

Loading…
Cancel
Save