package com.iailab.module.data.common.enums;
|
|
import lombok.AllArgsConstructor;
|
import lombok.Getter;
|
|
import java.math.BigDecimal;
|
|
/**
|
* @author PanZhibao
|
* @Description
|
* @createTime 2024年11月20日
|
*/
|
@Getter
|
@AllArgsConstructor
|
public enum DataQualityEnum {
|
GOOD("Good", "Good"),
|
|
BAD("Bad", "Bad");
|
|
private String code;
|
private String desc;
|
|
public static DataQualityEnum getEumByValue(Object value) {
|
if (value == null) {
|
return BAD;
|
} else if (value instanceof Number) {
|
if (new BigDecimal(((Number) value).doubleValue()).compareTo(CommonConstant.BAD_VALUE) == 0) {
|
return BAD;
|
}
|
} else if (value instanceof String) {
|
if (value.toString().equals(CommonConstant.BAD_VALUE.toString())) {
|
return BAD;
|
}
|
}
|
return GOOD;
|
}
|
}
|