CarriageExceptionEnum.java
1.19 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
package com.sl.ms.carriage.enums;
import cn.hutool.core.util.EnumUtil;
import com.sl.transport.common.enums.BaseExceptionEnum;
/**
* 异常枚举
*/
public enum CarriageExceptionEnum implements BaseExceptionEnum {
NOT_ECONOMIC_ZONE_REPEAT(1001, "非经济区的模板重复,只能有一个模板"),
ECONOMIC_ZONE_CITY_REPEAT(1002, "经济区互寄关联城市重复"),
NOT_FOUND(1003, "没有找到运费模板,无法计算运费");
private Integer code;
private Integer status;
private String value;
CarriageExceptionEnum(Integer code, String value) {
this.code = code;
this.value = value;
this.status = 500;
}
CarriageExceptionEnum(Integer code, Integer status, String value) {
this.code = code;
this.value = value;
this.status = status;
}
@Override
public Integer getCode() {
return this.code;
}
@Override
public String getValue() {
return this.value;
}
@Override
public Integer getStatus() {
return this.status;
}
public static CarriageExceptionEnum codeOf(Integer code) {
return EnumUtil.getBy(CarriageExceptionEnum::getCode, code);
}
}