From 7d33080998a2c5b38e8a74dbed2b0f40d39bbe47 Mon Sep 17 00:00:00 2001
From: Riku <risaku@163.com>
Date: 星期三, 04 六月 2025 23:27:26 +0800
Subject: [PATCH] 1. 新增动态污染溯源新的判定逻辑(待完成)
---
src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionSlideAverage.kt | 36 ++++++++++++++++++++++++------------
1 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionSlideAverage.kt b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionSlideAverage.kt
index 391e20d..7cfcd1f 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionSlideAverage.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionSlideAverage.kt
@@ -3,6 +3,7 @@
import com.flightfeather.uav.biz.FactorFilter
import com.flightfeather.uav.biz.dataanalysis.BaseExceptionAnalysis
import com.flightfeather.uav.biz.dataanalysis.model.DataAnalysisConfig
+import com.flightfeather.uav.biz.dataanalysis.model.ExceptionResult
import com.flightfeather.uav.biz.dataanalysis.model.ExceptionType
import com.flightfeather.uav.domain.entity.BaseRealTimeData
import com.flightfeather.uav.socket.eunm.FactorType
@@ -11,7 +12,8 @@
/**
* 婊戝姩骞冲潎鍊肩獊鍙樺紓甯�
*/
-class ExceptionSlideAverage(config: DataAnalysisConfig) : BaseExceptionAnalysis(config) {
+class ExceptionSlideAverage(config: DataAnalysisConfig) :
+ BaseExceptionAnalysis<DataAnalysisConfig, ExceptionResult>(config) {
private val historyDataList = mutableListOf<BaseRealTimeData>()
private val tempDataList = mutableListOf<BaseRealTimeData>()
@@ -27,7 +29,7 @@
var sIndex = 0
// 璧峰鏁版嵁瀵硅薄
- var startData :BaseRealTimeData? = null
+ var startData: BaseRealTimeData? = null
// 鏈熬鏁版嵁涓嬫爣
var eIndex = -1
@@ -42,7 +44,7 @@
var exceptionData = mutableListOf<BaseRealTimeData>()
// 鏄惁瀛樺湪寮傚父
- var existException = false
+ var exceptionExisted = false
fun refreshAfterCheckResult(data: BaseRealTimeData) {
// 鍒ゆ柇骞舵洿鏂拌捣濮嬬偣浣嶇疆
@@ -66,7 +68,7 @@
lastData = null
tagMap.clear()
- config.factorFilter.mainList().forEach {f->
+ config.factorFilter.mainList().forEach { f ->
tagMap[f] = Tag()
}
// avgListReverse.clear()
@@ -86,7 +88,7 @@
if (tempDataList.size > config.changeTrendGroup) {
tempDataList.removeAt(0)
}
- config.factorFilter.selectedList.forEach {s->
+ config.factorFilter.selectedList.forEach { s ->
val f = s.main
tagMap[f]?.let {
it.eIndex++
@@ -98,7 +100,7 @@
if (tempDataList.size == config.changeTrendGroup) {
calAvg(f, tempDataList)
if (checkSlideAvg(f)) {
- it.existException = true
+ it.exceptionExisted = true
it.exceptionData.add(data)
} else {
checkResult(s)
@@ -179,23 +181,33 @@
private fun checkResult(factor: FactorFilter.SelectedFactor? = null) {
val tag = tagMap[factor?.main]
if (factor != null && tag != null) {
- if (tag.existException) {
+ if (tag.exceptionExisted) {
tag.startData?.let {
- resultList.add(newResult(it, lastData, factor, tag.exceptionData))
+ resultList.add(newResult(it, tag.endData, factor, tag.exceptionData))
}
- tag.existException = false
+ tag.exceptionExisted = false
}
} else {
config.factorFilter.selectedList.forEach { f ->
val tag1 = tagMap[f.main] ?: return@forEach
- if (tag1.existException) {
+ if (tag1.exceptionExisted) {
tag1.startData?.let {
- resultList.add(newResult(it, lastData, f, tag1.exceptionData))
+ resultList.add(newResult(it, tag1.endData, f, tag1.exceptionData))
}
- tag1.existException = false
+ tag1.exceptionExisted = false
}
}
}
}
+
+ override fun newResult(
+ start: BaseRealTimeData,
+ end: BaseRealTimeData?,
+ factor: FactorFilter.SelectedFactor,
+ exceptionData: List<BaseRealTimeData>,
+ ): ExceptionResult {
+ val eType = getExceptionType()
+ return ExceptionResult(start, end, factor, exceptionData, config.mission.missionCode, eType)
+ }
}
\ No newline at end of file
--
Gitblit v1.9.3