From 594de76ed51fd49fb79b912212bb0052a63e7671 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期四, 09 四月 2026 16:10:45 +0800
Subject: [PATCH] 2026.4.9

---
 src/main/kotlin/com/flightfeather/uav/socket/processor/UnderwayProcessor.kt |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 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 7d8fd21..0058d2b 100644
--- a/src/main/kotlin/com/flightfeather/uav/socket/processor/UnderwayProcessor.kt
+++ b/src/main/kotlin/com/flightfeather/uav/socket/processor/UnderwayProcessor.kt
@@ -5,6 +5,7 @@
 import com.flightfeather.uav.model.epw.EPWDataPrep
 import com.flightfeather.uav.domain.repository.AirDataRep
 import com.flightfeather.uav.domain.repository.SceneInfoRep
+import com.flightfeather.uav.domain.repository.SourceTraceRep
 import com.flightfeather.uav.socket.bean.AirDataPackage
 import com.flightfeather.uav.socket.decoder.AirDataDecoder
 import com.flightfeather.uav.socket.decoder.DataPackageDecoder
@@ -25,6 +26,7 @@
 class UnderwayProcessor(
     private val airDataRep: AirDataRep,
     private val sceneInfoRep: SceneInfoRep,
+    private val sourceTraceRep: SourceTraceRep
 ) : BaseProcessor() {
 
     companion object {
@@ -53,7 +55,7 @@
             saveToDataBase(packageData)?.takeIf { it.isNotEmpty() }?.get(0)?.let {
                 // 姣忓彴璁惧鏈夊悇鑷崟鐙殑寮傚父鏁版嵁澶勭悊鍣�
                 if (!sourceTraceMap.containsKey(it.deviceCode)) {
-                    sourceTraceMap[it.deviceCode] = SourceTraceController(sceneInfoRep)
+                    sourceTraceMap[it.deviceCode] = SourceTraceController(sceneInfoRep, sourceTraceRep)
                 }
                 // 灏嗚蛋鑸暟鎹紶鍏ュ紓甯稿鐞嗗櫒
                 sourceTraceMap[it.deviceCode]?.addOneData(it)
@@ -70,6 +72,8 @@
     fun saveToDataBase(dataPackage: AirDataPackage): List<BaseRealTimeData>? {
         when (dataPackage.commandUnit) {
             AirCommandUnit.AirData.value -> {
+                // 瀛樺偍鍓嶅垽鏂暟鎹槸鍚︽湁鏁�
+                if (!isValid(dataPackage)) return null
                 // 浠son鏍煎紡瀛樺偍鍘熷鏁版嵁
                 airDataRep.saveAirData(dataPackage)
                 // 杩涜棰勫鐞嗗悗锛屽瓨鍌ㄨ嚦瀵瑰簲鏁版嵁琛�
@@ -143,4 +147,13 @@
 
         return sb.toString()
     }
+
+    /**
+     * 鏁版嵁鏈夋晥鎬у垽鏂�
+     */
+    private fun isValid(dataPackage: AirDataPackage): Boolean {
+        if (dataPackage.dataTime == null) return false
+        val check1 = dataPackage.dataTime!!.time < Date().time
+        return check1
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3