|
|
@@ -0,0 +1,142 @@
|
|
|
+package com.zksy.web.controller.warning;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.zksy.base.warning.service.IEarlyWarningDisposeEfficiencyService;
|
|
|
+import com.zksy.common.core.domain.AjaxResult;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
+import io.swagger.annotations.ApiResponse;
|
|
|
+import io.swagger.annotations.ApiResponses;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.format.annotation.DateTimeFormat;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 预警统计-处置时效分析接口
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/api/warning/disposeEfficiency")
|
|
|
+@Api(tags = "预警信息-处置时效分析模块")
|
|
|
+public class EarlyWarningDisposeEfficiencyController {
|
|
|
+
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(EarlyWarningDisposeEfficiencyController.class);
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IEarlyWarningDisposeEfficiencyService efficiencyService;
|
|
|
+
|
|
|
+ @GetMapping("/overview")
|
|
|
+ @ApiOperation(value = "处置时效概览统计", notes = "返回平均、最长、最短处置时长及总数量核心指标")
|
|
|
+ @ApiResponses({
|
|
|
+ @ApiResponse(code = 200, message = "统计成功", response = AjaxResult.class),
|
|
|
+ @ApiResponse(code = 500, message = "统计异常", response = AjaxResult.class)
|
|
|
+ })
|
|
|
+ public AjaxResult getOverview(
|
|
|
+ @ApiParam(value = "发布开始时间 yyyy-MM-dd HH:mm:ss", example = "2026-01-01 00:00:00")
|
|
|
+ @RequestParam(required = false)
|
|
|
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime,
|
|
|
+
|
|
|
+ @ApiParam(value = "发布结束时间 yyyy-MM-dd HH:mm:ss", example = "2026-06-01 23:59:59")
|
|
|
+ @RequestParam(required = false)
|
|
|
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime,
|
|
|
+
|
|
|
+ @ApiParam(value = "预警专项", example = "管网压力专项")
|
|
|
+ @RequestParam(required = false) String warningSpecial) {
|
|
|
+ try {
|
|
|
+ Map<String, Object> result = efficiencyService.getEfficiencyOverview(startTime, endTime, warningSpecial);
|
|
|
+ return AjaxResult.success("概览统计查询成功", result);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("处置时效概览统计异常", e);
|
|
|
+ return AjaxResult.error("统计失败:" + e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/range")
|
|
|
+ @ApiOperation(value = "处置时效区间分布", notes = "按时长区间统计预警数量,适配柱状图展示")
|
|
|
+ @ApiResponses({
|
|
|
+ @ApiResponse(code = 200, message = "统计成功", response = AjaxResult.class),
|
|
|
+ @ApiResponse(code = 500, message = "统计异常", response = AjaxResult.class)
|
|
|
+ })
|
|
|
+ public AjaxResult getRange(
|
|
|
+ @ApiParam(value = "发布开始时间 yyyy-MM-dd HH:mm:ss", example = "2026-01-01 00:00:00")
|
|
|
+ @RequestParam(required = false)
|
|
|
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime,
|
|
|
+
|
|
|
+ @ApiParam(value = "发布结束时间 yyyy-MM-dd HH:mm:ss", example = "2026-06-01 23:59:59")
|
|
|
+ @RequestParam(required = false)
|
|
|
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime,
|
|
|
+
|
|
|
+ @ApiParam(value = "预警专项", example = "管网压力专项")
|
|
|
+ @RequestParam(required = false) String warningSpecial) {
|
|
|
+ try {
|
|
|
+ List<Map<String, Object>> result = efficiencyService.getEfficiencyRange(startTime, endTime, warningSpecial);
|
|
|
+ return AjaxResult.success("区间分布统计查询成功", result);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("处置时效区间统计异常", e);
|
|
|
+ return AjaxResult.error("统计失败:" + e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/special")
|
|
|
+ @ApiOperation(value = "按专项统计处置时效", notes = "按预警专项维度统计平均处置时长,从高到低排序")
|
|
|
+ @ApiResponses({
|
|
|
+ @ApiResponse(code = 200, message = "统计成功", response = AjaxResult.class),
|
|
|
+ @ApiResponse(code = 500, message = "统计异常", response = AjaxResult.class)
|
|
|
+ })
|
|
|
+ public AjaxResult getBySpecial(
|
|
|
+ @ApiParam(value = "发布开始时间 yyyy-MM-dd HH:mm:ss", example = "2026-01-01 00:00:00")
|
|
|
+ @RequestParam(required = false)
|
|
|
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime,
|
|
|
+
|
|
|
+ @ApiParam(value = "发布结束时间 yyyy-MM-dd HH:mm:ss", example = "2026-06-01 23:59:59")
|
|
|
+ @RequestParam(required = false)
|
|
|
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime) {
|
|
|
+ try {
|
|
|
+ List<Map<String, Object>> result = efficiencyService.getEfficiencyBySpecial(startTime, endTime);
|
|
|
+ return AjaxResult.success("专项时效统计查询成功", result);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("专项处置时效统计异常", e);
|
|
|
+ return AjaxResult.error("统计失败:" + e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/page")
|
|
|
+ @ApiOperation(value = "处置时效明细列表", notes = "分页查询预警处置时效明细,支持按时长排序,定位低效案例")
|
|
|
+ @ApiResponses({
|
|
|
+ @ApiResponse(code = 200, message = "查询成功", response = AjaxResult.class),
|
|
|
+ @ApiResponse(code = 500, message = "查询异常", response = AjaxResult.class)
|
|
|
+ })
|
|
|
+ public AjaxResult queryPage(
|
|
|
+ @ApiParam(value = "页码", defaultValue = "1") @RequestParam(defaultValue = "1") Integer pageNum,
|
|
|
+ @ApiParam(value = "每页大小", defaultValue = "10") @RequestParam(defaultValue = "10") Integer pageSize,
|
|
|
+
|
|
|
+ @ApiParam(value = "发布开始时间 yyyy-MM-dd HH:mm:ss", example = "2026-01-01 00:00:00")
|
|
|
+ @RequestParam(required = false)
|
|
|
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime,
|
|
|
+
|
|
|
+ @ApiParam(value = "发布结束时间 yyyy-MM-dd HH:mm:ss", example = "2026-06-01 23:59:59")
|
|
|
+ @RequestParam(required = false)
|
|
|
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime,
|
|
|
+
|
|
|
+ @ApiParam(value = "预警专项", example = "管网压力专项")
|
|
|
+ @RequestParam(required = false) String warningSpecial,
|
|
|
+
|
|
|
+ @ApiParam(value = "排序方式", allowableValues = "asc,desc", example = "desc")
|
|
|
+ @RequestParam(defaultValue = "desc") String sortType) {
|
|
|
+ try {
|
|
|
+ Page<Map<String, Object>> page = new Page<>(pageNum, pageSize);
|
|
|
+ IPage<Map<String, Object>> resultPage = efficiencyService.queryEfficiencyPage(page, startTime, endTime, warningSpecial, sortType);
|
|
|
+ return AjaxResult.success("明细查询成功", resultPage);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("处置时效明细查询异常", e);
|
|
|
+ return AjaxResult.error("查询失败:" + e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|