From 0f06dce035f4c4b013fe9869ca95657fa0efde9f Mon Sep 17 00:00:00 2001 From: weizhihong Date: Thu, 7 Jul 2022 17:18:56 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E8=B0=83=E5=BA=A6=E5=8F=B0=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=AE=9E=E9=99=85=E6=97=B6=E9=97=B4=E4=B8=8B=E5=8F=91?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E6=9C=AA=E5=8F=98=E6=9B=B4=E7=9A=84=E8=A1=8C?= =?UTF-8?q?=E8=BD=A6=E6=97=A5=E5=BF=97=E5=AE=9E=E9=99=85=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=8F=98=E5=8C=96=E3=80=91=20=E3=80=90=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E4=B8=8B=E5=8F=91=E9=9D=9E=E7=A9=BA=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../runplan/CtcStationRunPlanLogService.java | 24 ++++++++++++------- .../ATS/service/runplan/CtcZoneService.java | 13 ++++++++++ .../cbtc/CTC/data/vo/CtcRunPlanVO.java | 21 +++++++++------- 3 files changed, 42 insertions(+), 16 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcStationRunPlanLogService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcStationRunPlanLogService.java index 764d6eb92..305071146 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcStationRunPlanLogService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcStationRunPlanLogService.java @@ -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(); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcZoneService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcZoneService.java index 2488dd086..b88845dc8 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcZoneService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/runplan/CtcZoneService.java @@ -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; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcRunPlanVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcRunPlanVO.java index 3e3784119..a6bfc6789 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcRunPlanVO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/vo/CtcRunPlanVO.java @@ -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; + } } }