7 changed files with 249 additions and 101 deletions
@ -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<ProblemSourceStatisticsVo> 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<List<BarItem>> 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<List<BarItem>> 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<List<BarItem>> 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<List<BarItem>> 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<List<RiskStatisticsVo>> 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<List<RiskStatisticsVo>> 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<List<RiskStatisticsVo>> 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<List<RiskStatisticsVo>> 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<List<RiskStatisticsVo>> 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<List<RiskStatisticsVo>> 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<List<RiskStatisticsVo>> 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<List<RiskStatisticsVo>> 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<List<RiskStatisticsVo>> 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<List<RiskStatisticsVo>> 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<List<RiskStatisticsVo>> 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<List<RiskStatisticsVo>> 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<List<RiskStatisticsVo>> 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)); |
||||
} |
||||
} |
||||
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper |
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.biutag.supervision.mapper.StatisticsGroupMapper"> |
||||
|
||||
<select id="selectCityNegative" resultType="com.biutag.supervision.pojo.dto.common.BarItem"> |
||||
|
||||
</select> |
||||
|
||||
<select id="selectCityNegativePerNumber" resultType="com.biutag.supervision.pojo.dto.common.BarItem"> |
||||
|
||||
</select> |
||||
|
||||
<select id="selectCityNegativePerCapita" resultType="com.biutag.supervision.pojo.dto.common.BarItem"> |
||||
|
||||
</select> |
||||
|
||||
</mapper> |
||||
Loading…
Reference in new issue