Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
e1f390fb6c
@ -227,25 +227,27 @@ public class AtpSectionService {
|
|||||||
// 道岔列表
|
// 道岔列表
|
||||||
List<Switch> relSwitchList = section.getRelSwitchList();
|
List<Switch> relSwitchList = section.getRelSwitchList();
|
||||||
// 反位情况下
|
// 反位情况下
|
||||||
|
Switch relSwitch = null;
|
||||||
if (relSwitchList.stream().anyMatch(Switch::isPosR)) {
|
if (relSwitchList.stream().anyMatch(Switch::isPosR)) {
|
||||||
Switch relSwitch = relSwitchList.stream().filter(Switch::isPosR).findFirst().orElse(null);
|
relSwitch = relSwitchList.stream().filter(Switch::isPosR).findFirst().orElse(null);
|
||||||
if (relSwitch != null) {
|
|
||||||
// 反位前区段列表
|
|
||||||
Section nextSection = relSwitch.getA();
|
|
||||||
do {
|
|
||||||
atpSectionList.add(0, nextSection);
|
|
||||||
nextSection = nextSection.getNextRunningSectionOf(!right);
|
|
||||||
} while (nextSection.getRelSwitch() != null && relSwitchList.contains(nextSection.getRelSwitch()));
|
|
||||||
|
|
||||||
// 反位后区段列表
|
|
||||||
nextSection = relSwitch.isPosN() ? relSwitch.getB() : relSwitch.getC();
|
|
||||||
while (nextSection != null && relSwitchList.contains(nextSection.getRelSwitch())) {
|
|
||||||
atpSectionList.add(nextSection);
|
|
||||||
nextSection = nextSection.getNextRunningSectionOf(right);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
relSwitchList.forEach(relSwitch -> atpSectionList.addAll(relSwitch.getSectionsByPosition()));
|
relSwitch = relSwitchList.stream().filter(Switch::isPosN).findFirst().orElse(null);
|
||||||
|
//relSwitchList.forEach(relSwitch -> atpSectionList.addAll(relSwitch.getSectionsByPosition()));
|
||||||
|
}
|
||||||
|
if (relSwitch != null) {
|
||||||
|
// 反位前区段列表
|
||||||
|
Section nextSection = relSwitch.getA();
|
||||||
|
do {
|
||||||
|
atpSectionList.add(0, nextSection);
|
||||||
|
nextSection = nextSection.getNextRunningSectionOf(!right);
|
||||||
|
} while (nextSection.getRelSwitch() != null && relSwitchList.contains(nextSection.getRelSwitch()));
|
||||||
|
|
||||||
|
// 反位后区段列表
|
||||||
|
nextSection = relSwitch.isPosN() ? relSwitch.getB() : relSwitch.getC();
|
||||||
|
while (nextSection != null && relSwitchList.contains(nextSection.getRelSwitch())) {
|
||||||
|
atpSectionList.add(nextSection);
|
||||||
|
nextSection = nextSection.getNextRunningSectionOf(right);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return atpSectionList;
|
return atpSectionList;
|
||||||
}
|
}
|
||||||
|
@ -980,6 +980,11 @@ public class Operation {
|
|||||||
* 设置终到车
|
* 设置终到车
|
||||||
*/
|
*/
|
||||||
CTC_LOG_SET_END_RUN_PLAN,
|
CTC_LOG_SET_END_RUN_PLAN,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实际时间平移多少分钟
|
||||||
|
*/
|
||||||
|
CTC_LOG_ACTUAL_TIME_ADD_MINUTE,
|
||||||
/**************调度台******************/
|
/**************调度台******************/
|
||||||
/**
|
/**
|
||||||
* 调度台保存运行计划
|
* 调度台保存运行计划
|
||||||
|
@ -217,11 +217,11 @@ public class CtcStationRunPlanOperateHandler {
|
|||||||
* @param stationCode 车站编码
|
* @param stationCode 车站编码
|
||||||
* @param runPlanCode 运行计划编码
|
* @param runPlanCode 运行计划编码
|
||||||
* @param taskKey 任务Key
|
* @param taskKey 任务Key
|
||||||
* @param status 是否设置 1 是 , 0 否
|
* @param task 设置任务
|
||||||
*/
|
*/
|
||||||
@OperateHandlerMapping(type = Operation.Type.CTC_LOG_SET_TASK)
|
@OperateHandlerMapping(type = Operation.Type.CTC_LOG_SET_TASK)
|
||||||
public void setTask(Simulation simulation, String stationCode, String runPlanCode, String taskKey, int status) {
|
public void setTask(Simulation simulation, String stationCode, String runPlanCode, String taskKey, CtcStationRunPlanLog.RunPlanTask task) {
|
||||||
ctcStationRunPlanLogService.setTask(simulation, stationCode, runPlanCode, taskKey, status);
|
ctcStationRunPlanLogService.setTask(simulation, stationCode, runPlanCode, taskKey, task);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -357,4 +357,19 @@ public class CtcStationRunPlanOperateHandler {
|
|||||||
public void setEndRunPlan(Simulation simulation, String stationCode, String runPlanCode, int status) {
|
public void setEndRunPlan(Simulation simulation, String stationCode, String runPlanCode, int status) {
|
||||||
ctcStationRunPlanLogService.setEndRunPlan(simulation, stationCode, runPlanCode, status);
|
ctcStationRunPlanLogService.setEndRunPlan(simulation, stationCode, runPlanCode, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改实际时间
|
||||||
|
*
|
||||||
|
* @param simulation 仿真
|
||||||
|
* @param stationCode 车站编码
|
||||||
|
* @param runPlanCode 运行计划编码
|
||||||
|
* @param minutes 分钟数
|
||||||
|
* @param model 接发
|
||||||
|
*/
|
||||||
|
@OperateHandlerMapping(type = Operation.Type.CTC_LOG_ACTUAL_TIME_ADD_MINUTE)
|
||||||
|
public void actualTimeAddMinute(Simulation simulation, String stationCode, String runPlanCode, int minutes, StationDirection.ReceiveAndDeliverModel model) {
|
||||||
|
ctcStationRunPlanLogService.actualTimeAddMinute(simulation, stationCode, runPlanCode, minutes, model);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@ -196,6 +197,16 @@ public class CtcRunPlanParam implements Cloneable {
|
|||||||
*/
|
*/
|
||||||
private RunType runType;
|
private RunType runType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据版本
|
||||||
|
*/
|
||||||
|
private AtomicInteger version = new AtomicInteger(0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否已接收
|
||||||
|
*/
|
||||||
|
private boolean receive;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除时构造实体
|
* 删除时构造实体
|
||||||
*
|
*
|
||||||
@ -672,6 +683,7 @@ public class CtcRunPlanParam implements Cloneable {
|
|||||||
Map<CtcStationRunPlanLog.RunPlanTask, Integer> map = new HashMap<>(this.runPlanTaskMap.size());
|
Map<CtcStationRunPlanLog.RunPlanTask, Integer> map = new HashMap<>(this.runPlanTaskMap.size());
|
||||||
map.putAll(this.runPlanTaskMap);
|
map.putAll(this.runPlanTaskMap);
|
||||||
clone.setRunPlanTaskMap(map);
|
clone.setRunPlanTaskMap(map);
|
||||||
|
clone.setVersion(new AtomicInteger(this.version.get()));
|
||||||
return clone;
|
return clone;
|
||||||
} catch (CloneNotSupportedException e) {
|
} catch (CloneNotSupportedException e) {
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
|
@ -130,17 +130,21 @@ public class StationDirectionService {
|
|||||||
* 接辅助按钮后续操作
|
* 接辅助按钮后续操作
|
||||||
*/
|
*/
|
||||||
private final ButtonThenInterface receiveAssistThen = (simulation, stationDirection) -> {
|
private final ButtonThenInterface receiveAssistThen = (simulation, stationDirection) -> {
|
||||||
// 按下接辅助,弹起发辅助
|
// 接辅助完成后,改变接方向
|
||||||
stationDirection.setDeliverAssistStatus(false);
|
stationDirection.setRunStatus(StationDirection.ReceiveAndDeliverModel.R);
|
||||||
// 重新设置倒计时时间
|
// 邻站修改发方向
|
||||||
stationDirection.getRemain().set(StationDirection.DEFAULT_RECEIVE_DELAY_TIME);
|
StationDirection adjacentDirection = getRelativeStationDirection(simulation, stationDirection);
|
||||||
|
adjacentDirection.setRunStatus(StationDirection.ReceiveAndDeliverModel.D);
|
||||||
|
// 办理完成后
|
||||||
|
stationDirection.resetAssistStatus();
|
||||||
|
adjacentDirection.resetAssistStatus();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接辅助按钮后续操作
|
* 发辅助按钮后续操作
|
||||||
*/
|
*/
|
||||||
private final ButtonThenInterface deliverAssistThen = (simulation, stationDirection) -> {
|
private final ButtonThenInterface deliverAssistThen = (simulation, stationDirection) -> {
|
||||||
// 按下发辅助,弹起发辅助
|
// 按下发辅助,弹起接辅助
|
||||||
stationDirection.setReceiveAssistStatus(false);
|
stationDirection.setReceiveAssistStatus(false);
|
||||||
// 重新设置倒计时时间
|
// 重新设置倒计时时间
|
||||||
stationDirection.getRemain().set(StationDirection.DEFAULT_DELIVER_DELAY_TIME);
|
stationDirection.getRemain().set(StationDirection.DEFAULT_DELIVER_DELAY_TIME);
|
||||||
|
@ -270,7 +270,10 @@ public class CtcStationRunPlanLogService {
|
|||||||
if (CollectionUtils.isEmpty(ctcRunPlanVOList)) {
|
if (CollectionUtils.isEmpty(ctcRunPlanVOList)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
CtcEffectRepository effectRepository = simulation.getCtcRepository().getCtcEffectRepository();
|
||||||
ctcRunPlanVOList.forEach(ctcRunPlanVO -> {
|
ctcRunPlanVOList.forEach(ctcRunPlanVO -> {
|
||||||
|
// 生效区接收状态修改
|
||||||
|
effectRepository.receiveRunPlan(stationCode, ctcRunPlanVO.getRunPlanCode());
|
||||||
CtcRunPlanParam modifyParam = ctcRunPlanVO.getRunPlan();
|
CtcRunPlanParam modifyParam = ctcRunPlanVO.getRunPlan();
|
||||||
CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository()
|
CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository()
|
||||||
.getRunPlanByRunPlanCodeAndStationCode(stationCode, ctcRunPlanVO.getRunPlanCode());
|
.getRunPlanByRunPlanCodeAndStationCode(stationCode, ctcRunPlanVO.getRunPlanCode());
|
||||||
@ -459,16 +462,18 @@ public class CtcStationRunPlanLogService {
|
|||||||
* @param simulation 仿真
|
* @param simulation 仿真
|
||||||
* @param stationCode 车站编码
|
* @param stationCode 车站编码
|
||||||
* @param runPlanCode 运行计划编码
|
* @param runPlanCode 运行计划编码
|
||||||
* @param taskKey 任务Key
|
* @param task 任务Key
|
||||||
*/
|
*/
|
||||||
public void setTask(Simulation simulation, String stationCode, String runPlanCode, String taskKey, int status) {
|
public void setTask(Simulation simulation, String stationCode, String runPlanCode, String taskKey, CtcStationRunPlanLog.RunPlanTask task) {
|
||||||
CtcStationRunPlanLog.RunPlanTask task = CtcStationRunPlanLog.RunPlanTask.getTaskByKey(taskKey);
|
|
||||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(task);
|
|
||||||
CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode);
|
CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode);
|
||||||
if (status == 1) { // 设置
|
CtcStationRunPlanLog.RunPlanTaskItem taskItem = runPlanLog.getRunPlanTaskItemMap().get(taskKey);
|
||||||
runPlanLog.getRunPlanTaskItemMap().put(task.getOptionKey(), new CtcStationRunPlanLog.RunPlanTaskItem(task));
|
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(taskItem);
|
||||||
} else { // 取消
|
if (CtcStationRunPlanLog.RunPlanTask.NO.equals(task)) { // 取消
|
||||||
runPlanLog.getRunPlanTaskItemMap().remove(task.getOptionKey());
|
taskItem.setType(task);
|
||||||
|
} else if (task.getOptionKey().equals(taskKey)) { // 设置
|
||||||
|
runPlanLog.getRunPlanTaskItemMap().put(taskKey, new CtcStationRunPlanLog.RunPlanTaskItem(task));
|
||||||
|
} else {
|
||||||
|
BusinessExceptionAssertEnum.DATA_ERROR.exception("任务类型不匹配");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -563,6 +568,24 @@ public class CtcStationRunPlanLogService {
|
|||||||
runPlanLog.setEndRunPlan(status == 1);
|
runPlanLog.setEndRunPlan(status == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改实际时间
|
||||||
|
*
|
||||||
|
* @param simulation 仿真
|
||||||
|
* @param stationCode 车站编码
|
||||||
|
* @param runPlanCode 运行计划编码
|
||||||
|
* @param minutes 分钟数
|
||||||
|
* @param model 接发
|
||||||
|
*/
|
||||||
|
public void actualTimeAddMinute(Simulation simulation, String stationCode, String runPlanCode, int minutes
|
||||||
|
, StationDirection.ReceiveAndDeliverModel model) {
|
||||||
|
CtcStationRunPlanLog runPlanLog = simulation.getCtcRepository().getRunPlanByRunPlanCode(stationCode, runPlanCode);
|
||||||
|
if (StationDirection.ReceiveAndDeliverModel.R.equals(model)) {
|
||||||
|
runPlanLog.arriveActualTime(minutes);
|
||||||
|
}
|
||||||
|
runPlanLog.departActualTime(minutes);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改原始数据,并返回修改属性的对象
|
* 修改原始数据,并返回修改属性的对象
|
||||||
*
|
*
|
||||||
@ -763,5 +786,4 @@ public class CtcStationRunPlanLogService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,7 @@ public class CtcZoneService {
|
|||||||
} else {
|
} else {
|
||||||
runPlanParam.setDepartSectionCode(sectionCode);
|
runPlanParam.setDepartSectionCode(sectionCode);
|
||||||
}
|
}
|
||||||
|
afterUpdate(runPlanParam);
|
||||||
return runPlanParam;
|
return runPlanParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,6 +95,7 @@ public class CtcZoneService {
|
|||||||
} else {
|
} else {
|
||||||
runPlanParam.setDepartTripNumber(tripNumber);
|
runPlanParam.setDepartTripNumber(tripNumber);
|
||||||
}
|
}
|
||||||
|
afterUpdate(runPlanParam);
|
||||||
return runPlanParam;
|
return runPlanParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,8 +121,8 @@ public class CtcZoneService {
|
|||||||
runPlanParam.setDepartTime(planTime);
|
runPlanParam.setDepartTime(planTime);
|
||||||
}
|
}
|
||||||
runPlanParam.setDepartPlanTime(planTime);
|
runPlanParam.setDepartPlanTime(planTime);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
afterUpdate(runPlanParam);
|
||||||
return runPlanParam;
|
return runPlanParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,6 +139,7 @@ public class CtcZoneService {
|
|||||||
}
|
}
|
||||||
runPlanParam.setDepartPlanTime(runPlanParam.getDepartPlanTime().plusMinutes(minutes));
|
runPlanParam.setDepartPlanTime(runPlanParam.getDepartPlanTime().plusMinutes(minutes));
|
||||||
}
|
}
|
||||||
|
afterUpdate(runPlanParam);
|
||||||
return runPlanParam;
|
return runPlanParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,6 +160,7 @@ public class CtcZoneService {
|
|||||||
} else {
|
} else {
|
||||||
runPlanParam.setDepartDirectionCode(directionCode);
|
runPlanParam.setDepartDirectionCode(directionCode);
|
||||||
}
|
}
|
||||||
|
afterUpdate(runPlanParam);
|
||||||
return runPlanParam;
|
return runPlanParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,6 +181,7 @@ public class CtcZoneService {
|
|||||||
} else {
|
} else {
|
||||||
runPlanParam.setDepartStationCode(planStationCode);
|
runPlanParam.setDepartStationCode(planStationCode);
|
||||||
}
|
}
|
||||||
|
afterUpdate(runPlanParam);
|
||||||
return runPlanParam;
|
return runPlanParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,10 +309,12 @@ public class CtcZoneService {
|
|||||||
CtcEffectRepository.StationRunPlanRepository runPlanRepository = ctcRepository.getEffectStationRunPlanMap(stationCode);
|
CtcEffectRepository.StationRunPlanRepository runPlanRepository = ctcRepository.getEffectStationRunPlanMap(stationCode);
|
||||||
List<CtcRunPlanVO> allList = new LinkedList<>();
|
List<CtcRunPlanVO> allList = new LinkedList<>();
|
||||||
runPlanRepository.getDataMap().forEach((runPlanCode, ctcRunPlanParam) -> {
|
runPlanRepository.getDataMap().forEach((runPlanCode, ctcRunPlanParam) -> {
|
||||||
CtcStationRunPlanLog runPlanLog = ctcRepository.getRunPlanByRunPlanCodeAndStationCode(stationCode, runPlanCode);
|
if (!ctcRunPlanParam.isReceive()) { // 对未接收的运行计划,进行对比,已接收的就不需要再做对比
|
||||||
CtcRunPlanVO runPlanVO = CtcRunPlanVO.compareAndChange(ctcRunPlanParam, runPlanLog);
|
CtcStationRunPlanLog runPlanLog = ctcRepository.getRunPlanByRunPlanCodeAndStationCode(stationCode, runPlanCode);
|
||||||
if (runPlanVO != null) {
|
CtcRunPlanVO runPlanVO = CtcRunPlanVO.compareAndChange(ctcRunPlanParam, runPlanLog);
|
||||||
allList.add(runPlanVO);
|
if (runPlanVO != null) {
|
||||||
|
allList.add(runPlanVO);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!allList.isEmpty()) {
|
if (!allList.isEmpty()) {
|
||||||
@ -321,4 +328,13 @@ public class CtcZoneService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新后操作
|
||||||
|
*
|
||||||
|
* @param param 参数
|
||||||
|
*/
|
||||||
|
private void afterUpdate(CtcRunPlanParam param) {
|
||||||
|
param.getVersion().incrementAndGet();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package club.joylink.rtss.simulation.cbtc.CTC.data;
|
package club.joylink.rtss.simulation.cbtc.CTC.data;
|
||||||
|
|
||||||
|
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.CtcRunPlanVO;
|
import club.joylink.rtss.simulation.cbtc.CTC.data.vo.CtcRunPlanVO;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.StationDirection;
|
import club.joylink.rtss.simulation.cbtc.data.map.StationDirection;
|
||||||
@ -102,11 +103,18 @@ public class CtcEffectRepository {
|
|||||||
effectRepository.setStationCode(stationCode);
|
effectRepository.setStationCode(stationCode);
|
||||||
this.stationRunPlanMap.put(stationCode, effectRepository);
|
this.stationRunPlanMap.put(stationCode, effectRepository);
|
||||||
}
|
}
|
||||||
// 增加版本
|
|
||||||
effectRepository.setUpdateTime(updateDateTime);
|
effectRepository.setUpdateTime(updateDateTime);
|
||||||
effectRepository.getVersion().incrementAndGet();
|
CtcRunPlanParam oldPlan;
|
||||||
|
boolean change = false;
|
||||||
for (Map.Entry<String, CtcRunPlanParam> v : runPlanMap.entrySet()) {
|
for (Map.Entry<String, CtcRunPlanParam> v : runPlanMap.entrySet()) {
|
||||||
effectRepository.save(v.getValue().clone());
|
oldPlan = effectRepository.query(v.getValue().getRunPlanCode());
|
||||||
|
if (oldPlan == null || oldPlan.getVersion().get() < v.getValue().getVersion().get()) {
|
||||||
|
effectRepository.save(v.getValue().clone());
|
||||||
|
change = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (change) { // 增加版本
|
||||||
|
effectRepository.getVersion().incrementAndGet();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -256,6 +264,20 @@ public class CtcEffectRepository {
|
|||||||
return repository.query(code);
|
return repository.query(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改运行计划为接收状态
|
||||||
|
*
|
||||||
|
* @param stationCode 车站编码
|
||||||
|
* @param runPlanCode 运行计划编码
|
||||||
|
*/
|
||||||
|
public void receiveRunPlan(String stationCode, String runPlanCode) {
|
||||||
|
StationRunPlanRepository repository = this.stationRunPlanMap.get(stationCode);
|
||||||
|
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(repository);
|
||||||
|
CtcRunPlanParam runPlanParam = repository.query(runPlanCode);
|
||||||
|
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(runPlanParam);
|
||||||
|
runPlanParam.setReceive(true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 阶段计划数据
|
* 阶段计划数据
|
||||||
*/
|
*/
|
||||||
@ -489,7 +511,6 @@ public class CtcEffectRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void reset() {
|
public void reset() {
|
||||||
this.stationRunPlanMap.clear();
|
this.stationRunPlanMap.clear();
|
||||||
this.stationApplyRunPlanMap.clear();
|
this.stationApplyRunPlanMap.clear();
|
||||||
|
@ -9,15 +9,13 @@ 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.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
import java.util.regex.Matcher;
|
||||||
import java.util.Map;
|
import java.util.regex.Pattern;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -184,12 +182,14 @@ public class CtcStationRunPlanLog {
|
|||||||
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.getRunPlanTaskMap())) { // 运行计划任务
|
this.runPlanTaskItemMap = new HashMap<>(RunPlanTask.values().length); // 运行计划任务
|
||||||
this.runPlanTaskItemMap = paramInfo.getRunPlanTaskMap().keySet().stream()
|
RunPlanTask.getOptionKeyList().forEach(key -> this.runPlanTaskItemMap.put(key, new RunPlanTaskItem(RunPlanTask.NO)));
|
||||||
.collect(Collectors.toMap(RunPlanTask::getOptionKey, RunPlanTaskItem::new));
|
paramInfo.getRunPlanTaskMap().forEach((k, v) -> {
|
||||||
} else {
|
if (v != null && v > 0) {
|
||||||
this.runPlanTaskItemMap = new HashMap<>(0);
|
this.runPlanTaskItemMap.get(k.getOptionKey()).setType(k);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
// 删除状态
|
||||||
this.delete = paramInfo.getStatus() == -1;
|
this.delete = paramInfo.getStatus() == -1;
|
||||||
this.startRunPlan = paramInfo.getStartRunPlan() != null && paramInfo.getStartRunPlan();
|
this.startRunPlan = paramInfo.getStartRunPlan() != null && paramInfo.getStartRunPlan();
|
||||||
this.endRunPlan = paramInfo.getEndRunPlan() != null && paramInfo.getEndRunPlan();
|
this.endRunPlan = paramInfo.getEndRunPlan() != null && paramInfo.getEndRunPlan();
|
||||||
@ -334,6 +334,26 @@ public class CtcStationRunPlanLog {
|
|||||||
return (this.arriveRunPlan != null && this.arriveRunPlan.isElectrical()) || (this.departRunPlan != null && this.departRunPlan.isElectrical());
|
return (this.arriveRunPlan != null && this.arriveRunPlan.isElectrical()) || (this.departRunPlan != null && this.departRunPlan.isElectrical());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 到达实际时间增加minutes分钟
|
||||||
|
*
|
||||||
|
* @param minutes 分钟数
|
||||||
|
*/
|
||||||
|
public void arriveActualTime(int minutes) {
|
||||||
|
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(arriveRunPlan);
|
||||||
|
arriveRunPlan.actualAddMinute(minutes);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出发实际时间增加minutes分钟
|
||||||
|
*
|
||||||
|
* @param minutes 分钟数
|
||||||
|
*/
|
||||||
|
public void departActualTime(int minutes) {
|
||||||
|
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(departRunPlan);
|
||||||
|
departRunPlan.actualAddMinute(minutes);
|
||||||
|
}
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
@Getter
|
@Getter
|
||||||
public static class RunPlanItem {
|
public static class RunPlanItem {
|
||||||
@ -472,6 +492,37 @@ public class CtcStationRunPlanLog {
|
|||||||
public boolean isEffect() {
|
public boolean isEffect() {
|
||||||
return this.finish || RunPlanItem.WAIT.equals(this.adjacentMessage) || RunPlanItem.FINISH.equals(this.adjacentMessage);
|
return this.finish || RunPlanItem.WAIT.equals(this.adjacentMessage) || RunPlanItem.FINISH.equals(this.adjacentMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实际时间增加minute时间
|
||||||
|
*
|
||||||
|
* @param minute 分钟数
|
||||||
|
*/
|
||||||
|
public void actualAddMinute(int minute) {
|
||||||
|
LocalTime localTime = isValidDate(this.actualTime);
|
||||||
|
if (localTime != null) {
|
||||||
|
this.actualTime = localTime.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验时间并返回时间
|
||||||
|
* HH:mm (([0-1][0-9])|(2[0-3])):([0-5][0-9])$
|
||||||
|
* yyyy-MM-dd HH:mm \\d{4}(\\-|\\/|.)\\d{1,2}\\1\\d{1,2} ([0-1]?[0-9]|2[0-3]):([0-5][0-9])$
|
||||||
|
* yyyy-MM-dd HH:mm:ss \\d{4}(\\-|\\/|.)\\d{1,2}\\1\\d{1,2} ([0-1]?[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$
|
||||||
|
*
|
||||||
|
* @param dateStr 时间字符串
|
||||||
|
* @return 时间
|
||||||
|
*/
|
||||||
|
private LocalTime isValidDate(String dateStr) {
|
||||||
|
Pattern datePattern = Pattern.compile("(([0-1][0-9])|(2[0-3])):([0-5][0-9])$");
|
||||||
|
Matcher matcher = datePattern.matcher(dateStr);
|
||||||
|
if (matcher.find()) {
|
||||||
|
return LocalTime.parse(dateStr);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -576,6 +627,8 @@ public class CtcStationRunPlanLog {
|
|||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public enum RunPlanTask {
|
public enum RunPlanTask {
|
||||||
|
// 空任务
|
||||||
|
NO("", ""),
|
||||||
// 技术停点
|
// 技术停点
|
||||||
Technical_Stop_Point("stopPoint", "技术停点"),
|
Technical_Stop_Point("stopPoint", "技术停点"),
|
||||||
// 上水
|
// 上水
|
||||||
@ -625,9 +678,19 @@ public class CtcStationRunPlanLog {
|
|||||||
* @param key 唯一键
|
* @param key 唯一键
|
||||||
* @return 运行任务
|
* @return 运行任务
|
||||||
*/
|
*/
|
||||||
public static RunPlanTask getTaskByKey(String key) {
|
public static List<RunPlanTask> getTaskByKey(String key) {
|
||||||
return Arrays.stream(RunPlanTask.values()).filter(r -> r.getOptionKey().equals(key))
|
return Arrays.stream(RunPlanTask.values()).filter(r -> r.getOptionKey().equals(key))
|
||||||
.findFirst().orElseGet(null);
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取任务对应列key
|
||||||
|
*
|
||||||
|
* @return key列表
|
||||||
|
*/
|
||||||
|
public static List<String> getOptionKeyList() {
|
||||||
|
return Arrays.stream(RunPlanTask.values()).filter(r -> !StringUtils.isEmpty(r.getOptionKey()))
|
||||||
|
.map(r -> r.getOptionKey()).distinct().collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ 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 org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -81,7 +82,7 @@ public class CtcStationRunPlanLogVO {
|
|||||||
/**
|
/**
|
||||||
* 超限等级
|
* 超限等级
|
||||||
*/
|
*/
|
||||||
private String transfinite;
|
private CtcStationRunPlanLog.TransfiniteType transfinite;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否电力
|
* 是否电力
|
||||||
@ -155,7 +156,7 @@ public class CtcStationRunPlanLogVO {
|
|||||||
this.delete = ctcStationRunPlanLog.getDelete(); // 删除
|
this.delete = ctcStationRunPlanLog.getDelete(); // 删除
|
||||||
this.keyTrains = ctcStationRunPlanLog.getKeyTrains(); // 重点列车
|
this.keyTrains = ctcStationRunPlanLog.getKeyTrains(); // 重点列车
|
||||||
this.military = ctcStationRunPlanLog.getMilitary(); // 军用
|
this.military = ctcStationRunPlanLog.getMilitary(); // 军用
|
||||||
this.transfinite = ctcStationRunPlanLog.getTransfinite().getVal(); // 超限等级
|
this.transfinite = ctcStationRunPlanLog.getTransfinite(); // 超限等级
|
||||||
this.trackDiscordant = ctcStationRunPlanLog.getTrackDiscordant(); // 运行股道与基本径路不一致
|
this.trackDiscordant = ctcStationRunPlanLog.getTrackDiscordant(); // 运行股道与基本径路不一致
|
||||||
this.entryOutDiscordant = ctcStationRunPlanLog.getEntryOutDiscordant(); // 出入口与基本径路不一致
|
this.entryOutDiscordant = ctcStationRunPlanLog.getEntryOutDiscordant(); // 出入口与基本径路不一致
|
||||||
this.passenger = ctcStationRunPlanLog.getPassenger(); // 客运车
|
this.passenger = ctcStationRunPlanLog.getPassenger(); // 客运车
|
||||||
@ -166,12 +167,12 @@ public class CtcStationRunPlanLogVO {
|
|||||||
this.departRunPlan = new RunPlanItem(ctcStationRunPlanLog.getDepartRunPlan());
|
this.departRunPlan = new RunPlanItem(ctcStationRunPlanLog.getDepartRunPlan());
|
||||||
}
|
}
|
||||||
// 列车运行计划作业
|
// 列车运行计划作业
|
||||||
this.runPlanTaskItemMap = Arrays.stream(CtcStationRunPlanLog.RunPlanTask.values())
|
this.runPlanTaskItemMap = Arrays.stream(CtcStationRunPlanLog.RunPlanTask.values()).filter(r -> !StringUtils.isEmpty(r.getOptionKey()))
|
||||||
.collect(Collectors.toMap(CtcStationRunPlanLog.RunPlanTask::getOptionKey, r -> EMPTY_STR));
|
.collect(Collectors.toMap(CtcStationRunPlanLog.RunPlanTask::getOptionKey, r -> CtcStationRunPlanLog.RunPlanTask.NO.name()));
|
||||||
ctcStationRunPlanLog.getRunPlanTaskItemMap().forEach((k, v) -> this.runPlanTaskItemMap.put(k, v.getType().getOptionName()));
|
ctcStationRunPlanLog.getRunPlanTaskItemMap().forEach((k, v) -> this.runPlanTaskItemMap.put(k, v.getType().name()));
|
||||||
List<String> planPropertiesList = new LinkedList<>();
|
List<String> planPropertiesList = new LinkedList<>();
|
||||||
this.electrical = ctcStationRunPlanLog.isElectrical(); // 电力
|
this.electrical = ctcStationRunPlanLog.isElectrical(); // 电力
|
||||||
if (this.electrical != null) {
|
if (this.electrical) {
|
||||||
planPropertiesList.add("电力;");
|
planPropertiesList.add("电力;");
|
||||||
}
|
}
|
||||||
this.planProperties = String.join("", planPropertiesList);
|
this.planProperties = String.join("", planPropertiesList);
|
||||||
@ -202,7 +203,7 @@ public class CtcStationRunPlanLogVO {
|
|||||||
this.runPlanTaskItemMap.forEach((k, v) -> {
|
this.runPlanTaskItemMap.forEach((k, v) -> {
|
||||||
// 新增的任务 : 删除的任务
|
// 新增的任务 : 删除的任务
|
||||||
CtcStationRunPlanLog.RunPlanTaskItem taskItem = runPlanLog.getRunPlanTaskItemMap().get(k);
|
CtcStationRunPlanLog.RunPlanTaskItem taskItem = runPlanLog.getRunPlanTaskItemMap().get(k);
|
||||||
String val = taskItem != null ? taskItem.getType().getOptionName() : EMPTY_STR;
|
String val = taskItem.getType().name();
|
||||||
if (!Objects.equals(val, v)) {
|
if (!Objects.equals(val, v)) {
|
||||||
modifyMap.put(k, val);
|
modifyMap.put(k, val);
|
||||||
this.runPlanTaskItemMap.put(k, val);
|
this.runPlanTaskItemMap.put(k, val);
|
||||||
@ -233,7 +234,7 @@ public class CtcStationRunPlanLogVO {
|
|||||||
// 运行股道与基本径路不一致
|
// 运行股道与基本径路不一致
|
||||||
if (!Objects.equals(this.trackDiscordant, runPlanLog.getTrackDiscordant())) {
|
if (!Objects.equals(this.trackDiscordant, runPlanLog.getTrackDiscordant())) {
|
||||||
this.trackDiscordant = runPlanLog.getTrackDiscordant();
|
this.trackDiscordant = runPlanLog.getTrackDiscordant();
|
||||||
changeCtcStationRunPlanLogVO.setTrackSectionCode(runPlanLog.getTrackSectionCode());
|
changeCtcStationRunPlanLogVO.setTrackDiscordant(runPlanLog.getTrackDiscordant());
|
||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
// 出入口与基本径路不一致
|
// 出入口与基本径路不一致
|
||||||
@ -243,9 +244,9 @@ public class CtcStationRunPlanLogVO {
|
|||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
// 超限等级
|
// 超限等级
|
||||||
if (!Objects.equals(this.transfinite, runPlanLog.getTransfinite().getVal())) {
|
if (!Objects.equals(this.transfinite, runPlanLog.getTransfinite())) {
|
||||||
this.transfinite = runPlanLog.getTransfinite().getVal();
|
this.transfinite = runPlanLog.getTransfinite();
|
||||||
changeCtcStationRunPlanLogVO.setTransfinite(runPlanLog.getTransfinite().getVal());
|
changeCtcStationRunPlanLogVO.setTransfinite(runPlanLog.getTransfinite());
|
||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
// 记事
|
// 记事
|
||||||
@ -409,9 +410,9 @@ public class CtcStationRunPlanLogVO {
|
|||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
// 超限
|
// 超限
|
||||||
if (runPlanItem.getTransfinite() != null && !Objects.equals(paramInfo.getTransfinite(), runPlanItem.getTransfinite().getVal())) {
|
if (runPlanItem.getTransfinite() != null && !Objects.equals(paramInfo.getTransfinite(), runPlanItem.getTransfinite())) {
|
||||||
paramInfo.setTransfinite(runPlanItem.getTransfinite().getVal());
|
paramInfo.setTransfinite(runPlanItem.getTransfinite());
|
||||||
changeRunItem.setTransfinite(runPlanItem.getTransfinite().getVal());
|
changeRunItem.setTransfinite(runPlanItem.getTransfinite());
|
||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
return change ? changeRunItem : null; // 没有变化返回null
|
return change ? changeRunItem : null; // 没有变化返回null
|
||||||
@ -483,7 +484,7 @@ public class CtcStationRunPlanLogVO {
|
|||||||
/**
|
/**
|
||||||
* 超限等级
|
* 超限等级
|
||||||
*/
|
*/
|
||||||
private String transfinite;
|
private CtcStationRunPlanLog.TransfiniteType transfinite;
|
||||||
|
|
||||||
public RunPlanItem() {
|
public RunPlanItem() {
|
||||||
}
|
}
|
||||||
@ -506,7 +507,7 @@ public class CtcStationRunPlanLogVO {
|
|||||||
this.adjacentMessageTime = runPlanItem.getAdjacentMessageTime();
|
this.adjacentMessageTime = runPlanItem.getAdjacentMessageTime();
|
||||||
this.finish = runPlanItem.isFinish();
|
this.finish = runPlanItem.isFinish();
|
||||||
this.electrical = runPlanItem.isElectrical();
|
this.electrical = runPlanItem.isElectrical();
|
||||||
this.transfinite = runPlanItem.getTransfinite().getVal();
|
this.transfinite = runPlanItem.getTransfinite();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -371,6 +371,15 @@ public class StationDirection extends MapNamedElement {
|
|||||||
return isChange;
|
return isChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置辅助状态
|
||||||
|
*/
|
||||||
|
public void resetAssistStatus() {
|
||||||
|
this.deliverAssistStatus = false;
|
||||||
|
this.receiveAssistStatus = false;
|
||||||
|
this.remain.set(0);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置默认属性
|
* 设置默认属性
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user