From 538ba7a3bbc682f4537f1dd34f93feb2cf56b08e Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期二, 14 十月 2025 17:32:04 +0800
Subject: [PATCH] 2025.10.14 1. 新增数据统计颗粒度选项,可选秒级数据、分钟数据进行数据统计 2. 典型隐患区域统计新增按照污染溯源区域进行分类统计的功能

---
 src/main/kotlin/com/flightfeather/uav/lightshare/web/DataAnalysisController.kt |  130 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 130 insertions(+), 0 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/web/DataAnalysisController.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/web/DataAnalysisController.kt
index 67634b9..c6c2a83 100644
--- a/src/main/kotlin/com/flightfeather/uav/lightshare/web/DataAnalysisController.kt
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/web/DataAnalysisController.kt
@@ -1,11 +1,17 @@
 package com.flightfeather.uav.lightshare.web
 
+import com.fasterxml.jackson.annotation.JsonFormat
 import com.flightfeather.uav.lightshare.bean.AreaVo
 import com.flightfeather.uav.lightshare.service.DataAnalysisService
+import com.flightfeather.uav.socket.eunm.FactorType
 import io.swagger.annotations.Api
 import io.swagger.annotations.ApiOperation
 import io.swagger.annotations.ApiParam
+import org.springframework.format.annotation.DateTimeFormat
 import org.springframework.web.bind.annotation.*
+import java.time.LocalDateTime
+import java.time.ZoneId
+import java.util.*
 
 /**
  * 璧拌埅鏁版嵁鍒嗘瀽
@@ -31,4 +37,128 @@
         @ApiParam("璧拌埅浠诲姟缂栧彿") @RequestParam missionCode: String,
     ) = resPack { dataAnalysisService.fetchHistory(missionCode) }
 
+    @ApiOperation(value = "鐢熸垚璧拌埅浠诲姟姹囨�荤粺璁�")
+    @PostMapping("/report/missionSummary")
+    fun generateMissionSummary(
+        @ApiParam("寮�濮嬫椂闂�") @RequestParam
+        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+        startTime: LocalDateTime,
+        @ApiParam("缁撴潫鏃堕棿") @RequestParam
+        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+        endTime: LocalDateTime,
+        @ApiParam("鍖哄煙") @RequestBody areaVo: AreaVo,
+    ) = resPack {
+        dataAnalysisService.generateMissionSummary(
+            Date.from(startTime.atZone(ZoneId.systemDefault()).toInstant()),
+            Date.from(endTime.atZone(ZoneId.systemDefault()).toInstant()),
+            areaVo
+        )
+    }
+
+    @ApiOperation(value = "鐢熸垚璧拌埅浠诲姟姹囨�荤粺璁�")
+    @GetMapping("/report/missionSummary/one")
+    fun generateOneMissionSummary(
+        @ApiParam("浠诲姟缂栧彿") @RequestParam missionCode: String,
+    ) = resPack { dataAnalysisService.generateMissionSummary(missionCode) }
+
+    @ApiOperation(value = "鐢熸垚璧拌埅浠诲姟娓呭崟")
+    @PostMapping("/report/missionList")
+    fun generateMissionList(
+        @ApiParam("寮�濮嬫椂闂�") @RequestParam
+        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+        startTime: LocalDateTime,
+        @ApiParam("缁撴潫鏃堕棿") @RequestParam
+        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+        endTime: LocalDateTime,
+        @ApiParam("鍖哄煙") @RequestBody areaVo: AreaVo,
+    ) = resPack {
+        dataAnalysisService.generateMissionList(
+            Date.from(startTime.atZone(ZoneId.systemDefault()).toInstant()),
+            Date.from(endTime.atZone(ZoneId.systemDefault()).toInstant()),
+            areaVo
+        )
+    }
+
+    @ApiOperation(value = "鐢熸垚璧拌埅浠诲姟璇︽儏")
+    @PostMapping("/report/missionDetail")
+    fun generateMissionDetail(
+        @ApiParam("寮�濮嬫椂闂�") @RequestParam
+        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+        startTime: LocalDateTime,
+        @ApiParam("缁撴潫鏃堕棿") @RequestParam
+        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+        endTime: LocalDateTime,
+        @ApiParam("鏁版嵁棰楃矑搴�", allowableValues = "SECOND, MINUTE, HOUR") @RequestParam(required = false)
+        granularity: String?,
+        @ApiParam("鍖哄煙") @RequestBody areaVo: AreaVo,
+    ) = resPack {
+        dataAnalysisService.generateMissionDetail(
+            Date.from(startTime.atZone(ZoneId.systemDefault()).toInstant()),
+            Date.from(endTime.atZone(ZoneId.systemDefault()).toInstant()),
+            areaVo,granularity
+        )
+    }
+
+    @ApiOperation(value = "鐢熸垚璧拌埅浠诲姟璇︽儏")
+    @GetMapping("/report/missionDetail/one")
+    fun generateOneMissionDetail(
+        @ApiParam("浠诲姟缂栧彿") @RequestParam missionCode: String,
+        @ApiParam("鏁版嵁棰楃矑搴�", allowableValues = "SECOND, MINUTE, HOUR") @RequestParam(required = false)
+        granularity: String?,
+    ) = resPack { dataAnalysisService.generateMissionDetail(missionCode, granularity) }
+
+    @ApiOperation(value = "璧拌埅鍏稿瀷闅愭偅鍖哄煙缁熻")
+    @PostMapping("/report/clueByRiskArea")
+    fun generateClueByRiskArea(
+        @ApiParam("寮�濮嬫椂闂�") @RequestParam
+        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+        startTime: LocalDateTime,
+        @ApiParam("缁撴潫鏃堕棿") @RequestParam
+        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+        endTime: LocalDateTime,
+        @ApiParam("鍖哄煙") @RequestBody areaVo: AreaVo,
+    ) = resPack {
+        dataAnalysisService.generateClueByRiskArea(
+            Date.from(startTime.atZone(ZoneId.systemDefault()).toInstant()),
+            Date.from(endTime.atZone(ZoneId.systemDefault()).toInstant()),
+            areaVo
+        )
+    }
+
+    @ApiOperation(value = "璧拌埅鍏稿瀷闅愭偅鍖哄煙缁熻")
+    @GetMapping("/report/clueByRiskArea/one")
+    fun generateOneClueByRiskArea(
+        @ApiParam("浠诲姟缂栧彿") @RequestParam missionCode: String,
+    ) = resPack { dataAnalysisService.generateClueByRiskArea(missionCode) }
+
+    @ApiOperation(value = "鍙犲姞铻嶅悎鍒嗘瀽")
+    @PostMapping("/report/gridFusion")
+    fun generateGridFusion(
+        @ApiParam("寮�濮嬫椂闂�") @RequestParam
+        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+        startTime: LocalDateTime,
+        @ApiParam("缁撴潫鏃堕棿") @RequestParam
+        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+        endTime: LocalDateTime,
+        @ApiParam("闇�瑕佺粺璁$殑鐩戞祴鍥犲瓙", example = "NO2, CO") @RequestParam
+        factorTypes: String,
+        @ApiParam("鍖哄煙") @RequestBody areaVo: AreaVo,
+    ) = resPack {
+        dataAnalysisService.generateGridFusion(
+            factorTypes.split(",").map { FactorType.valueOf(it) },
+            Date.from(startTime.atZone(ZoneId.systemDefault()).toInstant()),
+            Date.from(endTime.atZone(ZoneId.systemDefault()).toInstant()),
+            areaVo
+        )
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3