【行车日志任务状态修改】

This commit is contained in:
weizhihong 2022-06-17 10:17:50 +08:00
parent 2991922eb7
commit 3e16b48761
3 changed files with 88 additions and 25 deletions

View File

@ -322,11 +322,6 @@ public class CtcStationRunPlanLogService {
change = change || modifyRunPlanItemInfo(simulation, runPlanLog.getArriveRunPlan(), planParam, true); change = change || modifyRunPlanItemInfo(simulation, runPlanLog.getArriveRunPlan(), planParam, true);
// 出发 // 出发
change = change || modifyRunPlanItemInfo(simulation, runPlanLog.getDepartRunPlan(), planParam, false); change = change || modifyRunPlanItemInfo(simulation, runPlanLog.getDepartRunPlan(), planParam, false);
// 存在不一样的选项
long modifyNum = planParam.getRunPlanTaskList().stream().filter(task -> !runPlanLog.getRunPlanTaskList().contains(task)).count();
if (modifyNum > 0 || (planParam.getRunPlanTaskList().size() != runPlanLog.getRunPlanTaskList().size())) { // 长度不一致直接赋值
runPlanLog.setRunPlanTaskList(planParam.getRunPlanTaskList());
}
// 是否客运 // 是否客运
if (planParam.getPassenger() != null && !Objects.equals(planParam.getPassenger(), runPlanLog.getPassenger())) { if (planParam.getPassenger() != null && !Objects.equals(planParam.getPassenger(), runPlanLog.getPassenger())) {
runPlanLog.setPassenger(planParam.getPassenger()); runPlanLog.setPassenger(planParam.getPassenger());

View File

@ -9,13 +9,14 @@ import club.joylink.rtss.simulation.cbtc.data.map.StationDirection;
import lombok.Data; import lombok.Data;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.time.LocalTime; import java.time.LocalTime;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/** /**
* Ctc 车站运行计划日志 * Ctc 车站运行计划日志
@ -73,9 +74,9 @@ public class CtcStationRunPlanLog {
private String planProperties; private String planProperties;
/** /**
* 列车运行计划作业 * 列车运行作业
*/ */
private List<RunPlanTask> runPlanTaskList = new ArrayList<>(); private Map<RunPlanTask, RunPlanTaskItem> runPlanTaskItemMap;
/** /**
* 是否原始数据 * 是否原始数据
@ -117,9 +118,6 @@ public class CtcStationRunPlanLog {
*/ */
private TransfiniteType transfinite; private TransfiniteType transfinite;
public CtcStationRunPlanLog() {
}
public CtcStationRunPlanLog(CtcRunPlanParam paramInfo) { public CtcStationRunPlanLog(CtcRunPlanParam paramInfo) {
this.planParam = paramInfo; this.planParam = paramInfo;
this.code = paramInfo.getRunPlanCode(); this.code = paramInfo.getRunPlanCode();
@ -127,20 +125,26 @@ public class CtcStationRunPlanLog {
this.trackSectionCode = paramInfo.getTrackSectionCode(); this.trackSectionCode = paramInfo.getTrackSectionCode();
this.remark = paramInfo.getRemark(); // 记事 this.remark = paramInfo.getRemark(); // 记事
this.lateReason = paramInfo.getLateReason(); // 晚点原因 this.lateReason = paramInfo.getLateReason(); // 晚点原因
this.runPlanTaskList = paramInfo.getRunPlanTaskList();
this.passenger = paramInfo.getPassenger(); // 是否客运 this.passenger = paramInfo.getPassenger(); // 是否客运
this.keyTrains = paramInfo.getKeyTrains(); // 重点列车 this.keyTrains = paramInfo.getKeyTrains(); // 重点列车
this.military = paramInfo.getMilitary(); // 是否军用 this.military = paramInfo.getMilitary(); // 是否军用
this.trackDiscordant = paramInfo.getTrackDiscordant(); // 运行股道与基本径路不一致 this.trackDiscordant = paramInfo.getTrackDiscordant(); // 运行股道与基本径路不一致
this.entryOutDiscordant = paramInfo.getEntryOutDiscordant(); // 出入口与基本径路不一致 this.entryOutDiscordant = paramInfo.getEntryOutDiscordant(); // 出入口与基本径路不一致
this.transfinite = paramInfo.getTransfinite(); // 超限等级 this.transfinite = paramInfo.getTransfinite(); // 超限等级
if (CollectionUtils.isEmpty(paramInfo.getRunPlanTaskList())) { // 运行计划任务
this.runPlanTaskItemMap = paramInfo.getRunPlanTaskList().stream()
.collect(Collectors.toMap(t -> t, t -> new RunPlanTaskItem(t)));
} else {
this.runPlanTaskItemMap = new HashMap<>(0);
}
} }
public void reset() { public void reset() {
this.remark = null; this.remark = null;
this.lateReason = null; this.lateReason = null;
this.planProperties = null; this.planProperties = null;
this.runPlanTaskList = new ArrayList<>(); // 运行任务复位
this.runPlanTaskItemMap.forEach((k, v) -> v.reset());
if (this.arriveRunPlan != null) { if (this.arriveRunPlan != null) {
this.arriveRunPlan.setRunModel(StationDirection.ReceiveAndDeliverModel.R); this.arriveRunPlan.setRunModel(StationDirection.ReceiveAndDeliverModel.R);
this.arriveRunPlan.reset(); this.arriveRunPlan.reset();
@ -336,9 +340,6 @@ public class CtcStationRunPlanLog {
this.processTypeMap = new HashMap<>(ProcessType.values().length); this.processTypeMap = new HashMap<>(ProcessType.values().length);
} }
public RunPlanItem() {
}
public void reset() { public void reset() {
this.stationDirection = this.defaultStationDirection; this.stationDirection = this.defaultStationDirection;
this.station = this.defaultStation; this.station = this.defaultStation;
@ -455,7 +456,7 @@ public class CtcStationRunPlanLog {
} }
/** /**
* 运行作业 * 运行作业类型
*/ */
public enum RunPlanTask { public enum RunPlanTask {
// 技术停点 // 技术停点
@ -500,6 +501,59 @@ public class CtcStationRunPlanLog {
} }
} }
/**
* 运行作业详细信息
*/
@Getter
@Setter
public static class RunPlanTaskItem implements Cloneable {
private RunPlanTask type;
private RunPlanTaskStatus status;
public RunPlanTaskItem(RunPlanTask type) {
this.type = type;
this.status = RunPlanTaskStatus.NO;
}
/**
* 判断是否变化
*
* @param modifyItem 修改实体
* @param statusItem 状态实体
* @return 是否变化
*/
public boolean compareAndChange(RunPlanTaskItem modifyItem, RunPlanTaskItem statusItem) {
boolean change = false;
if (!Objects.equals(modifyItem.getStatus(), this.status)) {
this.status = modifyItem.status;
statusItem.setStatus(modifyItem.getStatus());
change = true;
}
return change;
}
public void reset() {
this.status = RunPlanTaskStatus.NO;
}
@Override
public RunPlanTaskItem clone() {
try {
return (RunPlanTaskItem) super.clone();
} catch (CloneNotSupportedException e) {
throw new AssertionError();
}
}
/**
* 行车计划状态
*/
public enum RunPlanTaskStatus {
NO
}
}
/** /**
* 超限类型 * 超限类型
*/ */

View File

@ -3,9 +3,11 @@ package club.joylink.rtss.vo.client.ctc;
import club.joylink.rtss.simulation.cbtc.CTC.data.CtcStationRunPlanLog; import club.joylink.rtss.simulation.cbtc.CTC.data.CtcStationRunPlanLog;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.util.CollectionUtils;
import java.time.LocalTime; import java.time.LocalTime;
import java.util.List; import java.util.HashMap;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
/** /**
@ -102,7 +104,7 @@ public class CtcRunPlanVO {
/** /**
* 列车运行计划作业 * 列车运行计划作业
*/ */
private List<CtcStationRunPlanLog.RunPlanTask> runPlanTaskList; private Map<CtcStationRunPlanLog.RunPlanTask, CtcStationRunPlanLog.RunPlanTaskItem> runPlanTaskItemMap;
public CtcRunPlanVO(String stationCode, String code) { public CtcRunPlanVO(String stationCode, String code) {
this.stationCode = stationCode; this.stationCode = stationCode;
@ -125,7 +127,7 @@ public class CtcRunPlanVO {
this.trackDiscordant = ctcStationRunPlanLog.getTrackDiscordant(); // 运行股道与基本径路不一致 this.trackDiscordant = ctcStationRunPlanLog.getTrackDiscordant(); // 运行股道与基本径路不一致
this.entryOutDiscordant = ctcStationRunPlanLog.getEntryOutDiscordant(); // 出入口与基本径路不一致 this.entryOutDiscordant = ctcStationRunPlanLog.getEntryOutDiscordant(); // 出入口与基本径路不一致
this.passenger = ctcStationRunPlanLog.getPassenger(); // 客运车 this.passenger = ctcStationRunPlanLog.getPassenger(); // 客运车
this.runPlanTaskList = ctcStationRunPlanLog.getRunPlanTaskList(); // 列车运行计划作业 this.runPlanTaskItemMap = ctcStationRunPlanLog.getRunPlanTaskItemMap(); // 列车运行计划作业
if (ctcStationRunPlanLog.getArriveRunPlan() != null) { // 到达计划 if (ctcStationRunPlanLog.getArriveRunPlan() != null) { // 到达计划
this.arriveRunPlan = new RunPlanItem(ctcStationRunPlanLog.getArriveRunPlan()); this.arriveRunPlan = new RunPlanItem(ctcStationRunPlanLog.getArriveRunPlan());
if (ctcStationRunPlanLog.getArriveRunPlan().getElectrical() != null) { if (ctcStationRunPlanLog.getArriveRunPlan().getElectrical() != null) {
@ -158,10 +160,22 @@ public class CtcRunPlanVO {
change = true; change = true;
} }
// 存在不一样的选项 // 存在不一样的选项
long modifyNum = runPlanLog.getRunPlanTaskList().stream().filter(task -> !this.runPlanTaskList.contains(task)).count(); Map<CtcStationRunPlanLog.RunPlanTask, CtcStationRunPlanLog.RunPlanTaskItem> modifyMap = new HashMap<>();
if (modifyNum > 0 || (runPlanLog.getRunPlanTaskList().size() != this.runPlanTaskList.size())) { // 长度不一致直接赋值 runPlanLog.getRunPlanTaskItemMap().forEach((k, v) -> {
this.runPlanTaskList = runPlanLog.getRunPlanTaskList(); CtcStationRunPlanLog.RunPlanTaskItem statusItem = null;
changeCtcRunPlanVO.setRunPlanTaskList(runPlanLog.getRunPlanTaskList()); if (!this.getRunPlanTaskItemMap().containsKey(k)) {
statusItem = v.clone();
modifyMap.put(k, statusItem);
this.getRunPlanTaskItemMap().put(k, statusItem);
} else {
statusItem = new CtcStationRunPlanLog.RunPlanTaskItem(k);
if (this.getRunPlanTaskItemMap().get(k).compareAndChange(v, statusItem)) {
modifyMap.put(k, statusItem);
}
}
});
if (runPlanLog.getRunPlanTaskItemMap().size() != this.getRunPlanTaskItemMap().size() || !CollectionUtils.isEmpty(modifyMap)) {
changeCtcRunPlanVO.setRunPlanTaskItemMap(modifyMap);
change = true; change = true;
} }
// 是否客运 // 是否客运