From d649f734c44541641158aec2d6b10d630f5a0827 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期四, 25 十二月 2025 17:25:16 +0800
Subject: [PATCH] 2025.12.19 1. 动态溯源相关分析逻辑调整; 2. 走航报告接口参数调整;
---
src/main/kotlin/com/flightfeather/uav/domain/repository/SourceTraceRep.kt | 58 +++++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 45 insertions(+), 13 deletions(-)
diff --git a/src/main/kotlin/com/flightfeather/uav/domain/repository/SourceTraceRep.kt b/src/main/kotlin/com/flightfeather/uav/domain/repository/SourceTraceRep.kt
index b8c4c4c..3d8d7e7 100644
--- a/src/main/kotlin/com/flightfeather/uav/domain/repository/SourceTraceRep.kt
+++ b/src/main/kotlin/com/flightfeather/uav/domain/repository/SourceTraceRep.kt
@@ -99,21 +99,52 @@
return if (res.isEmpty()) null else res[0]
}
- fun fetchList(deviceCode: String, startTime: Date, endTime: Date): List<BaseExceptionResult?> {
- return sourceTraceMsgBlobMapper.selectWithBlob(deviceCode, startTime, endTime)
- .map { stm ->
- when (stm?.msgType) {
- MsgType.PolClue.value,
- MsgType.DataChange.value,
- -> {
- GsonUtils.gson.fromJson(stm.blobContent, PollutedClue::class.java)
- }
+ val stMsgCache = mutableMapOf<String, List<BaseExceptionResult?>>()
+ fun fetchList(
+ deviceCode: String,
+ startTime: Date,
+ endTime: Date,
+ msgType: MsgType? = null,
+ minPer: Double? = 0.5,
+ ): List<BaseExceptionResult?> {
+ var stMsgList = listOf<BaseExceptionResult?>()
+ val key = "${deviceCode}_${startTime.time}_${endTime.time}_${msgType?.value}"
+ if (stMsgCache.containsKey(key)) {
+ stMsgList = stMsgCache[key]!!
+ }
+ if (stMsgList.isEmpty()) {
+ var res = sourceTraceMsgBlobMapper.selectWithBlob(deviceCode, startTime, endTime)
+ if (msgType !== null) {
+ res = res.filter { it?.msgType == msgType.value }
+ }
- MsgType.AnaResult.value -> {
- GsonUtils.gson.fromJson(stm.blobContent, AnalysisResult::class.java)
- }
+ stMsgList = res.map { stm ->
+ when (stm?.msgType) {
+ MsgType.PolClue.value,
+ MsgType.DataChange.value,
+ -> {
+ GsonUtils.gson.fromJson(stm.blobContent, PollutedClue::class.java)
+ }
- else -> null
+ MsgType.AnaResult.value -> {
+ GsonUtils.gson.fromJson(stm.blobContent, AnalysisResult::class.java)
+ }
+
+ else -> null
+ }
+ }
+ stMsgCache[key] = stMsgList
+ }
+ // 绛涢�夊嚭寮傚父鏁版嵁PollutedClue涓紓甯哥櫨鍒嗘瘮澶т簬minPer鐨�
+ return stMsgList.filter {
+ if (it is PollutedClue) {
+ var valid = false
+ (it as PollutedClue?)?.pollutedData?.statisticMap?.entries?.forEach {sta->
+ if (!valid) valid = (sta.value.avgPer?:.0) > minPer!!
+ }
+ valid
+ } else {
+ true
}
}
}
@@ -125,6 +156,7 @@
.andGreaterThanOrEqualTo("startTime", mission.startTime)
.andLessThanOrEqualTo("endTime", mission.endTime)
}).map { it?.id }
+ if (idList.isEmpty()) return 0
sourceTraceMsgMapper.deleteByExample(Example(SourceTraceMsg::class.java).apply {
createCriteria().andIn("id", idList)
})
--
Gitblit v1.9.3