From eb3dd00b0b7fcda477229d518d250f9c842b790b Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期二, 21 十月 2025 17:45:44 +0800
Subject: [PATCH] 2025.10.21 1. 走航季度报告相关数据计算逻辑调整
---
src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuous.kt | 26 +++++++++++++++++++-------
1 files changed, 19 insertions(+), 7 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..0388a35 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuous.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuous.kt
@@ -154,8 +154,8 @@
lastData = data
removeSingleFactor(data)
- checkDelayedExceptions(data)
- mergeExceptionResult(data)
+ val fittedComb = checkDelayedExceptions(data)
+ mergeExceptionResult(data, fittedComb)
onNewResult(result)
clearExceptions(data)
}
@@ -286,6 +286,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 +304,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 +320,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 +380,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 +404,7 @@
}
// 鍚﹀垯灏嗗紓甯哥殑娣辨嫹璐濈増鏈瓨鍏ュ緟鍚堝苟寮傚父闆嗗悎
// TODO 2025.8.4: 鍚庣画娣诲姞褰撳叧鑱旂殑鐩戞祴鍥犲瓙绱寮傚父璁℃暟鎺ヨ繎闃堝�兼椂锛屾墠瀛樺叆闆嗗悎鐨勯�昏緫
- else {
+ else if (res.isNotEmpty()) {
remainingExceptions.add(RemainException(res, c))
}
}
--
Gitblit v1.9.3