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;
|
}
|
}
|