From b10c22af595bd995e56946bff63b8f2f984b13e8 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期四, 14 八月 2025 17:25:05 +0800 Subject: [PATCH] 2025.8.14 1. 动态溯源模块添加滑动平均异常计算(调试中) --- src/test/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuousTest.kt | 85 ++++++++++++++++++++++++++++-------------- 1 files changed, 56 insertions(+), 29 deletions(-) diff --git a/src/test/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuousTest.kt b/src/test/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuousTest.kt index 450871f..dff3477 100644 --- a/src/test/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuousTest.kt +++ b/src/test/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuousTest.kt @@ -26,7 +26,7 @@ BaseRealTimeData().apply { id = 3 }, endData!! ) - historyData = mutableListOf() +// historyData = mutableListOf() exceptionExisted = true exceptionCreated = false // exceptionResult = @@ -103,33 +103,38 @@ @Test fun checkDelayedExceptions() { - taskList().forEach { exc -> - val e = exceptions() - exc.remainingExceptions.add(RemainException(listOf(e[3], e[5]), listOf(FactorType.VOC, FactorType.PM25, FactorType.CO))) - exc.remainingExceptions.add(RemainException(listOf(e[1]), listOf(FactorType.VOC, FactorType.CO))) - exc.remainingExceptions.add(RemainException(listOf(e[3]), listOf(FactorType.PM10, FactorType.PM25))) + val res = listOf(FactorFilter.SelectedFactor(FactorType.PM25) to exceptionTag) + val c = listOf(FactorType.PM25, FactorType.PM10, FactorType.VOC) + val r = RemainException(res, c) + println(r) +// taskList().forEach { exc -> +// val e = exceptions() +// exc.remainingExceptions.add(RemainException(listOf(e[3], e[5]), listOf(FactorType.VOC, FactorType.PM25, FactorType.CO))) +// exc.remainingExceptions.add(RemainException(listOf(e[1]), listOf(FactorType.VOC, FactorType.CO))) +// exc.remainingExceptions.add(RemainException(listOf(e[3]), listOf(FactorType.PM10, FactorType.PM25))) +// +// exc.latestExceptions.clear() +// exc.latestExceptions.addAll(exceptions()) +// +// exc.removeSingleFactor(BaseRealTimeData()) +// +// val resList = exc.result.map { +// it.pollutedData?.statisticMap?.entries?.map { e -> e.key } +// } +// assertContentEquals( +// listOf(listOf(FactorType.NO2), listOf(FactorType.O3)), +// resList, +// "寮傚父缁撴灉搴旇閮芥槸涓嶅湪缁勫悎涓殑寮傚父" +// ) +// +// val resList2 = exc.latestExceptions.map { it.first.main } +// assertContentEquals( +// listOf(FactorType.CO, FactorType.PM25, FactorType.PM10, FactorType.VOC), +// resList2, +// "鍓╀綑鐨勫簲璇ユ槸涓嶅湪缁勫悎涓殑寮傚父" +// ) +// } - exc.latestExceptions.clear() - exc.latestExceptions.addAll(exceptions()) - - exc.removeSingleFactor(BaseRealTimeData()) - - val resList = exc.result.map { - it.pollutedData?.statisticMap?.entries?.map { e -> e.key } - } - assertContentEquals( - listOf(listOf(FactorType.NO2), listOf(FactorType.O3)), - resList, - "寮傚父缁撴灉搴旇閮芥槸涓嶅湪缁勫悎涓殑寮傚父" - ) - - val resList2 = exc.latestExceptions.map { it.first.main } - assertContentEquals( - listOf(FactorType.CO, FactorType.PM25, FactorType.PM10, FactorType.VOC), - resList2, - "鍓╀綑鐨勫簲璇ユ槸涓嶅湪缁勫悎涓殑寮傚父" - ) - } } @Test @@ -140,11 +145,33 @@ FactorFilter.SelectedFactor(FactorType.CO), ) val factorList2 = listOf( - FactorFilter.SelectedFactor(FactorType.CO), FactorFilter.SelectedFactor(FactorType.PM25), FactorFilter.SelectedFactor(FactorType.PM10), ) - println(factorList == factorList2) + + val factorList3 = listOf( + FactorFilter.SelectedFactor(FactorType.PM25), + FactorFilter.SelectedFactor(FactorType.VOC), + ) + + val comb = listOf( + listOf( + FactorFilter.SelectedFactor(FactorType.PM10), + FactorFilter.SelectedFactor(FactorType.PM25), + FactorFilter.SelectedFactor(FactorType.CO), + ), + listOf( + FactorFilter.SelectedFactor(FactorType.PM25), + FactorFilter.SelectedFactor(FactorType.PM10), + ), + listOf( + FactorFilter.SelectedFactor(FactorType.VOC), + FactorFilter.SelectedFactor(FactorType.PM25), + ) + ) + + val i = comb.indexOf(factorList) + println(i) } @Test -- Gitblit v1.9.3