From ed265ddfb8f08f69af064a9adf65fcbf06289ffe Mon Sep 17 00:00:00 2001 From: Junjie <xjj@123> Date: 星期二, 11 二月 2025 14:07:54 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/utils/NotifyUtils.java | 36 ++++++++++++++++++------------------ 1 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/zy/asrs/utils/NotifyUtils.java b/src/main/java/com/zy/asrs/utils/NotifyUtils.java index 6a1f480..18dc8ab 100644 --- a/src/main/java/com/zy/asrs/utils/NotifyUtils.java +++ b/src/main/java/com/zy/asrs/utils/NotifyUtils.java @@ -27,12 +27,12 @@ @Autowired private ConfigService configService; - public synchronized boolean notify(String deviceType, Integer device, String taskNo, NotifyMsgType msgType) { - SlaveType type = SlaveType.findInstance(deviceType); - if (type == null) { - return false; - } - return append(type, device, taskNo, msgType); + public synchronized boolean notify(String notifyType, Integer device, String taskNo, NotifyMsgType msgType) { + return append(notifyType, device, taskNo, msgType, null); + } + + public synchronized boolean notify(String notifyType, Integer device, String taskNo, NotifyMsgType msgType, String data) { + return append(notifyType, device, taskNo, msgType, data); } public synchronized List<String> takeKeys(String deviceType, Integer device) { @@ -73,25 +73,25 @@ return key; } - private boolean append(SlaveType deviceType, Integer device, String taskNo, NotifyMsgType msgType) { + private boolean append(String notifyType, Integer device, String taskNo, NotifyMsgType msgType, String data) { String key = null; - switch (deviceType) { - case Shuttle: - key = RedisKeyType.QUEUE_SHUTTLE.key + device; - break; - case ForkLift: - key = RedisKeyType.QUEUE_FORK_LIFT.key + device; - break; - default: - return false; + if (notifyType.equals(String.valueOf(SlaveType.Shuttle))) { + key = RedisKeyType.QUEUE_SHUTTLE.key + device; + } else if (notifyType.equals(String.valueOf(SlaveType.ForkLift))) { + key = RedisKeyType.QUEUE_FORK_LIFT.key + device; + } else if (notifyType.equals("task")) { + key = RedisKeyType.QUEUE_FORK_LIFT.key + device; + } else { + return false; } NotifyDto dto = new NotifyDto(); dto.setId(snowflakeIdWorker.nextId()); - dto.setDeviceType(String.valueOf(deviceType)); + dto.setNotifyType(notifyType); dto.setDevice(device); dto.setMsgType(msgType.flag); - dto.setContent(msgType.desc); + dto.setMsgDesc(msgType.desc); + dto.setData(data); dto.setTaskNo(taskNo); //閲嶈瘯娆℃暟 -- Gitblit v1.9.1