【调整行车日志创建逻辑】

【修改没有删除BUG】
This commit is contained in:
weizhihong 2022-06-29 17:37:12 +08:00
parent 77cdd3fd29
commit c693b8dfcc
2 changed files with 30 additions and 25 deletions

View File

@ -2,12 +2,12 @@ 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.service.CTCService;
import club.joylink.rtss.simulation.cbtc.CTC.data.CtcEffectRepository; 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.CtcStationRunPlanLog;
import club.joylink.rtss.simulation.cbtc.CTC.data.RouteSequence; import club.joylink.rtss.simulation.cbtc.CTC.data.RouteSequence;
import club.joylink.rtss.simulation.cbtc.CTC.data.vo.CtcRunPlanVO; import club.joylink.rtss.simulation.cbtc.CTC.data.vo.CtcRunPlanVO;
import club.joylink.rtss.simulation.cbtc.CTC.data.vo.CtcStationRunPlanLogVO; import club.joylink.rtss.simulation.cbtc.CTC.data.vo.CtcStationRunPlanLogVO;
import club.joylink.rtss.simulation.cbtc.CTC.service.CTCService;
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;
@ -222,6 +222,7 @@ public class CtcStationRunPlanLogService {
boolean change = false; boolean change = false;
if (runPlanLog != null) { if (runPlanLog != null) {
runPlanLog.setBaseAttribute(ctcRunPlanVO.getRunPlan()); runPlanLog.setBaseAttribute(ctcRunPlanVO.getRunPlan());
runPlanLog.setDelete(ctcRunPlanVO.getStatus() == -1);
// 到达 // 到达
if (ctcRunPlanVO.getRunPlan().arriveIsExist()) { // 不存在到达信息则直接浮空 if (ctcRunPlanVO.getRunPlan().arriveIsExist()) { // 不存在到达信息则直接浮空
change = modifyRunPlanItemInfo(simulation, runPlanLog.getArriveRunPlan(), ctcRunPlanVO.getRunPlan(), true); change = modifyRunPlanItemInfo(simulation, runPlanLog.getArriveRunPlan(), ctcRunPlanVO.getRunPlan(), true);
@ -243,17 +244,17 @@ public class CtcStationRunPlanLogService {
runPlanLogList.add(runPlanLog); runPlanLogList.add(runPlanLog);
} }
}); });
// 编辑过轨道的行车记录 // 编辑过轨道的行车记录 ,暂时注释
runPlanLogList.stream() // runPlanLogList.stream()
.filter(r -> r.getArriveRunPlan() != null || r.getDepartRunPlan() != null) // .filter(r -> r.getArriveRunPlan() != null || r.getDepartRunPlan() != null)
.forEach(r -> { // .forEach(r -> {
if (r.getArriveRunPlan() != null && r.getArriveRunPlan().getTrackSection() != null) { // if (r.getArriveRunPlan() != null && r.getArriveRunPlan().getTrackSection() != null) {
ctcService.runPlanItemUpdate(simulation, r.getStation(), r.getArriveRunPlan(), false); // ctcService.runPlanItemUpdate(simulation, r.getStation(), r.getArriveRunPlan(), false);
} // }
if (r.getDepartRunPlan() != null && r.getDepartRunPlan().getTrackSection() != null) { // if (r.getDepartRunPlan() != null && r.getDepartRunPlan().getTrackSection() != null) {
ctcService.runPlanItemUpdate(simulation, r.getStation(), r.getDepartRunPlan(), true); // ctcService.runPlanItemUpdate(simulation, r.getStation(), r.getDepartRunPlan(), true);
} // }
}); // });
} }
/** /**

View File

@ -349,10 +349,25 @@ public class CtcStationRunPlanLog {
String stationCode = arrive ? paramInfo.getArriveStationCode() : paramInfo.getDepartStationCode(); String stationCode = arrive ? paramInfo.getArriveStationCode() : paramInfo.getDepartStationCode();
// 车次 // 车次
String tripNumber = arrive ? paramInfo.getArriveTripNumber() : paramInfo.getDepartTripNumber(); String tripNumber = arrive ? paramInfo.getArriveTripNumber() : paramInfo.getDepartTripNumber();
// 运行方向
String directionCode = arrive ? paramInfo.getArriveDirectionCode() : paramInfo.getDepartDirectionCode();
RunPlanItem runPlanItem = null; RunPlanItem runPlanItem = null;
if (!StringUtils.isEmpty(stationCode) && !StringUtils.isEmpty(tripNumber)) { if ((!StringUtils.isEmpty(stationCode) && !StringUtils.isEmpty(tripNumber)) || !StringUtils.isEmpty(directionCode)) {
runPlanItem = new RunPlanItem(paramInfo); runPlanItem = new RunPlanItem(paramInfo);
Station adjacentStation = simulation.getRepository().getByCode(stationCode, Station.class); Station adjacentStation = null;
if (!StringUtils.isEmpty(directionCode)) {
// 出入口
StationDirection stationDirection = simulation.getRepository().getByCode(directionCode, StationDirection.class);
// 接发状态
runPlanItem.setStationDirection(stationDirection);
runPlanItem.setAccessName(stationDirection.getName());
runPlanItem.setRight(stationDirection.getRight());
runPlanItem.setRunModel(stationDirection.getDefaultRunStatus());
runPlanItem.initAccessName();
adjacentStation = stationDirection.getRelativeStationDirection().getStation();
}
// 如果车站信息不为空则用指定车站信息
adjacentStation = StringUtils.isEmpty(stationCode) ? adjacentStation : simulation.getRepository().getByCode(stationCode, Station.class);
runPlanItem.setStation(adjacentStation); runPlanItem.setStation(adjacentStation);
runPlanItem.setTripNumber(tripNumber); runPlanItem.setTripNumber(tripNumber);
// 计划时间 // 计划时间
@ -376,17 +391,6 @@ public class CtcStationRunPlanLog {
StationDirection.ReceiveAndDeliverModel runStatus = arrive ? StationDirection.ReceiveAndDeliverModel runStatus = arrive ?
StationDirection.ReceiveAndDeliverModel.R : StationDirection.ReceiveAndDeliverModel.D; StationDirection.ReceiveAndDeliverModel.R : StationDirection.ReceiveAndDeliverModel.D;
runPlanItem.setRunModel(runStatus); runPlanItem.setRunModel(runStatus);
// 运行方向
String directionCode = arrive ? paramInfo.getArriveDirectionCode() : paramInfo.getDepartDirectionCode();
if (!StringUtils.isEmpty(directionCode)) {
StationDirection stationDirection = simulation.getRepository().getByCode(directionCode, StationDirection.class);
// 接发状态
runPlanItem.setStationDirection(stationDirection);
runPlanItem.setAccessName(stationDirection.getName());
runPlanItem.setRight(stationDirection.getRight());
runPlanItem.setRunModel(stationDirection.getDefaultRunStatus());
runPlanItem.initAccessName();
}
} }
return runPlanItem; return runPlanItem;
} }