zmc
2023-11-23 3ba74e7692143fd6dcf4dd885f80f95dfef8387e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.flightfeather.monitor.analysis.dust.exception
 
import com.flightfeather.monitor.domain.ds1.entity.DustExceptionSetting
import com.flightfeather.monitor.domain.ds1.entity.DustSiteData
import com.flightfeather.monitor.enumration.dust.ExceptionType
import java.time.Duration
 
/**
 * 数据缺失异常分析
 */
class ExceptionDataMissing_BackUp(config: DustExceptionSetting) : BaseDustExceptionAnalysis(config) {
 
    private var lastData: DustSiteData? = null
 
    override fun init() {
        super.init()
        lastData = null
    }
 
    override fun getExceptionType(): ExceptionType = ExceptionType.TYPE0
 
    override fun onNextData(data: DustSiteData) {
        lastData?.let {
            val t1 = it.lst
            val t2 = data.lst
            val b1 = Duration.between(t1?.toInstant(), t2.toInstant()).toMinutes() >= config.missDataMinutes
            if (b1) {
                resultList.add(newResult(it, data))
            }
        }
        lastData = data
    }
 
    override fun onDone() {
        //do noting
    }
}