diff --git a/src/main/java/com/biutag/supervision/service/ModelClueService.java b/src/main/java/com/biutag/supervision/service/ModelClueService.java index 5a60ad9..7f2a52f 100644 --- a/src/main/java/com/biutag/supervision/service/ModelClueService.java +++ b/src/main/java/com/biutag/supervision/service/ModelClueService.java @@ -265,7 +265,7 @@ public class ModelClueService extends ServiceImpl { return new ArrayList<>(); } List needsInsertModelClues = modelClues.stream().filter(item -> needsInsertIds.contains(item.getUniqueKey())).toList(); - String newSql = generateNewSql(sql, needsInsertIds); + String newSql = generateNewSql(sql, needsInsertIds, modelId); List> allData = modelClueDataMapper.selectByUniqueKeys(newSql); String originalFieldName = getKeyFieldName(sql); for (ModelClue modelClue : needsInsertModelClues) { @@ -289,7 +289,8 @@ public class ModelClueService extends ServiceImpl { } private void setPerson(Integer modelId, ModelClue modelClue, Map data) { - if (modelId == 3) { // 执法区域人员表 + // 执法区域人员表 + if (modelId == 3) { String bar1 = (String) data.get("bar1"); String bar2 = (String) data.get("bar2"); String involvePoliceName = (bar1 != null && !bar1.isEmpty() && bar2 != null && !bar2.isEmpty()) @@ -311,7 +312,8 @@ public class ModelClueService extends ServiceImpl { modelClue.setInvolvePoliceEmpNo("无警号数据"); } } - if (modelId == 10 || modelId == 11 || modelId == 12 || modelId == 13 || modelId == 14 || modelId == 15 || modelId == 19) { // 案件基本信息表 + // 案件基本信息表 + if (modelId == 10 || modelId == 11 || modelId == 12 || modelId == 13 || modelId == 14 || modelId == 15 || modelId == 19) { String bar1Id = (String) data.get("BAR1ID"); String bar2Id = (String) data.get("BAR2ID"); Map bar1 = bar1Id != null && !bar1Id.isEmpty() ? modelClueDataMapper.selectBAR(bar1Id) : null; @@ -330,6 +332,18 @@ public class ModelClueService extends ServiceImpl { modelClue.setInvolvePoliceName("无姓名数据"); } } + // 接警单关联反馈单 + if (modelId == 24) { //24号模型:警情未录入反馈人员信息 + String barId = (String) data.get("fkrbh"); + Map bar = barId != null && !barId.isEmpty() ? modelClueDataMapper.selectBAR(barId) : null; + if (bar != null) { + modelClue.setInvolvePoliceEmpNo((String) bar.get("JH")); + modelClue.setInvolvePoliceName((String) bar.get("XM")); + } else { + modelClue.setInvolvePoliceEmpNo("无警号数据"); + modelClue.setInvolvePoliceName("无姓名数据"); + } + } } private static void generateThingDesc(Integer modelId, ModelClue modelClue, Map data) { @@ -1020,7 +1034,7 @@ public class ModelClueService extends ServiceImpl { } } - public static String generateNewSql(String originalSql, List uniqueKeys) { + public static String generateNewSql(String originalSql, List uniqueKeys, Integer modelId) { Pattern tablePattern = Pattern.compile("FROM\\s+(\\w+)", Pattern.CASE_INSENSITIVE); Matcher tableMatcher = tablePattern.matcher(originalSql); String tableName = ""; @@ -1028,6 +1042,9 @@ public class ModelClueService extends ServiceImpl { tableName = tableMatcher.group(1); } String originalFieldName = getKeyFieldName(originalSql); + if (modelId == 24) { //24号模型:警情未录入反馈人员信息 + return "SELECT a.*, b.fkrbh, b.fkrxm FROM " + tableName + " a left join dwd_asj_zhtx_fkd b on a.jjdbh = b.jjdbh " + "WHERE " + 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(",")) + ");"; }