Commit b4f93e832f2e1b16e163b8da010d1e36150bc192

Authored by LesanOuO
1 parent 362b872a

fix: 无时间中缀不设置Redis过期时间

yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/redis/BpmProcessIdRedisDAO.java
... ... @@ -29,6 +29,7 @@ public class BpmProcessIdRedisDAO {
29 29 public String generate(BpmModelMetaInfoVO.ProcessIdRule processIdRule) {
30 30 // 生成日期前缀
31 31 String infix = "";
  32 + boolean expireEnable = true;
32 33 switch (processIdRule.getInfix()) {
33 34 case "DAY":
34 35 infix = DateUtil.format(LocalDateTime.now(), "yyyyMMDD");
... ... @@ -42,13 +43,18 @@ public class BpmProcessIdRedisDAO {
42 43 case "SECOND":
43 44 infix = DateUtil.format(LocalDateTime.now(), "yyyyMMDDHHmmss");
44 45 break;
  46 + default:
  47 + expireEnable = false;
  48 + break;
45 49 }
46 50  
47 51 // 生成序号
48 52 String noPrefix = processIdRule.getPrefix() + infix + processIdRule.getPostfix();
49 53 String key = RedisKeyConstants.BPM_PROCESS_ID + noPrefix;
50 54 Long no = stringRedisTemplate.opsForValue().increment(key);
51   - stringRedisTemplate.expire(key, Duration.ofDays(1L));
  55 + if (Boolean.TRUE.equals(expireEnable)) {
  56 + stringRedisTemplate.expire(key, Duration.ofDays(1L));
  57 + }
52 58 return noPrefix + String.format("%0" + processIdRule.getLength() + "d", no);
53 59 }
54 60  
... ...