From 97c56c9af6630cbdec33591674ab96c9ef2c0235 Mon Sep 17 00:00:00 2001 From: wxc <191104855@qq.com> Date: Tue, 28 Oct 2025 14:59:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FileController.java | 2 +- .../controller/datav/RiskDataController1.java | 208 ++++++++++++++++++ .../mapper/StatisticsGroupMapper.java | 9 + .../supervision/service/ModelClueService.java | 94 -------- .../supervision/service/SupTaskService.java | 8 +- src/main/resources/mapper/RpcApplyMapper.xml | 10 +- .../mapper/StatisticsGroupMapper.xml | 19 ++ 7 files changed, 249 insertions(+), 101 deletions(-) create mode 100644 src/main/java/com/biutag/supervision/controller/datav/RiskDataController1.java create mode 100644 src/main/resources/mapper/StatisticsGroupMapper.xml diff --git a/src/main/java/com/biutag/supervision/controller/FileController.java b/src/main/java/com/biutag/supervision/controller/FileController.java index 00b7ca4..749a353 100644 --- a/src/main/java/com/biutag/supervision/controller/FileController.java +++ b/src/main/java/com/biutag/supervision/controller/FileController.java @@ -75,7 +75,7 @@ public class FileController { @ResponseBody @GetMapping("base64") public Result getBase64(String filepath) throws IOException { - if (StrUtil.isBlank(filepath)) { + if (StrUtil.isBlank(filepath) || "undefined".equals(filepath)) { return Result.success(null); } FileBase64 fileBase64 = fileBase64Mapper.selectById(filepath); diff --git a/src/main/java/com/biutag/supervision/controller/datav/RiskDataController1.java b/src/main/java/com/biutag/supervision/controller/datav/RiskDataController1.java new file mode 100644 index 0000000..d59faee --- /dev/null +++ b/src/main/java/com/biutag/supervision/controller/datav/RiskDataController1.java @@ -0,0 +1,208 @@ +package com.biutag.supervision.controller.datav; + +import cn.hutool.core.date.DateUtil; +import com.biutag.supervision.mapper.StatisticsGroupMapper; +import com.biutag.supervision.pojo.Result; +import com.biutag.supervision.pojo.dto.common.BarItem; +import com.biutag.supervision.pojo.vo.ProblemSourceStatisticsVo; +import com.biutag.supervision.pojo.vo.RiskStatisticsVo; +import com.biutag.supervision.service.ProblemSourceService; +import com.biutag.supervision.service.RiskStatisticsService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +/** + * @author kami on 2024-11-16 19:16:04 + * @version 0.0.1 + * @since 1.8 + */ +@Slf4j +@RestController +@RequestMapping("/datav1/risk") +@AllArgsConstructor +public class RiskDataController1 { + + private final ProblemSourceService sourceService; + + private final RiskStatisticsService statisticsService; + + private final StatisticsGroupMapper statisticsGroupMapper; + + //数量统计 + @GetMapping("/total/statistics") + public Result totalStatistics(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime) { + endTime = DateUtil.endOfDay(endTime); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + String beginTimeStr = dateFormat.format(beginTime); + String endTimeStr = dateFormat.format(endTime); + return Result.success(sourceService.totalStatistics(beginTimeStr, endTimeStr)); + } + + // 分县市局-问题数 + @GetMapping("/city/negative") + public Result> cityNegative(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime, @RequestParam String groupId) { + endTime = DateUtil.endOfDay(endTime); + return Result.success(statisticsGroupMapper.selectCityNegative(beginTime, endTime, groupId)); + } + + // 分县市局-涉及人数 + @GetMapping("/city/negativePerNumber") + public Result> cityNegativePerNumber(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime, @RequestParam String groupId) { + endTime = DateUtil.endOfDay(endTime); + + return Result.success(); + } + + // 分县市局-人均问题数 + @GetMapping("/city/negativePerCapita") + public Result> cityNegativePerCapita(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime, @RequestParam String groupId) { + endTime = DateUtil.endOfDay(endTime); + + return Result.success(); + } + + // 派出所/交警-问题数 + @GetMapping("/three/negative") + public Result> threeNegative(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime, @RequestParam String groupId) { + endTime = DateUtil.endOfDay(endTime); + + return Result.success(); + } + + // 派出所/交警-涉及人数 + @GetMapping("/three/negativePerNumber") + public Result> riskOrgCarStatistics(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime, @RequestParam String type) { + endTime = DateUtil.endOfDay(endTime); + + return Result.success(); + } + + // 民警 问题发生率 + @GetMapping("/three/negativePerCapita") + public Result> riskPoliceAStatistics(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime, @RequestParam String type) { + endTime = DateUtil.endOfDay(endTime); + + return Result.success(); + } + + // 辅警/协警 问题发生率 + @GetMapping("/risk/police/b/statistics") + public Result> riskPoliceBStatistics(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime, @RequestParam String type) { + endTime = DateUtil.endOfDay(endTime); + + return Result.success(); + } + + @GetMapping("/risk/leader/statistics") + public Result> riskLeaderStatistics(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime, @RequestParam String type) { + endTime = DateUtil.endOfDay(endTime); + + return Result.success(); + } + + // **********问题数************* + // 分县市局-中业务量 + @GetMapping("/area/negative/statistics") + public Result> areaNegativeStatistics(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime, @RequestParam String type) { + endTime = DateUtil.endOfDay(endTime); + + return Result.success(); + } + + // 派出所-中业务量 + @GetMapping("/org/negative/statistics") + public Result> orgNegativeStatistics(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime, @RequestParam String type) { + endTime = DateUtil.endOfDay(endTime); + + return Result.success(); + } + + // 交警大队-中业务量 + @GetMapping("/org/car/negative/statistics") + public Result> orgCarNegativeStatistics(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime, @RequestParam String type) { + + return Result.success(); + } + + // 民警 问题数 + @GetMapping("/police/a/negative/statistics") + public Result> policeANegativeStatistics(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime, @RequestParam String type) { + + return Result.success(); + } + + @GetMapping("/police/b/negative/statistics") + public Result> policeBNegativeStatistics(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime, @RequestParam String type) { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + String beginTimeStr = dateFormat.format(beginTime); + String endTimeStr = dateFormat.format(endTime); + String sql = ""; + if (type.equals("paichusuo")) { + sql = "SELECT d.blameIdCode, d.blameName membersName, COUNT(DISTINCT c.id) AS clueNumber, COUNT(DISTINCT IF(c.checkStatus = 1 OR c.checkStatus = 2, c.id, 0)) - 1 AS problemNumber FROM statistics_depart a INNER JOIN negative c ON a.departId = c.involveDepartId INNER JOIN negative_blame d ON c.id = d.negativeId AND d.blameIdCode IS NOT NULL WHERE groupId = 10 AND d.ivPersonTypeCode != 1 AND c.discoveryTime BETWEEN '" + + beginTimeStr + " 00:00:00' AND '" + endTimeStr + " 23:59:59' GROUP BY d.blameIdCode, blameName ORDER BY problemNumber DESC LIMIT 10;"; + } else if (type.equals("jiaojing")) { + sql = "SELECT d.blameIdCode, d.blameName membersName, COUNT(DISTINCT c.id) AS clueNumber, COUNT(DISTINCT IF(c.checkStatus = 1 OR c.checkStatus = 2, c.id, 0)) - 1 AS problemNumber FROM statistics_depart a INNER JOIN negative c ON a.departId = c.involveDepartId INNER JOIN negative_blame d ON c.id = d.negativeId AND d.blameIdCode IS NOT NULL WHERE groupId = 11 AND d.ivPersonTypeCode != 1 AND c.discoveryTime BETWEEN '" + + beginTimeStr + " 00:00:00' AND '" + endTimeStr + " 23:59:59' GROUP BY d.blameIdCode, blameName ORDER BY problemNumber DESC LIMIT 10;"; + } + return Result.success(statisticsService.riskStatisticsBigOrg(sql, "problemNumber")); + } + + @GetMapping("/police/leader/negative/statistics") + public Result> policeLeaderNegativeStatistics(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime, @RequestParam String type) { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + String beginTimeStr = dateFormat.format(beginTime); + String endTimeStr = dateFormat.format(endTime); + String sql = ""; + if (type.equals("paichusuo")) { + sql = "SELECT d.leadIdCode, d.leadName membersName, COUNT(DISTINCT c.id) AS clueNumber, COUNT(DISTINCT IF(c.checkStatus = 1 OR c.checkStatus = 2, c.id, 0)) - 1 AS problemNumber, COUNT(DISTINCT d.blameIdCode) AS cluePersonNumber, COUNT(DISTINCT IF(c.checkStatus = 1 OR c.checkStatus = 2, d.blameIdCode, 0)) - 1 AS problemPersonNumber FROM statistics_depart a INNER JOIN negative c ON a.departId = c.involveDepartId INNER JOIN negative_blame d ON c.id = d.negativeId AND d.blameIdCode IS NOT NULL WHERE groupId = 10 AND d.leadIdCode IS NOT NULL AND c.discoveryTime BETWEEN '" + + beginTimeStr + " 00:00:00' AND '" + endTimeStr + " 23:59:59' GROUP BY d.leadIdCode, d.leadName ORDER BY cluePersonNumber DESC LIMIT 10;"; + } else if (type.equals("jiaojing")) { + sql = "SELECT d.leadIdCode, d.leadName membersName, COUNT(DISTINCT c.id) AS clueNumber, COUNT(DISTINCT IF(c.checkStatus = 1 OR c.checkStatus = 2, c.id, 0)) - 1 AS problemNumber, COUNT(DISTINCT d.blameIdCode) AS cluePersonNumber, COUNT(DISTINCT IF(c.checkStatus = 1 OR c.checkStatus = 2, d.blameIdCode, 0)) - 1 AS problemPersonNumber FROM statistics_depart a INNER JOIN negative c ON a.departId = c.involveDepartId INNER JOIN negative_blame d ON c.id = d.negativeId AND d.blameIdCode IS NOT NULL WHERE groupId = 11 AND d.leadIdCode IS NOT NULL AND c.discoveryTime BETWEEN '" + + beginTimeStr + " 00:00:00' AND '" + endTimeStr + " 23:59:59' GROUP BY d.leadIdCode, d.leadName ORDER BY cluePersonNumber DESC LIMIT 10;"; + } + return Result.success(statisticsService.riskStatisticsBigOrg(sql, "problemNumber")); + } + + // **********问题率************* + // 分县市局-低业务量 + @GetMapping("/area/rate/statistics") + public Result> areaRateStatistics(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime, @RequestParam String type) { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + String beginTimeStr = dateFormat.format(beginTime); + String endTimeStr = dateFormat.format(endTime); + String sql = "SELECT a.membersCode, a.membersName, COUNT(DISTINCT c.id) AS problemNumber, COUNT(DISTINCT d.blameIdCode) AS personNumber, ROUND(AVG(e.totalPersonNumber), 0) AS totalPersonNumber, ROUND(COUNT(DISTINCT c.id) / AVG(e.totalPersonNumber), 1) AS avgProblemNumber FROM negative_group_members a INNER JOIN sup_depart b ON a.membersCode = b.pid INNER JOIN (SELECT membersCode, membersName, SUM(police_size + aux_size) totalPersonNumber FROM negative_group_members a1, sup_depart a2, sup_depart_police_size a3 WHERE a1.membersCode = a2.pid AND a2.id = a3.depart_id GROUP BY membersCode, membersName) e ON a.membersCode = e.membersCode INNER JOIN negative c ON b.id = c.involveDepartId LEFT JOIN negative_blame d ON c.id = d.negativeId WHERE groupId = 25 AND checkStatus IN (1, 2) AND c.discoveryTime BETWEEN '" + + beginTimeStr + " 00:00:00' AND '" + endTimeStr + " 23:59:59' GROUP BY a.membersCode, a.membersName ORDER BY problemNumber DESC;"; + return Result.success(statisticsService.riskStatisticsBigOrg(sql, type)); + } + + // 派出所-低业务量 + @GetMapping("/org/rate/statistics") + public Result> orgRateStatistics(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime, @RequestParam String type) { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + String beginTimeStr = dateFormat.format(beginTime); + String endTimeStr = dateFormat.format(endTime); + String sql = "SELECT a.membersCode, a.membersName, COUNT(DISTINCT c.id) AS problemNumber, COUNT(DISTINCT d.blameIdCode) AS personNumber, ROUND(AVG(b.police_size + b.aux_size), 0) AS totalPersonNumber, ROUND(COUNT(DISTINCT c.id) / AVG(b.police_size + b.aux_size), 1) AS avgProblemNumber FROM negative_group_members a INNER JOIN sup_depart_police_size b ON a.membersCode = b.depart_id INNER JOIN negative c ON a.membersCode = c.involveDepartId LEFT JOIN negative_blame d ON c.id = d.negativeId WHERE groupId = 19 AND checkStatus IN (1, 2) AND c.discoveryTime BETWEEN '" + + beginTimeStr + " 00:00:00' AND '" + endTimeStr + " 23:59:59' GROUP BY a.membersCode, a.membersName ORDER BY problemNumber DESC LIMIT 10;"; + return Result.success(statisticsService.riskStatisticsBigOrg(sql, type)); + } + + // 交警大队-低业务量 + @GetMapping("/org/car/rate/statistics") + public Result> orgCarRateStatistics(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime, @RequestParam String type) { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + String beginTimeStr = dateFormat.format(beginTime); + String endTimeStr = dateFormat.format(endTime); + String sql = "SELECT a.membersCode, a.membersName, COUNT(DISTINCT c.id) AS problemNumber, COUNT(DISTINCT d.blameIdCode) AS personNumber, ROUND(AVG(b.police_size + b.aux_size), 0) AS totalPersonNumber, ROUND(COUNT(DISTINCT c.id) / AVG(b.police_size + b.aux_size), 1) AS avgProblemNumber FROM negative_group_members a INNER JOIN sup_depart_police_size b ON a.membersCode = b.depart_id INNER JOIN negative c ON a.membersCode = c.involveDepartId LEFT JOIN negative_blame d ON c.id = d.negativeId WHERE groupId = 22 AND checkStatus IN (1, 2) AND c.discoveryTime BETWEEN '" + + beginTimeStr + " 00:00:00' AND '" + endTimeStr + " 23:59:59' GROUP BY a.membersCode, a.membersName ORDER BY problemNumber DESC LIMIT 10;"; + return Result.success(statisticsService.riskStatisticsBigOrg(sql, type)); + } +} diff --git a/src/main/java/com/biutag/supervision/mapper/StatisticsGroupMapper.java b/src/main/java/com/biutag/supervision/mapper/StatisticsGroupMapper.java index 4285415..a3f675e 100644 --- a/src/main/java/com/biutag/supervision/mapper/StatisticsGroupMapper.java +++ b/src/main/java/com/biutag/supervision/mapper/StatisticsGroupMapper.java @@ -2,9 +2,11 @@ package com.biutag.supervision.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.biutag.supervision.pojo.domain.GroupMembers; +import com.biutag.supervision.pojo.dto.common.BarItem; import com.biutag.supervision.pojo.entity.StatisticsGroup; import org.apache.ibatis.annotations.Select; +import java.util.Date; import java.util.List; import java.util.Map; @@ -28,4 +30,11 @@ public interface StatisticsGroupMapper extends BaseMapper { @Select("${newSql}") List> selectByUniqueKeys(@org.apache.ibatis.annotations.Param("newSql") String newSql); + List selectCityNegative(Date beginTime, Date endTime, String groupId); + + List selectCityNegativePerNumber(Date beginTime, Date endTime, String groupId); + + List selectCityNegativePerCapita(Date beginTime, Date endTime, String groupId); + + } diff --git a/src/main/java/com/biutag/supervision/service/ModelClueService.java b/src/main/java/com/biutag/supervision/service/ModelClueService.java index 87f588b..d764157 100644 --- a/src/main/java/com/biutag/supervision/service/ModelClueService.java +++ b/src/main/java/com/biutag/supervision/service/ModelClueService.java @@ -5,7 +5,6 @@ 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; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.biutag.supervision.constants.enums.*; @@ -276,99 +275,6 @@ public class ModelClueService extends ServiceImpl { 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; - } else if (modelId == 18) { // 18号模型:相同时间地点抓捕出现多条案件编号的异常数据 - getModelCluesForModel18(sql, modelClues); - return modelClues; - } else if (modelId == 20) { // 20号模型:连续7天上传散油购销记录小于10的异常数据 - getModelCluesForModel20(sql, modelClues); - return modelClues; - } else if (modelId == 22) { // 22号模型:执法记录仪使用不规范问题 - getModelCluesForModel22(sql, modelClues); - return modelClues; - } else if (modelId == 25) { // 25号模型:重点人员管控人数过多 - getModelCluesForModel25(sql, modelClues); - return modelClues; - } else if (modelId == 103) { // 103号模型:接处警不及时的异常数据 - getModelCluesForModel103(sql, modelClues); - return modelClues; - } else if (modelId == 104) { // 模型104:大量变更接警性质的预警模型 - getModelCluesForModel104(sql, modelClues); - return modelClues; - } else if (modelId == 105) { // 模型105:近一月同一人同一类型问题出现3次以上的异常数据 - getModelCluesForModel105(sql, modelClues); - return modelClues; - } else { - System.out.println("模型" + modelId + "开始查询数据库"); - modelClues = modelClueDataMapper.selectDataByDynamicSql(sql); - System.out.println("模型" + modelId + "查询数据库完毕,数量为:" + modelClues.size()); - } - List uniqueKeys = modelClues.stream().map(ModelClue::getUniqueKey).filter(k -> k != null && !k.isEmpty()).toList(); - List oldUniqueKeys = new ArrayList<>(); - // 无需更新状态的模型 - if (modelId != 19 && modelId != 26 && modelId != 27 && modelId != 28 && modelId != 30 && modelId != 100 ) { - 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()) { - modelClueMapper.update(null, new LambdaUpdateWrapper().in(ModelClue::getUniqueKey, changeStatusIds).set(ModelClue::getDistributionState, "2")); - } - } - List needsInsertIds = new ArrayList<>(); - for (String uniqueKey : uniqueKeys) { - if (oldUniqueKeys.isEmpty()) { - needsInsertIds.addAll(uniqueKeys); - break; - } - if (!oldUniqueKeys.contains(uniqueKey)) { - needsInsertIds.add(uniqueKey); - } - } - if (needsInsertIds.isEmpty()) { - return new ArrayList<>(); - } - List needsInsertModelClues = modelClues.stream().filter(item -> needsInsertIds.contains(item.getUniqueKey())).toList(); - String newSql = generateNewSql(sql, needsInsertIds, modelId); - System.out.println("开始查询新sql" + newSql); - List> allData = modelClueDataMapper.selectByUniqueKeys(newSql); - if (modelId == 26) { - return filterDataForModel26(allData); - } - System.out.println("查询新sql完成,结果数量:" + allData.size()); - String originalFieldName = getKeyFieldName(sql); - for (ModelClue modelClue : needsInsertModelClues) { - for (Map data : allData) { - String keyColumn = (String) data.get(originalFieldName); - if (Objects.equals(keyColumn, modelClue.getUniqueKey())) { - modelClue.setData(JSONObject.toJSONString(data)); - modelClue.setDistributionState("0"); - SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper().eq(SupExternalDepart::getExternalId, modelClue.getInvolveDepartId()).last("LIMIT 1")); - if (supExternalDepart != null && supExternalDepart.getInternalShortName() != null && !supExternalDepart.getInternalShortName().isEmpty()) { - modelClue.setInvolveDepartName(supExternalDepart.getInternalShortName()); - modelClue.setInvolveDepartId(supExternalDepart.getInternalId()); - } - setPerson(modelId, modelClue, data); - generateThingDesc(modelId, modelClue, data); - break; - } - } - } - if (modelId == 15) { - needsInsertModelClues = needsInsertModelClues.stream().filter(map -> map != null && map.getThingDesc() != null && !map.getThingDesc().contains("互殴")).collect(Collectors.toList()); - } - return needsInsertModelClues; - } - private void getModelCluesForModel5(String param, List modelClues) { // List jsonStrings = redisTemplate.opsForList().range("call:point", 0, -1); diff --git a/src/main/java/com/biutag/supervision/service/SupTaskService.java b/src/main/java/com/biutag/supervision/service/SupTaskService.java index 4b1ad9c..284095b 100644 --- a/src/main/java/com/biutag/supervision/service/SupTaskService.java +++ b/src/main/java/com/biutag/supervision/service/SupTaskService.java @@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.biutag.supervision.common.UserContextHolder; +import com.biutag.supervision.constants.AppConstants; +import com.biutag.supervision.constants.enums.RoleCodeEnum; import com.biutag.supervision.constants.enums.TaskTypeEnum; import com.biutag.supervision.constants.enums.WorkStatusEnum; import com.biutag.supervision.mapper.SupTaskMapper; @@ -22,6 +24,7 @@ import com.biutag.supervision.pojo.vo.TaskVo; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -54,6 +57,10 @@ public class SupTaskService extends ServiceImpl { } public Page pageTaskData(TaskQueryParam queryParam){ + UserAuth user = UserContextHolder.getCurrentUser(); + if (!AppConstants.USER_TYPE_SUPER.equals(user.getUserType()) || !user.getRoleCodes().contains(RoleCodeEnum.FIRST_ADMIN.getCode())) { + return new Page().setTotal(0).setRecords(new ArrayList<>()); + } QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq(StrUtil.isNotEmpty( queryParam.getTaskStatus()), "t.task_status", queryParam.getTaskStatus()) .like(StrUtil.isNotEmpty(queryParam.getTaskName()), "t.task_name", queryParam.getTaskName()) @@ -67,7 +74,6 @@ public class SupTaskService extends ServiceImpl { s.setPersons(problems.stream().map(SupTaskPerson::getName).distinct().collect(Collectors.joining(","))); } }); - return page; } diff --git a/src/main/resources/mapper/RpcApplyMapper.xml b/src/main/resources/mapper/RpcApplyMapper.xml index 86107d3..07b92f5 100644 --- a/src/main/resources/mapper/RpcApplyMapper.xml +++ b/src/main/resources/mapper/RpcApplyMapper.xml @@ -5,11 +5,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" diff --git a/src/main/resources/mapper/StatisticsGroupMapper.xml b/src/main/resources/mapper/StatisticsGroupMapper.xml new file mode 100644 index 0000000..ddcfee7 --- /dev/null +++ b/src/main/resources/mapper/StatisticsGroupMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + +