cjl
2024-06-17 34d9307df9870510f9204659ddf9f5389012cd4d
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
50
51
52
53
54
55
56
57
58
59
package com.moral.api.pojo.enums;
 
 
import lombok.Getter;
 
import java.util.HashMap;
import java.util.Map;
 
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.moral.api.exception.BusinessException;
 
@Getter
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum AppAllocationStateEnum implements IntegerValueEnum {
    /**
     *待处理
     */
    TO_BE_PROCESSED(20, "待处理"),
    /**
     *待完成
     */
    TO_BE_COMPLETED(30, "待完成"),
    /**
     * 40或50 都是已完成
     */
    COMPLETED(40, "已完成"),
 
 
    ;
 
    @EnumValue
    public  final Integer value;
    public  final String name;
 
    AppAllocationStateEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }
 
    private static Map<Integer, AllocationExtensionApproveEnum> valueMap = new HashMap<>();
    static {
        for (AllocationExtensionApproveEnum v : AllocationExtensionApproveEnum.values()) {
            valueMap.put(v.value, v);
        }
    }
    @JsonCreator
    public static AllocationExtensionApproveEnum getByValue(Integer value) {
        if (value == null) {
            return null;
        }
        AllocationExtensionApproveEnum result = valueMap.get(value);
        if (result == null) {
            throw new BusinessException("枚举转换异常" + value);
        }
        return result;
    }
}