提交 15cfdb0e 编写于 作者: H haoxr

feat:SpringBoot整合Redis集群

上级 b73cc79e
......@@ -26,9 +26,7 @@ public class BusinessNoGenerator {
*/
public String generate(String businessCode, Integer digit) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
// String date = LocalDateTime.now(ZoneOffset.of("+8")).format(formatter);
String date="20210216";
String date = LocalDateTime.now(ZoneOffset.of("+8")).format(formatter);
String key = RedisKeyConstants.BUSINESS_NO_PREFIX + BusinessTypeEnum.getValue(businessCode).toString().toLowerCase() + ":" + date;
Long increment = redisTemplate.opsForValue().increment(key);
return date + businessCode + String.format("%0" + digit + "d", increment);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册