From 55769ee2dce4558b72ba5edac99d9989acb95023 Mon Sep 17 00:00:00 2001 From: walker-sheng Date: Sat, 9 Oct 2021 11:14:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=92=8C=E6=B3=A8=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cbtc/ProjectJointSimulationServiceImpl.java | 3 +-- .../SimulationRealDeviceThread.java | 14 ++++---------- .../passenger/PassengerFlowSimulateService.java | 3 --- .../cbtc/robot/RobotListenerHandler.java | 3 +-- 4 files changed, 6 insertions(+), 17 deletions(-) rename src/main/java/club/joylink/rtss/simulation/cbtc/device/real/{ => modbustcp}/SimulationRealDeviceThread.java (91%) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ProjectJointSimulationServiceImpl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ProjectJointSimulationServiceImpl.java index e0750f61d..25c187dca 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ProjectJointSimulationServiceImpl.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ProjectJointSimulationServiceImpl.java @@ -9,7 +9,7 @@ import club.joylink.rtss.services.auth.ProjectDeviceLogoutEvent; import club.joylink.rtss.services.auth.UserLogoutEvent; import club.joylink.rtss.services.project.DeviceService; import club.joylink.rtss.simulation.cbtc.data.map.Station; -import club.joylink.rtss.simulation.cbtc.device.real.SimulationRealDeviceThread; +import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.SimulationRealDeviceThread; import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig; import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.heb.device.Heb1IbpConfig; import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.heb.device.Heb1PscConfig; @@ -25,7 +25,6 @@ import club.joylink.rtss.vo.AccountVO; import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.client.project.LwConfigVO; import club.joylink.rtss.vo.client.project.ProjectDeviceVO; -import club.joylink.rtss.vo.client.project.richor.ZjdPslConfigVO; import club.joylink.rtss.vo.map.MapVO; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/SimulationRealDeviceThread.java b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/modbustcp/SimulationRealDeviceThread.java similarity index 91% rename from src/main/java/club/joylink/rtss/simulation/cbtc/device/real/SimulationRealDeviceThread.java rename to src/main/java/club/joylink/rtss/simulation/cbtc/device/real/modbustcp/SimulationRealDeviceThread.java index 0c69ea0e2..2bd742f98 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/SimulationRealDeviceThread.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/modbustcp/SimulationRealDeviceThread.java @@ -1,4 +1,4 @@ -package club.joylink.rtss.simulation.cbtc.device.real; +package club.joylink.rtss.simulation.cbtc.device.real.modbustcp; import club.joylink.rtss.constants.Project; import club.joylink.rtss.constants.ProjectDeviceType; @@ -7,7 +7,6 @@ import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityScreenDoor; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch; -import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.*; import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.PlcGateway; import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig; import club.joylink.rtss.simulation.cbtc.device.virtual.VirtualRealityDeviceService; @@ -18,7 +17,6 @@ import io.netty.channel.Channel; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.event.EventListener; -import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; @@ -89,8 +87,6 @@ public class SimulationRealDeviceThread { } } - @Async("realDeviceExecutor") -// @Scheduled(fixedRate = Query_Rate) public void queryDeviceStatus(Simulation simulation) { PlcGateway plcGateway = simulation.queryPlcGatewayDevice(); if (Objects.isNull(plcGateway)) { @@ -108,8 +104,6 @@ public class SimulationRealDeviceThread { } } - @Async("realDeviceExecutor") -// @Scheduled(fixedRate = 100) public void UpdateDeviceStatusByCollection(Simulation simulation) { Queue futureQueue = simulation.getDeviceQueryFutureQueue(); DeviceQueryFuture deviceQueryFuture = futureQueue.peek(); @@ -171,8 +165,8 @@ public class SimulationRealDeviceThread { } public void addJobs(Simulation simulation) { - simulation.addJobIfAbsent(Simulation.JobName.controlDevice, () -> this.controlDevice(simulation), SimulationConstants.VRD_LOOP_RATE); - simulation.addJobIfAbsent(Simulation.JobName.queryDeviceStatus, () -> this.queryDeviceStatus(simulation), Query_Rate); - simulation.addJobIfAbsent(Simulation.JobName.UpdateDeviceStatusByCollection, () -> this.UpdateDeviceStatusByCollection(simulation), 100); + simulation.addFixedRateJob(Simulation.JobName.controlDevice, () -> this.controlDevice(simulation), SimulationConstants.VRD_LOOP_RATE); + simulation.addFixedRateJob(Simulation.JobName.queryDeviceStatus, () -> this.queryDeviceStatus(simulation), Query_Rate); + simulation.addFixedRateJob(Simulation.JobName.UpdateDeviceStatusByCollection, () -> this.UpdateDeviceStatusByCollection(simulation), 100); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/passenger/PassengerFlowSimulateService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/passenger/PassengerFlowSimulateService.java index a4ac1c4fb..8c943dd06 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/passenger/PassengerFlowSimulateService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/passenger/PassengerFlowSimulateService.java @@ -95,9 +95,6 @@ public class PassengerFlowSimulateService { this.removeJobs(simulation); } -// @Async("nsExecutor") -// @EventListener - /** * @return 客流初始化成功 */ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/robot/RobotListenerHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/robot/RobotListenerHandler.java index f96aff13e..a062219f0 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/robot/RobotListenerHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/robot/RobotListenerHandler.java @@ -1,5 +1,6 @@ package club.joylink.rtss.simulation.cbtc.robot; +import club.joylink.rtss.services.IVoiceService; import club.joylink.rtss.simulation.cbtc.GroupSimulationService; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.command.CommandBO; @@ -15,7 +16,6 @@ import club.joylink.rtss.simulation.cbtc.event.SimulationConversationExitEvent; import club.joylink.rtss.simulation.cbtc.event.SimulationOperationMessageEvent; import club.joylink.rtss.simulation.cbtc.member.SimulationMember; import club.joylink.rtss.simulation.cbtc.onboard.ATO.service.ATOService; -import club.joylink.rtss.services.IVoiceService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -63,7 +63,6 @@ public class RobotListenerHandler { } } -// @Async("nsExecutor") // @EventListener // public void handleEvent(SimulationATPAutoCancelEBEvent event) { // VirtualRealityTrain train = event.getTrain();