feiyu02
2023-12-01 c6842e8498c2d9b469890b38cd9f0d714392c445
src/main/java/com/flightfeather/monitor/analysis/dust/ExceptionAnalysisController.kt
@@ -1,5 +1,6 @@
package com.flightfeather.monitor.analysis.dust
import com.flightfeather.monitor.analysis.dust.exception.*
import com.flightfeather.monitor.domain.ds1.entity.DustExceptionData
import com.flightfeather.monitor.domain.ds1.repository.DustExceptionDataRep
import com.flightfeather.monitor.domain.ds1.repository.DustExceptionSettingRep
@@ -23,7 +24,7 @@
    private val dustSiteStatusRep: DustSiteStatusRep,
) {
    private var running = false
    var running = false
    private val taskList = mutableListOf<BaseDustExceptionAnalysis>()
@@ -39,6 +40,7 @@
                add(ExceptionValueMutation(it))
                add(ExceptionDataLowValue(it))
                add(ExceptionDataExceed(it))
                add(ExceptionValidRate(it))
            }
        }
    }
@@ -97,15 +99,15 @@
    fun debugRun() {
        val result = mutableListOf<DustExceptionData>()
        val date = LocalDate.of(2023, 7, 2)
        val date = LocalDate.of(2023, 11, 22)
        taskList.forEach { it.init() }
        // 轮询数据,计算各个异常
        val list = dustSiteDataRep.select("YZT0JS0150043", date)
        val list = dustSiteDataRep.select("SHKJ0JS0150917", date)
        list.takeIf { it.isNotEmpty() }?.forEach { d ->
            d?.let { taskList[0].onNextData(d) }
            d?.let { taskList.forEach { it.onNextData(d) } }
        }
        // 各个异常分析分别结束
        taskList[0].onDone()
        taskList.forEach { it.onDone() }
        // 存储分析结果
        taskList.forEach { result.addAll(it.resultList) }
        println(result)