提交 | 用户 | 时间
|
2f03e2
|
1 |
package com.iailab.module.data.common.enums; |
潘 |
2 |
|
|
3 |
import lombok.AllArgsConstructor; |
|
4 |
import lombok.Getter; |
|
5 |
|
|
6 |
import java.math.BigDecimal; |
|
7 |
|
|
8 |
/** |
|
9 |
* @author PanZhibao |
|
10 |
* @Description |
|
11 |
* @createTime 2024年11月20日 |
|
12 |
*/ |
|
13 |
@Getter |
|
14 |
@AllArgsConstructor |
|
15 |
public enum DataQualityEnum { |
|
16 |
GOOD("Good", "Good"), |
|
17 |
|
|
18 |
BAD("Bad", "Bad"); |
|
19 |
|
|
20 |
private String code; |
|
21 |
private String desc; |
|
22 |
|
|
23 |
public static DataQualityEnum getEumByValue(Object value) { |
|
24 |
if (value == null) { |
|
25 |
return BAD; |
|
26 |
} else if (value instanceof Number) { |
|
27 |
if (new BigDecimal(((Number) value).doubleValue()).compareTo(CommonConstant.BAD_VALUE) == 0) { |
|
28 |
return BAD; |
|
29 |
} |
df6628
|
30 |
} else if (value instanceof BigDecimal) { |
潘 |
31 |
if (new BigDecimal(value.toString()).compareTo(CommonConstant.BAD_VALUE) == 0) { |
|
32 |
return BAD; |
|
33 |
} |
2f03e2
|
34 |
} else if (value instanceof String) { |
潘 |
35 |
if (value.toString().equals(CommonConstant.BAD_VALUE.toString())) { |
|
36 |
return BAD; |
|
37 |
} |
|
38 |
} |
|
39 |
return GOOD; |
|
40 |
} |
|
41 |
} |