【删除多余消息类型以及代码】

【增加获取所有调度台运行计划接口】
This commit is contained in:
weizhihong 2022-06-29 13:03:41 +08:00
parent 2d2c3d27b0
commit 436fa36ac8
19 changed files with 243 additions and 521 deletions

View File

@ -0,0 +1,71 @@
package club.joylink.rtss.controller.simulation;
import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.CtcRunPlanParam;
import club.joylink.rtss.simulation.cbtc.ATS.service.runplan.CtcManageService;
import club.joylink.rtss.simulation.cbtc.ATS.service.runplan.CtcStationRunPlanLogService;
import club.joylink.rtss.simulation.cbtc.ATS.service.runplan.CtcZoneService;
import club.joylink.rtss.simulation.cbtc.CTC.data.vo.CtcStationRunPlanLogVO;
import club.joylink.rtss.simulation.cbtc.GroupSimulationCache;
import club.joylink.rtss.simulation.cbtc.Simulation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* CTC 接口操作
*/
@RestController
@RequestMapping("/api/simulation/{group}/ctc")
public class SimulationCtcController {
@Autowired
private GroupSimulationCache groupSimulationCache;
@Autowired
private CtcZoneService ctcZoneService;
@Autowired
private CtcStationRunPlanLogService ctcStationRunPlanLogService;
@Autowired
private CtcManageService ctcManageService;
/**
* 获取调度台运行计划列表
*
* @param group 仿真编码
* @return 运行计划列表
*/
@GetMapping("/railway/runPlan/list")
public List<CtcRunPlanParam> pullRailwayRunPlan(@PathVariable String group) {
Simulation simulation = this.groupSimulationCache.getSimulationByGroup(group);
return ctcZoneService.pullRailwayRunPlan(simulation);
}
/**
* 获取车站的运行计划列表
*
* @param group 仿真编码
* @return 运行计划列表
*/
@GetMapping("/station/runPlan/list")
public List<CtcStationRunPlanLogVO> pullStationRunPlan(@PathVariable String group) {
Simulation simulation = this.groupSimulationCache.getSimulationByGroup(group);
return ctcStationRunPlanLogService.pullStationRunPlan(simulation);
}
/**
* 获取车务管理终端所有运行计划列表
*
* @param group 仿真编码
* @return 运行计划列表
*/
@GetMapping("/manage/runPlan/list")
public List<CtcRunPlanParam> pullCtcManageRunPlan(@PathVariable String group) {
Simulation simulation = this.groupSimulationCache.getSimulationByGroup(group);
return ctcManageService.pullCtcManageRunPlan(simulation);
}
}

View File

@ -29,8 +29,8 @@ public class CtcZoneOperateHandler {
* @param planParam 行车计划 * @param planParam 行车计划
*/ */
@OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_RUN_PLAN) @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_RUN_PLAN)
public void saveRunPlan(Simulation simulation, CtcRunPlanParam planParam) { public CtcRunPlanParam saveRunPlan(Simulation simulation, CtcRunPlanParam planParam) {
ctcZoneService.saveRunPlan(simulation, planParam); return ctcZoneService.saveRunPlan(simulation, planParam);
} }
/** /**
@ -43,8 +43,8 @@ public class CtcZoneOperateHandler {
* @param model 接发 * @param model 接发
*/ */
@OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_TRACK_SECTION) @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_TRACK_SECTION)
public void saveTrackSection(Simulation simulation, String stationCode, String runPlanCode, String sectionCode, StationDirection.ReceiveAndDeliverModel model) { public CtcRunPlanParam saveTrackSection(Simulation simulation, String stationCode, String runPlanCode, String sectionCode, StationDirection.ReceiveAndDeliverModel model) {
ctcZoneService.saveTrackSection(simulation, stationCode, runPlanCode, sectionCode, model); return ctcZoneService.saveTrackSection(simulation, stationCode, runPlanCode, sectionCode, model);
} }
/** /**
@ -57,8 +57,8 @@ public class CtcZoneOperateHandler {
* @param model 接发 * @param model 接发
*/ */
@OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_TRIP_NUMBER) @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_TRIP_NUMBER)
public void saveTripNumber(Simulation simulation, String stationCode, String runPlanCode, String tripNumber, StationDirection.ReceiveAndDeliverModel model) { public CtcRunPlanParam saveTripNumber(Simulation simulation, String stationCode, String runPlanCode, String tripNumber, StationDirection.ReceiveAndDeliverModel model) {
ctcZoneService.saveTripNumber(simulation, stationCode, runPlanCode, tripNumber, model); return ctcZoneService.saveTripNumber(simulation, stationCode, runPlanCode, tripNumber, model);
} }
/** /**
@ -71,8 +71,8 @@ public class CtcZoneOperateHandler {
* @param model 接发 * @param model 接发
*/ */
@OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_PLAN_TIME) @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_PLAN_TIME)
public void savePlanTime(Simulation simulation, String stationCode, String runPlanCode, String planTime, StationDirection.ReceiveAndDeliverModel model) { public CtcRunPlanParam savePlanTime(Simulation simulation, String stationCode, String runPlanCode, String planTime, StationDirection.ReceiveAndDeliverModel model) {
ctcZoneService.savePlanTime(simulation, stationCode, runPlanCode, LocalDateTime.parse(planTime), model); return ctcZoneService.savePlanTime(simulation, stationCode, runPlanCode, LocalDateTime.parse(planTime), model);
} }
/** /**
@ -85,8 +85,8 @@ public class CtcZoneOperateHandler {
* @param model 接发 * @param model 接发
*/ */
@OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_PLAN_TIME_MINUTE) @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_PLAN_TIME_MINUTE)
public void savePlanTime(Simulation simulation, String stationCode, String runPlanCode, int minutes, StationDirection.ReceiveAndDeliverModel model) { public CtcRunPlanParam savePlanTime(Simulation simulation, String stationCode, String runPlanCode, int minutes, StationDirection.ReceiveAndDeliverModel model) {
ctcZoneService.savePlanTime(simulation, stationCode, runPlanCode, minutes, model); return ctcZoneService.savePlanTime(simulation, stationCode, runPlanCode, minutes, model);
} }
/** /**
@ -99,8 +99,8 @@ public class CtcZoneOperateHandler {
* @param model 接发 * @param model 接发
*/ */
@OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_DIRECTION) @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_DIRECTION)
public void saveDirection(Simulation simulation, String stationCode, String runPlanCode, String directionCode, StationDirection.ReceiveAndDeliverModel model) { public CtcRunPlanParam saveDirection(Simulation simulation, String stationCode, String runPlanCode, String directionCode, StationDirection.ReceiveAndDeliverModel model) {
ctcZoneService.saveDirection(simulation, stationCode, runPlanCode, directionCode, model); return ctcZoneService.saveDirection(simulation, stationCode, runPlanCode, directionCode, model);
} }
/** /**
@ -113,8 +113,8 @@ public class CtcZoneOperateHandler {
* @param model 接发 * @param model 接发
*/ */
@OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_STATION) @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_SAVE_STATION)
public void saveStation(Simulation simulation, String stationCode, String runPlanCode, String planStationCode, StationDirection.ReceiveAndDeliverModel model) { public CtcRunPlanParam saveStation(Simulation simulation, String stationCode, String runPlanCode, String planStationCode, StationDirection.ReceiveAndDeliverModel model) {
ctcZoneService.saveStation(simulation, stationCode, runPlanCode, planStationCode, model); return ctcZoneService.saveStation(simulation, stationCode, runPlanCode, planStationCode, model);
} }
/** /**
@ -124,8 +124,8 @@ public class CtcZoneOperateHandler {
* @param runPlanCode 行车计划编码 * @param runPlanCode 行车计划编码
*/ */
@OperateHandlerMapping(type = Operation.Type.CTC_ZONE_DELETE_RUN_PLAN) @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_DELETE_RUN_PLAN)
public void deleteRunPlan(Simulation simulation, String stationCode, String runPlanCode) { public String deleteRunPlan(Simulation simulation, String stationCode, String runPlanCode) {
ctcZoneService.delRunPlan(simulation, stationCode, runPlanCode); return ctcZoneService.delRunPlan(simulation, stationCode, runPlanCode);
} }
/** /**
@ -135,8 +135,8 @@ public class CtcZoneOperateHandler {
* @param zoneCode 区间编码 * @param zoneCode 区间编码
*/ */
@OperateHandlerMapping(type = Operation.Type.CTC_ZONE_RELEASE_ZONE_RUN_PLAN) @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_RELEASE_ZONE_RUN_PLAN)
public void releaseRunPlan(Simulation simulation, String zoneCode) { public String releaseRunPlan(Simulation simulation, String zoneCode) {
ctcZoneService.releaseRunPlan(simulation, zoneCode); return ctcZoneService.releaseRunPlan(simulation, zoneCode);
} }
/** /**
@ -146,8 +146,19 @@ public class CtcZoneOperateHandler {
* @param stationCode 车站编码 * @param stationCode 车站编码
*/ */
@OperateHandlerMapping(type = Operation.Type.CTC_ZONE_RELEASE_STATION_RUN_PLAN) @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_RELEASE_STATION_RUN_PLAN)
public void releaseStationRunPlan(Simulation simulation, String stationCode) { public String releaseStationRunPlan(Simulation simulation, String stationCode) {
ctcZoneService.releaseStationRunPlan(simulation, stationCode); return ctcZoneService.releaseStationRunPlan(simulation, stationCode);
}
/**
* 发布车站的行车计划
*
* @param simulation 仿真
* @param stationCode 车站编码
*/
@OperateHandlerMapping(type = Operation.Type.CTC_ZONE_RELEASE_ALL_RUN_PLAN)
public String releaseAllRunPlan(Simulation simulation) {
return ctcZoneService.releaseAllRunPlan(simulation);
} }
/** /**
@ -157,7 +168,7 @@ public class CtcZoneOperateHandler {
* @param stationCode 车站编码 * @param stationCode 车站编码
*/ */
@OperateHandlerMapping(type = Operation.Type.CTC_ZONE_CONFIRM_APPLY_RUN_PLAY) @OperateHandlerMapping(type = Operation.Type.CTC_ZONE_CONFIRM_APPLY_RUN_PLAY)
public void confirmApplyRunPlan(Simulation simulation, String stationCode) { public String confirmApplyRunPlan(Simulation simulation, String stationCode) {
ctcZoneService.confirmApplyRunPlan(simulation, stationCode); return ctcZoneService.confirmApplyRunPlan(simulation, stationCode);
} }
} }

View File

@ -507,6 +507,26 @@ public class CtcRunPlanParam implements Cloneable {
return change ? this : null; return change ? this : null;
} }
public void setArrivePlanTime(String arrivePlanTime) {
if (!StringUtils.isEmpty(arrivePlanTime)) {
this.arrivePlanTime = LocalDateTime.parse(arrivePlanTime.replace(" ", "T"));
}
}
public void setArrivePlanTime(LocalDateTime arrivePlanTime) {
this.arrivePlanTime = arrivePlanTime;
}
public void setDepartPlanTime(String departPlanTime) {
if (!StringUtils.isEmpty(departPlanTime)) {
this.departPlanTime = LocalDateTime.parse(departPlanTime.replace(" ", "T"));
}
}
public void setDepartPlanTime(LocalDateTime departPlanTime) {
this.departPlanTime = departPlanTime;
}
@Override @Override
public String toString() { public String toString() {
return "CtcRunPlanParam{" + return "CtcRunPlanParam{" +

View File

@ -11,6 +11,7 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -142,6 +143,18 @@ public class CtcManageService {
} }
} }
/**
* 拉取所有的运行计划
*
* @param simulation 仿真实体
* @return 运行计划
*/
public List<CtcRunPlanParam> pullCtcManageRunPlan(Simulation simulation) {
List<CtcRunPlanParam> allList = new LinkedList<>();
simulation.getCtcRepository().getManageRepositoryMap().forEach((k, v) -> allList.addAll(v.getEditAllRunPlan()));
return allList;
}
/** /**
* 获取关联车站的车务管理端数据实体 * 获取关联车站的车务管理端数据实体
* *

View File

@ -7,6 +7,7 @@ import club.joylink.rtss.simulation.cbtc.CTC.data.CtcEffectRepository;
import club.joylink.rtss.simulation.cbtc.CTC.data.CtcStationRunPlanLog; import club.joylink.rtss.simulation.cbtc.CTC.data.CtcStationRunPlanLog;
import club.joylink.rtss.simulation.cbtc.CTC.data.RouteSequence; import club.joylink.rtss.simulation.cbtc.CTC.data.RouteSequence;
import club.joylink.rtss.simulation.cbtc.CTC.data.vo.CtcRunPlanVO; import club.joylink.rtss.simulation.cbtc.CTC.data.vo.CtcRunPlanVO;
import club.joylink.rtss.simulation.cbtc.CTC.data.vo.CtcStationRunPlanLogVO;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.map.Section; import club.joylink.rtss.simulation.cbtc.data.map.Section;
import club.joylink.rtss.simulation.cbtc.data.map.Station; import club.joylink.rtss.simulation.cbtc.data.map.Station;
@ -24,6 +25,7 @@ import java.time.LocalTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors;
@Component @Component
@Slf4j @Slf4j
@ -280,6 +282,17 @@ public class CtcStationRunPlanLogService {
} }
} }
/**
* 拉取车站最新运行计划
*
* @param simulation 仿真
* @return 运行计划列表
*/
public List<CtcStationRunPlanLogVO> pullStationRunPlan(Simulation simulation) {
List<CtcStationRunPlanLog> allRunPlanList = simulation.getCtcRepository().getAllRunPlanList();
return allRunPlanList.stream().map(r -> new CtcStationRunPlanLogVO(r)).collect(Collectors.toList());
}
/** /**
* 修改原始数据并返回修改属性的对象 * 修改原始数据并返回修改属性的对象
* *

View File

@ -12,10 +12,7 @@ import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.HashSet; import java.util.*;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
@Component @Component
@Slf4j @Slf4j
@ -30,13 +27,14 @@ public class CtcZoneService {
* @param simulation 仿真 * @param simulation 仿真
* @param planParam 行车计划 * @param planParam 行车计划
*/ */
public void saveRunPlan(Simulation simulation, CtcRunPlanParam planParam) { public CtcRunPlanParam saveRunPlan(Simulation simulation, CtcRunPlanParam planParam) {
CtcZoneRepository railwayRepository = simulation.getCtcRepository().getCtcZoneRepository(); CtcZoneRepository railwayRepository = simulation.getCtcRepository().getCtcZoneRepository();
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(railwayRepository); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(railwayRepository);
if (StringUtils.isEmpty(planParam.getRunPlanCode())) { // 初始化运行计划编码车次信息 if (StringUtils.isEmpty(planParam.getRunPlanCode())) { // 初始化运行计划编码车次信息
planParam.generateRunPlanCodeAndTripNumber(); planParam.generateRunPlanCodeAndTripNumber();
} }
railwayRepository.saveRunPlan(planParam); railwayRepository.saveRunPlan(planParam);
return planParam;
} }
/** /**
@ -48,7 +46,7 @@ public class CtcZoneService {
* @param sectionCode 股道 * @param sectionCode 股道
* @param model 接发 * @param model 接发
*/ */
public void saveTrackSection(Simulation simulation, String stationCode, String runPlanCode, String sectionCode, StationDirection.ReceiveAndDeliverModel model) { public CtcRunPlanParam saveTrackSection(Simulation simulation, String stationCode, String runPlanCode, String sectionCode, StationDirection.ReceiveAndDeliverModel model) {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(sectionCode); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(sectionCode);
CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode); CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode);
if (StationDirection.ReceiveAndDeliverModel.R.equals(model)) { if (StationDirection.ReceiveAndDeliverModel.R.equals(model)) {
@ -56,6 +54,7 @@ public class CtcZoneService {
} else { } else {
runPlanParam.setDepartSectionCode(sectionCode); runPlanParam.setDepartSectionCode(sectionCode);
} }
return runPlanParam;
} }
/** /**
@ -67,7 +66,7 @@ public class CtcZoneService {
* @param tripNumber 车次 * @param tripNumber 车次
* @param model 接发 * @param model 接发
*/ */
public void saveTripNumber(Simulation simulation, String stationCode, String runPlanCode, String tripNumber, StationDirection.ReceiveAndDeliverModel model) { public CtcRunPlanParam saveTripNumber(Simulation simulation, String stationCode, String runPlanCode, String tripNumber, StationDirection.ReceiveAndDeliverModel model) {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(tripNumber); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(tripNumber);
CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode); CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode);
if (StationDirection.ReceiveAndDeliverModel.R.equals(model)) { if (StationDirection.ReceiveAndDeliverModel.R.equals(model)) {
@ -75,6 +74,7 @@ public class CtcZoneService {
} else { } else {
runPlanParam.setDepartTripNumber(tripNumber); runPlanParam.setDepartTripNumber(tripNumber);
} }
return runPlanParam;
} }
/** /**
@ -86,7 +86,7 @@ public class CtcZoneService {
* @param planTime 计划时间 * @param planTime 计划时间
* @param model 接发 * @param model 接发
*/ */
public void savePlanTime(Simulation simulation, String stationCode, String runPlanCode, LocalDateTime planTime, StationDirection.ReceiveAndDeliverModel model) { public CtcRunPlanParam savePlanTime(Simulation simulation, String stationCode, String runPlanCode, LocalDateTime planTime, StationDirection.ReceiveAndDeliverModel model) {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(planTime); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(planTime);
CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode); CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode);
if (StationDirection.ReceiveAndDeliverModel.R.equals(model)) { if (StationDirection.ReceiveAndDeliverModel.R.equals(model)) {
@ -94,15 +94,17 @@ public class CtcZoneService {
} else { } else {
runPlanParam.setDepartPlanTime(planTime); runPlanParam.setDepartPlanTime(planTime);
} }
return runPlanParam;
} }
public void savePlanTime(Simulation simulation, String stationCode, String runPlanCode, int minutes, StationDirection.ReceiveAndDeliverModel model) { public CtcRunPlanParam savePlanTime(Simulation simulation, String stationCode, String runPlanCode, int minutes, StationDirection.ReceiveAndDeliverModel model) {
CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode); CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode);
if (StationDirection.ReceiveAndDeliverModel.R.equals(model)) { if (StationDirection.ReceiveAndDeliverModel.R.equals(model)) {
runPlanParam.setArrivePlanTime(runPlanParam.getArrivePlanTime().plusMinutes(minutes)); runPlanParam.setArrivePlanTime(runPlanParam.getArrivePlanTime().plusMinutes(minutes));
} else { } else {
runPlanParam.setDepartPlanTime(runPlanParam.getDepartPlanTime().plusMinutes(minutes)); runPlanParam.setDepartPlanTime(runPlanParam.getDepartPlanTime().plusMinutes(minutes));
} }
return runPlanParam;
} }
/** /**
@ -114,7 +116,7 @@ public class CtcZoneService {
* @param runPlanCode 运行计划编码 * @param runPlanCode 运行计划编码
* @param directionCode 方向编码 * @param directionCode 方向编码
*/ */
public void saveDirection(Simulation simulation, String stationCode, String runPlanCode, String directionCode, StationDirection.ReceiveAndDeliverModel model) { public CtcRunPlanParam saveDirection(Simulation simulation, String stationCode, String runPlanCode, String directionCode, StationDirection.ReceiveAndDeliverModel model) {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(directionCode); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(directionCode);
CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode); CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode);
if (StationDirection.ReceiveAndDeliverModel.R.equals(model)) { if (StationDirection.ReceiveAndDeliverModel.R.equals(model)) {
@ -122,6 +124,7 @@ public class CtcZoneService {
} else { } else {
runPlanParam.setDepartDirectionCode(directionCode); runPlanParam.setDepartDirectionCode(directionCode);
} }
return runPlanParam;
} }
/** /**
@ -133,7 +136,7 @@ public class CtcZoneService {
* @param planStationCode 计划方向车站编码 * @param planStationCode 计划方向车站编码
* @param model 接发 * @param model 接发
*/ */
public void saveStation(Simulation simulation, String stationCode, String runPlanCode, String planStationCode, StationDirection.ReceiveAndDeliverModel model) { public CtcRunPlanParam saveStation(Simulation simulation, String stationCode, String runPlanCode, String planStationCode, StationDirection.ReceiveAndDeliverModel model) {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(planStationCode); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(planStationCode);
CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode); CtcRunPlanParam runPlanParam = simulation.getCtcRepository().getCtcZoneRepository().queryRunPlan(stationCode, runPlanCode);
if (StationDirection.ReceiveAndDeliverModel.R.equals(model)) { if (StationDirection.ReceiveAndDeliverModel.R.equals(model)) {
@ -141,6 +144,7 @@ public class CtcZoneService {
} else { } else {
runPlanParam.setDepartStationCode(planStationCode); runPlanParam.setDepartStationCode(planStationCode);
} }
return runPlanParam;
} }
/** /**
@ -149,10 +153,11 @@ public class CtcZoneService {
* @param simulation 仿真 * @param simulation 仿真
* @param runPlanCode 行车计划编码 * @param runPlanCode 行车计划编码
*/ */
public void delRunPlan(Simulation simulation, String stationCode, String runPlanCode) { public String delRunPlan(Simulation simulation, String stationCode, String runPlanCode) {
CtcZoneRepository railwayRepository = simulation.getCtcRepository().getCtcZoneRepository(); CtcZoneRepository railwayRepository = simulation.getCtcRepository().getCtcZoneRepository();
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(railwayRepository); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(railwayRepository);
railwayRepository.delRunPlan(stationCode, runPlanCode); railwayRepository.delRunPlan(stationCode, runPlanCode);
return "success";
} }
/** /**
@ -161,7 +166,7 @@ public class CtcZoneService {
* @param simulation 仿真 * @param simulation 仿真
* @param zoneCode 区间编码 * @param zoneCode 区间编码
*/ */
public void releaseRunPlan(Simulation simulation, String zoneCode) { public String releaseRunPlan(Simulation simulation, String zoneCode) {
CtcZoneRepository zoneRepository = simulation.getCtcRepository().getCtcZoneRepository(); CtcZoneRepository zoneRepository = simulation.getCtcRepository().getCtcZoneRepository();
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(zoneRepository); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(zoneRepository);
CtcZone ctcZone = zoneRepository.getCtcZoneList().stream().filter(c -> zoneCode.equals(c.getCode())) CtcZone ctcZone = zoneRepository.getCtcZoneList().stream().filter(c -> zoneCode.equals(c.getCode()))
@ -180,6 +185,7 @@ public class CtcZoneService {
}); });
updateStageRunPlan(simulation, stationCodeSet); updateStageRunPlan(simulation, stationCodeSet);
} }
return "success";
} }
/** /**
@ -188,7 +194,7 @@ public class CtcZoneService {
* @param simulation 仿真 * @param simulation 仿真
* @param stationCode 车站编码 * @param stationCode 车站编码
*/ */
public void releaseStationRunPlan(Simulation simulation, String stationCode) { public String releaseStationRunPlan(Simulation simulation, String stationCode) {
CtcZoneRepository zoneRepository = simulation.getCtcRepository().getCtcZoneRepository(); CtcZoneRepository zoneRepository = simulation.getCtcRepository().getCtcZoneRepository();
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(zoneRepository); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(zoneRepository);
CtcManageRepository.StationRunPlanRepository runPlanRepository = zoneRepository.getStationRunPlanMap().get(stationCode); CtcManageRepository.StationRunPlanRepository runPlanRepository = zoneRepository.getStationRunPlanMap().get(stationCode);
@ -196,6 +202,23 @@ public class CtcZoneService {
CtcEffectRepository effectRepository = simulation.getCtcRepository().getCtcEffectRepository(); CtcEffectRepository effectRepository = simulation.getCtcRepository().getCtcEffectRepository();
effectRepository.releaseRunPlanByStationCode(runPlanRepository, simulation.getCorrectSystemTime()); effectRepository.releaseRunPlanByStationCode(runPlanRepository, simulation.getCorrectSystemTime());
updateStageRunPlan(simulation, stationCode); updateStageRunPlan(simulation, stationCode);
return "success";
}
/**
* 发布全量计划
*
* @param simulation 仿真
*/
public String releaseAllRunPlan(Simulation simulation) {
Map<String, CtcManageRepository.StationRunPlanRepository> stationRunPlanMap
= simulation.getCtcRepository().getCtcZoneRepository().getStationRunPlanMap();
CtcEffectRepository effectRepository = simulation.getCtcRepository().getCtcEffectRepository();
stationRunPlanMap.forEach((k, v) -> {
effectRepository.releaseRunPlanByStationCode(v, simulation.getCorrectSystemTime());
updateStageRunPlan(simulation, k);
});
return "success";
} }
/** /**
@ -204,7 +227,7 @@ public class CtcZoneService {
* @param simulation 仿真 * @param simulation 仿真
* @param stationCode 车站编码 * @param stationCode 车站编码
*/ */
public void confirmApplyRunPlan(Simulation simulation, String stationCode) { public String confirmApplyRunPlan(Simulation simulation, String stationCode) {
// 获取生效区信息 // 获取生效区信息
CtcEffectRepository ctcEffectRepository = simulation.getCtcRepository().getCtcEffectRepository(); CtcEffectRepository ctcEffectRepository = simulation.getCtcRepository().getCtcEffectRepository();
// 发布至生效区 // 发布至生效区
@ -213,6 +236,17 @@ public class CtcZoneService {
runPlanLogService.doUpdateRunPlanLog(simulation, stationCode, ctcEffectRepository.getCtcRunPlan(stationCode)); runPlanLogService.doUpdateRunPlanLog(simulation, stationCode, ctcEffectRepository.getCtcRunPlan(stationCode));
// 清空生效区 // 清空生效区
ctcEffectRepository.clearStationApplyRunPlan(stationCode); ctcEffectRepository.clearStationApplyRunPlan(stationCode);
return "success";
}
/**
* 获取全量运行计划
*
* @param simulation 仿真
* @return 运行计划列表
*/
public List<CtcRunPlanParam> pullRailwayRunPlan(Simulation simulation) {
return simulation.getCtcRepository().getCtcZoneRepository().getAllRunPlanList();
} }
/** /**

View File

@ -1,8 +1,12 @@
package club.joylink.rtss.simulation.cbtc.CTC; package club.joylink.rtss.simulation.cbtc.CTC;
import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.CtcRunPlanParam; import club.joylink.rtss.simulation.cbtc.CTC.data.CtcRepository;
import club.joylink.rtss.simulation.cbtc.CTC.data.*; import club.joylink.rtss.simulation.cbtc.CTC.data.CtcStationRunPlanLog;
import club.joylink.rtss.simulation.cbtc.CTC.data.vo.*; import club.joylink.rtss.simulation.cbtc.CTC.data.RouteSequence;
import club.joylink.rtss.simulation.cbtc.CTC.data.TrackView;
import club.joylink.rtss.simulation.cbtc.CTC.data.vo.CtcStationRunPlanLogVO;
import club.joylink.rtss.simulation.cbtc.CTC.data.vo.RouteSequenceVO;
import club.joylink.rtss.simulation.cbtc.CTC.data.vo.TrackViewVO;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
import club.joylink.rtss.simulation.cbtc.data.map.*; import club.joylink.rtss.simulation.cbtc.data.map.*;
@ -46,12 +50,6 @@ public class CTCLogicLoop {
// 发送运行计划变化消息 // 发送运行计划变化消息
sendRunPlanChangeMessage(simulation); sendRunPlanChangeMessage(simulation);
sendRunPlanRemoveMessage(simulation); sendRunPlanRemoveMessage(simulation);
// 发送车务管理端消息(编辑区)
sendManageChange(simulation);
sendManageRemove(simulation);
// 发送铁路局
sendZoneRunPlanChange(simulation);
sendZoneRunPlanRemove(simulation);
// 下发计划 // 下发计划
sendZoneRunPlanSend(simulation); sendZoneRunPlanSend(simulation);
} }
@ -237,77 +235,6 @@ public class CTCLogicLoop {
simulation.addFixedRateJob(MESSAGE_NAME, () -> this.sendMessage(simulation), MESSAGE_RATE); simulation.addFixedRateJob(MESSAGE_NAME, () -> this.sendMessage(simulation), MESSAGE_RATE);
} }
/**
* 发送铁路局行车区段信息列表
*
* @param simulation 仿真
* @param userIds 用户
*/
public void sendAllZoneInfo(Simulation simulation, Set<String> userIds) {
List<CtcZoneVO> ctcZoneVOList = simulation.getCtcRepository().getCtcZoneRepository().getCtcZoneList().stream()
.map(r -> new CtcZoneVO(r)).collect(Collectors.toList());
sendCtcMessage(simulation.getId(), ctcZoneVOList, WebSocketMessageType.SIMULATION_CTC_ZONE, simulation.getSimulationUserIds());
}
/**
* 行车区段运行计划变化
*
* @param simulation 仿真
* @param userIds 用户
*/
public void sendAllZoneRunPlan(Simulation simulation, Set<String> userIds) {
CtcZoneRepositoryVO ctcZoneRepositoryVO = simulation.getCtcRepository().getCtcZoneRepositoryVO();
synchronized (ctcZoneRepositoryVO) {
List<CtcRunPlanParam> allList = new ArrayList<>();
if (ctcZoneRepositoryVO.getRunPlanParamMap().isEmpty()) {
simulation.getCtcRepository().getCtcZoneRepository().getStationRunPlanMap().forEach((k, v) -> {
allList.addAll(ctcZoneRepositoryVO.compareAndReturnChangeRunPlan(v));
});
} else {
allList.addAll(ctcZoneRepositoryVO.getRunPlanParamMap().values());
}
if (!CollectionUtils.isEmpty(allList)) {
sendCtcMessage(simulation.getId(), allList, WebSocketMessageType.SIMULATION_RAILWAY_RUN_PLAN_INIT
, userIds);
}
}
}
/**
* 行车区段运行计划变化
*
* @param simulation 仿真
*/
public void sendZoneRunPlanChange(Simulation simulation) {
CtcZoneRepositoryVO ctcZoneRepositoryVO = simulation.getCtcRepository().getCtcZoneRepositoryVO();
List<CtcRunPlanParam> allList = new ArrayList<>();
// 运行计划
simulation.getCtcRepository().getCtcZoneRepository().getStationRunPlanMap()
.forEach((k, v) -> allList.addAll(ctcZoneRepositoryVO.compareAndReturnChangeRunPlan(v)));
if (!CollectionUtils.isEmpty(allList)) {
sendCtcMessage(simulation.getId(), allList, WebSocketMessageType.SIMULATION_RAILWAY_RUN_PLAN_CHANGE
, simulation.getSimulationUserIds());
}
}
/**
* 行车区段调度台运行计划删除
*
* @param simulation 仿真
*/
public void sendZoneRunPlanRemove(Simulation simulation) {
CtcZoneRepositoryVO ctcZoneRepositoryVO = simulation.getCtcRepository().getCtcZoneRepositoryVO();
List<CtcRunPlanParam> allList = new ArrayList<>();
// 运行计划
simulation.getCtcRepository().getCtcZoneRepository().getStationRunPlanMap()
.forEach((k, v) -> allList.addAll(ctcZoneRepositoryVO.compareAndReturnRemoveRunPlan(v)));
if (!CollectionUtils.isEmpty(allList)) {
sendCtcMessage(simulation.getId(), allList, WebSocketMessageType.SIMULATION_RAILWAY_RUN_PLAN_REMOVE
, simulation.getSimulationUserIds());
}
}
/** /**
* 行车区段运行计划下发 * 行车区段运行计划下发
* *
@ -320,64 +247,6 @@ public class CTCLogicLoop {
} }
} }
/**
* 初始时发送
*
* @param simulation 仿真
* @param userIds 用户
*/
public void sendAllManageChange(Simulation simulation, Set<String> userIds) {
CtcManageRepositoryVO ctcManageRepositoryVO = simulation.getCtcRepository().getCtcManageRepositoryVO();
synchronized (ctcManageRepositoryVO) {
List<CtcRunPlanParam> allList = new ArrayList<>();
if (ctcManageRepositoryVO.getEditAreaCtcRunPlanParamVOMap().isEmpty()) {
simulation.getCtcRepository().getManageRepositoryMap().forEach((k, v) -> {
allList.addAll(ctcManageRepositoryVO.compareAndReturnChangeRunPlan(v.getEditAreaMap().getRunPlanRepository(), true));
});
} else {
allList.addAll(ctcManageRepositoryVO.getEditAreaCtcRunPlanParamVOMap().values());
}
if (!CollectionUtils.isEmpty(allList)) {
sendCtcMessage(simulation.getId(), allList, WebSocketMessageType.SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_INIT
, userIds);
}
}
}
/**
* 发送管理端编辑区变更数据
*
* @param simulation 仿真数据
*/
public void sendManageChange(Simulation simulation) {
CtcManageRepositoryVO ctcManageRepositoryVO = simulation.getCtcRepository().getCtcManageRepositoryVO();
List<CtcRunPlanParam> allList = new ArrayList<>();
simulation.getCtcRepository().getManageRepositoryMap().forEach((k, v) -> {
allList.addAll(ctcManageRepositoryVO.compareAndReturnChangeRunPlan(v.getEditAreaMap().getRunPlanRepository(), true));
});
if (!CollectionUtils.isEmpty(allList)) {
sendCtcMessage(simulation.getId(), allList, WebSocketMessageType.SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_CHANGE
, simulation.getSimulationUserIds());
}
}
/**
* 发送管理端编辑区数据删除数据
*
* @param simulation 仿真数据
*/
public void sendManageRemove(Simulation simulation) {
CtcManageRepositoryVO ctcManageRepositoryVO = simulation.getCtcRepository().getCtcManageRepositoryVO();
List<CtcRunPlanParam> allList = new ArrayList<>();
simulation.getCtcRepository().getManageRepositoryMap().forEach((k, v) -> {
allList.addAll(ctcManageRepositoryVO.compareAndReturnRemoveRunPlan(v.getEditAreaMap().getRunPlanRepository(), true));
});
if (!CollectionUtils.isEmpty(allList)) {
sendCtcMessage(simulation.getId(), allList
, WebSocketMessageType.SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_REMOVE, simulation.getSimulationUserIds());
}
}
/** /**
* 发送CTC初始行车日志变化 * 发送CTC初始行车日志变化
* *
@ -454,34 +323,6 @@ public class CTCLogicLoop {
} }
} }
/**
* 发送调度台消息
*
* @param simulationId 仿真ID
* @param messageInfo 消息
* @param userIds 用户ID
* @param <T> 消息类型
*/
public <T> void sendCtcDispatcherMessage(String simulationId, T messageInfo, Set<String> userIds) {
if (messageInfo != null) {
sendCtcMessage(simulationId, messageInfo, WebSocketMessageType.SIMULATION_CTC_DISPATCHER_MESSAGE, userIds);
}
}
/**
* CTC邻站消息
*
* @param simulationId 仿真ID
* @param messageInfo 消息
* @param userIds 用户ID
* @param <T> 消息类型
*/
public <T> void sendCtcAdjacentStationMessage(String simulationId, T messageInfo, Set<String> userIds) {
if (messageInfo != null) {
sendCtcMessage(simulationId, messageInfo, WebSocketMessageType.SIMULATION_CTC_ADJACENT_STATION_MESSAGE, userIds);
}
}
/** /**
* 发送CTC运行计划消息 * 发送CTC运行计划消息
* *

View File

@ -136,6 +136,10 @@ public class CtcEffectRepository {
return null; return null;
} }
return this.stationStageRunPlanMap.values().stream() return this.stationStageRunPlanMap.values().stream()
.filter(r -> {
Integer oldVersion = this.getStageRunPlanVersionMap().get(r.getStationCode());
return oldVersion == null || oldVersion < r.getVersion().get();
})
.map(r -> { .map(r -> {
Map<String, Object> dataMap = new HashMap<>(); Map<String, Object> dataMap = new HashMap<>();
dataMap.put("stationCode", r.stationCode); dataMap.put("stationCode", r.stationCode);
@ -242,18 +246,6 @@ public class CtcEffectRepository {
this.version.set(version); this.version.set(version);
} }
/**
* 发布计划表
*
* @param ctcRunPlanVOList 计划列表
* @param updateTime 更新时间
*/
public void updateRunPlanList(List<CtcRunPlanVO> ctcRunPlanVOList, LocalDateTime updateTime) {
this.ctcRunPlanVOList = ctcRunPlanVOList;
this.version.incrementAndGet();
this.updateTime = updateTime;
}
/** /**
* 插入计划信息 * 插入计划信息
* *

View File

@ -7,9 +7,11 @@ import lombok.Setter;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/** /**
* 车务管理端数据(调度台区段) * 车务管理端数据(调度台区段)
@ -110,6 +112,10 @@ public class CtcManageRepository {
.filter(r -> r.getTripNumber().equals(tripNumber)).count(); .filter(r -> r.getTripNumber().equals(tripNumber)).count();
} }
public List<CtcRunPlanParam> getEditAllRunPlan() {
return this.editAreaMap.getRunPlanRepository().getAllRunPlanParam();
}
/** /**
* 管理端工作区 * 管理端工作区
*/ */
@ -240,5 +246,9 @@ public class CtcManageRepository {
public StationRunPlanRepository() { public StationRunPlanRepository() {
this.version = new AtomicInteger(0); this.version = new AtomicInteger(0);
} }
public List<CtcRunPlanParam> getAllRunPlanParam() {
return this.runPlanParamMap.values().stream().collect(Collectors.toList());
}
} }
} }

View File

@ -2,7 +2,10 @@ package club.joylink.rtss.simulation.cbtc.CTC.data;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.CtcRunPlanParam; import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.CtcRunPlanParam;
import club.joylink.rtss.simulation.cbtc.CTC.data.vo.*; import club.joylink.rtss.simulation.cbtc.CTC.data.vo.CtcRunPlanVO;
import club.joylink.rtss.simulation.cbtc.CTC.data.vo.CtcStationRunPlanLogVO;
import club.joylink.rtss.simulation.cbtc.CTC.data.vo.RouteSequenceVO;
import club.joylink.rtss.simulation.cbtc.CTC.data.vo.TrackViewVO;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder; import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
import club.joylink.rtss.simulation.cbtc.data.map.Station; import club.joylink.rtss.simulation.cbtc.data.map.Station;
@ -35,16 +38,8 @@ public class CtcRepository {
/******************************************* 以下为调度台数据:车站为单位 *********************************************/ /******************************************* 以下为调度台数据:车站为单位 *********************************************/
/**
* 数据
*/
private final CtcZoneRepository ctcZoneRepository = new CtcZoneRepository(); private final CtcZoneRepository ctcZoneRepository = new CtcZoneRepository();
/**
* 状态
*/
private final CtcZoneRepositoryVO ctcZoneRepositoryVO = new CtcZoneRepositoryVO();
/******************************************* 以上为调度台数据:车站为单位 *********************************************/ /******************************************* 以上为调度台数据:车站为单位 *********************************************/
/******************************************* 以下为总数据:车站为单位 ************************************************/ /******************************************* 以下为总数据:车站为单位 ************************************************/
@ -59,12 +54,6 @@ public class CtcRepository {
* 车站为key * 车站为key
*/ */
private final Map<String, CtcManageRepository> manageRepositoryMap = new ConcurrentHashMap<>(); private final Map<String, CtcManageRepository> manageRepositoryMap = new ConcurrentHashMap<>();
/**
* 管理终端数据状态
*/
private final CtcManageRepositoryVO ctcManageRepositoryVO = new CtcManageRepositoryVO();
/******************************************* 以上为车务管理终端数据:车站为单位 ****************************************/ /******************************************* 以上为车务管理终端数据:车站为单位 ****************************************/
/******************************************* 以下为车站终端数据:车站为单位 *******************************************/ /******************************************* 以下为车站终端数据:车站为单位 *******************************************/
@ -125,10 +114,8 @@ public class CtcRepository {
public void reset(Simulation simulation) { public void reset(Simulation simulation) {
// 仿真运行数据直接清空 // 仿真运行数据直接清空
this.ctcZoneRepository.reset(); this.ctcZoneRepository.reset();
this.ctcZoneRepositoryVO.reset();
this.ctcEffectRepository.reset(); this.ctcEffectRepository.reset();
this.manageRepositoryMap.clear(); this.manageRepositoryMap.clear();
this.ctcManageRepositoryVO.reset();
this.allRunPlanList.clear(); this.allRunPlanList.clear();
this.simulationRunPlanMap.clear(); this.simulationRunPlanMap.clear();
this.runPlanStatusVOMap.clear(); // 运行计划状态清除 this.runPlanStatusVOMap.clear(); // 运行计划状态清除

View File

@ -65,6 +65,16 @@ public class CtcZoneRepository {
return runPlanParam; return runPlanParam;
} }
/**
* 获取所有运行计划
*/
public List<CtcRunPlanParam> getAllRunPlanList() {
List<CtcRunPlanParam> allList = new LinkedList<>();
this.stationRunPlanMap.forEach((k, v) -> allList.addAll(v.getAllRunPlanParam()));
return allList;
}
/** /**
* 重置 * 重置
*/ */

View File

@ -1,120 +0,0 @@
package club.joylink.rtss.simulation.cbtc.CTC.data.vo;
import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.CtcRunPlanParam;
import club.joylink.rtss.simulation.cbtc.CTC.data.CtcManageRepository;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 车务管理端数据状态
*/
@Getter
@Setter
public class CtcManageRepositoryVO {
/**
* 编辑区股道版本状态
*/
private final Map<String, Integer> editAreaTrackSectionVersionMap = new HashMap<>();
/**
* 编辑区股道状态
*/
private final Map<String, TrackSectionVO> editAreaTrackSectionVOMap = new HashMap<>();
/**
* 编辑区运行计划版本状态
*/
private final Map<String, Integer> editAreaCtcRunPlanVersionMap = new HashMap<>();
/**
* 编辑区行车计划状态
*/
private final Map<String, CtcRunPlanParam> editAreaCtcRunPlanParamVOMap = new HashMap<>();
/**
* 生效区股道版本状态
*/
private final Map<String, Integer> effectAreaTrackSectionVersionMap = new HashMap<>();
/**
* 生效区股道状态
*/
private final Map<String, TrackSectionVO> effectAreaTrackSectionVOMap = new HashMap<>();
/**
* 生效区运行计划版本状态
*/
private final Map<String, Integer> effectAreaCtcRunPlanVersionMap = new HashMap<>();
/**
* 生效区行车计划状态
*/
private final Map<String, CtcRunPlanParam> effectAreaCtcRunPlanParamVOMap = new HashMap<>();
/**
* 比较并返回变化过的运行计划
*
* @param runPlanRepository 运行计划
* @param isEdit 编辑区
* @return 变化过的
*/
public List<CtcRunPlanParam> compareAndReturnChangeRunPlan(CtcManageRepository.StationRunPlanRepository runPlanRepository, boolean isEdit) {
List<CtcRunPlanParam> allList = new ArrayList<>(runPlanRepository.getRunPlanParamMap().size());
Map<String, CtcRunPlanParam> runPlanMap = isEdit ? this.editAreaCtcRunPlanParamVOMap : this.effectAreaCtcRunPlanParamVOMap;
runPlanRepository.getRunPlanParamMap().forEach((k, p) -> {
String mapKey = p.getStationCode() + "_" + p.getRunPlanCode();
CtcRunPlanParam param = runPlanMap.get(mapKey);
CtcRunPlanParam changeCtcRunPlanVo = null;
if (param == null) {
changeCtcRunPlanVo = p.clone();
runPlanMap.put(mapKey, changeCtcRunPlanVo);
allList.add(changeCtcRunPlanVo);
} else {
changeCtcRunPlanVo = param.compareAndChange(p);
if (changeCtcRunPlanVo != null) {
allList.add(changeCtcRunPlanVo);
}
}
});
return allList;
}
/**
* 比较并返回删除的运行计划
*
* @param runPlanRepository 运行计划
* @param isEdit 编辑区
* @return 删除的
*/
public List<CtcRunPlanParam> compareAndReturnRemoveRunPlan(CtcManageRepository.StationRunPlanRepository runPlanRepository, boolean isEdit) {
Map<String, CtcRunPlanParam> runPlanMap = isEdit ? this.editAreaCtcRunPlanParamVOMap : this.effectAreaCtcRunPlanParamVOMap;
List<CtcRunPlanParam> messageInfo = runPlanMap.values().stream()
.filter(vo -> vo.getStationCode().equals(runPlanRepository.getStationCode()) && !runPlanRepository.isExit(vo.getRunPlanCode()))
.map(vo -> vo.buildRemoveParam()).collect(Collectors.toList());
// 移除数据
if (!CollectionUtils.isEmpty(messageInfo)) {
messageInfo.forEach(vo -> runPlanMap.remove(vo.getStationCode() + "_" + vo.getRunPlanCode()));
}
return messageInfo;
}
public void reset() {
this.editAreaTrackSectionVersionMap.clear();
this.editAreaTrackSectionVOMap.clear();
this.editAreaCtcRunPlanVersionMap.clear();
this.editAreaCtcRunPlanParamVOMap.clear();
this.effectAreaTrackSectionVersionMap.clear();
this.effectAreaTrackSectionVOMap.clear();
this.effectAreaCtcRunPlanVersionMap.clear();
this.effectAreaCtcRunPlanParamVOMap.clear();
}
}

View File

@ -54,7 +54,8 @@ public class CtcRunPlanVO {
* @param runPlanLog 行车日志 * @param runPlanLog 行车日志
*/ */
public static CtcRunPlanVO compareAndChange(CtcRunPlanParam runPlanParam, CtcStationRunPlanLog runPlanLog) { public static CtcRunPlanVO compareAndChange(CtcRunPlanParam runPlanParam, CtcStationRunPlanLog runPlanLog) {
return compareAndChange(runPlanParam, runPlanLog.getPlanParam()); CtcRunPlanParam planParam = runPlanLog == null ? null : runPlanLog.getPlanParam();
return compareAndChange(runPlanParam, planParam);
} }
/** /**

View File

@ -1,73 +0,0 @@
package club.joylink.rtss.simulation.cbtc.CTC.data.vo;
import club.joylink.rtss.simulation.cbtc.ATS.operation.vo.CtcRunPlanParam;
import club.joylink.rtss.simulation.cbtc.CTC.data.CtcManageRepository;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
/**
* CTC行车区间关联数据状态
*/
@Setter
@Getter
public class CtcZoneRepositoryVO {
/**
* 运行计划状态
*/
private final Map<String, CtcRunPlanParam> runPlanParamMap = new ConcurrentHashMap<>();
/**
* 比较并返回变化过的运行计划
*
* @param runPlanRepository 运行计划
* @return 变化过的
*/
public List<CtcRunPlanParam> compareAndReturnChangeRunPlan(CtcManageRepository.StationRunPlanRepository runPlanRepository) {
List<CtcRunPlanParam> allList = new ArrayList<>(runPlanRepository.getRunPlanParamMap().size());
runPlanRepository.getRunPlanParamMap().forEach((k, p) -> {
String mapKey = p.getStationCode() + "_" + p.getRunPlanCode();
CtcRunPlanParam param = this.runPlanParamMap.get(mapKey);
CtcRunPlanParam changeCtcRunPlanVo = null;
if (param == null) {
changeCtcRunPlanVo = p.clone();
this.runPlanParamMap.put(mapKey, changeCtcRunPlanVo);
allList.add(changeCtcRunPlanVo);
} else {
changeCtcRunPlanVo = param.compareAndChange(p);
if (changeCtcRunPlanVo != null) {
allList.add(changeCtcRunPlanVo);
}
}
});
return allList;
}
/**
* 比较并返回删除的运行计划
*
* @param runPlanRepository 运行计划
* @return 删除的
*/
public List<CtcRunPlanParam> compareAndReturnRemoveRunPlan(CtcManageRepository.StationRunPlanRepository runPlanRepository) {
List<CtcRunPlanParam> messageInfo = this.runPlanParamMap.values().stream()
.filter(vo -> vo.getStationCode().equals(runPlanRepository.getStationCode()) && !runPlanRepository.isExit(vo.getRunPlanCode()))
.map(vo -> vo.buildRemoveParam()).collect(Collectors.toList());
// 移除数据
if (!CollectionUtils.isEmpty(messageInfo)) {
messageInfo.forEach(vo -> this.runPlanParamMap.remove(vo.getStationCode() + "_" + vo.getRunPlanCode()));
}
return messageInfo;
}
public void reset() {
this.runPlanParamMap.clear();
}
}

View File

@ -164,11 +164,6 @@ public class Section extends DelayUnlockDevice {
*/ */
private Set<ZC> zcs = new HashSet<>(); private Set<ZC> zcs = new HashSet<>();
/**
* 分路不良类型
*/
private List<ShuntingType> shuntingTypeList;
// ------------------状态属性--------------------- // ------------------状态属性---------------------
/** /**
@ -261,6 +256,11 @@ public class Section extends DelayUnlockDevice {
*/ */
private boolean badShunt; private boolean badShunt;
/**
* 分路不良类型
*/
private List<ShuntingType> shuntingTypeList;
@Override @Override
public void reset() { public void reset() {
super.reset(); super.reset();

View File

@ -16,8 +16,6 @@ public enum SimulationSubscribeTopic {
PassengerFlow("/queue/simulation/passenger/{id}"), PassengerFlow("/queue/simulation/passenger/{id}"),
WeChatMini("/topic/simulation/assistant/{id}"), WeChatMini("/topic/simulation/assistant/{id}"),
Ctc("/queue/simulation/{id}/ctc"), //大铁CTC Ctc("/queue/simulation/{id}/ctc"), //大铁CTC
Ctc_Manager("/queue/simulation/{id}/ctcManage"), // 大铁CTC管理端
Ctc_RAILWAY("/queue/simulation/{id}/railway") // 大铁调度台
; ;
private String destPattern; private String destPattern;

View File

@ -112,22 +112,9 @@ public class SimulationUserWsListener {
Set<String> userIds = Stream.of(userId).collect(Collectors.toSet()); Set<String> userIds = Stream.of(userId).collect(Collectors.toSet());
// CTC运行日志发消息 // CTC运行日志发消息
ctcLogicLoop.sendAllRunPlanChangeMessage(simulation, userIds); ctcLogicLoop.sendAllRunPlanChangeMessage(simulation, userIds);
ctcLogicLoop.sendAllZoneInfo(simulation, userIds);
ctcLogicLoop.sendAllMessage(simulation); ctcLogicLoop.sendAllMessage(simulation);
break; break;
} }
case Ctc_Manager: { // CTC运行管理端
Set<String> userIds = Stream.of(userId).collect(Collectors.toSet());
// CTC运行日志发消息
ctcLogicLoop.sendAllZoneInfo(simulation, userIds);
ctcLogicLoop.sendAllManageChange(simulation, userIds);
break;
}
case Ctc_RAILWAY: { // CTC铁路局
Set<String> userIds = Stream.of(userId).collect(Collectors.toSet());
ctcLogicLoop.sendAllZoneInfo(simulation, userIds);
ctcLogicLoop.sendAllZoneRunPlan(simulation, userIds);
}
} }
} }

View File

@ -354,26 +354,6 @@ public enum WebSocketMessageType {
*/ */
Simulation_RailCtcStatus, Simulation_RailCtcStatus,
/**
* CTC 铁路局行车区段消息
*/
SIMULATION_CTC_ZONE,
/**
* 铁路局运行计划初始化
*/
SIMULATION_RAILWAY_RUN_PLAN_INIT,
/**
* 铁路局运行计划变化
*/
SIMULATION_RAILWAY_RUN_PLAN_CHANGE,
/**
* 铁路局运行计划移除
*/
SIMULATION_RAILWAY_RUN_PLAN_REMOVE,
/** /**
* 铁路局运行计划下发 * 铁路局运行计划下发
*/ */
@ -394,41 +374,8 @@ public enum WebSocketMessageType {
SIMULATION_CTC_RUN_PLAN_REMOVE, SIMULATION_CTC_RUN_PLAN_REMOVE,
/** /**
* CTC调度台消息类型 * 调度命令
*/ */
SIMULATION_CTC_DISPATCHER_MESSAGE,
/**
* CTC邻站消息
*/
SIMULATION_CTC_ADJACENT_STATION_MESSAGE,
/**
* 仿真CTC管理端
*/
SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_INIT,
/**
* 仿真CTC管理端移除操作
*/
SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_REMOVE,
/**
* 仿真编辑区运行计划变化
*/
SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_CHANGE,
/**
* 仿真生效区运行计划变化
*/
SIMULATION_CTC_MANAGER_RUN_PLAN_EFFECT_CHANGE,
/**
* 仿真CTC管理端生效区移除操作
*/
SIMULATION_CTC_MANAGER_RUN_PLAN_EFFECT_REMOVE,
/** 调度命令 */
SIMULATION_RAIL_CTC_DISPATCH_COMMAND, SIMULATION_RAIL_CTC_DISPATCH_COMMAND,
/** ------------ CTC消息信息 ----------- */ /** ------------ CTC消息信息 ----------- */
; ;

View File

@ -107,18 +107,6 @@ public class SocketMessageFactory {
topicList.add(String.format(WebSocketSubscribeTopic.Simulation, group)); topicList.add(String.format(WebSocketSubscribeTopic.Simulation, group));
break; break;
} }
case SIMULATION_RAILWAY_RUN_PLAN_INIT: // 铁路局运行计划初始化
case SIMULATION_RAILWAY_RUN_PLAN_CHANGE: // 铁路局运行计划变化
case SIMULATION_RAILWAY_RUN_PLAN_REMOVE: {// 铁路局运行计划移除
topicList.add(SimulationSubscribeTopic.Ctc_RAILWAY.buildDestination(group));
break;
}
case SIMULATION_CTC_ZONE: {
topicList.add(SimulationSubscribeTopic.Ctc.buildDestination(group));
topicList.add(SimulationSubscribeTopic.Ctc_Manager.buildDestination(group));
topicList.add(SimulationSubscribeTopic.Ctc_RAILWAY.buildDestination(group));
break;
}
case SIMULATION_RAILWAY_RUN_PLAN_SEND: // 铁路局运行计划下发 case SIMULATION_RAILWAY_RUN_PLAN_SEND: // 铁路局运行计划下发
case SIMULATION_CTC_RUN_PLAN_INIT: case SIMULATION_CTC_RUN_PLAN_INIT:
case SIMULATION_CTC_RUN_PLAN_CHANGE: case SIMULATION_CTC_RUN_PLAN_CHANGE:
@ -128,14 +116,6 @@ public class SocketMessageFactory {
topicList.add(SimulationSubscribeTopic.Ctc.buildDestination(group)); topicList.add(SimulationSubscribeTopic.Ctc.buildDestination(group));
break; break;
} }
case SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_INIT:
case SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_CHANGE:
case SIMULATION_CTC_MANAGER_RUN_PLAN_EDIT_REMOVE:
case SIMULATION_CTC_MANAGER_RUN_PLAN_EFFECT_CHANGE:
case SIMULATION_CTC_MANAGER_RUN_PLAN_EFFECT_REMOVE: {
topicList.add(SimulationSubscribeTopic.Ctc_Manager.buildDestination(group));
break;
}
case Simulation_Member_Change: case Simulation_Member_Change:
case Simulation_Start_Conversation: case Simulation_Start_Conversation:
case Simulation_Accept_Conversation: case Simulation_Accept_Conversation: