From 14f2c4fce50c871d84f89d2dca2298e0892b4672 Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期二, 05 五月 2026 08:25:26 +0800
Subject: [PATCH] Merge branch 'rcs_master_1.0' into rcs_master_all
---
zy-acs-gateway/src/main/java/com/zy/acs/gateway/listen/MessageListener.java | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 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 99904ef..261262d 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
@@ -3,14 +3,20 @@
import com.alibaba.fastjson.JSON;
import com.zy.acs.common.constant.RedisConstant;
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.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.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
@@ -30,8 +36,16 @@
@Autowired
private DispatcherPublisher publisher;
+
@Autowired
private SystemProperties systemProperties;
+
+ @Autowired
+ private RabbitTemplate rabbitTemplate;
+
+ @Value("${spring.rabbitmq.enable}")
+ private Boolean flag;
+
@PostConstruct
private void start(){
@@ -43,7 +57,15 @@
log.info("鐩戝惉鍣� >>> {}", JSON.toJSONString(protocol));
}
if (!Cools.isEmpty(protocol.getAgvNo())) {
- publisher.publish(ProtocolUtils.installDownProtocol(protocol));
+ AgvPackage agvPackage = ProtocolUtils.installDownProtocol(protocol);
+ publisher.publish(agvPackage);
+ if (flag) {
+ // 鍐欏叆闃熷垪
+ 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()));
+ } else {
+ log.warn("RabbitTemplate is not running, message not sent");
+ }
+
}
}
// 闂撮殧
--
Gitblit v1.9.1