Browse Source

新增27、28、30号模型:盗窃车内财物警情结警性质变动的异常数据、盗窃车内财物超过5000元的数据、接警结警性质不一致的异常数据

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

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

@ -239,7 +239,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
} else if (modelId == 25) { // 25号模型:重点人员管控人数过多
getModelCluesForModel25(sql, modelClues);
return modelClues;
}else {
} else {
System.out.println("模型" + modelId + "开始查询数据库");
modelClues = modelClueDataMapper.selectDataByDynamicSql(sql);
System.out.println("模型" + modelId + "查询数据库完毕,数量为:" + modelClues.size());
@ -247,7 +247,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> oldUniqueKeys = new ArrayList<>();
// 无需更新状态的模型
if (modelId != 19) {
if (modelId != 19 && modelId != 27 && modelId != 28 && modelId != 30) {
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()) {
@ -269,7 +269,9 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
}
List<ModelClue> needsInsertModelClues = modelClues.stream().filter(item -> needsInsertIds.contains(item.getUniqueKey())).toList();
String newSql = generateNewSql(sql, needsInsertIds, modelId);
System.out.println("开始查询新sql");
List<Map<String, Object>> allData = modelClueDataMapper.selectByUniqueKeys(newSql);
System.out.println("查询新sql完成,结果数量:" + allData.size());
String originalFieldName = getKeyFieldName(sql);
for (ModelClue modelClue : needsInsertModelClues) {
for (Map<String, Object> data : allData) {
@ -335,7 +337,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
modelClue.setInvolvePoliceName("无姓名数据");
}
}
// 接警单关联反馈单
// 反馈单
if (modelId == 24) { //24号模型:警情未录入反馈人员信息
String barId = (String) data.get("fkrbh");
Map<String, Object> bar = barId != null && !barId.isEmpty() ? modelClueDataMapper.selectBAR(barId) : null;
@ -469,6 +471,21 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
+ "离开,停留时长" + calculateMinutesBetween(data.get("djsj"), data.get("lksj"))
+ ",存在间隔时间过短的异常。");
}
} else if (modelId == 27) { // 27号模型:盗窃车内财物警情结警性质变动的异常数据
modelClue.setThingDesc("发现" + modelClue.getInvolveDepartName() + "受理的接警单"
+ modelClue.getUniqueKey() + ",报警日期为" + getDateMinuteString(data.get("bjsj"))
+ ",接警性质为“" + data.get("ysjqxzmc") + "”,结警性质为“" + data.get("jqxzmc")
+ ",存在盗窃车内财物警情结警性质变动的异常情况。");
} else if (modelId == 28) { // 28号模型:盗窃车内财物超过5000元的数据
modelClue.setThingDesc("发现" + modelClue.getInvolveDepartName() + "受理的接警单"
+ modelClue.getUniqueKey() + ",报警日期为" + getDateMinuteString(data.get("bjsj"))
+ ",接警性质为“" + data.get("ysjqxzmc") + "”,金额超过5000元。报警内容为:“" + data.get("bjnr")
+ "”。");
} else if (modelId == 30) { // 30号模型:接警结警性质不一致的异常数据
modelClue.setThingDesc("发现" + modelClue.getInvolveDepartName() + "受理的接警单"
+ modelClue.getUniqueKey() + ",报警日期为" + getDateMinuteString(data.get("bjsj"))
+ ",接警性质为“" + data.get("ysjqxzmc") + "”,结警性质为“" + data.get("jqxzmc")
+ ",存在接警结警性质不一致的异常数据的异常情况。");
}
}
@ -658,7 +675,7 @@ 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查询数据库完毕");
System.out.println("模型18查询数据库完毕,结果数量:" + sqlList.size());
if (sqlList.isEmpty()) {
return;
}
@ -712,7 +729,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
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查询数据库完毕");
System.out.println("模型20查询数据库完毕,结果数量:" + sqlList.size());
if (sqlList.isEmpty()) {
return;
}
@ -740,7 +757,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
private void getModelCluesForModel22(String sql, List<ModelClue> modelClues) {
System.out.println("模型22开始查询数据库");
List<Map<String, Object>> sqlList = modelClueDataDMMapper.selectByUniqueKeys(sql);
System.out.println("模型22查询数据库完毕");
System.out.println("模型22查询数据库完毕,结果数量:" + sqlList.size());
if (sqlList.isEmpty()) {
return;
}
@ -796,7 +813,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
private void getModelCluesForModel25(String sql, List<ModelClue> modelClues) {
System.out.println("模型25开始查询数据库");
List<Map<String, Object>> sqlList = modelClueDataMapper.selectByUniqueKeys(sql);
System.out.println("模型25查询数据库完毕");
System.out.println("模型25查询数据库完毕,结果数量:" + sqlList.size());
if (sqlList.isEmpty()) {
return;
}
@ -1114,7 +1131,8 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
tableName = tableMatcher.group(1);
}
String originalFieldName = getKeyFieldName(originalSql);
if (modelId == 24) { //24号模型:警情未录入反馈人员信息
// 接警单关联反馈单警员
if (modelId == 24 || modelId == 27 || modelId == 28 || modelId == 30) {
return "SELECT a.*, b.fkrbh, b.fkrxm FROM " + tableName + " a left join dwd_asj_zhtx_fkd b on a.jjdbh = b.jjdbh " + "WHERE a." + originalFieldName + " IN " + "(" + uniqueKeys.stream().map(k -> "'" + k + "'").collect(Collectors.joining(",")) + ");";
}
return "SELECT * FROM " + tableName + " " + "WHERE " + originalFieldName + " IN " + "(" + uniqueKeys.stream().map(k -> "'" + k + "'").collect(Collectors.joining(",")) + ");";

Loading…
Cancel
Save