From 635d762aef37b5de6cd2e34f4a076ab56d9a239d Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期五, 11 四月 2025 17:35:11 +0800
Subject: [PATCH] 1. 添加自动输出接口API文档功能
---
src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionValueMutation.kt | 34 +++++++++++++++++++++++++---------
1 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionValueMutation.kt b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionValueMutation.kt
index f9da13a..fdaa83c 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionValueMutation.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionValueMutation.kt
@@ -4,6 +4,7 @@
import com.flightfeather.uav.biz.dataanalysis.model.DataAnalysisConfig
import com.flightfeather.uav.biz.dataanalysis.model.ExceptionType
import com.flightfeather.uav.domain.entity.BaseRealTimeData
+import com.flightfeather.uav.socket.eunm.FactorType
import kotlin.math.abs
/**
@@ -19,21 +20,35 @@
override fun getExceptionType(): ExceptionType = ExceptionType.TYPE4
- override fun judgeException(p: BaseRealTimeData?, n: BaseRealTimeData): List<Boolean> {
- val res = mutableListOf<Boolean>()
- repeat(config.factorCount) { i->
- if (p?.getByFactorIndex(i) == null || n.getByFactorIndex(i) == null) {
- res.add(false)
- return@repeat
+ override fun judgeException(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) {
+ res[f] = (false)
+ return@forEach
}
- val pValue = p.getByFactorIndex(i)!!
- val nValue = n.getByFactorIndex(i)!!
+ val pValue = p.getByFactorType(f)!!
+ val nValue = n.getByFactorType(f)!!
val r = abs((pValue - nValue) / pValue)
val b1 = r >= (2 * config.mutationRate)
val b2 = r >= config.mutationRate
if (b1) special = true
- res.add(b1 || b2)
+ res[f] = (b1 || b2)
+ if (res[f] == true) println("p: $pValue --- n: $nValue --- r: $r")
}
+// repeat(config.factorCount) { i->
+// if (p?.getByFactorIndex(i) == null || n.getByFactorIndex(i) == null) {
+// res.add(false)
+// return@repeat
+// }
+// val pValue = p.getByFactorIndex(i)!!
+// val nValue = n.getByFactorIndex(i)!!
+// val r = abs((pValue - nValue) / pValue)
+// val b1 = r >= (2 * config.mutationRate)
+// val b2 = r >= config.mutationRate
+// if (b1) special = true
+// res.add(b1 || b2)
+// }
return res
}
@@ -42,6 +57,7 @@
val b1 = special && (eIndex - sIndex) >= (config.mutationNum / 2)
val b2 = (eIndex - sIndex) >= config.mutationNum
special = false
+ println("sIndex: $sIndex --- eIndex: $eIndex --- special: $special")
return b1 || b2
}
}
\ No newline at end of file
--
Gitblit v1.9.3