【调度台修改实际时间下发后,未变更的行车日志实际时间变化】
【增加计划下发非空判断】
This commit is contained in:
parent
db198ad99d
commit
0f06dce035
@ -281,14 +281,14 @@ public class CtcStationRunPlanLogService {
|
||||
boolean change = false;
|
||||
if (runPlanLog != null) {
|
||||
boolean isFinish = runPlanLog.isFinish();
|
||||
if (!isFinish) { // 如果存在完成流程,则不允许修改,已完成该车次的接发车作业,又收到该接发车时间范围内的阶段计划,不取消红闪
|
||||
if (isFinish) { // 如果存在完成流程,则不允许修改,已完成该车次的接发车作业,又收到该接发车时间范围内的阶段计划,不取消红闪
|
||||
runPlanLog.setTwinkle(true);
|
||||
} else { // 行车计划未完成
|
||||
runPlanLog.setBaseAttribute(modifyParam);
|
||||
runPlanLog.setPlanParam(modifyParam); // 覆盖原有的计划参数
|
||||
// 到达
|
||||
if (modifyParam.arriveIsExist()) { // 不存在到达信息则直接浮空
|
||||
change = modifyRunPlanItemInfo(simulation, runPlanLog.getArriveRunPlan(), modifyParam, true);
|
||||
change = modifyRunPlanItemInfo(simulation, runPlanLog.getArriveRunPlan(), modifyParam, true, true);
|
||||
runPlanLog.getArriveRunPlan().setParamInfo(modifyParam);
|
||||
} else {
|
||||
change = runPlanLog.getArriveRunPlan() != null;
|
||||
@ -296,7 +296,7 @@ public class CtcStationRunPlanLogService {
|
||||
}
|
||||
// 出发
|
||||
if (modifyParam.departIsExist()) {
|
||||
change = change || modifyRunPlanItemInfo(simulation, runPlanLog.getDepartRunPlan(), modifyParam, false);
|
||||
change = change || modifyRunPlanItemInfo(simulation, runPlanLog.getDepartRunPlan(), modifyParam, false, true);
|
||||
runPlanLog.getDepartRunPlan().setParamInfo(modifyParam);
|
||||
} else {
|
||||
change = change || runPlanLog.getDepartRunPlan() != null;
|
||||
@ -553,9 +553,9 @@ public class CtcStationRunPlanLogService {
|
||||
runPlanLog.setDelete(Boolean.TRUE);
|
||||
}
|
||||
// 到达
|
||||
change = modifyRunPlanItemInfo(simulation, runPlanLog.getArriveRunPlan(), planParam, true);
|
||||
change = modifyRunPlanItemInfo(simulation, runPlanLog.getArriveRunPlan(), planParam, true, false);
|
||||
// 出发
|
||||
change = change || modifyRunPlanItemInfo(simulation, runPlanLog.getDepartRunPlan(), planParam, false);
|
||||
change = change || modifyRunPlanItemInfo(simulation, runPlanLog.getDepartRunPlan(), planParam, false, false);
|
||||
// 是否客运
|
||||
if (planParam.getPassenger() != null) {
|
||||
CtcStationRunPlanLog.PlanPropertiesType planPropertiesType = planParam.getPassenger() ?
|
||||
@ -602,21 +602,29 @@ public class CtcStationRunPlanLogService {
|
||||
* @param runPlanItem 接发条目
|
||||
* @param paramInfo 参数
|
||||
* @param arrive 是否到达
|
||||
* @param sign 是否签收操作,签收对实际时间需要做下操作
|
||||
*/
|
||||
private boolean modifyRunPlanItemInfo(Simulation simulation, CtcStationRunPlanLog.RunPlanItem runPlanItem
|
||||
, CtcRunPlanParam paramInfo, boolean arrive) {
|
||||
, CtcRunPlanParam paramInfo, boolean arrive, boolean sign) {
|
||||
boolean change = false;
|
||||
if (runPlanItem != null) {
|
||||
// 计划时间
|
||||
LocalDateTime planTime = arrive ? paramInfo.getArrivePlanTime() : paramInfo.getDepartPlanTime();
|
||||
String oldPlanTime = runPlanItem.getPlanTime().toLocalTime().toString();
|
||||
if (planTime != null && !Objects.equals(planTime, runPlanItem.getPlanTime())) {
|
||||
runPlanItem.setPlanTime(planTime);
|
||||
change = true;
|
||||
}
|
||||
// 实际时间
|
||||
LocalDateTime actualTime = arrive ? paramInfo.getArriveTime() : paramInfo.getDepartTime();
|
||||
if (actualTime != null && !Objects.equals(actualTime.toLocalTime().toString(), runPlanItem.getActualTime())) {
|
||||
runPlanItem.setActualTime(actualTime.toLocalTime().toString());
|
||||
if (actualTime != null) {
|
||||
if (sign) {// 如果是签收动作,在实际情况未改变的情况下,需要改变原来的实际时间
|
||||
if (oldPlanTime.equals(runPlanItem.getActualTime())) {
|
||||
runPlanItem.setActualTime(planTime.toLocalTime().toString());
|
||||
}
|
||||
} else if (!Objects.equals(actualTime.toLocalTime().toString(), runPlanItem.getActualTime())) {
|
||||
runPlanItem.setActualTime(actualTime.toLocalTime().toString());
|
||||
}
|
||||
}
|
||||
// 股道编码
|
||||
String sectionCode = arrive ? paramInfo.getArriveSectionCode() : paramInfo.getDepartSectionCode();
|
||||
|
@ -106,9 +106,16 @@ public class CtcZoneService {
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(planTime);
|
||||
CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode);
|
||||
if (StationDirection.ReceiveAndDeliverModel.R.equals(model)) {
|
||||
if (runPlanParam.getArrivePlanTime().isEqual(runPlanParam.getArriveTime())) {
|
||||
runPlanParam.setArriveTime(planTime);
|
||||
}
|
||||
runPlanParam.setArrivePlanTime(planTime);
|
||||
} else {
|
||||
if (runPlanParam.getDepartPlanTime().isEqual(runPlanParam.getDepartTime())) {
|
||||
runPlanParam.setDepartTime(planTime);
|
||||
}
|
||||
runPlanParam.setDepartPlanTime(planTime);
|
||||
|
||||
}
|
||||
return runPlanParam;
|
||||
}
|
||||
@ -116,8 +123,14 @@ public class CtcZoneService {
|
||||
public CtcRunPlanParam savePlanTime(Simulation simulation, String stationCode, String runPlanCode, int minutes, StationDirection.ReceiveAndDeliverModel model) {
|
||||
CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode);
|
||||
if (StationDirection.ReceiveAndDeliverModel.R.equals(model)) {
|
||||
if (runPlanParam.getArrivePlanTime().isEqual(runPlanParam.getArriveTime())) {
|
||||
runPlanParam.setArriveTime(runPlanParam.getArriveTime().plusMinutes(minutes));
|
||||
}
|
||||
runPlanParam.setArrivePlanTime(runPlanParam.getArrivePlanTime().plusMinutes(minutes));
|
||||
} else {
|
||||
if (runPlanParam.getDepartPlanTime().isEqual(runPlanParam.getDepartTime())) {
|
||||
runPlanParam.setDepartTime(runPlanParam.getDepartTime().plusMinutes(minutes));
|
||||
}
|
||||
runPlanParam.setDepartPlanTime(runPlanParam.getDepartPlanTime().plusMinutes(minutes));
|
||||
}
|
||||
return runPlanParam;
|
||||
|
@ -4,6 +4,7 @@ import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.CtcRunPlanParam;
|
||||
import club.joylink.rtss.simulation.cbtc.CTC.data.CtcStationRunPlanLog;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@ -176,20 +177,24 @@ public class CtcRunPlanVO {
|
||||
this.stationCode = runPlanVO.getStationCode();
|
||||
this.runPlanCode = runPlanVO.getRunPlanCode();
|
||||
this.status = runPlanVO.getStatus();
|
||||
this.arriveTripNumber = runPlanVO.getRunPlan().getArriveTripNumber();
|
||||
this.departTripNumber = runPlanVO.getRunPlan().getDepartTripNumber();
|
||||
this.arriveSectionCode = runPlanVO.getRunPlan().getArriveSectionCode();
|
||||
this.arriveTripNumber = getValue(runPlanVO.getRunPlan().getArriveTripNumber());
|
||||
this.departTripNumber = getValue(runPlanVO.getRunPlan().getDepartTripNumber());
|
||||
this.arriveSectionCode = getValue(runPlanVO.getRunPlan().getArriveSectionCode());
|
||||
this.arrivePlanTime = runPlanVO.getRunPlan().getArrivePlanTime();
|
||||
this.departSectionCode = runPlanVO.getRunPlan().getDepartSectionCode();
|
||||
this.departSectionCode = getValue(runPlanVO.getRunPlan().getDepartSectionCode());
|
||||
this.departPlanTime = runPlanVO.getRunPlan().getDepartPlanTime();
|
||||
if (runPlanVO.getChangeRunPlan() != null) {
|
||||
this.oldArriveTripNumber = runPlanVO.getChangeRunPlan().getArriveTripNumber();
|
||||
this.oldDepartTripNumber = runPlanVO.getChangeRunPlan().getDepartTripNumber();
|
||||
this.oldArriveSectionCode = runPlanVO.getChangeRunPlan().getArriveSectionCode();
|
||||
this.oldArriveTripNumber = getValue(runPlanVO.getChangeRunPlan().getArriveTripNumber());
|
||||
this.oldDepartTripNumber = getValue(runPlanVO.getChangeRunPlan().getDepartTripNumber());
|
||||
this.oldArriveSectionCode = getValue(runPlanVO.getChangeRunPlan().getArriveSectionCode());
|
||||
this.oldArrivePlanTime = runPlanVO.getChangeRunPlan().getArrivePlanTime();
|
||||
this.oldDepartSectionCode = runPlanVO.getChangeRunPlan().getDepartSectionCode();
|
||||
this.oldDepartSectionCode = getValue(runPlanVO.getChangeRunPlan().getDepartSectionCode());
|
||||
this.oldDepartPlanTime = runPlanVO.getChangeRunPlan().getDepartPlanTime();
|
||||
}
|
||||
}
|
||||
|
||||
public String getValue(String valObj) {
|
||||
return StringUtils.isEmpty(valObj) ? null : valObj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user