【增加红闪限制条件】

This commit is contained in:
weizhihong 2022-07-06 18:02:29 +08:00
parent 2bb21db602
commit 6c1c90bc81
2 changed files with 21 additions and 5 deletions

View File

@ -239,7 +239,7 @@ public class CtcStationRunPlanLogService {
CtcStationRunPlanLog ctcStationRunPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode); CtcStationRunPlanLog ctcStationRunPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode);
if (!Objects.equals(ctcStationRunPlanLog.getDelete(), Boolean.TRUE)) { if (!Objects.equals(ctcStationRunPlanLog.getDelete(), Boolean.TRUE)) {
ctcStationRunPlanLog.setDelete(Boolean.TRUE); ctcStationRunPlanLog.setDelete(Boolean.TRUE);
ctcStationRunPlanLog.setChange(CtcStationRunPlanLog.ChangeType.STATUS_DELETE_CHANGE); // ctcStationRunPlanLog.setChange(CtcStationRunPlanLog.ChangeType.STATUS_DELETE_CHANGE);
} }
} }
@ -379,6 +379,8 @@ public class CtcStationRunPlanLogService {
* @param runPlanCode 运行计划编码 * @param runPlanCode 运行计划编码
*/ */
public void cancelTwinkle(Simulation simulation, String stationCode, String runPlanCode) { public void cancelTwinkle(Simulation simulation, String stationCode, String runPlanCode) {
boolean isExist = simulation.getCtcRepository().getCtcEffectRepository().isExistStageRunPlan(stationCode, null);
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(isExist, "存在未签收的阶段计划");
CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode); CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode);
runPlanLog.setTwinkle(false); runPlanLog.setTwinkle(false);
} }

View File

@ -151,13 +151,27 @@ public class CtcEffectRepository {
return null; return null;
} }
return this.stationStageRunPlanMap.values().stream() return this.stationStageRunPlanMap.values().stream()
.filter(r -> { .filter(r -> isExistStageRunPlan(r.getStationCode(), r))
Integer oldVersion = this.getStageRunPlanVersionMap().get(r.getStationCode());
return !CollectionUtils.isEmpty(r.getCtcRunPlanVOList()) && (oldVersion == null || oldVersion < r.getVersion().get());
})
.map(CtcStageRunPlanRepository::generateStatus).collect(Collectors.toList()); .map(CtcStageRunPlanRepository::generateStatus).collect(Collectors.toList());
} }
/**
* 是否存在阶段计划
*
* @param stationCode 车站编码
* @param r 阶段计划
* @return 是否存在
*/
public boolean isExistStageRunPlan(String stationCode, CtcStageRunPlanRepository r) {
CtcStageRunPlanRepository repository = r == null ? this.stationStageRunPlanMap.get(stationCode) : r;
if (repository != null) {
Integer oldVersion = this.getStageRunPlanVersionMap().get(repository.getStationCode());
return !CollectionUtils.isEmpty(repository.getCtcRunPlanVOList())
&& (oldVersion == null || oldVersion < repository.getVersion().get());
}
return false;
}
/** /**
* 将修改的计划发布至申请区 * 将修改的计划发布至申请区
* *