package com.dl.common;
|
|
import com.dl.common.utils.DateUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.stereotype.Component;
|
|
|
@Component
|
public class GeneratorNoService {
|
@Autowired
|
private RedisTemplate redisTemplate;
|
|
public String generateNextId(String KEY) {
|
Long nextValue = redisTemplate.opsForValue().increment(KEY, 1);
|
return String.format(DateUtils.dateNow()+"%03d", nextValue);
|
}
|
}
|