diff --git a/src/main/java/com/glxp/api/service/collect/RelCodeBatchService.java b/src/main/java/com/glxp/api/service/collect/RelCodeBatchService.java index d130e2e1..09c41ad7 100644 --- a/src/main/java/com/glxp/api/service/collect/RelCodeBatchService.java +++ b/src/main/java/com/glxp/api/service/collect/RelCodeBatchService.java @@ -766,7 +766,7 @@ public class RelCodeBatchService extends ServiceImpl().eq("curCode",code) ); if(Objects.isNull(relCodeBatch)){ - redisDelayedQueue.addTaskToQueue(code+"&&&"+erpId,relCodeDelaySeconds); + redisDelayedQueue.addTaskToQueue(code+"&&&"+erpId,relCodeDelaySeconds,"rel_code_queue"); }else { log.error("有关联关系了此码==="+code); } diff --git a/src/main/java/com/glxp/api/util/redis/RedisDelayedQueue.java b/src/main/java/com/glxp/api/util/redis/RedisDelayedQueue.java index 3f57548d..09e9c76d 100644 --- a/src/main/java/com/glxp/api/util/redis/RedisDelayedQueue.java +++ b/src/main/java/com/glxp/api/util/redis/RedisDelayedQueue.java @@ -15,9 +15,9 @@ public class RedisDelayedQueue { // 将任务加入延时队列 - public void addTaskToQueue(String taskId, long delaySeconds) { + public void addTaskToQueue(String taskId, long delaySeconds,String queueName) { long timestamp = System.currentTimeMillis() / 1000 + delaySeconds; // 计算任务执行的时间戳 - jedis.zadd("rel_code_queue", timestamp, taskId); // 将任务添加到有序集合,score 为任务的执行时间戳 + jedis.zadd(queueName, timestamp, taskId); // 将任务添加到有序集合,score 为任务的执行时间戳 System.out.println("Task " + taskId + " added to queue with " + delaySeconds + " seconds delay."); }