From 37d47c6a7ab0f454b948b68c987146b261117993 Mon Sep 17 00:00:00 2001
From: Riku <risaku@163.com>
Date: 星期日, 13 七月 2025 22:47:21 +0800
Subject: [PATCH] 2025.7.13 动态溯源逻辑调整

---
 src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/SourceTraceController.kt |   49 ++++++++++++++++++++++++++++++-------------------
 1 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/SourceTraceController.kt b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/SourceTraceController.kt
index 504efa2..d721f59 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/SourceTraceController.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/SourceTraceController.kt
@@ -2,13 +2,11 @@
 
 import com.flightfeather.uav.biz.FactorFilter
 import com.flightfeather.uav.biz.dataanalysis.BaseExceptionAnalysis
-import com.flightfeather.uav.biz.sourcetrace.RealTimeAnalysisConfig
 import com.flightfeather.uav.biz.sourcetrace.config.RTExcWindLevelConfig
 import com.flightfeather.uav.biz.sourcetrace.exceptiontype.*
 import com.flightfeather.uav.biz.sourcetrace.model.AnalysisResult
 import com.flightfeather.uav.biz.sourcetrace.model.PollutedClue
 import com.flightfeather.uav.biz.sourcetrace.model.PollutedSummary
-import com.flightfeather.uav.common.utils.GsonUtils
 import com.flightfeather.uav.domain.entity.BaseRealTimeData
 import com.flightfeather.uav.domain.repository.SceneInfoRep
 import com.flightfeather.uav.domain.repository.SourceTraceRep
@@ -34,19 +32,23 @@
         this.sceneInfoRep = sceneInfoRep
         this.sourceTraceRep = sourceTraceRep
         this.config = if (factorFilter != null) {
-            RTExcWindLevelConfig(factorFilter)
+            RTExcWindLevelConfig(factorFilter, emptyList())
         } else {
             RTExcWindLevelConfig(
                 FactorFilter.builder()
-//                    .withMain(FactorType.NO2)
-//                    .withMain(FactorType.CO)
+                    .withMain(FactorType.NO2)
+                    .withMain(FactorType.CO)
 //                    .withMain(FactorType.H2S)
 //                    .withMain(FactorType.SO2)
-//                    .withMain(FactorType.O3)
+                    .withMain(FactorType.O3)
                     .withMain(FactorType.PM25)
                     .withMain(FactorType.PM10)
                     .withMain(FactorType.VOC)
-                    .create()
+                    .create(),
+                listOf(
+                    listOf(FactorType.PM25, FactorType.PM10),
+                    listOf(FactorType.VOC, FactorType.CO),
+                )
             )
         }
         pollutedSummary = PollutedSummary(config) { summaryCallback(it) }
@@ -74,8 +76,13 @@
             add(RTExcWindLevel1_1(config) { exceptionCallback(it) }.also { it.init() })
             add(RTExcWindLevel4(config) { exceptionCallback(it) }.also { it.init() })
             add(RTExcWindLevel6(config) { exceptionCallback(it) }.also { it.init() })
-            add(RTExcChangeRate(config) { exceptionCallback(it) }.also { it.init() })
+
+            add(RTExcChangeRate1(config) { exceptionCallback(it) }.also { it.init() })
+            add(RTExcChangeRate4(config) { exceptionCallback(it) }.also { it.init() })
+            add(RTExcChangeRate6(config) { exceptionCallback(it) }.also { it.init() })
+
             add(RTWarnChangeRate(config) { dataChangeCallback(it) }.also { it.init() })
+            add(RTWarnChangeRate2(config) { dataChangeCallback(it) }.also { it.init() })
         }
     }
 
@@ -103,28 +110,32 @@
     }
 
     // 鏁版嵁绐佸彉寮傚父鍥炶皟
-    private fun exceptionCallback(ex: PollutedClue) {
-        // 婧簮姹℃煋婧愪俊鎭�
-        ex.searchScenes(sceneInfoRep)
-        ex.msgType = MsgType.PolClue.value
+    private fun exceptionCallback(ex: List<PollutedClue>) {
+        ex.forEach {
+            // 婧簮姹℃煋婧愪俊鎭�
+            it.searchScenes(sceneInfoRep)
+            it.msgType = MsgType.PolClue.value
+        }
 
         // 骞挎挱姹℃煋婧簮寮傚父缁撴灉
         UnderwayWebSocketSender.broadcast(MsgType.PolClue.value, ex)
-        sourceTraceRep.insert(MsgType.PolClue, ex)
+        sourceTraceRep.insertList(MsgType.PolClue, ex)
 
         // 璁板綍姹℃煋绾跨储
-        pollutedSummary.addClue(ex)
+        pollutedSummary.addClueList(ex)
     }
 
     // 鏁版嵁鍙樺寲鎻愰啋鍥炶皟
-    private fun dataChangeCallback(ex: PollutedClue) {
-        // 婧簮姹℃煋婧愪俊鎭�
-        ex.searchScenes(sceneInfoRep)
-        ex.msgType = MsgType.DataChange.value
+    private fun dataChangeCallback(ex: List<PollutedClue>) {
+        ex.forEach {
+            // 婧簮姹℃煋婧愪俊鎭�
+            it.searchScenes(sceneInfoRep)
+            it.msgType = MsgType.DataChange.value
+        }
 
         // 骞挎挱鏁版嵁鍙樺寲鎻愰啋
         UnderwayWebSocketSender.broadcast(MsgType.DataChange.value, ex)
-        sourceTraceRep.insert(MsgType.DataChange, ex)
+        sourceTraceRep.insertList(MsgType.DataChange, ex)
     }
 
     private fun summaryCallback(ex: AnalysisResult) {

--
Gitblit v1.9.3