【大铁行驶区段占用BUG修复】
【车务管理终端后端修改、移除、发布功能逻辑】
This commit is contained in:
parent
d57c2f6c58
commit
8ef0eafd69
@ -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.Section;
|
||||
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.vr.VirtualRealityTrain;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -110,7 +111,7 @@ public class AtpSectionService {
|
||||
if (section.isSwitchAxleCounterSection()) {
|
||||
Section switchSection = section.getLogicList().get(0);
|
||||
if (switchSingleHandle) {
|
||||
atpSectionList.addAll(switchSection.getSwitchAxleSectionsBySwitchPositionBySwitchSingleHandle());
|
||||
atpSectionList.addAll(handleSingleSwitchPosition(section, right));
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +118,6 @@ public class CtcStationRunPlanLogService {
|
||||
stationRunPlanMap.put(tripNumber, p);
|
||||
runPlanLogList.add(p);
|
||||
}
|
||||
|
||||
});
|
||||
// 发送消息
|
||||
ctcLogicLoop.sendCtcRunPlanMessage(simulation.getId(), runPlanLogList,
|
||||
@ -155,8 +154,8 @@ public class CtcStationRunPlanLogService {
|
||||
* @param tripNumberList 车次
|
||||
*/
|
||||
public void removeRunPlanFromEditArea(Simulation simulation, String stationCode, List<String> tripNumberList) {
|
||||
Map<String, CtcRunPlanParam> stationRunLogTripNumberMap = simulation.getCtcRepository().getSimulationRunPlanEditAreaMap()
|
||||
.getOrDefault(stationCode, new ConcurrentHashMap<>());
|
||||
Map<String, CtcRunPlanParam> stationRunLogTripNumberMap = simulation.getCtcRepository()
|
||||
.getSimulationRunPlanEditAreaMap().getOrDefault(stationCode, new ConcurrentHashMap<>());
|
||||
tripNumberList.forEach(tripNumber -> stationRunLogTripNumberMap.remove(tripNumber));
|
||||
// 发送消息
|
||||
ctcLogicLoop.sendCtcRunPlanMessage(simulation.getId(), tripNumberList,
|
||||
@ -172,14 +171,13 @@ public class CtcStationRunPlanLogService {
|
||||
public void releaseRunPlanToSimulation(Simulation simulation, String stationCode) {
|
||||
// 移除生效区中车站的所有计划(包括原始计划)
|
||||
simulation.getCtcRepository().removeRunPlanByStationCode(stationCode);
|
||||
Map<String, CtcRunPlanParam> planParamMap = simulation.getCtcRepository().getSimulationRunPlanEditAreaMap()
|
||||
.getOrDefault(stationCode, new ConcurrentHashMap<>());
|
||||
Map<String, CtcRunPlanParam> planParamMap = simulation.getCtcRepository()
|
||||
.getSimulationRunPlanEditAreaMap().getOrDefault(stationCode, new ConcurrentHashMap<>());
|
||||
// 添加至仿真CTC运行计划中
|
||||
List<CtcStationRunPlanLog> runPlanLogList = new LinkedList<>();
|
||||
planParamMap.forEach((k, p) -> {
|
||||
CtcStationRunPlanLog runPlanLog = createRunPlanLog(simulation, stationCode, p);
|
||||
runPlanLog.setOrigin(true);
|
||||
simulation.getCtcRepository().addRunPlanToOriginMap(runPlanLog);
|
||||
simulation.getCtcRepository().addRunPlanToSimulationMap(runPlanLog);
|
||||
runPlanLogList.add(runPlanLog);
|
||||
});
|
||||
coverRunPlanMessage(simulation, runPlanLogList);
|
||||
@ -359,11 +357,11 @@ public class CtcStationRunPlanLogService {
|
||||
*/
|
||||
public void removeRunPlan(Simulation simulation, String stationCode, String runPlanCode) {
|
||||
CtcStationRunPlanLog ctcStationRunPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode);
|
||||
if (!Objects.equals(ctcStationRunPlanLog.isDelete(), true)) {
|
||||
ctcStationRunPlanLog.setDelete(true);
|
||||
if (!Objects.equals(ctcStationRunPlanLog.getDelete(), Boolean.TRUE)) {
|
||||
ctcStationRunPlanLog.setDelete(Boolean.TRUE);
|
||||
CtcStationRunPlanLog changeRunPlanLog = new CtcStationRunPlanLog();
|
||||
changeRunPlanLog.setCode(runPlanCode);
|
||||
changeRunPlanLog.setDelete(true);
|
||||
changeRunPlanLog.setDelete(Boolean.TRUE);
|
||||
sendRunPlanChangeMessage(simulation, Arrays.asList(changeRunPlanLog));
|
||||
}
|
||||
}
|
||||
@ -380,8 +378,8 @@ public class CtcStationRunPlanLogService {
|
||||
CtcStationRunPlanLog changeRunPlanLog = new CtcStationRunPlanLog();
|
||||
boolean change = false;
|
||||
if (planParam.getStatus() == -1) {
|
||||
runPlanLog.setDelete(true);
|
||||
changeRunPlanLog.setDelete(true);
|
||||
runPlanLog.setDelete(Boolean.TRUE);
|
||||
changeRunPlanLog.setDelete(Boolean.TRUE);
|
||||
change = true;
|
||||
}
|
||||
CtcStationRunPlanLog.RunPlanItem changeArriveItem =
|
||||
|
@ -99,9 +99,9 @@ public class CtcRepository {
|
||||
* @param stationCode 车站编码
|
||||
*/
|
||||
public void removeRunPlanByStationCode(String stationCode) {
|
||||
this.originRunPlanMap.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());
|
||||
}
|
||||
|
||||
|
@ -77,40 +77,40 @@ public class CtcStationRunPlanLog {
|
||||
*/
|
||||
private List<RunPlanTask> runPlanTaskList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private boolean delete;
|
||||
|
||||
/**
|
||||
* 是否原始数据
|
||||
*/
|
||||
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) {
|
||||
this.paramInfo = paramInfo;
|
||||
|
@ -822,24 +822,6 @@ public class Section extends DelayUnlockDevice {
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判定为非通信车占用
|
||||
*
|
||||
|
@ -386,6 +386,6 @@ public enum WebSocketMessageType {
|
||||
* 仿真编辑区运行计划覆盖
|
||||
*/
|
||||
SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_COVER,
|
||||
/** ------------ CTC消息信息 ------- */
|
||||
/** ------------ CTC消息信息 ----------- */
|
||||
;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* CTC运行计划消息实体
|
||||
@ -62,6 +63,46 @@ public class CtcRunPlanVO {
|
||||
*/
|
||||
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) {
|
||||
this.code = ctcStationRunPlanLog.getCode();
|
||||
if (ctcStationRunPlanLog.getStation() != null) {
|
||||
@ -71,18 +112,30 @@ public class CtcRunPlanVO {
|
||||
this.tripNumber = ctcStationRunPlanLog.getTripNumber();
|
||||
this.remark = ctcStationRunPlanLog.getRemark();
|
||||
this.lateReason = ctcStationRunPlanLog.getLateReason();
|
||||
this.planProperties = ctcStationRunPlanLog.getPlanProperties();
|
||||
if (ctcStationRunPlanLog.getArriveRunPlan() != null) {
|
||||
this.delete = ctcStationRunPlanLog.getDelete(); // 删除
|
||||
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());
|
||||
if (ctcStationRunPlanLog.getArriveRunPlan().getElectrical() != null) {
|
||||
this.electrical = ctcStationRunPlanLog.getArriveRunPlan().getElectrical();
|
||||
}
|
||||
if (ctcStationRunPlanLog.getDepartRunPlan() != null) {
|
||||
}
|
||||
if (ctcStationRunPlanLog.getDepartRunPlan() != null) { // 发车计划
|
||||
this.departRunPlan = new RunPlanItem(ctcStationRunPlanLog.getDepartRunPlan());
|
||||
}
|
||||
if (ctcStationRunPlanLog.isDelete()) {
|
||||
this.delete = ctcStationRunPlanLog.isDelete();
|
||||
if (ctcStationRunPlanLog.getDepartRunPlan().getElectrical() != null) {
|
||||
this.electrical = this.electrical || ctcStationRunPlanLog.getDepartRunPlan().getElectrical();
|
||||
}
|
||||
}
|
||||
if (this.electrical != null) {
|
||||
this.planProperties = this.electrical ? "电力;" : "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
Loading…
Reference in New Issue
Block a user