update 优化 新增发号器工具类方法

dev
疯狂的狮子Li 7 months ago
parent 488a5631f4
commit 09c03bfc76

@ -24,14 +24,17 @@ public class SequenceUtils {
* *
*/ */
public static final Long DEFAULT_INIT_VALUE = 1L; public static final Long DEFAULT_INIT_VALUE = 1L;
/** /**
* *
*/ */
public static final Long DEFAULT_STEP_VALUE = 1L; public static final Long DEFAULT_STEP_VALUE = 1L;
/** /**
* - * -
*/ */
public static final Duration DEFAULT_EXPIRE_TIME_DAY = Duration.ofDays(1); public static final Duration DEFAULT_EXPIRE_TIME_DAY = Duration.ofDays(1);
/** /**
* - * -
*/ */
@ -114,6 +117,18 @@ public class SequenceUtils {
return String.valueOf(nextId(key, expireTime)); return String.valueOf(nextId(key, expireTime));
} }
/**
* keyid (ID=1,ID=1)
*
* @param key key
* @param expireTime
* @param width 0
* @return id
*/
public static String nextPaddedIdStr(String key, Duration expireTime, Integer width) {
return StringUtils.leftPad(nextIdStr(key, expireTime), width, '0');
}
/** /**
* yyyyMMdd id * yyyyMMdd id
* *

Loading…
Cancel
Save