From 9a9a27f185bc0cf9dc0001cfc6839e6d13dbccd9 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期四, 08 五月 2025 17:38:30 +0800
Subject: [PATCH] 1. 添加了动态污染溯源相关功能逻辑

---
 src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/model/DataAnalysisConfig.kt                     |    4 
 src/main/kotlin/com/flightfeather/uav/common/location/TrackSegment.kt                                  |   28 -
 src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/DataAnalysisServiceImpl.kt               |   47 +++
 src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImplTest.kt     |    7 
 src/main/kotlin/com/flightfeather/uav/biz/dataprocess/RoadSegment.kt                                   |    2 
 src/main/kotlin/com/flightfeather/uav/domain/entity/Mission.java                                       |  153 +++++++++++-
 src/main/kotlin/com/flightfeather/uav/domain/repository/SatelliteGridRep.kt                            |   22 +
 src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteDataCalculateServiceImplTest.kt |   12 
 src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionDataExceed.kt            |   11 
 src/main/resources/generator/generatorConfig.xml                                                       |    4 
 src/main/kotlin/com/flightfeather/uav/lightshare/service/DataAnalysisService.kt                        |   17 +
 src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImpl.kt         |   43 +--
 src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/model/ExceptionResult.kt                        |    4 
 src/main/kotlin/com/flightfeather/uav/lightshare/web/DataAnalysisController.kt                         |   28 ++
 src/main/kotlin/com/flightfeather/uav/lightshare/web/SatelliteTelemetryController.kt                   |   30 +
 src/main/kotlin/com/flightfeather/uav/domain/mapper/GridDataDetailMapper.kt                            |    8 
 src/main/kotlin/com/flightfeather/uav/biz/report/MissionReport.kt                                      |   11 
 src/main/kotlin/com/flightfeather/uav/domain/entity/GridGroup.java                                     |   48 ++++
 src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteDataCalculateServiceImpl.kt     |   28 +-
 src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionValueMutation.kt         |   17 -
 src/main/resources/mapper/MissionMapper.xml                                                            |   12 
 src/main/kotlin/com/flightfeather/uav/domain/mapper/GridDataMapper.kt                                  |   10 
 src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuous.kt                      |   26 --
 src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/ExceptionAnalysisController.kt                  |   15 
 src/main/resources/application-test.yml                                                                |   12 
 src/main/kotlin/com/flightfeather/uav/lightshare/service/SatelliteDataCalculateService.kt              |    8 
 src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/DataAnalysisServiceImplTest.kt           |   22 +
 src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/RealTimeExceptionAnalysisController.kt          |   32 ++
 src/main/kotlin/com/flightfeather/uav/lightshare/service/SatelliteTelemetryService.kt                  |   17 
 src/main/resources/mapper/GridGroupMapper.xml                                                          |    4 
 30 files changed, 497 insertions(+), 185 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuous.kt b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuous.kt
index c5ab169..63cd9af 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuous.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuous.kt
@@ -124,32 +124,6 @@
                 }
             }
         }
-//        repeat(config.factorCount) { i ->
-//            eIndex[i]++
-//            // 璧峰鏁版嵁
-//            if (lastData == null) {
-//                refreshAfterCheckResult(i, data)
-//            }
-//            // 鍒ゆ柇鐩搁偦鏁版嵁鏄惁杩炵画骞朵笖鏄惁婊¤冻寮傚父鍒ゆ柇
-//            if (!isContinue) {
-//                checkResult()
-//                // 鏁版嵁涓嶈繛缁椂锛岃褰曞紓甯告儏鍐�
-//                if (eIndex[i] - sIndex[i] >= durationCount) {
-//                    refreshAfterCheckResult(i, data)
-//                }
-//            } else {
-//                if (hasException[i]) {
-//                    existException[i] = true
-//                    exceptionData[i].add(data)
-//                } else {
-//                    // 寮傚父涓嶅啀閲嶅鍑虹幇鏃讹紝璁板綍寮傚父鎯呭喌
-//                    checkResult()
-//                    if (eIndex[i] - sIndex[i] >= durationCount) {
-//                        refreshAfterCheckResult(i, data)
-//                    }
-//                }
-//            }
-//        }
         lastData = data
     }
 
diff --git a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/ExceptionAnalysisController.kt b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/ExceptionAnalysisController.kt
index a8c9d8e..d2f3c57 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/ExceptionAnalysisController.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/ExceptionAnalysisController.kt
@@ -1,7 +1,6 @@
 package com.flightfeather.uav.biz.dataanalysis
 
 import com.flightfeather.uav.biz.FactorFilter
-import com.flightfeather.uav.biz.dataanalysis.exceptiontype.ExceptionDataExceed
 import com.flightfeather.uav.biz.dataanalysis.exceptiontype.ExceptionSlideAverage
 import com.flightfeather.uav.biz.dataanalysis.exceptiontype.ExceptionValueMutation
 import com.flightfeather.uav.biz.dataanalysis.model.DataAnalysisConfig
@@ -12,15 +11,12 @@
 import com.flightfeather.uav.domain.repository.RealTimeDataRep
 import com.flightfeather.uav.domain.repository.SegmentInfoRep
 import com.flightfeather.uav.socket.eunm.UWDeviceType
-import org.springframework.stereotype.Component
 import java.time.LocalDateTime
 import java.time.ZoneId
-import java.time.format.DateTimeFormatter
 
 /**
  * 鏁版嵁寮傚父鍒嗘瀽鎺у埗鍣�
  */
-@Component
 class  ExceptionAnalysisController(
     private val realTimeDataRep: RealTimeDataRep,
     private val locationRoadNearby: LocationRoadNearby,
@@ -34,13 +30,13 @@
     private fun initTask(config: DataAnalysisConfig) {
         taskList.clear()
         taskList.apply {
-            add(ExceptionDataExceed(config))
+//            add(ExceptionDataExceed(config))
             add(ExceptionValueMutation(config))
             add(ExceptionSlideAverage(config))
         }
     }
 
-    fun run(mission: Mission, factorFilter: FactorFilter): List<ExceptionResult> {
+    fun execute(mission: Mission, factorFilter: FactorFilter): List<ExceptionResult> {
         running = true
         val config = DataAnalysisConfig(mission, ExceptionSetting(), factorFilter)
         initTask(config)
@@ -63,7 +59,9 @@
                 // 鏌ヨ寮傚父鍛ㄨ竟鍙兘姹℃煋婧�
                 nearBy(r, config)
                 // 鏌ヨ鏃舵鎵�鍦ㄨ矾娈�
-                road(r)
+//                road(r)
+                // 灏嗘暟鎹浆鎹负閫氱敤鏍煎紡
+                r.dataVoList = r.dataList.map { e-> e.toDataVo() }
             }
             // 瀛樺偍鍒嗘瀽缁撴灉
             result.addAll(it.resultList)
@@ -71,6 +69,8 @@
         running = false
         return result
     }
+
+//    private fun
 
     private fun nearBy(r: ExceptionResult, config: DataAnalysisConfig) {
         if (r.longitude != null && r.latitude != null) {
@@ -85,6 +85,7 @@
                 }
                 r.relatedSceneId = idList
                 r.relatedSceneName = nameList
+                r.relatedSceneList = sceneList
             }
         }
     }
diff --git a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/RealTimeExceptionAnalysisController.kt b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/RealTimeExceptionAnalysisController.kt
new file mode 100644
index 0000000..91bd310
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/RealTimeExceptionAnalysisController.kt
@@ -0,0 +1,32 @@
+package com.flightfeather.uav.biz.dataanalysis
+
+import com.flightfeather.uav.biz.dataanalysis.exceptiontype.ExceptionSlideAverage
+import com.flightfeather.uav.biz.dataanalysis.exceptiontype.ExceptionValueMutation
+import com.flightfeather.uav.biz.dataanalysis.model.DataAnalysisConfig
+import com.flightfeather.uav.common.location.LocationRoadNearby
+import com.flightfeather.uav.domain.repository.RealTimeDataRep
+import com.flightfeather.uav.domain.repository.SegmentInfoRep
+
+/**
+ *
+ * @date 2025/5/8
+ * @author feiyu02
+ */
+class RealTimeExceptionAnalysisController (
+    private val realTimeDataRep: RealTimeDataRep,
+    private val locationRoadNearby: LocationRoadNearby,
+    private val segmentInfoRep: SegmentInfoRep,
+){
+
+    private val taskList = mutableListOf<BaseExceptionAnalysis>()
+
+    private fun initTask(config: DataAnalysisConfig) {
+        taskList.clear()
+        taskList.apply {
+            add(ExceptionValueMutation(config))
+            add(ExceptionSlideAverage(config))
+        }
+    }
+
+    // 璁$畻鍘嗗彶浠诲姟
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionDataExceed.kt b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionDataExceed.kt
index 0d140d9..3bf7937 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionDataExceed.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionDataExceed.kt
@@ -9,6 +9,7 @@
 /**
  * 鏁版嵁瓒呮爣寮傚父鍒嗘瀽
  */
+@Deprecated("鍘熻秴鏍囧垽瀹氶�昏緫璁惧畾鐨勮秴鏍囧�兼湁婕忔礊锛�")
 class ExceptionDataExceed(config: DataAnalysisConfig) : BaseExceptionContinuousSingle(config) {
 
     override fun getExceptionType(): ExceptionType = ExceptionType.TYPE2
@@ -25,16 +26,6 @@
             }
             res[f] = bool
         }
-//        repeat(config.factorCount) { i ->
-//            val data = n.getByFactorIndex(i)
-//            val limit = config.exceptionSetting.getByFactorIndex(i)
-//            val bool = if (data != null && limit != null) {
-//                data >= limit
-//            } else {
-//                false
-//            }
-//            res.add(bool)
-//        }
         return res
     }
 
diff --git a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionValueMutation.kt b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionValueMutation.kt
index fdaa83c..e7994b7 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionValueMutation.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionValueMutation.kt
@@ -34,21 +34,8 @@
             val b2 = r >= config.mutationRate
             if (b1) special = true
             res[f] = (b1 || b2)
-            if (res[f] == true) println("p: $pValue --- n: $nValue --- r: $r")
+//            if (res[f] == true) println("p: $pValue --- n: $nValue --- r: $r")
         }
-//        repeat(config.factorCount) { i->
-//            if (p?.getByFactorIndex(i) == null || n.getByFactorIndex(i) == null) {
-//                res.add(false)
-//                return@repeat
-//            }
-//            val pValue = p.getByFactorIndex(i)!!
-//            val nValue = n.getByFactorIndex(i)!!
-//            val r = abs((pValue - nValue) / pValue)
-//            val b1 = r >= (2 * config.mutationRate)
-//            val b2 = r >= config.mutationRate
-//            if (b1) special = true
-//            res.add(b1 || b2)
-//        }
 
         return res
     }
@@ -57,7 +44,7 @@
         val b1 = special && (eIndex - sIndex) >= (config.mutationNum / 2)
         val b2 = (eIndex - sIndex) >= config.mutationNum
         special = false
-        println("sIndex: $sIndex --- eIndex: $eIndex --- special: $special")
+//        println("sIndex: $sIndex --- eIndex: $eIndex --- special: $special")
         return b1 || b2
     }
 }
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/model/DataAnalysisConfig.kt b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/model/DataAnalysisConfig.kt
index bbc7b00..0248932 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/model/DataAnalysisConfig.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/model/DataAnalysisConfig.kt
@@ -15,7 +15,7 @@
     val factorFilter: FactorFilter,
 ){
     // 杩炵画绐佸彉鏁版嵁涓暟
-    var mutationNum = 6
+    var mutationNum = 2
     // 绐佸彉鐜�
     var mutationRate = .5
 
@@ -23,7 +23,7 @@
     var changeTrendGroup = 12
     // 婊戝姩骞冲潎鍊艰繛缁�
     var changeTrendInterval = 12
-    var changeTrendRate = 1
+    var changeTrendRate = .5
     // 婊戝姩骞冲潎鍊煎彉鍖栫巼寮傚父杩炵画娆℃暟
     var changeTrendTimes = 3
 
diff --git a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/model/ExceptionResult.kt b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/model/ExceptionResult.kt
index 66a9322..9d80c20 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/model/ExceptionResult.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/model/ExceptionResult.kt
@@ -2,6 +2,8 @@
 
 import com.flightfeather.uav.biz.FactorFilter
 import com.flightfeather.uav.domain.entity.BaseRealTimeData
+import com.flightfeather.uav.domain.entity.SceneInfo
+import com.flightfeather.uav.lightshare.bean.DataVo
 import java.math.BigDecimal
 import java.util.*
 
@@ -37,6 +39,8 @@
     var relatedSceneId: List<String>? = null
     // 鐩稿叧浼佷笟鍚嶇О锛堝悕绉颁箣闂�;鍒嗛殧锛�
     var relatedSceneName: List<String>? = null
+    var relatedSceneList: List<SceneInfo?>? = null
     // 寮傚父鏁版嵁锛屽ご灏惧彲鑳藉寘鍚竴瀹氶噺鐨勫亸绉�
     var dataList: MutableList<BaseRealTimeData> = mutableListOf()
+    var dataVoList: List<DataVo>? = null
 }
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/uav/biz/dataprocess/RoadSegment.kt b/src/main/kotlin/com/flightfeather/uav/biz/dataprocess/RoadSegment.kt
index 837c393..93403a2 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/dataprocess/RoadSegment.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/dataprocess/RoadSegment.kt
@@ -97,7 +97,7 @@
     private fun saveResult(segmentInfoList:List<SegmentInfo>) {
         val res = mutableListOf<SegmentInfo>()
         segmentInfoList.forEach { s ->
-            // 鍒ゆ柇褰撳墠璁板綍鍜屼笂涓褰曟槸鍚︽暟鎹悓涓�鏉¢亾璺�
+            // 鍒ゆ柇褰撳墠璁板綍鍜屼笂涓褰曟槸鍚﹀睘浜庡悓涓�鏉¢亾璺�
             if (res.isNotEmpty()) {
                 val lastOne = res.last()
                 // 鑻ュ睘浜庡悓涓�閬撹矾锛屽悎骞�
diff --git a/src/main/kotlin/com/flightfeather/uav/biz/report/MissionReport.kt b/src/main/kotlin/com/flightfeather/uav/biz/report/MissionReport.kt
index a2c474d..e898e97 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/report/MissionReport.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/report/MissionReport.kt
@@ -6,12 +6,14 @@
 import com.flightfeather.uav.biz.dataprocess.PreData
 import com.flightfeather.uav.common.chart.DataToChartUtil
 import com.flightfeather.uav.common.exception.BizException
+import com.flightfeather.uav.common.location.LocationRoadNearby
 import com.flightfeather.uav.common.pdf.GeneratePdfUtil
 import com.flightfeather.uav.common.utils.DateUtil
 import com.flightfeather.uav.common.utils.ImageUtil
 import com.flightfeather.uav.domain.entity.Mission
 import com.flightfeather.uav.domain.repository.MissionRep
 import com.flightfeather.uav.domain.repository.RealTimeDataRep
+import com.flightfeather.uav.domain.repository.SegmentInfoRep
 import org.springframework.beans.BeanUtils
 import org.springframework.beans.factory.annotation.Value
 import org.springframework.stereotype.Component
@@ -24,12 +26,17 @@
  */
 @Component
 class MissionReport(
-    private val exceptionAnalysisController: ExceptionAnalysisController,
     private val missionRep: MissionRep,
     private val realTimeDataRep: RealTimeDataRep,
+    private val locationRoadNearby: LocationRoadNearby,
+    private val segmentInfoRep: SegmentInfoRep,
     @Value("\${filePath}")
     private val filePath: String,
 ) {
+
+    private val exceptionAnalysisController =
+        ExceptionAnalysisController(realTimeDataRep, locationRoadNearby, segmentInfoRep)
+
     data class Param(
         val district: String,
         val town: String,
@@ -105,7 +112,7 @@
 
     // 鑾峰彇寮傚父鍒嗘瀽缁撴灉
     fun exceptionAnalysis(mission: Mission, factorFilter: FactorFilter): List<ExceptionResult> {
-        return exceptionAnalysisController.run(mission, factorFilter)
+        return exceptionAnalysisController.execute(mission, factorFilter)
     }
 
     // 璁$畻鍧囧�煎拰鏁版嵁鑼冨洿
diff --git a/src/main/kotlin/com/flightfeather/uav/common/location/TrackSegment.kt b/src/main/kotlin/com/flightfeather/uav/common/location/TrackSegment.kt
index 3f90920..6b6c0a4 100644
--- a/src/main/kotlin/com/flightfeather/uav/common/location/TrackSegment.kt
+++ b/src/main/kotlin/com/flightfeather/uav/common/location/TrackSegment.kt
@@ -36,9 +36,6 @@
         val closeList = mutableListOf<BaseRealTimeData>()
         records.add(mutableListOf())
         data.forEachIndexed { i, d ->
-//            if (records.size == 23) {
-//                println(records.size)
-//            }
             var isSame = false
             if (i > 0) {
                 // 鍓嶄竴涓湁鏁堢洃娴嬬偣
@@ -66,28 +63,17 @@
                     }
 
                     if (distance >= MIN_DISTANCE) {
+                        // 涓ょ偣璺濈杈冨ぇ鏃讹紝璁$畻澶硅
                         val deg = CoordinateUtil.getAngle(
                             lastData.longitude!!.toDouble(), lastData.latitude!!.toDouble(),
                             d.longitude!!.toDouble(), d.latitude!!.toDouble(),
                         )
+                        // 璁$畻
                         isSame = if (lastDegList.isNotEmpty()) {
                             var bool = true
 
-
-//                            // 鍑虹幇瑙掑害鎺ヨ繎鍨傜洿鐘舵�佺殑娆℃暟
-//                            var unSameCount = 0
-//                            // 姣旇緝褰撳墠鏂逛綅瑙掑拰涓婁竴缁勬瘡涓柟浣嶈鐨勫樊鍊兼槸鍚﹂兘澶勪簬鑼冨洿鍐�
-//                            for (lastDeg in lastDegList) {
-//                                val diffDeg = abs(deg - lastDeg)
-//                                if (diffDeg in (90.0 - VERTICAL_OFFSET_DEG)..(90.0 + VERTICAL_OFFSET_DEG)
-//                                    || diffDeg in (270.0 - VERTICAL_OFFSET_DEG)..(270.0 + VERTICAL_OFFSET_DEG)
-//                                ) {
-//                                    unSameCount++
-//                                }
-//                            }
-//                            // 褰撴帴杩戝瀭鐩寸殑瑙掑害瓒呰繃涓婁竴缁勫钩琛岃搴︾殑涓�鍗婃椂锛岃涓轰粠璇ョ偣杞ㄨ抗杞集锛堟秷闄や釜鍒潗鏍囩偣鐢变簬瀹氫綅璇樊瀵艰嚧鐨勯敊璇奖鍝嶏級
-//                            bool = unSameCount < (lastDegList.size / 3 + 1)
-
+                            // 灏嗗綋鍓嶅潗鏍囩偣鐨勮搴﹀拰涔嬪墠鎵�鏈夊睘浜庡悓涓�閬撹矾鐨勫潗鏍囩偣鐨勮搴︾殑鍧囧�煎仛姣旇緝锛�
+                            // 瑙e喅褰撹溅杈嗚椹惰建杩逛负寮х嚎鏃讹紙渚嬪绔嬩氦妗ョ殑寮х嚎杞集绛夛級锛屼竴鐩磋鍒ゅ畾涓鸿浆鍚戝箙搴︿笉澶у睘浜庡悓涓�璺鐨勯棶棰�
                             val avgDeg = avgDegree(lastDegList)
                             val diffDeg = abs(deg - avgDeg)
                             if (diffDeg in (90.0 - VERTICAL_OFFSET_DEG)..(90.0 + VERTICAL_OFFSET_DEG)
@@ -104,17 +90,19 @@
                             }
                             bool
                         } else {
-                            // 褰撳潗鏍囩偣褰㈡垚鏈夋晥璺緞鏃讹紝璁板綍涓轰笂涓�涓潗鏍囩偣
+                            // 褰撴病鏈夊巻鍙茶搴︽椂锛岀洿鎺ヤ繚瀛橈紝骞惰涓烘槸鍚屼竴璺
                             lastDegList.add(deg)
                             true
                         }
+                        // 娓呯┖涓婁竴缁勮窛绂绘帴杩戠殑鍧愭爣鐐�
                         closeList.clear()
                     } else {
+                        // 涓ょ偣璺濈鎺ヨ繎鏃讹紝娣诲姞璁板綍
                         closeList.add(d)
                         isSame = true
                     }
                 }
-                // 鍚﹀垯璁や负鍚屼竴璺
+                // 涓ょ偣鍧愭爣涓嶅悎娉曪紝鍒欒涓哄悓涓�璺
                 else {
                     isSame = true
                 }
diff --git a/src/main/kotlin/com/flightfeather/uav/domain/entity/GridGroup.java b/src/main/kotlin/com/flightfeather/uav/domain/entity/GridGroup.java
index 6e0fd9a..0736389 100644
--- a/src/main/kotlin/com/flightfeather/uav/domain/entity/GridGroup.java
+++ b/src/main/kotlin/com/flightfeather/uav/domain/entity/GridGroup.java
@@ -58,6 +58,18 @@
     private Integer fatherGroupId;
 
     /**
+     * 鏈�澶фí鍧愭爣
+     */
+    @Column(name = "max_xaxis")
+    private Integer maxXaxis;
+
+    /**
+     * 鏈�澶х旱鍧愭爣
+     */
+    @Column(name = "max_yaxis")
+    private Integer maxYaxis;
+
+    /**
      * @return id
      */
     public Integer getId() {
@@ -268,4 +280,40 @@
     public void setFatherGroupId(Integer fatherGroupId) {
         this.fatherGroupId = fatherGroupId;
     }
+
+    /**
+     * 鑾峰彇鏈�澶фí鍧愭爣
+     *
+     * @return max_xaxis - 鏈�澶фí鍧愭爣
+     */
+    public Integer getMaxXaxis() {
+        return maxXaxis;
+    }
+
+    /**
+     * 璁剧疆鏈�澶фí鍧愭爣
+     *
+     * @param maxXaxis 鏈�澶фí鍧愭爣
+     */
+    public void setMaxXaxis(Integer maxXaxis) {
+        this.maxXaxis = maxXaxis;
+    }
+
+    /**
+     * 鑾峰彇鏈�澶х旱鍧愭爣
+     *
+     * @return max_yaxis - 鏈�澶х旱鍧愭爣
+     */
+    public Integer getMaxYaxis() {
+        return maxYaxis;
+    }
+
+    /**
+     * 璁剧疆鏈�澶х旱鍧愭爣
+     *
+     * @param maxYaxis 鏈�澶х旱鍧愭爣
+     */
+    public void setMaxYaxis(Integer maxYaxis) {
+        this.maxYaxis = maxYaxis;
+    }
 }
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/uav/domain/entity/Mission.java b/src/main/kotlin/com/flightfeather/uav/domain/entity/Mission.java
index 4272c58..d98aadf 100644
--- a/src/main/kotlin/com/flightfeather/uav/domain/entity/Mission.java
+++ b/src/main/kotlin/com/flightfeather/uav/domain/entity/Mission.java
@@ -20,14 +20,35 @@
     @Column(name = "end_time")
     private Date endTime;
 
-    @Column(name = "district_name")
-    private String districtName;
-
     /**
      * 鏁版嵁鏄惁宸茬粡鎷夊彇鍏ュ簱
      */
     @Column(name = "data_pulled")
     private Boolean dataPulled;
+
+    @Column(name = "province_code")
+    private String provinceCode;
+
+    @Column(name = "province_name")
+    private String provinceName;
+
+    @Column(name = "city_code")
+    private String cityCode;
+
+    @Column(name = "city_name")
+    private String cityName;
+
+    @Column(name = "district_code")
+    private String districtCode;
+
+    @Column(name = "district_name")
+    private String districtName;
+
+    @Column(name = "town_code")
+    private String townCode;
+
+    @Column(name = "town_name")
+    private String townName;
 
     /**
      * @return mission_code
@@ -100,20 +121,6 @@
     }
 
     /**
-     * @return district_name
-     */
-    public String getDistrictName() {
-        return districtName;
-    }
-
-    /**
-     * @param districtName
-     */
-    public void setDistrictName(String districtName) {
-        this.districtName = districtName == null ? null : districtName.trim();
-    }
-
-    /**
      * 鑾峰彇鏁版嵁鏄惁宸茬粡鎷夊彇鍏ュ簱
      *
      * @return data_pulled - 鏁版嵁鏄惁宸茬粡鎷夊彇鍏ュ簱
@@ -130,4 +137,116 @@
     public void setDataPulled(Boolean dataPulled) {
         this.dataPulled = dataPulled;
     }
+
+    /**
+     * @return province_code
+     */
+    public String getProvinceCode() {
+        return provinceCode;
+    }
+
+    /**
+     * @param provinceCode
+     */
+    public void setProvinceCode(String provinceCode) {
+        this.provinceCode = provinceCode == null ? null : provinceCode.trim();
+    }
+
+    /**
+     * @return province_name
+     */
+    public String getProvinceName() {
+        return provinceName;
+    }
+
+    /**
+     * @param provinceName
+     */
+    public void setProvinceName(String provinceName) {
+        this.provinceName = provinceName == null ? null : provinceName.trim();
+    }
+
+    /**
+     * @return city_code
+     */
+    public String getCityCode() {
+        return cityCode;
+    }
+
+    /**
+     * @param cityCode
+     */
+    public void setCityCode(String cityCode) {
+        this.cityCode = cityCode == null ? null : cityCode.trim();
+    }
+
+    /**
+     * @return city_name
+     */
+    public String getCityName() {
+        return cityName;
+    }
+
+    /**
+     * @param cityName
+     */
+    public void setCityName(String cityName) {
+        this.cityName = cityName == null ? null : cityName.trim();
+    }
+
+    /**
+     * @return district_code
+     */
+    public String getDistrictCode() {
+        return districtCode;
+    }
+
+    /**
+     * @param districtCode
+     */
+    public void setDistrictCode(String districtCode) {
+        this.districtCode = districtCode == null ? null : districtCode.trim();
+    }
+
+    /**
+     * @return district_name
+     */
+    public String getDistrictName() {
+        return districtName;
+    }
+
+    /**
+     * @param districtName
+     */
+    public void setDistrictName(String districtName) {
+        this.districtName = districtName == null ? null : districtName.trim();
+    }
+
+    /**
+     * @return town_code
+     */
+    public String getTownCode() {
+        return townCode;
+    }
+
+    /**
+     * @param townCode
+     */
+    public void setTownCode(String townCode) {
+        this.townCode = townCode == null ? null : townCode.trim();
+    }
+
+    /**
+     * @return town_name
+     */
+    public String getTownName() {
+        return townName;
+    }
+
+    /**
+     * @param townName
+     */
+    public void setTownName(String townName) {
+        this.townName = townName == null ? null : townName.trim();
+    }
 }
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/uav/domain/mapper/GridDataDetailMapper.kt b/src/main/kotlin/com/flightfeather/uav/domain/mapper/GridDataDetailMapper.kt
index cf4437e..1ca3b8e 100644
--- a/src/main/kotlin/com/flightfeather/uav/domain/mapper/GridDataDetailMapper.kt
+++ b/src/main/kotlin/com/flightfeather/uav/domain/mapper/GridDataDetailMapper.kt
@@ -3,8 +3,16 @@
 import com.flightfeather.uav.domain.MyMapper
 import com.flightfeather.uav.domain.entity.GridDataDetail
 import org.apache.ibatis.annotations.Mapper
+import org.apache.ibatis.annotations.Select
 
 @Mapper
 interface GridDataDetailMapper : MyMapper<GridDataDetail?> {
+
     fun updatePM25Batch(gridDataDetails: List<GridDataDetail>)
+
+    /**
+     * 閲嶇疆鑷id
+     */
+    @Select("alter table grid_data_detail auto_increment = #{param1}")
+    fun resetAutoIncrement(id: Int)
 }
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/uav/domain/mapper/GridDataMapper.kt b/src/main/kotlin/com/flightfeather/uav/domain/mapper/GridDataMapper.kt
index e44eb7d..5537e09 100644
--- a/src/main/kotlin/com/flightfeather/uav/domain/mapper/GridDataMapper.kt
+++ b/src/main/kotlin/com/flightfeather/uav/domain/mapper/GridDataMapper.kt
@@ -3,6 +3,14 @@
 import com.flightfeather.uav.domain.MyMapper
 import com.flightfeather.uav.domain.entity.GridData
 import org.apache.ibatis.annotations.Mapper
+import org.apache.ibatis.annotations.Select
 
 @Mapper
-interface GridDataMapper : MyMapper<GridData?>
\ No newline at end of file
+interface GridDataMapper : MyMapper<GridData?> {
+
+    /**
+     * 閲嶇疆鑷id
+     */
+    @Select("alter table grid_data auto_increment = #{param1}")
+    fun resetAutoIncrement(id: Int)
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/uav/domain/repository/SatelliteGridRep.kt b/src/main/kotlin/com/flightfeather/uav/domain/repository/SatelliteGridRep.kt
index 202983d..9233bcb 100644
--- a/src/main/kotlin/com/flightfeather/uav/domain/repository/SatelliteGridRep.kt
+++ b/src/main/kotlin/com/flightfeather/uav/domain/repository/SatelliteGridRep.kt
@@ -8,6 +8,7 @@
 import com.flightfeather.uav.domain.mapper.GridDataMapper
 import com.flightfeather.uav.domain.mapper.GridGroupMapper
 import com.flightfeather.uav.lightshare.bean.AreaVo
+import com.github.pagehelper.PageHelper
 import org.springframework.stereotype.Repository
 import org.springframework.transaction.annotation.Transactional
 import tk.mybatis.mapper.entity.Example
@@ -54,12 +55,14 @@
     @Transactional
     fun deleteGridGroup(groupId: Int) {
         gridCellMapper.delete(GridCell().apply { this.groupId = groupId })
+        PageHelper.startPage<GridCell>(1, 1)
         gridCellMapper.selectByExample(
             Example(GridCell::class.java).apply { orderBy("id").desc() }
         ).takeIf { it.isNotEmpty() }?.get(0)?.id?.let { id ->
             gridCellMapper.resetAutoIncrement(id + 1)
         }
         gridGroupMapper.deleteByPrimaryKey(groupId)
+        PageHelper.startPage<GridGroup>(1, 1)
         gridGroupMapper.selectByExample(
             Example(GridGroup::class.java).apply { orderBy("id").desc() }
         ).takeIf { it.isNotEmpty() }?.get(0)?.id?.let { id ->
@@ -136,6 +139,25 @@
         gridDataDetailMapper.updatePM25Batch(gridDataDetails)
     }
 
+    @Transactional
+    @Throws
+    fun deleteGridData(dataId: Int?) {
+        gridDataDetailMapper.delete(GridDataDetail().apply { this.dataId = dataId })
+        // Fixme 2025.4.16 姝ゅ鐨勯噸缃嚜澧瀒d鍙湪鍒犻櫎鏈�鏂版暟鎹殑鎯呭喌涓嬫湁鏁堬紝鍚庣画鑰冭檻涓嶉�傜敤鑷涓婚敭锛屾敼涓烘柊鐨勪富閿敓鎴愭柟寮�
+//        PageHelper.startPage<GridDataDetail>(1, 1)
+//        gridDataDetailMapper.selectByExample(Example(GridDataDetail::class.java).apply { orderBy("id").desc() })
+//            .takeIf { it.isNotEmpty() }?.get(0)?.id?.let { id ->
+//                gridDataDetailMapper.resetAutoIncrement(id + 1)
+//            }
+        gridDataMapper.deleteByPrimaryKey(dataId)
+//        PageHelper.startPage<GridData>(1, 1)
+//        gridDataMapper.selectByExample(
+//            Example(GridData::class.java).apply { orderBy("id").desc() }
+//        ).takeIf { it.isNotEmpty() }?.get(0)?.id?.let { id ->
+//            gridDataMapper.resetAutoIncrement(id + 1)
+//        }
+    }
+
     /*****************************************************************/
 
     //    aod 鐩稿叧鎿嶄綔
diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/DataAnalysisService.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/DataAnalysisService.kt
new file mode 100644
index 0000000..31d6937
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/service/DataAnalysisService.kt
@@ -0,0 +1,17 @@
+package com.flightfeather.uav.lightshare.service
+
+import com.flightfeather.uav.biz.dataanalysis.model.ExceptionResult
+
+/**
+ *
+ * @date 2025/5/8
+ * @author feiyu02
+ */
+interface DataAnalysisService {
+
+    /**
+     * 姹℃煋婧簮鍒嗘瀽
+     * @param missionCode 璧拌埅浠诲姟缂栧彿
+     */
+    fun pollutionTrace(missionCode: String): List<ExceptionResult>
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/SatelliteDataCalculateService.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/SatelliteDataCalculateService.kt
index d858605..de35772 100644
--- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/SatelliteDataCalculateService.kt
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/service/SatelliteDataCalculateService.kt
@@ -1,6 +1,7 @@
 package com.flightfeather.uav.lightshare.service
 
 import com.flightfeather.uav.domain.entity.GridCell
+import com.flightfeather.uav.domain.entity.GridData
 import com.flightfeather.uav.domain.entity.GridDataDetail
 import com.flightfeather.uav.lightshare.bean.GridDataDetailMixVo
 
@@ -33,10 +34,9 @@
 
     /**
      * 灏嗚蛋鑸洃娴嬫暟鎹拰鍗槦缃戞牸杩涜铻嶅悎璁$畻
-     * @param missionCode
-     * @param groupId
+     * @param gridData
      */
-    fun dataFusion(missionCode: String, groupId: Int): List<GridDataDetail?>
+    fun dataFusion(gridData: GridData): List<GridDataDetail?>
 
     /**
      * 璧拌埅鏁版嵁铻嶅悎
@@ -44,7 +44,7 @@
      * @param dataIdList 铻嶅悎鐨勬暟鎹甶d绱㈠紩鏁扮粍
      */
     // Fixme 2025.3.28: 闇�瑕佸拰[SatelliteTelemetryService.mixGridData]鍑芥暟鍚堝苟
-    fun mixGridData(groupId: Int, dataIdList: List<Int>): List<GridDataDetailMixVo>
+    fun mixUnderwayGridData(groupId: Int, dataIdList: List<Int>): List<GridDataDetailMixVo>
 
     /**
      * 灏嗚蛋鑸綉鏍兼暟鎹敓鎴愬搴旂殑鐑姏缃戞牸鍥�
diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/SatelliteTelemetryService.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/SatelliteTelemetryService.kt
index d75f91b..e1e16c9 100644
--- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/SatelliteTelemetryService.kt
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/service/SatelliteTelemetryService.kt
@@ -29,18 +29,19 @@
 
     fun fetchGridData(groupId: Int, dataTime: LocalDateTime?, type: Int?): List<GridData?>
 
+    fun fetchGridData(gridData: GridData): List<GridData?>
+
+    fun deleteGridData(dataId: Int): Boolean
+
     fun fetchGridDataDetail(dataId: Int, groupId: Int?, cellId: Int?): List<GridDataDetail?>
 
     fun createGridDataAndDataDetail(
-        groupId: Int,
-        dataTime: LocalDateTime?,
-        gridDataDetail: List<GridDataDetail>,
-    ): Boolean
+        groupId: Int, dataTime: LocalDateTime?, gridDataDetail: List<GridDataDetail>): Boolean
 
     /**
      * 鏁版嵁铻嶅悎
      */
-    // Fixme 2025.3.28: 闇�瑕佸拰[SatelliteDataCalculateService.mixGridData]鍑芥暟鍚堝苟
+    // Fixme 2025.3.28: 闇�瑕佸拰[SatelliteDataCalculateService.mixUnderwayGridData]鍑芥暟鍚堝苟
     fun mixGridData(dataIdList: List<Int>): List<GridData?>
 
     @Throws(BizException::class)
@@ -52,12 +53,6 @@
     fun importGridAOD(groupId: Int, dataTime: LocalDateTime?, update: Boolean, file: MultipartFile): GridDataImportResult?
 
     fun downloadAODTemplate(response: HttpServletResponse): Boolean
-
-    /**
-     * 鏍规嵁鍗槦閬ユ祴缃戞牸鐨勪腑蹇冨潗鏍囩偣锛岃绠楃綉鏍�4涓《鐐瑰潗鏍�
-     * @param groupId 缃戞牸缁勭储寮昳d
-     */
-    fun calGridVertex(groupId: Int): List<GridCell?>
 
 
     /**AOD鏁版嵁鐩稿叧**************************************************************/
diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/DataAnalysisServiceImpl.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/DataAnalysisServiceImpl.kt
new file mode 100644
index 0000000..d64872d
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/DataAnalysisServiceImpl.kt
@@ -0,0 +1,47 @@
+package com.flightfeather.uav.lightshare.service.impl
+
+import com.flightfeather.uav.biz.FactorFilter
+import com.flightfeather.uav.biz.dataanalysis.ExceptionAnalysisController
+import com.flightfeather.uav.biz.dataanalysis.model.ExceptionResult
+import com.flightfeather.uav.common.exception.BizException
+import com.flightfeather.uav.common.location.LocationRoadNearby
+import com.flightfeather.uav.domain.repository.MissionRep
+import com.flightfeather.uav.domain.repository.RealTimeDataRep
+import com.flightfeather.uav.domain.repository.SegmentInfoRep
+import com.flightfeather.uav.lightshare.service.DataAnalysisService
+import com.flightfeather.uav.socket.eunm.FactorType
+import org.springframework.stereotype.Service
+
+/**
+ *
+ * @date 2025/5/8
+ * @author feiyu02
+ */
+@Service
+class DataAnalysisServiceImpl(
+    private val missionRep: MissionRep,
+    private val realTimeDataRep: RealTimeDataRep,
+    private val locationRoadNearby: LocationRoadNearby,
+    private val segmentInfoRep: SegmentInfoRep,
+) : DataAnalysisService {
+
+    override fun pollutionTrace(missionCode: String): List<ExceptionResult> {
+        val mission = missionRep.findOne(missionCode) ?: throw BizException("璧拌埅浠诲姟涓嶅瓨鍦�")
+
+        val exceptionAnalysisController =
+            ExceptionAnalysisController(realTimeDataRep, locationRoadNearby, segmentInfoRep)
+
+        return exceptionAnalysisController.execute(
+            mission, FactorFilter.builder()
+//                .withMain(FactorType.NO2)
+                .withMain(FactorType.CO)
+//                .withMain(FactorType.H2S)
+//                .withMain(FactorType.SO2)
+//                .withMain(FactorType.O3)
+                .withMain(FactorType.PM25)
+                .withMain(FactorType.PM10)
+                .withMain(FactorType.VOC)
+                .create()
+        )
+    }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteDataCalculateServiceImpl.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteDataCalculateServiceImpl.kt
index ece5805..93866e6 100644
--- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteDataCalculateServiceImpl.kt
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteDataCalculateServiceImpl.kt
@@ -60,6 +60,7 @@
         return cellList
     }
 
+    @Transactional
     override fun splitGrid(groupId: Int, scale: Int): List<GridCell?> {
         // 妫�鏌ヨ缃戞牸灞炴�ф槸鍚﹀悎瑙�
         val gridGroup =
@@ -134,7 +135,10 @@
     }
 
     @Transactional
-    override fun dataFusion(missionCode: String, groupId: Int): List<GridDataDetail?> {
+    override fun dataFusion(gridData: GridData): List<GridDataDetail?> {
+        val missionCode = gridData.missionCode ?: throw BizException("缂哄皯浠诲姟缂栧彿")
+        val groupId = gridData.groupId ?: throw BizException("缂哄皯缃戞牸缁刬d")
+
         // 鏌ヨ璧拌埅浠诲姟鍙婂搴旇蛋鑸洃娴嬫暟鎹�
         val mission = missionRep.findOne(missionCode) ?: throw BizException("浠诲姟涓嶅瓨鍦�")
         val data = realTimeDataRep.fetchData(mission)
@@ -142,25 +146,24 @@
         // 鏌ユ壘鏄惁宸叉湁璧拌埅铻嶅悎璁板綍
         val oldGridDataList = satelliteGridRep.fetchGridData(GridData().apply {
             this.groupId = groupId
-            mixDataId = missionCode
+            this.missionCode = missionCode
             this.type = SatelliteDataType.Monitor.value.toByte()
         })
 
         if (oldGridDataList.isEmpty()) {
             // 鍒涘缓铻嶅悎鏁版嵁绱㈠紩瀵硅薄
-            val newGridData = GridData().apply {
+            val newGridData = gridData.apply {
                 this.groupId = groupId
                 dataTime = mission.startTime
                 type = SatelliteDataType.Monitor.value.toByte()
                 this.missionCode = mission.missionCode
-                // Fixme 2025.3.27: 琛屾斂鍖哄垝鍦ㄨ蛋鑸换鍔℃坊鍔犲搴斿瓧娈靛悗杩涜璧嬪��
-                provinceCode
-                provinceName
-                cityCode
-                cityName
-                districtCode
+                provinceCode = mission.provinceCode
+                provinceName = mission.provinceName
+                cityCode = mission.cityCode
+                cityName = mission.cityName
+                districtCode = mission.districtCode
                 districtName = mission.districtName
-                // Fixme 2025.3.27: 鎵�灞炵洃娴嬬偣鍖哄煙鐩墠闇�瑕侀�氳繃鐢ㄦ埛閫夋嫨纭畾
+                // 2025.3.27: 鎵�灞炵洃娴嬬偣鍖哄煙闇�瑕侀�氳繃鐢ㄦ埛閫夋嫨纭畾
                 zone
                 pollutionDegreeIndex
                 pollutionDegree
@@ -199,7 +202,7 @@
         }
     }
 
-    override fun mixGridData(groupId: Int, dataIdList: List<Int>): List<GridDataDetailMixVo> {
+    override fun mixUnderwayGridData(groupId: Int, dataIdList: List<Int>): List<GridDataDetailMixVo> {
         // 鑾峰彇鎵�浣跨敤鐨勭綉鏍肩粍缃戞牸淇℃伅
         val gridCellList = satelliteGridRep.fetchGridCell(groupId)
 
@@ -248,10 +251,11 @@
         gridDataDetailList: List<GridDataDetail>,
         searchLength: Int,
     ): List<GridDataDetail> {
+        val gridGroup =satelliteGridRep.fetchGridGroup(groupId)
         val gridCellList = satelliteGridRep.fetchGridCell(groupId)
         val originCellIdList = gridDataDetailList.map { it.cellId }
         // Fixme 2025.3.24: 姝ゅ鏍规嵁鐜版湁鐨勭綉鏍间俊鎭璁℃柟寮忥紝浣跨敤涓存椂鐨勫弬鏁帮紝鍚庣画灏嗙綉鏍奸�氳繃浜岀淮鍧愭爣褰㈠紡琛ㄧず锛屾澶勫弬鏁板幓闄�
-        val option = GridGroupOption(120, 90, 10, 10)
+        val option = GridGroupOption(gridGroup?.maxXaxis ?: 120, gridGroup?.maxYaxis ?: 90, 10, 10)
 
         val resMap = mutableMapOf<Int, MutableList<GridDataDetail>>()
 
diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImpl.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImpl.kt
index 4038e82..33c310e 100644
--- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImpl.kt
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImpl.kt
@@ -54,6 +54,20 @@
         return satelliteGridRep.fetchGridData(groupId, dataTime, type)
     }
 
+    override fun fetchGridData(gridData: GridData): List<GridData?> {
+        return satelliteGridRep.fetchGridData(gridData)
+    }
+
+    override fun deleteGridData(dataId: Int): Boolean {
+        try {
+            satelliteGridRep.deleteGridData(dataId)
+        } catch (e: Exception) {
+            // todo: 鍔犲叆鏃ュ織瀛樺偍閫昏緫
+            return false
+        }
+        return true
+    }
+
     override fun fetchGridDataDetail(dataId: Int, groupId: Int?, cellId: Int?): List<GridDataDetail?> {
         val res =  satelliteGridRep.fetchGridDataDetail(dataId, groupId, cellId)
         res.forEach {
@@ -234,35 +248,6 @@
             response.outputStream.write(file.readBytes())
         }
         return true
-    }
-
-    override fun calGridVertex(groupId: Int): List<GridCell?> {
-        val cellList = satelliteGridRep.fetchGridCell(groupId)
-        val vertexList = SatelliteGridManage.calGridVertex(cellList.map {
-            if (it?.longitude == null || it.latitude == null) {
-                throw BizException("鍗槦閬ユ祴缃戞牸璁$畻椤剁偣鍧愭爣鐐瑰け璐ワ紝瀛樺湪涓績鐐瑰潗鏍囦负绌虹殑鎯呭喌")
-            }
-            it.longitude?.toDouble()!! to it.latitude?.toDouble()!!
-        })
-
-        cellList.forEachIndexed { i, c ->
-            val v = vertexList[i]
-            c?.point1Lon = v.point1Lon.toBigDecimal()
-            c?.point1Lat = v.point1Lat.toBigDecimal()
-
-            c?.point2Lon = v.point2Lon.toBigDecimal()
-            c?.point2Lat = v.point2Lat.toBigDecimal()
-
-            c?.point3Lon = v.point3Lon.toBigDecimal()
-            c?.point3Lat = v.point3Lat.toBigDecimal()
-
-            c?.point4Lon = v.point4Lon.toBigDecimal()
-            c?.point4Lat = v.point4Lat.toBigDecimal()
-        }
-
-        satelliteGridRep.updateGridCellBatch(cellList)
-
-        return cellList
     }
 
     override fun fetchGridAod(groupId: Int, dataTime: LocalDateTime?): List<GridAod?> {
diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/web/DataAnalysisController.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/web/DataAnalysisController.kt
new file mode 100644
index 0000000..26b0fbe
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/web/DataAnalysisController.kt
@@ -0,0 +1,28 @@
+package com.flightfeather.uav.lightshare.web
+
+import com.flightfeather.uav.lightshare.bean.AreaVo
+import com.flightfeather.uav.lightshare.service.DataAnalysisService
+import io.swagger.annotations.Api
+import io.swagger.annotations.ApiOperation
+import io.swagger.annotations.ApiParam
+import org.springframework.web.bind.annotation.*
+
+/**
+ * 璧拌埅鏁版嵁鍒嗘瀽
+ * @date 2025/5/8
+ * @author feiyu02
+ */
+@Api(tags = ["璧拌埅鏁版嵁鍒嗘瀽API鎺ュ彛"])
+@RestController
+@RequestMapping("air/analysis")
+class DataAnalysisController(private val dataAnalysisService: DataAnalysisService) {
+
+    @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) }
+
+}
\ No newline at end of file
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 20c487e..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,5 +1,6 @@
 package com.flightfeather.uav.lightshare.web
 
+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
@@ -48,11 +49,21 @@
         @ApiParam("缃戞牸缁刬d") @RequestParam groupId: Int,
         @ApiParam("閬ユ祴鏁版嵁鏃堕棿")
         @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") dataTime: LocalDateTime?,
-        @ApiParam(
-            "閬ユ祴鏁版嵁绫诲瀷",
-            allowableValues = "0锛氬師濮嬪崼鏄熼仴娴嬫暟鎹紱1锛氳瀺鍚堟暟鎹�"
-        ) @RequestParam(required = false) type: Int?,
+        @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")
@@ -144,18 +155,19 @@
 
     /**閬ユ祴浜у搧鍒朵綔鐩稿叧**************************************************************/
     @ApiOperation(value = "鐢熸垚璧拌埅铻嶅悎浜у搧")
-    @GetMapping("/product/underway/build")
+    @PostMapping("/product/underway/build")
     fun buildUnderwayProduct(
-        @ApiParam("璧拌埅浠诲姟缂栧彿") @RequestParam missionCode: String,
-        @ApiParam("缃戞牸缁刬d") @RequestParam groupId: Int,
-    ) = resPack { satelliteDataCalculateService.dataFusion(missionCode, groupId) }
+//        @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.mixGridData(groupId, dataIdList) }
+    ) = resPack { satelliteDataCalculateService.mixUnderwayGridData(groupId, dataIdList) }
 
     @ApiOperation(value = "鐢熸垚璧拌埅鐑姏鍥�")
     @PostMapping("/product/underway/heatmap/build")
diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml
index 75ca738..02d8369 100644
--- a/src/main/resources/application-test.yml
+++ b/src/main/resources/application-test.yml
@@ -7,13 +7,13 @@
     #    password: cn.FLIGHTFEATHER
 
     #   杩滅▼鏈嶅姟鍣�
-#    url: jdbc:mysql://47.100.191.150:3306/dronemonitor?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
-#    username: remoteU1
-#    password: eSoF8DnzfGTlhAjE
-
-    url: jdbc:mysql://114.215.109.124:3306/dronemonitor?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
+    url: jdbc:mysql://47.100.191.150:3306/dronemonitor?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
     username: remoteU1
-    password: feiyu2024
+    password: eSoF8DnzfGTlhAjE
+
+#    url: jdbc:mysql://114.215.109.124:3306/dronemonitor?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
+#    username: remoteU1
+#    password: feiyu2024
 
 springfox:
   documentation:
diff --git a/src/main/resources/generator/generatorConfig.xml b/src/main/resources/generator/generatorConfig.xml
index c188146..02686f9 100644
--- a/src/main/resources/generator/generatorConfig.xml
+++ b/src/main/resources/generator/generatorConfig.xml
@@ -52,7 +52,7 @@
         </javaClientGenerator>
         <!-- 瑕佺敓鎴愮殑琛� tableName鏄暟鎹簱涓殑琛ㄥ悕鎴栬鍥惧悕 domainObjectName鏄疄浣撶被鍚�-->
 <!--        <table tableName="air_real_time_data" domainObjectName="RealTimeData" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
-<!--        <table tableName="mission" domainObjectName="Mission" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
+        <table tableName="mission" domainObjectName="Mission" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>
 <!--        <table tableName="el_minutevalue" domainObjectName="ElectricMinuteValue" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
 <!--        <table tableName="el_company_device" domainObjectName="CompanyDevice" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
 <!--        <table tableName="co_complaint" domainObjectName="Complaint" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
@@ -68,7 +68,7 @@
 <!--        <table tableName="segment_info" domainObjectName="SegmentInfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
 <!--        <table tableName="grid_group" domainObjectName="GridGroup" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
 <!--        <table tableName="grid_cell" domainObjectName="GridCell" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
-        <table tableName="grid_data" domainObjectName="GridData" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>
+<!--        <table tableName="grid_data" domainObjectName="GridData" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
 <!--        <table tableName="grid_data_detail" domainObjectName="GridDataDetail" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
     </context>
 </generatorConfiguration>
\ No newline at end of file
diff --git a/src/main/resources/mapper/GridGroupMapper.xml b/src/main/resources/mapper/GridGroupMapper.xml
index c7a1641..e03d6dd 100644
--- a/src/main/resources/mapper/GridGroupMapper.xml
+++ b/src/main/resources/mapper/GridGroupMapper.xml
@@ -19,12 +19,14 @@
     <result column="length" jdbcType="DOUBLE" property="length" />
     <result column="type" jdbcType="VARCHAR" property="type" />
     <result column="father_group_id" jdbcType="INTEGER" property="fatherGroupId" />
+    <result column="max_xaxis" jdbcType="INTEGER" property="maxXaxis" />
+    <result column="max_yaxis" jdbcType="INTEGER" property="maxYaxis" />
   </resultMap>
   <sql id="Base_Column_List">
     <!--
       WARNING - @mbg.generated
     -->
     id, name, province_code, province_name, city_code, city_name, district_code, district_name, 
-    town_code, town_name, create_time, length, type, father_group_id
+    town_code, town_name, create_time, length, type, father_group_id, max_xaxis, max_yaxis
   </sql>
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/MissionMapper.xml b/src/main/resources/mapper/MissionMapper.xml
index 31c198e..e6dbcb6 100644
--- a/src/main/resources/mapper/MissionMapper.xml
+++ b/src/main/resources/mapper/MissionMapper.xml
@@ -10,13 +10,21 @@
     <result column="device_code" jdbcType="VARCHAR" property="deviceCode" />
     <result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
     <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
-    <result column="district_name" jdbcType="VARCHAR" property="districtName" />
     <result column="data_pulled" jdbcType="BIT" property="dataPulled" />
+    <result column="province_code" jdbcType="VARCHAR" property="provinceCode" />
+    <result column="province_name" jdbcType="VARCHAR" property="provinceName" />
+    <result column="city_code" jdbcType="VARCHAR" property="cityCode" />
+    <result column="city_name" jdbcType="VARCHAR" property="cityName" />
+    <result column="district_code" jdbcType="VARCHAR" property="districtCode" />
+    <result column="district_name" jdbcType="VARCHAR" property="districtName" />
+    <result column="town_code" jdbcType="VARCHAR" property="townCode" />
+    <result column="town_name" jdbcType="VARCHAR" property="townName" />
   </resultMap>
   <sql id="Base_Column_List">
     <!--
       WARNING - @mbg.generated
     -->
-    mission_code, device_type, device_code, start_time, end_time, district_name, data_pulled
+    mission_code, device_type, device_code, start_time, end_time, data_pulled, province_code, 
+    province_name, city_code, city_name, district_code, district_name, town_code, town_name
   </sql>
 </mapper>
\ No newline at end of file
diff --git a/src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/DataAnalysisServiceImplTest.kt b/src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/DataAnalysisServiceImplTest.kt
new file mode 100644
index 0000000..13faf0b
--- /dev/null
+++ b/src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/DataAnalysisServiceImplTest.kt
@@ -0,0 +1,22 @@
+package com.flightfeather.uav.lightshare.service.impl
+
+import com.flightfeather.uav.lightshare.service.DataAnalysisService
+import junit.framework.TestCase
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.boot.test.context.SpringBootTest
+import org.springframework.test.context.junit4.SpringRunner
+
+@RunWith(SpringRunner::class)
+@SpringBootTest
+class DataAnalysisServiceImplTest{
+
+    @Autowired
+    lateinit var dataAnalysisService: DataAnalysisService
+
+    @Test
+    fun testPollutionTrace() {
+        dataAnalysisService.pollutionTrace("SH-CN-20250116")
+    }
+}
\ No newline at end of file
diff --git a/src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteDataCalculateServiceImplTest.kt b/src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteDataCalculateServiceImplTest.kt
index 3e11665..50d0001 100644
--- a/src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteDataCalculateServiceImplTest.kt
+++ b/src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteDataCalculateServiceImplTest.kt
@@ -51,8 +51,13 @@
     }
 
     @Test
+    fun calGridVertex() {
+        satelliteDataCalculateService.calGridVertex(5)
+    }
+
+    @Test
     fun splitGrid() {
-        val res = satelliteDataCalculateService.splitGrid(1, 4)
+        val res = satelliteDataCalculateService.splitGrid(1, 10)
 //        println(res)
     }
 
@@ -100,7 +105,10 @@
                 "SH-CN-20250120"
             )
         missionList.forEach { m ->
-            satelliteDataCalculateService.dataFusion(m, 3)
+            satelliteDataCalculateService.dataFusion(GridData().apply {
+                missionCode = m
+                type = 3
+            })
         }
 //        val res = satelliteDataCalculateService.dataFusion("SH-CN-20241216", 3)
     }
diff --git a/src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImplTest.kt b/src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImplTest.kt
index a675491..88ca0c1 100644
--- a/src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImplTest.kt
+++ b/src/test/kotlin/com/flightfeather/uav/lightshare/service/impl/SatelliteTelemetryServiceImplTest.kt
@@ -24,12 +24,7 @@
     }
 
     @Test
-    fun calGridVertex() {
-        satelliteTelemetryService.calGridVertex(1)
-    }
-
-    @Test
     fun deleteGridGroup() {
-        satelliteTelemetryService.deleteGridGroup(2)
+        satelliteTelemetryService.deleteGridGroup(6)
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3