diff --git a/src/main/java/com/biutag/supervision/controller/datav/RiskDataController.java b/src/main/java/com/biutag/supervision/controller/datav/RiskDataController.java index d0bfbec..725ff0c 100644 --- a/src/main/java/com/biutag/supervision/controller/datav/RiskDataController.java +++ b/src/main/java/com/biutag/supervision/controller/datav/RiskDataController.java @@ -24,7 +24,7 @@ import java.util.List; */ @Slf4j @RestController -@RequestMapping("/datav/risk") +@RequestMapping("/datav1/risk") @AllArgsConstructor public class RiskDataController { diff --git a/src/main/java/com/biutag/supervision/controller/datav/RiskDataController1.java b/src/main/java/com/biutag/supervision/controller/datav/RiskDataController1.java index d59faee..27b6d96 100644 --- a/src/main/java/com/biutag/supervision/controller/datav/RiskDataController1.java +++ b/src/main/java/com/biutag/supervision/controller/datav/RiskDataController1.java @@ -1,13 +1,13 @@ package com.biutag.supervision.controller.datav; import cn.hutool.core.date.DateUtil; +import com.biutag.supervision.constants.enums.BlameType; +import com.biutag.supervision.constants.enums.PersonTypeEnum; 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; @@ -27,14 +27,12 @@ import java.util.List; */ @Slf4j @RestController -@RequestMapping("/datav1/risk") +@RequestMapping("/datav/risk") @AllArgsConstructor public class RiskDataController1 { private final ProblemSourceService sourceService; - private final RiskStatisticsService statisticsService; - private final StatisticsGroupMapper statisticsGroupMapper; //数量统计 @@ -48,161 +46,57 @@ public class RiskDataController1 { } // 分县市局-问题数 - @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) { + @GetMapping("/negative/city") + public Result> cityNegative(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime, @RequestParam String groupId, + String type) { endTime = DateUtil.endOfDay(endTime); - - return Result.success(); + if ("涉及问题数".equals(type)) { + return Result.success(statisticsGroupMapper.selectNegativeStatisticsByCity(beginTime, endTime, groupId)); + } + if ("涉及人数".equals(type)) { + return Result.success(statisticsGroupMapper.selectNegativePerNumberStatisticsByCity(beginTime, endTime, groupId)); + } + // 人均问题数(查实) + return Result.success(statisticsGroupMapper.selectNegativePerCapitaStatisticsByCity(beginTime, endTime, groupId)); } - // 分县市局-人均问题数 - @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) { + @GetMapping("/negative/three") + public Result> threeNegative(@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date beginTime, @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime, @RequestParam String groupId, + String type) { endTime = DateUtil.endOfDay(endTime); - - return Result.success(); + if ("涉及问题数".equals(type)) { + return Result.success(statisticsGroupMapper.selectNegativeStatisticsByThree(beginTime, endTime, groupId)); + } + if ("涉及人数".equals(type)) { + return Result.success(statisticsGroupMapper.selectNegativePerNumberStatisticsByThree(beginTime, endTime, groupId)); + } + // 人均问题数(查实) + return Result.success(statisticsGroupMapper.selectNegativePerCapitaStatisticsByThree(beginTime, endTime, groupId)); } - @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) { + // 领导问题数 + @GetMapping("/negative/lead") + public Result> leadNegative(@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(); + return Result.success(statisticsGroupMapper.selectNegativeStatistics(beginTime, endTime, groupId, BlameType.department.name(), List.of(PersonTypeEnum.police.getValue()))); } - // **********问题数************* - // 分县市局-中业务量 - @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) { + // 民警问题数 + @GetMapping("/negative/police") + public Result> policeNegative(@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(); + return Result.success(statisticsGroupMapper.selectNegativeStatistics(beginTime, endTime, groupId, BlameType.personal.name(), List.of(PersonTypeEnum.police.getValue()))); } - // 派出所-中业务量 - @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) { + // 民辅警问题数 + @GetMapping("/negative/aux") + public Result> auxNegative(@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(); + List personTypes = List.of(PersonTypeEnum.works.getValue(), PersonTypeEnum.aux.getValue(), PersonTypeEnum.clerk.getValue(), PersonTypeEnum.xj.getValue()); + return Result.success(statisticsGroupMapper.selectNegativeStatistics(beginTime, endTime, groupId, BlameType.personal.name(), personTypes)); } - // 交警大队-中业务量 - @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/controller/system/DepartController.java b/src/main/java/com/biutag/supervision/controller/system/DepartController.java index b406473..2059373 100644 --- a/src/main/java/com/biutag/supervision/controller/system/DepartController.java +++ b/src/main/java/com/biutag/supervision/controller/system/DepartController.java @@ -14,6 +14,7 @@ import com.biutag.supervision.pojo.entity.SupDepart; import com.biutag.supervision.pojo.param.DepartQueryParam; import com.biutag.supervision.pojo.param.DepartTreeListParam; import com.biutag.supervision.pojo.vo.DepartTree; +import com.biutag.supervision.service.SupDepartPoliceSizeService; import com.biutag.supervision.service.SupDepartService; import com.biutag.supervision.service.SupPoliceService; import jakarta.validation.ValidationException; @@ -33,6 +34,8 @@ public class DepartController { public final SupPoliceService policeService; + private final SupDepartPoliceSizeService departPoliceSizeService; + @GetMapping public Result> treeList(DepartTreeListParam departTreeListParam) { return Result.success(departService.buildTreeByParam(departTreeListParam)); @@ -138,4 +141,19 @@ public class DepartController { return Result.success(List.of(root)); } + @RequestMapping("updatePoliceSize") + public Result updatePoliceSize() { + // 三级机构 + List departs = departService.list(new LambdaQueryWrapper().eq(SupDepart::getLevel, 3)); + departs.forEach(item -> { + departPoliceSizeService.saveOrUpdate(item.getId()); + }); + // 分县市局 + List secondDeparts = departService.list(new LambdaQueryWrapper().eq(SupDepart::getStatisticsGroupId, 3)); + secondDeparts.forEach(item -> { + departPoliceSizeService.saveOrUpdate(item.getId()); + }); + return Result.success(); + } + } diff --git a/src/main/java/com/biutag/supervision/job/DepartJob.java b/src/main/java/com/biutag/supervision/job/DepartJob.java index aea5c4f..dfffbe7 100644 --- a/src/main/java/com/biutag/supervision/job/DepartJob.java +++ b/src/main/java/com/biutag/supervision/job/DepartJob.java @@ -2,17 +2,15 @@ package com.biutag.supervision.job; import cn.hutool.core.util.NumberUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.biutag.supervision.constants.enums.InspectCaseEnum; +import com.biutag.supervision.controller.system.DepartController; import com.biutag.supervision.pojo.entity.BusinessDepart; import com.biutag.supervision.pojo.entity.DepartNegativeRate; import com.biutag.supervision.pojo.entity.Negative; import com.biutag.supervision.pojo.entity.SupDepart; import com.biutag.supervision.service.*; import com.biutag.supervision.util.ScoreRule; -import jakarta.annotation.PostConstruct; import lombok.RequiredArgsConstructor; -import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -32,7 +30,7 @@ public class DepartJob { private final SupDepartService departService; - private final SupDepartPoliceSizeService departPoliceSizeService; + private final DepartNegativeRateService departNegativeRateService; @@ -40,23 +38,21 @@ public class DepartJob { private final NegativeService negativeService; + private final DepartController departController; + /** * 每天更新一次 */ @Scheduled(cron = "0 0 0 * * ?") public void updatePoliceSize() { - List departs = departService.list(new LambdaQueryWrapper().eq(SupDepart::getLevel, 3)); - departs.forEach(item -> { - departPoliceSizeService.saveOrUpdate(item.getId()); - }); - + departController.updatePoliceSize(); } /** * 每月1号零点更新 */ - @Scheduled(cron = "0 0 1 * * ?") +// @Scheduled(cron = "0 0 1 * * ?") // @PostConstruct public void updateDepartNegativeRate() { // 10 派出所 diff --git a/src/main/java/com/biutag/supervision/mapper/StatisticsGroupMapper.java b/src/main/java/com/biutag/supervision/mapper/StatisticsGroupMapper.java index a3f675e..53ff806 100644 --- a/src/main/java/com/biutag/supervision/mapper/StatisticsGroupMapper.java +++ b/src/main/java/com/biutag/supervision/mapper/StatisticsGroupMapper.java @@ -30,11 +30,20 @@ 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 selectNegativeStatisticsByCity(Date beginTime, Date endTime, String groupId); - List selectCityNegativePerNumber(Date beginTime, Date endTime, String groupId); + List selectNegativePerNumberStatisticsByCity(Date beginTime, Date endTime, String groupId); - List selectCityNegativePerCapita(Date beginTime, Date endTime, String groupId); + List selectNegativePerCapitaStatisticsByCity(Date beginTime, Date endTime, String groupId); + + List selectNegativeStatisticsByThree(Date beginTime, Date endTime, String groupId); + + List selectNegativePerNumberStatisticsByThree(Date beginTime, Date endTime, String groupId); + + List selectNegativePerCapitaStatisticsByThree(Date beginTime, Date endTime, String groupId); + + + List selectNegativeStatistics(Date beginTime, Date endTime, String groupId, String type, List personTypeCode); } diff --git a/src/main/java/com/biutag/supervision/service/WvpDeviceChannelService.java b/src/main/java/com/biutag/supervision/service/WvpDeviceChannelService.java index abba4bc..47ec194 100644 --- a/src/main/java/com/biutag/supervision/service/WvpDeviceChannelService.java +++ b/src/main/java/com/biutag/supervision/service/WvpDeviceChannelService.java @@ -13,7 +13,7 @@ import java.util.stream.Collectors; public class WvpDeviceChannelService extends ServiceImpl { public List getDeviceList() { - List allDevices = list(new LambdaQueryWrapper().eq(WvpDeviceChannel::getStatus, "ON")); + List allDevices = list(); Map deviceMap = allDevices.stream() .collect(Collectors.toMap(WvpDeviceChannel::getDeviceId, device -> device)); List hierarchy = new ArrayList<>(); diff --git a/src/main/resources/mapper/StatisticsGroupMapper.xml b/src/main/resources/mapper/StatisticsGroupMapper.xml index ddcfee7..e41721b 100644 --- a/src/main/resources/mapper/StatisticsGroupMapper.xml +++ b/src/main/resources/mapper/StatisticsGroupMapper.xml @@ -4,16 +4,169 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + SELECT + membersName label, + `value` + FROM + negative_group_members m + LEFT JOIN ( + SELECT + second_involve_depart_id, + count( 1 ) `value` + FROM + negative + WHERE + crtTime BETWEEN #{beginTime} AND #{endTime} + GROUP BY + second_involve_depart_id + ) n ON m.membersCode = n.second_involve_depart_id + WHERE + groupId = #{groupId} + ORDER BY + `value` DESC + + - + SELECT + membersName label, + CASE WHEN s.police_size + s.aux_size > 0 THEN + ROUND(total / ( s.police_size + s.aux_size ), 1) ELSE 0 END `value` + FROM + negative_group_members m + LEFT JOIN ( + SELECT + second_involve_depart_id, + count( 1 ) total + FROM + negative + WHERE + crtTime BETWEEN #{beginTime} AND #{endTime} + GROUP BY + second_involve_depart_id + ) n ON m.membersCode = n.second_involve_depart_id + LEFT JOIN sup_depart_police_size s ON m.membersCode = s.depart_id + WHERE + groupId = #{groupId} + ORDER BY + `value` DESC + + - + SELECT + membersName label, + `value` + FROM + negative_group_members m + LEFT JOIN ( + SELECT + three_involve_depart_id, + count( DISTINCT b.blameEmpNo ) `value` + FROM + negative n + JOIN negative_blame b ON n.id = b.negativeId AND b.type = 'personal' + WHERE + n.crtTime BETWEEN #{beginTime} AND #{endTime} + GROUP BY + three_involve_depart_id + ) n ON m.membersCode = n.three_involve_depart_id + WHERE + groupId = #{groupId} + ORDER BY + `value` DESC limit 8 + + + +