Pu Zhibing
2025-02-28 315c07aa4f70fa26143076f462ed0e6a44238bfa
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
package com.ruoyi.system.api.constant;
 
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
 
import java.util.HashMap;
import java.util.Map;
 
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
@Getter
public enum DelayTaskEnum {
 
    ORDER_AUTOMATIC_CANCEL("订单延时任务-自动关闭","超时订单自动关闭"),
    COUPON_SEND_DELAY_TASK("优惠券延时任务","定时启动优惠券发送"),
    ACTIVITY_START_TASK("活动延时任务","定时开始任务"),
    ACTIVITY_END_TASK("活动延时任务","定时结束任务"),
    LIVE_APPOINTMENT_TASK("直播预约任务","直播预约任务")
    ;
 
    String name;
    String code;
 
    private static Map<String, DelayTaskEnum> valueMap = new HashMap<>();
 
    static {
        for(DelayTaskEnum gender : DelayTaskEnum.values()) {
            valueMap.put(gender.name, gender);
        }
    }
 
    DelayTaskEnum(String name, String code) {
        this.code = code;
        this.name=name;
    }
 
    public static String getByName(String name) {
        DelayTaskEnum result = valueMap.get(name);
        if(result == null) {
            throw new IllegalArgumentException("No element matches " + name);
        }
        return result.code;
    }
}