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/sourcetrace/model/PollutedClue.kt | 84 +++++++++++++++++++++++++++++++++++-------
1 files changed, 70 insertions(+), 14 deletions(-)
diff --git a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedClue.kt b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedClue.kt
index 6775572..306d4a7 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedClue.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedClue.kt
@@ -2,6 +2,7 @@
import com.flightfeather.uav.biz.FactorFilter
import com.flightfeather.uav.biz.dataanalysis.BaseExceptionResult
+import com.flightfeather.uav.biz.dataanalysis.model.ExceptionTag
import com.flightfeather.uav.biz.dataanalysis.model.ExceptionType
import com.flightfeather.uav.biz.sourcetrace.config.RTExcWindLevelConfig
import com.flightfeather.uav.common.utils.DateUtil
@@ -9,6 +10,7 @@
import com.flightfeather.uav.domain.entity.BaseRealTimeData
import com.flightfeather.uav.domain.entity.SceneInfo
import com.flightfeather.uav.domain.repository.SceneInfoRep
+import com.flightfeather.uav.socket.sender.MsgType
/**
* 姹℃煋绾跨储
@@ -19,23 +21,77 @@
class PollutedClue() : BaseExceptionResult() {
constructor(
- start: BaseRealTimeData,
- end: BaseRealTimeData?,
- factor: FactorFilter.SelectedFactor,
- exceptionData: List<BaseRealTimeData>,
+ exceptions: List<Pair<FactorFilter.SelectedFactor, ExceptionTag>>,
eType: ExceptionType,
config: RTExcWindLevelConfig,
- windLevelCondition: RTExcWindLevelConfig.WindLevelCondition
+ windLevelCondition: RTExcWindLevelConfig.WindLevelCondition?,
) : this() {
- this.factor = factor
- if (exceptionData.isEmpty()) return
- pollutedData = PollutedData(start, end, factor, exceptionData, eType, windLevelCondition)
- pollutedArea = PollutedArea(exceptionData, config, windLevelCondition)
+ if (exceptions.isEmpty() || exceptions[0].second.exceptionData.isEmpty()) return
+ deviceCode = exceptions[0].second.startData?.deviceCode
+ var startData: BaseRealTimeData? = null
+ var endData: BaseRealTimeData? = null
+ var exceptionData = mutableListOf<BaseRealTimeData>()
+ var historyData = mutableListOf<BaseRealTimeData>()
+ exceptions.forEach { e ->
+ // 灏嗛噰鏍锋椂闂存渶鏃╃殑浣滀负寮�濮嬫暟鎹�
+ if (startData == null) {
+ startData = e.second.startData
+ } else {
+ if (e.second.startData?.dataTime!! < startData!!.dataTime) {
+ startData = e.second.startData
+ }
+ }
+
+ // 灏嗛噰鏍锋椂闂存渶鏅氱殑浣滀负缁撴潫鏁版嵁
+ if (endData == null) {
+ endData = e.second.endData
+ } else {
+ if (e.second.endData?.dataTime!! > endData!!.dataTime) {
+ endData = e.second.endData
+ }
+ }
+
+ // 灏嗘墍鏈夊紓甯告暟鎹幓閲嶅悎骞�
+ if (exceptionData.isEmpty()) {
+ exceptionData = e.second.exceptionData
+ } else {
+ e.second.exceptionData.forEach {
+ if (exceptionData.find { d -> d.dataTime == it.dataTime } == null) {
+ exceptionData.add(it)
+ }
+ }
+ }
+
+ // 灏嗘墍鏈夊巻鍙叉暟鎹幓閲嶅悎骞�
+ if (historyData.isEmpty()) {
+ historyData = e.second.historyData
+ } else {
+ e.second.historyData.forEach {
+ if (historyData.find { d -> d.dataTime == it.dataTime } == null) {
+ historyData.add(it)
+ }
+ }
+ }
+ }
+ // 鎸夌収閲囨牱鏃堕棿鍗囧簭鎺掑垪
+ exceptionData.sortBy { it.dataTime }
+ historyData.sortBy { it.dataTime }
+
+ // 鑾峰彇鍘婚噸鍚庣殑鐩戞祴鍥犲瓙绫诲瀷
+ val factorList = exceptions.map { it.first }.distinct()
+ pollutedData = PollutedData(
+ startData!!, endData, factorList, exceptionData, historyData, eType, windLevelCondition
+ )
+ pollutedArea = PollutedArea(historyData, exceptionData, config, windLevelCondition)
+
}
/**
- * 6. 灞曠ず鏁版嵁鍙樺寲鎯呭喌锛屼笂鍗囬�熺巼绛夌瓑
+ * @see [MsgType]
*/
+ var msgType: Int? = null
+
+ var deviceCode: String? = null
var pollutedData: PollutedData? = null
@@ -43,13 +99,13 @@
var pollutedSource: PollutedSource? = null
- private var factor: FactorFilter.SelectedFactor? = null
-
/**
* 鏌ユ壘绯荤粺鍐呴儴婧簮鑼冨洿鍐呯殑姹℃煋浼佷笟
*/
fun searchScenes(sceneInfoRep: SceneInfoRep) {
- if (pollutedArea == null || factor == null) return
- pollutedSource = PollutedSource().also { it.searchScenes(pollutedArea!!, sceneInfoRep, factor!!) }
+ if (pollutedArea == null || pollutedData == null) return
+ pollutedSource = PollutedSource().also {
+ it.searchScenes(pollutedArea!!, sceneInfoRep, pollutedData!!)
+ }
}
}
\ No newline at end of file
--
Gitblit v1.9.3