zhang
2025-05-20 1313906bb1eb983d3beece810035e7fc28d6a92f
zy-acs-gateway/src/main/java/com/zy/acs/gateway/listen/MessageListener.java
@@ -2,18 +2,16 @@
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.gateway.config.SystemProperties;
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.framework.common.Cools;
import com.zy.acs.gateway.config.SystemProperties;
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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
@@ -39,19 +37,18 @@
    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())) {
                        publisher.publish(ProtocolUtils.installDownProtocol(protocol));
                    }
                }
                // 间隔
                try {
                    Thread.sleep(1000);
                    Thread.sleep(500);
                } catch (Exception ignore) {}
            }
        });