修改站间运行时间计算预计离开时间有时空指针的bug

This commit is contained in:
walker-sheng 2021-02-05 09:51:48 +08:00
parent d9f9ce640e
commit 55449d3a67

View File

@ -383,12 +383,12 @@ public class AtsPlanService {
if (Objects.equals(train.getPlanStandTrack(), nextStationPlan.getSection().getCode())) { if (Objects.equals(train.getPlanStandTrack(), nextStationPlan.getSection().getCode())) {
return; return;
} else { } else {
long runningTime = ChronoUnit.SECONDS.between(stationPlan.getLeaveTime(), nextStationPlan.getArriveTime()); long planTime = ChronoUnit.SECONDS.between(stationPlan.getLeaveTime(), nextStationPlan.getArriveTime());
long runningTime = planTime;
if (estimatedLeaveTime != null) { if (estimatedLeaveTime != null) {
runningTime = ChronoUnit.SECONDS.between(estimatedLeaveTime, runningTime = ChronoUnit.SECONDS.between(estimatedLeaveTime,
nextStationPlan.getArriveTime()); nextStationPlan.getArriveTime());
} }
long planTime = ChronoUnit.SECONDS.between(stationPlan.getLeaveTime(), nextStationPlan.getArriveTime());
if (runningTime > planTime * 2) { if (runningTime > planTime * 2) {
runningTime = planTime * 2; runningTime = planTime * 2;
} }