feiyu02
2025-07-21 38d72198bfcced01ed9513b978163e5cd1d84625
src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/SourceTraceController.kt
@@ -43,7 +43,7 @@
                    .withMain(FactorType.O3)
                    .withMain(FactorType.PM25)
                    .withMain(FactorType.PM10)
                    .withMain(FactorType.VOC)
//                    .withMain(FactorType.VOC)
                    .withCombination(
                        listOf(
                            listOf(FactorType.PM25, FactorType.PM10),
@@ -63,6 +63,8 @@
    private val sceneInfoRep: SceneInfoRep
    private val sourceTraceRep: SourceTraceRep
    private val config: RTExcWindLevelConfig
    private val timer = Timer()
    private var timerTask: TimerTask? = null
    private val taskList = mutableListOf<BaseExceptionAnalysis<RTExcWindLevelConfig, PollutedClue>>()
@@ -92,23 +94,27 @@
     * 计算新的一条实时走航数据
     */
    fun addOneData(data: BaseRealTimeData) {
//        println("====================>")
        // 计算异常
        taskList.forEach { it.onNextData(data) }
        pollutedSummary.refreshLatestMonitorData(data)
        // 限定时间内没有新数据传入,则结束当前的计算
        dealOnTimeout()
    }
    /**
     * 超时处理,较长时间没有新数据进入,进行初始化操作
     */
    private fun dealOnTimeout() {
        val timer = Timer(true)
        timer.schedule(object : TimerTask() {
//        val timer = Timer()
        timerTask?.cancel()
        timer.purge()
        timerTask = object : TimerTask() {
            override fun run() {
                TODO("Not yet implemented")
                initTask()
            }
        }, 60 * 1000)
        timer.cancel()
        }
        timer.schedule(timerTask, 2 * 60 * 60 * 1000)
    }
    // 数据突变异常回调