【更新计划以及空指针判断】

This commit is contained in:
weizhihong 2022-06-28 16:28:57 +08:00
parent fc4524efb6
commit 2d2c3d27b0
2 changed files with 14 additions and 11 deletions

View File

@ -203,13 +203,13 @@ public class CtcStationRunPlanLogService {
}
/**
* 将变更运行计划刷新至行车日志
* 将变更运行计划刷新至行车日志这里需要加锁避免重复处理
*
* @param simulation 仿真
* @param stationCode 车站编码
* @param ctcRunPlanVOList 变更的运行计划列表
*/
public void doUpdateRunPlanLog(Simulation simulation, String stationCode, List<CtcRunPlanVO> ctcRunPlanVOList) {
public synchronized void doUpdateRunPlanLog(Simulation simulation, String stationCode, List<CtcRunPlanVO> ctcRunPlanVOList) {
if (CollectionUtils.isEmpty(ctcRunPlanVOList)) {
return;
}

View File

@ -168,15 +168,18 @@ public class CtcZoneService {
.findFirst().orElse(null);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(ctcZone);
CtcEffectRepository effectRepository = simulation.getCtcRepository().getCtcEffectRepository();
Set<String> stationCodeSet = new HashSet<>();
ctcZone.getStationList().forEach(station -> {
stationCodeSet.add(station.getCode());
CtcManageRepository.StationRunPlanRepository runPlanRepository = zoneRepository.getStationRunPlanMap().get(station.getCode());
if (runPlanRepository != null) {
effectRepository.releaseRunPlanByStationCode(runPlanRepository, simulation.getCorrectSystemTime());
}
});
updateStageRunPlan(simulation, stationCodeSet);
if (ctcZone.getStationList() != null) {
Set<String> stationCodeSet = new HashSet<>();
ctcZone.getStationList().forEach(station -> {
stationCodeSet.add(station.getCode());
CtcManageRepository.StationRunPlanRepository runPlanRepository
= zoneRepository.getStationRunPlanMap().get(station.getCode());
if (runPlanRepository != null) {
effectRepository.releaseRunPlanByStationCode(runPlanRepository, simulation.getCorrectSystemTime());
}
});
updateStageRunPlan(simulation, stationCodeSet);
}
}
/**