Commit f441de534b62e70edaef986ba746516d0285812e

Authored by YunaiV
1 parent ef0bf372

fix:【bpm 工作流】流程自定义 ID 序号,无 infix 前缀时,永不过期,可见 https://t.zsxq.com/MU1E2 讨论

yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/dal/redis/BpmProcessIdRedisDAO.java
@@ -51,8 +51,8 @@ public class BpmProcessIdRedisDAO { @@ -51,8 +51,8 @@ public class BpmProcessIdRedisDAO {
51 String noPrefix = processIdRule.getPrefix() + infix + processIdRule.getPostfix(); 51 String noPrefix = processIdRule.getPrefix() + infix + processIdRule.getPostfix();
52 String key = RedisKeyConstants.BPM_PROCESS_ID + noPrefix; 52 String key = RedisKeyConstants.BPM_PROCESS_ID + noPrefix;
53 Long no = stringRedisTemplate.opsForValue().increment(key); 53 Long no = stringRedisTemplate.opsForValue().increment(key);
54 - if (StrUtil.isNotEmpty(infix)) {  
55 - // 特殊:没有前缀,则不能过期,不能每次都是从 0 开始 54 + if (StrUtil.isEmpty(infix)) {
  55 + // 特殊:没有前缀,则不能过期,不能每次都是从 0 开始。可见 https://t.zsxq.com/MU1E2 讨论
56 stringRedisTemplate.expire(key, Duration.ofDays(1L)); 56 stringRedisTemplate.expire(key, Duration.ofDays(1L));
57 } 57 }
58 return noPrefix + String.format("%0" + processIdRule.getLength() + "d", no); 58 return noPrefix + String.format("%0" + processIdRule.getLength() + "d", no);