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); - } - } - } - } /** 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()