利用Redis自增长id 生成四位流水编号:
//设置key
String redisKey = "xxx" + time;
Long count = redisTemplate.opsForValue().increment(redisKey);
String format;
if (count > 9999) {
format = String.valueOf(count);
} else {
format = String.format("%04d", count);
}