From c56e1e74426238939f229f0005828d05089715ff Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期四, 03 七月 2025 17:30:58 +0800
Subject: [PATCH] 2025.7.3 1. 新增动态污染溯源新的判定逻辑

---
 src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/RTExcChangeRate.kt |   26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/RTExcChangeRate.kt b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/RTExcChangeRate.kt
index c6360d3..f07fd1c 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/RTExcChangeRate.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/RTExcChangeRate.kt
@@ -19,7 +19,7 @@
  * @date 2025/6/10
  * @author feiyu02
  */
-class RTExcChangeRate(config: RTExcWindLevelConfig) :
+open class RTExcChangeRate(config: RTExcWindLevelConfig) :
     BaseExceptionContinuous<ExceptionTag, RTExcWindLevelConfig, PollutedClue>(config, ExceptionTag::class.java) {
 
     constructor(config: RTExcWindLevelConfig, callback: NewPolluteClueCallback) : this(config){
@@ -28,8 +28,24 @@
 
     private var callback: NewPolluteClueCallback? = null
 
+    open var changeRate = this.config.changeRateUp
+
     override fun getExceptionType(): ExceptionType {
         return ExceptionType.TYPE9
+    }
+
+    override fun judgeDataScale(p: BaseRealTimeData?, n: BaseRealTimeData): MutableMap<FactorType, Boolean> {
+        val res = mutableMapOf<FactorType, Boolean>()
+        config.factorFilter.mainList().forEach { f ->
+            if (p?.getByFactorType(f) == null || n.getByFactorType(f) == null || n.windSpeed == null) {
+                res[f] = (false)
+                return@forEach
+            }
+            val nValue = n.getByFactorType(f)!!
+            val minValue = FactorType.getVMin(f)
+            res[f] = nValue >= minValue
+        }
+        return res
     }
 
     override fun judgeException(p: BaseRealTimeData?, n: BaseRealTimeData): MutableMap<FactorType, Boolean> {
@@ -40,7 +56,7 @@
                 return@forEach
             }
 
-            val rate = config.changeRate[f]
+            val rate = changeRate[f]
 
             val pValue = p.getByFactorType(f)!!
             val nValue = n.getByFactorType(f)!!
@@ -48,7 +64,7 @@
             val v = (nValue - pValue)
 
             val b1 = if (rate != null) {
-                v >= rate.mutationRate.first
+                v in rate.mutationRate.first..rate.mutationRate.second
             } else {
                 false
             }
@@ -61,7 +77,7 @@
     }
 
     override fun judgeExceptionCount(tag: ExceptionTag, factorType: FactorType?): Boolean {
-        return tag.exceptionData.size >= (config.changeRate[factorType]?.countLimit ?: 1)
+        return tag.exceptionData.size >= (changeRate[factorType]?.countLimit ?: 1)
     }
 
     override fun needCut(tag: ExceptionTag, hasException: Boolean?): Boolean {
@@ -97,7 +113,7 @@
     }
 
     override fun newResult(tag: ExceptionTag, factor: FactorFilter.SelectedFactor): PollutedClue {
-        return PollutedClue(tag, factor, getExceptionType(), config, config.changeRate[factor.main])
+        return PollutedClue(tag, factor, getExceptionType(), config, changeRate[factor.main])
     }
 
     override fun onNewException(

--
Gitblit v1.9.3