src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/exceptiontype/ExceptionSlideAverage.kt
@@ -3,6 +3,7 @@
import com.flightfeather.uav.biz.FactorFilter
import com.flightfeather.uav.biz.dataanalysis.BaseExceptionAnalysis
import com.flightfeather.uav.biz.dataanalysis.model.DataAnalysisConfig
import com.flightfeather.uav.biz.dataanalysis.model.ExceptionResult
import com.flightfeather.uav.biz.dataanalysis.model.ExceptionType
import com.flightfeather.uav.domain.entity.BaseRealTimeData
import com.flightfeather.uav.socket.eunm.FactorType
@@ -11,7 +12,8 @@
/**
 * 滑动平均值突变异常
 */
class ExceptionSlideAverage(config: DataAnalysisConfig) : BaseExceptionAnalysis(config) {
class ExceptionSlideAverage(config: DataAnalysisConfig) :
    BaseExceptionAnalysis<DataAnalysisConfig, ExceptionResult>(config) {
    private val historyDataList = mutableListOf<BaseRealTimeData>()
    private val tempDataList = mutableListOf<BaseRealTimeData>()
@@ -27,7 +29,7 @@
        var sIndex = 0
        // 起始数据对象
        var startData :BaseRealTimeData? = null
        var startData: BaseRealTimeData? = null
        // 末尾数据下标
        var eIndex = -1
@@ -66,7 +68,7 @@
        lastData = null
        tagMap.clear()
        config.factorFilter.mainList().forEach {f->
        config.factorFilter.mainList().forEach { f ->
            tagMap[f] = Tag()
        }
//        avgListReverse.clear()
@@ -86,7 +88,7 @@
        if (tempDataList.size > config.changeTrendGroup) {
            tempDataList.removeAt(0)
        }
        config.factorFilter.selectedList.forEach {s->
        config.factorFilter.selectedList.forEach { s ->
            val f = s.main
            tagMap[f]?.let {
                it.eIndex++
@@ -198,4 +200,14 @@
        }
    }
    fun newResult(
        start: BaseRealTimeData,
        end: BaseRealTimeData?,
        factor: FactorFilter.SelectedFactor,
        exceptionData: List<BaseRealTimeData>,
    ): ExceptionResult {
        val eType = getExceptionType()
        return ExceptionResult(start, end, factor, exceptionData, config.mission.missionCode, eType)
    }
}