#
Junjie
2025-07-05 a757961fc5b8f5ee5b79cc30615bd22d321d0d72
src/main/java/com/zy/core/ServerBootstrap.java
@@ -10,6 +10,7 @@
import com.zy.core.thread.impl.LfdZyForkLiftMasterThread;
import com.zy.core.thread.impl.NyShuttleThread;
import com.zy.core.utils.DeviceMsgUtils;
import com.zy.core.utils.FakeDeviceUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
@@ -30,6 +31,8 @@
    private RedisUtil redisUtil;
    @Autowired
    private DeviceMsgUtils deviceMsgUtils;
    @Autowired
    private FakeDeviceUtils fakeDeviceUtils;
    @PostConstruct
@@ -41,6 +44,8 @@
        initMq();
        // 初始化下位机线程
        initThread();
        // 初始化虚拟设备线程
        initFakeThread();
        News.info("核心控制层已启动...............................................");
    }
@@ -79,6 +84,20 @@
        }
    }
    private void initFakeThread(){
        String fakeDeviceConfig = fakeDeviceUtils.getFakeDeviceConfig();
        if(null != fakeDeviceConfig){
            List<DeviceConfig> deviceConfigs = JSON.parseArray(fakeDeviceConfig, DeviceConfig.class);
            for (DeviceConfig device : deviceConfigs) {
                if (device.getDeviceType().equals(String.valueOf(SlaveType.ForkLift))) {
                    initForkLiftThread(device);
                } else if (device.getDeviceType().equals(String.valueOf(SlaveType.Shuttle))) {
                    initShuttleThread(device);
                }
            }
        }
    }
    @PreDestroy
    public void destroy() {