From 8eb584869b4fd4de0f51c93f2616f12e51df9193 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期四, 18 十二月 2025 17:48:29 +0800
Subject: [PATCH] 2025.12.18 1. 动态溯源相关分析逻辑调整; 2. 走航报告接口参数调整;
---
src/main/kotlin/com/flightfeather/uav/lightshare/web/DataAnalysisController.kt | 96 +++++++++++++++++++++--------------------------
1 files changed, 43 insertions(+), 53 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 c6c2a83..8fd3212 100644
--- a/src/main/kotlin/com/flightfeather/uav/lightshare/web/DataAnalysisController.kt
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/web/DataAnalysisController.kt
@@ -1,6 +1,8 @@
package com.flightfeather.uav.lightshare.web
import com.fasterxml.jackson.annotation.JsonFormat
+import com.flightfeather.uav.common.exception.BizException
+import com.flightfeather.uav.lightshare.bean.AnalysisOption
import com.flightfeather.uav.lightshare.bean.AreaVo
import com.flightfeather.uav.lightshare.service.DataAnalysisService
import com.flightfeather.uav.socket.eunm.FactorType
@@ -23,12 +25,11 @@
@RequestMapping("air/analysis")
class DataAnalysisController(private val dataAnalysisService: DataAnalysisService) {
+ @Deprecated("璇ユ帴鍙e凡搴熷純锛屼娇鐢�/report/missionSummary/one鎺ュ彛")
@ApiOperation(value = "姹℃煋婧簮鍒嗘瀽")
@GetMapping("/pollution/trace")
fun pollutionTrace(
@ApiParam("璧拌埅浠诲姟缂栧彿") @RequestParam missionCode: String,
-// @RequestParam("page", required = false) page: Int?,
-// @RequestParam("per_page", required = false) perPage: Int?,
) = resPack { dataAnalysisService.pollutionTrace(missionCode) }
@ApiOperation(value = "鑾峰彇鍘嗗彶姹℃煋婧簮缁撴灉")
@@ -40,16 +41,14 @@
@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,
+ @ApiParam("鍒嗘瀽閫夐」") @RequestBody analysisOption: AnalysisOption,
) = resPack {
+ if (analysisOption.startTime == null || analysisOption.endTime == null || analysisOption.area == null)
+ throw BizException("鍙傛暟閿欒, startTime, endTime, area涓嶈兘涓虹┖")
+ val startTime = analysisOption.startTime!!.atZone(ZoneId.systemDefault()).toInstant()
+ val endTime = analysisOption.endTime!!.atZone(ZoneId.systemDefault()).toInstant()
+ val areaVo = analysisOption.area!!
+
dataAnalysisService.generateMissionSummary(
Date.from(startTime.atZone(ZoneId.systemDefault()).toInstant()),
Date.from(endTime.atZone(ZoneId.systemDefault()).toInstant()),
@@ -66,16 +65,14 @@
@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,
+ @ApiParam("鍒嗘瀽閫夐」") @RequestBody analysisOption: AnalysisOption,
) = resPack {
+ if (analysisOption.startTime == null || analysisOption.endTime == null || analysisOption.area == null)
+ throw BizException("鍙傛暟閿欒, startTime, endTime, area涓嶈兘涓虹┖")
+ val startTime = analysisOption.startTime!!.atZone(ZoneId.systemDefault()).toInstant()
+ val endTime = analysisOption.endTime!!.atZone(ZoneId.systemDefault()).toInstant()
+ val areaVo = analysisOption.area!!
+
dataAnalysisService.generateMissionList(
Date.from(startTime.atZone(ZoneId.systemDefault()).toInstant()),
Date.from(endTime.atZone(ZoneId.systemDefault()).toInstant()),
@@ -86,18 +83,15 @@
@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,
+ @ApiParam("鍒嗘瀽閫夐」") @RequestBody analysisOption: AnalysisOption,
) = resPack {
+ if (analysisOption.startTime == null || analysisOption.endTime == null || analysisOption.area == null)
+ throw BizException("鍙傛暟閿欒, startTime, endTime, area涓嶈兘涓虹┖")
+ val startTime = analysisOption.startTime!!.atZone(ZoneId.systemDefault()).toInstant()
+ val endTime = analysisOption.endTime!!.atZone(ZoneId.systemDefault()).toInstant()
+ val areaVo = analysisOption.area!!
+ val granularity = analysisOption.granularity
+
dataAnalysisService.generateMissionDetail(
Date.from(startTime.atZone(ZoneId.systemDefault()).toInstant()),
Date.from(endTime.atZone(ZoneId.systemDefault()).toInstant()),
@@ -116,20 +110,19 @@
@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,
+ @ApiParam("鍒嗘瀽閫夐」") @RequestBody analysisOption: AnalysisOption,
) = resPack {
+ if (analysisOption.startTime == null || analysisOption.endTime == null || analysisOption.area == null)
+ throw BizException("鍙傛暟閿欒, startTime, endTime, area涓嶈兘涓虹┖")
+ val startTime = analysisOption.startTime!!.atZone(ZoneId.systemDefault()).toInstant()
+ val endTime = analysisOption.endTime!!.atZone(ZoneId.systemDefault()).toInstant()
+ val areaVo = analysisOption.area!!
dataAnalysisService.generateClueByRiskArea(
Date.from(startTime.atZone(ZoneId.systemDefault()).toInstant()),
Date.from(endTime.atZone(ZoneId.systemDefault()).toInstant()),
- areaVo
+ areaVo,
+ analysisOption.removeOtherDistrict,
+ analysisOption.removeNoPollutedSource
)
}
@@ -142,20 +135,17 @@
@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,
+ @ApiParam("鍒嗘瀽閫夐」") @RequestBody analysisOption: AnalysisOption,
) = resPack {
+ if (analysisOption.startTime == null || analysisOption.endTime == null || analysisOption.area == null || analysisOption.factorTypes == null)
+ throw BizException("鍙傛暟閿欒, startTime, endTime, area, factorTypes涓嶈兘涓虹┖")
+ val startTime = analysisOption.startTime!!.atZone(ZoneId.systemDefault()).toInstant()
+ val endTime = analysisOption.endTime!!.atZone(ZoneId.systemDefault()).toInstant()
+ val areaVo = analysisOption.area!!
+ val factorTypes = analysisOption.factorTypes!!.map { FactorType.valueOf(it) }
+
dataAnalysisService.generateGridFusion(
- factorTypes.split(",").map { FactorType.valueOf(it) },
+ factorTypes,
Date.from(startTime.atZone(ZoneId.systemDefault()).toInstant()),
Date.from(endTime.atZone(ZoneId.systemDefault()).toInstant()),
areaVo
--
Gitblit v1.9.3