Browse Source

新增16号模型:多次取保的异常数据

main
sjh 1 year ago
parent
commit
e5cd6b5d67
  1. 1
      src/main/java/com/biutag/supervision/mapper/ModelClueDataMapper.java
  2. 88
      src/main/java/com/biutag/supervision/service/ModelClueService.java

1
src/main/java/com/biutag/supervision/mapper/ModelClueDataMapper.java

@ -19,4 +19,5 @@ public interface ModelClueDataMapper extends BaseMapper<ModelClue> {
@Select("SELECT XM, JH FROM dwd_ry_zfba_baryxx WHERE ZJ = #{barID}")
Map<String, Object> selectBAR(String barID);
}

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

@ -185,6 +185,9 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
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<ModelClueMapper, ModelClue> {
}
private void setPerson(Integer modelId, ModelClue modelClue, Map<String, Object> 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<ModelClueMapper, ModelClue> {
}
}
}
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<String, Object> bar1;
Map<String, Object> bar2;
if (data.get("BAR1ID") != null && !data.get("BAR1ID").equals("")) {
@ -366,6 +369,11 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
+ ",立案日期 无数据"
+ ",当前案件状态为“" + 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<ModelClueMapper, ModelClue> {
return modelClues;
}
private void getModelCluesForModel16(String param, List<ModelClue> modelClues) {
System.out.println("模型16开始查询数据库");
List<String> 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<Map<String, Object>> sfzhList = modelClueDataMapper.selectByUniqueKeys(selectSfzh);
Map<String, Long> 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<Map<String, Object>> newModelClues = modelClueDataMapper.selectByUniqueKeys(selectSfzh2);
for (Map<String, Object> modelClue : newModelClues) {
if (!sfzhMap.containsKey((String) modelClue.get("sfzh"))) {
continue;
}
Long count = baseMapper.selectCount(new LambdaQueryWrapper<ModelClue>().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<SupExternalDepart>().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<String, Object> bar1 = modelClueDataMapper.selectBAR((String) modelClue.get("bar1id"));
Map<String, Object> 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<ModelClue> modelClues2, List<ModelClue> modelClues1 , int no) {
for (ModelClue modelClue2 : modelClues2) {
Iterator<ModelClue> iterator1 = modelClues1.iterator();

Loading…
Cancel
Save