feiyu02
2025-07-04 9c797fa0d704ef8ffb65cd1716b8eb694b4c46c3
src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedClue.kt
@@ -1,10 +1,80 @@
package com.flightfeather.uav.biz.sourcetrace.model
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
import com.flightfeather.uav.common.utils.MapUtil
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
/**
 * 污染线索
 * 根据
 * 通过污染数据[PollutedData],污染区域[PollutedArea],污染来源[PollutedSource],形成一条污染溯源线索
 * @date 2025/5/27
 * @author feiyu02
 */
class PollutedClue {
class PollutedClue() : BaseExceptionResult(){
//    constructor(
//        start: BaseRealTimeData,
//        end: BaseRealTimeData?,
//        factor: FactorFilter.SelectedFactor,
//        exceptionData: List<BaseRealTimeData>,
//        eType: ExceptionType,
//        config: RTExcWindLevelConfig,
//        windLevelCondition: RTExcWindLevelConfig.WindLevelCondition?,
//    ) : this() {
//        if (exceptionData.isEmpty()) return
//        pollutedData = PollutedData(start, end, factor, exceptionData, eType, windLevelCondition)
//        pollutedArea = PollutedArea(exceptionData, config, windLevelCondition)
//    }
    constructor(
        tag: ExceptionTag, factor: FactorFilter.SelectedFactor, eType: ExceptionType, config: RTExcWindLevelConfig,
        windLevelCondition: RTExcWindLevelConfig.WindLevelCondition?,
    ) : this()
//            this(
//        tag.startData!!, tag.endData, factor, tag.exceptionData, eType, config,
//        windLevelCondition
//    )
    {
        if (tag.exceptionData.isEmpty()) return
        deviceCode = tag.startData?.deviceCode
        pollutedData = PollutedData(
            tag.startData!!, tag.endData, factor, tag.exceptionData, tag.historyData, eType, windLevelCondition
        )
        pollutedArea = PollutedArea(tag.historyData, tag.exceptionData, config, windLevelCondition)
    }
    /**
     * 6. 展示数据变化情况,上升速率等等
     */
    /**
     * @see [MsgType]
     */
    var msgType: Int? = null
    var deviceCode: String? = null
    var pollutedData: PollutedData? = null
    var pollutedArea: PollutedArea? = null
    var pollutedSource: PollutedSource? = null
    /**
     * 查找系统内部溯源范围内的污染企业
     */
    fun searchScenes(sceneInfoRep: SceneInfoRep) {
        if (pollutedArea == null || pollutedData == null) return
        pollutedSource = PollutedSource().also {
            it.searchScenes(pollutedArea!!, sceneInfoRep, pollutedData!!)
        }
    }
}