【行车计划任务返回消息】

【行车计划电力设置】
This commit is contained in:
weizhihong 2022-07-08 11:30:10 +08:00
parent 0f06dce035
commit 66e8758888
4 changed files with 145 additions and 42 deletions

View File

@ -121,6 +121,16 @@ public class CtcRunPlanParam implements Cloneable {
*/ */
private Boolean electrical; private Boolean electrical;
/**
* 到达电力
*/
private Boolean arriveElectrical;
/**
* 出发到达
*/
private Boolean departElectrical;
/** /**
* 办理客运 * 办理客运
*/ */
@ -340,6 +350,18 @@ public class CtcRunPlanParam implements Cloneable {
runPlanParam.setElectrical(modify.getElectrical()); runPlanParam.setElectrical(modify.getElectrical());
change = true; change = true;
} }
// 到达电力计划
if (!Objects.equals(this.arriveElectrical, modify.getArriveElectrical())) {
this.arriveElectrical = modify.getArriveElectrical();
runPlanParam.setArriveElectrical(modify.getArriveElectrical());
change = true;
}
// 出发电力计划
if (!Objects.equals(this.departElectrical, modify.getDepartElectrical())) {
this.departElectrical = modify.getDepartElectrical();
runPlanParam.setDepartElectrical(modify.getDepartElectrical());
change = true;
}
// 办理客运 // 办理客运
if (!Objects.equals(this.passenger, modify.getPassenger())) { if (!Objects.equals(this.passenger, modify.getPassenger())) {
this.passenger = modify.getPassenger(); this.passenger = modify.getPassenger();
@ -498,6 +520,16 @@ public class CtcRunPlanParam implements Cloneable {
this.electrical = origin.getElectrical(); this.electrical = origin.getElectrical();
change = true; change = true;
} }
// 到达电力计划
if (!Objects.equals(origin.getArriveElectrical(), modify.getArriveElectrical())) {
this.arriveElectrical = origin.getArriveElectrical();
change = true;
}
// 出发电力计划
if (!Objects.equals(origin.getDepartElectrical(), modify.getDepartElectrical())) {
this.departElectrical = origin.getDepartElectrical();
change = true;
}
// 办理客运 // 办理客运
if (!Objects.equals(origin.getPassenger(), modify.getPassenger())) { if (!Objects.equals(origin.getPassenger(), modify.getPassenger())) {
this.passenger = origin.getPassenger(); this.passenger = origin.getPassenger();
@ -551,6 +583,15 @@ public class CtcRunPlanParam implements Cloneable {
this.departPlanTime = departPlanTime; this.departPlanTime = departPlanTime;
} }
/**
* 如果没有指定到达出发电力
*
* @return 是否存在指定电力
*/
public boolean arriveAndDepartElectrical() {
return this.arriveElectrical != null || this.departElectrical != null;
}
@Override @Override
public String toString() { public String toString() {
return "CtcRunPlanParam{" + return "CtcRunPlanParam{" +

View File

@ -468,9 +468,9 @@ public class CtcStationRunPlanLogService {
public void setTask(Simulation simulation, String stationCode, String runPlanCode, CtcStationRunPlanLog.RunPlanTask task, int status) { public void setTask(Simulation simulation, String stationCode, String runPlanCode, CtcStationRunPlanLog.RunPlanTask task, int status) {
CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode); CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode);
if (status == 1) { // 设置 if (status == 1) { // 设置
runPlanLog.getRunPlanTaskItemMap().put(task, new CtcStationRunPlanLog.RunPlanTaskItem(task)); runPlanLog.getRunPlanTaskItemMap().put(task.getOptionKey(), new CtcStationRunPlanLog.RunPlanTaskItem(task));
} else { // 取消 } else { // 取消
runPlanLog.getRunPlanTaskItemMap().remove(task); runPlanLog.getRunPlanTaskItemMap().remove(task.getOptionKey());
} }
} }

View File

@ -14,6 +14,7 @@ import org.springframework.util.StringUtils;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.LocalTime; import java.time.LocalTime;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
@ -82,7 +83,7 @@ public class CtcStationRunPlanLog {
/** /**
* 列车运行作业 * 列车运行作业
*/ */
private Map<RunPlanTask, RunPlanTaskItem> runPlanTaskItemMap; private Map<String, RunPlanTaskItem> runPlanTaskItemMap;
/** /**
* 是否原始数据 * 是否原始数据
@ -165,7 +166,7 @@ public class CtcStationRunPlanLog {
this.transfinite = paramInfo.getTransfinite(); // 超限等级 this.transfinite = paramInfo.getTransfinite(); // 超限等级
if (CollectionUtils.isEmpty(paramInfo.getRunPlanTaskMap())) { // 运行计划任务 if (CollectionUtils.isEmpty(paramInfo.getRunPlanTaskMap())) { // 运行计划任务
this.runPlanTaskItemMap = paramInfo.getRunPlanTaskMap().keySet().stream() this.runPlanTaskItemMap = paramInfo.getRunPlanTaskMap().keySet().stream()
.collect(Collectors.toMap(t -> t, RunPlanTaskItem::new)); .collect(Collectors.toMap(RunPlanTask::getOptionKey, RunPlanTaskItem::new));
} else { } else {
this.runPlanTaskItemMap = new HashMap<>(0); this.runPlanTaskItemMap = new HashMap<>(0);
} }
@ -300,6 +301,15 @@ public class CtcStationRunPlanLog {
return (this.arriveRunPlan != null && this.arriveRunPlan.isFinish()) || (this.departRunPlan != null && this.departRunPlan.isFinish()); return (this.arriveRunPlan != null && this.arriveRunPlan.isFinish()) || (this.departRunPlan != null && this.departRunPlan.isFinish());
} }
/**
* 是否电力车
*
* @return 电力
*/
public boolean isElectrical() {
return (this.arriveRunPlan != null && this.arriveRunPlan.isElectrical()) || (this.departRunPlan != null && this.departRunPlan.isElectrical());
}
@Setter @Setter
@Getter @Getter
public static class RunPlanItem { public static class RunPlanItem {
@ -390,7 +400,7 @@ public class CtcStationRunPlanLog {
/** /**
* 电力标识 * 电力标识
*/ */
private Boolean electrical; private boolean electrical;
/** /**
* 邻站预告同意时间 * 邻站预告同意时间
@ -514,6 +524,13 @@ public class CtcStationRunPlanLog {
StationDirection.ReceiveAndDeliverModel runStatus = arrive ? StationDirection.ReceiveAndDeliverModel runStatus = arrive ?
StationDirection.ReceiveAndDeliverModel.R : StationDirection.ReceiveAndDeliverModel.D; StationDirection.ReceiveAndDeliverModel.R : StationDirection.ReceiveAndDeliverModel.D;
runPlanItem.setRunModel(runStatus); runPlanItem.setRunModel(runStatus);
// 电力
if (paramInfo.arriveAndDepartElectrical()) { // 存在指定电力设置则获取指定
Boolean electrical = arrive ? paramInfo.getArriveElectrical() : paramInfo.getDepartElectrical();
runPlanItem.setElectrical(electrical);
} else {
runPlanItem.setElectrical(paramInfo.getElectrical());
}
} }
return runPlanItem; return runPlanItem;
} }
@ -524,45 +541,58 @@ public class CtcStationRunPlanLog {
@Getter @Getter
public enum RunPlanTask { public enum RunPlanTask {
// 技术停点 // 技术停点
Technical_Stop_Point("技术停点"), Technical_Stop_Point("stopPoint", "技术停点"),
// 上水 // 上水
Train_Water_Supply_Operation("上水"), Train_Water_Supply_Operation("waterSupply", "上水"),
// 换乘作业 // 换乘作业
Train_Transfer_Operation("换乘"), Train_Transfer_Operation("jobTransfer", "换乘"),
// 机车 // 机车
Train_Locomotive_Operation("机车"), Train_Locomotive_Operation("locomotive", "机车"),
// 道口 // 道口
Train_Crossing_Operation("道口"), Train_Crossing_Operation("crossing", "道口"),
// 综控 // 综控
Train_Integrated_Control_Operation("综控"), Train_Integrated_Control_Operation("integratedControl", "综控"),
// 交令 // 交令
Train_Handover_Operation("交令"), Train_Handover_Operation("handover", "交令"),
// 摘挂 // 摘挂
Train_Uncoupling_Operation("摘挂"), Train_Set_Out_Operation("setOut", "摘挂"),
// 列尾 // 列尾
Train_Tail_Operation("列尾"), Train_Tail_Operation("trainTail", "列尾"),
// 吸污 // 吸污
Train_Sewage_Absorption_Operation("吸污"), Train_Sewage_Absorption_Operation("sewageAbsorption", "吸污"),
// 车号 // 车号
Train_Code_Operation("车号"), Train_Code_Operation("tailCode", "车号"),
// 乘降 // 乘降
Train_Boarding_And_Landing_Operation("乘降"), Train_Boarding_And_Landing_Operation("boardLand", "乘降"),
// 列检 // 列检
Train_Inspection_Operation("列检"), Train_Inspection_Operation("inspection", "列检"),
// 交票 // 交票
Train_Ticket_Delivery_Operation("交票"), Train_Ticket_Delivery_Operation("ticketDelivery", "交票"),
// 装卸 // 装卸
Train_Loading_And_Unloading_Operation("装卸"), Train_Stevedore_Operation("stevedore", "装卸"),
// 货验 // 货验
Train_Goods_Inspection_Operation("货验"), Train_Goods_Inspection_Operation("goodsInspection", "货验"),
// 站务 // 站务
Train_Depot_Operation("站务"); Train_Station_Service_Operation("stationService", "站务");
private final String optionKey;
private final String optionName; private final String optionName;
RunPlanTask(String optionName) { RunPlanTask(String optionKey, String optionName) {
this.optionKey = optionKey;
this.optionName = optionName; this.optionName = optionName;
} }
/**
* 根据key获取运行计划任务
*
* @param key 唯一键
* @return 运行任务
*/
public RunPlanTask getTaskByKey(String key) {
return Arrays.stream(RunPlanTask.values()).filter(r -> r.getOptionKey().equals(key))
.findFirst().orElseGet(null);
}
} }
/** /**

View File

@ -6,9 +6,8 @@ import lombok.Setter;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.time.LocalTime; import java.time.LocalTime;
import java.util.HashMap; import java.util.*;
import java.util.Map; import java.util.stream.Collectors;
import java.util.Objects;
/** /**
* CTC运行计划消息实体 * CTC运行计划消息实体
@ -16,6 +15,8 @@ import java.util.Objects;
@Getter @Getter
@Setter @Setter
public class CtcStationRunPlanLogVO { public class CtcStationRunPlanLogVO {
private final static String EMPTY_STR = "";
/** /**
* 编码 * 编码
*/ */
@ -104,7 +105,7 @@ public class CtcStationRunPlanLogVO {
/** /**
* 列车运行计划作业 * 列车运行计划作业
*/ */
private Map<CtcStationRunPlanLog.RunPlanTask, String> runPlanTaskItemMap; private Map<String, String> runPlanTaskItemMap;
/** /**
* 是否闪烁 * 是否闪烁
@ -137,23 +138,22 @@ public class CtcStationRunPlanLogVO {
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.runPlanTaskItemMap = new HashMap<>(ctcStationRunPlanLog.getRunPlanTaskItemMap().size()); // 列车运行计划作业
ctcStationRunPlanLog.getRunPlanTaskItemMap().forEach((k, v) -> this.runPlanTaskItemMap.put(k, k.getOptionName()));
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) {
this.electrical = ctcStationRunPlanLog.getArriveRunPlan().getElectrical();
}
} }
if (ctcStationRunPlanLog.getDepartRunPlan() != null) { // 发车计划 if (ctcStationRunPlanLog.getDepartRunPlan() != null) { // 发车计划
this.departRunPlan = new RunPlanItem(ctcStationRunPlanLog.getDepartRunPlan()); this.departRunPlan = new RunPlanItem(ctcStationRunPlanLog.getDepartRunPlan());
if (ctcStationRunPlanLog.getDepartRunPlan().getElectrical() != null) {
this.electrical = this.electrical || ctcStationRunPlanLog.getDepartRunPlan().getElectrical();
}
} }
// 列车运行计划作业
this.runPlanTaskItemMap = Arrays.stream(CtcStationRunPlanLog.RunPlanTask.values())
.collect(Collectors.toMap(CtcStationRunPlanLog.RunPlanTask::getOptionKey, r -> EMPTY_STR));
ctcStationRunPlanLog.getRunPlanTaskItemMap().forEach((k, v) -> this.runPlanTaskItemMap.put(k, v.getType().getOptionName()));
List<String> planPropertiesList = new LinkedList<>();
this.electrical = ctcStationRunPlanLog.isElectrical(); // 电力
if (this.electrical != null) { if (this.electrical != null) {
this.planProperties = this.electrical ? "电力;" : ""; planPropertiesList.add("电力;");
} }
this.planProperties = String.join("", planPropertiesList);
this.twinkle = ctcStationRunPlanLog.isTwinkle(); this.twinkle = ctcStationRunPlanLog.isTwinkle();
this.effect = ctcStationRunPlanLog.isEffect(); this.effect = ctcStationRunPlanLog.isEffect();
} }
@ -173,14 +173,17 @@ public class CtcStationRunPlanLogVO {
change = true; change = true;
} }
// 存在不一样的选项 // 存在不一样的选项
Map<CtcStationRunPlanLog.RunPlanTask, String> modifyMap = new HashMap<>(); Map<String, String> modifyMap = new HashMap<>();
runPlanLog.getRunPlanTaskItemMap().forEach((k, v) -> { this.runPlanTaskItemMap.forEach((k, v) -> {
if (!this.getRunPlanTaskItemMap().containsKey(k)) { // 新增的任务 : 删除的任务
modifyMap.put(k, k.getOptionName()); CtcStationRunPlanLog.RunPlanTaskItem taskItem = runPlanLog.getRunPlanTaskItemMap().get(k);
this.getRunPlanTaskItemMap().put(k, k.getOptionName()); String val = taskItem != null ? taskItem.getType().getOptionName() : EMPTY_STR;
if (!Objects.equals(val, v)) {
modifyMap.put(k, val);
this.runPlanTaskItemMap.put(k, val);
} }
}); });
if (runPlanLog.getRunPlanTaskItemMap().size() != this.getRunPlanTaskItemMap().size() || !CollectionUtils.isEmpty(modifyMap)) { if (!CollectionUtils.isEmpty(modifyMap)) {
changeCtcStationRunPlanLogVO.setRunPlanTaskItemMap(modifyMap); changeCtcStationRunPlanLogVO.setRunPlanTaskItemMap(modifyMap);
change = true; change = true;
} }
@ -252,6 +255,23 @@ public class CtcStationRunPlanLogVO {
changeCtcStationRunPlanLogVO.setEffect(runPlanLog.isEffect()); changeCtcStationRunPlanLogVO.setEffect(runPlanLog.isEffect());
change = true; change = true;
} }
// 是否电力
if (!Objects.equals(this.electrical, runPlanLog.isElectrical())) {
this.electrical = runPlanLog.isElectrical(); // 电力
changeCtcStationRunPlanLogVO.setElectrical(this.electrical);
change = true;
}
List<String> planPropertiesList = new LinkedList<>();
if (this.electrical) {
planPropertiesList.add("电力;");
}
// 计划属性
String planPropertiesStr = String.join("", planPropertiesList);
if (!Objects.equals(this.planProperties, planPropertiesStr)) {
this.planProperties = planPropertiesStr;
changeCtcStationRunPlanLogVO.setPlanProperties(planPropertiesStr);
change = true;
}
return change ? changeCtcStationRunPlanLogVO : null; return change ? changeCtcStationRunPlanLogVO : null;
} }
@ -333,6 +353,12 @@ public class CtcStationRunPlanLogVO {
changeRunItem.setFinish(runPlanItem.isFinish()); changeRunItem.setFinish(runPlanItem.isFinish());
change = true; change = true;
} }
// 电力
if (!Objects.equals(paramInfo.getElectrical(), runPlanItem.isElectrical())) {
paramInfo.setElectrical(runPlanItem.isElectrical());
changeRunItem.setElectrical(runPlanItem.isElectrical());
change = true;
}
return change ? changeRunItem : null; // 没有变化返回null return change ? changeRunItem : null; // 没有变化返回null
} }
@ -394,6 +420,11 @@ public class CtcStationRunPlanLogVO {
*/ */
private Boolean finish; private Boolean finish;
/**
* 电力
*/
private Boolean electrical;
public RunPlanItem() { public RunPlanItem() {
} }
@ -414,6 +445,7 @@ public class CtcStationRunPlanLogVO {
this.accessName = runPlanItem.getAccessName(); this.accessName = runPlanItem.getAccessName();
this.adjacentMessageTime = runPlanItem.getAdjacentMessageTime(); this.adjacentMessageTime = runPlanItem.getAdjacentMessageTime();
this.finish = runPlanItem.isFinish(); this.finish = runPlanItem.isFinish();
this.electrical = runPlanItem.isElectrical();
} }
} }
} }