【调度台运行日志信息操作】

【运行日志签收】
【运行日志重置功能】
This commit is contained in:
weizhihong 2022-06-27 16:58:26 +08:00
parent 54e73fffe4
commit de3435cfd9
14 changed files with 672 additions and 460 deletions

View File

@ -6,6 +6,7 @@ import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandler
import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.CtcRunPlanParam; import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.CtcRunPlanParam;
import club.joylink.rtss.simulation.cbtc.ATS.service.runplan.CtcZoneService; import club.joylink.rtss.simulation.cbtc.ATS.service.runplan.CtcZoneService;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.map.StationDirection;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -38,12 +39,12 @@ public class CtcZoneOperateHandler {
* @param simulation 仿真 * @param simulation 仿真
* @param stationCode 车站编码 * @param stationCode 车站编码
* @param runPlanCode 运行计划编码 * @param runPlanCode 运行计划编码
* @param arriveSection 到达股道 * @param sectionCode 股道
* @param departSection 发车股道 * @param model 接发
*/ */
@OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_TRACK_SECTION) @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_TRACK_SECTION)
public void saveTrackSection(Simulation simulation, String stationCode, String runPlanCode, String arriveSection, String departSection) { public void saveTrackSection(Simulation simulation, String stationCode, String runPlanCode, String sectionCode, StationDirection.ReceiveAndDeliverModel model) {
ctcZoneService.saveTrackSection(simulation, stationCode, runPlanCode, arriveSection, departSection); ctcZoneService.saveTrackSection(simulation, stationCode, runPlanCode, sectionCode, model);
} }
/** /**
@ -52,12 +53,12 @@ public class CtcZoneOperateHandler {
* @param simulation 仿真 * @param simulation 仿真
* @param stationCode 车站编码 * @param stationCode 车站编码
* @param runPlanCode 运行计划编码 * @param runPlanCode 运行计划编码
* @param arriveTripNumber 到达车次 * @param tripNumber 车次
* @param departTripNumber 发车车次 * @param model 接发
*/ */
@OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_TRIP_NUMBER) @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_TRIP_NUMBER)
public void saveTripNumber(Simulation simulation, String stationCode, String runPlanCode, String arriveTripNumber, String departTripNumber) { public void saveTripNumber(Simulation simulation, String stationCode, String runPlanCode, String tripNumber, StationDirection.ReceiveAndDeliverModel model) {
ctcZoneService.saveTripNumber(simulation, stationCode, runPlanCode, arriveTripNumber, departTripNumber); ctcZoneService.saveTripNumber(simulation, stationCode, runPlanCode, tripNumber, model);
} }
/** /**
@ -66,12 +67,12 @@ public class CtcZoneOperateHandler {
* @param simulation 仿真 * @param simulation 仿真
* @param stationCode 车站编码 * @param stationCode 车站编码
* @param runPlanCode 运行计划编码 * @param runPlanCode 运行计划编码
* @param arriveTime 到达时间 * @param planTime 计划时间
* @param departTime 车时间 * @param model
*/ */
@OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_PLAN_TIME) @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_PLAN_TIME)
public void savePlanTime(Simulation simulation, String stationCode, String runPlanCode, LocalTime arriveTime, LocalTime departTime) { public void savePlanTime(Simulation simulation, String stationCode, String runPlanCode, LocalTime planTime, StationDirection.ReceiveAndDeliverModel model) {
ctcZoneService.savePlanTime(simulation, stationCode, runPlanCode, arriveTime, departTime); ctcZoneService.savePlanTime(simulation, stationCode, runPlanCode, planTime, model);
} }
/** /**
@ -80,12 +81,12 @@ public class CtcZoneOperateHandler {
* @param simulation 仿真 * @param simulation 仿真
* @param stationCode 车站编码 * @param stationCode 车站编码
* @param runPlanCode 运行计划编码 * @param runPlanCode 运行计划编码
* @param arriveDirectionCode 到达方向编码 * @param directionCode 方向编码
* @param departDirectionCode 发车方向编码 * @param model 接发
*/ */
@OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_DIRECTION) @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_DIRECTION)
public void saveDirection(Simulation simulation, String stationCode, String runPlanCode, String arriveDirectionCode, String departDirectionCode) { public void saveDirection(Simulation simulation, String stationCode, String runPlanCode, String directionCode, StationDirection.ReceiveAndDeliverModel model) {
ctcZoneService.saveDirection(simulation, stationCode, runPlanCode, arriveDirectionCode, departDirectionCode); ctcZoneService.saveDirection(simulation, stationCode, runPlanCode, directionCode, model);
} }
/** /**
@ -94,12 +95,12 @@ public class CtcZoneOperateHandler {
* @param simulation 仿真 * @param simulation 仿真
* @param stationCode 车站编码 * @param stationCode 车站编码
* @param runPlanCode 运行计划编码 * @param runPlanCode 运行计划编码
* @param arriveStation 到达方向车站编码 * @param planStationCode 计划方向车站编码
* @param departStation 发车方向车站编码 * @param model 接发
*/ */
@OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_STATION) @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_STATION)
public void saveStation(Simulation simulation, String stationCode, String runPlanCode, String arriveStation, String departStation) { public void saveStation(Simulation simulation, String stationCode, String runPlanCode, String planStationCode, StationDirection.ReceiveAndDeliverModel model) {
ctcZoneService.saveStation(simulation, stationCode, runPlanCode, arriveStation, departStation); ctcZoneService.saveStation(simulation, stationCode, runPlanCode, planStationCode, model);
} }
/** /**

View File

@ -46,11 +46,6 @@ public class CtcRunPlanParam implements Cloneable {
*/ */
private String arriveSectionCode; private String arriveSectionCode;
/**
* 发车股道
*/
private String departSectionCode;
/** /**
* 到达计划时间 * 到达计划时间
*/ */
@ -61,6 +56,31 @@ public class CtcRunPlanParam implements Cloneable {
*/ */
private LocalTime arriveTime; private LocalTime arriveTime;
/**
* 到达车次
*/
private String arriveTripNumber;
/**
* 到达车站
*/
private String arriveStationCode;
/**
* 到达方向编码到达口
*/
private String arriveDirectionCode;
/**
* 始发计划
*/
private Boolean startRunPlan;
/**
* 发车股道
*/
private String departSectionCode;
/** /**
* 发车计划时间 * 发车计划时间
*/ */
@ -71,45 +91,40 @@ public class CtcRunPlanParam implements Cloneable {
*/ */
private LocalTime departTime; private LocalTime departTime;
/**
* 到达车次
*/
private String arriveTripNumber;
/** /**
* 发车车次 * 发车车次
*/ */
private String departTripNumber; private String departTripNumber;
/**
* 到达车站
*/
private String arriveStationCode;
/** /**
* 发车车站 * 发车车站
*/ */
private String departStationCode; private String departStationCode;
/**
* 到达方向编码到达口
*/
private String arriveDirectionCode;
/** /**
* 发向方向编码发车口 * 发向方向编码发车口
*/ */
private String departDirectionCode; private String departDirectionCode;
/**
* 终到计划
*/
private String endRunPlan;
/** /**
* 状态-1删除0修改1添加 * 状态-1删除0修改1添加
*/ */
private int status; private int status;
/** /**
* 客运车 * 电力计划
*/ */
private CtcStationRunPlanLog.PlanPropertiesType passenger; private Boolean electrical;
/**
* 办理客运
*/
private Boolean passenger;
/** /**
* 重点列车 * 重点列车
@ -151,6 +166,16 @@ public class CtcRunPlanParam implements Cloneable {
*/ */
private Map<CtcStationRunPlanLog.RunPlanTask, Integer> runPlanTaskMap = new HashMap<>(); private Map<CtcStationRunPlanLog.RunPlanTask, Integer> runPlanTaskMap = new HashMap<>();
/**
* 列车类型
*/
private TrainType trainType;
/**
* 运行类型
*/
private RunType runType;
/** /**
* 删除时构造实体 * 删除时构造实体
* *
@ -161,6 +186,7 @@ public class CtcRunPlanParam implements Cloneable {
p.setRunPlanCode(this.runPlanCode); p.setRunPlanCode(this.runPlanCode);
p.setStationCode(this.stationCode); p.setStationCode(this.stationCode);
p.setTripNumber(this.tripNumber); p.setTripNumber(this.tripNumber);
p.setGroupNumber(this.getGroupNumber());
p.setRunPlanTaskMap(null); p.setRunPlanTaskMap(null);
return p; return p;
} }
@ -169,11 +195,18 @@ public class CtcRunPlanParam implements Cloneable {
* 生成主键 * 生成主键
*/ */
public void generateRunPlanCodeAndTripNumber() { public void generateRunPlanCodeAndTripNumber() {
this.groupNumber = this.groupNumber != null ? this.groupNumber : String.format("%03d", 1);
this.tripNumber = StringUtils.isEmpty(this.tripNumber) ? this.tripNumber = StringUtils.isEmpty(this.tripNumber) ?
(StringUtils.isEmpty(this.arriveTripNumber) ? this.departTripNumber : this.arriveTripNumber) : this.tripNumber; (StringUtils.isEmpty(this.arriveTripNumber) ? this.departTripNumber : this.arriveTripNumber) : this.tripNumber;
this.runPlanCode = StringUtils.isEmpty(this.runPlanCode) ? (this.groupNumber + this.tripNumber) : this.runPlanCode; this.runPlanCode = StringUtils.isEmpty(this.runPlanCode) ? (this.groupNumber + this.tripNumber) : this.runPlanCode;
} }
/**
* 对比两个计划对象,并修改实际计划
*
* @param modify 修改的
* @return 修改过的字段
*/
public CtcRunPlanParam compareAndChange(CtcRunPlanParam modify) { public CtcRunPlanParam compareAndChange(CtcRunPlanParam modify) {
CtcRunPlanParam runPlanParam = new CtcRunPlanParam(); CtcRunPlanParam runPlanParam = new CtcRunPlanParam();
runPlanParam.setRunPlanCode(modify.getRunPlanCode()); runPlanParam.setRunPlanCode(modify.getRunPlanCode());
@ -208,21 +241,11 @@ public class CtcRunPlanParam implements Cloneable {
runPlanParam.setDepartSectionCode(modify.getDepartSectionCode()); runPlanParam.setDepartSectionCode(modify.getDepartSectionCode());
change = true; change = true;
} }
if (!Objects.equals(this.arrivePlanTime, modify.getArrivePlanTime())) {
this.arrivePlanTime = modify.getArrivePlanTime();
runPlanParam.setArrivePlanTime(modify.getArrivePlanTime());
change = true;
}
if (!Objects.equals(this.arriveTime, modify.getArriveTime())) { if (!Objects.equals(this.arriveTime, modify.getArriveTime())) {
this.arriveTime = modify.getArriveTime(); this.arriveTime = modify.getArriveTime();
runPlanParam.setArriveTime(modify.getArriveTime()); runPlanParam.setArriveTime(modify.getArriveTime());
change = true; change = true;
} }
if (!Objects.equals(this.departPlanTime, modify.getDepartPlanTime())) {
this.departPlanTime = modify.getDepartPlanTime();
runPlanParam.setDepartPlanTime(modify.getDepartPlanTime());
change = true;
}
if (!Objects.equals(this.departTime, modify.getDepartTime())) { if (!Objects.equals(this.departTime, modify.getDepartTime())) {
this.departTime = modify.getDepartTime(); this.departTime = modify.getDepartTime();
runPlanParam.setDepartTime(modify.getDepartTime()); runPlanParam.setDepartTime(modify.getDepartTime());
@ -258,6 +281,84 @@ public class CtcRunPlanParam implements Cloneable {
runPlanParam.setDepartDirectionCode(modify.getDepartDirectionCode()); runPlanParam.setDepartDirectionCode(modify.getDepartDirectionCode());
change = true; change = true;
} }
// 到达计划时间
if (!Objects.equals(this.arrivePlanTime, modify.getArrivePlanTime())) {
this.arrivePlanTime = modify.getArrivePlanTime();
runPlanParam.setArrivePlanTime(modify.getArrivePlanTime());
change = true;
}
// 出发计划时间
if (!Objects.equals(this.departPlanTime, modify.getDepartPlanTime())) {
this.departPlanTime = modify.getDepartPlanTime();
runPlanParam.setDepartPlanTime(modify.getDepartPlanTime());
change = true;
}
// 始发
if (!Objects.equals(this.startRunPlan, modify.getStartRunPlan())) {
this.startRunPlan = modify.getStartRunPlan();
runPlanParam.setStartRunPlan(modify.getStartRunPlan());
change = true;
}
// 终到
if (!Objects.equals(this.endRunPlan, modify.getEndRunPlan())) {
this.endRunPlan = modify.getEndRunPlan();
runPlanParam.setEndRunPlan(modify.getEndRunPlan());
change = true;
}
// 电力计划
if (!Objects.equals(this.electrical, modify.getElectrical())) {
this.electrical = modify.getElectrical();
runPlanParam.setElectrical(modify.getElectrical());
change = true;
}
// 办理客运
if (!Objects.equals(this.passenger, modify.getPassenger())) {
this.passenger = modify.getPassenger();
runPlanParam.setPassenger(modify.getPassenger());
change = true;
}
// 重点列车
if (!Objects.equals(this.keyTrains, modify.getKeyTrains())) {
this.keyTrains = modify.getKeyTrains();
runPlanParam.setKeyTrains(modify.getKeyTrains());
change = true;
}
// 是否军用
if (!Objects.equals(this.military, modify.getMilitary())) {
this.military = modify.getMilitary();
runPlanParam.setMilitary(modify.getMilitary());
change = true;
}
// 运行股道与基本径路不一致
if (!Objects.equals(this.trackDiscordant, modify.getTrackDiscordant())) {
this.trackDiscordant = modify.getTrackDiscordant();
runPlanParam.setTrackDiscordant(modify.getTrackDiscordant());
change = true;
}
// 出入口与基本径路不一致
if (!Objects.equals(this.entryOutDiscordant, modify.getEntryOutDiscordant())) {
this.entryOutDiscordant = modify.getTrackDiscordant();
runPlanParam.setEntryOutDiscordant(modify.getEntryOutDiscordant());
change = true;
}
// 超限等级
if (!Objects.equals(this.transfinite, modify.getTransfinite())) {
this.transfinite = modify.getTransfinite();
runPlanParam.setTransfinite(modify.getTransfinite());
change = true;
}
// 列车类型
if (!Objects.equals(this.trainType, modify.getTrainType())) {
this.trainType = modify.getTrainType();
runPlanParam.setTrainType(modify.getTrainType());
change = true;
}
// 运行类型
if (!Objects.equals(this.runType, modify.getRunType())) {
this.runType = modify.getRunType();
runPlanParam.setRunType(modify.getRunType());
change = true;
}
// 存在不一样的选项 // 存在不一样的选项
Map<CtcStationRunPlanLog.RunPlanTask, Integer> modifyMap = new HashMap<>(); Map<CtcStationRunPlanLog.RunPlanTask, Integer> modifyMap = new HashMap<>();
modify.getRunPlanTaskMap().forEach((k, v) -> { modify.getRunPlanTaskMap().forEach((k, v) -> {
@ -270,9 +371,143 @@ public class CtcRunPlanParam implements Cloneable {
runPlanParam.setRunPlanTaskMap(modifyMap); runPlanParam.setRunPlanTaskMap(modifyMap);
change = true; change = true;
} }
if (!Objects.equals(this.status, modify.getStatus())) {
this.status = modify.getStatus();
runPlanParam.setStatus(modify.getStatus());
change = true;
}
return change ? runPlanParam : null; return change ? runPlanParam : null;
} }
/**
* 对比两个计划对象
*
* @param origin 原有的
* @param modify 修改的
* @return 修改过的字段
*/
public CtcRunPlanParam compareAndChange(CtcRunPlanParam origin, CtcRunPlanParam modify) {
this.setRunPlanCode(modify.getRunPlanCode());
boolean change = false;
if (!Objects.equals(origin.getStationCode(), modify.getStationCode())) {
this.stationCode = modify.getStationCode();
change = true;
}
if (!Objects.equals(origin.getTripNumber(), modify.getTripNumber())) {
this.tripNumber = modify.getTripNumber();
change = true;
}
if (!Objects.equals(origin.getGroupNumber(), modify.getGroupNumber())) {
this.groupNumber = modify.getGroupNumber();
change = true;
}
if (!Objects.equals(origin.getTrackSectionCode(), modify.getTrackSectionCode())) {
this.trackSectionCode = modify.getTrackSectionCode();
change = true;
}
if (!Objects.equals(origin.getArriveSectionCode(), modify.getArriveSectionCode())) {
this.arriveSectionCode = modify.getArriveSectionCode();
change = true;
}
if (!Objects.equals(origin.getDepartSectionCode(), modify.getDepartSectionCode())) {
this.departSectionCode = modify.getDepartSectionCode();
change = true;
}
if (!Objects.equals(origin.getArriveTime(), modify.getArriveTime())) {
this.arriveTime = modify.getArriveTime();
change = true;
}
if (!Objects.equals(origin.getDepartTime(), modify.getDepartTime())) {
this.departTime = modify.getDepartTime();
change = true;
}
if (!Objects.equals(origin.getArriveTripNumber(), modify.getArriveTripNumber())) {
this.arriveTripNumber = modify.getArriveTripNumber();
change = true;
}
if (!Objects.equals(origin.getDepartTripNumber(), modify.getDepartTripNumber())) {
this.departTripNumber = modify.getDepartTripNumber();
change = true;
}
if (!Objects.equals(origin.getArriveStationCode(), modify.getArriveStationCode())) {
this.arriveStationCode = modify.getArriveStationCode();
change = true;
}
if (!Objects.equals(origin.getDepartStationCode(), modify.getDepartStationCode())) {
this.departStationCode = modify.getDepartStationCode();
change = true;
}
if (!Objects.equals(origin.getArriveDirectionCode(), modify.getArriveDirectionCode())) {
this.arriveDirectionCode = modify.getArriveDirectionCode();
change = true;
}
if (!Objects.equals(origin.getDepartDirectionCode(), modify.getDepartDirectionCode())) {
this.departDirectionCode = modify.getDepartDirectionCode();
change = true;
}
// 到达计划时间
if (!Objects.equals(origin.getArrivePlanTime(), modify.getArrivePlanTime())) {
this.arrivePlanTime = modify.getArrivePlanTime();
change = true;
}
// 出发计划时间
if (!Objects.equals(origin.getDepartPlanTime(), modify.getDepartPlanTime())) {
this.departPlanTime = modify.getDepartPlanTime();
change = true;
}
// 始发
if (!Objects.equals(origin.getStartRunPlan(), modify.getStartRunPlan())) {
this.startRunPlan = modify.getStartRunPlan();
change = true;
}
// 终到
if (!Objects.equals(origin.getEndRunPlan(), modify.getEndRunPlan())) {
this.endRunPlan = modify.getEndRunPlan();
change = true;
}
// 电力计划
if (!Objects.equals(origin.getElectrical(), modify.getElectrical())) {
this.electrical = modify.getElectrical();
change = true;
}
// 办理客运
if (!Objects.equals(origin.getPassenger(), modify.getPassenger())) {
this.passenger = modify.getPassenger();
change = true;
}
// 重点列车
if (!Objects.equals(origin.getKeyTrains(), modify.getKeyTrains())) {
this.keyTrains = modify.getKeyTrains();
change = true;
}
// 是否军用
if (!Objects.equals(origin.getMilitary(), modify.getMilitary())) {
this.military = modify.getMilitary();
change = true;
}
// 运行股道与基本径路不一致
if (!Objects.equals(origin.getTrackDiscordant(), modify.getTrackDiscordant())) {
this.trackDiscordant = modify.getTrackDiscordant();
change = true;
}
// 出入口与基本径路不一致
if (!Objects.equals(origin.getEntryOutDiscordant(), modify.getEntryOutDiscordant())) {
this.entryOutDiscordant = modify.getTrackDiscordant();
change = true;
}
// 超限等级
if (!Objects.equals(origin.getTransfinite(), modify.getTransfinite())) {
this.transfinite = modify.getTransfinite();
change = true;
}
// 状态
if (!Objects.equals(origin.getStatus(), modify.getStatus())) {
this.status = modify.getStatus();
change = true;
}
return change ? this : null;
}
@Override @Override
public String toString() { public String toString() {
return "CtcRunPlanParam{" + return "CtcRunPlanParam{" +
@ -313,7 +548,7 @@ public class CtcRunPlanParam implements Cloneable {
* @return 是否存在 * @return 是否存在
*/ */
public boolean arriveIsExist() { public boolean arriveIsExist() {
return this.arrivePlanTime != null || !StringUtils.isEmpty(this.arriveTripNumber) || !StringUtils.isEmpty(this.arriveSectionCode) return this.arriveTime != null || !StringUtils.isEmpty(this.arriveTripNumber) || !StringUtils.isEmpty(this.arriveSectionCode)
|| !StringUtils.isEmpty(this.arriveDirectionCode) || !StringUtils.isEmpty(this.arriveStationCode); || !StringUtils.isEmpty(this.arriveDirectionCode) || !StringUtils.isEmpty(this.arriveStationCode);
} }
@ -323,7 +558,21 @@ public class CtcRunPlanParam implements Cloneable {
* @return 是否存在 * @return 是否存在
*/ */
public boolean departIsExist() { public boolean departIsExist() {
return this.departPlanTime != null || !StringUtils.isEmpty(this.departTripNumber) || !StringUtils.isEmpty(this.departSectionCode) return this.departTime != null || !StringUtils.isEmpty(this.departTripNumber) || !StringUtils.isEmpty(this.departSectionCode)
|| !StringUtils.isEmpty(this.departDirectionCode) || !StringUtils.isEmpty(this.departStationCode); || !StringUtils.isEmpty(this.departDirectionCode) || !StringUtils.isEmpty(this.departStationCode);
} }
/**
* 列车类型
*/
public enum TrainType {
FAST_PASSENGER_TRAIN, // 快速旅客列车
}
/**
* 运行类型
*/
public enum RunType {
FAST_PASSENGER_TRAIN, // 快速旅客列车
}
} }

View File

@ -3,7 +3,9 @@ package club.joylink.rtss.simulation.cbtc.ATS.service.runplan;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.CtcRunPlanParam; import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.CtcRunPlanParam;
import club.joylink.rtss.simulation.cbtc.CTC.CTCService; import club.joylink.rtss.simulation.cbtc.CTC.CTCService;
import club.joylink.rtss.simulation.cbtc.CTC.data.*; import club.joylink.rtss.simulation.cbtc.CTC.data.CtcEffectRepository;
import club.joylink.rtss.simulation.cbtc.CTC.data.CtcStationRunPlanLog;
import club.joylink.rtss.simulation.cbtc.CTC.data.RouteSequence;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
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.Station; import club.joylink.rtss.simulation.cbtc.data.map.Station;
@ -19,7 +21,6 @@ import java.time.LocalTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors;
@Component @Component
@Slf4j @Slf4j
@ -187,24 +188,27 @@ public class CtcStationRunPlanLogService {
public void signForRunPlan(Simulation simulation, String stationCode) { public void signForRunPlan(Simulation simulation, String stationCode) {
CtcEffectRepository effectRepository = simulation.getCtcRepository().getCtcEffectRepository(); CtcEffectRepository effectRepository = simulation.getCtcRepository().getCtcEffectRepository();
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(effectRepository); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(effectRepository);
CtcManageRepository.StationRunPlanRepository stationRunPlanRepository = effectRepository.getStationRunPlanMap().get(stationCode); CtcEffectRepository.CtcStageRunPlanRepository runPlanRepository = effectRepository.getStationStageRunPlanMap().get(stationCode);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(stationRunPlanRepository); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(runPlanRepository);
List<CtcRunPlanParam> runPlanParamList = stationRunPlanRepository.getRunPlanParamMap().values().stream().collect(Collectors.toList()); int curVersion = runPlanRepository.getVersion().get(); // 当前生效区版本
// 如果发生变化,覆盖原有的信息 Integer oldVersion = effectRepository.getStageRunPlanVersionMap().get(stationCode); // 旧版本
stationRunPlanRepository.getRunPlanParamMap().forEach((runPlanCode, ctcRunPlanParam) -> { if (oldVersion == null || curVersion != oldVersion) {
CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode); runPlanRepository.getCtcRunPlanVOList().forEach(ctcRunPlanVO -> {
CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository()
.getRunPlanByRunPlanCodeAndStationCode(stationCode, ctcRunPlanVO.getRunPlanCode());
if (runPlanLog != null) { if (runPlanLog != null) {
CtcRunPlanVO runPlanVO = CtcRunPlanVO.compareAndChange(ctcRunPlanParam, runPlanLog); runPlanLog.setBaseAttribute(ctcRunPlanVO.getOriginRunPlan());
if (runPlanVO != null) { // 到达
runPlanLog.setBaseAttribute(ctcRunPlanParam); modifyRunPlanItemInfo(simulation, runPlanLog.getArriveRunPlan(), ctcRunPlanVO.getOriginRunPlan(), true);
runPlanLog.setArriveRunPlan(CtcStationRunPlanLog.createRunPlanItem(simulation, ctcRunPlanParam, true)); // 出发
runPlanLog.setDepartRunPlan(CtcStationRunPlanLog.createRunPlanItem(simulation, ctcRunPlanParam, false)); modifyRunPlanItemInfo(simulation, runPlanLog.getDepartRunPlan(), ctcRunPlanVO.getOriginRunPlan(), false);
}
} else { } else {
runPlanLog = createRunPlanLog(simulation, stationCode, ctcRunPlanParam); runPlanLog = createRunPlanLog(simulation, stationCode, ctcRunPlanVO.getOriginRunPlan());
simulation.getCtcRepository().addRunPlanToSimulationMap(runPlanLog); simulation.getCtcRepository().addRunPlanToSimulationMap(runPlanLog);
} }
}); });
effectRepository.getStageRunPlanVersionMap().put(stationCode, curVersion);
}
} }
/** /**
@ -225,8 +229,12 @@ public class CtcStationRunPlanLogService {
// 出发 // 出发
change = change || modifyRunPlanItemInfo(simulation, runPlanLog.getDepartRunPlan(), planParam, false); change = change || modifyRunPlanItemInfo(simulation, runPlanLog.getDepartRunPlan(), planParam, false);
// 是否客运 // 是否客运
if (planParam.getPassenger() != null && !Objects.equals(planParam.getPassenger(), runPlanLog.getPassenger())) { if (planParam.getPassenger() != null) {
runPlanLog.setPassenger(planParam.getPassenger()); CtcStationRunPlanLog.PlanPropertiesType planPropertiesType = planParam.getPassenger() ?
CtcStationRunPlanLog.PlanPropertiesType.PASSENGER : null;
if (!Objects.equals(planParam.getPassenger(), runPlanLog.getPassenger())) {
runPlanLog.setPassenger(planPropertiesType);
}
} }
// 重点列车 // 重点列车
if (planParam.getKeyTrains() != null && !Objects.equals(planParam.getKeyTrains(), runPlanLog.getKeyTrains())) { if (planParam.getKeyTrains() != null && !Objects.equals(planParam.getKeyTrains(), runPlanLog.getKeyTrains())) {

View File

@ -2,16 +2,18 @@ package club.joylink.rtss.simulation.cbtc.ATS.service.runplan;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.CtcRunPlanParam; import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.CtcRunPlanParam;
import club.joylink.rtss.simulation.cbtc.CTC.data.CtcEffectRepository; import club.joylink.rtss.simulation.cbtc.CTC.data.*;
import club.joylink.rtss.simulation.cbtc.CTC.data.CtcManageRepository;
import club.joylink.rtss.simulation.cbtc.CTC.data.CtcZone;
import club.joylink.rtss.simulation.cbtc.CTC.data.CtcZoneRepository;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.map.StationDirection;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.time.LocalTime; import java.time.LocalTime;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
@Component @Component
@Slf4j @Slf4j
@ -26,8 +28,9 @@ public class CtcZoneService {
public void saveRunPlan(Simulation simulation, CtcRunPlanParam planParam) { public void saveRunPlan(Simulation simulation, CtcRunPlanParam planParam) {
CtcZoneRepository railwayRepository = simulation.getCtcRepository().getCtcZoneRepository(); CtcZoneRepository railwayRepository = simulation.getCtcRepository().getCtcZoneRepository();
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(railwayRepository); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(railwayRepository);
// 初始化运行计划编码车次信息 if (StringUtils.isEmpty(planParam.getRunPlanCode())) { // 初始化运行计划编码车次信息
planParam.generateRunPlanCodeAndTripNumber(); planParam.generateRunPlanCodeAndTripNumber();
}
railwayRepository.saveRunPlan(planParam); railwayRepository.saveRunPlan(planParam);
} }
@ -37,16 +40,16 @@ public class CtcZoneService {
* @param simulation 仿真 * @param simulation 仿真
* @param stationCode 车站编码 * @param stationCode 车站编码
* @param runPlanCode 运行计划编码 * @param runPlanCode 运行计划编码
* @param arriveSection 到达股道 * @param sectionCode 股道
* @param departSection 发车股道 * @param model 接发
*/ */
public void saveTrackSection(Simulation simulation, String stationCode, String runPlanCode, String arriveSection, String departSection) { public void saveTrackSection(Simulation simulation, String stationCode, String runPlanCode, String sectionCode, StationDirection.ReceiveAndDeliverModel model) {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(sectionCode);
CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode); CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode);
if (!StringUtils.isEmpty(arriveSection)) { if (StationDirection.ReceiveAndDeliverModel.R.equals(model)) {
runPlanParam.setArriveSectionCode(arriveSection); runPlanParam.setArriveSectionCode(sectionCode);
} } else {
if (!StringUtils.isEmpty(departSection)) { runPlanParam.setDepartSectionCode(sectionCode);
runPlanParam.setDepartSectionCode(departSection);
} }
} }
@ -56,16 +59,16 @@ public class CtcZoneService {
* @param simulation 仿真 * @param simulation 仿真
* @param stationCode 车站编码 * @param stationCode 车站编码
* @param runPlanCode 运行计划编码 * @param runPlanCode 运行计划编码
* @param arriveTripNumber 到达车次 * @param tripNumber 车次
* @param departTripNumber 发车车次 * @param model 接发
*/ */
public void saveTripNumber(Simulation simulation, String stationCode, String runPlanCode, String arriveTripNumber, String departTripNumber) { public void saveTripNumber(Simulation simulation, String stationCode, String runPlanCode, String tripNumber, StationDirection.ReceiveAndDeliverModel model) {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(tripNumber);
CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode); CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode);
if (!StringUtils.isEmpty(arriveTripNumber)) { if (StationDirection.ReceiveAndDeliverModel.R.equals(model)) {
runPlanParam.setArriveTripNumber(arriveTripNumber); runPlanParam.setArriveTripNumber(tripNumber);
} } else {
if (!StringUtils.isEmpty(departTripNumber)) { runPlanParam.setDepartTripNumber(tripNumber);
runPlanParam.setDepartTripNumber(departTripNumber);
} }
} }
@ -75,16 +78,16 @@ public class CtcZoneService {
* @param simulation 仿真 * @param simulation 仿真
* @param stationCode 车站编码 * @param stationCode 车站编码
* @param runPlanCode 运行计划编码 * @param runPlanCode 运行计划编码
* @param arriveTime 到达时间 * @param planTime 计划时间
* @param departTime 车时间 * @param model
*/ */
public void savePlanTime(Simulation simulation, String stationCode, String runPlanCode, LocalTime arriveTime, LocalTime departTime) { public void savePlanTime(Simulation simulation, String stationCode, String runPlanCode, LocalTime planTime, StationDirection.ReceiveAndDeliverModel model) {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(planTime);
CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode); CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode);
if (!StringUtils.isEmpty(arriveTime)) { if (StationDirection.ReceiveAndDeliverModel.R.equals(model)) {
runPlanParam.setArrivePlanTime(arriveTime); runPlanParam.setArriveTime(planTime);
} } else {
if (!StringUtils.isEmpty(departTime)) { runPlanParam.setDepartTime(planTime);
runPlanParam.setDepartPlanTime(departTime);
} }
} }
@ -94,16 +97,16 @@ public class CtcZoneService {
* @param simulation 仿真 * @param simulation 仿真
* @param stationCode 车站编码 * @param stationCode 车站编码
* @param runPlanCode 运行计划编码 * @param runPlanCode 运行计划编码
* @param arriveDirectionCode 到达方向编码 * @param runPlanCode 运行计划编码
* @param departDirectionCode 发车方向编码 * @param directionCode 方向编码
*/ */
public void saveDirection(Simulation simulation, String stationCode, String runPlanCode, String arriveDirectionCode, String departDirectionCode) { public void saveDirection(Simulation simulation, String stationCode, String runPlanCode, String directionCode, StationDirection.ReceiveAndDeliverModel model) {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(directionCode);
CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode); CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode);
if (!StringUtils.isEmpty(arriveDirectionCode)) { if (StationDirection.ReceiveAndDeliverModel.R.equals(model)) {
runPlanParam.setArriveDirectionCode(arriveDirectionCode); runPlanParam.setArriveDirectionCode(directionCode);
} } else {
if (!StringUtils.isEmpty(departDirectionCode)) { runPlanParam.setDepartDirectionCode(directionCode);
runPlanParam.setDepartDirectionCode(departDirectionCode);
} }
} }
@ -113,16 +116,16 @@ public class CtcZoneService {
* @param simulation 仿真 * @param simulation 仿真
* @param stationCode 车站编码 * @param stationCode 车站编码
* @param runPlanCode 运行计划编码 * @param runPlanCode 运行计划编码
* @param arriveStation 到达方向车站编码 * @param planStationCode 计划方向车站编码
* @param departStation 发车方向车站编码 * @param model 接发
*/ */
public void saveStation(Simulation simulation, String stationCode, String runPlanCode, String arriveStation, String departStation) { public void saveStation(Simulation simulation, String stationCode, String runPlanCode, String planStationCode, StationDirection.ReceiveAndDeliverModel model) {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(planStationCode);
CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode); CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode);
if (!StringUtils.isEmpty(arriveStation)) { if (StationDirection.ReceiveAndDeliverModel.R.equals(model)) {
runPlanParam.setArriveStationCode(arriveStation); runPlanParam.setArriveStationCode(planStationCode);
} } else {
if (!StringUtils.isEmpty(departStation)) { runPlanParam.setDepartStationCode(planStationCode);
runPlanParam.setDepartStationCode(departStation);
} }
} }
@ -151,12 +154,15 @@ public class CtcZoneService {
.findFirst().orElse(null); .findFirst().orElse(null);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(ctcZone); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(ctcZone);
CtcEffectRepository effectRepository = simulation.getCtcRepository().getCtcEffectRepository(); CtcEffectRepository effectRepository = simulation.getCtcRepository().getCtcEffectRepository();
Set<String> stationCodeSet = new HashSet<>();
ctcZone.getStationList().forEach(station -> { ctcZone.getStationList().forEach(station -> {
stationCodeSet.add(station.getCode());
CtcManageRepository.StationRunPlanRepository runPlanRepository = zoneRepository.getStationRunPlanMap().get(station.getCode()); CtcManageRepository.StationRunPlanRepository runPlanRepository = zoneRepository.getStationRunPlanMap().get(station.getCode());
if (runPlanRepository != null) { if (runPlanRepository != null) {
effectRepository.releaseRunPlanByStationCode(runPlanRepository, simulation.getCorrectSystemTime()); effectRepository.releaseRunPlanByStationCode(runPlanRepository, simulation.getCorrectSystemTime());
} }
}); });
updateStageRunPlan(simulation, stationCodeSet);
} }
/** /**
@ -172,5 +178,39 @@ public class CtcZoneService {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(runPlanRepository); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(runPlanRepository);
CtcEffectRepository effectRepository = simulation.getCtcRepository().getCtcEffectRepository(); CtcEffectRepository effectRepository = simulation.getCtcRepository().getCtcEffectRepository();
effectRepository.releaseRunPlanByStationCode(runPlanRepository, simulation.getCorrectSystemTime()); effectRepository.releaseRunPlanByStationCode(runPlanRepository, simulation.getCorrectSystemTime());
updateStageRunPlan(simulation, stationCode);
}
/**
* 更新至阶段计划
*
* @param simulation 仿真
* @param stationCodeSet 车站编码列表
*/
private void updateStageRunPlan(Simulation simulation, Set<String> stationCodeSet) {
stationCodeSet.forEach(stationCode -> updateStageRunPlan(simulation, stationCode));
}
/**
* 更新至阶段计划
*
* @param simulation 仿真
* @param stationCode 车站编码
*/
private void updateStageRunPlan(Simulation simulation, String stationCode) {
// 生效区的数据
CtcManageRepository.StationRunPlanRepository runPlanRepository = simulation.getCtcRepository().getEffectStationRunPlanMap(stationCode);
List<CtcRunPlanVO> allList = new LinkedList<>();
runPlanRepository.getRunPlanParamMap().forEach((runPlanCode, ctcRunPlanParam) -> {
CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCodeAndStationCode(stationCode, runPlanCode);
CtcRunPlanVO runPlanVO = CtcRunPlanVO.compareAndChange(ctcRunPlanParam, runPlanLog);
if (runPlanVO != null) {
allList.add(runPlanVO);
}
});
if (!allList.isEmpty()) {
simulation.getCtcRepository().releaseRunPlanStagePlan(stationCode, allList, simulation.getCorrectSystemTime()
, runPlanRepository.getVersion().get());
}
} }
} }

View File

@ -314,18 +314,8 @@ public class CTCLogicLoop {
* @param simulation 仿真 * @param simulation 仿真
*/ */
public void sendZoneRunPlanSend(Simulation simulation) { public void sendZoneRunPlanSend(Simulation simulation) {
// 生效区的数据 List<CtcEffectRepository.CtcStageRunPlanRepository> allList
CtcEffectRepository effectRepository = simulation.getCtcRepository().getCtcEffectRepository(); = simulation.getCtcRepository().getCtcEffectRepository().getChangeStageRunPlan();
List<CtcRunPlanVO> allList = new LinkedList<>();
effectRepository.getStationRunPlanMap().forEach((k, v) -> {
v.getRunPlanParamMap().forEach((runPlanCode, ctcRunPlanParam) -> {
CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(k, runPlanCode);
CtcRunPlanVO runPlanVO = CtcRunPlanVO.compareAndChange(ctcRunPlanParam, runPlanLog);
if (runPlanVO != null) {
allList.add(runPlanVO);
}
});
});
if (!CollectionUtils.isEmpty(allList)) { if (!CollectionUtils.isEmpty(allList)) {
sendCtcMessage(simulation.getId(), allList, WebSocketMessageType.SIMULATION_RAILWAY_RUN_PLAN_SEND, simulation.getSimulationUserIds()); sendCtcMessage(simulation.getId(), allList, WebSocketMessageType.SIMULATION_RAILWAY_RUN_PLAN_SEND, simulation.getSimulationUserIds());
} }

View File

@ -1,13 +1,17 @@
package club.joylink.rtss.simulation.cbtc.CTC.data; 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.simulation.cbtc.ATS.operation.vo.CtcRunPlanParam;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/** /**
* CTC生效区数据 * CTC生效区数据
@ -22,6 +26,30 @@ public class CtcEffectRepository {
*/ */
private final Map<String, CtcManageRepository.StationRunPlanRepository> stationRunPlanMap = new ConcurrentHashMap<>(); private final Map<String, CtcManageRepository.StationRunPlanRepository> stationRunPlanMap = new ConcurrentHashMap<>();
/**
* 阶段计划与各车站与生效区
*/
private final Map<String, CtcStageRunPlanRepository> stationStageRunPlanMap = new ConcurrentHashMap<>();
/**
* 阶段计划版本
*/
private final Map<String, Integer> stageRunPlanVersionMap = new HashMap<>();
/**
* 保存运行计划信息
*
* @param runPlanParam 运行计划
*/
public void saveRunPlan(CtcRunPlanParam runPlanParam) {
if (!this.stationRunPlanMap.containsKey(runPlanParam.getStationCode())) {
CtcManageRepository.StationRunPlanRepository repository = new CtcManageRepository.StationRunPlanRepository();
repository.setStationCode(runPlanParam.getStationCode());
this.stationRunPlanMap.put(runPlanParam.getStationCode(), repository);
}
this.stationRunPlanMap.get(runPlanParam.getStationCode()).saveRunPlan(runPlanParam);
}
/** /**
* 单车站发布 * 单车站发布
* *
@ -46,14 +74,97 @@ public class CtcEffectRepository {
} }
/** /**
* 获取生效区运行计划 * 获取车站的运行计划数据
*
* @param stationCode
* @return 运行计划数据
*/
public CtcManageRepository.StationRunPlanRepository getStationRunPlanRepository(String stationCode) {
return this.stationRunPlanMap.get(stationCode);
}
/**
* 发布阶段计划
* *
* @param stationCode 车站编码 * @param stationCode 车站编码
* @return 运行计划 * @param ctcRunPlanVOList 运行计划列表
* @param updateDateTime 更新时间
* @param version 版本
*/ */
public Map<String, CtcRunPlanParam> getStationRunPlanParam(String stationCode) { public void releaseRunPlanStagePlan(String stationCode, List<CtcRunPlanVO> ctcRunPlanVOList
CtcManageRepository.StationRunPlanRepository runPlanRepository = this.getStationRunPlanMap().get(stationCode); , LocalDateTime updateDateTime, int version) {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(runPlanRepository); if (!CollectionUtils.isEmpty(ctcRunPlanVOList)) {
return runPlanRepository.getRunPlanParamMap(); CtcStageRunPlanRepository runPlanRepository = this.stationStageRunPlanMap
.getOrDefault(stationCode, new CtcStageRunPlanRepository(stationCode));
runPlanRepository.setVersion(version);
runPlanRepository.setCtcRunPlanVOList(ctcRunPlanVOList);
runPlanRepository.setUpdateTime(updateDateTime);
this.stationStageRunPlanMap.put(stationCode, runPlanRepository);
}
}
/**
* 获取阶段计划已发布情况
*
* @return 变化的车站
*/
public List<CtcStageRunPlanRepository> getChangeStageRunPlan() {
return this.stationStageRunPlanMap.values().stream()
.filter(r -> this.stageRunPlanVersionMap.get(r.getVersion()) == null
|| this.stageRunPlanVersionMap.get(r.getVersion()) != r.getVersion().get())
.collect(Collectors.toList());
}
/**
* 阶段计划数据
*/
@Getter
@Setter
public class CtcStageRunPlanRepository {
/**
* 车站编码
*/
private String stationCode;
/**
* 当前数据版本
*/
private AtomicInteger version;
/**
* 最近变更时间
*/
private LocalDateTime updateTime;
/**
* 变化的计划列表
*/
private List<CtcRunPlanVO> ctcRunPlanVOList;
public CtcStageRunPlanRepository(String stationCode) {
this.stationCode = stationCode;
this.version = new AtomicInteger(0);
}
public void setVersion(int version) {
this.version.set(version);
}
/**
* 发布计划表
*
* @param ctcRunPlanVOList 计划列表
* @param updateTime 更新时间
*/
public void updateRunPlanList(List<CtcRunPlanVO> ctcRunPlanVOList, LocalDateTime updateTime) {
this.ctcRunPlanVOList = ctcRunPlanVOList;
this.version.incrementAndGet();
this.updateTime = updateTime;
}
}
public void reset() {
this.stationRunPlanMap.clear();
this.stationStageRunPlanMap.clear();
} }
} }

View File

@ -7,6 +7,7 @@ import club.joylink.rtss.simulation.cbtc.CTC.data.vo.RouteSequenceVO;
import club.joylink.rtss.simulation.cbtc.CTC.data.vo.TrackViewVO; import club.joylink.rtss.simulation.cbtc.CTC.data.vo.TrackViewVO;
import lombok.Getter; import lombok.Getter;
import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@ -30,8 +31,8 @@ public class CtcRepository {
* 铁路局的数据包含区段信息用户信息设置的默认信息等 * 铁路局的数据包含区段信息用户信息设置的默认信息等
*/ */
/******************************************* 以下为调度台数据:车站为单位 *********************************************/
/******************************************* 以下为调度台数据:车站为单位 *********************************************/
/** /**
* 数据 * 数据
*/ */
@ -97,12 +98,6 @@ public class CtcRepository {
*/ */
private List<CtcStationRunPlanLog> allRunPlanList = new LinkedList<>(); private List<CtcStationRunPlanLog> allRunPlanList = new LinkedList<>();
/**
* 原始数据中行车计划原始行驶计划数据
* 编码为key
*/
private final Map<String, Map<String, CtcStationRunPlanLog>> originRunPlanMap = new ConcurrentHashMap<>();
/** /**
* 仿真数据中行车计划后期客户添加 * 仿真数据中行车计划后期客户添加
* 编码为key * 编码为key
@ -130,15 +125,14 @@ public class CtcRepository {
trackViewMap.clear(); trackViewMap.clear();
trackViewVOMap.clear(); trackViewVOMap.clear();
// 仿真运行数据直接清空 // 仿真运行数据直接清空
this.simulationRunPlanMap.clear(); this.ctcZoneRepository.reset();
this.ctcZoneRepositoryVO.reset();
this.ctcEffectRepository.reset();
this.manageRepositoryMap.clear();
this.ctcManageRepositoryVO.reset();
this.allRunPlanList.clear(); this.allRunPlanList.clear();
// 重置原始数据 this.simulationRunPlanMap.clear();
this.originRunPlanMap.values().forEach(runPlanMap -> runPlanMap.values().forEach(runPlan -> { this.runPlanStatusVOMap.clear(); // 运行计划状态清除
runPlan.reset();
this.allRunPlanList.add(runPlan);
}));
// 运行计划状态清除
this.runPlanStatusVOMap.clear();
dispatchCommandIdGenerator = new AtomicInteger(0); dispatchCommandIdGenerator = new AtomicInteger(0);
dispatchCommandSet.clear(); dispatchCommandSet.clear();
} }
@ -162,26 +156,6 @@ public class CtcRepository {
runPlanLogList.forEach(this::addRunPlanToSimulationMap); runPlanLogList.forEach(this::addRunPlanToSimulationMap);
} }
/**
* 添加至初始数据中的行车计划
*/
public void addRunPlanToOriginMap(CtcStationRunPlanLog runPlanLog) {
String stationCode = runPlanLog.getStation().getCode();
// 编码为Key
Map<String, CtcStationRunPlanLog> stationRunLogMap =
this.originRunPlanMap.getOrDefault(stationCode, new ConcurrentHashMap<>(64));
stationRunLogMap.put(runPlanLog.getCode(), runPlanLog);
this.originRunPlanMap.put(stationCode, stationRunLogMap);
this.allRunPlanList.add(runPlanLog);
}
/**
* 添加至仿真中的行车计划
*/
public void addRunPlanListToOriginMap(List<CtcStationRunPlanLog> runPlanLogList) {
runPlanLogList.forEach(this::addRunPlanToOriginMap);
}
/** /**
* 移除车站的所有运行计划 * 移除车站的所有运行计划
*/ */
@ -204,6 +178,35 @@ public class CtcRepository {
return planLog; return planLog;
} }
public CtcStationRunPlanLog getRunPlanByRunPlanCodeAndStationCode(String stationCode, String runPlanCode) {
// 运行计划集合
Map<String, CtcStationRunPlanLog> runPlanLogMap = this.simulationRunPlanMap.getOrDefault(stationCode, new HashMap<>());
return runPlanLogMap.get(runPlanCode);
}
/**
* 获取生效区
*
* @param stationCode 车站编码
* @return 车站生效区的运行计划
*/
public CtcManageRepository.StationRunPlanRepository getEffectStationRunPlanMap(String stationCode) {
return this.ctcEffectRepository.getStationRunPlanRepository(stationCode);
}
/**
* 发布至阶段数据
*
* @param stationCode 车站编码
* @param ctcRunPlanVOList 运行计划列表
* @param updateDateTime 更新时间
* @param version 版本
*/
public void releaseRunPlanStagePlan(String stationCode, List<CtcRunPlanVO> ctcRunPlanVOList
, LocalDateTime updateDateTime, int version) {
this.ctcEffectRepository.releaseRunPlanStagePlan(stationCode, ctcRunPlanVOList, updateDateTime, version);
}
/** /**
* 根据车次获取运行计划 * 根据车次获取运行计划
*/ */

View File

@ -3,9 +3,6 @@ package club.joylink.rtss.simulation.cbtc.CTC.data;
import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.CtcRunPlanParam; import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.CtcRunPlanParam;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.util.StringUtils;
import java.util.Objects;
/** /**
* 阶段对比 * 阶段对比
@ -24,7 +21,7 @@ public class CtcRunPlanVO {
private String runPlanCode; private String runPlanCode;
/** /**
* 原始运行计划 * 当前运行计划
*/ */
private CtcRunPlanParam originRunPlan; private CtcRunPlanParam originRunPlan;
@ -47,165 +44,12 @@ public class CtcRunPlanVO {
* @param runPlanLog 行车日志 * @param runPlanLog 行车日志
*/ */
public static CtcRunPlanVO compareAndChange(CtcRunPlanParam runPlanParam, CtcStationRunPlanLog runPlanLog) { public static CtcRunPlanVO compareAndChange(CtcRunPlanParam runPlanParam, CtcStationRunPlanLog runPlanLog) {
CtcRunPlanParam changeRunPlan = new CtcRunPlanParam();
if (runPlanLog == null) {
return new CtcRunPlanVO(runPlanParam);
}
boolean change = false;
// 到达信息
if (runPlanParam.arriveIsExist()) {
if (runPlanLog.getArriveRunPlan() != null) {
CtcStationRunPlanLog.RunPlanItem runPlanItem = runPlanLog.getArriveRunPlan();
// 计划时间
if (!Objects.equals(runPlanParam.getArrivePlanTime(), runPlanItem.getPlanTime())) {
changeRunPlan.setArrivePlanTime(runPlanParam.getArrivePlanTime());
change = true;
}
// 车次
if (!Objects.equals(runPlanParam.getArriveTripNumber(), runPlanItem.getTripNumber())) {
changeRunPlan.setArriveTripNumber(runPlanParam.getArriveTripNumber());
change = true;
}
// 股道
if (runPlanItem.getTrackSection() == null && !StringUtils.isEmpty(runPlanParam.getArriveSectionCode())) {
changeRunPlan.setArriveSectionCode(runPlanParam.getArriveSectionCode());
change = true;
} else if (runPlanItem.getTrackSection() != null
&& !Objects.equals(runPlanParam.getArriveSectionCode(), runPlanItem.getTrackSection().getCode())) {
changeRunPlan.setArriveSectionCode(runPlanParam.getArriveSectionCode());
change = true;
}
// 车站
if (runPlanItem.getStation() == null && !StringUtils.isEmpty(runPlanParam.getArriveStationCode())) {
changeRunPlan.setArriveStationCode(runPlanParam.getArriveStationCode());
change = true;
} else if (runPlanItem.getStation() != null
&& !Objects.equals(runPlanParam.getArriveStationCode(), runPlanItem.getStation().getCode())) {
changeRunPlan.setArriveStationCode(runPlanParam.getArriveStationCode());
change = true;
}
// 出入口
if (runPlanItem.getStationDirection() == null && !StringUtils.isEmpty(runPlanParam.getArriveDirectionCode())) {
changeRunPlan.setArriveDirectionCode(runPlanParam.getArriveDirectionCode());
change = true;
} else if (runPlanItem.getStation() != null
&& !Objects.equals(runPlanParam.getArriveDirectionCode(), runPlanItem.getStationDirection().getCode())) {
changeRunPlan.setArriveDirectionCode(runPlanParam.getArriveDirectionCode());
change = true;
}
} else {
changeRunPlan.setArrivePlanTime(runPlanParam.getArrivePlanTime());
changeRunPlan.setArriveTripNumber(runPlanParam.getArriveTripNumber());
changeRunPlan.setArriveSectionCode(runPlanParam.getArriveSectionCode());
changeRunPlan.setArriveDirectionCode(runPlanParam.getArriveDirectionCode());
changeRunPlan.setArriveStationCode(runPlanParam.getArriveStationCode());
change = true;
}
} else {
change = runPlanLog.getArriveRunPlan() != null;
}
// 出发时间
if (runPlanParam.departIsExist()) {
if (runPlanLog.getDepartRunPlan() != null) {
CtcStationRunPlanLog.RunPlanItem runPlanItem = runPlanLog.getDepartRunPlan();
// 计划时间
if (!Objects.equals(runPlanParam.getDepartPlanTime(), runPlanItem.getPlanTime())) {
changeRunPlan.setDepartPlanTime(runPlanParam.getDepartPlanTime());
change = true;
}
// 车次
if (!Objects.equals(runPlanParam.getDepartTripNumber(), runPlanItem.getTripNumber())) {
changeRunPlan.setDepartTripNumber(runPlanParam.getDepartTripNumber());
change = true;
}
// 股道
if (runPlanItem.getTrackSection() == null && !StringUtils.isEmpty(runPlanParam.getDepartSectionCode())) {
changeRunPlan.setDepartSectionCode(runPlanParam.getDepartSectionCode());
change = true;
} else if (runPlanItem.getTrackSection() != null
&& !Objects.equals(runPlanParam.getDepartSectionCode(), runPlanItem.getTrackSection().getCode())) {
changeRunPlan.setDepartSectionCode(runPlanParam.getDepartSectionCode());
change = true;
}
// 车站
if (runPlanItem.getStation() == null && !StringUtils.isEmpty(runPlanParam.getDepartStationCode())) {
changeRunPlan.setDepartStationCode(runPlanParam.getDepartStationCode());
change = true;
} else if (runPlanItem.getStation() != null
&& !Objects.equals(runPlanParam.getDepartStationCode(), runPlanItem.getStation().getCode())) {
changeRunPlan.setDepartStationCode(runPlanParam.getDepartStationCode());
change = true;
}
// 出入口
if (runPlanItem.getStationDirection() == null && !StringUtils.isEmpty(runPlanParam.getDepartDirectionCode())) {
changeRunPlan.setDepartDirectionCode(runPlanParam.getDepartDirectionCode());
change = true;
} else if (runPlanItem.getStation() != null
&& !Objects.equals(runPlanParam.getDepartDirectionCode(), runPlanItem.getStationDirection().getCode())) {
changeRunPlan.setDepartDirectionCode(runPlanParam.getDepartDirectionCode());
change = true;
}
} else {
changeRunPlan.setDepartPlanTime(runPlanParam.getDepartPlanTime());
changeRunPlan.setDepartTripNumber(runPlanParam.getDepartTripNumber());
changeRunPlan.setDepartSectionCode(runPlanParam.getDepartSectionCode());
changeRunPlan.setDepartDirectionCode(runPlanParam.getDepartDirectionCode());
changeRunPlan.setDepartStationCode(runPlanParam.getDepartStationCode());
change = true;
}
} else {
change = runPlanLog.getDepartRunPlan() != null;
}
// 车次
if (!Objects.equals(runPlanParam.getGroupNumber(), runPlanLog.getGroupNumber())) {
changeRunPlan.setGroupNumber(runPlanParam.getGroupNumber());
change = true;
}
// 股道信息
if (!Objects.equals(runPlanParam.getTrackSectionCode(), runPlanLog.getTrackSectionCode())) {
changeRunPlan.setTrackSectionCode(runPlanParam.getTrackSectionCode());
change = true;
}
// 是否删除
if (!Objects.equals(runPlanParam.getStatus() == -1, runPlanLog.getDelete())) {
changeRunPlan.setStatus(runPlanParam.getStatus());
change = true;
}
// 客运车
if (!Objects.equals(runPlanParam.getPassenger(), runPlanLog.getPassenger())) {
changeRunPlan.setPassenger(runPlanParam.getPassenger());
change = true;
}
// 重点列车
if (!Objects.equals(runPlanParam.getKeyTrains(), runPlanLog.getKeyTrains())) {
changeRunPlan.setKeyTrains(runPlanParam.getKeyTrains());
change = true;
}
// 军用
if (!Objects.equals(runPlanParam.getMilitary(), runPlanLog.getMilitary())) {
changeRunPlan.setMilitary(runPlanParam.getMilitary());
change = true;
}
// 运行股道与基本径路不一致
if (!Objects.equals(runPlanParam.getTrackDiscordant(), runPlanLog.getTrackDiscordant())) {
changeRunPlan.setTrackDiscordant(runPlanParam.getTrackDiscordant());
change = true;
}
// 出入口与基本径路不一致
if (!Objects.equals(runPlanParam.getEntryOutDiscordant(), runPlanLog.getEntryOutDiscordant())) {
changeRunPlan.setEntryOutDiscordant(runPlanParam.getEntryOutDiscordant());
change = true;
}
// 超限等级
if (!Objects.equals(runPlanParam.getTransfinite(), runPlanLog.getTransfinite())) {
changeRunPlan.setTransfinite(runPlanParam.getTransfinite());
change = true;
}
if (change) {
CtcRunPlanVO runPlanVO = new CtcRunPlanVO(runPlanParam); CtcRunPlanVO runPlanVO = new CtcRunPlanVO(runPlanParam);
runPlanVO.setChangeRunPlan(changeRunPlan); if (runPlanLog == null) {
return runPlanVO; return runPlanVO;
} }
return null; CtcRunPlanParam changeRunPlan = new CtcRunPlanParam().compareAndChange(runPlanLog.getPlanParam(), runPlanParam);
runPlanVO.setChangeRunPlan(changeRunPlan);
return changeRunPlan != null ? runPlanVO : null;
} }
} }

View File

@ -139,7 +139,9 @@ public class CtcStationRunPlanLog {
public void setBaseAttribute(CtcRunPlanParam paramInfo) { public void setBaseAttribute(CtcRunPlanParam paramInfo) {
this.tripNumber = paramInfo.getTripNumber(); this.tripNumber = paramInfo.getTripNumber();
this.trackSectionCode = paramInfo.getTrackSectionCode(); this.trackSectionCode = paramInfo.getTrackSectionCode();
this.passenger = paramInfo.getPassenger(); // 是否客运 if (paramInfo.getPassenger() != null && paramInfo.getPassenger()) {
this.passenger = PlanPropertiesType.PASSENGER; // 是否客运
}
this.keyTrains = paramInfo.getKeyTrains(); // 重点列车 this.keyTrains = paramInfo.getKeyTrains(); // 重点列车
this.military = paramInfo.getMilitary(); // 是否军用 this.military = paramInfo.getMilitary(); // 是否军用
this.trackDiscordant = paramInfo.getTrackDiscordant(); // 运行股道与基本径路不一致 this.trackDiscordant = paramInfo.getTrackDiscordant(); // 运行股道与基本径路不一致
@ -153,25 +155,6 @@ public class CtcStationRunPlanLog {
} }
} }
public void reset() {
this.remark = null;
this.lateReason = null;
this.planProperties = null;
// 运行任务复位
if (!CollectionUtils.isEmpty(this.runPlanTaskItemMap)) {
this.runPlanTaskItemMap.forEach((k, v) -> v.reset());
}
if (this.arriveRunPlan != null) {
this.arriveRunPlan.setRunModel(StationDirection.ReceiveAndDeliverModel.R);
this.arriveRunPlan.reset();
}
if (this.departRunPlan != null) {
this.departRunPlan.setRunModel(StationDirection.ReceiveAndDeliverModel.D);
this.departRunPlan.reset();
}
this.delete = false;
}
public void finishReceivingNotice() { public void finishReceivingNotice() {
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(arriveRunPlan); BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(arriveRunPlan);
arriveRunPlan.setAdjacentMessage(RunPlanItem.FINISH); arriveRunPlan.setAdjacentMessage(RunPlanItem.FINISH);
@ -255,21 +238,11 @@ public class CtcStationRunPlanLog {
*/ */
private Station station; private Station station;
/**
* 默认的邻近车站
*/
private Station defaultStation;
/** /**
* 股道区段发车股道目标(站台), 倒车计划目标区段发车计划起始区段 * 股道区段发车股道目标(站台), 倒车计划目标区段发车计划起始区段
*/ */
private Section trackSection; private Section trackSection;
/**
* 默认股道区段
*/
private Section defaultTrackSection;
/** /**
* 车次号 * 车次号
*/ */
@ -320,11 +293,6 @@ public class CtcStationRunPlanLog {
*/ */
private StationDirection stationDirection; private StationDirection stationDirection;
/**
* 默认的发车方向
*/
private StationDirection defaultStationDirection;
/** /**
* 列车类型 * 列车类型
*/ */
@ -356,35 +324,6 @@ public class CtcStationRunPlanLog {
this.processTypeMap = new HashMap<>(ProcessType.values().length); this.processTypeMap = new HashMap<>(ProcessType.values().length);
} }
public void reset() {
this.stationDirection = this.defaultStationDirection;
this.station = this.defaultStation;
if (this.stationDirection != null) {
this.right = this.stationDirection.getRight();
this.accessName = this.stationDirection.getName();
this.initAccessName();
} else {
this.accessName = null;
}
if (StationDirection.ReceiveAndDeliverModel.R.equals(this.runModel)) {
this.tripNumber = this.paramInfo.getArriveTripNumber();
this.planTime = this.getParamInfo().getArrivePlanTime();
} else {
this.tripNumber = this.paramInfo.getDepartTripNumber();
this.planTime = this.getParamInfo().getDepartPlanTime();
}
this.trackSection = this.defaultTrackSection;
this.actualTime = null;
this.adjacentStatus = null;
this.adjacentDepart = null;
this.adjacentMessage = NO;
this.occupiedCode = null;
this.adjacentMessageTime = null;
this.trainTypeMap.clear();
this.processTypeMap.clear();
}
public void initAccessName() { public void initAccessName() {
if (StringUtils.isEmpty(this.accessName)) { if (StringUtils.isEmpty(this.accessName)) {
this.accessName = String.format("%s%s(%s)", "甲丙", this.right ? "上行" : "下行", this.station.getName()); this.accessName = String.format("%s%s(%s)", "甲丙", this.right ? "上行" : "下行", this.station.getName());
@ -414,7 +353,6 @@ public class CtcStationRunPlanLog {
runPlanItem = new RunPlanItem(paramInfo); runPlanItem = new RunPlanItem(paramInfo);
Station adjacentStation = simulation.getRepository().getByCode(stationCode, Station.class); Station adjacentStation = simulation.getRepository().getByCode(stationCode, Station.class);
runPlanItem.setStation(adjacentStation); runPlanItem.setStation(adjacentStation);
runPlanItem.setDefaultStation(adjacentStation);
runPlanItem.setTripNumber(tripNumber); runPlanItem.setTripNumber(tripNumber);
// 计划时间 // 计划时间
LocalTime planTime = arrive ? paramInfo.getArrivePlanTime() : paramInfo.getDepartPlanTime(); LocalTime planTime = arrive ? paramInfo.getArrivePlanTime() : paramInfo.getDepartPlanTime();
@ -432,7 +370,6 @@ public class CtcStationRunPlanLog {
if (!StringUtils.isEmpty(sectionCode)) { if (!StringUtils.isEmpty(sectionCode)) {
Section section = simulation.getRepository().getByCode(sectionCode, Section.class); Section section = simulation.getRepository().getByCode(sectionCode, Section.class);
runPlanItem.setTrackSection(section); runPlanItem.setTrackSection(section);
runPlanItem.setDefaultTrackSection(section);
} }
// 接发方向 // 接发方向
StationDirection.ReceiveAndDeliverModel runStatus = arrive ? StationDirection.ReceiveAndDeliverModel runStatus = arrive ?
@ -444,7 +381,6 @@ public class CtcStationRunPlanLog {
StationDirection stationDirection = simulation.getRepository().getByCode(directionCode, StationDirection.class); StationDirection stationDirection = simulation.getRepository().getByCode(directionCode, StationDirection.class);
// 接发状态 // 接发状态
runPlanItem.setStationDirection(stationDirection); runPlanItem.setStationDirection(stationDirection);
runPlanItem.setDefaultStationDirection(stationDirection);
runPlanItem.setAccessName(stationDirection.getName()); runPlanItem.setAccessName(stationDirection.getName());
runPlanItem.setRight(stationDirection.getRight()); runPlanItem.setRight(stationDirection.getRight());
runPlanItem.setRunModel(stationDirection.getDefaultRunStatus()); runPlanItem.setRunModel(stationDirection.getDefaultRunStatus());
@ -454,27 +390,6 @@ public class CtcStationRunPlanLog {
return runPlanItem; return runPlanItem;
} }
/**
* 列车类型
*/
public enum TrainType {
CARS_OPEN_TO_TRAFFIC_HEAVY, // 运用车重车
CARS_OPEN_TO_TRAFFIC_EMPTY, // 运用车空车
CARS_OPEN_TO_TRAFFIC_NO, // 非运用车
CABOOSE, // 守车
}
/**
* 流程类型
*/
public enum ProcessType {
TRAIN_ARRIVE_RETURN, // 列车到达补机返回
CONFIRM_BLOCK, // 承认闭塞
CANCEL_BLOCK, // 取消闭塞
TRACKING_SHUNTING, // 跟踪调车
TRACKING_SHUNTING_FINISH, // 跟踪调车完毕
}
/** /**
* 运行作业类型 * 运行作业类型
*/ */
@ -530,7 +445,7 @@ public class CtcStationRunPlanLog {
public static class RunPlanTaskItem implements Cloneable { public static class RunPlanTaskItem implements Cloneable {
private RunPlanTask type; private RunPlanTask type;
private RunPlanTaskStatus status; private RunPlanTaskStatus status = RunPlanTaskStatus.NO;
public RunPlanTaskItem(RunPlanTask type) { public RunPlanTaskItem(RunPlanTask type) {
this.type = type; this.type = type;
@ -554,10 +469,6 @@ public class CtcStationRunPlanLog {
return change; return change;
} }
public void reset() {
this.status = RunPlanTaskStatus.NO;
}
@Override @Override
public RunPlanTaskItem clone() { public RunPlanTaskItem clone() {
try { try {
@ -575,10 +486,32 @@ public class CtcStationRunPlanLog {
} }
} }
/**
* 列车类型
*/
public enum TrainType {
CARS_OPEN_TO_TRAFFIC_HEAVY, // 运用车重车
CARS_OPEN_TO_TRAFFIC_EMPTY, // 运用车空车
CARS_OPEN_TO_TRAFFIC_NO, // 非运用车
CABOOSE, // 守车
}
/**
* 流程类型
*/
public enum ProcessType {
TRAIN_ARRIVE_RETURN, // 列车到达补机返回
CONFIRM_BLOCK, // 承认闭塞
CANCEL_BLOCK, // 取消闭塞
TRACKING_SHUNTING, // 跟踪调车
TRACKING_SHUNTING_FINISH, // 跟踪调车完毕
}
/** /**
* 超限类型 * 超限类型
*/ */
public enum TransfiniteType { public enum TransfiniteType {
NO, // 不超限
TRANSFINITE_SUPER, // 超级超限 TRANSFINITE_SUPER, // 超级超限
TRANSFINITE_ONE_LEVEL, // 一级超限 TRANSFINITE_ONE_LEVEL, // 一级超限
TRANSFINITE_TWO_LEVEL, // 二级超限 TRANSFINITE_TWO_LEVEL, // 二级超限

View File

@ -64,4 +64,12 @@ public class CtcZoneRepository {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(runPlanParam); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(runPlanParam);
return runPlanParam; return runPlanParam;
} }
/**
* 重置
*/
public void reset() {
this.ctcZoneList.clear();
this.stationRunPlanMap.clear();
}
} }

View File

@ -67,4 +67,8 @@ public class CtcZoneRepositoryVO {
} }
return messageInfo; return messageInfo;
} }
public void reset() {
this.runPlanParamMap.clear();
}
} }

View File

@ -106,4 +106,15 @@ public class CtcManageRepositoryVO {
} }
return messageInfo; return messageInfo;
} }
public void reset() {
this.editAreaTrackSectionVersionMap.clear();
this.editAreaTrackSectionVOMap.clear();
this.editAreaCtcRunPlanVersionMap.clear();
this.editAreaCtcRunPlanParamVOMap.clear();
this.effectAreaTrackSectionVersionMap.clear();
this.effectAreaTrackSectionVOMap.clear();
this.effectAreaCtcRunPlanVersionMap.clear();
this.effectAreaCtcRunPlanParamVOMap.clear();
}
} }

View File

@ -577,7 +577,11 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation<Simulati
this.repository.reset(); this.repository.reset();
this.iscsRepository.reset(); this.iscsRepository.reset();
this.ctcRepository.reset(); this.ctcRepository.reset();
if (this.repository.getConfig().isHasCTC()) {
SimulationBuilder.buildCtcRailwayInfo(this); // 重新
SimulationBuilder.buildCtcStationRunPlanLog(this);
SimulationBuilder.generateRouteSequence(this); // TODO: 2022/6/14 重新考虑重置逻辑 SimulationBuilder.generateRouteSequence(this); // TODO: 2022/6/14 重新考虑重置逻辑
}
this.getSimulationMembers().forEach(member -> member.setCommand(null)); this.getSimulationMembers().forEach(member -> member.setCommand(null));
this.planRunning = false; this.planRunning = false;
if (!CollectionUtils.isEmpty(simulationConversationMap)) { if (!CollectionUtils.isEmpty(simulationConversationMap)) {

View File

@ -99,10 +99,10 @@ public class SimulationBuilder {
loadDepotInOutRoutePath(simulation); loadDepotInOutRoutePath(simulation);
// CTC行车日志数据结构构建 // CTC行车日志数据结构构建
if (simulation.getRepository().getConfig().isHasCTC()) { if (simulation.getRepository().getConfig().isHasCTC()) {
buildCtcRailwayInfo(simulation);
buildCtcStationRunPlanLog(simulation);
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
System.out.println("CTC行车日志耗时" + Duration.between(now, LocalDateTime.now()).getSeconds()); System.out.println("CTC行车日志耗时" + Duration.between(now, LocalDateTime.now()).getSeconds());
buildCtcRailwayInfo(simulation);
buildCtcStationRunPlanLog(simulation);
now = LocalDateTime.now(); now = LocalDateTime.now();
generateRouteSequence(simulation); generateRouteSequence(simulation);
System.out.println("CTC进路序列耗时" + Duration.between(now, LocalDateTime.now()).getSeconds()); System.out.println("CTC进路序列耗时" + Duration.between(now, LocalDateTime.now()).getSeconds());
@ -408,7 +408,7 @@ public class SimulationBuilder {
ctcRunPlanParam.setDepartTripNumber(tripPlan.getTripNumber()); ctcRunPlanParam.setDepartTripNumber(tripPlan.getTripNumber());
ctcRunPlanParam.setStationCode(stationPlan.getStation().getCode()); ctcRunPlanParam.setStationCode(stationPlan.getStation().getCode());
ctcRunPlanParam.setTrackSectionCode(stationPlan.getSection().getCode()); ctcRunPlanParam.setTrackSectionCode(stationPlan.getSection().getCode());
ctcRunPlanParam.setPassenger(CtcStationRunPlanLog.PlanPropertiesType.PASSENGER); ctcRunPlanParam.setPassenger(Boolean.TRUE);
// 到达计划始发站没有到达计划 // 到达计划始发站没有到达计划
if (index > 0) { if (index > 0) {
adjacentStationPlan = tripPlan.getPlanList().get(index - 1); adjacentStationPlan = tripPlan.getPlanList().get(index - 1);
@ -425,9 +425,13 @@ public class SimulationBuilder {
}); });
// 集中中心一份 // 集中中心一份
CtcZoneRepository ctcZoneRepository = simulation.getCtcRepository().getCtcZoneRepository(); CtcZoneRepository ctcZoneRepository = simulation.getCtcRepository().getCtcZoneRepository();
// 生效区一份
CtcEffectRepository ctcEffectRepository = simulation.getCtcRepository().getCtcEffectRepository();
ctcRunPlanParamList.forEach(param -> { ctcRunPlanParamList.forEach(param -> {
// 集中中心增加 // 集中中心增加
ctcZoneRepository.saveRunPlan(param.clone()); ctcZoneRepository.saveRunPlan(param.clone());
// 生效区
ctcEffectRepository.saveRunPlan(param.clone());
// 车务管理终端一份 // 车务管理终端一份
CtcManageRepository ctcManageRepository = simulation.getCtcRepository().getManageRepositoryMap().get(param.getStationCode()); CtcManageRepository ctcManageRepository = simulation.getCtcRepository().getManageRepositoryMap().get(param.getStationCode());
ctcManageRepository.saveRunPlanToEditArea(param.clone()); ctcManageRepository.saveRunPlanToEditArea(param.clone());
@ -439,7 +443,7 @@ public class SimulationBuilder {
runPlanLog.setOrigin(true); runPlanLog.setOrigin(true);
runPlanLog.setArriveRunPlan(CtcStationRunPlanLog.createRunPlanItem(simulation, param, true)); runPlanLog.setArriveRunPlan(CtcStationRunPlanLog.createRunPlanItem(simulation, param, true));
runPlanLog.setDepartRunPlan(CtcStationRunPlanLog.createRunPlanItem(simulation, param, false)); runPlanLog.setDepartRunPlan(CtcStationRunPlanLog.createRunPlanItem(simulation, param, false));
simulation.getCtcRepository().addRunPlanToOriginMap(runPlanLog); simulation.getCtcRepository().addRunPlanToSimulationMap(runPlanLog);
}); });
} }
@ -455,11 +459,13 @@ public class SimulationBuilder {
if (arriveFlag) { if (arriveFlag) {
defaultRunStatus = StationDirection.ReceiveAndDeliverModel.R; defaultRunStatus = StationDirection.ReceiveAndDeliverModel.R;
ctcRunPlanParam.setArrivePlanTime(stationPlan.getArriveTime()); ctcRunPlanParam.setArrivePlanTime(stationPlan.getArriveTime());
// ctcRunPlanParam.setArriveTime(stationPlan.getArriveTime());
ctcRunPlanParam.setArriveStationCode(adjacentStation.getCode()); ctcRunPlanParam.setArriveStationCode(adjacentStation.getCode());
ctcRunPlanParam.setArriveSectionCode(stationPlan.getSection().getCode()); // 停靠股道 ctcRunPlanParam.setArriveSectionCode(stationPlan.getSection().getCode()); // 停靠股道
} else { } else {
defaultRunStatus = StationDirection.ReceiveAndDeliverModel.D; defaultRunStatus = StationDirection.ReceiveAndDeliverModel.D;
ctcRunPlanParam.setDepartPlanTime(stationPlan.getLeaveTime()); ctcRunPlanParam.setDepartPlanTime(stationPlan.getLeaveTime());
// ctcRunPlanParam.setDepartTime(stationPlan.getLeaveTime());
ctcRunPlanParam.setDepartStationCode(adjacentStation.getCode()); ctcRunPlanParam.setDepartStationCode(adjacentStation.getCode());
ctcRunPlanParam.setDepartSectionCode(stationPlan.getSection().getCode()); // 停靠股道 ctcRunPlanParam.setDepartSectionCode(stationPlan.getSection().getCode()); // 停靠股道
} }