【上电逻辑修改、分路不良逻辑修改】
This commit is contained in:
parent
756d658b20
commit
f654df112d
@ -13,6 +13,8 @@ import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@OperateHandler
|
||||
@Slf4j
|
||||
public class SectionOperateHandler {
|
||||
@ -172,7 +174,7 @@ public class SectionOperateHandler {
|
||||
* @param types 分路不良类型列表
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.Section_Defective_Shunting)
|
||||
public void defectiveShunting(Simulation simulation, String sectionCode, String types) {
|
||||
atsSectionService.defectiveShunting(simulation, sectionCode, types);
|
||||
public void defectiveShunting(Simulation simulation, String sectionCode, List<Section.ShuntingType> shuntingTypeList) {
|
||||
atsSectionService.defectiveShunting(simulation, sectionCode, shuntingTypeList);
|
||||
}
|
||||
}
|
||||
|
@ -319,17 +319,6 @@ public class StationOperateHandler {
|
||||
atsStationService.specialStationControl(simulation, fromMember, stationCode, pressDown);
|
||||
}
|
||||
|
||||
/**
|
||||
* 车站设置分路不良(大铁)
|
||||
*
|
||||
* @param simulation 仿真实体
|
||||
* @param stationCode 车站编码
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.Station_Set_Defective_Shunting)
|
||||
public void setDefectiveShunting(Simulation simulation, String stationCode) {
|
||||
atsStationService.setDefectiveShunting(simulation, stationCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上电解锁(大铁)
|
||||
*
|
||||
@ -338,6 +327,7 @@ public class StationOperateHandler {
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.Station_Power_On_Unlock_Railroad)
|
||||
public void powerOnUnlockRailroad(Simulation simulation, String stationCode) {
|
||||
atsStationService.powerOnUnlockRailroad(simulation, stationCode);
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
ciApiService.powerOnUnlock(simulation, repository.getByCode(stationCode, Station.class));
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@ -101,15 +103,13 @@ public class AtsSectionService {
|
||||
* @param sectionCode 区段编码
|
||||
* @param types 分路不良类型列表
|
||||
*/
|
||||
public void defectiveShunting(Simulation simulation, String sectionCode, String types) {
|
||||
public void defectiveShunting(Simulation simulation, String sectionCode, List<Section.ShuntingType> shuntingTypeList) {
|
||||
if (StringUtils.isEmpty(sectionCode)) {
|
||||
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "区段不能为空");
|
||||
}
|
||||
Collections.sort(shuntingTypeList);
|
||||
// 设置区段的不良类型
|
||||
Section section = simulation.getRepository().getByCode(sectionCode, Section.class);
|
||||
section.setDefectiveShuntingTypes(types);
|
||||
// 弹起车站的分路不良按钮
|
||||
section.getStation().getDefectiveShuntingRemain().set(0);
|
||||
section.getStation().setDefectiveShunting(false);
|
||||
section.setShuntingTypeList(shuntingTypeList);
|
||||
}
|
||||
}
|
||||
|
@ -578,33 +578,4 @@ public class AtsStationService {
|
||||
new OperationMessage(fromMember.getId(), new HashSet<>(Collections.singleton(fromMember)),
|
||||
operationType, null, true, Arrays.asList(stationCode)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 按下分路不良(大铁)
|
||||
*
|
||||
* @param simulation 仿真实体
|
||||
* @param stationCode 车站编码
|
||||
*/
|
||||
public void setDefectiveShunting(Simulation simulation, String stationCode) {
|
||||
if (StringUtils.isEmpty(stationCode)) {
|
||||
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "车站不能为空");
|
||||
}
|
||||
Station station = getStation(simulation, stationCode);
|
||||
station.setDefectiveShunting(true);
|
||||
station.getDefectiveShuntingRemain().set(15);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上电解锁(大铁)
|
||||
*
|
||||
* @param simulation 仿真实体
|
||||
* @param stationCode 车站编码
|
||||
*/
|
||||
public void powerOnUnlockRailroad(Simulation simulation, String stationCode) {
|
||||
if (StringUtils.isEmpty(stationCode)) {
|
||||
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "车站不能为空");
|
||||
}
|
||||
List<Section> sectionList = simulation.getRepository().getSectionList();
|
||||
sectionList.stream().filter(section -> stationCode.equals(section.getStation().getCode())).forEach(Section::faultUnlock);
|
||||
}
|
||||
}
|
||||
|
@ -518,16 +518,24 @@ public class CiApiServiceImpl2 implements CiApiService {
|
||||
station = station.getDeviceStation();
|
||||
}
|
||||
Station deviceStation = station;
|
||||
if (Objects.nonNull(deviceStation.getRestartTime())
|
||||
&& deviceStation.getRestartTime().isBefore(LocalTime.now())
|
||||
&& ((Simulation.FunctionalType.LESSON.equals(simulation.getBuildParams().getFunctionalType())
|
||||
|| Simulation.FunctionalType.EXAM.equals(simulation.getBuildParams().getFunctionalType()))
|
||||
? true : deviceStation.getRestartTime().plusMinutes(8).isAfter(LocalTime.now()))) {
|
||||
List<Section> sections = simulation.getRepository().getSectionList();
|
||||
sections.stream().filter(section -> Objects.equals(section.getDeviceStation(), deviceStation)).forEach(Section::faultUnlock);
|
||||
return;
|
||||
boolean restartFlag = Objects.nonNull(deviceStation.getRestartTime()) && deviceStation.getRestartTime().isBefore(LocalTime.now());
|
||||
// 是否大铁设备
|
||||
boolean hasCTCFlag = simulation.getRepository().getConfig().isHasCTC();
|
||||
// 大铁异常提示语
|
||||
String exceptionMsg = hasCTCFlag ? "无效操作:车站未下电" : "无效操作或连锁机重启过8分钟需手动解锁";
|
||||
// 是否需要重启
|
||||
if (restartFlag) {
|
||||
// 考试、课程上电标识
|
||||
boolean powerOnFlag = ((Simulation.FunctionalType.LESSON.equals(simulation.getBuildParams().getFunctionalType())
|
||||
|| Simulation.FunctionalType.EXAM.equals(simulation.getBuildParams().getFunctionalType()))
|
||||
? true : deviceStation.getRestartTime().plusMinutes(8).isAfter(LocalTime.now()));
|
||||
if (hasCTCFlag || powerOnFlag) {
|
||||
List<Section> sections = simulation.getRepository().getSectionList();
|
||||
sections.stream().filter(section -> Objects.equals(section.getDeviceStation(), deviceStation)).forEach(Section::faultUnlock);
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.exception("无效操作或连锁机重启过8分钟需手动解锁");
|
||||
throw BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.exception(exceptionMsg);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -55,11 +55,6 @@ public class CiLogic {
|
||||
simulation.getRepository().getStationList().stream().forEach(station -> {
|
||||
// 允许自律状态刷新
|
||||
station.refreshAllowAutonomyStatus();
|
||||
// 分路不良倒计时
|
||||
if (station.getDefectiveShuntingRemain().decrementAndGet() <= 0) {
|
||||
station.setDefectiveShunting(false);
|
||||
station.getDefectiveShuntingRemain().set(0);
|
||||
}
|
||||
// 接、发辅助按钮倒计时刷新
|
||||
station.getStationDirectionMap().values().stream()
|
||||
.filter(stationDirection -> stationDirection.getRemain().intValue() != 0)
|
||||
|
@ -166,7 +166,7 @@ public class Section extends DelayUnlockDevice {
|
||||
/**
|
||||
* 分路不良类型
|
||||
*/
|
||||
private String defectiveShuntingTypes;
|
||||
private List<ShuntingType> shuntingTypeList;
|
||||
|
||||
// ------------------状态属性---------------------
|
||||
|
||||
@ -948,6 +948,7 @@ public class Section extends DelayUnlockDevice {
|
||||
this.route = null;
|
||||
this.overlapLock = false;
|
||||
this.delayUnlock = false;
|
||||
this.shuntingTypeList = null;
|
||||
}
|
||||
|
||||
public boolean isLockedOn(boolean right) {
|
||||
@ -1407,4 +1408,17 @@ public class Section extends DelayUnlockDevice {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分路不良枚举类型
|
||||
*/
|
||||
public enum ShuntingType {
|
||||
SECTION_SHUNTING, // 区段分路不良
|
||||
|
||||
SWITCH_FRONT_SHUNTING, // 岔前分路不良
|
||||
|
||||
FIXED_POSITION_SHUNTING,// 定位分路不良
|
||||
|
||||
REVERSE_POSITION_SHUNTING,// 反位分路不良
|
||||
}
|
||||
}
|
||||
|
@ -196,16 +196,6 @@ public class Station extends MayOutOfOrderDevice {
|
||||
*/
|
||||
private boolean allowAutonomy;
|
||||
|
||||
/**
|
||||
* 分路不良
|
||||
*/
|
||||
private boolean defectiveShunting;
|
||||
|
||||
/**
|
||||
* 分路不良倒计时
|
||||
*/
|
||||
private AtomicInteger defectiveShuntingRemain = new AtomicInteger(0);
|
||||
|
||||
@Override
|
||||
|
||||
public void reset() {
|
||||
|
@ -8,6 +8,7 @@ import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@ -103,7 +104,7 @@ public class SectionStatus extends DeviceStatus {
|
||||
|
||||
private String fault;
|
||||
|
||||
private String defectiveShuntingTypes;
|
||||
private List<Section.ShuntingType> shuntingTypeList;
|
||||
|
||||
public SectionStatus(Section section) {
|
||||
super(section.getCode(), section.getDeviceType());
|
||||
@ -124,7 +125,7 @@ public class SectionStatus extends DeviceStatus {
|
||||
this.closed = section.isClosed();
|
||||
this.remain = section.getRemain();
|
||||
this.fault = section.getFault() == null ? null : section.getFault().toString();
|
||||
this.defectiveShuntingTypes = section.getDefectiveShuntingTypes();
|
||||
this.shuntingTypeList = section.getShuntingTypeList();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -218,10 +219,10 @@ public class SectionStatus extends DeviceStatus {
|
||||
status.setFault(fault);
|
||||
change = true;
|
||||
}
|
||||
if (!Objects.equals(this.defectiveShuntingTypes, section.getDefectiveShuntingTypes())) {
|
||||
if (!Objects.equals(this.shuntingTypeList, section.getShuntingTypeList())) {
|
||||
change = true;
|
||||
this.defectiveShuntingTypes = section.getDefectiveShuntingTypes();
|
||||
status.setDefectiveShuntingTypes(this.defectiveShuntingTypes);
|
||||
this.shuntingTypeList = section.getShuntingTypeList();
|
||||
status.setShuntingTypeList(this.shuntingTypeList);
|
||||
}
|
||||
return change;
|
||||
}
|
||||
@ -245,7 +246,7 @@ public class SectionStatus extends DeviceStatus {
|
||||
statusVO.setDelayUnlock(delayUnlock);
|
||||
statusVO.setClosed(closed);
|
||||
statusVO.setFault(fault);
|
||||
statusVO.setDefectiveShuntingTypes(this.defectiveShuntingTypes);
|
||||
statusVO.setShuntingTypeList(this.shuntingTypeList);
|
||||
return statusVO;
|
||||
}
|
||||
|
||||
|
@ -87,16 +87,6 @@ public class StationStatus extends DeviceStatus {
|
||||
*/
|
||||
private boolean allowAutonomy;
|
||||
|
||||
/**
|
||||
* 分路不良
|
||||
*/
|
||||
private boolean defectiveBranch;
|
||||
|
||||
/**
|
||||
* 分路不良倒计时
|
||||
*/
|
||||
private int defectiveBranchRemain;
|
||||
|
||||
public StationStatus(Station station) {
|
||||
super(station.getCode(), station.getDeviceType());
|
||||
controlMode = station.getControlMode();
|
||||
@ -114,8 +104,6 @@ public class StationStatus extends DeviceStatus {
|
||||
sGuideMasterLock = station.isSGuideMasterLock();
|
||||
xGuideMasterLock = station.isXGuideMasterLock();
|
||||
allowAutonomy = station.isAllowAutonomy();
|
||||
defectiveBranch = station.isDefectiveShunting();
|
||||
defectiveBranchRemain = station.getDefectiveShuntingRemain().get();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -199,16 +187,6 @@ public class StationStatus extends DeviceStatus {
|
||||
allowAutonomy = station.isAllowAutonomy();
|
||||
status.setAllowAutonomy(allowAutonomy);
|
||||
}
|
||||
if (!Objects.equals(defectiveBranch, station.isDefectiveShunting())) {
|
||||
change = true;
|
||||
defectiveBranch = station.isDefectiveShunting();
|
||||
status.setDefectiveShunting(defectiveBranch);
|
||||
}
|
||||
if (defectiveBranchRemain != station.getDefectiveShuntingRemain().get()) {
|
||||
change = true;
|
||||
defectiveBranchRemain = station.getDefectiveShuntingRemain().get();
|
||||
status.setDefectiveShuntingRemain(defectiveBranchRemain);
|
||||
}
|
||||
return change;
|
||||
}
|
||||
|
||||
@ -230,8 +208,6 @@ public class StationStatus extends DeviceStatus {
|
||||
statusVO.setSGuideMasterLock(sGuideMasterLock);
|
||||
statusVO.setXGuideMasterLock(xGuideMasterLock);
|
||||
statusVO.setAllowAutonomy(allowAutonomy);
|
||||
statusVO.setDefectiveShunting(defectiveBranch);
|
||||
statusVO.setDefectiveShuntingRemain(defectiveBranchRemain);
|
||||
return statusVO;
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 区段状态
|
||||
*/
|
||||
@ -93,7 +95,7 @@ public class SectionStatusVO extends DeviceStatusVO {
|
||||
|
||||
private Integer remain;
|
||||
|
||||
private String defectiveShuntingTypes;
|
||||
private List<Section.ShuntingType> shuntingTypeList;
|
||||
|
||||
public SectionStatusVO(Section section) {
|
||||
super(section.getCode(), section.getDeviceType());
|
||||
|
@ -87,16 +87,6 @@ public class StationStatusVO extends DeviceStatusVO {
|
||||
|
||||
private Boolean allowAutonomy;
|
||||
|
||||
/**
|
||||
* 分路不良
|
||||
*/
|
||||
private Boolean defectiveShunting;
|
||||
|
||||
/**
|
||||
* 分路不良倒计时
|
||||
*/
|
||||
private Integer defectiveShuntingRemain;
|
||||
|
||||
public StationStatusVO(Station station) {
|
||||
super(station.getCode(), station.getDeviceType());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user