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

This commit is contained in:
walker-sheng 2021-02-05 09:50:13 +08:00
parent 3f35c48cb3
commit a87ca75d37

View File

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