From 9c797fa0d704ef8ffb65cd1716b8eb694b4c46c3 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期五, 04 七月 2025 17:28:00 +0800
Subject: [PATCH] 2025.7.4 1. 新增动态污染溯源新的判定逻辑

---
 src/main/kotlin/com/flightfeather/uav/lightshare/web/SatelliteTelemetryController.kt |  139 ++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 133 insertions(+), 6 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/web/SatelliteTelemetryController.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/web/SatelliteTelemetryController.kt
index 2ac67d6..70ec683 100644
--- a/src/main/kotlin/com/flightfeather/uav/lightshare/web/SatelliteTelemetryController.kt
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/web/SatelliteTelemetryController.kt
@@ -1,13 +1,19 @@
 package com.flightfeather.uav.lightshare.web
 
-import com.fasterxml.jackson.annotation.JsonFormat
+import com.flightfeather.uav.domain.entity.GridData
+import com.flightfeather.uav.domain.entity.GridDataDetail
 import com.flightfeather.uav.lightshare.bean.AreaVo
+import com.flightfeather.uav.lightshare.service.SatelliteDataCalculateService
 import com.flightfeather.uav.lightshare.service.SatelliteTelemetryService
 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 org.springframework.web.multipart.MultipartFile
+import springfox.documentation.annotations.ApiIgnore
 import java.time.LocalDateTime
+import javax.servlet.http.HttpServletResponse
 
 /**
  * 鍗槦閬ユ祴
@@ -17,15 +23,19 @@
 @Api(tags = ["鍗槦閬ユ祴API鎺ュ彛"])
 @RestController
 @RequestMapping("air/satellite")
-class SatelliteTelemetryController(private val satelliteTelemetryService: SatelliteTelemetryService) {
+class SatelliteTelemetryController(
+    private val satelliteTelemetryService: SatelliteTelemetryService,
+    private val satelliteDataCalculateService: SatelliteDataCalculateService,
+) {
 
     @ApiOperation(value = "鑾峰彇缃戞牸缁勪俊鎭�")
     @PostMapping("/grid/group")
     fun fetchGridGroup(
         @RequestBody areaVo: AreaVo,
+        @RequestParam(required = false) type: String?,
         @RequestParam("page", required = false) page: Int?,
-        @RequestParam("per_page", required = false) perPage: Int?
-    ) = resPack { satelliteTelemetryService.fetchGridGroup(areaVo, page, perPage) }
+        @RequestParam("per_page", required = false) perPage: Int?,
+    ) = resPack { satelliteTelemetryService.fetchGridGroup(areaVo, type, page, perPage) }
 
     @ApiOperation(value = "鑾峰彇缃戞牸缁勫唴鍏蜂綋缃戞牸淇℃伅")
     @GetMapping("/grid/cell")
@@ -38,9 +48,22 @@
     fun fetchGridData(
         @ApiParam("缃戞牸缁刬d") @RequestParam groupId: Int,
         @ApiParam("閬ユ祴鏁版嵁鏃堕棿")
-        @RequestParam(required = false) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") dataTime: LocalDateTime?,
-        @ApiParam("閬ユ祴鏁版嵁绫诲瀷", allowableValues = "0锛氬師濮嬪崼鏄熼仴娴嬫暟鎹紱1锛氳瀺鍚堟暟鎹�") @RequestParam(required = false) type: Int?,
+        @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") dataTime: LocalDateTime?,
+        @ApiParam("閬ユ祴鏁版嵁绫诲瀷", allowableValues = "0锛氬師濮嬪崼鏄熼仴娴嬫暟鎹紱1锛氳瀺鍚堟暟鎹�")
+        @RequestParam(required = false) type: Int?,
     ) = resPack { satelliteTelemetryService.fetchGridData(groupId, dataTime, type) }
+
+    @ApiOperation(value = "鑾峰彇缃戞牸缁勪笅鐨勫崼鏄熼仴娴嬫暟鎹�")
+    @PostMapping("/grid/data2")
+    fun fetchGridData2(
+        @ApiParam("缃戞牸鏁版嵁") @RequestBody gridData: GridData,
+    ) = resPack { satelliteTelemetryService.fetchGridData(gridData) }
+
+    @ApiOperation(value = "鍒犻櫎缃戞牸鏁版嵁")
+    @DeleteMapping("/grid/data/delete")
+    fun deleteGridData(
+        @ApiParam("鏁版嵁id") @RequestParam dataId: Int,
+    ) = resPack { satelliteTelemetryService.deleteGridData(dataId) }
 
     @ApiOperation(value = "鑾峰彇缃戞牸缁勪笅鐨勫崼鏄熼仴娴嬪叿浣撴暟鎹�")
     @GetMapping("/grid/data/detail")
@@ -49,4 +72,108 @@
         @ApiParam("缃戞牸缁刬d") @RequestParam(required = false) groupId: Int?,
         @ApiParam("缃戞牸鍗曞厓鏍糹d") @RequestParam(required = false) cellId: Int?,
     ) = resPack { satelliteTelemetryService.fetchGridDataDetail(dataId, groupId, cellId) }
+
+    @ApiOperation(value = "淇濆瓨鎷熷悎鐢熸垚鐨勫崼鏄熼仴娴婸M2.5缁撴灉鏁版嵁")
+    @PostMapping("/grid/data/create")
+    fun createGridDataAndDataDetail(
+        @ApiParam("缃戞牸缁刬d") @RequestParam groupId: Int,
+        @ApiParam("閬ユ祴鏁版嵁鏃堕棿")
+        @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") dateTime: LocalDateTime,
+        @RequestBody gridDataDetail: List<GridDataDetail>,
+    ) = resPack {
+        satelliteTelemetryService.createGridDataAndDataDetail(groupId, dateTime, gridDataDetail)
+    }
+
+
+    @ApiOperation(value = "澶氭璧拌埅鏁版嵁杩涜铻嶅悎璁$畻")
+    @PostMapping("/grid/data/mix")
+    fun mixGridData(
+        @ApiParam("鍘熷鏁版嵁id鏁扮粍") @RequestBody dataIdList: List<Int>,
+    ) = resPack { satelliteTelemetryService.mixGridData(dataIdList) }
+
+
+    @ApiOperation(value = "瀵煎叆鍗槦閬ユ祴PM2.5缁撴灉鏁版嵁")
+    @PostMapping("/import/grid/data")
+    fun importGridData(
+        @ApiParam("缃戞牸缁刬d") @RequestParam groupId: Int,
+        @ApiParam("閬ユ祴鏁版嵁鏃堕棿")
+        @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") dateTime: LocalDateTime,
+        @ApiParam("瑕嗙洊鏃ф暟鎹� 0: 涓嶈鐩� 1: 瑕嗙洊") @RequestParam update: Boolean,
+        @RequestParam("excel") file: MultipartFile,
+    ) = resPack {
+        satelliteTelemetryService.importGridData(groupId, dateTime, update, file)
+    }
+
+    @ApiOperation(value = "涓嬭浇鍗槦閬ユ祴PM2.5缁撴灉鏁版嵁瀵煎叆妯℃澘")
+    @GetMapping("/import/grid/data/download/template")
+    fun downloadTemplate(@ApiIgnore response: HttpServletResponse) =
+        satelliteTelemetryService.downloadTemplate(response)
+
+    @ApiOperation(value = "瀵煎叆鍗槦閬ユ祴Aod缁撴灉鏁版嵁")
+    @PostMapping("/import/grid/aod")
+    fun importGridAOD(
+        @ApiParam("缃戞牸缁刬d") @RequestParam groupId: Int,
+        @ApiParam("閬ユ祴鏁版嵁鏃堕棿")
+        @RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") dateTime: LocalDateTime,
+        @ApiParam("瑕嗙洊鏃ф暟鎹� 0: 涓嶈鐩� 1: 瑕嗙洊") @RequestParam update: Boolean,
+        @RequestParam("excel") file: MultipartFile,
+    ) = resPack {
+        satelliteTelemetryService.importGridAOD(groupId, dateTime, update, file)
+    }
+
+    @ApiOperation(value = "涓嬭浇鍗槦閬ユ祴Aod缁撴灉鏁版嵁瀵煎叆妯℃澘")
+    @GetMapping("/import/grid/aod/download/template")
+    fun downloadAODTemplate(@ApiIgnore response: HttpServletResponse) =
+        satelliteTelemetryService.downloadAODTemplate(response)
+
+
+    /**AOD鏁版嵁鐩稿叧**************************************************************/
+    @ApiOperation(value = "鑾峰彇缃戞牸缁勪笅鐨勫崼鏄熼仴娴媋od鏁版嵁")
+    @GetMapping("/grid/aod")
+    fun fetchGridAod(
+        @ApiParam("缃戞牸缁刬d") @RequestParam groupId: Int,
+        @ApiParam("閬ユ祴鏁版嵁鏃堕棿")
+        @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") dataTime: LocalDateTime?,
+    ) = resPack { satelliteTelemetryService.fetchGridAod(groupId, dataTime) }
+
+//    @ApiOperation(value = "鑾峰彇缃戞牸缁勪笅鐨勫崼鏄熼仴娴婣OD鏁版嵁")
+//    @GetMapping("/aod/data")
+//    fun fetchGridAOD(
+//        @ApiParam("缃戞牸缁刬d") @RequestParam groupId: Int,
+//        @ApiParam("AOD鏁版嵁鏃堕棿")
+//        @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") dataTime: LocalDateTime?,
+//    ) = resPack { satelliteTelemetryService.fetchGridAOD(groupId, dataTime) }
+
+    @ApiOperation(value = "鑾峰彇缃戞牸缁勪笅鐨勫崼鏄熼仴娴婣OD鍏蜂綋鏁版嵁")
+    @GetMapping("/aod/data/detail")
+    fun fetchGridAODDetail(
+        @ApiParam("AOD鏁版嵁id") @RequestParam aodId: Int,
+        @ApiParam("缃戞牸缁刬d") @RequestParam(required = false) groupId: Int?,
+        @ApiParam("缃戞牸鍗曞厓鏍糹d") @RequestParam(required = false) cellId: Int?,
+    ) = resPack { satelliteTelemetryService.fetchGridAODDetail(aodId, groupId, cellId) }
+
+
+    /**閬ユ祴浜у搧鍒朵綔鐩稿叧**************************************************************/
+    @ApiOperation(value = "鐢熸垚璧拌埅铻嶅悎浜у搧")
+    @PostMapping("/product/underway/build")
+    fun buildUnderwayProduct(
+//        @ApiParam("璧拌埅浠诲姟缂栧彿") @RequestParam missionCode: String,
+//        @ApiParam("缃戞牸缁刬d") @RequestParam groupId: Int,
+        @ApiParam("缃戞牸鏁版嵁") @RequestBody gridData: GridData,
+    ) = resPack { satelliteDataCalculateService.dataFusion(gridData) }
+
+    @ApiOperation(value = "杩涜璧拌埅铻嶅悎浜у搧鐨勮瀺鍚堝垎鏋�")
+    @PostMapping("/product/underway/mix")
+    fun mixGridData(
+        @ApiParam("缃戞牸缁刬d") @RequestParam groupId: Int,
+        @ApiParam("闇�瑕佽瀺鍚堢殑鏁版嵁id") @RequestBody dataIdList: List<Int>,
+    ) = resPack { satelliteDataCalculateService.mixUnderwayGridData(groupId, dataIdList) }
+
+    @ApiOperation(value = "鐢熸垚璧拌埅鐑姏鍥�")
+    @PostMapping("/product/underway/heatmap/build")
+    fun buildUnderwayHeatmap(
+        @ApiParam("浣跨敤鐨勭綉鏍肩粍id") @RequestParam groupId: Int,
+        @ApiParam("鎼滅储缃戞牸璺濈") @RequestParam searchLength: Int,
+        @ApiParam("浣跨敤鐨勮蛋鑸綉鏍兼暟鎹�") @RequestBody gridDataDetailList: List<GridDataDetail>,
+    ) = resPack { satelliteDataCalculateService.buildHeatmap(groupId, gridDataDetailList, searchLength) }
 }
\ No newline at end of file

--
Gitblit v1.9.3