From e58a05b78d09bcd4c1a12e8610c5adfc316494e8 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期四, 18 十二月 2025 10:04:42 +0800
Subject: [PATCH] 2025.12.18
---
src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuous.kt | 40 ++++++++++++++++++++++++++++++++--------
1 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuous.kt b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuous.kt
index 3866509..3d10232 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuous.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuous.kt
@@ -75,7 +75,7 @@
}
/**
- * 鍒ゆ柇鏁版嵁閲忕骇鍦ㄥ紓甯稿垽鏂殑鑼冨洿鍐�
+ * 鍒ゆ柇鏁版嵁閲忕骇鏄惁鍦ㄥ紓甯稿垽鏂殑鑼冨洿鍐�
* 榛樿鎵�鏈夐噺绾ч兘鍦ㄥ紓甯稿垽鏂殑鑼冨洿鍐�
*/
open fun judgeDataScale(p: BaseRealTimeData?, n: BaseRealTimeData): MutableMap<FactorType, Boolean> {
@@ -126,9 +126,15 @@
}
}
+ /**
+ * 寮傚父鏁版嵁澶勭悊鏍稿績鍒ゆ柇閫昏緫
+ */
override fun onNextData(data: BaseRealTimeData) {
+ // 1. 鍒ゆ柇鏂版暟鎹殑鏃堕棿杩炵画鎬�
val isContinue = isContinuous(lastData, data)
+ // 2. 璁$畻鍚勪釜鐩戞祴鍥犲瓙鏄惁鍙戠敓寮傚父
val hasException = judge(lastData, data)
+ // 3. 閬嶅巻閰嶇疆涓�変腑鐨勭洃娴嬪洜瀛愶紝鍒ゆ柇鏄惁鍙戠敓寮傚父
config.factorFilter.selectedList.forEach { s ->
val f = s.main
// 鎺掗櫎姝ゅ紓甯哥被鍨嬩笉閫傜敤鐨勭洃娴嬪洜瀛�
@@ -151,12 +157,18 @@
it.addHistoryData(data)
}
}
+ // 4. 鏇存柊鏈�鏂版暟鎹�
lastData = data
+ // 5. 淇濆瓨骞剁Щ闄ゅ崟鍥犲瓙寮傚父
removeSingleFactor(data)
- checkDelayedExceptions(data)
- mergeExceptionResult(data)
+ // 6. 妫�鏌ュ欢杩熷紓甯�
+ val fittedComb = checkDelayedExceptions(data)
+ // 7. 鍚堝苟寮傚父缁撴灉
+ mergeExceptionResult(data, fittedComb)
+ // 8. 瑙﹀彂鏂板紓甯哥粨鏋滀簨浠�
onNewResult(result)
+ // 9. 娓呴櫎寮傚父璁板綍
clearExceptions(data)
}
@@ -286,6 +298,8 @@
* 灏嗕笉鍦ㄥ叧鑱斿叧绯讳腑鐨勭洃娴嬪洜瀛愬紓甯稿瓨鍌紝骞跺墧闄�
*/
fun removeSingleFactor(data: BaseRealTimeData) {
+ if (latestExceptions.isEmpty()) return
+
// 鏌ユ壘涓嶅湪鍥犲瓙鍏宠仈缁勫悎涓殑寮傚父鍥犲瓙
val sfList = latestExceptions.filter {
config.factorFilter.combination.find { c -> c.find { f -> f == it.first.main } != null } == null
@@ -302,11 +316,13 @@
/**
* 妫�鏌ュ欢杩熺殑寰呭悎骞跺紓甯镐笌褰撳墠寮傚父鏄惁鑳藉尮閰�
* 1. 灏嗛仐鐣欑殑瓒呰繃绛夊緟鏁版嵁鍛ㄦ湡鐨勫紓甯稿瓨鍌�
- * 2. 灏嗗尮閰嶆垚鍔熺殑鍚堝苟寮傚父瀛樺偍
+ * 2. 灏嗗尮閰嶆垚鍔熺殑鍚堝苟寮傚父瀛樺偍锛屽悓鏃跺皢鍏宠仈鍏崇郴鏍囪涓哄凡鍖归厤
* 3. 淇濈暀渚濇棫鏈悎骞舵垚鍔熷苟涓斿彲缁х画绛夊緟鐨勫紓甯�
* @return 琚尮閰嶆垚鍔熺殑鍏宠仈鍏崇郴
*/
fun checkDelayedExceptions(data: BaseRealTimeData): List<List<FactorType>> {
+ if (latestExceptions.isEmpty()) return emptyList()
+
// 琚尮閰嶆垚鍔熺殑鐩戞祴鍥犲瓙鍏宠仈鍏崇郴
val fittedComb = mutableListOf<List<FactorType>>()
// 閬楃暀鐨勮繘鍏ヤ笅涓�涓暟鎹懆鏈熷仛鍒ゆ柇鐨勫緟鍚堝苟寮傚父闆嗗悎
@@ -316,14 +332,13 @@
// 鏈鏁版嵁鍛ㄦ湡涓紝琚尮閰嶆垚鍔熺殑寮傚父闆嗗悎
val exceps = mutableListOf<Pair<FactorFilter.SelectedFactor, T>>()
remainingExceptions.forEach {
- // 妫�鏌ュ綋鍓嶆柊寮傚父涓紝鏄惁鍖呭惈鍥犲瓙鍏宠仈鍏崇郴涓殑寮傚父
+ // 妫�鏌ユ湰娆℃暟鎹懆鏈熺殑寮傚父涓紝鏄惁鍖呭惈鍥犲瓙鍏宠仈鍏崇郴涓殑寮傚父
val combRes = matchCombFactor(it.combination, latestExceptions)
val res = combRes.second
// 鍒ゆ柇鏈鏁版嵁鍛ㄦ湡涓壘鍒扮殑鍥犲瓙鍜屽凡鏈夌殑鍥犲瓙鏄惁婊¤冻鍏宠仈鍏崇郴
val findFactors = mutableListOf<FactorType>()
res.forEach {r -> findFactors.add(r.first.main) }
it.exceptions.forEach {r -> findFactors.add(r.first.main) }
- // 鍒ゆ柇鏄惁杩樻湁缂哄け寮傚父
val isFitAll = findFactors.distinct() == it.combination
// 濡傛灉宸茬粡娌℃湁缂哄け鐨勫紓甯稿洜瀛愶紝鍒欏彲鍚堝苟涓虹粍鍚堝紓甯�
if (isFitAll) {
@@ -377,11 +392,20 @@
/**
* 鍚堝苟寮傚父
+ * @param data 褰撳墠鐩戞祴鏁版嵁
+ * @param fittedComb 鍦ㄩ仐鐣欑殑寮傚父[remainingExceptions]鍒ゆ柇涓紝宸茬粡杩涜鍖归厤鍒ゆ柇鐨勫叧鑱斿叧绯伙紝灏嗕笉鍐嶈繘琛屽尮閰�
*/
- open fun mergeExceptionResult(data: BaseRealTimeData) {
+ open fun mergeExceptionResult(data: BaseRealTimeData, fittedComb: List<List<FactorType>>) {
+ if (latestExceptions.isEmpty()) return
+
val combinedExc = mutableListOf<List<Pair<FactorFilter.SelectedFactor, T>>>()
// 閬嶅巻鎵�鏈夌殑鍥犲瓙缁勫悎
config.factorFilter.combination.forEach { c ->
+ /**
+ * 璺宠繃宸茬粡鍦╗checkDelayedExceptions]涓垽鏂繃鐨勫叧鑱斿叧绯�
+ */
+ if (fittedComb.indexOf(c) >= 0) return@forEach
+
val combRes = matchCombFactor(c, latestExceptions)
val res = combRes.second
val exist = combRes.first
@@ -392,7 +416,7 @@
}
// 鍚﹀垯灏嗗紓甯哥殑娣辨嫹璐濈増鏈瓨鍏ュ緟鍚堝苟寮傚父闆嗗悎
// TODO 2025.8.4: 鍚庣画娣诲姞褰撳叧鑱旂殑鐩戞祴鍥犲瓙绱寮傚父璁℃暟鎺ヨ繎闃堝�兼椂锛屾墠瀛樺叆闆嗗悎鐨勯�昏緫
- else {
+ else if (res.isNotEmpty()) {
remainingExceptions.add(RemainException(res, c))
}
}
--
Gitblit v1.9.3