From e3f3d8c0976a3e71b9dd11d9e19c58ad3f4d0cda Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Fri, 24 Jun 2022 18:17:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BF=9B=E8=B7=AF=E5=BA=8F?= =?UTF-8?q?=E5=88=97id=E7=94=9F=E6=88=90=E6=96=B9=E5=BC=8F=EF=BC=9B?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=B0=83=E5=BA=A6=E5=91=BD=E4=BB=A4=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=EF=BC=88=E6=9C=AA=E5=AE=8C=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cbtc/ATS/operation/Operation.java | 3 + .../simulation/cbtc/CTC/CTCLogicLoop.java | 1 + .../rtss/simulation/cbtc/CTC/CTCService.java | 33 +++++++ .../cbtc/CTC/data/CtcRepository.java | 29 +++++- .../cbtc/CTC/data/RailDispatchCommand.java | 95 +++++++++++++++++++ .../cbtc/CTC/data/RouteSequence.java | 10 +- .../simulation/cbtc/CTC/data/TrackView.java | 2 +- .../data/{ => vo}/CtcManageRepositoryVO.java | 3 +- .../data/{ => vo}/CtcStationRunPlanLogVO.java | 3 +- .../cbtc/CTC/data/{ => vo}/CtcZoneVO.java | 3 +- .../CTC/data/vo/RailDispatchCommandVO.java | 88 +++++++++++++++++ .../CTC/data/{ => vo}/RouteSequenceVO.java | 4 +- .../CTC/data/{ => vo}/TrackSectionVO.java | 4 +- .../cbtc/CTC/data/{ => vo}/TrackViewVO.java | 3 +- .../CTC/operation/RailCtcOperateHandler.java | 11 ++- .../cbtc/build/SimulationBuilder.java | 6 +- .../rtss/vo/client/WebSocketMessageType.java | 3 + .../client/factory/SocketMessageFactory.java | 2 +- .../rtss/websocket/WebSocketMessage.java | 18 ++++ 19 files changed, 296 insertions(+), 25 deletions(-) create mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/RailDispatchCommand.java rename src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/{ => vo}/CtcManageRepositoryVO.java (96%) rename src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/{ => vo}/CtcStationRunPlanLogVO.java (99%) rename src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/{ => vo}/CtcZoneVO.java (93%) create mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/RailDispatchCommandVO.java rename src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/{ => vo}/RouteSequenceVO.java (98%) rename src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/{ => vo}/TrackSectionVO.java (93%) rename src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/{ => vo}/TrackViewVO.java (98%) create mode 100644 src/main/java/club/joylink/rtss/websocket/WebSocketMessage.java diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java index 71460bb00..28726d7a7 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java @@ -1003,6 +1003,9 @@ public class Operation { * 事故按钮 */ ASSIST_PRESS_ACCIDENT, + + //---------------------------- 调度命令 ------------------------- + CTC_SEND_DISPATCH_COMMAND } /** 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 4d76c9000..71a47c20c 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 @@ -2,6 +2,7 @@ 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.Simulation; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; import club.joylink.rtss.simulation.cbtc.data.map.*; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCService.java index cebd939ec..6ee0abef4 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCService.java @@ -4,15 +4,24 @@ import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.simulation.cbtc.CI.CiApiService; 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.RailDispatchCommand; import club.joylink.rtss.simulation.cbtc.CTC.data.RouteSequence; +import club.joylink.rtss.simulation.cbtc.CTC.data.vo.RailDispatchCommandVO; import club.joylink.rtss.simulation.cbtc.Simulation; +import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; import club.joylink.rtss.simulation.cbtc.data.map.Route; import club.joylink.rtss.simulation.cbtc.data.map.Station; +import club.joylink.rtss.simulation.cbtc.member.SimulationMember; +import io.netty.util.internal.StringUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; import java.time.LocalTime; import java.time.format.DateTimeFormatter; +import java.util.Set; +import java.util.stream.Collectors; @Component public class CTCService { @@ -132,4 +141,28 @@ public class CTCService { CtcRepository ctcRepository = simulation.getCtcRepository(); return ctcRepository.getRunPlanByRunPlanCode(stationCode, runPlanCode); } + + /** + * 发送调度命令 + */ + public void sendDispatchCommand(Simulation simulation, RailDispatchCommandVO vo) { + CtcRepository ctcRepository = simulation.getCtcRepository(); + int id = ctcRepository.getDispatchCommandIdGenerator().getAndIncrement(); + vo.setId(String.valueOf(id)); + RailDispatchCommand command = new RailDispatchCommand(vo); + if (StringUtils.hasText(vo.getSenderId())) { + SimulationMember sender = simulation.getSimulationMemberById(vo.getSenderId()); + command.setSender(sender); + } + if (StringUtils.hasText(vo.getReviewerId())) { + SimulationMember reviewer = simulation.getSimulationMemberById(vo.getReviewerId()); + command.setReviewer(reviewer); + } + if (!CollectionUtils.isEmpty(vo.getReceiverIds())) { + Set receivers = vo.getReceiverIds().stream() + .map(simulation::getSimulationMemberById).collect(Collectors.toSet()); + command.setReceivers(receivers); + } + ctcRepository.addDispatchCommand(command); + } } 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 9e2146b64..f00652353 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 @@ -1,13 +1,15 @@ package club.joylink.rtss.simulation.cbtc.CTC.data; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; +import club.joylink.rtss.simulation.cbtc.CTC.data.vo.CtcManageRepositoryVO; +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 lombok.Getter; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; /** @@ -45,6 +47,11 @@ public class CtcRepository { */ private final CtcManageRepositoryVO ctcManageRepositoryVO = new CtcManageRepositoryVO(); + /** + * 进路序列id生成器 + */ + private AtomicInteger routeSequenceIdGenerator = new AtomicInteger(0); + /** * 车站-进路序列。每个车站都应该有 * k - stationCode @@ -91,7 +98,15 @@ public class CtcRepository { /******************************************* 以上为车站终端数据:车站为单位 *******************************************/ + /** + * 调度命令id生成器 + */ + private AtomicInteger dispatchCommandIdGenerator = new AtomicInteger(0); + + private final Set dispatchCommandSet = new HashSet<>(); + public void reset() { + routeSequenceIdGenerator = new AtomicInteger(0); routeSequenceMap.clear(); routeSequenceVOMap.clear(); trackViewMap.clear(); @@ -106,6 +121,8 @@ public class CtcRepository { })); // 运行计划状态清除 this.runPlanStatusVOMap.clear(); + dispatchCommandIdGenerator = new AtomicInteger(0); + dispatchCommandSet.clear(); } /** @@ -196,4 +213,8 @@ public class CtcRepository { BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(routeSequence); return routeSequence.getLine(tripNumber, routeCode); } + + public void addDispatchCommand(RailDispatchCommand command) { + dispatchCommandSet.add(command); + } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/RailDispatchCommand.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/RailDispatchCommand.java new file mode 100644 index 000000000..d52232d77 --- /dev/null +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/RailDispatchCommand.java @@ -0,0 +1,95 @@ +package club.joylink.rtss.simulation.cbtc.CTC.data; + +import club.joylink.rtss.simulation.cbtc.CTC.data.vo.RailDispatchCommandVO; +import club.joylink.rtss.simulation.cbtc.member.SimulationMember; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.time.LocalDateTime; +import java.util.Set; + +/** + * 大铁调度命令 + */ +@Getter +@Setter +@NoArgsConstructor +public class RailDispatchCommand { + private String id; + + /** + * 命令标题 + */ + private String title; + + /** + * 命令号 + */ + private String number; + + /** + * 发令时间 + */ + private LocalDateTime sendTime; + + /** + * 发令人 + */ + private SimulationMember sender; + + /** + * 发令单位 + */ + private String companyOfSender; + + /** + * 授权时间 + */ + private LocalDateTime authorizationTime; + + /** + * 授权状态 + */ + private String authorizationStatus; + + /** + * 定稿时间 + */ + private LocalDateTime finalizationTime; + + /** + * 审核人 + */ + private SimulationMember reviewer; + + /** + * 拟令人 + */ + private String author; + + private Type type; + + /** + * 受令人 + */ + private Set receivers; + + public RailDispatchCommand(RailDispatchCommandVO vo) { + this.id = vo.getId(); + this.title = vo.getTitle(); + this.number = vo.getNumber(); + this.sendTime = vo.getSendTime(); + this.companyOfSender = vo.getCompanyOfSender(); + this.authorizationTime = vo.getAuthorizationTime(); + this.authorizationStatus = vo.getAuthorizationStatus(); + this.finalizationTime = vo.getFinalizationTime(); + this.author = vo.getAuthor(); + this.type = vo.getType(); + } + + public enum Type { + /** 正常调度命令 */ + NORMAL + } +} diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/RouteSequence.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/RouteSequence.java index cc1432a47..722ca3adb 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/RouteSequence.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/RouteSequence.java @@ -22,8 +22,6 @@ import java.util.stream.Collectors; @Getter @Setter public class RouteSequence { - public static AtomicInteger idGenerator = new AtomicInteger(0); - private boolean readOnly; private Station station; @@ -43,10 +41,6 @@ public class RouteSequence { */ private final List lines; - public static void reset() { - idGenerator = new AtomicInteger(0); - } - public RouteSequence(Station station, List lines) { this.station = station; lines.sort((o1, o2) -> { @@ -68,7 +62,7 @@ public class RouteSequence { } } - public static Line buildLine(CtcStationRunPlanLog.RunPlanItem item, boolean departure) { + public static Line buildLine(CtcStationRunPlanLog.RunPlanItem item, boolean departure, AtomicInteger idGenerator) { Section trackSection = item.getTrackSection(); boolean right = item.isRight(); Signal startSignal = null; @@ -206,7 +200,7 @@ public class RouteSequence { @Setter private boolean triggered; - public Line(String id, CtcStationRunPlanLog.RunPlanItem item, boolean departure, LocalTime startTime, LocalTime planTime, Route route) { + Line(String id, CtcStationRunPlanLog.RunPlanItem item, boolean departure, LocalTime startTime, LocalTime planTime, Route route) { this.id = id; this.item = item; this.departure = departure; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/TrackView.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/TrackView.java index fd1a67d03..8d755cbda 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/TrackView.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/TrackView.java @@ -299,7 +299,7 @@ public class TrackView { } } - enum Process { + public enum Process { RECEIVING_BLOCK, //办理接车闭塞 RECEIVING, //准备接车 RECEIVING_ROUTE, //办理接车进路 diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcManageRepositoryVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcManageRepositoryVO.java similarity index 96% rename from src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcManageRepositoryVO.java rename to src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcManageRepositoryVO.java index b25653da3..cdd78980c 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcManageRepositoryVO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcManageRepositoryVO.java @@ -1,6 +1,7 @@ -package club.joylink.rtss.simulation.cbtc.CTC.data; +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; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcStationRunPlanLogVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcStationRunPlanLogVO.java similarity index 99% rename from src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcStationRunPlanLogVO.java rename to src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcStationRunPlanLogVO.java index ee74c9e56..7da966e2b 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcStationRunPlanLogVO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcStationRunPlanLogVO.java @@ -1,5 +1,6 @@ -package club.joylink.rtss.simulation.cbtc.CTC.data; +package club.joylink.rtss.simulation.cbtc.CTC.data.vo; +import club.joylink.rtss.simulation.cbtc.CTC.data.CtcStationRunPlanLog; import lombok.Getter; import lombok.Setter; import org.springframework.util.CollectionUtils; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcZoneVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcZoneVO.java similarity index 93% rename from src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcZoneVO.java rename to src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcZoneVO.java index 7da6b8183..e50e5e34c 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcZoneVO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcZoneVO.java @@ -1,5 +1,6 @@ -package club.joylink.rtss.simulation.cbtc.CTC.data; +package club.joylink.rtss.simulation.cbtc.CTC.data.vo; +import club.joylink.rtss.simulation.cbtc.CTC.data.CtcZone; import club.joylink.rtss.simulation.cbtc.data.map.Station; import lombok.Getter; import lombok.Setter; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/RailDispatchCommandVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/RailDispatchCommandVO.java new file mode 100644 index 000000000..0b6f4c7e7 --- /dev/null +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/RailDispatchCommandVO.java @@ -0,0 +1,88 @@ +package club.joylink.rtss.simulation.cbtc.CTC.data.vo; + +import club.joylink.rtss.simulation.cbtc.CTC.data.RailDispatchCommand; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; +import java.util.Set; + +/** + * 大铁调度命令 + */ +@Getter +@Setter +@NoArgsConstructor +public class RailDispatchCommandVO { + private String id; + + /** + * 命令标题 + */ + private String title; + + /** + * 命令号 + */ + private String number; + + /** + * 发令时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime sendTime; + + /** + * 发令人(仿真成员)id + */ + private String senderId; + + /** + * 发令单位 + */ + private String companyOfSender; + + /** + * 授权时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime authorizationTime; + + /** + * 授权状态 + */ + private String authorizationStatus; + + /** + * 定稿时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime finalizationTime; + + /** + * 审核人 + */ + private String reviewerId; + + /** + * 拟令人 + */ + private String author; + + /** + * 受令人(仿真成员)id + */ + private Set receiverIds; + + private RailDispatchCommand.Type type; + + /** + * webSocket消息类型 + */ + enum WsMessageType { + ADD, + UPDATE, + } +} diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/RouteSequenceVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/RouteSequenceVO.java similarity index 98% rename from src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/RouteSequenceVO.java rename to src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/RouteSequenceVO.java index 994cffc01..83fbcee82 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/RouteSequenceVO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/RouteSequenceVO.java @@ -1,9 +1,9 @@ -package club.joylink.rtss.simulation.cbtc.CTC.data; +package club.joylink.rtss.simulation.cbtc.CTC.data.vo; +import club.joylink.rtss.simulation.cbtc.CTC.data.RouteSequence; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Getter; import lombok.Setter; -import org.springframework.util.CollectionUtils; import java.time.LocalTime; import java.util.*; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/TrackSectionVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/TrackSectionVO.java similarity index 93% rename from src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/TrackSectionVO.java rename to src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/TrackSectionVO.java index d2e1b32e8..fe778bf9c 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/TrackSectionVO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/TrackSectionVO.java @@ -1,4 +1,6 @@ -package club.joylink.rtss.simulation.cbtc.CTC.data; +package club.joylink.rtss.simulation.cbtc.CTC.data.vo; + +import club.joylink.rtss.simulation.cbtc.CTC.data.TrackSection; /** * 股道与区段关联信息 diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/TrackViewVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/TrackViewVO.java similarity index 98% rename from src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/TrackViewVO.java rename to src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/TrackViewVO.java index e3da8dc7b..fb2f90319 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/TrackViewVO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/TrackViewVO.java @@ -1,5 +1,6 @@ -package club.joylink.rtss.simulation.cbtc.CTC.data; +package club.joylink.rtss.simulation.cbtc.CTC.data.vo; +import club.joylink.rtss.simulation.cbtc.CTC.data.TrackView; import lombok.Getter; import lombok.Setter; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/operation/RailCtcOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/operation/RailCtcOperateHandler.java index 7ce7de475..c22a8078c 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/operation/RailCtcOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/operation/RailCtcOperateHandler.java @@ -4,6 +4,7 @@ import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation; import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandler; import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandlerMapping; import club.joylink.rtss.simulation.cbtc.CTC.CTCService; +import club.joylink.rtss.simulation.cbtc.CTC.data.vo.RailDispatchCommandVO; import club.joylink.rtss.simulation.cbtc.Simulation; import org.springframework.beans.factory.annotation.Autowired; @@ -91,12 +92,18 @@ public class RailCtcOperateHandler { /** * CTC办理进路 + * * @param tripNumber 办理列车进路时可以输入车次号 - * @param force 是否强制办理 - * @param duration 办理调车进路时可以输入时间 + * @param force 是否强制办理 + * @param duration 办理调车进路时可以输入时间 */ @OperateHandlerMapping(type = Operation.Type.CTC_SET_ROUTE) public void setRoute(Simulation simulation, String routeCode, String tripNumber, Boolean force, Integer duration) { ctcService.setRoute(simulation, routeCode, tripNumber, force, duration); } + + @OperateHandlerMapping(type = Operation.Type.CTC_SEND_DISPATCH_COMMAND) + public void sendDispatchCommand(Simulation simulation, RailDispatchCommandVO command) { + ctcService.sendDispatchCommand(simulation, command); + } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/build/SimulationBuilder.java b/src/main/java/club/joylink/rtss/simulation/cbtc/build/SimulationBuilder.java index 37828228e..8ed2fbab8 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/build/SimulationBuilder.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/build/SimulationBuilder.java @@ -32,6 +32,7 @@ import org.springframework.util.CollectionUtils; import java.time.Duration; import java.time.LocalDateTime; import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Function; import java.util.stream.Collectors; @@ -112,6 +113,7 @@ public class SimulationBuilder { public static void generateRouteSequence(Simulation simulation) { SimulationDataRepository repository = simulation.getRepository(); CtcRepository ctcRepository = simulation.getCtcRepository(); + AtomicInteger idGenerator = ctcRepository.getRouteSequenceIdGenerator(); Map> stationLineMap = new HashMap<>(); for (Station station : repository.getStationList()) { stationLineMap.put(station.getCode(), new ArrayList<>()); @@ -120,12 +122,12 @@ public class SimulationBuilder { List lines = stationLineMap.get(plan.getStation().getCode()); CtcStationRunPlanLog.RunPlanItem arriveRunPlan = plan.getArriveRunPlan(); if (arriveRunPlan != null) { - RouteSequence.Line line = RouteSequence.buildLine(arriveRunPlan, false); + RouteSequence.Line line = RouteSequence.buildLine(arriveRunPlan, false, idGenerator); lines.add(line); } CtcStationRunPlanLog.RunPlanItem departRunPlan = plan.getDepartRunPlan(); if (departRunPlan != null) { - RouteSequence.Line line = RouteSequence.buildLine(departRunPlan, true); + RouteSequence.Line line = RouteSequence.buildLine(departRunPlan, true, idGenerator); lines.add(line); } } 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 2a2b11ded..dc90a3249 100644 --- a/src/main/java/club/joylink/rtss/vo/client/WebSocketMessageType.java +++ b/src/main/java/club/joylink/rtss/vo/client/WebSocketMessageType.java @@ -407,6 +407,9 @@ public enum WebSocketMessageType { * 仿真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 c7fe9390b..97794d4a5 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 @@ -2,7 +2,7 @@ package club.joylink.rtss.vo.client.factory; import club.joylink.rtss.constants.BusinessConsts.WebSocketSubscribeTopic; import club.joylink.rtss.simulation.cbtc.CTC.data.CtcStationRunPlanLog; -import club.joylink.rtss.simulation.cbtc.CTC.data.CtcStationRunPlanLogVO; +import club.joylink.rtss.simulation.cbtc.CTC.data.vo.CtcStationRunPlanLogVO; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.communication.vo.TrainPosition; import club.joylink.rtss.simulation.cbtc.conversation.Conversation; diff --git a/src/main/java/club/joylink/rtss/websocket/WebSocketMessage.java b/src/main/java/club/joylink/rtss/websocket/WebSocketMessage.java new file mode 100644 index 000000000..218ecbccc --- /dev/null +++ b/src/main/java/club/joylink/rtss/websocket/WebSocketMessage.java @@ -0,0 +1,18 @@ +package club.joylink.rtss.websocket; + +import lombok.Getter; + +/** + * WebSocket消息的二级分类消息模板 + */ +@Getter +public class WebSocketMessage { + private String type; + + private Object object; + + public WebSocketMessage(String type, Object object) { + this.type = type; + this.object = object; + } +}