【删除多余代码】

【增加车务管理端清空操作】
This commit is contained in:
weizhihong 2022-06-14 17:13:07 +08:00
parent cfd8454328
commit b15ec376fe
5 changed files with 58 additions and 147 deletions

View File

@ -915,16 +915,6 @@ public class Operation {
*/ */
CTC_BATCH_MODIFY_RUN_PLAN, CTC_BATCH_MODIFY_RUN_PLAN,
/**
* 修改股道
*/
CTC_MODIFY_TRACK_SECTION,
/**
* 修改实际到达时间
*/
CTC_MODIFY_ACTUAL_TIME,
/** /**
* 修改车次 * 修改车次
*/ */
@ -950,6 +940,11 @@ public class Operation {
*/ */
CTC_REMOVE_RUN_PLAN_FROM_EDIT_AREA, CTC_REMOVE_RUN_PLAN_FROM_EDIT_AREA,
/**
* 清空编辑区中的运行计划
*/
CTC_CLEAR_RUN_PLAN_FROM_EDIT_AREA,
/** /**
* 导入覆盖运行计划到编辑区 * 导入覆盖运行计划到编辑区
*/ */

View File

@ -9,7 +9,6 @@ import club.joylink.rtss.simulation.cbtc.Simulation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import java.time.LocalTime;
import java.util.List; import java.util.List;
@OperateHandler @OperateHandler
@ -30,38 +29,7 @@ public class CtcStationRunPlanOperateHandler {
public void modifyBatchRunPlan(Simulation simulation, String stationCode, List<CtcRunPlanParam> planParamList, int force) { public void modifyBatchRunPlan(Simulation simulation, String stationCode, List<CtcRunPlanParam> planParamList, int force) {
ctcStationRunPlanLogService.modifyBatchRunPlan(simulation, stationCode, planParamList, force); ctcStationRunPlanLogService.modifyBatchRunPlan(simulation, stationCode, planParamList, force);
} }
/**
* 修改行车计划股道信息
*
* @param simulation 仿真实体
* @param stationCode 车站编码
* @param runPlanCode 运行编码
* @param arriveSectionCode 到达股道编码
* @param departSectionCode 出发股道编码
* @param force 是否强制 0:不强制1强制
*/
@OperateHandlerMapping(type = Operation.Type.CTC_MODIFY_TRACK_SECTION)
public void modifyRunPlanTrackSection(Simulation simulation, String stationCode, String runPlanCode
, String arriveSectionCode, String departSectionCode, int force) {
ctcStationRunPlanLogService.modifyRunPlanTrackSection(simulation, stationCode, runPlanCode, arriveSectionCode, departSectionCode, force);
}
/**
* 人工上报行车日志的到点时间
*
* @param simulation 仿真实体
* @param stationCode 车站编码
* @param runPlanCode 运行编码
* @param arriveTime 到点时间
* @param departTime 发车时间
*/
@OperateHandlerMapping(type = Operation.Type.CTC_MODIFY_ACTUAL_TIME)
public void artificialReportRunPlanActualTime(Simulation simulation, String stationCode, String runPlanCode
, LocalTime arriveTime, LocalTime departTime) {
ctcStationRunPlanLogService.artificialReportRunPlanActualTime(simulation, stationCode, runPlanCode, arriveTime, departTime);
}
/** /**
* 修改车次号 * 修改车次号
* *
@ -146,7 +114,18 @@ public class CtcStationRunPlanOperateHandler {
* @param tripNumberList 车次 * @param tripNumberList 车次
*/ */
@OperateHandlerMapping(type = Operation.Type.CTC_REMOVE_RUN_PLAN_FROM_EDIT_AREA) @OperateHandlerMapping(type = Operation.Type.CTC_REMOVE_RUN_PLAN_FROM_EDIT_AREA)
public void removeRunPlanFromEditArea(Simulation simulation, String stationCode, List<String> tripNumberList) { public void removeRunPlanFromEditArea(Simulation simulation, String stationCode, String tripNumber) {
ctcStationRunPlanLogService.removeRunPlanFromEditArea(simulation, stationCode, tripNumberList); ctcStationRunPlanLogService.removeRunPlanFromEditArea(simulation, stationCode, tripNumber);
}
/**
* 清空车站编辑区内容
*
* @param simulation 仿真实体
* @param stationCode 车站编码
*/
@OperateHandlerMapping(type = Operation.Type.CTC_CLEAR_RUN_PLAN_FROM_EDIT_AREA)
public void clearRunPlanFromEditArea(Simulation simulation, String stationCode) {
ctcStationRunPlanLogService.clearRunPlanFromEditArea(simulation, stationCode);
} }
} }

View File

@ -93,6 +93,21 @@ public class CtcRunPlanParam {
*/ */
private List<CtcStationRunPlanLog.RunPlanTask> runPlanTaskList = new ArrayList<>(); private List<CtcStationRunPlanLog.RunPlanTask> runPlanTaskList = new ArrayList<>();
/**
* 删除时构造实体
*
* @param stationCode 车站
* @param tripNumber 车次
* @return 实体
*/
public static CtcRunPlanParam buildRemoveParam(String stationCode, String tripNumber) {
CtcRunPlanParam p = new CtcRunPlanParam();
p.stationCode = stationCode;
p.tripNumber = tripNumber;
p.runPlanTaskList = null;
return p;
}
@Override @Override
public String toString() { public String toString() {
return "CtcRunPlanParam{" + return "CtcRunPlanParam{" +

View File

@ -145,16 +145,32 @@ public class CtcStationRunPlanLogService {
/** /**
* 将车站编辑区中删除车次内容 * 将车站编辑区中删除车次内容
* *
* @param simulation 仿真实体 * @param simulation 仿真实体
* @param stationCode 车站编码 * @param stationCode 车站编码
* @param tripNumberList 车次 * @param tripNumber 车次
*/ */
public void removeRunPlanFromEditArea(Simulation simulation, String stationCode, List<String> tripNumberList) { public void removeRunPlanFromEditArea(Simulation simulation, String stationCode, String tripNumber) {
Map<String, CtcRunPlanParam> stationRunLogTripNumberMap = simulation.getCtcRepository() Map<String, CtcRunPlanParam> stationRunLogTripNumberMap = simulation.getCtcRepository()
.getSimulationRunPlanEditAreaMap().getOrDefault(stationCode, new ConcurrentHashMap<>()); .getSimulationRunPlanEditAreaMap().getOrDefault(stationCode, new ConcurrentHashMap<>());
tripNumberList.forEach(tripNumber -> stationRunLogTripNumberMap.remove(tripNumber)); stationRunLogTripNumberMap.remove(tripNumber);
// 发送消息 // 发送消息
ctcLogicLoop.sendCtcManageRemoveMessage(simulation, tripNumberList, simulation.getSimulationUserIds()); ctcLogicLoop.sendCtcManageRemoveMessage(simulation, Arrays.asList(CtcRunPlanParam.buildRemoveParam(stationCode, tripNumber)), simulation.getSimulationUserIds());
}
/**
* 全部清空
*
* @param simulation 仿真修改
* @param stationCode 车站编码
*/
public void clearRunPlanFromEditArea(Simulation simulation, String stationCode) {
Map<String, CtcRunPlanParam> stationRunLogTripNumberMap = simulation.getCtcRepository()
.getSimulationRunPlanEditAreaMap().getOrDefault(stationCode, new ConcurrentHashMap<>());
List<CtcRunPlanParam> removeParamList = stationRunLogTripNumberMap.values().stream()
.map(c -> CtcRunPlanParam.buildRemoveParam(c.getStationCode(), c.getTripNumber()))
.collect(Collectors.toList());
// 发送消息
ctcLogicLoop.sendCtcManageRemoveMessage(simulation, removeParamList, simulation.getSimulationUserIds());
} }
/** /**
@ -190,101 +206,7 @@ public class CtcStationRunPlanLogService {
}); });
ctcLogicLoop.coverRunPlanMessage(simulation, runPlanLogList, simulation.getSimulationUserIds()); ctcLogicLoop.coverRunPlanMessage(simulation, runPlanLogList, simulation.getSimulationUserIds());
} }
/**
* 修改运行股道
*
* @param simulation 仿真实体
* @param stationCode 车站编码
* @param runPlanCode 运行编码
* @param arriveSectionCode 到达区段
* @param departSectionCode 出发区段
* @param force 是否强制 0:不强制1强制
*/
public void modifyRunPlanTrackSection(Simulation simulation, String stationCode, String runPlanCode
, String arriveSectionCode, String departSectionCode, int force) {
CtcStationRunPlanLog ctcStationRunPlanLog =
simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode);
// 如果不强制则需要判断区段进路占用
if (force == 0) {
if (!StringUtils.isEmpty(arriveSectionCode)) {
RouteSequence.Line arriveLine = simulation.getCtcRepository()
.getRouteSequenceLine(stationCode, ctcStationRunPlanLog.getTripNumber(), false);
if ((arriveLine != null && arriveLine.getRoute().isLock())) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "到达进路状态不允许修改到达股道");
}
}
if (!StringUtils.isEmpty(departSectionCode)) {
RouteSequence.Line departLine = simulation.getCtcRepository()
.getRouteSequenceLine(stationCode, ctcStationRunPlanLog.getTripNumber(), true);
if ((departLine != null && departLine.getRoute().isLock())) {
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "出发进路状态不允许修改到达股道");
}
}
}
if (ctcStationRunPlanLog != null) {
CtcStationRunPlanLog changeRunPlanLog = new CtcStationRunPlanLog();
changeRunPlanLog.setCode(runPlanCode);
if (!StringUtils.isEmpty(arriveSectionCode)) {
Section arriveSection = simulation.getRepository().getByCode(arriveSectionCode, Section.class);
if (ctcStationRunPlanLog.getArriveRunPlan() != null
&& arriveSection.equals(ctcStationRunPlanLog.getArriveRunPlan().getTrackSection())) {
ctcStationRunPlanLog.getArriveRunPlan().setTrackSection(arriveSection);
changeRunPlanLog.setArriveRunPlan(new CtcStationRunPlanLog.RunPlanItem());
changeRunPlanLog.getArriveRunPlan().setTrackSection(arriveSection);
}
}
if (!StringUtils.isEmpty(departSectionCode)) {
Section departSection = simulation.getRepository().getByCode(departSectionCode, Section.class);
if (ctcStationRunPlanLog.getDepartRunPlan() != null
&& departSection.equals(ctcStationRunPlanLog.getDepartRunPlan().getTrackSection())) {
ctcStationRunPlanLog.getDepartRunPlan().setTrackSection(departSection);
changeRunPlanLog.setDepartRunPlan(new CtcStationRunPlanLog.RunPlanItem());
changeRunPlanLog.getDepartRunPlan().setTrackSection(departSection);
}
}
if (changeRunPlanLog.getArriveRunPlan() != null || changeRunPlanLog.getDepartRunPlan() != null) {
ctcLogicLoop.sendRunPlanChangeMessage(simulation, Arrays.asList(changeRunPlanLog), simulation.getSimulationUserIds());
}
}
}
/**
* 人工上报行车日志的到点时间
*
* @param simulation 仿真实体
* @param stationCode 车站编码
* @param runPlanCode 运行编码
* @param arriveTime 到点时间
* @param departTime 发车时间
*/
public void artificialReportRunPlanActualTime(Simulation simulation, String stationCode, String runPlanCode
, LocalTime arriveTime, LocalTime departTime) {
CtcStationRunPlanLog ctcStationRunPlanLog =
simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode);
CtcStationRunPlanLog changeRunPlanLog = new CtcStationRunPlanLog();
changeRunPlanLog.setCode(runPlanCode);
if (ctcStationRunPlanLog.getArriveRunPlan() != null) {
String arriveTimeStr = arriveTime != null ? "" : arriveTime.toString();
if (!Objects.equals(arriveTimeStr, changeRunPlanLog.getArriveRunPlan().getActualTime())) {
changeRunPlanLog.setArriveRunPlan(new CtcStationRunPlanLog.RunPlanItem());
changeRunPlanLog.getArriveRunPlan().setActualTime(arriveTimeStr);
ctcStationRunPlanLog.getArriveRunPlan().setActualTime(arriveTimeStr);
}
}
if (ctcStationRunPlanLog.getDepartRunPlan() != null) {
String departTimeStr = departTime != null ? "" : departTime.toString();
if (!Objects.equals(departTimeStr, changeRunPlanLog.getArriveRunPlan().getActualTime())) {
changeRunPlanLog.setDepartRunPlan(new CtcStationRunPlanLog.RunPlanItem());
changeRunPlanLog.getDepartRunPlan().setActualTime(departTimeStr);
ctcStationRunPlanLog.getDepartRunPlan().setActualTime(departTimeStr);
}
}
if (changeRunPlanLog.getArriveRunPlan() != null || changeRunPlanLog.getDepartRunPlan() != null) {
ctcLogicLoop.sendRunPlanChangeMessage(simulation, Arrays.asList(changeRunPlanLog), simulation.getSimulationUserIds());
}
}
/** /**
* 修改本站到发车次 这里存在问题这里会不会引起后续车次的到发变化 * 修改本站到发车次 这里存在问题这里会不会引起后续车次的到发变化
* *

View File

@ -183,7 +183,7 @@ public class CTCLogicLoop {
* @param messageInfo 消息 * @param messageInfo 消息
* @param userIds 用户ID * @param userIds 用户ID
*/ */
public void sendCtcManageRemoveMessage(Simulation simulation, List<String> messageInfo, Set<String> userIds) { public void sendCtcManageRemoveMessage(Simulation simulation, List<CtcRunPlanParam> messageInfo, Set<String> userIds) {
if (messageInfo != null && !messageInfo.isEmpty()) { if (messageInfo != null && !messageInfo.isEmpty()) {
sendCtcMessage(simulation.getId(), messageInfo, WebSocketMessageType.SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_REMOVE, userIds); sendCtcMessage(simulation.getId(), messageInfo, WebSocketMessageType.SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_REMOVE, userIds);
} }