#AI
Junjie
1 天以前 7fef7f8c7007eee9a54c7f6255391f7e46885825
src/main/java/com/zy/core/ServerBootstrap.java
@@ -10,13 +10,13 @@
import com.zy.core.enums.SlaveType;
import com.zy.core.thread.impl.ZySiemensCrnThread;
import com.zy.core.thread.impl.ZyStationThread;
import com.zy.core.thread.impl.ZyRgvThread;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.util.List;
@@ -34,7 +34,6 @@
    @Autowired
    private DeviceConfigService deviceConfigService;
    @PostConstruct
    @Async
    public void init() throws InterruptedException {
        News.info("核心控制层开始初始化...............................................");
@@ -112,6 +111,21 @@
            SlaveConnection.put(SlaveType.Devp, deviceConfig.getDeviceNo(), thread);
        }
        News.info("初始化RGV........................................................");
        List<DeviceConfig> rgvList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.Rgv)));
        for (DeviceConfig deviceConfig : rgvList) {
            ThreadHandler thread = null;
            if (deviceConfig.getThreadImpl().equals("ZyRgvThread")) {
                thread = new ZyRgvThread(deviceConfig, redisUtil);
            } else {
                throw new CoolException("未知的线程实现");
            }
            new Thread(thread).start();
            SlaveConnection.put(SlaveType.Rgv, deviceConfig.getDeviceNo(), thread);
        }
    }