转载请标明出处:
公司需求:生成14位时间+redis流水3位+"-"+4位字母数字随机+"-"+9位字母数字随机
把14位时间、redis流水号、字母数字随机数各写成一个方法,方便后期还有此类需求可以根据需求调用对应的方法获取数据进行拼接即可,灵活运用。
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.support.atomic.RedisAtomicLong;
import java.text.DecimalFormat;
import ja