diff --git a/src/main/java/com/biutag/supervision/mapper/ModelClueDataMapper.java b/src/main/java/com/biutag/supervision/mapper/ModelClueDataMapper.java index d7a8a46..3d1c1a1 100644 --- a/src/main/java/com/biutag/supervision/mapper/ModelClueDataMapper.java +++ b/src/main/java/com/biutag/supervision/mapper/ModelClueDataMapper.java @@ -19,4 +19,5 @@ public interface ModelClueDataMapper extends BaseMapper { @Select("SELECT XM, JH FROM dwd_ry_zfba_baryxx WHERE ZJ = #{barID}") Map selectBAR(String barID); + } diff --git a/src/main/java/com/biutag/supervision/service/ModelClueService.java b/src/main/java/com/biutag/supervision/service/ModelClueService.java index 68f98dd..96a08bd 100644 --- a/src/main/java/com/biutag/supervision/service/ModelClueService.java +++ b/src/main/java/com/biutag/supervision/service/ModelClueService.java @@ -185,6 +185,9 @@ public class ModelClueService extends ServiceImpl { return getModelCluesForModel2(sql, modelClues); } else if (modelId == 4) { // 4号模型:疑似漏登执法办案场所问题监督模型 return getModelCluesForModel4(sql, modelClues); + } else if (modelId == 16) { // 16号模型:多次取保的异常数据 + getModelCluesForModel16(sql, modelClues); + return modelClues; } else { System.out.println("模型" + modelId + "开始查询数据库"); modelClues = modelClueDataMapper.selectDataByDynamicSql(sql); @@ -225,7 +228,7 @@ public class ModelClueService extends ServiceImpl { } private void setPerson(Integer modelId, ModelClue modelClue, Map data) { - if (modelId == 3) { + if (modelId == 3) { // 执法区域人员表 if (data.get("bar1") != null && !data.get("bar1").equals("")) { if (data.get("bar2") != null && !data.get("bar2").equals("")) { modelClue.setInvolvePoliceName(data.get("bar1") + "," + data.get("bar2")); @@ -253,7 +256,7 @@ public class ModelClueService extends ServiceImpl { } } } - if (modelId == 10 || modelId == 11 || modelId == 12 || modelId == 13 || modelId == 14) { + if (modelId == 10 || modelId == 11 || modelId == 12 || modelId == 13 || modelId == 14 || modelId == 15) { // 案件基本信息表 Map bar1; Map bar2; if (data.get("BAR1ID") != null && !data.get("BAR1ID").equals("")) { @@ -366,6 +369,11 @@ public class ModelClueService extends ServiceImpl { + ",立案日期 无数据" + ",当前案件状态为“" + data.get("AJZTmc") + "”,立案不及时。"); + } else if (modelId == 15) { // 15号模型:未录入受害人员的异常数据 + modelClue.setThingDesc("该" + data.get("AJBZmc") + + "案件编号为" + getAjbh(data) + + ",受理日期为" + getDateString(data.get("SLRQ")) + + ",没有录入受害人。"); } } @@ -485,6 +493,82 @@ public class ModelClueService extends ServiceImpl { return modelClues; } + private void getModelCluesForModel16(String param, List modelClues) { + System.out.println("模型16开始查询数据库"); + List params = parseSqlForModel2(param); + String selectSfzh = "SELECT count(sfzh) as num, sfzh FROM dwd_wp_zfba_qbhsjds WHERE STR_TO_DATE(pzrq, '%Y%m%d%H%i%s') BETWEEN '" + params.get(0) + " 00:00:00' AND '" + params.get(1) + " 00:00:00' GROUP BY sfzh HAVING count(sfzh) > 2;"; + List> sfzhList = modelClueDataMapper.selectByUniqueKeys(selectSfzh); + Map sfzhMap = sfzhList.stream().filter(map -> map.get("sfzh") != null).collect(Collectors.toMap( + map -> (String) map.get("sfzh"), + map -> (long)map.get("num")) + ); + System.out.println("模型16查询数据库完毕"); + if (sfzhMap.isEmpty()) { + return; + } + String selectSfzh2 = "SELECT a.zj AS uniqueKey, a.sfzh AS negative_id, a.badwid AS involve_depart_id, a.badwmc AS involve_depart_name, a.bar1xm, a.bar2xm, a.bar1id, a.bar2id, a.sfzh, a.xm FROM dwd_wp_zfba_qbhsjds a INNER JOIN (SELECT sfzh, MAX(STR_TO_DATE(pzrq, '%Y%m%d%H%i%s')) AS max_create_time FROM dwd_wp_zfba_qbhsjds WHERE STR_TO_DATE(pzrq, '%Y%m%d%H%i%s') BETWEEN '" + params.get(0) + " 00:00:00' AND '" + params.get(1) + " 00:00:00' GROUP BY sfzh) b ON a.sfzh = b.sfzh AND STR_TO_DATE(a.pzrq, '%Y%m%d%H%i%s') = b.max_create_time;"; + List> newModelClues = modelClueDataMapper.selectByUniqueKeys(selectSfzh2); + for (Map modelClue : newModelClues) { + if (!sfzhMap.containsKey((String) modelClue.get("sfzh"))) { + continue; + } + Long count = baseMapper.selectCount(new LambdaQueryWrapper().eq(ModelClue::getNegativeId, modelClue.get("sfzh"))); + if (count > 0) { + continue; + } + ModelClue newModelClue = new ModelClue(); + newModelClue.setUniqueKey((String) modelClue.get("uniqueKey")); + newModelClue.setNegativeId((String) modelClue.get("negative_id")); + if (modelClue.get("involve_depart_id") != null) { + SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper().eq(SupExternalDepart::getExternalId, modelClue.get("involve_depart_id")).last("LIMIT 1")); + if (supExternalDepart != null) { + if (supExternalDepart.getInternalId() != null) { + newModelClue.setInvolveDepartId(supExternalDepart.getInternalId()); + } + if (supExternalDepart.getInternalShortName() != null) { + newModelClue.setInvolveDepartName(supExternalDepart.getInternalShortName()); + } + } + } + if (modelClue.get("bar1xm") != null) { + if (modelClue.get("bar2xm") != null) { + newModelClue.setInvolvePoliceName(modelClue.get("bar1xm") + "、" + modelClue.get("bar2xm")); + } else { + newModelClue.setInvolvePoliceName((String) modelClue.get("bar1xm")); + } + } else { + if (modelClue.get("bar2xm") != null) { + newModelClue.setInvolvePoliceName((String) modelClue.get("bar2xm")); + } else { + newModelClue.setInvolvePoliceName("无数据"); + } + } + Map bar1 = modelClueDataMapper.selectBAR((String) modelClue.get("bar1id")); + Map bar2 = modelClueDataMapper.selectBAR((String) modelClue.get("bar2id")); + if (bar1 != null && bar1.get("JH") != null) { + if (bar2 != null && bar2.get("JH") != null) { + newModelClue.setInvolvePoliceEmpNo(bar1.get("JH") + "、" + bar2.get("JH")); + } else { + newModelClue.setInvolvePoliceEmpNo((String) bar1.get("JH")); + } + } else { + if (bar2 != null && bar2.get("JH") != null) { + newModelClue.setInvolvePoliceEmpNo((String) bar2.get("JH")); + } else { + newModelClue.setInvolvePoliceEmpNo("无数据"); + } + } + newModelClue.setData(JSONObject.toJSONString(modelClue)); + newModelClue.setStatus(0); + newModelClue.setThingDesc("在" + params.get(0) + "到" + params.get(1) + "之间," + + (String) modelClue.get("xm") + + "(身份证号:" + modelClue.get("sfzh") + ")的取保次数为" + + sfzhMap.get((String) modelClue.get("sfzh")) + "次,大于2次,属于多次取保异常数据。"); + modelClues.add(newModelClue); + sfzhMap.remove((String) modelClue.get("sfzh")); + } + } + private void mergeModelClues(List modelClues2, List modelClues1 , int no) { for (ModelClue modelClue2 : modelClues2) { Iterator iterator1 = modelClues1.iterator();