【行车日志变化后,回调占线板方法】
This commit is contained in:
parent
8b02960200
commit
21f02c218b
@ -19,8 +19,10 @@ import org.springframework.util.StringUtils;
|
|||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.util.*;
|
import java.util.LinkedList;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@ -69,8 +71,12 @@ public class CtcStationRunPlanLogService {
|
|||||||
createList.add(runPlanLog);
|
createList.add(runPlanLog);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
changeList.forEach(r -> runPlanCallBack.get(CtcStationRunPlanLog.ChangeType.STATUS_MODIFY_CHANGE).accept(simulation, r));
|
if (!CollectionUtils.isEmpty(changeList) || !CollectionUtils.isEmpty(createList)) {
|
||||||
createList.forEach(r -> runPlanCallBack.get(CtcStationRunPlanLog.ChangeType.STATUS_ADD_CHANGE).accept(simulation, r));
|
changeList.forEach(r -> r.clearChange());
|
||||||
|
createList.forEach(r -> r.clearChange());
|
||||||
|
Station station = simulation.getRepository().getByCode(stationCode, Station.class);
|
||||||
|
ctcService.regenerateRouteSequenceAndTrackView(simulation, station);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -352,15 +358,9 @@ public class CtcStationRunPlanLogService {
|
|||||||
public void doSendOutRunPlan(Simulation simulation, String stationCode) {
|
public void doSendOutRunPlan(Simulation simulation, String stationCode) {
|
||||||
Map<String, CtcStationRunPlanLog> ctcRunPlanMap = simulation.getCtcRepository().getSimulationRunPlanMap().get(stationCode);
|
Map<String, CtcStationRunPlanLog> ctcRunPlanMap = simulation.getCtcRepository().getSimulationRunPlanMap().get(stationCode);
|
||||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(ctcRunPlanMap);
|
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(ctcRunPlanMap);
|
||||||
ctcRunPlanMap.values().stream()
|
ctcRunPlanMap.values().stream().filter(r -> r.getChangeType() != null).forEach(r -> r.clearChange()); // 签收完,清除变化类型
|
||||||
.filter(r -> r.getChangeType() != null && (r.getArriveRunPlan() != null || r.getDepartRunPlan() != null))
|
Station station = simulation.getRepository().getByCode(stationCode, Station.class);
|
||||||
.forEach(r -> {
|
ctcService.regenerateRouteSequenceAndTrackView(simulation, station);
|
||||||
BiConsumer<Simulation, CtcStationRunPlanLog> callBack = runPlanCallBack.get(r.getChangeType());
|
|
||||||
if (callBack != null) {
|
|
||||||
callBack.accept(simulation, r);
|
|
||||||
}
|
|
||||||
r.clearChange(); // 签收完,清除变化类型
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -769,35 +769,4 @@ public class CtcStationRunPlanLogService {
|
|||||||
}
|
}
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 行车日志变化后,占线板回调方法
|
|
||||||
*/
|
|
||||||
private final Map<CtcStationRunPlanLog.ChangeType, BiConsumer<Simulation, CtcStationRunPlanLog>> runPlanCallBack = new HashMap<>() {
|
|
||||||
{
|
|
||||||
put(CtcStationRunPlanLog.ChangeType.STATUS_MODIFY_CHANGE, (simulation, r) -> { // 修改股道后
|
|
||||||
if (r.getArriveRunPlan() != null && r.getArriveRunPlan().getTrackSection() != null) {
|
|
||||||
ctcService.runPlanItemUpdate(simulation, r.getStation(), r.getArriveRunPlan(), false);
|
|
||||||
}
|
|
||||||
if (r.getDepartRunPlan() != null && r.getDepartRunPlan().getTrackSection() != null) {
|
|
||||||
ctcService.runPlanItemUpdate(simulation, r.getStation(), r.getDepartRunPlan(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
put(CtcStationRunPlanLog.ChangeType.STATUS_ADD_CHANGE, (simulation, r) -> { // 创建
|
|
||||||
if (r.getArriveRunPlan() != null && r.getArriveRunPlan().getTrackSection() != null) {
|
|
||||||
ctcService.runPlanItemCreate(simulation, r.getStation(), r.getArriveRunPlan(), false);
|
|
||||||
}
|
|
||||||
if (r.getDepartRunPlan() != null && r.getDepartRunPlan().getTrackSection() != null) {
|
|
||||||
ctcService.runPlanItemCreate(simulation, r.getStation(), r.getDepartRunPlan(), true);
|
|
||||||
}
|
|
||||||
r.clearChange(); // 签收完,清除变化类型
|
|
||||||
});
|
|
||||||
|
|
||||||
put(CtcStationRunPlanLog.ChangeType.STATUS_DELETE_CHANGE, (simulation, r) -> { // 删除操作
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user