From 436fa36ac8547c2b8bc21d8365b6ea1f2b4adc93 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Wed, 29 Jun 2022 13:03:41 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=B1=BB=E5=9E=8B=E4=BB=A5=E5=8F=8A=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E3=80=91=20=E3=80=90=E5=A2=9E=E5=8A=A0=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=89=80=E6=9C=89=E8=B0=83=E5=BA=A6=E5=8F=B0=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E8=AE=A1=E5=88=92=E6=8E=A5=E5=8F=A3=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simulation/SimulationCtcController.java | 71 +++++++ .../handler/CtcZoneOperateHandler.java | 55 +++--- .../ATS/operation/vo/CtcRunPlanParam.java | 20 ++ .../ATS/service/runplan/CtcManageService.java | 13 ++ .../runplan/CtcStationRunPlanLogService.java | 13 ++ .../ATS/service/runplan/CtcZoneService.java | 64 +++++-- .../simulation/cbtc/CTC/CTCLogicLoop.java | 173 +----------------- .../cbtc/CTC/data/CtcEffectRepository.java | 18 +- .../cbtc/CTC/data/CtcManageRepository.java | 10 + .../cbtc/CTC/data/CtcRepository.java | 21 +-- .../cbtc/CTC/data/CtcZoneRepository.java | 10 + .../CTC/data/vo/CtcManageRepositoryVO.java | 120 ------------ .../cbtc/CTC/data/vo/CtcRunPlanVO.java | 3 +- .../cbtc/CTC/data/vo/CtcZoneRepositoryVO.java | 73 -------- .../simulation/cbtc/data/map/Section.java | 10 +- .../message/SimulationSubscribeTopic.java | 2 - .../message/SimulationUserWsListener.java | 13 -- .../rtss/vo/client/WebSocketMessageType.java | 55 +----- .../client/factory/SocketMessageFactory.java | 20 -- 19 files changed, 243 insertions(+), 521 deletions(-) create mode 100644 src/main/java/club/joylink/rtss/controller/simulation/SimulationCtcController.java delete mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcManageRepositoryVO.java delete mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcZoneRepositoryVO.java diff --git a/src/main/java/club/joylink/rtss/controller/simulation/SimulationCtcController.java b/src/main/java/club/joylink/rtss/controller/simulation/SimulationCtcController.java new file mode 100644 index 000000000..b6b744ac9 --- /dev/null +++ b/src/main/java/club/joylink/rtss/controller/simulation/SimulationCtcController.java @@ -0,0 +1,71 @@ +package club.joylink.rtss.controller.simulation; + +import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.CtcRunPlanParam; +import club.joylink.rtss.simulation.cbtc.ATS.service.runplan.CtcManageService; +import club.joylink.rtss.simulation.cbtc.ATS.service.runplan.CtcStationRunPlanLogService; +import club.joylink.rtss.simulation.cbtc.ATS.service.runplan.CtcZoneService; +import club.joylink.rtss.simulation.cbtc.CTC.data.vo.CtcStationRunPlanLogVO; +import club.joylink.rtss.simulation.cbtc.GroupSimulationCache; +import club.joylink.rtss.simulation.cbtc.Simulation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * CTC 接口操作 + */ +@RestController +@RequestMapping("/api/simulation/{group}/ctc") +public class SimulationCtcController { + @Autowired + private GroupSimulationCache groupSimulationCache; + + @Autowired + private CtcZoneService ctcZoneService; + + @Autowired + private CtcStationRunPlanLogService ctcStationRunPlanLogService; + + @Autowired + private CtcManageService ctcManageService; + + /** + * 获取调度台运行计划列表 + * + * @param group 仿真编码 + * @return 运行计划列表 + */ + @GetMapping("/railway/runPlan/list") + public List pullRailwayRunPlan(@PathVariable String group) { + Simulation simulation = this.groupSimulationCache.getSimulationByGroup(group); + return ctcZoneService.pullRailwayRunPlan(simulation); + } + + /** + * 获取车站的运行计划列表 + * + * @param group 仿真编码 + * @return 运行计划列表 + */ + @GetMapping("/station/runPlan/list") + public List pullStationRunPlan(@PathVariable String group) { + Simulation simulation = this.groupSimulationCache.getSimulationByGroup(group); + return ctcStationRunPlanLogService.pullStationRunPlan(simulation); + } + + /** + * 获取车务管理终端所有运行计划列表 + * + * @param group 仿真编码 + * @return 运行计划列表 + */ + @GetMapping("/manage/runPlan/list") + public List pullCtcManageRunPlan(@PathVariable String group) { + Simulation simulation = this.groupSimulationCache.getSimulationByGroup(group); + return ctcManageService.pullCtcManageRunPlan(simulation); + } +} diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/CtcZoneOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/CtcZoneOperateHandler.java index 2c201384b..91a87a3a6 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/CtcZoneOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/CtcZoneOperateHandler.java @@ -29,8 +29,8 @@ public class CtcZoneOperateHandler { * @param planParam 行车计划 */ @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_RUN_PLAN) - public void saveRunPlan(Simulation simulation, CtcRunPlanParam planParam) { - ctcZoneService.saveRunPlan(simulation, planParam); + public CtcRunPlanParam saveRunPlan(Simulation simulation, CtcRunPlanParam planParam) { + return ctcZoneService.saveRunPlan(simulation, planParam); } /** @@ -43,8 +43,8 @@ public class CtcZoneOperateHandler { * @param model 接发 */ @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_TRACK_SECTION) - public void saveTrackSection(Simulation simulation, String stationCode, String runPlanCode, String sectionCode, StationDirection.ReceiveAndDeliverModel model) { - ctcZoneService.saveTrackSection(simulation, stationCode, runPlanCode, sectionCode, model); + public CtcRunPlanParam saveTrackSection(Simulation simulation, String stationCode, String runPlanCode, String sectionCode, StationDirection.ReceiveAndDeliverModel model) { + return ctcZoneService.saveTrackSection(simulation, stationCode, runPlanCode, sectionCode, model); } /** @@ -57,8 +57,8 @@ public class CtcZoneOperateHandler { * @param model 接发 */ @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_TRIP_NUMBER) - public void saveTripNumber(Simulation simulation, String stationCode, String runPlanCode, String tripNumber, StationDirection.ReceiveAndDeliverModel model) { - ctcZoneService.saveTripNumber(simulation, stationCode, runPlanCode, tripNumber, model); + public CtcRunPlanParam saveTripNumber(Simulation simulation, String stationCode, String runPlanCode, String tripNumber, StationDirection.ReceiveAndDeliverModel model) { + return ctcZoneService.saveTripNumber(simulation, stationCode, runPlanCode, tripNumber, model); } /** @@ -71,8 +71,8 @@ public class CtcZoneOperateHandler { * @param model 接发 */ @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_PLAN_TIME) - public void savePlanTime(Simulation simulation, String stationCode, String runPlanCode, String planTime, StationDirection.ReceiveAndDeliverModel model) { - ctcZoneService.savePlanTime(simulation, stationCode, runPlanCode, LocalDateTime.parse(planTime), model); + public CtcRunPlanParam savePlanTime(Simulation simulation, String stationCode, String runPlanCode, String planTime, StationDirection.ReceiveAndDeliverModel model) { + return ctcZoneService.savePlanTime(simulation, stationCode, runPlanCode, LocalDateTime.parse(planTime), model); } /** @@ -85,8 +85,8 @@ public class CtcZoneOperateHandler { * @param model 接发 */ @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_PLAN_TIME_MINUTE) - public void savePlanTime(Simulation simulation, String stationCode, String runPlanCode, int minutes, StationDirection.ReceiveAndDeliverModel model) { - ctcZoneService.savePlanTime(simulation, stationCode, runPlanCode, minutes, model); + public CtcRunPlanParam savePlanTime(Simulation simulation, String stationCode, String runPlanCode, int minutes, StationDirection.ReceiveAndDeliverModel model) { + return ctcZoneService.savePlanTime(simulation, stationCode, runPlanCode, minutes, model); } /** @@ -99,8 +99,8 @@ public class CtcZoneOperateHandler { * @param model 接发 */ @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_DIRECTION) - public void saveDirection(Simulation simulation, String stationCode, String runPlanCode, String directionCode, StationDirection.ReceiveAndDeliverModel model) { - ctcZoneService.saveDirection(simulation, stationCode, runPlanCode, directionCode, model); + public CtcRunPlanParam saveDirection(Simulation simulation, String stationCode, String runPlanCode, String directionCode, StationDirection.ReceiveAndDeliverModel model) { + return ctcZoneService.saveDirection(simulation, stationCode, runPlanCode, directionCode, model); } /** @@ -113,8 +113,8 @@ public class CtcZoneOperateHandler { * @param model 接发 */ @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_STATION) - public void saveStation(Simulation simulation, String stationCode, String runPlanCode, String planStationCode, StationDirection.ReceiveAndDeliverModel model) { - ctcZoneService.saveStation(simulation, stationCode, runPlanCode, planStationCode, model); + public CtcRunPlanParam saveStation(Simulation simulation, String stationCode, String runPlanCode, String planStationCode, StationDirection.ReceiveAndDeliverModel model) { + return ctcZoneService.saveStation(simulation, stationCode, runPlanCode, planStationCode, model); } /** @@ -124,8 +124,8 @@ public class CtcZoneOperateHandler { * @param runPlanCode 行车计划编码 */ @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_DELETE_RUN_PLAN) - public void deleteRunPlan(Simulation simulation, String stationCode, String runPlanCode) { - ctcZoneService.delRunPlan(simulation, stationCode, runPlanCode); + public String deleteRunPlan(Simulation simulation, String stationCode, String runPlanCode) { + return ctcZoneService.delRunPlan(simulation, stationCode, runPlanCode); } /** @@ -135,8 +135,8 @@ public class CtcZoneOperateHandler { * @param zoneCode 区间编码 */ @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_RELEASE_ZONE_RUN_PLAN) - public void releaseRunPlan(Simulation simulation, String zoneCode) { - ctcZoneService.releaseRunPlan(simulation, zoneCode); + public String releaseRunPlan(Simulation simulation, String zoneCode) { + return ctcZoneService.releaseRunPlan(simulation, zoneCode); } /** @@ -146,8 +146,19 @@ public class CtcZoneOperateHandler { * @param stationCode 车站编码 */ @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_RELEASE_STATION_RUN_PLAN) - public void releaseStationRunPlan(Simulation simulation, String stationCode) { - ctcZoneService.releaseStationRunPlan(simulation, stationCode); + public String releaseStationRunPlan(Simulation simulation, String stationCode) { + return ctcZoneService.releaseStationRunPlan(simulation, stationCode); + } + + /** + * 发布车站的行车计划 + * + * @param simulation 仿真 + * @param stationCode 车站编码 + */ + @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_RELEASE_ALL_RUN_PLAN) + public String releaseAllRunPlan(Simulation simulation) { + return ctcZoneService.releaseAllRunPlan(simulation); } /** @@ -157,7 +168,7 @@ public class CtcZoneOperateHandler { * @param stationCode 车站编码 */ @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_CONFIRM_APPLY_RUN_PLAY) - public void confirmApplyRunPlan(Simulation simulation, String stationCode) { - ctcZoneService.confirmApplyRunPlan(simulation, stationCode); + public String confirmApplyRunPlan(Simulation simulation, String stationCode) { + return ctcZoneService.confirmApplyRunPlan(simulation, stationCode); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/vo/CtcRunPlanParam.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/vo/CtcRunPlanParam.java index 310e16b80..de60fd004 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/vo/CtcRunPlanParam.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/vo/CtcRunPlanParam.java @@ -507,6 +507,26 @@ public class CtcRunPlanParam implements Cloneable { return change ? this : null; } + public void setArrivePlanTime(String arrivePlanTime) { + if (!StringUtils.isEmpty(arrivePlanTime)) { + this.arrivePlanTime = LocalDateTime.parse(arrivePlanTime.replace(" ", "T")); + } + } + + public void setArrivePlanTime(LocalDateTime arrivePlanTime) { + this.arrivePlanTime = arrivePlanTime; + } + + public void setDepartPlanTime(String departPlanTime) { + if (!StringUtils.isEmpty(departPlanTime)) { + this.departPlanTime = LocalDateTime.parse(departPlanTime.replace(" ", "T")); + } + } + + public void setDepartPlanTime(LocalDateTime departPlanTime) { + this.departPlanTime = departPlanTime; + } + @Override public String toString() { return "CtcRunPlanParam{" + diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcManageService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcManageService.java index c0b750164..f29ac684f 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcManageService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcManageService.java @@ -11,6 +11,7 @@ import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import java.util.ArrayList; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -142,6 +143,18 @@ public class CtcManageService { } } + /** + * 拉取所有的运行计划 + * + * @param simulation 仿真实体 + * @return 运行计划 + */ + public List pullCtcManageRunPlan(Simulation simulation) { + List allList = new LinkedList<>(); + simulation.getCtcRepository().getManageRepositoryMap().forEach((k, v) -> allList.addAll(v.getEditAllRunPlan())); + return allList; + } + /** * 获取关联车站的车务管理端数据实体 * diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcStationRunPlanLogService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcStationRunPlanLogService.java index 914f843e7..2b7bea97d 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcStationRunPlanLogService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcStationRunPlanLogService.java @@ -7,6 +7,7 @@ import club.joylink.rtss.simulation.cbtc.CTC.data.CtcEffectRepository; import club.joylink.rtss.simulation.cbtc.CTC.data.CtcStationRunPlanLog; import club.joylink.rtss.simulation.cbtc.CTC.data.RouteSequence; import club.joylink.rtss.simulation.cbtc.CTC.data.vo.CtcRunPlanVO; +import club.joylink.rtss.simulation.cbtc.CTC.data.vo.CtcStationRunPlanLogVO; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.data.map.Section; import club.joylink.rtss.simulation.cbtc.data.map.Station; @@ -24,6 +25,7 @@ import java.time.LocalTime; import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; @Component @Slf4j @@ -280,6 +282,17 @@ public class CtcStationRunPlanLogService { } } + /** + * 拉取车站最新运行计划 + * + * @param simulation 仿真 + * @return 运行计划列表 + */ + public List pullStationRunPlan(Simulation simulation) { + List allRunPlanList = simulation.getCtcRepository().getAllRunPlanList(); + return allRunPlanList.stream().map(r -> new CtcStationRunPlanLogVO(r)).collect(Collectors.toList()); + } + /** * 修改原始数据,并返回修改属性的对象 * diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcZoneService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcZoneService.java index 7c65ba9d9..02809c770 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcZoneService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcZoneService.java @@ -12,10 +12,7 @@ import org.springframework.stereotype.Component; import org.springframework.util.StringUtils; import java.time.LocalDateTime; -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; +import java.util.*; @Component @Slf4j @@ -30,13 +27,14 @@ public class CtcZoneService { * @param simulation 仿真 * @param planParam 行车计划 */ - public void saveRunPlan(Simulation simulation, CtcRunPlanParam planParam) { + public CtcRunPlanParam saveRunPlan(Simulation simulation, CtcRunPlanParam planParam) { CtcZoneRepository railwayRepository = simulation.getCtcRepository().getCtcZoneRepository(); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(railwayRepository); if (StringUtils.isEmpty(planParam.getRunPlanCode())) { // 初始化运行计划编码、车次信息 planParam.generateRunPlanCodeAndTripNumber(); } railwayRepository.saveRunPlan(planParam); + return planParam; } /** @@ -48,7 +46,7 @@ public class CtcZoneService { * @param sectionCode 股道 * @param model 接发 */ - public void saveTrackSection(Simulation simulation, String stationCode, String runPlanCode, String sectionCode, StationDirection.ReceiveAndDeliverModel model) { + public CtcRunPlanParam saveTrackSection(Simulation simulation, String stationCode, String runPlanCode, String sectionCode, StationDirection.ReceiveAndDeliverModel model) { BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(sectionCode); CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode); if (StationDirection.ReceiveAndDeliverModel.R.equals(model)) { @@ -56,6 +54,7 @@ public class CtcZoneService { } else { runPlanParam.setDepartSectionCode(sectionCode); } + return runPlanParam; } /** @@ -67,7 +66,7 @@ public class CtcZoneService { * @param tripNumber 车次 * @param model 接发 */ - public void saveTripNumber(Simulation simulation, String stationCode, String runPlanCode, String tripNumber, StationDirection.ReceiveAndDeliverModel model) { + public CtcRunPlanParam saveTripNumber(Simulation simulation, String stationCode, String runPlanCode, String tripNumber, StationDirection.ReceiveAndDeliverModel model) { BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(tripNumber); CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode); if (StationDirection.ReceiveAndDeliverModel.R.equals(model)) { @@ -75,6 +74,7 @@ public class CtcZoneService { } else { runPlanParam.setDepartTripNumber(tripNumber); } + return runPlanParam; } /** @@ -86,7 +86,7 @@ public class CtcZoneService { * @param planTime 计划时间 * @param model 接发 */ - public void savePlanTime(Simulation simulation, String stationCode, String runPlanCode, LocalDateTime planTime, StationDirection.ReceiveAndDeliverModel model) { + public CtcRunPlanParam savePlanTime(Simulation simulation, String stationCode, String runPlanCode, LocalDateTime planTime, StationDirection.ReceiveAndDeliverModel model) { BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(planTime); CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode); if (StationDirection.ReceiveAndDeliverModel.R.equals(model)) { @@ -94,15 +94,17 @@ public class CtcZoneService { } else { runPlanParam.setDepartPlanTime(planTime); } + return runPlanParam; } - public void savePlanTime(Simulation simulation, String stationCode, String runPlanCode, int minutes, StationDirection.ReceiveAndDeliverModel model) { + public CtcRunPlanParam savePlanTime(Simulation simulation, String stationCode, String runPlanCode, int minutes, StationDirection.ReceiveAndDeliverModel model) { CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode); if (StationDirection.ReceiveAndDeliverModel.R.equals(model)) { runPlanParam.setArrivePlanTime(runPlanParam.getArrivePlanTime().plusMinutes(minutes)); } else { runPlanParam.setDepartPlanTime(runPlanParam.getDepartPlanTime().plusMinutes(minutes)); } + return runPlanParam; } /** @@ -114,7 +116,7 @@ public class CtcZoneService { * @param runPlanCode 运行计划编码 * @param directionCode 方向编码 */ - public void saveDirection(Simulation simulation, String stationCode, String runPlanCode, String directionCode, StationDirection.ReceiveAndDeliverModel model) { + public CtcRunPlanParam saveDirection(Simulation simulation, String stationCode, String runPlanCode, String directionCode, StationDirection.ReceiveAndDeliverModel model) { BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(directionCode); CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode); if (StationDirection.ReceiveAndDeliverModel.R.equals(model)) { @@ -122,6 +124,7 @@ public class CtcZoneService { } else { runPlanParam.setDepartDirectionCode(directionCode); } + return runPlanParam; } /** @@ -133,7 +136,7 @@ public class CtcZoneService { * @param planStationCode 计划方向车站编码 * @param model 接发 */ - public void saveStation(Simulation simulation, String stationCode, String runPlanCode, String planStationCode, StationDirection.ReceiveAndDeliverModel model) { + public CtcRunPlanParam saveStation(Simulation simulation, String stationCode, String runPlanCode, String planStationCode, StationDirection.ReceiveAndDeliverModel model) { BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(planStationCode); CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode); if (StationDirection.ReceiveAndDeliverModel.R.equals(model)) { @@ -141,6 +144,7 @@ public class CtcZoneService { } else { runPlanParam.setDepartStationCode(planStationCode); } + return runPlanParam; } /** @@ -149,10 +153,11 @@ public class CtcZoneService { * @param simulation 仿真 * @param runPlanCode 行车计划编码 */ - public void delRunPlan(Simulation simulation, String stationCode, String runPlanCode) { + public String delRunPlan(Simulation simulation, String stationCode, String runPlanCode) { CtcZoneRepository railwayRepository = simulation.getCtcRepository().getCtcZoneRepository(); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(railwayRepository); railwayRepository.delRunPlan(stationCode, runPlanCode); + return "success"; } /** @@ -161,7 +166,7 @@ public class CtcZoneService { * @param simulation 仿真 * @param zoneCode 区间编码 */ - public void releaseRunPlan(Simulation simulation, String zoneCode) { + public String releaseRunPlan(Simulation simulation, String zoneCode) { CtcZoneRepository zoneRepository = simulation.getCtcRepository().getCtcZoneRepository(); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(zoneRepository); CtcZone ctcZone = zoneRepository.getCtcZoneList().stream().filter(c -> zoneCode.equals(c.getCode())) @@ -180,6 +185,7 @@ public class CtcZoneService { }); updateStageRunPlan(simulation, stationCodeSet); } + return "success"; } /** @@ -188,7 +194,7 @@ public class CtcZoneService { * @param simulation 仿真 * @param stationCode 车站编码 */ - public void releaseStationRunPlan(Simulation simulation, String stationCode) { + public String releaseStationRunPlan(Simulation simulation, String stationCode) { CtcZoneRepository zoneRepository = simulation.getCtcRepository().getCtcZoneRepository(); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(zoneRepository); CtcManageRepository.StationRunPlanRepository runPlanRepository = zoneRepository.getStationRunPlanMap().get(stationCode); @@ -196,6 +202,23 @@ public class CtcZoneService { CtcEffectRepository effectRepository = simulation.getCtcRepository().getCtcEffectRepository(); effectRepository.releaseRunPlanByStationCode(runPlanRepository, simulation.getCorrectSystemTime()); updateStageRunPlan(simulation, stationCode); + return "success"; + } + + /** + * 发布全量计划 + * + * @param simulation 仿真 + */ + public String releaseAllRunPlan(Simulation simulation) { + Map stationRunPlanMap + = simulation.getCtcRepository().getCtcZoneRepository().getStationRunPlanMap(); + CtcEffectRepository effectRepository = simulation.getCtcRepository().getCtcEffectRepository(); + stationRunPlanMap.forEach((k, v) -> { + effectRepository.releaseRunPlanByStationCode(v, simulation.getCorrectSystemTime()); + updateStageRunPlan(simulation, k); + }); + return "success"; } /** @@ -204,7 +227,7 @@ public class CtcZoneService { * @param simulation 仿真 * @param stationCode 车站编码 */ - public void confirmApplyRunPlan(Simulation simulation, String stationCode) { + public String confirmApplyRunPlan(Simulation simulation, String stationCode) { // 获取生效区信息 CtcEffectRepository ctcEffectRepository = simulation.getCtcRepository().getCtcEffectRepository(); // 发布至生效区 @@ -213,6 +236,17 @@ public class CtcZoneService { runPlanLogService.doUpdateRunPlanLog(simulation, stationCode, ctcEffectRepository.getCtcRunPlan(stationCode)); // 清空生效区 ctcEffectRepository.clearStationApplyRunPlan(stationCode); + return "success"; + } + + /** + * 获取全量运行计划 + * + * @param simulation 仿真 + * @return 运行计划列表 + */ + public List pullRailwayRunPlan(Simulation simulation) { + return simulation.getCtcRepository().getCtcZoneRepository().getAllRunPlanList(); } /** diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCLogicLoop.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCLogicLoop.java index 100464ab7..874123d14 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCLogicLoop.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCLogicLoop.java @@ -1,8 +1,12 @@ package club.joylink.rtss.simulation.cbtc.CTC; -import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.CtcRunPlanParam; -import club.joylink.rtss.simulation.cbtc.CTC.data.*; -import club.joylink.rtss.simulation.cbtc.CTC.data.vo.*; +import club.joylink.rtss.simulation.cbtc.CTC.data.CtcRepository; +import club.joylink.rtss.simulation.cbtc.CTC.data.CtcStationRunPlanLog; +import club.joylink.rtss.simulation.cbtc.CTC.data.RouteSequence; +import club.joylink.rtss.simulation.cbtc.CTC.data.TrackView; +import club.joylink.rtss.simulation.cbtc.CTC.data.vo.CtcStationRunPlanLogVO; +import club.joylink.rtss.simulation.cbtc.CTC.data.vo.RouteSequenceVO; +import club.joylink.rtss.simulation.cbtc.CTC.data.vo.TrackViewVO; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; import club.joylink.rtss.simulation.cbtc.data.map.*; @@ -46,12 +50,6 @@ public class CTCLogicLoop { // 发送运行计划变化消息 sendRunPlanChangeMessage(simulation); sendRunPlanRemoveMessage(simulation); - // 发送车务管理端消息(编辑区) - sendManageChange(simulation); - sendManageRemove(simulation); - // 发送铁路局 - sendZoneRunPlanChange(simulation); - sendZoneRunPlanRemove(simulation); // 下发计划 sendZoneRunPlanSend(simulation); } @@ -237,77 +235,6 @@ public class CTCLogicLoop { simulation.addFixedRateJob(MESSAGE_NAME, () -> this.sendMessage(simulation), MESSAGE_RATE); } - /** - * 发送铁路局、行车区段信息列表 - * - * @param simulation 仿真 - * @param userIds 用户 - */ - public void sendAllZoneInfo(Simulation simulation, Set userIds) { - List ctcZoneVOList = simulation.getCtcRepository().getCtcZoneRepository().getCtcZoneList().stream() - .map(r -> new CtcZoneVO(r)).collect(Collectors.toList()); - sendCtcMessage(simulation.getId(), ctcZoneVOList, WebSocketMessageType.SIMULATION_CTC_ZONE, simulation.getSimulationUserIds()); - } - - /** - * 行车区段运行计划变化 - * - * @param simulation 仿真 - * @param userIds 用户 - */ - public void sendAllZoneRunPlan(Simulation simulation, Set userIds) { - CtcZoneRepositoryVO ctcZoneRepositoryVO = simulation.getCtcRepository().getCtcZoneRepositoryVO(); - synchronized (ctcZoneRepositoryVO) { - List allList = new ArrayList<>(); - if (ctcZoneRepositoryVO.getRunPlanParamMap().isEmpty()) { - simulation.getCtcRepository().getCtcZoneRepository().getStationRunPlanMap().forEach((k, v) -> { - allList.addAll(ctcZoneRepositoryVO.compareAndReturnChangeRunPlan(v)); - }); - } else { - allList.addAll(ctcZoneRepositoryVO.getRunPlanParamMap().values()); - } - if (!CollectionUtils.isEmpty(allList)) { - sendCtcMessage(simulation.getId(), allList, WebSocketMessageType.SIMULATION_RAILWAY_RUN_PLAN_INIT - , userIds); - } - } - } - - /** - * 行车区段运行计划变化 - * - * @param simulation 仿真 - */ - public void sendZoneRunPlanChange(Simulation simulation) { - CtcZoneRepositoryVO ctcZoneRepositoryVO = simulation.getCtcRepository().getCtcZoneRepositoryVO(); - List allList = new ArrayList<>(); - // 运行计划 - simulation.getCtcRepository().getCtcZoneRepository().getStationRunPlanMap() - .forEach((k, v) -> allList.addAll(ctcZoneRepositoryVO.compareAndReturnChangeRunPlan(v))); - if (!CollectionUtils.isEmpty(allList)) { - sendCtcMessage(simulation.getId(), allList, WebSocketMessageType.SIMULATION_RAILWAY_RUN_PLAN_CHANGE - , simulation.getSimulationUserIds()); - } - } - - /** - * 行车区段(调度台)运行计划删除 - * - * @param simulation 仿真 - */ - public void sendZoneRunPlanRemove(Simulation simulation) { - CtcZoneRepositoryVO ctcZoneRepositoryVO = simulation.getCtcRepository().getCtcZoneRepositoryVO(); - List allList = new ArrayList<>(); - // 运行计划 - simulation.getCtcRepository().getCtcZoneRepository().getStationRunPlanMap() - .forEach((k, v) -> allList.addAll(ctcZoneRepositoryVO.compareAndReturnRemoveRunPlan(v))); - if (!CollectionUtils.isEmpty(allList)) { - sendCtcMessage(simulation.getId(), allList, WebSocketMessageType.SIMULATION_RAILWAY_RUN_PLAN_REMOVE - , simulation.getSimulationUserIds()); - } - } - - /** * 行车区段运行计划下发 * @@ -320,64 +247,6 @@ public class CTCLogicLoop { } } - /** - * 初始时发送 - * - * @param simulation 仿真 - * @param userIds 用户 - */ - public void sendAllManageChange(Simulation simulation, Set userIds) { - CtcManageRepositoryVO ctcManageRepositoryVO = simulation.getCtcRepository().getCtcManageRepositoryVO(); - synchronized (ctcManageRepositoryVO) { - List allList = new ArrayList<>(); - if (ctcManageRepositoryVO.getEditAreaCtcRunPlanParamVOMap().isEmpty()) { - simulation.getCtcRepository().getManageRepositoryMap().forEach((k, v) -> { - allList.addAll(ctcManageRepositoryVO.compareAndReturnChangeRunPlan(v.getEditAreaMap().getRunPlanRepository(), true)); - }); - } else { - allList.addAll(ctcManageRepositoryVO.getEditAreaCtcRunPlanParamVOMap().values()); - } - if (!CollectionUtils.isEmpty(allList)) { - sendCtcMessage(simulation.getId(), allList, WebSocketMessageType.SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_INIT - , userIds); - } - } - } - - /** - * 发送管理端【编辑区】变更数据 - * - * @param simulation 仿真数据 - */ - public void sendManageChange(Simulation simulation) { - CtcManageRepositoryVO ctcManageRepositoryVO = simulation.getCtcRepository().getCtcManageRepositoryVO(); - List allList = new ArrayList<>(); - simulation.getCtcRepository().getManageRepositoryMap().forEach((k, v) -> { - allList.addAll(ctcManageRepositoryVO.compareAndReturnChangeRunPlan(v.getEditAreaMap().getRunPlanRepository(), true)); - }); - if (!CollectionUtils.isEmpty(allList)) { - sendCtcMessage(simulation.getId(), allList, WebSocketMessageType.SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_CHANGE - , simulation.getSimulationUserIds()); - } - } - - /** - * 发送管理端【编辑区数据】删除数据 - * - * @param simulation 仿真数据 - */ - public void sendManageRemove(Simulation simulation) { - CtcManageRepositoryVO ctcManageRepositoryVO = simulation.getCtcRepository().getCtcManageRepositoryVO(); - List allList = new ArrayList<>(); - simulation.getCtcRepository().getManageRepositoryMap().forEach((k, v) -> { - allList.addAll(ctcManageRepositoryVO.compareAndReturnRemoveRunPlan(v.getEditAreaMap().getRunPlanRepository(), true)); - }); - if (!CollectionUtils.isEmpty(allList)) { - sendCtcMessage(simulation.getId(), allList - , WebSocketMessageType.SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_REMOVE, simulation.getSimulationUserIds()); - } - } - /** * 发送CTC初始行车日志变化 * @@ -454,34 +323,6 @@ public class CTCLogicLoop { } } - /** - * 发送调度台消息 - * - * @param simulationId 仿真ID - * @param messageInfo 消息 - * @param userIds 用户ID - * @param 消息类型 - */ - public void sendCtcDispatcherMessage(String simulationId, T messageInfo, Set userIds) { - if (messageInfo != null) { - sendCtcMessage(simulationId, messageInfo, WebSocketMessageType.SIMULATION_CTC_DISPATCHER_MESSAGE, userIds); - } - } - - /** - * CTC邻站消息 - * - * @param simulationId 仿真ID - * @param messageInfo 消息 - * @param userIds 用户ID - * @param 消息类型 - */ - public void sendCtcAdjacentStationMessage(String simulationId, T messageInfo, Set userIds) { - if (messageInfo != null) { - sendCtcMessage(simulationId, messageInfo, WebSocketMessageType.SIMULATION_CTC_ADJACENT_STATION_MESSAGE, userIds); - } - } - /** * 发送CTC运行计划消息 * diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcEffectRepository.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcEffectRepository.java index 71ed9d822..cb53b76d0 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcEffectRepository.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcEffectRepository.java @@ -136,6 +136,10 @@ public class CtcEffectRepository { return null; } return this.stationStageRunPlanMap.values().stream() + .filter(r -> { + Integer oldVersion = this.getStageRunPlanVersionMap().get(r.getStationCode()); + return oldVersion == null || oldVersion < r.getVersion().get(); + }) .map(r -> { Map dataMap = new HashMap<>(); dataMap.put("stationCode", r.stationCode); @@ -241,19 +245,7 @@ public class CtcEffectRepository { public void setVersion(int version) { this.version.set(version); } - - /** - * 发布计划表 - * - * @param ctcRunPlanVOList 计划列表 - * @param updateTime 更新时间 - */ - public void updateRunPlanList(List ctcRunPlanVOList, LocalDateTime updateTime) { - this.ctcRunPlanVOList = ctcRunPlanVOList; - this.version.incrementAndGet(); - this.updateTime = updateTime; - } - + /** * 插入计划信息 * diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcManageRepository.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcManageRepository.java index 5596efead..060be251f 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcManageRepository.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcManageRepository.java @@ -7,9 +7,11 @@ import lombok.Setter; import org.springframework.util.StringUtils; import java.time.LocalDateTime; +import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; /** * 车务管理端数据(调度台、区段) @@ -110,6 +112,10 @@ public class CtcManageRepository { .filter(r -> r.getTripNumber().equals(tripNumber)).count(); } + public List getEditAllRunPlan() { + return this.editAreaMap.getRunPlanRepository().getAllRunPlanParam(); + } + /** * 管理端工作区 */ @@ -240,5 +246,9 @@ public class CtcManageRepository { public StationRunPlanRepository() { this.version = new AtomicInteger(0); } + + public List getAllRunPlanParam() { + return this.runPlanParamMap.values().stream().collect(Collectors.toList()); + } } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcRepository.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcRepository.java index 9ce238d59..ed08eac2a 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcRepository.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcRepository.java @@ -2,7 +2,10 @@ package club.joylink.rtss.simulation.cbtc.CTC.data; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.CtcRunPlanParam; -import club.joylink.rtss.simulation.cbtc.CTC.data.vo.*; +import club.joylink.rtss.simulation.cbtc.CTC.data.vo.CtcRunPlanVO; +import club.joylink.rtss.simulation.cbtc.CTC.data.vo.CtcStationRunPlanLogVO; +import club.joylink.rtss.simulation.cbtc.CTC.data.vo.RouteSequenceVO; +import club.joylink.rtss.simulation.cbtc.CTC.data.vo.TrackViewVO; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder; import club.joylink.rtss.simulation.cbtc.data.map.Station; @@ -35,16 +38,8 @@ public class CtcRepository { /******************************************* 以下为调度台数据:车站为单位 *********************************************/ - /** - * 数据 - */ private final CtcZoneRepository ctcZoneRepository = new CtcZoneRepository(); - /** - * 状态 - */ - private final CtcZoneRepositoryVO ctcZoneRepositoryVO = new CtcZoneRepositoryVO(); - /******************************************* 以上为调度台数据:车站为单位 *********************************************/ /******************************************* 以下为总数据:车站为单位 ************************************************/ @@ -59,12 +54,6 @@ public class CtcRepository { * 车站为key */ private final Map manageRepositoryMap = new ConcurrentHashMap<>(); - - /** - * 管理终端数据状态 - */ - private final CtcManageRepositoryVO ctcManageRepositoryVO = new CtcManageRepositoryVO(); - /******************************************* 以上为车务管理终端数据:车站为单位 ****************************************/ /******************************************* 以下为车站终端数据:车站为单位 *******************************************/ @@ -125,10 +114,8 @@ public class CtcRepository { public void reset(Simulation simulation) { // 仿真运行数据直接清空 this.ctcZoneRepository.reset(); - this.ctcZoneRepositoryVO.reset(); this.ctcEffectRepository.reset(); this.manageRepositoryMap.clear(); - this.ctcManageRepositoryVO.reset(); this.allRunPlanList.clear(); this.simulationRunPlanMap.clear(); this.runPlanStatusVOMap.clear(); // 运行计划状态清除 diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcZoneRepository.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcZoneRepository.java index 041a2fb92..e84973990 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcZoneRepository.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcZoneRepository.java @@ -65,6 +65,16 @@ public class CtcZoneRepository { return runPlanParam; } + /** + * 获取所有运行计划 + */ + public List getAllRunPlanList() { + List allList = new LinkedList<>(); + this.stationRunPlanMap.forEach((k, v) -> allList.addAll(v.getAllRunPlanParam())); + return allList; + } + + /** * 重置 */ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcManageRepositoryVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcManageRepositoryVO.java deleted file mode 100644 index 6478428e8..000000000 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcManageRepositoryVO.java +++ /dev/null @@ -1,120 +0,0 @@ -package club.joylink.rtss.simulation.cbtc.CTC.data.vo; - -import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.CtcRunPlanParam; -import club.joylink.rtss.simulation.cbtc.CTC.data.CtcManageRepository; -import lombok.Getter; -import lombok.Setter; -import org.springframework.util.CollectionUtils; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * 车务管理端数据状态 - */ -@Getter -@Setter -public class CtcManageRepositoryVO { - /** - * 编辑区股道版本状态 - */ - private final Map editAreaTrackSectionVersionMap = new HashMap<>(); - - /** - * 编辑区股道状态 - */ - private final Map editAreaTrackSectionVOMap = new HashMap<>(); - - /** - * 编辑区运行计划版本状态 - */ - private final Map editAreaCtcRunPlanVersionMap = new HashMap<>(); - - /** - * 编辑区行车计划状态 - */ - private final Map editAreaCtcRunPlanParamVOMap = new HashMap<>(); - - - /** - * 生效区股道版本状态 - */ - private final Map effectAreaTrackSectionVersionMap = new HashMap<>(); - - /** - * 生效区股道状态 - */ - private final Map effectAreaTrackSectionVOMap = new HashMap<>(); - - /** - * 生效区运行计划版本状态 - */ - private final Map effectAreaCtcRunPlanVersionMap = new HashMap<>(); - - /** - * 生效区行车计划状态 - */ - private final Map effectAreaCtcRunPlanParamVOMap = new HashMap<>(); - - - /** - * 比较并返回变化过的运行计划 - * - * @param runPlanRepository 运行计划 - * @param isEdit 编辑区 - * @return 变化过的 - */ - public List compareAndReturnChangeRunPlan(CtcManageRepository.StationRunPlanRepository runPlanRepository, boolean isEdit) { - List allList = new ArrayList<>(runPlanRepository.getRunPlanParamMap().size()); - Map runPlanMap = isEdit ? this.editAreaCtcRunPlanParamVOMap : this.effectAreaCtcRunPlanParamVOMap; - runPlanRepository.getRunPlanParamMap().forEach((k, p) -> { - String mapKey = p.getStationCode() + "_" + p.getRunPlanCode(); - CtcRunPlanParam param = runPlanMap.get(mapKey); - CtcRunPlanParam changeCtcRunPlanVo = null; - if (param == null) { - changeCtcRunPlanVo = p.clone(); - runPlanMap.put(mapKey, changeCtcRunPlanVo); - allList.add(changeCtcRunPlanVo); - } else { - changeCtcRunPlanVo = param.compareAndChange(p); - if (changeCtcRunPlanVo != null) { - allList.add(changeCtcRunPlanVo); - } - } - }); - return allList; - } - - /** - * 比较并返回删除的运行计划 - * - * @param runPlanRepository 运行计划 - * @param isEdit 编辑区 - * @return 删除的 - */ - public List compareAndReturnRemoveRunPlan(CtcManageRepository.StationRunPlanRepository runPlanRepository, boolean isEdit) { - Map runPlanMap = isEdit ? this.editAreaCtcRunPlanParamVOMap : this.effectAreaCtcRunPlanParamVOMap; - List messageInfo = runPlanMap.values().stream() - .filter(vo -> vo.getStationCode().equals(runPlanRepository.getStationCode()) && !runPlanRepository.isExit(vo.getRunPlanCode())) - .map(vo -> vo.buildRemoveParam()).collect(Collectors.toList()); - // 移除数据 - if (!CollectionUtils.isEmpty(messageInfo)) { - messageInfo.forEach(vo -> runPlanMap.remove(vo.getStationCode() + "_" + vo.getRunPlanCode())); - } - return messageInfo; - } - - public void reset() { - this.editAreaTrackSectionVersionMap.clear(); - this.editAreaTrackSectionVOMap.clear(); - this.editAreaCtcRunPlanVersionMap.clear(); - this.editAreaCtcRunPlanParamVOMap.clear(); - this.effectAreaTrackSectionVersionMap.clear(); - this.effectAreaTrackSectionVOMap.clear(); - this.effectAreaCtcRunPlanVersionMap.clear(); - this.effectAreaCtcRunPlanParamVOMap.clear(); - } -} diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcRunPlanVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcRunPlanVO.java index 4aa8004c5..aa8f5ce09 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcRunPlanVO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcRunPlanVO.java @@ -54,7 +54,8 @@ public class CtcRunPlanVO { * @param runPlanLog 行车日志 */ public static CtcRunPlanVO compareAndChange(CtcRunPlanParam runPlanParam, CtcStationRunPlanLog runPlanLog) { - return compareAndChange(runPlanParam, runPlanLog.getPlanParam()); + CtcRunPlanParam planParam = runPlanLog == null ? null : runPlanLog.getPlanParam(); + return compareAndChange(runPlanParam, planParam); } /** diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcZoneRepositoryVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcZoneRepositoryVO.java deleted file mode 100644 index d48416abe..000000000 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcZoneRepositoryVO.java +++ /dev/null @@ -1,73 +0,0 @@ -package club.joylink.rtss.simulation.cbtc.CTC.data.vo; - -import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.CtcRunPlanParam; -import club.joylink.rtss.simulation.cbtc.CTC.data.CtcManageRepository; -import lombok.Getter; -import lombok.Setter; -import org.springframework.util.CollectionUtils; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.stream.Collectors; - -/** - * CTC行车区间关联数据状态 - */ -@Setter -@Getter -public class CtcZoneRepositoryVO { - /** - * 运行计划状态 - */ - private final Map runPlanParamMap = new ConcurrentHashMap<>(); - - - /** - * 比较并返回变化过的运行计划 - * - * @param runPlanRepository 运行计划 - * @return 变化过的 - */ - public List compareAndReturnChangeRunPlan(CtcManageRepository.StationRunPlanRepository runPlanRepository) { - List allList = new ArrayList<>(runPlanRepository.getRunPlanParamMap().size()); - runPlanRepository.getRunPlanParamMap().forEach((k, p) -> { - String mapKey = p.getStationCode() + "_" + p.getRunPlanCode(); - CtcRunPlanParam param = this.runPlanParamMap.get(mapKey); - CtcRunPlanParam changeCtcRunPlanVo = null; - if (param == null) { - changeCtcRunPlanVo = p.clone(); - this.runPlanParamMap.put(mapKey, changeCtcRunPlanVo); - allList.add(changeCtcRunPlanVo); - } else { - changeCtcRunPlanVo = param.compareAndChange(p); - if (changeCtcRunPlanVo != null) { - allList.add(changeCtcRunPlanVo); - } - } - }); - return allList; - } - - /** - * 比较并返回删除的运行计划 - * - * @param runPlanRepository 运行计划 - * @return 删除的 - */ - public List compareAndReturnRemoveRunPlan(CtcManageRepository.StationRunPlanRepository runPlanRepository) { - List messageInfo = this.runPlanParamMap.values().stream() - .filter(vo -> vo.getStationCode().equals(runPlanRepository.getStationCode()) && !runPlanRepository.isExit(vo.getRunPlanCode())) - .map(vo -> vo.buildRemoveParam()).collect(Collectors.toList()); - // 移除数据 - if (!CollectionUtils.isEmpty(messageInfo)) { - messageInfo.forEach(vo -> this.runPlanParamMap.remove(vo.getStationCode() + "_" + vo.getRunPlanCode())); - } - return messageInfo; - } - - public void reset() { - this.runPlanParamMap.clear(); - } -} diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Section.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Section.java index 4110643ed..a54d21e59 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Section.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Section.java @@ -164,11 +164,6 @@ public class Section extends DelayUnlockDevice { */ private Set zcs = new HashSet<>(); - /** - * 分路不良类型 - */ - private List shuntingTypeList; - // ------------------状态属性--------------------- /** @@ -261,6 +256,11 @@ public class Section extends DelayUnlockDevice { */ private boolean badShunt; + /** + * 分路不良类型 + */ + private List shuntingTypeList; + @Override public void reset() { super.reset(); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/message/SimulationSubscribeTopic.java b/src/main/java/club/joylink/rtss/simulation/cbtc/message/SimulationSubscribeTopic.java index 2d51a0e04..f577055d2 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/message/SimulationSubscribeTopic.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/message/SimulationSubscribeTopic.java @@ -16,8 +16,6 @@ public enum SimulationSubscribeTopic { PassengerFlow("/queue/simulation/passenger/{id}"), WeChatMini("/topic/simulation/assistant/{id}"), Ctc("/queue/simulation/{id}/ctc"), //大铁CTC - Ctc_Manager("/queue/simulation/{id}/ctcManage"), // 大铁CTC管理端 - Ctc_RAILWAY("/queue/simulation/{id}/railway") // 大铁调度台 ; private String destPattern; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/message/SimulationUserWsListener.java b/src/main/java/club/joylink/rtss/simulation/cbtc/message/SimulationUserWsListener.java index c002a2487..556e5e030 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/message/SimulationUserWsListener.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/message/SimulationUserWsListener.java @@ -112,22 +112,9 @@ public class SimulationUserWsListener { Set userIds = Stream.of(userId).collect(Collectors.toSet()); // CTC运行日志发消息 ctcLogicLoop.sendAllRunPlanChangeMessage(simulation, userIds); - ctcLogicLoop.sendAllZoneInfo(simulation, userIds); ctcLogicLoop.sendAllMessage(simulation); break; } - case Ctc_Manager: { // CTC运行管理端 - Set userIds = Stream.of(userId).collect(Collectors.toSet()); - // CTC运行日志发消息 - ctcLogicLoop.sendAllZoneInfo(simulation, userIds); - ctcLogicLoop.sendAllManageChange(simulation, userIds); - break; - } - case Ctc_RAILWAY: { // CTC铁路局 - Set userIds = Stream.of(userId).collect(Collectors.toSet()); - ctcLogicLoop.sendAllZoneInfo(simulation, userIds); - ctcLogicLoop.sendAllZoneRunPlan(simulation, userIds); - } } } diff --git a/src/main/java/club/joylink/rtss/vo/client/WebSocketMessageType.java b/src/main/java/club/joylink/rtss/vo/client/WebSocketMessageType.java index 57b2ea409..ca8e45227 100644 --- a/src/main/java/club/joylink/rtss/vo/client/WebSocketMessageType.java +++ b/src/main/java/club/joylink/rtss/vo/client/WebSocketMessageType.java @@ -354,26 +354,6 @@ public enum WebSocketMessageType { */ Simulation_RailCtcStatus, - /** - * CTC 铁路局、行车区段消息 - */ - SIMULATION_CTC_ZONE, - - /** - * 铁路局运行计划初始化 - */ - SIMULATION_RAILWAY_RUN_PLAN_INIT, - - /** - * 铁路局运行计划变化 - */ - SIMULATION_RAILWAY_RUN_PLAN_CHANGE, - - /** - * 铁路局运行计划移除 - */ - SIMULATION_RAILWAY_RUN_PLAN_REMOVE, - /** * 铁路局运行计划下发 */ @@ -394,41 +374,8 @@ public enum WebSocketMessageType { SIMULATION_CTC_RUN_PLAN_REMOVE, /** - * CTC调度台消息类型 + * 调度命令 */ - SIMULATION_CTC_DISPATCHER_MESSAGE, - - /** - * CTC邻站消息 - */ - SIMULATION_CTC_ADJACENT_STATION_MESSAGE, - - /** - * 仿真CTC管理端 - */ - SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_INIT, - - /** - * 仿真CTC管理端移除操作 - */ - SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_REMOVE, - - /** - * 仿真编辑区运行计划变化 - */ - SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_CHANGE, - - /** - * 仿真生效区运行计划变化 - */ - SIMULATION_CTC_MANAGER_RUN_PLAN_EFFECT_CHANGE, - - /** - * 仿真CTC管理端生效区移除操作 - */ - SIMULATION_CTC_MANAGER_RUN_PLAN_EFFECT_REMOVE, - - /** 调度命令 */ SIMULATION_RAIL_CTC_DISPATCH_COMMAND, /** ------------ CTC消息信息 ----------- */ ; diff --git a/src/main/java/club/joylink/rtss/vo/client/factory/SocketMessageFactory.java b/src/main/java/club/joylink/rtss/vo/client/factory/SocketMessageFactory.java index c08cd4cab..1aa6d26e7 100644 --- a/src/main/java/club/joylink/rtss/vo/client/factory/SocketMessageFactory.java +++ b/src/main/java/club/joylink/rtss/vo/client/factory/SocketMessageFactory.java @@ -107,18 +107,6 @@ public class SocketMessageFactory { topicList.add(String.format(WebSocketSubscribeTopic.Simulation, group)); break; } - case SIMULATION_RAILWAY_RUN_PLAN_INIT: // 铁路局运行计划初始化 - case SIMULATION_RAILWAY_RUN_PLAN_CHANGE: // 铁路局运行计划变化 - case SIMULATION_RAILWAY_RUN_PLAN_REMOVE: {// 铁路局运行计划移除 - topicList.add(SimulationSubscribeTopic.Ctc_RAILWAY.buildDestination(group)); - break; - } - case SIMULATION_CTC_ZONE: { - topicList.add(SimulationSubscribeTopic.Ctc.buildDestination(group)); - topicList.add(SimulationSubscribeTopic.Ctc_Manager.buildDestination(group)); - topicList.add(SimulationSubscribeTopic.Ctc_RAILWAY.buildDestination(group)); - break; - } case SIMULATION_RAILWAY_RUN_PLAN_SEND: // 铁路局运行计划下发 case SIMULATION_CTC_RUN_PLAN_INIT: case SIMULATION_CTC_RUN_PLAN_CHANGE: @@ -128,14 +116,6 @@ public class SocketMessageFactory { topicList.add(SimulationSubscribeTopic.Ctc.buildDestination(group)); break; } - case SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_INIT: - case SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_CHANGE: - case SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_REMOVE: - case SIMULATION_CTC_MANAGER_RUN_PLAN_EFFECT_CHANGE: - case SIMULATION_CTC_MANAGER_RUN_PLAN_EFFECT_REMOVE: { - topicList.add(SimulationSubscribeTopic.Ctc_Manager.buildDestination(group)); - break; - } case Simulation_Member_Change: case Simulation_Start_Conversation: case Simulation_Accept_Conversation: