From b4f93e832f2e1b16e163b8da010d1e36150bc192 Mon Sep 17 00:00:00 2001 From: LesanOuO <1960681385@qq.com> Date: Mon, 27 Jan 2025 09:25:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=97=A0=E6=97=B6=E9=97=B4=E4=B8=AD?= =?UTF-8?q?=E7=BC=80=E4=B8=8D=E8=AE=BE=E7=BD=AERedis=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/module/bpm/dal/redis/BpmProcessIdRedisDAO.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/redis/BpmProcessIdRedisDAO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/redis/BpmProcessIdRedisDAO.java index 53a76322fe..57b6fe8676 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/redis/BpmProcessIdRedisDAO.java +++ b/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 { public String generate(BpmModelMetaInfoVO.ProcessIdRule processIdRule) { // 生成日期前缀 String infix = ""; + boolean expireEnable = true; switch (processIdRule.getInfix()) { case "DAY": infix = DateUtil.format(LocalDateTime.now(), "yyyyMMDD"); @@ -42,13 +43,18 @@ public class BpmProcessIdRedisDAO { case "SECOND": infix = DateUtil.format(LocalDateTime.now(), "yyyyMMDDHHmmss"); break; + default: + expireEnable = false; + break; } // 生成序号 String noPrefix = processIdRule.getPrefix() + infix + processIdRule.getPostfix(); String key = RedisKeyConstants.BPM_PROCESS_ID + noPrefix; Long no = stringRedisTemplate.opsForValue().increment(key); - stringRedisTemplate.expire(key, Duration.ofDays(1L)); + if (Boolean.TRUE.equals(expireEnable)) { + stringRedisTemplate.expire(key, Duration.ofDays(1L)); + } return noPrefix + String.format("%0" + processIdRule.getLength() + "d", no); }