From b445b59290a03b0413fbd76f159e8a0aeae9aa8f Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Fri, 22 Oct 2021 18:06:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E9=A5=B6=E6=B2=99=E7=9B=98(=E9=99=A4?= =?UTF-8?q?=E5=88=97=E8=BD=A6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rtss/constants/ProjectDeviceType.java | 5 +- .../controller/project/DeviceController.java | 6 +- .../DraftMapFlankProtectionService.java | 4 + .../DraftMapFlankProtectionServiceImpl.java | 10 ++ .../services/draftData/DraftMapService.java | 18 +-- .../draftData/DraftMapServiceImpl.java | 48 +++++-- .../services/draftData/RunLevelService.java | 13 +- .../rtss/services/project/DeviceService.java | 2 +- .../services/project/DeviceServiceImpl.java | 108 ++++++++++++--- .../cbtc/GroupSimulationService.java | 4 +- .../cbtc/GroupSimulationServiceImpl.java | 7 +- .../ProjectJointSimulationServiceImpl.java | 18 +++ .../rtss/simulation/cbtc/Simulation.java | 23 ++- .../cbtc/data/CalculateService.java | 4 +- .../cbtc/data/vr/VirtualRealitySignal.java | 3 +- .../SimulationRealDeviceConnectManager.java | 13 ++ .../modbustcp/richor/ZjdIbpServiceImpl.java | 6 - .../device/real/udp/Sr/SrSectionConfig.java | 21 +++ .../real/udp/Sr/SrSectionServiceImpl.java | 58 ++++++++ .../device/real/udp/Sr/SrSignalConfig.java | 21 +++ .../real/udp/Sr/SrSignalServiceImpl.java | 131 ++++++++++++++++++ .../device/real/udp/Sr/SrSwitchConfig.java | 21 +++ .../real/udp/Sr/SrSwitchServiceImpl.java | 75 ++++++++++ .../cbtc/device/real/udp/UDPClient.java | 33 +++-- .../cbtc/device/real/udp/UDPClientConfig.java | 20 +++ .../cbtc/device/real/udp/UDPLowConfig.java | 50 +++++++ .../device/real/udp/UDPRealDeviceService.java | 15 ++ .../real/udp/UDPRealDeviceServiceManager.java | 25 ++++ .../device/real/udp/UDPRealDeviceThread.java | 96 +++++++++++++ .../real/udp/handler/UDPMessageHandler.java | 18 ++- .../device/virtual/VRDeviceLogicLoop.java | 17 ++- .../vo/client/project/ProjectDeviceVO.java | 32 +++++ .../vo/client/project/UDPClientConfigVO.java | 19 +++ .../vo/client/project/UDPLowConfigVO.java | 27 ++++ .../vo/client/project/UdpLowConfigVO.java | 5 - .../client/project/gzb/GzbSignalConfigVO.java | 2 - .../client/project/gzb/GzbSwitchConfigVO.java | 2 - .../vo/client/project/sdy/SdyPsdConfigVO.java | 3 - .../vo/client/project/sdy/SdyPslConfigVO.java | 3 - .../client/project/sr/SrSectionConfigVO.java | 19 +++ .../client/project/sr/SrSignalConfigVO.java | 19 +++ .../client/project/sr/SrSwitchConfigVO.java | 19 +++ .../vo/client/project/xty/XtyPsdConfigVO.java | 3 - 43 files changed, 942 insertions(+), 104 deletions(-) create mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/Sr/SrSectionConfig.java create mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/Sr/SrSectionServiceImpl.java create mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/Sr/SrSignalConfig.java create mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/Sr/SrSignalServiceImpl.java create mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/Sr/SrSwitchConfig.java create mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/Sr/SrSwitchServiceImpl.java create mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/UDPClientConfig.java create mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/UDPLowConfig.java create mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/UDPRealDeviceService.java create mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/UDPRealDeviceServiceManager.java create mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/UDPRealDeviceThread.java create mode 100644 src/main/java/club/joylink/rtss/vo/client/project/UDPClientConfigVO.java create mode 100644 src/main/java/club/joylink/rtss/vo/client/project/UDPLowConfigVO.java delete mode 100644 src/main/java/club/joylink/rtss/vo/client/project/UdpLowConfigVO.java create mode 100644 src/main/java/club/joylink/rtss/vo/client/project/sr/SrSectionConfigVO.java create mode 100644 src/main/java/club/joylink/rtss/vo/client/project/sr/SrSignalConfigVO.java create mode 100644 src/main/java/club/joylink/rtss/vo/client/project/sr/SrSwitchConfigVO.java diff --git a/src/main/java/club/joylink/rtss/constants/ProjectDeviceType.java b/src/main/java/club/joylink/rtss/constants/ProjectDeviceType.java index 088a5e4b3..d95724175 100644 --- a/src/main/java/club/joylink/rtss/constants/ProjectDeviceType.java +++ b/src/main/java/club/joylink/rtss/constants/ProjectDeviceType.java @@ -32,6 +32,8 @@ public enum ProjectDeviceType { DCU, /** UDP下位机 */ UDP_LOW, + /** UDP客户端 */ + UDP_CLIENT, /* -----------plc device end---------- */ /* -----------client device start---------- */ @@ -76,6 +78,7 @@ public enum ProjectDeviceType { SWITCH, SIGNAL, DCU, - UDP_LOW); + UDP_LOW, + UDP_CLIENT); } } diff --git a/src/main/java/club/joylink/rtss/controller/project/DeviceController.java b/src/main/java/club/joylink/rtss/controller/project/DeviceController.java index f6411049b..248d6d0ec 100644 --- a/src/main/java/club/joylink/rtss/controller/project/DeviceController.java +++ b/src/main/java/club/joylink/rtss/controller/project/DeviceController.java @@ -237,9 +237,9 @@ public class DeviceController { this.deviceService.addOrUpdateRichorDeviceConfig(accountVO); } - @PostMapping("/sr/addOrUpdate") + @PostMapping("/sr/addOrUpdate/{mapId}") public void addOrUpdateSrDeviceConfig(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_USER_KEY) - AccountVO accountVO) { - this.deviceService.addOrUpdateSrDeviceConfig(accountVO); + AccountVO accountVO, @PathVariable Long mapId) { + this.deviceService.addOrUpdateSrDeviceConfig(accountVO, mapId); } } diff --git a/src/main/java/club/joylink/rtss/services/draftData/DraftMapFlankProtectionService.java b/src/main/java/club/joylink/rtss/services/draftData/DraftMapFlankProtectionService.java index c97327d4d..d64c8cedf 100644 --- a/src/main/java/club/joylink/rtss/services/draftData/DraftMapFlankProtectionService.java +++ b/src/main/java/club/joylink/rtss/services/draftData/DraftMapFlankProtectionService.java @@ -4,7 +4,11 @@ import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.map.logic.MapRouteFlankProtectionNewVO; import club.joylink.rtss.vo.map.query.MapRouteFlankProtectionQueryVO; +import java.util.List; + public interface DraftMapFlankProtectionService { + List queryAll(long mapId); + void create(MapRouteFlankProtectionNewVO flankProtectionNewVO); PageVO pagingQueryFlankProtections(Long mapId, MapRouteFlankProtectionQueryVO queryVO); diff --git a/src/main/java/club/joylink/rtss/services/draftData/DraftMapFlankProtectionServiceImpl.java b/src/main/java/club/joylink/rtss/services/draftData/DraftMapFlankProtectionServiceImpl.java index 8c5b75249..71a3df994 100644 --- a/src/main/java/club/joylink/rtss/services/draftData/DraftMapFlankProtectionServiceImpl.java +++ b/src/main/java/club/joylink/rtss/services/draftData/DraftMapFlankProtectionServiceImpl.java @@ -14,6 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; +import java.util.List; + @Slf4j @Service public class DraftMapFlankProtectionServiceImpl implements DraftMapFlankProtectionService { @@ -21,6 +23,14 @@ public class DraftMapFlankProtectionServiceImpl implements DraftMapFlankProtecti @Autowired private DraftMapRouteFlankProtectionDAO draftMapRouteFlankProtectionDAO; + @Override + public List queryAll(long mapId) { + DraftMapRouteFlankProtectionExample example = new DraftMapRouteFlankProtectionExample(); + example.createCriteria().andMapIdEqualTo(mapId); + List list = draftMapRouteFlankProtectionDAO.selectByExampleWithBLOBs(example); + return MapRouteFlankProtectionNewVO.convert2VOList(list); + } + @Override public void create(MapRouteFlankProtectionNewVO flankProtectionNewVO) { // 编号/名称查重 diff --git a/src/main/java/club/joylink/rtss/services/draftData/DraftMapService.java b/src/main/java/club/joylink/rtss/services/draftData/DraftMapService.java index 3ee8e842f..2d405b715 100644 --- a/src/main/java/club/joylink/rtss/services/draftData/DraftMapService.java +++ b/src/main/java/club/joylink/rtss/services/draftData/DraftMapService.java @@ -1,16 +1,7 @@ package club.joylink.rtss.services.draftData; -import club.joylink.rtss.vo.map.*; -import club.joylink.rtss.vo.map.logic.MapAutoReentryVO; -import club.joylink.rtss.vo.map.logic.MapAutoSignalNewVO; -import club.joylink.rtss.vo.map.logic.MapDestinationCodeDefinitionVO; -import club.joylink.rtss.vo.map.logic.MapOverlapVO; -import club.joylink.rtss.vo.map.logic.MapRouteFlankProtectionNewVO; -import club.joylink.rtss.vo.map.logic.MapRouteNewVO; -import club.joylink.rtss.vo.map.logic.MapRoutingDataVO; -import club.joylink.rtss.vo.map.logic.MapSignalApproachSectionVO; -import club.joylink.rtss.vo.map.logic.MapStationParkingTimeVO; -import club.joylink.rtss.vo.map.logic.MapStationRunLevelVO; +import club.joylink.rtss.vo.map.MapVO; +import club.joylink.rtss.vo.map.logic.*; import java.util.List; @@ -22,6 +13,11 @@ public interface DraftMapService { */ MapVO getDraftMapData(Long mapId); + /** + * 获取草稿地图的数据(包含逻辑数据) + */ + MapVO getDraftMapDataDetail(long mapId); + /** * 清理旧的联锁数据,并保存新联锁数据 * @param mapId diff --git a/src/main/java/club/joylink/rtss/services/draftData/DraftMapServiceImpl.java b/src/main/java/club/joylink/rtss/services/draftData/DraftMapServiceImpl.java index 1a9c6e6c3..cf890efc3 100644 --- a/src/main/java/club/joylink/rtss/services/draftData/DraftMapServiceImpl.java +++ b/src/main/java/club/joylink/rtss/services/draftData/DraftMapServiceImpl.java @@ -3,17 +3,9 @@ package club.joylink.rtss.services.draftData; import club.joylink.rtss.dao.*; import club.joylink.rtss.entity.*; import club.joylink.rtss.util.JsonUtils; -import club.joylink.rtss.vo.map.*; -import club.joylink.rtss.vo.map.logic.MapAutoReentryVO; -import club.joylink.rtss.vo.map.logic.MapAutoSignalNewVO; -import club.joylink.rtss.vo.map.logic.MapDestinationCodeDefinitionVO; -import club.joylink.rtss.vo.map.logic.MapOverlapVO; -import club.joylink.rtss.vo.map.logic.MapRouteFlankProtectionNewVO; -import club.joylink.rtss.vo.map.logic.MapRouteNewVO; -import club.joylink.rtss.vo.map.logic.MapRoutingDataVO; -import club.joylink.rtss.vo.map.logic.MapSignalApproachSectionVO; -import club.joylink.rtss.vo.map.logic.MapStationParkingTimeVO; -import club.joylink.rtss.vo.map.logic.MapStationRunLevelVO; +import club.joylink.rtss.vo.map.MapLogicDataNewVO; +import club.joylink.rtss.vo.map.MapVO; +import club.joylink.rtss.vo.map.logic.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -46,6 +38,21 @@ public class DraftMapServiceImpl implements DraftMapService { @Autowired private DraftMapParkingTimeDAO draftMapParkingTimeDAO; + @Autowired + private DraftMapRouteService draftMapRouteService; + @Autowired + private RunLevelService runLevelService; + @Autowired + private ParkTimeService parkTimeService; + @Autowired + private DraftMapOverrunService draftMapOverrunService; + @Autowired + private DraftMapOverlapService draftMapOverlapService; + @Autowired + private DraftMapFlankProtectionService draftMapFlankProtectionService; + @Autowired + private DraftMapSignalApproachSectionService draftMapSignalApproachSectionService; + @Override public MapVO getDraftMapData(Long mapId) { DraftMapWithBLOBs draftMap = this.draftMapDAO.selectByPrimaryKey(mapId); @@ -53,6 +60,25 @@ public class DraftMapServiceImpl implements DraftMapService { return mapVO; } + @Override + public MapVO getDraftMapDataDetail(long mapId) { + MapVO map = getDraftMapData(mapId); + MapLogicDataNewVO logicDataNew = new MapLogicDataNewVO(); + logicDataNew.setRouteList(draftMapRouteService.queryAllRoutes(mapId)); + logicDataNew.setRunLevelList(runLevelService.queryAll(mapId)); + logicDataNew.setParkingTimeList(parkTimeService.queryAll(mapId)); + logicDataNew.setOverrunList(draftMapOverrunService.queryAll(mapId)); + logicDataNew.setOverlapList(draftMapOverlapService.queryAll(mapId)); + logicDataNew.setFlankProtectionList(draftMapFlankProtectionService.queryAll(mapId)); +// logicDataNew.setDestinationCodeDefinitionList(); 后续补上 +// logicDataNew.setAutoSignalList(); 待补 +// logicDataNew.setAutoReentryList(); 待补 +// logicDataNew.setRoutingList(); 待补 + logicDataNew.setSignalApproachSectionList(draftMapSignalApproachSectionService.queryAll(mapId)); + map.setLogicDataNew(logicDataNew); + return map; + } + @Transactional @Override public void cleanAndSaveCiData(Long mapId, diff --git a/src/main/java/club/joylink/rtss/services/draftData/RunLevelService.java b/src/main/java/club/joylink/rtss/services/draftData/RunLevelService.java index ab97bc5f4..35d4ddadd 100644 --- a/src/main/java/club/joylink/rtss/services/draftData/RunLevelService.java +++ b/src/main/java/club/joylink/rtss/services/draftData/RunLevelService.java @@ -8,11 +8,10 @@ import club.joylink.rtss.simulation.cbtc.data.CalculateService; import club.joylink.rtss.simulation.cbtc.data.map.MapElement; import club.joylink.rtss.simulation.cbtc.data.map.Section; import club.joylink.rtss.simulation.cbtc.data.support.RoutePath; -import club.joylink.rtss.util.JsonUtils; -import club.joylink.rtss.vo.map.logic.MapRoutingDataVO; import club.joylink.rtss.vo.map.MapRoutingSectionNewVO; -import club.joylink.rtss.vo.map.logic.MapStationRunLevelVO; import club.joylink.rtss.vo.map.MapVO; +import club.joylink.rtss.vo.map.logic.MapRoutingDataVO; +import club.joylink.rtss.vo.map.logic.MapStationRunLevelVO; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -78,10 +77,10 @@ public class RunLevelService { public List generate(Long mapId) { // 先校验地图基础数据 - MapVO mapVO = this.draftMapService.getDraftMapData(mapId); - SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildBasicMapData(mapVO); - BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(), - String.format("地图基础数据有错误: %s", JsonUtils.writeValueAsString(buildResult.getErrMsgList()))); + MapVO mapVO = this.draftMapService.getDraftMapDataDetail(mapId); + SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapData(mapVO); +// BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(), +// String.format("地图基础数据有错误: %s", JsonUtils.writeValueAsString(buildResult.getErrMsgList()))); Map deviceMap = buildResult.getDeviceMap(); List routingDataVOList = this.draftMapService.queryRoutings(mapId); List runLevelVOList = this.generateRunLevels(routingDataVOList, deviceMap); diff --git a/src/main/java/club/joylink/rtss/services/project/DeviceService.java b/src/main/java/club/joylink/rtss/services/project/DeviceService.java index acfb06aea..cf42eccb9 100644 --- a/src/main/java/club/joylink/rtss/services/project/DeviceService.java +++ b/src/main/java/club/joylink/rtss/services/project/DeviceService.java @@ -182,5 +182,5 @@ public interface DeviceService { void addOrUpdateRichorDeviceConfig(AccountVO accountVO); - void addOrUpdateSrDeviceConfig(AccountVO accountVO); + void addOrUpdateSrDeviceConfig(AccountVO accountVO, Long mapId); } diff --git a/src/main/java/club/joylink/rtss/services/project/DeviceServiceImpl.java b/src/main/java/club/joylink/rtss/services/project/DeviceServiceImpl.java index 349aac463..e3a67ebb3 100644 --- a/src/main/java/club/joylink/rtss/services/project/DeviceServiceImpl.java +++ b/src/main/java/club/joylink/rtss/services/project/DeviceServiceImpl.java @@ -6,6 +6,8 @@ import club.joylink.rtss.dao.ProjectDeviceDAO; import club.joylink.rtss.entity.ProjectDevice; import club.joylink.rtss.entity.ProjectDeviceExample; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; +import club.joylink.rtss.services.IMapService; +import club.joylink.rtss.util.JsonUtils; import club.joylink.rtss.vo.AccountVO; import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.client.PageVO; @@ -17,7 +19,15 @@ import club.joylink.rtss.vo.client.project.richor.ZjdPsdConfigVO; import club.joylink.rtss.vo.client.project.richor.ZjdPslConfigVO; import club.joylink.rtss.vo.client.project.sdy.SdyPsdConfigVO; import club.joylink.rtss.vo.client.project.sdy.SdyPslConfigVO; +import club.joylink.rtss.vo.client.project.sr.SrSectionConfigVO; +import club.joylink.rtss.vo.client.project.sr.SrSignalConfigVO; +import club.joylink.rtss.vo.client.project.sr.SrSwitchConfigVO; import club.joylink.rtss.vo.client.project.xty.XtyPsdConfigVO; +import club.joylink.rtss.vo.map.MapGraphDataNewVO; +import club.joylink.rtss.vo.map.MapVO; +import club.joylink.rtss.vo.map.graph.MapSectionNewVO; +import club.joylink.rtss.vo.map.graph.MapSignalNewVO; +import club.joylink.rtss.vo.map.graph.MapSwitchVO; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import org.springframework.beans.factory.annotation.Autowired; @@ -37,6 +47,9 @@ public class DeviceServiceImpl implements DeviceService { @Autowired private ProjectDeviceDAO projectDeviceDAO; + @Autowired + private IMapService iMapService; + @Override public PageVO pagingQuery(ProjectDevicePageQueryVO queryVO, LoginUserInfoVO userLoginInfo) { @@ -398,32 +411,91 @@ public class DeviceServiceImpl implements DeviceService { } @Override - public void addOrUpdateSrDeviceConfig(AccountVO accountVO) { + public void addOrUpdateSrDeviceConfig(AccountVO accountVO, Long mapId) { // 删除旧配置 ProjectDeviceExample example = new ProjectDeviceExample(); example.createCriteria() - .andProjectCodeEqualTo(Project.RICHOR_JOINT.name()) + .andProjectCodeEqualTo(Project.SR_SANDBOX.name()) .andTypeIn(ProjectDeviceType.PlcDeviceList().stream() .map(Enum::name).collect(Collectors.toList())); this.projectDeviceDAO.deleteByExample(example); -// // 保存新配置 -// List list = this.buildSrProjectDevices(accountVO); -// for (ProjectDevice projectDevice : list) { -// this.projectDeviceDAO.insert(projectDevice); -// } + // 保存新配置 + List list = this.buildSrProjectDevices(accountVO, mapId); + for (ProjectDevice projectDevice : list) { + this.projectDeviceDAO.insert(projectDevice); + } } -// private List buildSrProjectDevices(AccountVO accountVO) { -// LocalDateTime now = LocalDateTime.now(); -// List list = new ArrayList<>(); -// //UDP下位机 -// ProjectDevice udp = new ProjectDevice(); -// udp.setProjectCode(Project.SR_SANDBOX.name()); -// udp.setCode("sr-udp"); -// udp.setType(ProjectDeviceType.UDP_LOW.name()); -// udp.setCreator(accountVO.getId()); -// udp.setCreateTime(now); -// } + private List buildSrProjectDevices(AccountVO accountVO, long mapId) { + LocalDateTime now = LocalDateTime.now(); + List list = new ArrayList<>(); + //UDP下位机 + ProjectDevice udp = new ProjectDevice(); + udp.setProjectCode(Project.SR_SANDBOX.name()); + udp.setCode("sr-udp"); + udp.setType(ProjectDeviceType.UDP_LOW.name()); + udp.setCreator(accountVO.getId()); + udp.setCreateTime(now); + UDPLowConfigVO udpConfigVO = new UDPLowConfigVO("", 10086); + udp.setConfig(udpConfigVO.toJson()); + list.add(udp); + //UDP客户端 + ProjectDevice udpClient = new ProjectDevice(); + udpClient.setProjectCode(Project.SR_SANDBOX.name()); + udpClient.setCode("sr-udp-client"); + udpClient.setType(ProjectDeviceType.UDP_CLIENT.name()); + udpClient.setCreator(accountVO.getId()); + udpClient.setCreateTime(now); + UDPClientConfigVO udpClientConfigVO = new UDPClientConfigVO("192.168.8.109", 10000); + udpClient.setConfig(JsonUtils.writeValueAsString(udpClientConfigVO)); + list.add(udpClient); + /*-------------------- 地图设备 --------------------*/ + MapVO map = iMapService.getMapDetail(mapId); + MapGraphDataNewVO graphDataNew = map.getGraphDataNew(); + //信号机 + for (MapSignalNewVO mapSignalNewVO : graphDataNew.getSignalList()) { + if (StringUtils.hasText(mapSignalNewVO.getSrCode())) { + ProjectDevice signal = new ProjectDevice(); + signal.setProjectCode(Project.SR_SANDBOX.name()); + signal.setCode("sr-signal-" + mapSignalNewVO.getCode()); + signal.setType(ProjectDeviceType.SIGNAL.name()); + signal.setCreator(accountVO.getId()); + signal.setCreateTime(now); + SrSignalConfigVO configVO = new SrSignalConfigVO(mapSignalNewVO.getCode(), mapSignalNewVO.getSrCode()); + signal.setConfig(JsonUtils.writeValueAsString(configVO)); + list.add(signal); + } + } + //道岔 + for (MapSwitchVO mapSwitchVO : graphDataNew.getSwitchList()) { + if (StringUtils.hasText(mapSwitchVO.getSrCode())) { + ProjectDevice aSwitch = new ProjectDevice(); + aSwitch.setProjectCode(Project.SR_SANDBOX.name()); + aSwitch.setCode("sr-switch-" + mapSwitchVO.getCode()); + aSwitch.setType(ProjectDeviceType.SWITCH.name()); + aSwitch.setCreator(accountVO.getId()); + aSwitch.setCreateTime(now); + SrSwitchConfigVO configVO = new SrSwitchConfigVO(mapSwitchVO.getCode(), mapSwitchVO.getSrCode()); + aSwitch.setConfig(JsonUtils.writeValueAsString(configVO)); + list.add(aSwitch); + } + } + //区段 + for (MapSectionNewVO mapSectionNewVO : graphDataNew.getSectionList()) { + if (StringUtils.hasText(mapSectionNewVO.getSrCode())) { + ProjectDevice section = new ProjectDevice(); + section.setProjectCode(Project.SR_SANDBOX.name()); + section.setCode("sr-section-" + mapSectionNewVO.getCode()); + section.setType(ProjectDeviceType.SECTION.name()); + section.setCreator(accountVO.getId()); + section.setCreateTime(now); + SrSectionConfigVO configVO = new SrSectionConfigVO(mapSectionNewVO.getCode(), mapSectionNewVO.getSrCode()); + section.setConfig(JsonUtils.writeValueAsString(configVO)); + list.add(section); + } + } + return list; + } private List buildZjdProjectDevices(AccountVO accountVO) { LocalDateTime now = LocalDateTime.now(); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/GroupSimulationService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/GroupSimulationService.java index b43b49420..1a94c9c38 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/GroupSimulationService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/GroupSimulationService.java @@ -19,8 +19,8 @@ import club.joylink.rtss.vo.client.runplan.PlanTripNumberVO; import club.joylink.rtss.vo.client.runplan.RunPlanEChartsDataVO; import club.joylink.rtss.vo.client.runplan.RunPlanVO; import club.joylink.rtss.vo.client.simulationv1.*; -import club.joylink.rtss.vo.map.graph.MapStationNewVO; import club.joylink.rtss.vo.map.MapVO; +import club.joylink.rtss.vo.map.graph.MapStationNewVO; import java.time.LocalDateTime; import java.time.LocalTime; @@ -280,4 +280,6 @@ public interface GroupSimulationService { void confirmHasPermission(AccountVO accountVO, Long mapId, String prdType); boolean hasPermission(AccountVO accountVO, Long mapId, String prdType); + + List querySimulations(); } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/GroupSimulationServiceImpl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/GroupSimulationServiceImpl.java index fac88bdba..9087c3a55 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/GroupSimulationServiceImpl.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/GroupSimulationServiceImpl.java @@ -62,8 +62,8 @@ import club.joylink.rtss.vo.client.script.ScriptVO; import club.joylink.rtss.vo.client.simulationv1.*; import club.joylink.rtss.vo.client.training.TrainingNewVO; import club.joylink.rtss.vo.client.userPermission.UserPermissionVO; -import club.joylink.rtss.vo.map.graph.MapStationNewVO; import club.joylink.rtss.vo.map.MapVO; +import club.joylink.rtss.vo.map.graph.MapStationNewVO; import club.joylink.rtss.websocket.StompMessageService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -1073,6 +1073,11 @@ public class GroupSimulationServiceImpl implements GroupSimulationService { return false; } + @Override + public List querySimulations() { + return groupSimulationCache.queryAllSimulation(); + } + private boolean isThirdAccountHasPermission(AccountVO accountVO, List ups, Long mapId, String prdType) { if (accountVO.isThirdChildAccount()) { List loginInfos = this.loginSessionManager.getAllLoginUserInfos(); 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 ce8347994..d757ebf14 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ProjectJointSimulationServiceImpl.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ProjectJointSimulationServiceImpl.java @@ -17,6 +17,10 @@ import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.heb.device.Heb1Ps import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.richor.ZjdIbpConfig; import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.richor.ZjdPslConfig; import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.xty.XtyPsdConfig; +import club.joylink.rtss.simulation.cbtc.device.real.udp.Sr.SrSectionConfig; +import club.joylink.rtss.simulation.cbtc.device.real.udp.Sr.SrSignalConfig; +import club.joylink.rtss.simulation.cbtc.device.real.udp.Sr.SrSwitchConfig; +import club.joylink.rtss.simulation.cbtc.device.real.udp.UDPRealDeviceThread; import club.joylink.rtss.simulation.cbtc.event.SimulationUserEnterEvent; import club.joylink.rtss.simulation.cbtc.member.MemberManager; import club.joylink.rtss.simulation.cbtc.member.SimulationMember; @@ -63,6 +67,9 @@ public class ProjectJointSimulationServiceImpl implements ProjectJointSimulation @Autowired private SimulationRealDeviceThread simulationRealDeviceThread; + @Autowired + private UDPRealDeviceThread udpRealDeviceThread; + @Override public Simulation createSimulation(LoginUserInfoVO loginUserInfo) { Project project = loginUserInfo.getProject(); @@ -100,6 +107,7 @@ public class ProjectJointSimulationServiceImpl implements ProjectJointSimulation simulation.setRealDeviceList(realDeviceList); if (!CollectionUtils.isEmpty(realDeviceList)) { simulationRealDeviceThread.addJobs(simulation); + udpRealDeviceThread.addJobs(simulation); } for (RealDeviceConfig realDevice : realDeviceList) { if (ProjectDeviceType.PLC_GATEWAY.equals(realDevice.getDeviceType())) { @@ -145,6 +153,16 @@ public class ProjectJointSimulationServiceImpl implements ProjectJointSimulation return ((ZjdPslConfig) config).getConfigVO().getPslCode(); } } + case SR_SANDBOX: { + switch (config.getDeviceType()) { + case SIGNAL: + return ((SrSignalConfig) config).getConfigVO().getVrCode(); + case SECTION: + return ((SrSectionConfig) config).getConfigVO().getVrCode(); + case SWITCH: + return ((SrSwitchConfig) config).getConfigVO().getVrCode(); + } + } } return null; } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/Simulation.java b/src/main/java/club/joylink/rtss/simulation/cbtc/Simulation.java index 14b256745..895fd98cc 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/Simulation.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/Simulation.java @@ -25,7 +25,6 @@ import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType; import club.joylink.rtss.simulation.cbtc.member.SimulationMember; import club.joylink.rtss.simulation.cbtc.member.SimulationUser; import club.joylink.rtss.simulation.cbtc.script.ScriptBO; -import club.joylink.rtss.simulation.rt.iscs.IscsStatusPublisher; import club.joylink.rtss.simulation.vo.SimulationInfoVO; import club.joylink.rtss.vo.AccountVO; import club.joylink.rtss.vo.client.fault.FaultRuleVO; @@ -329,6 +328,27 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation queryAllRealDevice(ProjectDeviceType type) { + if (CollectionUtils.isEmpty(realDeviceList)) { + return Collections.emptyList(); + } else { + return realDeviceList.stream() + .filter(config -> Objects.equals(config.getDeviceType(), type)) + .collect(Collectors.toList()); + } + } + public void pushModbusFuture(DeviceQueryFuture future) { this.deviceQueryFutureQueue.add(future); } @@ -652,5 +672,6 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation iterTimes) { - warnList.add(String.format("进路路径[%s]未找到:迭代100次,最后区段为[%s]", - routePath.debugStr(), routePath.getLastSection().debugStr())); + warnList.add(String.format("进路路径[%s]未找到:迭代[%s]次,最后区段为[%s]", + routePath.debugStr(), iterTimes, routePath.getLastSection().debugStr())); return; } Section end = routePath.getEnd(); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealitySignal.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealitySignal.java index 8d6e11f8b..89a79c2dc 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealitySignal.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealitySignal.java @@ -63,7 +63,8 @@ public class VirtualRealitySignal extends ControllableVrDevice { return; } } - this.aspect = command; +// this.aspect = command; + this.aspect = SignalAspect.R; } public enum Fault { diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/modbustcp/SimulationRealDeviceConnectManager.java b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/modbustcp/SimulationRealDeviceConnectManager.java index 30b34cc64..0d25f3358 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/modbustcp/SimulationRealDeviceConnectManager.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/modbustcp/SimulationRealDeviceConnectManager.java @@ -65,6 +65,19 @@ public class SimulationRealDeviceConnectManager { } break; } + case SECTION: { + VirtualRealityDevice vrDevice = simulation.getRepository().getVRByCode(deviceCode); + if (MapElement.DeviceType.AXLE_COUNTER.equals(vrDevice.getDeviceType())) { + typeEqual = true; + MapNamedElement old = realDevice.getMapElement(); + if (Objects.nonNull(old)) { + ((VirtualRealitySectionAxleCounter) old).updateRealDevice(null); + } + vrDevice.updateRealDevice(realDevice); + realDevice.connect(vrDevice); + } + break; + } case PSC: case PSD: { VirtualRealityDevice vrDevice = simulation.getRepository().getVRByCode(deviceCode); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/modbustcp/richor/ZjdIbpServiceImpl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/modbustcp/richor/ZjdIbpServiceImpl.java index ff881c433..1490fb68a 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/modbustcp/richor/ZjdIbpServiceImpl.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/modbustcp/richor/ZjdIbpServiceImpl.java @@ -50,12 +50,6 @@ public class ZjdIbpServiceImpl implements RealDeviceService { plcGatewayService.writeSingleCoil(baseAddr, configVO.getW_xx_jjtcd(), false, channel); } - public static void main(String[] args) { - int addr = 2; - int bit = 9; - System.out.println((addr + 1) * 16 + (bit + 8) % 16); - } - @Override public void handle(Simulation simulation, RealDeviceConfig deviceConfig, ByteBuf byteBuf) { PlcGateway plcGateway = simulation.queryPlcGatewayDevice(); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/Sr/SrSectionConfig.java b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/Sr/SrSectionConfig.java new file mode 100644 index 000000000..89687c6e0 --- /dev/null +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/Sr/SrSectionConfig.java @@ -0,0 +1,21 @@ +package club.joylink.rtss.simulation.cbtc.device.real.udp.Sr; + +import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig; +import club.joylink.rtss.util.JsonUtils; +import club.joylink.rtss.vo.client.project.ProjectDeviceVO; +import club.joylink.rtss.vo.client.project.sr.SrSectionConfigVO; +import lombok.Getter; + +import java.util.Objects; + +@Getter +public class SrSectionConfig extends RealDeviceConfig { + private SrSectionConfigVO configVO; + + public SrSectionConfig(ProjectDeviceVO projectDevice) { + super(projectDevice); + if (Objects.nonNull(projectDevice.getConfig())) { + this.configVO = JsonUtils.read(projectDevice.getConfig(), SrSectionConfigVO.class); + } + } +} diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/Sr/SrSectionServiceImpl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/Sr/SrSectionServiceImpl.java new file mode 100644 index 000000000..e901c7a95 --- /dev/null +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/Sr/SrSectionServiceImpl.java @@ -0,0 +1,58 @@ +package club.joylink.rtss.simulation.cbtc.device.real.udp.Sr; + +import club.joylink.rtss.constants.ProjectDeviceType; +import club.joylink.rtss.simulation.cbtc.Simulation; +import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySectionAxleCounter; +import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig; +import club.joylink.rtss.simulation.cbtc.device.real.udp.UDPClientConfig; +import club.joylink.rtss.simulation.cbtc.device.real.udp.UDPLowConfig; +import club.joylink.rtss.simulation.cbtc.device.real.udp.UDPRealDeviceService; +import io.netty.buffer.ByteBuf; +import org.springframework.stereotype.Service; + +import java.util.Map; +import java.util.stream.Collectors; + +@Service +public class SrSectionServiceImpl implements UDPRealDeviceService { + @Override + public boolean isMatch(RealDeviceConfig realDevice) { + return realDevice instanceof UDPClientConfig; + } + + @Override + public void control(Simulation simulation, UDPLowConfig udpLowConfig, RealDeviceConfig realDevice) { + + } + + @Override + public void init(Simulation simulation, UDPLowConfig udpConfig, RealDeviceConfig realDevice) { + + } + + @Override + public void handle(Simulation simulation, ByteBuf msg) { + byte[] data = new byte[msg.readableBytes()]; + if (data.length < 4) + return; + msg.readBytes(data); + if (Byte.toUnsignedInt(data[1]) != 137) + return; + Map map = simulation.queryAllRealDevice(ProjectDeviceType.SECTION).stream() + .map(config -> (SrSectionConfig) config) + .collect(Collectors.toMap(config -> config.getConfigVO().getSandboxCode(), + config -> (VirtualRealitySectionAxleCounter) config.getMapElement())); + for (int i = 3, dataLength = data.length; i < dataLength; i+=2) { + int code = Byte.toUnsignedInt(data[i - 1]); + VirtualRealitySectionAxleCounter axle = map.get(String.valueOf(code)); + if (axle != null) { + int n = Byte.toUnsignedInt(data[i]); + if (n == 170) { + axle.setOccupy(true); + } else if (n == 85) { + axle.setOccupy(false); + } + } + } + } +} diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/Sr/SrSignalConfig.java b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/Sr/SrSignalConfig.java new file mode 100644 index 000000000..d69e0be3b --- /dev/null +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/Sr/SrSignalConfig.java @@ -0,0 +1,21 @@ +package club.joylink.rtss.simulation.cbtc.device.real.udp.Sr; + +import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig; +import club.joylink.rtss.util.JsonUtils; +import club.joylink.rtss.vo.client.project.ProjectDeviceVO; +import club.joylink.rtss.vo.client.project.sr.SrSignalConfigVO; +import lombok.Getter; + +import java.util.Objects; + +@Getter +public class SrSignalConfig extends RealDeviceConfig { + private SrSignalConfigVO configVO; + + public SrSignalConfig(ProjectDeviceVO projectDevice) { + super(projectDevice); + if (Objects.nonNull(projectDevice.getConfig())) { + this.configVO = JsonUtils.read(projectDevice.getConfig(), SrSignalConfigVO.class); + } + } +} diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/Sr/SrSignalServiceImpl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/Sr/SrSignalServiceImpl.java new file mode 100644 index 000000000..84e863240 --- /dev/null +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/Sr/SrSignalServiceImpl.java @@ -0,0 +1,131 @@ +package club.joylink.rtss.simulation.cbtc.device.real.udp.Sr; + +import club.joylink.rtss.simulation.cbtc.Simulation; +import club.joylink.rtss.simulation.cbtc.constant.SignalAspect; +import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants; +import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySignal; +import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig; +import club.joylink.rtss.simulation.cbtc.device.real.udp.UDPClient; +import club.joylink.rtss.simulation.cbtc.device.real.udp.UDPLowConfig; +import club.joylink.rtss.simulation.cbtc.device.real.udp.UDPRealDeviceService; +import io.netty.buffer.ByteBuf; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Objects; + +@Service +public class SrSignalServiceImpl implements UDPRealDeviceService { + @Autowired + private UDPClient udpClient; + + @Override + public boolean isMatch(RealDeviceConfig realDevice) { + return realDevice instanceof SrSignalConfig; + } + + @Override + public void control(Simulation simulation, UDPLowConfig udpLowConfig, RealDeviceConfig realDevice) { + SrSignalConfig config = (SrSignalConfig) realDevice; + //控制vr设备 + VirtualRealitySignal vrSignal = (VirtualRealitySignal) realDevice.getMapElement(); + SignalAspect aspect = vrSignal.getAspect(); + SignalAspect command = vrSignal.getCommand(); + if (Objects.equals(aspect, command)) { + return; + } + if (vrSignal.getRemain() > 0) { + vrSignal.turning(SimulationConstants.VRD_LOOP_RATE); + } + //控制沙盘设备 + aspect = vrSignal.getAspect(); + if (aspect == null || udpLowConfig == null) { + return; + } + byte[] data = buildData(aspect, config); + if (data == null) + return; + udpClient.write(udpLowConfig.getAddr(), data); + } + + @Override + public void init(Simulation simulation, UDPLowConfig udpConfig, RealDeviceConfig realDevice) { + SrSignalConfig config = (SrSignalConfig) realDevice; + VirtualRealitySignal vrSignal = (VirtualRealitySignal) config.getMapElement(); + byte[] data = buildData(vrSignal.getAspect(), config); + udpClient.write(udpConfig.getAddr(), data); + } + + @Override + public void handle(Simulation simulation, ByteBuf msg) { + + } + + private byte[] buildData(SignalAspect aspect, SrSignalConfig config) { + if (aspect == null) + return null; + byte[] data = new byte[5]; + data[1] = (byte) 203; + data[2] = (byte) Integer.parseInt(config.getConfigVO().getSandboxCode()); + switch (aspect) { + case No: + case R: + case RF: + data[3] = (byte) 0; + break; + case G: + case GF: + data[3] = (byte) 1; + break; + case Y: + case YF: + data[3] = (byte) 2; + break; + case W: + case WF: + data[3] = (byte) 6; + break; + case B: + data[3] = (byte) 7; + break; + case GG: + data[3] = (byte) 5; + break; + case GY: + data[3] = (byte) 4; + break; + case YY: + data[3] = (byte) 3; + break; + case RY: + case RW: + return null; + default: + return null; + } + switch (aspect) { + case No: + case R: + case G: + case Y: + case W: + case B: + case RY: + case RW: + case GG: + case GY: + case YY: + data[4] = (byte) 0; + break; + case RF: + case YF: + case GF: + case WF: + data[4] = (byte) 1; + break; + default: + throw new IllegalStateException("Unexpected value: " + aspect); + } + return data; + } +} diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/Sr/SrSwitchConfig.java b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/Sr/SrSwitchConfig.java new file mode 100644 index 000000000..22eb03325 --- /dev/null +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/Sr/SrSwitchConfig.java @@ -0,0 +1,21 @@ +package club.joylink.rtss.simulation.cbtc.device.real.udp.Sr; + +import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig; +import club.joylink.rtss.util.JsonUtils; +import club.joylink.rtss.vo.client.project.ProjectDeviceVO; +import club.joylink.rtss.vo.client.project.sr.SrSwitchConfigVO; +import lombok.Getter; + +import java.util.Objects; + +@Getter +public class SrSwitchConfig extends RealDeviceConfig { + private SrSwitchConfigVO configVO; + + public SrSwitchConfig(ProjectDeviceVO projectDevice) { + super(projectDevice); + if (Objects.nonNull(projectDevice.getConfig())) { + this.configVO = JsonUtils.read(projectDevice.getConfig(), SrSwitchConfigVO.class); + } + } +} diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/Sr/SrSwitchServiceImpl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/Sr/SrSwitchServiceImpl.java new file mode 100644 index 000000000..118ea40c3 --- /dev/null +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/Sr/SrSwitchServiceImpl.java @@ -0,0 +1,75 @@ +package club.joylink.rtss.simulation.cbtc.device.real.udp.Sr; + +import club.joylink.rtss.simulation.cbtc.Simulation; +import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants; +import club.joylink.rtss.simulation.cbtc.constant.SwitchIndication; +import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch; +import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig; +import club.joylink.rtss.simulation.cbtc.device.real.udp.UDPClient; +import club.joylink.rtss.simulation.cbtc.device.real.udp.UDPLowConfig; +import club.joylink.rtss.simulation.cbtc.device.real.udp.UDPRealDeviceService; +import io.netty.buffer.ByteBuf; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class SrSwitchServiceImpl implements UDPRealDeviceService { + @Autowired + private UDPClient udpClient; + + @Override + public boolean isMatch(RealDeviceConfig realDevice) { + return realDevice instanceof SrSwitchConfig; + } + + @Override + public void control(Simulation simulation, UDPLowConfig udpLowConfig, RealDeviceConfig realDevice) { + SrSwitchConfig config = (SrSwitchConfig) realDevice; + //控制vr设备 + VirtualRealitySwitch vrSwitch = (VirtualRealitySwitch) realDevice.getMapElement(); + if (vrSwitch.getRemain() > 0) { + vrSwitch.turning(SimulationConstants.VRD_LOOP_RATE); + } + //控制沙盘设备 + SwitchIndication p = vrSwitch.getP(); + if (p == null || udpLowConfig == null) { + return; + } + byte[] data = buildData(p, config); + if (data == null) + return; + udpClient.write(udpLowConfig.getAddr(), data); + } + + @Override + public void init(Simulation simulation, UDPLowConfig udpConfig, RealDeviceConfig realDevice) { + + } + + @Override + public void handle(Simulation simulation, ByteBuf msg) { + + } + + private byte[] buildData(SwitchIndication p, SrSwitchConfig config) { + if (p == null) + return null; + byte[] data = new byte[4]; + data[1] = (byte) 208; + data[2] = (byte) Integer.parseInt(config.getConfigVO().getSandboxCode()); + switch (p) { + case N: + data[3] = (byte) 0; + break; + case R: + data[3] = (byte) 1; + break; + case NO: + case EX: + return null; + default: + throw new IllegalStateException("Unexpected value: " + p); + } + return data; + } +} diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/UDPClient.java b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/UDPClient.java index eb1561806..f4cbf59dd 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/UDPClient.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/UDPClient.java @@ -26,6 +26,8 @@ public class UDPClient implements ApplicationRunner { @Autowired private UDPConfig udpConfig; + private Channel channel; + @Override public void run(ApplicationArguments args) throws Exception { this.start(); @@ -43,21 +45,32 @@ public class UDPClient implements ApplicationRunner { }); ChannelFuture future = bootstrap.bind(udpConfig.getClientPort()).sync(); Channel channel = future.channel(); - byte[] bytes = new byte[]{(byte)127, (byte)0, (byte)0, (byte)1}; + this.channel = channel; + if(future.isSuccess()) { + log.info(String.format("udp client start on port [%s]", this.udpConfig.getClientPort())); + } else { + log.error("udp server start failed", future.cause()); + } + } + + public void write(byte[] ip, int port, byte[] msg) { try { - InetAddress inetAddress = InetAddress.getByAddress(bytes); - InetSocketAddress addr = new InetSocketAddress(inetAddress, 9999); - ByteBuf byteBuf = Unpooled.copiedBuffer("主动发送消息".getBytes()); - DatagramPacket data = new DatagramPacket(byteBuf, addr); - channel.writeAndFlush(data); - if(future.isSuccess()) { - log.info(String.format("udp client start on port [%s]", this.udpConfig.getClientPort())); - } else { - log.error("udp server start failed", future.cause()); + if (channel != null && channel.isWritable()) { + InetAddress inetAddress = InetAddress.getByAddress(ip); + InetSocketAddress addr = new InetSocketAddress(inetAddress, port); + write(addr, msg); } } catch (UnknownHostException e) { e.printStackTrace(); } } + public void write(InetSocketAddress addr, byte[] msg) { + if (channel != null && channel.isWritable() && addr != null) { + ByteBuf byteBuf = Unpooled.copiedBuffer(msg); + DatagramPacket data = new DatagramPacket(byteBuf, addr); + channel.writeAndFlush(data); + } + } + } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/UDPClientConfig.java b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/UDPClientConfig.java new file mode 100644 index 000000000..0d1005124 --- /dev/null +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/UDPClientConfig.java @@ -0,0 +1,20 @@ +package club.joylink.rtss.simulation.cbtc.device.real.udp; + +import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig; +import club.joylink.rtss.util.JsonUtils; +import club.joylink.rtss.vo.client.project.ProjectDeviceVO; +import club.joylink.rtss.vo.client.project.UDPClientConfigVO; +import lombok.Getter; +import org.springframework.util.StringUtils; + +@Getter +public class UDPClientConfig extends RealDeviceConfig { + private UDPClientConfigVO configVO; + + public UDPClientConfig(ProjectDeviceVO projectDevice) { + super(projectDevice); + if (StringUtils.hasText(projectDevice.getConfig())) { + this.configVO = JsonUtils.read(projectDevice.getConfig(), UDPClientConfigVO.class); + } + } +} diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/UDPLowConfig.java b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/UDPLowConfig.java new file mode 100644 index 000000000..c4f97b766 --- /dev/null +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/UDPLowConfig.java @@ -0,0 +1,50 @@ +package club.joylink.rtss.simulation.cbtc.device.real.udp; + +import club.joylink.rtss.exception.BusinessExceptionAssertEnum; +import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig; +import club.joylink.rtss.util.JsonUtils; +import club.joylink.rtss.vo.client.project.ProjectDeviceVO; +import club.joylink.rtss.vo.client.project.UDPLowConfigVO; +import lombok.Getter; +import org.springframework.util.StringUtils; + +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.UnknownHostException; + +@Getter +public class UDPLowConfig extends RealDeviceConfig { + private UDPLowConfigVO configVO; + + private byte[] ip; + + private Integer port; + + private InetSocketAddress addr; + + public UDPLowConfig(ProjectDeviceVO projectDevice) { + super(projectDevice); + if (StringUtils.hasText(projectDevice.getConfig())) { + this.configVO = JsonUtils.read(projectDevice.getConfig(), UDPLowConfigVO.class); + String ipStr = configVO.getIp(); + if (StringUtils.hasText(ipStr)) { + String[] split = ipStr.split("\\."); + BusinessExceptionAssertEnum.DATA_ERROR.assertEquals(split.length, 4); + ip = new byte[4]; + for (int i = 0; i < 4; i++) { + ip[i] = (byte) Integer.parseInt(split[i]); + } + } + this.port = configVO.getPort(); + //构建地址 + if (ip != null && port != null) { + try { + InetAddress inetAddress = InetAddress.getByAddress(ip); + addr = new InetSocketAddress(inetAddress, port); + } catch (UnknownHostException e) { + throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception(e); + } + } + } + } +} diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/UDPRealDeviceService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/UDPRealDeviceService.java new file mode 100644 index 000000000..727d4b98a --- /dev/null +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/UDPRealDeviceService.java @@ -0,0 +1,15 @@ +package club.joylink.rtss.simulation.cbtc.device.real.udp; + +import club.joylink.rtss.simulation.cbtc.Simulation; +import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig; +import io.netty.buffer.ByteBuf; + +public interface UDPRealDeviceService { + boolean isMatch(RealDeviceConfig realDevice); + + void control(Simulation simulation, UDPLowConfig udpLowConfig, RealDeviceConfig realDevice); + + void init(Simulation simulation, UDPLowConfig udpConfig, RealDeviceConfig realDevice); + + void handle(Simulation simulation, ByteBuf msg); +} diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/UDPRealDeviceServiceManager.java b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/UDPRealDeviceServiceManager.java new file mode 100644 index 000000000..e002c072b --- /dev/null +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/UDPRealDeviceServiceManager.java @@ -0,0 +1,25 @@ +package club.joylink.rtss.simulation.cbtc.device.real.udp; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +@Component +public class UDPRealDeviceServiceManager implements ApplicationContextAware { + private List serviceList; + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + Map deviceServiceMap = applicationContext.getBeansOfType(UDPRealDeviceService.class); + this.serviceList = new ArrayList<>(deviceServiceMap.values()); + } + + public List getServiceList() { + return this.serviceList; + } +} diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/UDPRealDeviceThread.java b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/UDPRealDeviceThread.java new file mode 100644 index 000000000..fb0fc3d16 --- /dev/null +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/UDPRealDeviceThread.java @@ -0,0 +1,96 @@ +package club.joylink.rtss.simulation.cbtc.device.real.udp; + +import club.joylink.rtss.constants.ProjectDeviceType; +import club.joylink.rtss.simulation.cbtc.GroupSimulationService; +import club.joylink.rtss.simulation.cbtc.Simulation; +import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants; +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.event.SimulationResetEvent; +import io.netty.buffer.ByteBuf; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.event.EventListener; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.util.List; +import java.util.Objects; + +@Slf4j +@Component +public class UDPRealDeviceThread { + @Autowired + private UDPRealDeviceServiceManager udpRealDeviceServiceManager; + + @Autowired + private GroupSimulationService groupSimulationService; + + @EventListener + public void simulationReset(SimulationResetEvent event) { + Simulation simulation = event.getSimulation(); + List realDeviceList = simulation.getRealDeviceList(); + if (CollectionUtils.isEmpty(realDeviceList)) + return; + UDPLowConfig udpConfig = (UDPLowConfig) simulation.queryOneRealDevice(ProjectDeviceType.UDP_LOW); + if (udpConfig == null) + return; + for (RealDeviceConfig realDevice : realDeviceList) { + if (realDevice instanceof PlcGateway) { + continue; + } + for (UDPRealDeviceService realDeviceService : this.udpRealDeviceServiceManager.getServiceList()) { + if (realDeviceService.isMatch(realDevice)) { + realDeviceService.init(simulation, udpConfig, realDevice); + } + } + } + } + + public void run(Simulation simulation) { + List realDeviceList = simulation.getRealDeviceList(); + if (CollectionUtils.isEmpty(realDeviceList)) + return; + List serviceList = udpRealDeviceServiceManager.getServiceList(); + if (CollectionUtils.isEmpty(serviceList)) + return; + UDPLowConfig udpLowConfig = null; + for (RealDeviceConfig realDeviceConfig : realDeviceList) { + if (ProjectDeviceType.UDP_LOW.equals(realDeviceConfig.getDeviceType())) { + udpLowConfig = (UDPLowConfig) realDeviceConfig; + break; + } + } + for (RealDeviceConfig config : realDeviceList) { + for (UDPRealDeviceService service : serviceList) { + if (service.isMatch(config)) { + service.control(simulation, udpLowConfig, config); + } + } + } + } + + public void handleData(String ip, int port, ByteBuf data) { + List simulations = groupSimulationService.querySimulations(); + for (Simulation simulation : simulations) { + List realDeviceList = simulation.getRealDeviceList(); + if (CollectionUtils.isEmpty(realDeviceList)) + continue; + UDPClientConfig udpClientConfig = (UDPClientConfig) simulation.queryOneRealDevice(ProjectDeviceType.UDP_CLIENT); + if (udpClientConfig != null && Objects.equals(ip, udpClientConfig.getConfigVO().getIp()) + && Objects.equals(port, udpClientConfig.getConfigVO().getPort())) { + for (UDPRealDeviceService udpRealDeviceService : this.udpRealDeviceServiceManager.getServiceList()) { + if (udpRealDeviceService.isMatch(udpClientConfig)) { + udpRealDeviceService.handle(simulation, data); + } + } + break; + } + } + } + + public void addJobs(Simulation simulation) { + simulation.addFixedRateJob(Simulation.JobName.udpRealDevice, + () -> this.run(simulation), SimulationConstants.VRD_LOOP_RATE); + } +} diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/handler/UDPMessageHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/handler/UDPMessageHandler.java index 11050bde9..83b71e286 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/handler/UDPMessageHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/device/real/udp/handler/UDPMessageHandler.java @@ -1,21 +1,29 @@ package club.joylink.rtss.simulation.cbtc.device.real.udp.handler; +import club.joylink.rtss.simulation.cbtc.device.real.udp.UDPRealDeviceThread; import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; import io.netty.channel.socket.DatagramPacket; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.nio.charset.StandardCharsets; +import java.net.InetSocketAddress; @Component public class UDPMessageHandler extends SimpleChannelInboundHandler { + @Autowired + private UDPRealDeviceThread udpRealDeviceThread; @Override protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket datagramPacket) { - System.out.println("收到消息:" + datagramPacket.content().toString(StandardCharsets.UTF_8)); - ByteBuf byteBuf = Unpooled.copiedBuffer("hi".getBytes()); - ctx.writeAndFlush(new DatagramPacket(byteBuf, datagramPacket.sender())); + InetSocketAddress sender = datagramPacket.sender(); + String ip = sender.getHostString(); + int port = sender.getPort(); + ByteBuf content = datagramPacket.content(); + udpRealDeviceThread.handleData(ip, port, content); +// System.out.println("收到消息:" + datagramPacket.content().toString(StandardCharsets.UTF_8)); +// ByteBuf byteBuf = Unpooled.copiedBuffer("hi".getBytes()); +// ctx.writeAndFlush(new DatagramPacket(byteBuf, datagramPacket.sender())); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/device/virtual/VRDeviceLogicLoop.java b/src/main/java/club/joylink/rtss/simulation/cbtc/device/virtual/VRDeviceLogicLoop.java index e5b6fbfa3..302ccbf39 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/device/virtual/VRDeviceLogicLoop.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/device/virtual/VRDeviceLogicLoop.java @@ -43,7 +43,6 @@ public class VRDeviceLogicLoop { /** * 更新列车实际占压的计轴区段 - * @param simulation */ public void updateTrainOccupySection(Simulation simulation) { SimulationDataRepository repository = simulation.getRepository(); @@ -63,20 +62,24 @@ public class VRDeviceLogicLoop { /** * 更新区段占用状态 - * @param oldOccupyList - * @param occupySectionList - * @param right */ private void updateAxleCounterOccupied(List
oldOccupyList, List
occupySectionList, boolean right) { // 非占用区段出清 if (!CollectionUtils.isEmpty(oldOccupyList)) { // 筛选出已经出清的区段,更新为非占用状态 oldOccupyList.removeAll(occupySectionList); - oldOccupyList.forEach(section -> - section.getVirtualAxleCounter().clear()); + oldOccupyList.forEach(section -> { + if (!section.getVirtualAxleCounter().isConnectReal()) { + section.getVirtualAxleCounter().clear(); + } + }); } // 所有计轴区段计轴占用——即非通信车占用 - occupySectionList.forEach(section -> section.getVirtualAxleCounter().occupied(right)); + occupySectionList.forEach(section -> { + if (!section.getVirtualAxleCounter().isConnectReal()) { + section.getVirtualAxleCounter().occupied(right); + } + }); } public void addJobs(Simulation simulation) { diff --git a/src/main/java/club/joylink/rtss/vo/client/project/ProjectDeviceVO.java b/src/main/java/club/joylink/rtss/vo/client/project/ProjectDeviceVO.java index e71c40cfe..790d0c942 100644 --- a/src/main/java/club/joylink/rtss/vo/client/project/ProjectDeviceVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/project/ProjectDeviceVO.java @@ -15,6 +15,11 @@ import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.richor.ZjdPslConf import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.sdy.SdyPsdConfig; import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.sdy.SdyPslConfig; import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.xty.XtyPsdConfig; +import club.joylink.rtss.simulation.cbtc.device.real.udp.Sr.SrSectionConfig; +import club.joylink.rtss.simulation.cbtc.device.real.udp.Sr.SrSignalConfig; +import club.joylink.rtss.simulation.cbtc.device.real.udp.Sr.SrSwitchConfig; +import club.joylink.rtss.simulation.cbtc.device.real.udp.UDPClientConfig; +import club.joylink.rtss.simulation.cbtc.device.real.udp.UDPLowConfig; import club.joylink.rtss.util.JsonUtils; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Getter; @@ -110,12 +115,39 @@ public class ProjectDeviceVO { case RICHOR_JOINT: { return zjdDeviceConfigConvert(voList); } + case SR_SANDBOX: { + return srSandboxDeviceConfigConvert(voList); + } } } return list; } + private static List srSandboxDeviceConfigConvert(List voList) { + List list = new ArrayList<>(); + for (ProjectDeviceVO deviceVO : voList) { + switch (deviceVO.getType()) { + case UDP_LOW: + list.add(new UDPLowConfig(deviceVO)); + break; + case UDP_CLIENT: + list.add(new UDPClientConfig(deviceVO)); + break; + case SIGNAL: + list.add(new SrSignalConfig(deviceVO)); + break; + case SECTION: + list.add(new SrSectionConfig(deviceVO)); + break; + case SWITCH: + list.add(new SrSwitchConfig(deviceVO)); + break; + } + } + return list; + } + private static List zjdDeviceConfigConvert(List voList) { List list = new ArrayList<>(); for (ProjectDeviceVO deviceVO : voList) { diff --git a/src/main/java/club/joylink/rtss/vo/client/project/UDPClientConfigVO.java b/src/main/java/club/joylink/rtss/vo/client/project/UDPClientConfigVO.java new file mode 100644 index 000000000..15eedc1f0 --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/client/project/UDPClientConfigVO.java @@ -0,0 +1,19 @@ +package club.joylink.rtss.vo.client.project; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +public class UDPClientConfigVO { + private String ip; + + private Integer port; + + public UDPClientConfigVO(String ip, Integer port) { + this.ip = ip; + this.port = port; + } +} diff --git a/src/main/java/club/joylink/rtss/vo/client/project/UDPLowConfigVO.java b/src/main/java/club/joylink/rtss/vo/client/project/UDPLowConfigVO.java new file mode 100644 index 000000000..812db1317 --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/client/project/UDPLowConfigVO.java @@ -0,0 +1,27 @@ +package club.joylink.rtss.vo.client.project; + +import club.joylink.rtss.util.JsonUtils; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +/** + * UDP下位机配置 + */ +@Getter +@Setter +@NoArgsConstructor +public class UDPLowConfigVO { + private String ip; + + private Integer port; + + public UDPLowConfigVO(String ip, Integer port) { + this.ip = ip; + this.port = port; + } + + public String toJson() { + return JsonUtils.writeValueAsString(this); + } +} diff --git a/src/main/java/club/joylink/rtss/vo/client/project/UdpLowConfigVO.java b/src/main/java/club/joylink/rtss/vo/client/project/UdpLowConfigVO.java deleted file mode 100644 index 5b6dde9db..000000000 --- a/src/main/java/club/joylink/rtss/vo/client/project/UdpLowConfigVO.java +++ /dev/null @@ -1,5 +0,0 @@ -package club.joylink.rtss.vo.client.project; - -public class UdpLowConfigVO { - -} diff --git a/src/main/java/club/joylink/rtss/vo/client/project/gzb/GzbSignalConfigVO.java b/src/main/java/club/joylink/rtss/vo/client/project/gzb/GzbSignalConfigVO.java index e3a855f9b..7da8a5b59 100644 --- a/src/main/java/club/joylink/rtss/vo/client/project/gzb/GzbSignalConfigVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/project/gzb/GzbSignalConfigVO.java @@ -1,8 +1,6 @@ package club.joylink.rtss.vo.client.project.gzb; -import club.joylink.rtss.util.JsonUtils; import club.joylink.rtss.vo.client.project.RealConfigVO; -import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Getter; import lombok.Setter; diff --git a/src/main/java/club/joylink/rtss/vo/client/project/gzb/GzbSwitchConfigVO.java b/src/main/java/club/joylink/rtss/vo/client/project/gzb/GzbSwitchConfigVO.java index 40651ab6a..d5b0f6fae 100644 --- a/src/main/java/club/joylink/rtss/vo/client/project/gzb/GzbSwitchConfigVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/project/gzb/GzbSwitchConfigVO.java @@ -1,8 +1,6 @@ package club.joylink.rtss.vo.client.project.gzb; -import club.joylink.rtss.util.JsonUtils; import club.joylink.rtss.vo.client.project.RealConfigVO; -import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Getter; import lombok.Setter; diff --git a/src/main/java/club/joylink/rtss/vo/client/project/sdy/SdyPsdConfigVO.java b/src/main/java/club/joylink/rtss/vo/client/project/sdy/SdyPsdConfigVO.java index d75b92ae3..399fce89d 100644 --- a/src/main/java/club/joylink/rtss/vo/client/project/sdy/SdyPsdConfigVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/project/sdy/SdyPsdConfigVO.java @@ -1,10 +1,7 @@ package club.joylink.rtss.vo.client.project.sdy; -import club.joylink.rtss.util.JsonUtils; import club.joylink.rtss.vo.client.project.RealConfigVO; -import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Getter; -import lombok.NoArgsConstructor; import lombok.Setter; import javax.validation.constraints.NotBlank; diff --git a/src/main/java/club/joylink/rtss/vo/client/project/sdy/SdyPslConfigVO.java b/src/main/java/club/joylink/rtss/vo/client/project/sdy/SdyPslConfigVO.java index 950465bbb..1114fe59a 100644 --- a/src/main/java/club/joylink/rtss/vo/client/project/sdy/SdyPslConfigVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/project/sdy/SdyPslConfigVO.java @@ -1,10 +1,7 @@ package club.joylink.rtss.vo.client.project.sdy; -import club.joylink.rtss.util.JsonUtils; import club.joylink.rtss.vo.client.project.RealConfigVO; -import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Getter; -import lombok.NoArgsConstructor; import lombok.Setter; @Getter diff --git a/src/main/java/club/joylink/rtss/vo/client/project/sr/SrSectionConfigVO.java b/src/main/java/club/joylink/rtss/vo/client/project/sr/SrSectionConfigVO.java new file mode 100644 index 000000000..e85e69198 --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/client/project/sr/SrSectionConfigVO.java @@ -0,0 +1,19 @@ +package club.joylink.rtss.vo.client.project.sr; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +public class SrSectionConfigVO { + private String vrCode; + + private String sandboxCode; + + public SrSectionConfigVO(String vrCode, String sandboxCode) { + this.vrCode = vrCode; + this.sandboxCode = sandboxCode; + } +} diff --git a/src/main/java/club/joylink/rtss/vo/client/project/sr/SrSignalConfigVO.java b/src/main/java/club/joylink/rtss/vo/client/project/sr/SrSignalConfigVO.java new file mode 100644 index 000000000..75b51a4df --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/client/project/sr/SrSignalConfigVO.java @@ -0,0 +1,19 @@ +package club.joylink.rtss.vo.client.project.sr; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +public class SrSignalConfigVO { + private String vrCode; + + private String sandboxCode; + + public SrSignalConfigVO(String vrCode, String sandboxCode) { + this.vrCode = vrCode; + this.sandboxCode = sandboxCode; + } +} diff --git a/src/main/java/club/joylink/rtss/vo/client/project/sr/SrSwitchConfigVO.java b/src/main/java/club/joylink/rtss/vo/client/project/sr/SrSwitchConfigVO.java new file mode 100644 index 000000000..dfddcb6ed --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/client/project/sr/SrSwitchConfigVO.java @@ -0,0 +1,19 @@ +package club.joylink.rtss.vo.client.project.sr; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +public class SrSwitchConfigVO { + private String vrCode; + + private String sandboxCode; + + public SrSwitchConfigVO(String vrCode, String sandboxCode) { + this.vrCode = vrCode; + this.sandboxCode = sandboxCode; + } +} diff --git a/src/main/java/club/joylink/rtss/vo/client/project/xty/XtyPsdConfigVO.java b/src/main/java/club/joylink/rtss/vo/client/project/xty/XtyPsdConfigVO.java index d5b4a576c..44e95dd7b 100644 --- a/src/main/java/club/joylink/rtss/vo/client/project/xty/XtyPsdConfigVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/project/xty/XtyPsdConfigVO.java @@ -1,10 +1,7 @@ package club.joylink.rtss.vo.client.project.xty; -import club.joylink.rtss.util.JsonUtils; import club.joylink.rtss.vo.client.project.RealConfigVO; -import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Getter; -import lombok.NoArgsConstructor; import lombok.Setter; import javax.validation.constraints.NotBlank;