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 d054db380..98a6bc4ec 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 @@ -134,7 +134,7 @@ public class CtcRunPlanParam implements Cloneable { /** * 列车运行计划作业 */ - private Map runPlanTaskMap = new HashMap(); + private Map runPlanTaskMap = new HashMap<>(); /** * 删除时构造实体 @@ -271,7 +271,7 @@ public class CtcRunPlanParam implements Cloneable { public CtcRunPlanParam clone() { try { CtcRunPlanParam clone = (CtcRunPlanParam) super.clone(); - Map map = new HashMap(this.runPlanTaskMap.size()); + Map map = new HashMap<>(this.runPlanTaskMap.size()); map.putAll(this.runPlanTaskMap); clone.setRunPlanTaskMap(map); return clone; 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 d94653718..f20eb1f63 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,7 +1,6 @@ package club.joylink.rtss.simulation.cbtc.CTC; import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.CtcRunPlanParam; -import club.joylink.rtss.simulation.cbtc.CI.CiApiService; import club.joylink.rtss.simulation.cbtc.CTC.data.*; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; @@ -11,7 +10,6 @@ import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain; import club.joylink.rtss.vo.client.SocketMessageVO; import club.joylink.rtss.vo.client.WebSocketMessageType; -import club.joylink.rtss.vo.client.ctc.CtcRunPlanVO; import club.joylink.rtss.vo.client.factory.SocketMessageFactory; import club.joylink.rtss.websocket.StompMessageService; import org.springframework.beans.factory.annotation.Autowired; @@ -243,18 +241,18 @@ public class CTCLogicLoop { public void sendAllRunPlanChangeMessage(Simulation simulation, Set userIds) { // CTC运行日志发消息 synchronized (this) { - Map ctcRunPlanVOMap = simulation.getCtcRepository().getRunPlanStatusVOMap(); - List messageList = null; + Map ctcRunPlanVOMap = simulation.getCtcRepository().getRunPlanStatusVOMap(); + List messageList = null; if (CollectionUtils.isEmpty(ctcRunPlanVOMap)) { List allRunPlanList = simulation.getCtcRepository().getAllRunPlanList(); messageList = new ArrayList<>(allRunPlanList.size()); String mapKey = null; - CtcRunPlanVO ctcRunPlanVO = null; + CtcStationRunPlanLogVO ctcStationRunPlanLogVO = null; for (CtcStationRunPlanLog runPlan : allRunPlanList) { mapKey = runPlan.getStation().getCode() + "_" + runPlan.getCode(); - ctcRunPlanVO = new CtcRunPlanVO(runPlan); - ctcRunPlanVOMap.put(mapKey, ctcRunPlanVO); - messageList.add(ctcRunPlanVO); + ctcStationRunPlanLogVO = new CtcStationRunPlanLogVO(runPlan); + ctcRunPlanVOMap.put(mapKey, ctcStationRunPlanLogVO); + messageList.add(ctcStationRunPlanLogVO); } } else { messageList = ctcRunPlanVOMap.values().stream().collect(Collectors.toList()); @@ -269,19 +267,19 @@ public class CTCLogicLoop { * @param simulation 仿真实体 */ private void sendRunPlanChangeMessage(Simulation simulation) { - Map ctcRunPlanVOMap = simulation.getCtcRepository().getRunPlanStatusVOMap(); + Map ctcRunPlanVOMap = simulation.getCtcRepository().getRunPlanStatusVOMap(); List allRunPlanList = simulation.getCtcRepository().getAllRunPlanList(); - List messageList = new ArrayList<>(); + List messageList = new ArrayList<>(); allRunPlanList.forEach(runPlan -> { String mapKey = runPlan.getStation().getCode() + "_" + runPlan.getCode(); - CtcRunPlanVO runPlanVO = ctcRunPlanVOMap.get(mapKey); + CtcStationRunPlanLogVO runPlanVO = ctcRunPlanVOMap.get(mapKey); if (runPlanVO == null) { - ctcRunPlanVOMap.put(mapKey, new CtcRunPlanVO(runPlan)); + ctcRunPlanVOMap.put(mapKey, new CtcStationRunPlanLogVO(runPlan)); messageList.add(ctcRunPlanVOMap.get(mapKey)); } else { - CtcRunPlanVO changeCtcRunPlanVo = runPlanVO.compareAndChange(runPlan); - if (changeCtcRunPlanVo != null) { - messageList.add(changeCtcRunPlanVo); + CtcStationRunPlanLogVO changeCtcStationRunPlanLogVo = runPlanVO.compareAndChange(runPlan); + if (changeCtcStationRunPlanLogVo != null) { + messageList.add(changeCtcStationRunPlanLogVo); } } }); @@ -297,15 +295,15 @@ public class CTCLogicLoop { * @param simulation 仿真实体 */ public void sendRunPlanRemoveMessage(Simulation simulation) { - Map ctcRunPlanVOMap = simulation.getCtcRepository().getRunPlanStatusVOMap(); - List ctcRunPlanVOList = ctcRunPlanVOMap.values().stream() + Map ctcRunPlanVOMap = simulation.getCtcRepository().getRunPlanStatusVOMap(); + List ctcStationRunPlanLogVOList = ctcRunPlanVOMap.values().stream() .filter(vo -> simulation.getCtcRepository().getRunPlanByRunPlanCode(vo.getStationCode(), vo.getCode()) == null) - .map(vo -> new CtcRunPlanVO(vo.getStationCode(), vo.getCode())) + .map(vo -> new CtcStationRunPlanLogVO(vo.getStationCode(), vo.getCode())) .collect(Collectors.toList()); - if (!CollectionUtils.isEmpty(ctcRunPlanVOList)) { + if (!CollectionUtils.isEmpty(ctcStationRunPlanLogVOList)) { // 移除已删除的数据 - ctcRunPlanVOList.forEach(vo -> ctcRunPlanVOMap.remove(vo.getStationCode() + "_" + vo.getCode())); - sendCtcMessage(simulation.getId(), ctcRunPlanVOList + ctcStationRunPlanLogVOList.forEach(vo -> ctcRunPlanVOMap.remove(vo.getStationCode() + "_" + vo.getCode())); + sendCtcMessage(simulation.getId(), ctcStationRunPlanLogVOList , WebSocketMessageType.SIMULATION_CTC_RUN_PLAN_REMOVE, simulation.getSimulationUserIds()); } } 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 0942ab5a7..5e3e967bb 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,6 @@ 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.vo.client.ctc.CtcRunPlanVO; import lombok.Getter; import java.util.HashMap; @@ -79,7 +78,7 @@ public class CtcRepository { /** * 运行日志消息状态 */ - private final Map runPlanStatusVOMap = new HashMap<>(); + private final Map runPlanStatusVOMap = new HashMap<>(); /** * 车务管理端运行计划状态 diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcStationRunPlanLog.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcStationRunPlanLog.java index c76e72fe7..93f94f5be 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcStationRunPlanLog.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcStationRunPlanLog.java @@ -133,7 +133,7 @@ public class CtcStationRunPlanLog { this.transfinite = paramInfo.getTransfinite(); // 超限等级 if (CollectionUtils.isEmpty(paramInfo.getRunPlanTaskMap())) { // 运行计划任务 this.runPlanTaskItemMap = paramInfo.getRunPlanTaskMap().keySet().stream() - .collect(Collectors.toMap(t -> t, t -> new RunPlanTaskItem(t))); + .collect(Collectors.toMap(t -> t, RunPlanTaskItem::new)); } else { this.runPlanTaskItemMap = new HashMap<>(0); } @@ -385,10 +385,10 @@ public class CtcStationRunPlanLog { /** * 初始化到、发运行计划条目 * - * @param simulation - * @param paramInfo - * @param arrive - * @return + * @param simulation 仿真实体 + * @param paramInfo 参数信息 + * @param arrive 到发标识 + * @return 运行条目 */ public static RunPlanItem createRunPlanItem(Simulation simulation, CtcRunPlanParam paramInfo, boolean arrive) { // 车站\邻站 @@ -443,8 +443,6 @@ public class CtcStationRunPlanLog { CARS_OPEN_TO_TRAFFIC_EMPTY, // 运用车空车 CARS_OPEN_TO_TRAFFIC_NO, // 非运用车 CABOOSE, // 守车 - VAN, // 客货车 - GOODS_VAN // 货车 } /** @@ -461,6 +459,7 @@ public class CtcStationRunPlanLog { /** * 运行作业类型 */ + @Getter public enum RunPlanTask { // 技术停点 Technical_Stop_Point("技术停点"), @@ -569,6 +568,7 @@ public class CtcStationRunPlanLog { /** * 计划属性类型 */ + @Getter public enum PlanPropertiesType { PASSENGER("客运"), // 客运 GOODS_TRAIN("货运"), // 货运 diff --git a/src/main/java/club/joylink/rtss/vo/client/ctc/CtcRunPlanVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcStationRunPlanLogVO.java similarity index 89% rename from src/main/java/club/joylink/rtss/vo/client/ctc/CtcRunPlanVO.java rename to src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcStationRunPlanLogVO.java index 542c4660c..ee74c9e56 100644 --- a/src/main/java/club/joylink/rtss/vo/client/ctc/CtcRunPlanVO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/CtcStationRunPlanLogVO.java @@ -1,6 +1,5 @@ -package club.joylink.rtss.vo.client.ctc; +package club.joylink.rtss.simulation.cbtc.CTC.data; -import club.joylink.rtss.simulation.cbtc.CTC.data.CtcStationRunPlanLog; import lombok.Getter; import lombok.Setter; import org.springframework.util.CollectionUtils; @@ -15,7 +14,7 @@ import java.util.Objects; */ @Getter @Setter -public class CtcRunPlanVO { +public class CtcStationRunPlanLogVO { /** * 编码 */ @@ -106,12 +105,12 @@ public class CtcRunPlanVO { */ private Map runPlanTaskItemMap; - public CtcRunPlanVO(String stationCode, String code) { + public CtcStationRunPlanLogVO(String stationCode, String code) { this.stationCode = stationCode; this.code = code; } - public CtcRunPlanVO(CtcStationRunPlanLog ctcStationRunPlanLog) { + public CtcStationRunPlanLogVO(CtcStationRunPlanLog ctcStationRunPlanLog) { this.code = ctcStationRunPlanLog.getCode(); if (ctcStationRunPlanLog.getStation() != null) { this.stationCode = ctcStationRunPlanLog.getStation().getCode(); @@ -151,12 +150,12 @@ public class CtcRunPlanVO { * @param runPlanLog * @return */ - public CtcRunPlanVO compareAndChange(CtcStationRunPlanLog runPlanLog) { - CtcRunPlanVO changeCtcRunPlanVO = new CtcRunPlanVO(runPlanLog.getStation().getCode(), runPlanLog.getCode()); + public CtcStationRunPlanLogVO compareAndChange(CtcStationRunPlanLog runPlanLog) { + CtcStationRunPlanLogVO changeCtcStationRunPlanLogVO = new CtcStationRunPlanLogVO(runPlanLog.getStation().getCode(), runPlanLog.getCode()); boolean change = false; if (!Objects.equals(this.delete, runPlanLog.getDelete())) { this.delete = runPlanLog.getDelete(); - changeCtcRunPlanVO.setDelete(runPlanLog.getDelete()); + changeCtcStationRunPlanLogVO.setDelete(runPlanLog.getDelete()); change = true; } // 存在不一样的选项 @@ -175,66 +174,66 @@ public class CtcRunPlanVO { } }); if (runPlanLog.getRunPlanTaskItemMap().size() != this.getRunPlanTaskItemMap().size() || !CollectionUtils.isEmpty(modifyMap)) { - changeCtcRunPlanVO.setRunPlanTaskItemMap(modifyMap); + changeCtcStationRunPlanLogVO.setRunPlanTaskItemMap(modifyMap); change = true; } // 是否客运 if (!Objects.equals(this.passenger, runPlanLog.getPassenger())) { this.passenger = runPlanLog.getPassenger(); - changeCtcRunPlanVO.setPassenger(runPlanLog.getPassenger()); + changeCtcStationRunPlanLogVO.setPassenger(runPlanLog.getPassenger()); change = true; } // 重点列车 if (!Objects.equals(this.keyTrains, runPlanLog.getKeyTrains())) { this.keyTrains = runPlanLog.getKeyTrains(); - changeCtcRunPlanVO.setKeyTrains(runPlanLog.getKeyTrains()); + changeCtcStationRunPlanLogVO.setKeyTrains(runPlanLog.getKeyTrains()); change = true; } // 是否军用 if (!Objects.equals(this.military, runPlanLog.getMilitary())) { this.military = runPlanLog.getMilitary(); - changeCtcRunPlanVO.setMilitary(runPlanLog.getMilitary()); + changeCtcStationRunPlanLogVO.setMilitary(runPlanLog.getMilitary()); change = true; } // 运行股道与基本径路不一致 if (!Objects.equals(this.trackDiscordant, runPlanLog.getTrackDiscordant())) { this.trackDiscordant = runPlanLog.getTrackDiscordant(); - changeCtcRunPlanVO.setTrackSectionCode(runPlanLog.getTrackSectionCode()); + changeCtcStationRunPlanLogVO.setTrackSectionCode(runPlanLog.getTrackSectionCode()); change = true; } // 出入口与基本径路不一致 if (!Objects.equals(this.entryOutDiscordant, runPlanLog.getEntryOutDiscordant())) { this.entryOutDiscordant = runPlanLog.getEntryOutDiscordant(); - changeCtcRunPlanVO.setEntryOutDiscordant(runPlanLog.getEntryOutDiscordant()); + changeCtcStationRunPlanLogVO.setEntryOutDiscordant(runPlanLog.getEntryOutDiscordant()); change = true; } // 超限等级 if (!Objects.equals(this.transfinite, runPlanLog.getTransfinite())) { this.transfinite = runPlanLog.getTransfinite(); - changeCtcRunPlanVO.setTransfinite(runPlanLog.getTransfinite()); + changeCtcStationRunPlanLogVO.setTransfinite(runPlanLog.getTransfinite()); change = true; } // 记事 if (!Objects.equals(this.remark, runPlanLog.getRemark())) { this.remark = runPlanLog.getRemark(); - changeCtcRunPlanVO.setRemark(runPlanLog.getRemark()); + changeCtcStationRunPlanLogVO.setRemark(runPlanLog.getRemark()); change = true; } // 晚点原因 if (!Objects.equals(this.getLateReason(), runPlanLog.getLateReason())) { this.lateReason = runPlanLog.getLateReason(); - changeCtcRunPlanVO.setLateReason(runPlanLog.getLateReason()); + changeCtcStationRunPlanLogVO.setLateReason(runPlanLog.getLateReason()); change = true; } // 到站条目 RunPlanItem changeArriveItem = modifyRunPlanItemInfo(runPlanLog.getArriveRunPlan(), this.arriveRunPlan); - changeCtcRunPlanVO.setArriveRunPlan(changeArriveItem); + changeCtcStationRunPlanLogVO.setArriveRunPlan(changeArriveItem); change = change || changeArriveItem != null; // 发车条目 RunPlanItem changeDepartItem = modifyRunPlanItemInfo(runPlanLog.getDepartRunPlan(), this.departRunPlan); - changeCtcRunPlanVO.setDepartRunPlan(changeDepartItem); + changeCtcStationRunPlanLogVO.setDepartRunPlan(changeDepartItem); change = change || changeDepartItem != null; - return change ? changeCtcRunPlanVO : null; + return change ? changeCtcStationRunPlanLogVO : null; } /** diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/TrackSection.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/TrackSection.java new file mode 100644 index 000000000..58c8e5cd3 --- /dev/null +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/TrackSection.java @@ -0,0 +1,109 @@ +package club.joylink.rtss.simulation.cbtc.CTC.data; + +import club.joylink.rtss.simulation.cbtc.data.map.Section; +import lombok.Getter; +import lombok.Setter; + +/** + * 股道与区段关联信息 + */ +@Setter +@Getter +public class TrackSection { + /** + * 编码 + */ + private String code; + /** + * 名称 + */ + private String name; + + /** + * 区段 + */ + private Section section; + + /** + * 性质 + */ + private TrackNature trackNature; + + /** + * 上下行 + */ + private DirectionType direction; + + /** + * 接发车类型 + */ + private TrainType trainType; + + /** + * 是否可以接发超限类型 + */ + private boolean transfinite; + + /** + * 站台 + */ + private StandType standType; + + /** + * 是否动车轨 + */ + private boolean motorCar; + + /** + * 是否有上水设备 + */ + private boolean waterSupply; + + /** + * 是否有吸污设备 + */ + private boolean sewageAbsorption; + + /** + * 是否军用 + */ + private boolean military; + + public TrackSection(Section section) { + this.code = section.getCode(); + this.name = section.getName(); + this.section = section; + } + + /** + * 股道性质 + */ + public enum TrackNature { + RIGHT_TRACK, // 正线 + ARRIVE_DEPART_TRACK // 到发线 + } + + /** + * 方向类型 + */ + public enum DirectionType { + // 上行、下行、双向 + S, X, D + } + + /** + * 列车类型 + */ + public enum TrainType { + VAN, // 客货车 + GOODS_VAN, // 货车 + PASSENGER, // 客车 + } + + /** + * 站台类型:无、低、高 + */ + public enum StandType { + NO, LOW, HIGH + } +} 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/TrackSectionVO.java new file mode 100644 index 000000000..d2e1b32e8 --- /dev/null +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/TrackSectionVO.java @@ -0,0 +1,83 @@ +package club.joylink.rtss.simulation.cbtc.CTC.data; + +/** + * 股道与区段关联信息 + */ +public class TrackSectionVO { + /** + * 编码 + */ + private String code; + + /** + * 名称 + */ + private String name; + + /** + * 区段 + */ + private String sectionCode; + + /** + * 性质 + */ + private TrackSection.TrackNature trackNature; + + /** + * 上下行 + */ + private TrackSection.DirectionType direction; + + /** + * 接发车类型 + */ + private TrackSection.TrainType trainType; + + /** + * 是否可以接发超限类型 + */ + private Boolean transfinite; + + /** + * 站台 + */ + private TrackSection.StandType standType; + + /** + * 是否动车轨 + */ + private Boolean motorCar; + + /** + * 是否有上水设备 + */ + private Boolean waterSupply; + + /** + * 是否有吸污设备 + */ + private Boolean sewageAbsorption; + + /** + * 是否军用 + */ + private Boolean military; + + public TrackSectionVO(TrackSection trackSection) { + this.code = trackSection.getCode(); + this.name = trackSection.getName(); + if (trackSection.getSection() != null) { + this.sectionCode = trackSection.getSection().getCode(); + } + this.trackNature = trackSection.getTrackNature(); + this.direction = trackSection.getDirection(); + this.trainType = trackSection.getTrainType(); + this.transfinite = trackSection.isTransfinite(); + this.standType = trackSection.getStandType(); + this.motorCar = trackSection.isMotorCar(); + this.waterSupply = trackSection.isWaterSupply(); + this.sewageAbsorption = trackSection.isSewageAbsorption(); + this.military = trackSection.isMilitary(); + } +} 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 5d62778a5..c256a9ca9 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,6 +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.Simulation; import club.joylink.rtss.simulation.cbtc.communication.vo.TrainPosition; import club.joylink.rtss.simulation.cbtc.conversation.Conversation; @@ -15,7 +16,6 @@ import club.joylink.rtss.util.JsonUtils; import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.client.SocketMessageVO; import club.joylink.rtss.vo.client.WebSocketMessageType; -import club.joylink.rtss.vo.client.ctc.CtcRunPlanVO; import club.joylink.rtss.vo.client.passenger.PassengerFlowMessage2TD; import club.joylink.rtss.vo.client.psl.PslStatus; import club.joylink.rtss.vo.client.runplan.RunPlanEChartsDataVO; @@ -406,11 +406,11 @@ public class SocketMessageFactory { /** * CTC 列车运行计划变化消息 */ - public static SocketMessageVO> buildCtcRunPlanCommonMessage(String simulationId + public static SocketMessageVO> buildCtcRunPlanCommonMessage(String simulationId , List ctcStationRunPlanLogList, WebSocketMessageType type) { - List ctcRunPlanVOList = ctcStationRunPlanLogList.stream() - .map(ctcStationRunPlanLog -> new CtcRunPlanVO(ctcStationRunPlanLog)).collect(Collectors.toList()); - return build(type, simulationId, ctcRunPlanVOList); + List ctcStationRunPlanLogVOList = ctcStationRunPlanLogList.stream() + .map(ctcStationRunPlanLog -> new CtcStationRunPlanLogVO(ctcStationRunPlanLog)).collect(Collectors.toList()); + return build(type, simulationId, ctcStationRunPlanLogVOList); } /**