Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
joylink_zhangsai 2022-06-14 10:06:19 +08:00
commit e80633570b
7 changed files with 119 additions and 51 deletions

View File

@ -6,6 +6,7 @@ import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
import club.joylink.rtss.simulation.cbtc.data.map.MapConfig; import club.joylink.rtss.simulation.cbtc.data.map.MapConfig;
import club.joylink.rtss.simulation.cbtc.data.map.Section; import club.joylink.rtss.simulation.cbtc.data.map.Section;
import club.joylink.rtss.simulation.cbtc.data.map.Signal; import club.joylink.rtss.simulation.cbtc.data.map.Signal;
import club.joylink.rtss.simulation.cbtc.data.map.Switch;
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition; import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -110,7 +111,7 @@ public class AtpSectionService {
if (section.isSwitchAxleCounterSection()) { if (section.isSwitchAxleCounterSection()) {
Section switchSection = section.getLogicList().get(0); Section switchSection = section.getLogicList().get(0);
if (switchSingleHandle) { if (switchSingleHandle) {
atpSectionList.addAll(switchSection.getSwitchAxleSectionsBySwitchPositionBySwitchSingleHandle()); atpSectionList.addAll(handleSingleSwitchPosition(section, right));
} else { } else {
atpSectionList.addAll(switchSection.getSwitchAxleSectionsBySwitchPosition()); atpSectionList.addAll(switchSection.getSwitchAxleSectionsBySwitchPosition());
} }
@ -213,4 +214,38 @@ public class AtpSectionService {
}); });
} }
/**
* isSwitchSingleHandle 为TRUE的情况下获取区段列表
*
* @param section 区段
* @param right 列车行驶方向
* @return 区段列表
*/
private List<Section> handleSingleSwitchPosition(Section section, boolean right) {
List<Section> atpSectionList = new ArrayList<>();
// 道岔列表
List<Switch> relSwitchList = section.getRelSwitchList();
// 反位情况下
if (relSwitchList.stream().anyMatch(Switch::isPosR)) {
Switch relSwitch = relSwitchList.stream().filter(Switch::isPosR).findFirst().orElse(null);
if (relSwitch != null) {
// 反位前区段列表
Section nextSection = relSwitch.getA();
do {
atpSectionList.add(0, nextSection);
nextSection = nextSection.getNextRunningSectionOf(!right);
} while (nextSection.getRelSwitch() != null && relSwitchList.contains(nextSection.getRelSwitch()));
// 反位后区段列表
nextSection = relSwitch.isPosN() ? relSwitch.getB() : relSwitch.getC();
while (nextSection != null && relSwitchList.contains(nextSection.getRelSwitch())) {
atpSectionList.add(nextSection);
nextSection = nextSection.getNextRunningSectionOf(right);
}
}
} else {
relSwitchList.forEach(relSwitch -> atpSectionList.addAll(relSwitch.getSectionsByPosition()));
}
return atpSectionList;
}
} }

View File

@ -118,7 +118,6 @@ public class CtcStationRunPlanLogService {
stationRunPlanMap.put(tripNumber, p); stationRunPlanMap.put(tripNumber, p);
runPlanLogList.add(p); runPlanLogList.add(p);
} }
}); });
// 发送消息 // 发送消息
ctcLogicLoop.sendCtcRunPlanMessage(simulation.getId(), runPlanLogList, ctcLogicLoop.sendCtcRunPlanMessage(simulation.getId(), runPlanLogList,
@ -155,8 +154,8 @@ public class CtcStationRunPlanLogService {
* @param tripNumberList 车次 * @param tripNumberList 车次
*/ */
public void removeRunPlanFromEditArea(Simulation simulation, String stationCode, List<String> tripNumberList) { public void removeRunPlanFromEditArea(Simulation simulation, String stationCode, List<String> tripNumberList) {
Map<String, CtcRunPlanParam> stationRunLogTripNumberMap = simulation.getCtcRepository().getSimulationRunPlanEditAreaMap() Map<String, CtcRunPlanParam> stationRunLogTripNumberMap = simulation.getCtcRepository()
.getOrDefault(stationCode, new ConcurrentHashMap<>()); .getSimulationRunPlanEditAreaMap().getOrDefault(stationCode, new ConcurrentHashMap<>());
tripNumberList.forEach(tripNumber -> stationRunLogTripNumberMap.remove(tripNumber)); tripNumberList.forEach(tripNumber -> stationRunLogTripNumberMap.remove(tripNumber));
// 发送消息 // 发送消息
ctcLogicLoop.sendCtcRunPlanMessage(simulation.getId(), tripNumberList, ctcLogicLoop.sendCtcRunPlanMessage(simulation.getId(), tripNumberList,
@ -172,14 +171,13 @@ public class CtcStationRunPlanLogService {
public void releaseRunPlanToSimulation(Simulation simulation, String stationCode) { public void releaseRunPlanToSimulation(Simulation simulation, String stationCode) {
// 移除生效区中车站的所有计划(包括原始计划) // 移除生效区中车站的所有计划(包括原始计划)
simulation.getCtcRepository().removeRunPlanByStationCode(stationCode); simulation.getCtcRepository().removeRunPlanByStationCode(stationCode);
Map<String, CtcRunPlanParam> planParamMap = simulation.getCtcRepository().getSimulationRunPlanEditAreaMap() Map<String, CtcRunPlanParam> planParamMap = simulation.getCtcRepository()
.getOrDefault(stationCode, new ConcurrentHashMap<>()); .getSimulationRunPlanEditAreaMap().getOrDefault(stationCode, new ConcurrentHashMap<>());
// 添加至仿真CTC运行计划中 // 添加至仿真CTC运行计划中
List<CtcStationRunPlanLog> runPlanLogList = new LinkedList<>(); List<CtcStationRunPlanLog> runPlanLogList = new LinkedList<>();
planParamMap.forEach((k, p) -> { planParamMap.forEach((k, p) -> {
CtcStationRunPlanLog runPlanLog = createRunPlanLog(simulation, stationCode, p); CtcStationRunPlanLog runPlanLog = createRunPlanLog(simulation, stationCode, p);
runPlanLog.setOrigin(true); simulation.getCtcRepository().addRunPlanToSimulationMap(runPlanLog);
simulation.getCtcRepository().addRunPlanToOriginMap(runPlanLog);
runPlanLogList.add(runPlanLog); runPlanLogList.add(runPlanLog);
}); });
coverRunPlanMessage(simulation, runPlanLogList); coverRunPlanMessage(simulation, runPlanLogList);
@ -359,11 +357,11 @@ public class CtcStationRunPlanLogService {
*/ */
public void removeRunPlan(Simulation simulation, String stationCode, String runPlanCode) { public void removeRunPlan(Simulation simulation, String stationCode, String runPlanCode) {
CtcStationRunPlanLog ctcStationRunPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode); CtcStationRunPlanLog ctcStationRunPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode);
if (!Objects.equals(ctcStationRunPlanLog.isDelete(), true)) { if (!Objects.equals(ctcStationRunPlanLog.getDelete(), Boolean.TRUE)) {
ctcStationRunPlanLog.setDelete(true); ctcStationRunPlanLog.setDelete(Boolean.TRUE);
CtcStationRunPlanLog changeRunPlanLog = new CtcStationRunPlanLog(); CtcStationRunPlanLog changeRunPlanLog = new CtcStationRunPlanLog();
changeRunPlanLog.setCode(runPlanCode); changeRunPlanLog.setCode(runPlanCode);
changeRunPlanLog.setDelete(true); changeRunPlanLog.setDelete(Boolean.TRUE);
sendRunPlanChangeMessage(simulation, Arrays.asList(changeRunPlanLog)); sendRunPlanChangeMessage(simulation, Arrays.asList(changeRunPlanLog));
} }
} }
@ -380,8 +378,8 @@ public class CtcStationRunPlanLogService {
CtcStationRunPlanLog changeRunPlanLog = new CtcStationRunPlanLog(); CtcStationRunPlanLog changeRunPlanLog = new CtcStationRunPlanLog();
boolean change = false; boolean change = false;
if (planParam.getStatus() == -1) { if (planParam.getStatus() == -1) {
runPlanLog.setDelete(true); runPlanLog.setDelete(Boolean.TRUE);
changeRunPlanLog.setDelete(true); changeRunPlanLog.setDelete(Boolean.TRUE);
change = true; change = true;
} }
CtcStationRunPlanLog.RunPlanItem changeArriveItem = CtcStationRunPlanLog.RunPlanItem changeArriveItem =

View File

@ -99,9 +99,9 @@ public class CtcRepository {
* @param stationCode 车站编码 * @param stationCode 车站编码
*/ */
public void removeRunPlanByStationCode(String stationCode) { public void removeRunPlanByStationCode(String stationCode) {
this.originRunPlanMap.remove(stationCode);
this.simulationRunPlanMap.remove(stationCode); this.simulationRunPlanMap.remove(stationCode);
this.allRunPlanList = this.allRunPlanList.stream().filter(r -> !stationCode.equals(r.getStation().getCode())) this.allRunPlanList = this.allRunPlanList.stream()
.filter(r -> r.isOrigin() || !stationCode.equals(r.getStation().getCode()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }

View File

@ -77,40 +77,40 @@ public class CtcStationRunPlanLog {
*/ */
private List<RunPlanTask> runPlanTaskList = new ArrayList<>(); private List<RunPlanTask> runPlanTaskList = new ArrayList<>();
/**
* 是否删除
*/
private boolean delete;
/** /**
* 是否原始数据 * 是否原始数据
*/ */
private boolean origin; private boolean origin;
/**
* 是否删除
*/
private Boolean delete;
/** /**
* 客运车 * 客运车
*/ */
private boolean passenger; private Boolean passenger;
/** /**
* 重点列车 * 重点列车
*/ */
private boolean keyTrains; private Boolean keyTrains;
/** /**
* 是否军用 * 是否军用
*/ */
private boolean military; private Boolean military;
/** /**
* 运行股道与基本径路不一致 * 运行股道与基本径路不一致
*/ */
private boolean trackDiscordant; private Boolean trackDiscordant;
/** /**
* 出入口与基本径路不一致 * 出入口与基本径路不一致
*/ */
private boolean entryOutDiscordant; private Boolean entryOutDiscordant;
/** /**
* 超限等级 * 超限等级
@ -299,7 +299,7 @@ public class CtcStationRunPlanLog {
/** /**
* 电力标识 * 电力标识
*/ */
private boolean electrical; private Boolean electrical;
public RunPlanItem(CtcRunPlanParam paramInfo) { public RunPlanItem(CtcRunPlanParam paramInfo) {
this.paramInfo = paramInfo; this.paramInfo = paramInfo;

View File

@ -822,24 +822,6 @@ public class Section extends DelayUnlockDevice {
return atpSectionList; return atpSectionList;
} }
/**
* isSwitchSingleHandle 为TRUE的情况下获取区段列表
*
* @return 区段列表
*/
public List<Section> getSwitchAxleSectionsBySwitchPositionBySwitchSingleHandle() {
List<Section> atpSectionList = new ArrayList<>();
Section parent = this.getParent();
List<Switch> relSwitchList = parent.getRelSwitchList();
// 反位情况下
if (relSwitchList.stream().anyMatch(Switch::isPosR)) {
relSwitchList.stream().filter(Switch::isPosR).forEach(relSwitch -> atpSectionList.addAll(relSwitch.getSectionsByPosition()));
} else {
relSwitchList.forEach(relSwitch -> atpSectionList.addAll(relSwitch.getSectionsByPosition()));
}
return atpSectionList;
}
/** /**
* 判定为非通信车占用 * 判定为非通信车占用
* *

View File

@ -386,6 +386,6 @@ public enum WebSocketMessageType {
* 仿真编辑区运行计划覆盖 * 仿真编辑区运行计划覆盖
*/ */
SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_COVER, SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_COVER,
/** ------------ CTC消息信息 ------- */ /** ------------ CTC消息信息 ----------- */
; ;
} }

View File

@ -5,6 +5,7 @@ import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import java.time.LocalTime; import java.time.LocalTime;
import java.util.List;
/** /**
* CTC运行计划消息实体 * CTC运行计划消息实体
@ -62,6 +63,46 @@ public class CtcRunPlanVO {
*/ */
private Boolean delete; private Boolean delete;
/**
* 重点列车
*/
private Boolean keyTrains;
/**
* 军用
*/
private Boolean military;
/**
* 超限等级
*/
private CtcStationRunPlanLog.TransfiniteType transfinite;
/**
* 是否电力
*/
private Boolean electrical;
/**
* 运行股道与基本径路不一致
*/
private Boolean trackDiscordant;
/**
* 出入口与基本径路不一致
*/
private Boolean entryOutDiscordant;
/**
* 客运车
*/
private Boolean passenger;
/**
* 列车运行计划作业
*/
private List<CtcStationRunPlanLog.RunPlanTask> runPlanTaskList;
public CtcRunPlanVO(CtcStationRunPlanLog ctcStationRunPlanLog) { public CtcRunPlanVO(CtcStationRunPlanLog ctcStationRunPlanLog) {
this.code = ctcStationRunPlanLog.getCode(); this.code = ctcStationRunPlanLog.getCode();
if (ctcStationRunPlanLog.getStation() != null) { if (ctcStationRunPlanLog.getStation() != null) {
@ -71,19 +112,31 @@ public class CtcRunPlanVO {
this.tripNumber = ctcStationRunPlanLog.getTripNumber(); this.tripNumber = ctcStationRunPlanLog.getTripNumber();
this.remark = ctcStationRunPlanLog.getRemark(); this.remark = ctcStationRunPlanLog.getRemark();
this.lateReason = ctcStationRunPlanLog.getLateReason(); this.lateReason = ctcStationRunPlanLog.getLateReason();
this.planProperties = ctcStationRunPlanLog.getPlanProperties(); this.delete = ctcStationRunPlanLog.getDelete(); // 删除
if (ctcStationRunPlanLog.getArriveRunPlan() != null) { this.keyTrains = ctcStationRunPlanLog.getKeyTrains(); // 重点列车
this.military = ctcStationRunPlanLog.getMilitary(); // 军用
this.transfinite = ctcStationRunPlanLog.getTransfinite(); // 超限等级
this.trackDiscordant = ctcStationRunPlanLog.getTrackDiscordant(); // 运行股道与基本径路不一致
this.entryOutDiscordant = ctcStationRunPlanLog.getEntryOutDiscordant(); // 出入口与基本径路不一致
this.passenger = ctcStationRunPlanLog.getPassenger(); // 客运车
this.runPlanTaskList = ctcStationRunPlanLog.getRunPlanTaskList(); // 列车运行计划作业
if (ctcStationRunPlanLog.getArriveRunPlan() != null) { // 到达计划
this.arriveRunPlan = new RunPlanItem(ctcStationRunPlanLog.getArriveRunPlan()); this.arriveRunPlan = new RunPlanItem(ctcStationRunPlanLog.getArriveRunPlan());
if (ctcStationRunPlanLog.getArriveRunPlan().getElectrical() != null) {
this.electrical = ctcStationRunPlanLog.getArriveRunPlan().getElectrical();
}
} }
if (ctcStationRunPlanLog.getDepartRunPlan() != null) { if (ctcStationRunPlanLog.getDepartRunPlan() != null) { // 发车计划
this.departRunPlan = new RunPlanItem(ctcStationRunPlanLog.getDepartRunPlan()); this.departRunPlan = new RunPlanItem(ctcStationRunPlanLog.getDepartRunPlan());
if (ctcStationRunPlanLog.getDepartRunPlan().getElectrical() != null) {
this.electrical = this.electrical || ctcStationRunPlanLog.getDepartRunPlan().getElectrical();
}
} }
if (ctcStationRunPlanLog.isDelete()) { if (this.electrical != null) {
this.delete = ctcStationRunPlanLog.isDelete(); this.planProperties = this.electrical ? "电力;" : "";
} }
} }
@Getter @Getter
@Setter @Setter
public class RunPlanItem { public class RunPlanItem {