From 675c3b5d83b928c2bfbb84cd99a7d3f222d4432c Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期四, 05 三月 2026 10:18:16 +0800
Subject: [PATCH] 1

---
 zy-acs-gateway/src/main/java/com/zy/acs/gateway/listen/MessageListener.java |   27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/zy-acs-gateway/src/main/java/com/zy/acs/gateway/listen/MessageListener.java b/zy-acs-gateway/src/main/java/com/zy/acs/gateway/listen/MessageListener.java
index 6e6ced0..cb80297 100644
--- a/zy-acs-gateway/src/main/java/com/zy/acs/gateway/listen/MessageListener.java
+++ b/zy-acs-gateway/src/main/java/com/zy/acs/gateway/listen/MessageListener.java
@@ -2,18 +2,21 @@
 
 import com.alibaba.fastjson.JSON;
 import com.zy.acs.common.constant.RedisConstant;
-import com.zy.acs.common.domain.AgvCommand;
 import com.zy.acs.common.domain.AgvProtocol;
+import com.zy.acs.common.domain.mq.DeviceMessage;
+import com.zy.acs.common.utils.RedisSupport;
+import com.zy.acs.framework.common.Cools;
 import com.zy.acs.gateway.config.SystemProperties;
+import com.zy.acs.gateway.constant.ProtocolType;
+import com.zy.acs.gateway.constant.RabbitmqConstant;
 import com.zy.acs.gateway.domain.AgvPackage;
 import com.zy.acs.gateway.job.DispatcherPublisher;
-import com.zy.acs.common.utils.RedisSupport;
 import com.zy.acs.gateway.utils.ProtocolUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
-import org.springframework.util.StringUtils;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
@@ -35,23 +38,31 @@
     @Autowired
     private SystemProperties systemProperties;
 
+    @Autowired
+    private RabbitTemplate rabbitTemplate;
+
+
     @PostConstruct
     private void start(){
         thread = new Thread(() -> {
             while (!Thread.currentThread().isInterrupted()) {
-                AgvProtocol protocol = redis.pop(RedisConstant.AGV_CMD_DOWN_FLAG);
-                if (null != protocol){
+                AgvProtocol protocol = redis.pop(RedisConstant.AGV_PATH_DOWN_FLAG);
+                if (null != protocol) {
                     if (systemProperties.isPrintPacLog()) {
                         log.info("鐩戝惉鍣� >>> {}", JSON.toJSONString(protocol));
                     }
-                    if (!StringUtils.isEmpty(protocol.getAgvNo())){
+                    if (!Cools.isEmpty(protocol.getAgvNo())) {
+                        AgvPackage agvPackage = ProtocolUtils.installDownProtocol(protocol);
+                        publisher.publish(agvPackage);
+                        // 鍐欏叆闃熷垪
+                        log.info("<UNK> >>> {}", JSON.toJSONString(agvPackage));
+                        rabbitTemplate.convertAndSend(RabbitmqConstant.TOPIC_EXCHANGE, RabbitmqConstant.ROUTING_KEY_DOWN.replaceFirst(RabbitmqConstant.SPILT_REGEX, protocol.getAgvNo()).replaceFirst(RabbitmqConstant.SPILT_REGEX, agvPackage.getHeader().getProtocolType().name()),new DeviceMessage(agvPackage.getSourceHexStr()));
 
-                        publisher.publish(ProtocolUtils.installDownProtocol(protocol));
                     }
                 }
                 // 闂撮殧
                 try {
-                    Thread.sleep(1000);
+                    Thread.sleep(300);
                 } catch (Exception ignore) {}
             }
         });

--
Gitblit v1.9.1