| | |
| | | @Autowired |
| | | private StringRedisTemplate stringRedisTemplate; |
| | | |
| | | public synchronized String generateLisID() { |
| | | public synchronized String generateLisID(String prefix) { |
| | | String currentDate = new SimpleDateFormat("yyyyMMdd").format(new Date()); |
| | | String storedDate = stringRedisTemplate.opsForValue().get(LIS_CURRENT_DATE_KEY); |
| | | String lastIdStr = stringRedisTemplate.opsForValue().get(LIS_LAST_ID_KEY); |
| | |
| | | stringRedisTemplate.opsForValue().set(LIS_LAST_ID_KEY, String.valueOf(lastId)); |
| | | } |
| | | String yyMMdd = currentDate.substring(2); |
| | | return String.format("9%s%05d", yyMMdd, lastId); |
| | | return String.format(prefix+"%s%05d", yyMMdd, lastId); |
| | | } |
| | | |
| | | } |