wxc 1 year ago
parent
commit
866ce88a4b
  1. 15
      src/main/java/com/biutag/supervision/pojo/entity/ModelClue18.java
  2. 83
      src/main/java/com/biutag/supervision/service/ModelClueService.java

15
src/main/java/com/biutag/supervision/pojo/entity/ModelClue18.java

@ -0,0 +1,15 @@
package com.biutag.supervision.pojo.entity;
import lombok.Getter;
import lombok.Setter;
@Setter
@Getter
public class ModelClue18 {
private String zhrq;
private String zhdd;
private String ajbh;
private String zhr;
private String badwIDdm;
private String badwIDmc;
}

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

@ -222,18 +222,33 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
} else if (modelId == 16) { // 16号模型:多次取保的异常数据
getModelCluesForModel16(sql, modelClues);
return modelClues;
} else if (modelId == 18) { // 18号模型:相同时间地点抓捕出现多条案件编号的异常数据
getModelCluesForModel18(sql, modelClues);
return modelClues;
} else {
System.out.println("模型" + modelId + "开始查询数据库");
modelClues = modelClueDataMapper.selectDataByDynamicSql(sql);
System.out.println("模型" + modelId + "查询数据库完毕,数量为:" + modelClues.size());
}
List<String> uniqueKeys = modelClues.stream().map(ModelClue::getUniqueKey).filter(k -> k != null && !k.isEmpty()).toList();
List<String> 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();
if (!changeStatusIds.isEmpty()) {
modelClueMapper.update(null, new LambdaUpdateWrapper<ModelClue>().in(ModelClue::getUniqueKey, changeStatusIds).set(ModelClue::getDistributionState, "2"));
List<String> oldUniqueKeys = new ArrayList<>();
// 无需更新状态的模型
if (modelId != 18) {
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();
if (!changeStatusIds.isEmpty()) {
modelClueMapper.update(null, new LambdaUpdateWrapper<ModelClue>().in(ModelClue::getUniqueKey, changeStatusIds).set(ModelClue::getDistributionState, "2"));
}
}
List<String> needsInsertIds = new ArrayList<>();
for (String uniqueKey : uniqueKeys) {
if (oldUniqueKeys.isEmpty()) {
break;
}
if (!oldUniqueKeys.contains(uniqueKey)) {
needsInsertIds.add(uniqueKey);
}
}
List<String> needsInsertIds = uniqueKeys.stream().filter(item -> !oldUniqueKeys.contains(item)).toList();
if (needsInsertIds.isEmpty()) {
return new ArrayList<>();
}
@ -395,6 +410,11 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
+ "”(【" + data.get("AJBZmc") + "】编号:" + getAjbh(data)
+ "),其案件定性为“" + data.get("AJLBmc")
+ "”,应至少有一名受害人,但办案单位没有录入,存在未录入受害人员的异常情况。");
} else if (modelId == 17) { // 17号模型:刑事盗窃警情未录入执法办案系统的异常数据
modelClue.setThingDesc(
"发现" + modelClue.getInvolveDepartName() + "受理的盗窃性质接警单" + modelClue.getUniqueKey()
+ ",报警日期为" + getDateMinuteString(data.get("bjsj"))
+ ",状态为已结案。目前但执法办案系统中未查询到数据,存在刑事盗窃警情未录入执法办案系统的异常情况。");
}
}
@ -581,6 +601,59 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
}
}
private void getModelCluesForModel18(String sql, List<ModelClue> modelClues) {
System.out.println("模型18开始查询数据库");
List<Map<String, Object>> sqlList = modelClueDataMapper.selectByUniqueKeys(sql);
System.out.println("模型18查询数据库完毕");
if (sqlList.isEmpty()) {
return;
}
Map<String, ModelClue18> model18Map = new HashMap<>();
for (Map<String, Object> map : sqlList) {
String zhrq = getDateMinuteString(map.get("zhrq"));
String zhdd = (String) map.get("zhdd");
String ajbh = (String) map.get("ajbh");
String zhr = map.get("zhr") == null ? "" : (String) map.get("zhr");
String badwIDdm = map.get("BADWIDdm") == null ? "" : (String) map.get("BADWIDdm");
String badwIDmc = map.get("BADWIDmc") == null ? "" : (String) map.get("BADWIDmc");
ModelClue18 modelClue18 = new ModelClue18();
modelClue18.setAjbh(ajbh);
modelClue18.setZhrq(zhrq);
modelClue18.setZhdd(zhdd);
modelClue18.setZhr(zhr);
modelClue18.setBadwIDdm(badwIDdm);
modelClue18.setBadwIDmc(badwIDmc);
if (model18Map.containsKey(zhdd + zhrq)) {
modelClue18.setAjbh(model18Map.get(zhdd + zhrq).getAjbh() +"、"+ ajbh);
}
model18Map.put(zhdd + zhrq, modelClue18);
}
for (ModelClue18 value : model18Map.values()) {
ModelClue newModelClue = new ModelClue();
newModelClue.setUniqueKey(value.getAjbh());
newModelClue.setNegativeIdEx(value.getAjbh());
newModelClue.setInvolvePoliceName(value.getZhr());
if (value.getBadwIDdm() != null) {
SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper<SupExternalDepart>().eq(SupExternalDepart::getExternalId, value.getBadwIDdm()).last("LIMIT 1"));
if (supExternalDepart != null) {
if (supExternalDepart.getInternalId() != null) {
newModelClue.setInvolveDepartId(supExternalDepart.getInternalId());
}
if (supExternalDepart.getInternalShortName() != null) {
newModelClue.setInvolveDepartName(supExternalDepart.getInternalShortName());
}
}
}
newModelClue.setData(JSONObject.toJSONString(value));
newModelClue.setDistributionState("0");
newModelClue.setThingDesc(
"发现" + newModelClue.getInvolveDepartName() + "在" + value.getZhrq()
+ "于" + value.getZhdd() + "出警时产生了多条案件编号(" + value.getAjbh() +
"),存在相同时间地点抓捕出现多条案件编号的异常,请予以重点关注。");
modelClues.add(newModelClue);
}
}
private void mergeModelClues(List<ModelClue> modelClues2, List<ModelClue> modelClues1 , int no) {
for (ModelClue modelClue2 : modelClues2) {
Iterator<ModelClue> iterator1 = modelClues1.iterator();

Loading…
Cancel
Save