From f1ea263462d1f3f10a886fb083536a38b03a1ceb Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期三, 14 五月 2025 17:33:04 +0800
Subject: [PATCH] 1. 新增动态污染溯源的数据异常判断逻辑 2. 新增动态污染溯源websocket连接功能

---
 src/main/kotlin/com/flightfeather/uav/socket/processor/UnderwayProcessor.kt |   30 ++++++++----------------------
 1 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/uav/socket/processor/UnderwayProcessor.kt b/src/main/kotlin/com/flightfeather/uav/socket/processor/UnderwayProcessor.kt
index a649598..6c5f374 100644
--- a/src/main/kotlin/com/flightfeather/uav/socket/processor/UnderwayProcessor.kt
+++ b/src/main/kotlin/com/flightfeather/uav/socket/processor/UnderwayProcessor.kt
@@ -7,6 +7,7 @@
 import com.flightfeather.uav.model.epw.EPWDataPrep
 import com.flightfeather.uav.domain.repository.AirDataRep
 import com.flightfeather.uav.domain.repository.RealTimeDataRep
+import com.flightfeather.uav.domain.repository.SceneInfoRep
 import com.flightfeather.uav.domain.repository.SegmentInfoRep
 import com.flightfeather.uav.socket.bean.AirDataPackage
 import com.flightfeather.uav.socket.decoder.AirDataDecoder
@@ -31,10 +32,7 @@
 @Component
 class UnderwayProcessor(
     private val airDataRep: AirDataRep,
-    private val realTimeDataRep: RealTimeDataRep,
-    private val locationRoadNearby: LocationRoadNearby,
-    private val segmentInfoRep: SegmentInfoRep,
-    private val underwayWebSocketServerHandler: UnderwayWebSocketServerHandler,
+    private val sceneInfoRep: SceneInfoRep,
 ) : BaseProcessor() {
 
     companion object {
@@ -48,23 +46,7 @@
     private val dataProcessMap = mutableMapOf<String?, EPWDataPrep>()
 
     // 瀹炴椂璧拌埅姹℃煋婧簮澶勭悊鍣�
-    private val realTimeExceptionAnalysisController =
-        RealTimeExceptionAnalysisController(
-            realTimeDataRep,
-            locationRoadNearby,
-            segmentInfoRep,
-            underwayWebSocketServerHandler,
-            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()
-        )
+    private val realTimeExceptionAnalysisMap = mutableMapOf<String?, RealTimeExceptionAnalysisController>()
 
     override var tag: String = "璧拌埅鐩戞祴"
 
@@ -77,8 +59,12 @@
             deviceSession.saveDevice(packageData.deviceCode, ctx)
             saveToTxt(msg)
             saveToDataBase(packageData)?.takeIf { it.isNotEmpty() }?.get(0)?.let {
+                // 姣忓彴璁惧鏈夊悇鑷崟鐙殑寮傚父鏁版嵁澶勭悊鍣�
+                if (!realTimeExceptionAnalysisMap.containsKey(it.deviceCode)) {
+                    realTimeExceptionAnalysisMap[it.deviceCode] = RealTimeExceptionAnalysisController(sceneInfoRep)
+                }
                 // 灏嗚蛋鑸暟鎹紶鍏ュ紓甯稿鐞嗗櫒
-                realTimeExceptionAnalysisController.addOneData(it)
+                realTimeExceptionAnalysisMap[it.deviceCode]?.addOneData(it)
             }
 
         } else {

--
Gitblit v1.9.3