生日有礼定时奖励
This commit is contained in:
@@ -38,4 +38,36 @@ public interface TableValueConstant {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface BirthdayGiftRecord {
|
||||
@Getter
|
||||
enum PushStatus {
|
||||
WAIT_PUSH("wait_push", "待推送"),
|
||||
NO_PUSH("no_push", "不用推送"),
|
||||
SUCCESS("success", "推送成功");
|
||||
private final String code;
|
||||
private final String msg;
|
||||
|
||||
PushStatus(String code, String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
interface BirthdayGiftRecordCoupon {
|
||||
@Getter
|
||||
enum Type {
|
||||
GIVE("give", "待推送"),
|
||||
CONSUME("consume", "推送成功");
|
||||
private final String code;
|
||||
private final String msg;
|
||||
|
||||
Type(String code, String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.czg.utils;
|
||||
|
||||
import cn.hutool.core.lang.func.Func0;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Slf4j
|
||||
public class FunUtils {
|
||||
/**
|
||||
* 执行方法并捕获异常
|
||||
* @param func 方法
|
||||
* @param value 失败的值
|
||||
*/
|
||||
public static <T> T safeRun(Func0<T> func, T value) {
|
||||
try {
|
||||
return func.call();
|
||||
} catch (Exception e) {
|
||||
log.warn("方法执行失败: {}", e.getMessage());
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public static void safeRunVoid(Runnable func, String... msg) {
|
||||
try {
|
||||
func.run();
|
||||
} catch (Exception e) {
|
||||
log.warn(msg.length > 0 ? msg[0] : "方法执行失败: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user