From 20b8d870efbbb89564b599561fc69202ba41223f Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 10 四月 2026 13:36:42 +0800
Subject: [PATCH] 2026.4.10 1. 修复采样时间超过当前时间的数据依旧能存入数据库的bug

---
 src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/BaseRTExcWindLevel.kt |   53 ++++++++++++++++++++++++++++-------------------------
 1 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/BaseRTExcWindLevel.kt b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/BaseRTExcWindLevel.kt
index 490c6ac..898b806 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/BaseRTExcWindLevel.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/BaseRTExcWindLevel.kt
@@ -16,7 +16,7 @@
 
 
 // 寮傚父鏁版嵁鐢熸垚鍥炶皟绫�
-typealias NewPolluteClueCallback = (ex: List<PollutedClue>) -> Unit
+typealias NewPolluteClueCallback = (ex: PollutedClue) -> Unit
 /**
  * 涓嶅悓椋庨�熶笅锛屾暟鎹獊鍙樺紓甯稿熀绫�
  * @date 2025/5/29
@@ -29,9 +29,13 @@
         this.callback = callback
     }
 
+    override var excludedFactor: List<FactorType> = listOf(FactorType.NO2)
+
     private var callback: NewPolluteClueCallback? = null
 
     abstract var windLevelCondition: RTExcWindLevelConfig.WindLevelCondition
+
+    override var judgeMethod: JudgeMethod = JudgeMethod.M1
 
     override fun getExceptionType(): ExceptionType {
         return ExceptionType.TYPE4
@@ -62,13 +66,13 @@
             val con = windLevelCondition
 
             if (n.windSpeed!! in con.windSpeed.first..con.windSpeed.second) {
-                println("椋庨�燂細${n.windSpeed}锛孾${con.windSpeed.first} - ${con.windSpeed.second}]")
+//                println("椋庨�燂細${n.windSpeed}锛孾${con.windSpeed.first} - ${con.windSpeed.second}]")
                 val pValue = p.getByFactorType(f)!!
                 val nValue = n.getByFactorType(f)!!
                 // 璁$畻鍚庝竴涓暟鎹浉姣斾簬鍓嶄竴涓暟鎹殑鍙樺寲鐜�
                 val r = (nValue - pValue) / pValue
                 val b1 = r >= con.mutationRate.first && r < con.mutationRate.second
-                println("鍥犲瓙锛�${f.des}锛屽箙搴︼細${r}锛岄檺瀹氾細${con.mutationRate.first}锛�${b1}")
+//                println("鍥犲瓙锛�${f.des}锛屽箙搴︼細${r}锛岄檺瀹氾細${con.mutationRate.first}锛�${b1}")
                 res[f] = b1
             } else {
                 res[f] = false
@@ -116,10 +120,17 @@
     }
 
     override fun newResult(tag: ExceptionTag, factor: FactorFilter.SelectedFactor): PollutedClue {
-        return PollutedClue(tag, factor, getExceptionType(), config, windLevelCondition)
+        return PollutedClue()
     }
 
-//    override fun newResult(
+    override fun newResult(exceptions: List<Pair<FactorFilter.SelectedFactor, ExceptionTag>>): PollutedClue {
+        return if (exceptions.isEmpty())
+            PollutedClue()
+        else
+            PollutedClue(exceptions, getExceptionType(), config, windLevelCondition)
+    }
+
+    //    override fun newResult(
 //        start: BaseRealTimeData,
 //        end: BaseRealTimeData?,
 //        factor: FactorFilter.SelectedFactor,
@@ -128,28 +139,20 @@
 //        return PollutedClue(start, end, factor, exceptionData, getExceptionType(), config, windLevelCondition)
 //    }
 
-    override fun onNewException(
-        tag: ExceptionTag,
-        factor: FactorFilter.SelectedFactor,
-        exceptionStatus: ExceptionStatusType,
-    ) {
-        super.onNewException(tag, factor, exceptionStatus)
-//        callback?.let { func ->
-//            val exc = tag.exceptionResult.last()
-//            func.invoke(exc as PollutedClue)
-//        }
-    }
 
-    override fun mergeExceptionResult() {
-        super.mergeExceptionResult()
-        latestExceptionResult
-        latestCombinedResult
+//    override fun mergeExceptionResult() {
+//        super.mergeExceptionResult()
+//        callback?.let { func ->
+//            result.forEach {
+//                func.invoke(it)
+//            }
+//        }
+//    }
+
+    override fun onNewResult(result: List<PollutedClue>) {
         callback?.let { func ->
-            latestExceptionResult.forEach {
-                func.invoke(listOf(it as PollutedClue))
-            }
-            latestCombinedResult.forEach {
-                func.invoke(it as List<PollutedClue>)
+            result.forEach {
+                func.invoke(it)
             }
         }
     }

--
Gitblit v1.9.3