guohongjin
2024-05-15 5b7639f0bd9e056738ec15100ed0532e965c6cd5
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 cn.stylefeng.roses.kernel.rule.enums;
 
import cn.hutool.core.date.DateUtil;
import lombok.Getter;
 
/**
 * 订单类型-枚举
 *
 * @author goupan
 */
@Getter
public enum OrderTypeEnum {
 
    MENTAL_TEST("MT", "心理测试订单"),
    CONSULT_ONE("CO", "心理咨询1V1订单"),
    COURSE_ORDER("KC", "课程订单"),
    COUNSELLING_ORDER("ZX", "咨询订单"),
    REFUND_ORDER("REO", "退款订单"),
    ;
 
    private final String code;
 
    private final String name;
 
    OrderTypeEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }
 
    /**
     * 根据code获取枚举
     */
    public static OrderTypeEnum codeToEnum(String code) {
        if (null != code) {
            for (OrderTypeEnum e : OrderTypeEnum.values()) {
                if (e.getCode().equals(code)) {
                    return e;
                }
            }
        }
        return null;
    }
 
    /**
     * 编码转化成中文含义
     */
    public static String codeToName(String code) {
        if (null != code) {
            for (OrderTypeEnum e : OrderTypeEnum.values()) {
                if (e.getCode().equals(code)) {
                    return e.getName();
                }
            }
        }
        return "未知";
    }
 
 
}