【剧本中出入口状态、行车日志信息保存】
This commit is contained in:
parent
0e3939b8f6
commit
dcec7e339c
@ -19,23 +19,38 @@ import java.time.LocalDateTime;
|
||||
@NoArgsConstructor
|
||||
public class StorageSimulation {
|
||||
|
||||
/** 数据仓库 */
|
||||
/**
|
||||
* 数据仓库
|
||||
*/
|
||||
private StorageSimulationDataRepository repository;
|
||||
|
||||
/** 仿真系统时间(为实际时间-2小时,与运行图对应) */
|
||||
/**
|
||||
* CTC存储数据
|
||||
*/
|
||||
private StorageSimulationCtcDataRepository ctcDataRepository;
|
||||
|
||||
/**
|
||||
* 仿真系统时间(为实际时间-2小时,与运行图对应)
|
||||
*/
|
||||
private LocalDateTime systemTime;
|
||||
|
||||
/** 是否按计划运行 */
|
||||
/**
|
||||
* 是否按计划运行
|
||||
*/
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
||||
private boolean planRunning;
|
||||
|
||||
/** 是否暂停 */
|
||||
/**
|
||||
* 是否暂停
|
||||
*/
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
||||
private boolean pause;
|
||||
|
||||
/** 是否暂停 */
|
||||
/**
|
||||
* 是否暂停
|
||||
*/
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
@JsonDeserialize(using = Boolean2NumDeserializer.class)
|
||||
private boolean planLoaded;
|
||||
@ -46,6 +61,7 @@ public class StorageSimulation {
|
||||
this.pause = simulation.isPause();
|
||||
this.planLoaded = simulation.isPlanLoaded();
|
||||
this.repository = new StorageSimulationDataRepository(simulation.getRepository(), script);
|
||||
this.ctcDataRepository = new StorageSimulationCtcDataRepository(simulation.getCtcRepository());
|
||||
}
|
||||
|
||||
public void recover2Simulation(Simulation simulation) {
|
||||
@ -53,5 +69,6 @@ public class StorageSimulation {
|
||||
simulation.setPlanRunning(this.planRunning);
|
||||
simulation.setPlanLoaded(planLoaded);
|
||||
repository.recover2Simulation(simulation, simulation.getRepository());
|
||||
ctcDataRepository.recover2Simulation(simulation, simulation.getCtcRepository());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,68 @@
|
||||
package club.joylink.rtss.simulation.cbtc.data.storage;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.CTC.data.CtcRepository;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.data.storage.plan.StorageCtcEffectData;
|
||||
import club.joylink.rtss.simulation.cbtc.data.storage.plan.StorageCtcRunPlanLog;
|
||||
import club.joylink.rtss.simulation.cbtc.data.storage.plan.StorageCtcZoneData;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class StorageSimulationCtcDataRepository {
|
||||
/**
|
||||
* 调度台数据
|
||||
*/
|
||||
private StorageCtcZoneData storageCtcZoneData;
|
||||
|
||||
/**
|
||||
* 生效区数据
|
||||
*/
|
||||
private StorageCtcEffectData storageCtcEffectData;
|
||||
|
||||
/**
|
||||
* 行车日志列表
|
||||
*/
|
||||
private List<StorageCtcRunPlanLog> runPlanLogList;
|
||||
|
||||
/**
|
||||
* 保存剧本数据
|
||||
*
|
||||
* @param repository CTC信息
|
||||
*/
|
||||
public StorageSimulationCtcDataRepository(CtcRepository repository) {
|
||||
this.storageCtcZoneData = StorageCtcZoneData.convert2Storage(repository.getCtcZoneRepository());
|
||||
this.storageCtcEffectData = StorageCtcEffectData.convert2Storage(repository.getCtcEffectRepository());
|
||||
if (!repository.getAllRunPlanList().isEmpty()) {
|
||||
this.runPlanLogList = repository.getAllRunPlanList().stream().map(r -> StorageCtcRunPlanLog.convert2Storage(r))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载剧本数据
|
||||
*
|
||||
* @param simulation 仿真实体
|
||||
* @param repository 仿真中的CTC数据
|
||||
*/
|
||||
public void recover2Simulation(Simulation simulation, CtcRepository repository) {
|
||||
// 调度台数据
|
||||
if (storageCtcZoneData != null) {
|
||||
storageCtcZoneData.convert(repository.getCtcZoneRepository());
|
||||
}
|
||||
// 生效区数据
|
||||
if (storageCtcEffectData != null) {
|
||||
storageCtcEffectData.convert(repository.getCtcEffectRepository());
|
||||
}
|
||||
// 行车日志
|
||||
if (this.runPlanLogList != null) {
|
||||
this.runPlanLogList.forEach(r -> r.convert(simulation, repository));
|
||||
}
|
||||
}
|
||||
}
|
@ -19,11 +19,8 @@ import lombok.Setter;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ -75,6 +72,9 @@ public class StorageSimulationDataRepository {
|
||||
// -----------运行中数据-----------
|
||||
private List<String> settingRouteList;
|
||||
|
||||
// 出入口方向状态数据
|
||||
private List<StorageStationDirection> stationDirectionList;
|
||||
|
||||
public StorageSimulationDataRepository(SimulationDataRepository repository, boolean script) {
|
||||
// 地图设备状态列表赋值
|
||||
List<StorageSection> tempSectionList = new ArrayList<>();
|
||||
@ -89,6 +89,7 @@ public class StorageSimulationDataRepository {
|
||||
List<StorageCatenary> tempCatenaryList = new ArrayList<>();
|
||||
List<StorageZC> tempZCList = new ArrayList<>();
|
||||
List<StorageCycle> tempCycleList = new ArrayList<>();
|
||||
List<StorageStationDirection> tempStationDirection = new ArrayList<>();
|
||||
for (MapElement element : repository.getDeviceMap().values()) {
|
||||
MapElement.DeviceType deviceType = element.getDeviceType();
|
||||
switch (deviceType) {
|
||||
@ -164,6 +165,13 @@ public class StorageSimulationDataRepository {
|
||||
if (storageCycle != null)
|
||||
tempCycleList.add(storageCycle);
|
||||
break;
|
||||
case STATION_DIRECTION:
|
||||
StationDirection stationDirection = (StationDirection) element;
|
||||
StorageStationDirection storageStationDirection = StorageStationDirection.convert2Storage(stationDirection);
|
||||
if (storageStationDirection != null) {
|
||||
tempStationDirection.add(storageStationDirection);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!tempSectionList.isEmpty()) {
|
||||
@ -202,6 +210,10 @@ public class StorageSimulationDataRepository {
|
||||
if (!tempCycleList.isEmpty()) {
|
||||
this.cycleList = tempCycleList;
|
||||
}
|
||||
// 出入口序列化
|
||||
if (!tempStationDirection.isEmpty()) {
|
||||
this.stationDirectionList = tempStationDirection;
|
||||
}
|
||||
// 虚拟真实设备状态列表
|
||||
List<StorageVirtualRealityScreenDoor> tempVrDoorList = new ArrayList<>();
|
||||
List<StorageVirtualRealitySignal> tempVrSignalList = new ArrayList<>();
|
||||
@ -353,6 +365,12 @@ public class StorageSimulationDataRepository {
|
||||
storageCycle.recover2Simulation(element, simulation, repository);
|
||||
}
|
||||
}
|
||||
// 出入口反序列化
|
||||
if (Objects.nonNull(this.stationDirectionList)) {
|
||||
stationDirectionList.forEach(storageStationDirection ->
|
||||
storageStationDirection.recover2Simulation(repository.getByCode(storageStationDirection.getCode()),
|
||||
simulation, repository));
|
||||
}
|
||||
// 恢复虚拟真实设备状态
|
||||
if (Objects.nonNull(this.vrDoorList)) {
|
||||
for (StorageVirtualRealityScreenDoor vrDoor : this.vrDoorList) {
|
||||
|
@ -3,7 +3,6 @@ package club.joylink.rtss.simulation.cbtc.data.storage.device;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.MayOutOfOrderDevice;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Route;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
||||
import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer;
|
||||
@ -14,8 +13,9 @@ import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ -96,6 +96,16 @@ public class StorageSection extends StorageDelayUnlockDevice {
|
||||
*/
|
||||
private Integer delayTime;
|
||||
|
||||
/**
|
||||
* 分路不良
|
||||
*/
|
||||
private List<Section.ShuntingType> shuntingTypeList;
|
||||
|
||||
/**
|
||||
* 分路不良状态
|
||||
*/
|
||||
private Boolean badShunt;
|
||||
|
||||
public StorageSection(Section section) {
|
||||
super(section);
|
||||
}
|
||||
@ -161,6 +171,11 @@ public class StorageSection extends StorageDelayUnlockDevice {
|
||||
change = true;
|
||||
this.speedLimitBeforeFault = section.getSpeedLimitBeforeFault();
|
||||
}
|
||||
if (section.getShuntingTypeList() != null) {
|
||||
change = true;
|
||||
this.shuntingTypeList = section.getShuntingTypeList();
|
||||
}
|
||||
this.badShunt = section.isBadShunt();
|
||||
return change;
|
||||
}
|
||||
|
||||
@ -176,9 +191,11 @@ public class StorageSection extends StorageDelayUnlockDevice {
|
||||
section.setCtOccupied(ctOccupied != null ? ctOccupied : false);
|
||||
section.setNctOccupied(nctOccupied != null ? nctOccupied : false);
|
||||
section.setCutOff(cutOff != null ? cutOff : false);
|
||||
section.setInvalid(invalid != null? invalid : false);
|
||||
section.setInvalid(invalid != null ? invalid : false);
|
||||
section.setFaultLock(faultLock != null ? faultLock : false);
|
||||
section.setSpeedUpLimit(speedUpLimit != null? speedUpLimit : -1);
|
||||
section.setSpeedUpLimit(speedUpLimit != null ? speedUpLimit : -1);
|
||||
section.setSpeedLimitBeforeFault(speedLimitBeforeFault);
|
||||
section.setShuntingTypeList(shuntingTypeList != null ? shuntingTypeList : new ArrayList<>());
|
||||
section.setBadShunt(badShunt != null ? badShunt : false);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,160 @@
|
||||
package club.joylink.rtss.simulation.cbtc.data.storage.device;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.StationDirection;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class StorageStationDirection extends StorageMayOutOfOrderDevice {
|
||||
/**
|
||||
* 接发状态
|
||||
*/
|
||||
private StationDirection.ReceiveAndDeliverModel runStatus;
|
||||
|
||||
/**
|
||||
* 预接发状态
|
||||
*/
|
||||
private StationDirection.ReceiveAndDeliverModel prepareRunStatus;
|
||||
|
||||
/**
|
||||
* 改方按钮状态
|
||||
*/
|
||||
private Boolean changeDirectionStatus;
|
||||
|
||||
/**
|
||||
* 改方时间
|
||||
*/
|
||||
private LocalDateTime changeDirectionTime;
|
||||
|
||||
/**
|
||||
* 总辅助
|
||||
*/
|
||||
private Boolean mainAssistStatus;
|
||||
|
||||
/**
|
||||
* 接辅助
|
||||
*/
|
||||
private Boolean receiveAssistStatus;
|
||||
|
||||
/**
|
||||
* 发辅助
|
||||
*/
|
||||
private Boolean deliverAssistStatus;
|
||||
|
||||
private Boolean assistReadyStatus;
|
||||
|
||||
/**
|
||||
* 接、发辅助初始操作时间,在接发互相转换时重置,初始、辅助操作就绪后置空
|
||||
*/
|
||||
private LocalDateTime assistTime;
|
||||
|
||||
/**
|
||||
* 倒计时
|
||||
*/
|
||||
private Integer countDown;
|
||||
|
||||
/**
|
||||
* 预备状态
|
||||
*/
|
||||
private Boolean readyStatus;
|
||||
|
||||
public StorageStationDirection(StationDirection stationDirection) {
|
||||
super(stationDirection);
|
||||
}
|
||||
|
||||
public static StorageStationDirection convert2Storage(StationDirection stationDirection) {
|
||||
StorageStationDirection storageStationDirection = new StorageStationDirection(stationDirection);
|
||||
if (storageStationDirection.convert(stationDirection)) {
|
||||
return storageStationDirection;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean convert(MapElement element) {
|
||||
boolean change = super.convert(element);
|
||||
StationDirection stationDirection = (StationDirection) element;
|
||||
if (StationDirection.DirectionRunModel.A.equals(stationDirection.getRunModel())) { // 自动闭塞情况
|
||||
if (stationDirection.isChangeDirectionStatus()) { // 改方状态
|
||||
change = true;
|
||||
this.changeDirectionStatus = stationDirection.isChangeDirectionStatus();
|
||||
this.changeDirectionTime = stationDirection.getChangeDirectionTime();
|
||||
} else if (stationDirection.isMainAssistStatus()) { // 总辅助状态
|
||||
change = true;
|
||||
this.mainAssistStatus = stationDirection.isMainAssistStatus();
|
||||
this.assistTime = stationDirection.getAssistTime();
|
||||
// 辅助状态时间
|
||||
if (stationDirection.isAssistReadyStatus()) {
|
||||
this.assistReadyStatus = stationDirection.isAssistReadyStatus();
|
||||
}
|
||||
// 改变时间
|
||||
if (stationDirection.getCountDown().get() != 0) {
|
||||
this.countDown = stationDirection.getCountDown().get();
|
||||
}
|
||||
// 接辅助
|
||||
if (stationDirection.isReceiveAssistStatus()) {
|
||||
this.receiveAssistStatus = stationDirection.isReceiveAssistStatus();
|
||||
this.prepareRunStatus = stationDirection.getPrepareRunStatus();
|
||||
}
|
||||
// 发辅助
|
||||
if (stationDirection.isDeliverAssistStatus()) {
|
||||
this.deliverAssistStatus = stationDirection.isDeliverAssistStatus();
|
||||
}
|
||||
if (stationDirection.getPrepareRunStatus() != null) {
|
||||
this.prepareRunStatus = stationDirection.getPrepareRunStatus();
|
||||
}
|
||||
}
|
||||
} else { // 半自动闭塞
|
||||
if (!stationDirection.getRunStatus().equals(StationDirection.ReceiveAndDeliverModel.NO)) { // 如果不是复位状态
|
||||
change = true;
|
||||
this.runStatus = stationDirection.getRunStatus();
|
||||
this.readyStatus = stationDirection.isReadyStatus();
|
||||
}
|
||||
}
|
||||
return change;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recover2Simulation(MapElement element, Simulation simulation, SimulationDataRepository repository) {
|
||||
super.recover2Simulation(element, simulation, repository);
|
||||
StationDirection stationDirection = (StationDirection) element;
|
||||
if (runStatus != null) {
|
||||
stationDirection.setRunStatus(runStatus);
|
||||
stationDirection.setReadyStatus(readyStatus);
|
||||
}
|
||||
if (prepareRunStatus != null) {
|
||||
stationDirection.setPrepareRunStatus(prepareRunStatus);
|
||||
}
|
||||
if (changeDirectionStatus != null) {
|
||||
stationDirection.setChangeDirectionStatus(changeDirectionStatus);
|
||||
stationDirection.setChangeDirectionTime(changeDirectionTime);
|
||||
}
|
||||
if (mainAssistStatus != null) {
|
||||
stationDirection.setMainAssistStatus(mainAssistStatus);
|
||||
stationDirection.setAssistTime(assistTime);
|
||||
if (assistReadyStatus != null) {
|
||||
stationDirection.setAssistReadyStatus(assistReadyStatus);
|
||||
}
|
||||
// 改变时间
|
||||
if (countDown != null) {
|
||||
stationDirection.getCountDown().set(countDown);
|
||||
}
|
||||
// 接辅助
|
||||
if (receiveAssistStatus != null) {
|
||||
stationDirection.setReceiveAssistStatus(receiveAssistStatus);
|
||||
}
|
||||
// 发辅助
|
||||
if (deliverAssistStatus) {
|
||||
stationDirection.setDeliverAssistStatus(deliverAssistStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
package club.joylink.rtss.simulation.cbtc.data.storage.plan;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.CTC.data.CtcEffectRepository;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* CTC生效区数据
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
public class StorageCtcEffectData {
|
||||
|
||||
/**
|
||||
* 运行计划数据
|
||||
*/
|
||||
private Map<String, CtcEffectRepository.StationRunPlanRepository> stationRunPlanMap;
|
||||
|
||||
/**
|
||||
* 阶段计划版本
|
||||
*/
|
||||
private Map<String, Integer> stageRunPlanVersionMap;
|
||||
|
||||
/**
|
||||
* 车站申请信息
|
||||
*/
|
||||
private Map<String, CtcEffectRepository.CtcStageRunPlanRepository> stationApplyRunPlanMap;
|
||||
|
||||
/**
|
||||
* 阶段计划
|
||||
*/
|
||||
private Map<String, CtcEffectRepository.CtcStageRunPlanRepository> stationStageRunPlanMap;
|
||||
|
||||
/**
|
||||
* 设置的股道信息
|
||||
*/
|
||||
private Map<String, CtcEffectRepository.StationTrackSectionRepository> stationTrackSectionMap;
|
||||
|
||||
/**
|
||||
* 序列化成剧本数据
|
||||
*
|
||||
* @param repository 调度台数据
|
||||
* @return 剧本调度台数据
|
||||
*/
|
||||
public static StorageCtcEffectData convert2Storage(CtcEffectRepository repository) {
|
||||
StorageCtcEffectData storageCtcEffectData = null;
|
||||
if (!repository.getStationRunPlanMap().isEmpty()) {
|
||||
storageCtcEffectData = new StorageCtcEffectData();
|
||||
storageCtcEffectData.setStageRunPlanVersionMap(repository.getStageRunPlanVersionMap());
|
||||
}
|
||||
if (!repository.getStageRunPlanVersionMap().isEmpty()) {
|
||||
storageCtcEffectData = storageCtcEffectData == null ? new StorageCtcEffectData() : storageCtcEffectData;
|
||||
storageCtcEffectData.setStageRunPlanVersionMap(repository.getStageRunPlanVersionMap());
|
||||
}
|
||||
if (!repository.getStationApplyRunPlanMap().isEmpty()) {
|
||||
storageCtcEffectData = storageCtcEffectData == null ? new StorageCtcEffectData() : storageCtcEffectData;
|
||||
storageCtcEffectData.setStationApplyRunPlanMap(repository.getStationApplyRunPlanMap());
|
||||
}
|
||||
if (!repository.getStationStageRunPlanMap().isEmpty()) {
|
||||
storageCtcEffectData = storageCtcEffectData == null ? new StorageCtcEffectData() : storageCtcEffectData;
|
||||
storageCtcEffectData.setStationStageRunPlanMap(repository.getStationStageRunPlanMap());
|
||||
}
|
||||
if (!repository.getStationTrackSectionMap().isEmpty()) {
|
||||
storageCtcEffectData = storageCtcEffectData == null ? new StorageCtcEffectData() : storageCtcEffectData;
|
||||
storageCtcEffectData.setStationTrackSectionMap(repository.getStationTrackSectionMap());
|
||||
}
|
||||
return storageCtcEffectData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 反序列化数据
|
||||
*
|
||||
* @param repository 仿真数据化
|
||||
* @return
|
||||
*/
|
||||
public void convert(CtcEffectRepository repository) {
|
||||
if (stationRunPlanMap != null) {
|
||||
stationRunPlanMap.forEach((k, v) -> repository.getStationRunPlanMap().put(k, v));
|
||||
}
|
||||
if (stageRunPlanVersionMap != null) {
|
||||
stageRunPlanVersionMap.forEach((k, v) -> repository.getStageRunPlanVersionMap().put(k, v));
|
||||
}
|
||||
if (stationApplyRunPlanMap != null) {
|
||||
stationApplyRunPlanMap.forEach((k, v) -> repository.getStationApplyRunPlanMap().put(k, v));
|
||||
}
|
||||
if (stationStageRunPlanMap != null) {
|
||||
stationStageRunPlanMap.forEach((k, v) -> repository.getStationStageRunPlanMap().put(k, v));
|
||||
}
|
||||
if (stationTrackSectionMap != null) {
|
||||
stationTrackSectionMap.forEach((k, v) -> repository.getStationTrackSectionMap().put(k, v));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,243 @@
|
||||
package club.joylink.rtss.simulation.cbtc.data.storage.plan;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.CtcRunPlanParam;
|
||||
import club.joylink.rtss.simulation.cbtc.CTC.data.CtcRepository;
|
||||
import club.joylink.rtss.simulation.cbtc.CTC.data.CtcStationRunPlanLog;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 剧本行车日志信息
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
public class StorageCtcRunPlanLog {
|
||||
|
||||
private CtcRunPlanParam planParam;
|
||||
|
||||
/**
|
||||
* 是否闪烁
|
||||
* 调度员对接发股道、计划时间、车次删除时,闪烁
|
||||
*/
|
||||
private Boolean twinkle;
|
||||
|
||||
/**
|
||||
* 是否已加载至轨道
|
||||
*/
|
||||
private Boolean load;
|
||||
|
||||
/**
|
||||
* 是否签收至占线板
|
||||
*/
|
||||
private Boolean sign;
|
||||
|
||||
private ItemOtherInfo arriveItemOtherInfo;
|
||||
|
||||
private ItemOtherInfo departItemOtherInfo;
|
||||
|
||||
public static StorageCtcRunPlanLog convert2Storage(CtcStationRunPlanLog runPlanLog) {
|
||||
StorageCtcRunPlanLog storageCtcRunPlanLog = new StorageCtcRunPlanLog();
|
||||
CtcRunPlanParam ctcRunPlanParam = new CtcRunPlanParam();
|
||||
ctcRunPlanParam.setRunPlanCode(runPlanLog.getCode());
|
||||
ctcRunPlanParam.setStationCode(runPlanLog.getStation().getCode());
|
||||
ctcRunPlanParam.setGroupNumber(runPlanLog.getGroupNumber());
|
||||
ctcRunPlanParam.setTripNumber(runPlanLog.getTripNumber());
|
||||
ctcRunPlanParam.setTrackSectionCode(runPlanLog.getTrackSectionCode());
|
||||
ctcRunPlanParam.setStartRunPlan(runPlanLog.isStartRunPlan());
|
||||
ctcRunPlanParam.setEndRunPlan(runPlanLog.isEndRunPlan());
|
||||
ctcRunPlanParam.setStatus(runPlanLog.getStatus());
|
||||
if (runPlanLog.isElectrical()) {
|
||||
ctcRunPlanParam.setElectrical(runPlanLog.isElectrical());
|
||||
}
|
||||
ctcRunPlanParam.setTransfinite(runPlanLog.getTransfinite());
|
||||
if (runPlanLog.getPassenger().equals(CtcStationRunPlanLog.PlanPropertiesType.PASSENGER)) {
|
||||
ctcRunPlanParam.setPassenger(true);
|
||||
}
|
||||
ctcRunPlanParam.setKeyTrains(runPlanLog.getKeyTrains());
|
||||
ctcRunPlanParam.setMilitary(runPlanLog.getMilitary());
|
||||
ctcRunPlanParam.setTrackDiscordant(runPlanLog.getTrackDiscordant());
|
||||
ctcRunPlanParam.setEntryOutDiscordant(runPlanLog.getEntryOutDiscordant());
|
||||
ctcRunPlanParam.setRemark(runPlanLog.getRemark());
|
||||
ctcRunPlanParam.setLateReason(runPlanLog.getLateReason());
|
||||
runPlanLog.getRunPlanTaskItemMap().forEach((k, v) -> ctcRunPlanParam.getRunPlanTaskMap().put(v.getType(), 1));
|
||||
ctcRunPlanParam.setTrainType(runPlanLog.getTrainType());
|
||||
ctcRunPlanParam.setRunType(runPlanLog.getRunType());
|
||||
storageCtcRunPlanLog.setDepartAndArrive(ctcRunPlanParam, runPlanLog.getArriveRunPlan(), true);
|
||||
storageCtcRunPlanLog.setDepartAndArrive(ctcRunPlanParam, runPlanLog.getDepartRunPlan(), false);
|
||||
storageCtcRunPlanLog.setPlanParam(ctcRunPlanParam);
|
||||
if (runPlanLog.isTwinkle()) {
|
||||
storageCtcRunPlanLog.setTwinkle(runPlanLog.isTwinkle());
|
||||
}
|
||||
if (runPlanLog.isLoad()) {
|
||||
storageCtcRunPlanLog.setSign(runPlanLog.isLoad());
|
||||
}
|
||||
if (runPlanLog.isSign()) {
|
||||
storageCtcRunPlanLog.setSign(runPlanLog.isSign());
|
||||
}
|
||||
return storageCtcRunPlanLog;
|
||||
}
|
||||
|
||||
/**
|
||||
* 反序列化
|
||||
*
|
||||
* @param simulation 仿真
|
||||
* @param ctcRepository ctc数据
|
||||
*/
|
||||
public void convert(Simulation simulation, CtcRepository ctcRepository) {
|
||||
CtcStationRunPlanLog ctcStationRunPlanLog = CtcStationRunPlanLog.createRunPlanLog(simulation, planParam.getStationCode(), planParam);
|
||||
if (twinkle != null) {
|
||||
ctcStationRunPlanLog.setTwinkle(twinkle);
|
||||
}
|
||||
if (load != null) {
|
||||
ctcStationRunPlanLog.setLoad(load);
|
||||
}
|
||||
if (sign != null) {
|
||||
ctcStationRunPlanLog.setSign(sign);
|
||||
}
|
||||
this.departItemOtherInfo.convertToObj(ctcStationRunPlanLog.getDepartRunPlan());
|
||||
this.arriveItemOtherInfo.convertToObj(ctcStationRunPlanLog.getArriveRunPlan());
|
||||
}
|
||||
|
||||
private void setDepartAndArrive(CtcRunPlanParam ctcRunPlanParam, CtcStationRunPlanLog.RunPlanItem runPlanItem, boolean arrive) {
|
||||
if (runPlanItem != null) {
|
||||
// 股道
|
||||
String sectionCode = runPlanItem.getTrackSection().getCode();
|
||||
if (arrive) {
|
||||
ctcRunPlanParam.setArriveSectionCode(sectionCode);
|
||||
} else {
|
||||
ctcRunPlanParam.setDepartSectionCode(sectionCode);
|
||||
}
|
||||
// 计划时间
|
||||
LocalDateTime plan = runPlanItem.getPlanTime();
|
||||
if (arrive) {
|
||||
ctcRunPlanParam.setArrivePlanTime(plan);
|
||||
} else {
|
||||
ctcRunPlanParam.setDepartPlanTime(plan);
|
||||
}
|
||||
// 车次
|
||||
String tripNumber = runPlanItem.getTripNumber();
|
||||
if (arrive) {
|
||||
ctcRunPlanParam.setArriveTripNumber(tripNumber);
|
||||
} else {
|
||||
ctcRunPlanParam.setDepartTripNumber(tripNumber);
|
||||
}
|
||||
// 车站
|
||||
String code = runPlanItem.getStation().getCode();
|
||||
if (arrive) {
|
||||
ctcRunPlanParam.setArriveStationCode(code);
|
||||
} else {
|
||||
ctcRunPlanParam.setDepartStationCode(code);
|
||||
}
|
||||
// 到达口
|
||||
String directionCode = runPlanItem.getStationDirection().getCode();
|
||||
if (arrive) {
|
||||
ctcRunPlanParam.setArriveDirectionCode(directionCode);
|
||||
} else {
|
||||
ctcRunPlanParam.setDepartDirectionCode(directionCode);
|
||||
}
|
||||
// 电力
|
||||
if (runPlanItem.isElectrical()) {
|
||||
if (arrive) {
|
||||
ctcRunPlanParam.setArriveElectrical(true);
|
||||
} else {
|
||||
ctcRunPlanParam.setDepartElectrical(true);
|
||||
}
|
||||
}
|
||||
// 超限
|
||||
if (runPlanItem.getTransfinite() != null) {
|
||||
if (arrive) {
|
||||
ctcRunPlanParam.setArriveTransfinite(runPlanItem.getTransfinite());
|
||||
} else {
|
||||
ctcRunPlanParam.setDepartTransfinite(runPlanItem.getTransfinite());
|
||||
}
|
||||
}
|
||||
// 其他可修改信息
|
||||
if (arrive) {
|
||||
this.arriveItemOtherInfo = new ItemOtherInfo(runPlanItem);
|
||||
|
||||
} else {
|
||||
this.departItemOtherInfo = new ItemOtherInfo(runPlanItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private class ItemOtherInfo {
|
||||
/**
|
||||
* 实际时间
|
||||
*/
|
||||
private String actualTime;
|
||||
|
||||
/**
|
||||
* 邻站状态
|
||||
*/
|
||||
private String adjacentStatus;
|
||||
|
||||
/**
|
||||
* 同意邻站发车、邻站同意发车(0,1,2分别代表无状态、发起预告/接到预告、完成预告)
|
||||
*/
|
||||
private String adjacentMessage;
|
||||
|
||||
/**
|
||||
* 邻站发车
|
||||
*/
|
||||
private String adjacentDepart;
|
||||
|
||||
/**
|
||||
* 列车类型
|
||||
*/
|
||||
private Map<CtcStationRunPlanLog.SetOutType, Integer> setOutTypeMap;
|
||||
|
||||
/**
|
||||
* 占用区间凭证号码
|
||||
*/
|
||||
private String occupiedCode;
|
||||
|
||||
/**
|
||||
* 电话记录号码
|
||||
*/
|
||||
private Map<CtcStationRunPlanLog.ProcessType, String> processTypeMap;
|
||||
|
||||
/**
|
||||
* 邻站预告、同意时间
|
||||
*/
|
||||
private String adjacentMessageTime;
|
||||
|
||||
/**
|
||||
* 是否完成
|
||||
*/
|
||||
private Boolean finish;
|
||||
|
||||
public ItemOtherInfo(CtcStationRunPlanLog.RunPlanItem runPlanItem) {
|
||||
this.actualTime = runPlanItem.getActualTime();
|
||||
this.adjacentStatus = runPlanItem.getAdjacentStatus();
|
||||
this.adjacentMessage = runPlanItem.getAdjacentMessage();
|
||||
this.adjacentDepart = runPlanItem.getAdjacentDepart();
|
||||
this.setOutTypeMap = runPlanItem.getSetOutTypeMap();
|
||||
this.occupiedCode = runPlanItem.getOccupiedCode();
|
||||
this.processTypeMap = runPlanItem.getProcessTypeMap();
|
||||
this.adjacentMessageTime = runPlanItem.getAdjacentMessageTime();
|
||||
this.finish = runPlanItem.isFinish();
|
||||
}
|
||||
|
||||
public void convertToObj(CtcStationRunPlanLog.RunPlanItem runPlanItem) {
|
||||
if (runPlanItem != null) {
|
||||
runPlanItem.setActualTime(actualTime);
|
||||
runPlanItem.setAdjacentStatus(adjacentStatus);
|
||||
runPlanItem.setAdjacentMessage(adjacentMessage);
|
||||
runPlanItem.setAdjacentDepart(adjacentDepart);
|
||||
runPlanItem.setSetOutTypeMap(setOutTypeMap);
|
||||
runPlanItem.setOccupiedCode(occupiedCode);
|
||||
runPlanItem.setProcessTypeMap(processTypeMap);
|
||||
runPlanItem.setAdjacentMessageTime(adjacentMessageTime);
|
||||
runPlanItem.setFinish(finish);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package club.joylink.rtss.simulation.cbtc.data.storage.plan;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.CTC.data.CtcEffectRepository;
|
||||
import club.joylink.rtss.simulation.cbtc.CTC.data.CtcZoneRepository;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* CTC剧本调度台数据
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
public class StorageCtcZoneData {
|
||||
|
||||
/**
|
||||
* 运行计划数据
|
||||
*/
|
||||
private Map<String, CtcEffectRepository.StationRunPlanRepository> stationRunPlanMap;
|
||||
|
||||
/**
|
||||
* 序列化成剧本数据
|
||||
*
|
||||
* @param repository 调度台数据
|
||||
* @return 剧本调度台数据
|
||||
*/
|
||||
public static StorageCtcZoneData convert2Storage(CtcZoneRepository repository) {
|
||||
if (repository.getStationRunPlanMap().isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
StorageCtcZoneData storageCtcZoneData = new StorageCtcZoneData();
|
||||
storageCtcZoneData.setStationRunPlanMap(repository.getStationRunPlanMap());
|
||||
return storageCtcZoneData;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 反序列化数据
|
||||
*
|
||||
* @param repository 仿真数据化
|
||||
* @return
|
||||
*/
|
||||
public void convert(CtcZoneRepository repository) {
|
||||
stationRunPlanMap.forEach((k, v) -> repository.getStationRunPlanMap().put(k, v));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user