1
2
3
4
5
6
7
8
9
10
package cn.iocoder.yudao.module.mes.service.safety;
import java.math.BigDecimal;
final class SafetyRiskThreshold {
    private SafetyRiskThreshold() {}
    static String evaluate(BigDecimal value, BigDecimal low, BigDecimal high) {
        if (low != null && high != null && low.compareTo(high) > 0) throw new IllegalArgumentException("下限不能大于上限");
        if (value == null || (low == null && high == null)) return "UNKNOWN";
        return (low != null && value.compareTo(low) < 0) || (high != null && value.compareTo(high) > 0) ? "ALARM" : "NORMAL";
    }
}