From 5b99524e1c5a6b97341448d2e0f003967d43c52d Mon Sep 17 00:00:00 2001 From: sjh Date: Mon, 11 Nov 2024 17:23:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E20=E5=8F=B7=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=EF=BC=9A=E8=BF=9E=E7=BB=AD7=E5=A4=A9=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E6=95=A3=E6=B2=B9=E8=B4=AD=E9=94=80=E8=AE=B0=E5=BD=95=E5=B0=8F?= =?UTF-8?q?=E4=BA=8E10=E7=9A=84=E5=BC=82=E5=B8=B8=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../supervision/service/ModelClueService.java | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/biutag/supervision/service/ModelClueService.java b/src/main/java/com/biutag/supervision/service/ModelClueService.java index 8f5effa..211a2b0 100644 --- a/src/main/java/com/biutag/supervision/service/ModelClueService.java +++ b/src/main/java/com/biutag/supervision/service/ModelClueService.java @@ -225,6 +225,9 @@ public class ModelClueService extends ServiceImpl { } else if (modelId == 18) { // 18号模型:相同时间地点抓捕出现多条案件编号的异常数据 getModelCluesForModel18(sql, modelClues); return modelClues; + } else if (modelId == 20) { // 20号模型:连续7天上传散油购销记录小于10的异常数据 + getModelCluesForModel20(sql, modelClues); + return modelClues; } else { System.out.println("模型" + modelId + "开始查询数据库"); modelClues = modelClueDataMapper.selectDataByDynamicSql(sql); @@ -233,7 +236,7 @@ public class ModelClueService extends ServiceImpl { List uniqueKeys = modelClues.stream().map(ModelClue::getUniqueKey).filter(k -> k != null && !k.isEmpty()).toList(); List oldUniqueKeys = new ArrayList<>(); // 无需更新状态的模型 - if (modelId != 18) { + if (modelId != 19) { oldUniqueKeys = this.listObjs(new LambdaQueryWrapper().select(ModelClue::getUniqueKey).ne(ModelClue::getDistributionState, "2").eq(ModelClue::getModelId, modelId), String::valueOf); List changeStatusIds = oldUniqueKeys.stream().filter(item -> !uniqueKeys.contains(item)).toList(); if (!changeStatusIds.isEmpty()) { @@ -662,6 +665,35 @@ public class ModelClueService extends ServiceImpl { } } + private void getModelCluesForModel20(String param, List modelClues) { + 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> sqlList = modelClueDataMapper.selectByUniqueKeys(sql); + System.out.println("模型20查询数据库完毕"); + if (sqlList.isEmpty()) { + return; + } + for (Map map : sqlList) { + ModelClue newModelClue = new ModelClue(); + newModelClue.setUniqueKey((String) map.get("tjrq") + map.get("dwmc")); + newModelClue.setNegativeIdEx((String) map.get("tjrq") + map.get("dwmc")); + newModelClue.setInvolveDepartName((String) map.get("pcsmc")); + SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper().eq(SupExternalDepart::getInternalShortName, map.get("pcsmc")).last("LIMIT 1")); + if (supExternalDepart != null) { + if (supExternalDepart.getInternalId() != null) { + newModelClue.setInvolveDepartId(supExternalDepart.getInternalId()); + } + } + newModelClue.setData(JSONObject.toJSONString(map)); + newModelClue.setDistributionState("0"); + newModelClue.setThingDesc( + getDateString((String) map.get("tjrq")) + "灵敏感知系统发现" + newModelClue.getInvolveDepartName() + "合作的" + map.get("dwmc") + + "的上报数量为" + map.get("cnt") + "," + map.get("result") + + ",请予以重点关注。"); + modelClues.add(newModelClue); + } + } + private void mergeModelClues(List modelClues2, List modelClues1 , int no) { for (ModelClue modelClue2 : modelClues2) { Iterator iterator1 = modelClues1.iterator();