feiyu02
23 小时以前 8eb584869b4fd4de0f51c93f2616f12e51df9193
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,28 @@
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
        // 获取去重后的监测因子类型
        val factorList = exceptions.map { it.first }.distinct()
        pollutedData = PollutedData(exceptions, eType)
        pollutedArea = PollutedArea(pollutedData!!, config, windLevelCondition)
    }
    /**
     * 6. 展示数据变化情况,上升速率等等
     * @see [MsgType]
     */
    var msgType: Int? = null
    var deviceCode: String? = null
    var pollutedData: PollutedData? = null
@@ -43,13 +50,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!!)
        }
    }
}