From eb8882e1bdac28f0b2c40a92ab44447e72ad330d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E7=88=B1=E5=AD=A6=E4=B9=A0=E7=9A=84=E7=9F=B3?= =?UTF-8?q?=E5=90=8C=E5=AD=A6?= <2936013465@qq.com> Date: Thu, 21 Nov 2024 16:45:09 +0800 Subject: [PATCH 1/2] 2024/11/21 16:45 --- .../controller/datav/DataGobalController.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/main/java/com/biutag/supervision/controller/datav/DataGobalController.java b/src/main/java/com/biutag/supervision/controller/datav/DataGobalController.java index b0f5001..b216983 100644 --- a/src/main/java/com/biutag/supervision/controller/datav/DataGobalController.java +++ b/src/main/java/com/biutag/supervision/controller/datav/DataGobalController.java @@ -66,16 +66,6 @@ public class DataGobalController { return Result.success(data); } - public void updateProList(List proList, List gobalMapVoList, BiConsumer setter) { - for (GobalMapIconVo gobalMapIconVo : gobalMapVoList) { - for (CommonVo commonVo : proList) { - if (gobalMapIconVo.getName().equals(commonVo.getName())) { - Integer temp = Integer.parseInt(commonVo.getValue()); - setter.accept(gobalMapIconVo, Integer.parseInt(commonVo.getValue()) + temp); - } - } - } - } /** From f844ac9957b4fd818ce361f424e9ccfbcfddfa9d Mon Sep 17 00:00:00 2001 From: sjh Date: Thu, 21 Nov 2024 16:47:41 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E5=E5=8F=B7=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=EF=BC=9A=E9=87=8D=E7=82=B9=E4=BA=BA=E5=91=98=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E6=8A=A5=E8=AD=A6=E7=9B=91=E7=9D=A3=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../supervision/service/ModelClueService.java | 101 +++++++++++++++--- 1 file changed, 88 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/biutag/supervision/service/ModelClueService.java b/src/main/java/com/biutag/supervision/service/ModelClueService.java index 50653e5..6f19fe5 100644 --- a/src/main/java/com/biutag/supervision/service/ModelClueService.java +++ b/src/main/java/com/biutag/supervision/service/ModelClueService.java @@ -1,6 +1,7 @@ package com.biutag.supervision.service; import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -17,6 +18,7 @@ import com.biutag.supervision.pojo.param.ModelClueQueryParam; import com.biutag.supervision.pojo.vo.FileVo; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -59,6 +61,8 @@ public class ModelClueService extends ServiceImpl { private final StatisticsDepartMapper statisticsDepartMapper; + private final RedisTemplate redisTemplate; + public Page page(ModelClueQueryParam param) { if (Objects.nonNull(param.getModelIds()) && param.getModelIds().isEmpty()) { return new Page().setTotal(0).setRecords(new ArrayList<>()); @@ -198,19 +202,7 @@ public class ModelClueService extends ServiceImpl { public void generate(Integer modelId) { if (modelId == 1300) { - List modelClues = modelClueMapper.selectByModelId(103); - if (modelClues != null && !modelClues.isEmpty()) { - for (ModelClue modelClue : modelClues) { - SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper().eq(SupExternalDepart::getExternalId, modelClue.getInvolveDepartId()).last("LIMIT 1")); - if (supExternalDepart != null) { - if (supExternalDepart.getInternalId() != null) { - modelClueMapper.updateInvolveDepartId(modelClue.getId(), supExternalDepart.getInternalId()); - } - } - } - } else { - System.out.println("No records found for model_id 103."); - } + updateDepart(); return; } Model model = modelMapper.selectById(modelId); @@ -234,12 +226,32 @@ public class ModelClueService extends ServiceImpl { } } + private void updateDepart() { + List modelClues = modelClueMapper.selectByModelId(103); + if (modelClues != null && !modelClues.isEmpty()) { + for (ModelClue modelClue : modelClues) { + SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper().eq(SupExternalDepart::getExternalId, modelClue.getInvolveDepartId()).last("LIMIT 1")); + if (supExternalDepart != null) { + if (supExternalDepart.getInternalId() != null) { + modelClueMapper.updateInvolveDepartId(modelClue.getId(), supExternalDepart.getInternalId()); + } + } + } + } else { + System.out.println("No records found for model_id 103."); + } + return; + } + public List getModelClueBySql(String sql, Integer modelId) { List modelClues = new ArrayList<>(); if (modelId == 2) { // 2号模型:行政、刑事案件受立案不及时问题监督模型 return getModelCluesForModel2(sql, modelClues); } else if (modelId == 4) { // 4号模型:疑似漏登执法办案场所问题监督模型 return getModelCluesForModel4(sql, modelClues); + } else if (modelId == 5) { // 5号模型:重点人员重复报警监督模型 + getModelCluesForModel5(sql, modelClues); + return modelClues; } else if (modelId == 16) { // 16号模型:多次取保的异常数据 getModelCluesForModel16(sql, modelClues); return modelClues; @@ -321,6 +333,69 @@ public class ModelClueService extends ServiceImpl { return needsInsertModelClues; } + private void getModelCluesForModel5(String param, List modelClues) { + List jsonStrings = redisTemplate.boundListOps("call:point").range(0, -1); + if (jsonStrings != null) { + System.out.println("获取到的数据条数:" + jsonStrings.size()); + try { + for (Object jsonString : jsonStrings) { + JSONObject jsonObject = JSON.parseObject((String) jsonString); + String name = (String) jsonObject.get("name"); + String mobiles = (String) jsonObject.get("mobiles"); + String idCode = (String) jsonObject.get("idCode"); + String labels = (String) jsonObject.get("labels"); + Integer callCount = (Integer) jsonObject.get("callCount"); + Integer noUsefulCallCount = (Integer) jsonObject.get("noUsefulCallCount"); + String desc = (String) jsonObject.get("desc"); + String controlId = (String) jsonObject.get("controlId"); + String controlName = (String) jsonObject.get("controlName"); + ModelClue newModelClue = new ModelClue(); + LocalDate currentDate = LocalDate.now(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); + newModelClue.setUniqueKey(idCode + currentDate.format(formatter)); + newModelClue.setNegativeIdEx(idCode + currentDate.format(formatter)); + SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper().eq(SupExternalDepart::getExternalId, controlId).last("LIMIT 1")); + if (supExternalDepart != null) { + if (supExternalDepart.getInternalId() != null) { + newModelClue.setInvolveDepartId(supExternalDepart.getInternalId()); + } + if (supExternalDepart.getInternalShortName() != null) { + newModelClue.setInvolveDepartName(supExternalDepart.getInternalShortName()); + } + } + newModelClue.setData(JSONObject.toJSONString(jsonString)); + newModelClue.setDistributionState("0"); + String dateString = getDateString(currentDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); + if (callCount >= 5 && noUsefulCallCount >= 100) { + newModelClue.setThingDesc( + "发现" + newModelClue.getInvolveDepartName() + "管理的重点人员" + name + + "(身份证号:" + idCode + ")于" + dateString + "产生了" + callCount + + "条有效报警," + noUsefulCallCount + "条无效报警,报警电话为“" + + mobiles + "”请予以重点关注。"); + } else if (callCount >= 5) { + newModelClue.setThingDesc( + "发现" + newModelClue.getInvolveDepartName() + "管理的重点人员" + name + + "(身份证号:"+idCode+")于" + dateString + "产生了" + callCount + + "条有效报警,报警电话为“" + mobiles + "”请予以重点关注。"); + } else if (noUsefulCallCount >= 100) { + newModelClue.setThingDesc( + "发现" + newModelClue.getInvolveDepartName() + "管理的重点人员" + name + + "(身份证号:"+idCode+")于" + dateString + "产生了" + + noUsefulCallCount + "条无效报警,报警电话为“" + mobiles + "”请予以重点关注。"); + } else { + System.out.println("数据有误,idCode:" + idCode + "callCount:" + callCount + "noUsefulCallCount:" + noUsefulCallCount); + break; + } + modelClues.add(newModelClue); + } + } catch (Exception e) { + log.error("模型5执行失败", e); + } + } else { + System.out.println("Redis未找到key'call:point'"); + } + } + private List filterDataForModel26(List> allData) { List> filteredData = allData.stream().filter(map -> map.get("ajbh") != null && map.get("zjhm") != null).toList(); Map>>> groupedData = filteredData.stream()