feiyu02
2023-10-20 3371ed856d8712732b3f46e30e41e652ff5d7781
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package com.flightfeather.monitor.analysis.dust
 
import com.flightfeather.monitor.domain.ds1.entity.DustExceptionSetting
import com.flightfeather.monitor.domain.ds1.entity.DustSiteData
import com.flightfeather.monitor.enumration.dust.ExceptionType
 
/**
 * 数据临近超标异常分析
 */
class ExceptionApproachExceeding(config: DustExceptionSetting) : BaseExceptionContinuous(config) {
 
    override fun getExceptionType(): ExceptionType = ExceptionType.TYPE5
 
    override fun judgeException(p: DustSiteData?, n: DustSiteData): Boolean {
        // 判断数据是否在设定的临近超标范围内
        return n.dustValue >= config.nearExceedLowValue && n.dustValue <= config.nearExceedHighValue
    }
 
    override fun judgeDuration(sIndex: Int, eIndex: Int): Boolean {
        // 判断数据临近超标数量是否连续超过限定个数
        return (eIndex - sIndex) >= config.nearExceedNum
    }
}