Merge remote-tracking branch 'origin/test'
This commit is contained in:
commit
35b9f0cca2
|
@ -109,4 +109,14 @@ public class SimulationTrainingV2Controller {
|
|||
public void jumpToStep(@PathVariable String group, @PathVariable Long stepId){
|
||||
training2Service.jumpToStep(group, stepId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 实训开始准备,给实训参与人员发送准备开始执行
|
||||
* @param group 仿真ID
|
||||
* @param user 操作人
|
||||
*/
|
||||
@PostMapping("/{group}/prepare/start")
|
||||
public void prepareStart(@PathVariable String group, @RequestAttribute AccountVO user, ScriptBO.Mode mode) {
|
||||
training2Service.prepareStart(group, user, mode);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
|
|||
VirtualRealityIbp.SquareButton button = (VirtualRealityIbp.SquareButton) element;
|
||||
if (!button.isEffective()) {
|
||||
button.setEffective(true);
|
||||
button.setPressTime(LocalDateTime.now());
|
||||
button.setPressTime(simulation.getCorrectSystemTime());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -263,13 +263,16 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
|
|||
if (ibp == null)
|
||||
continue;
|
||||
List<VirtualRealityIbp.IbpElement> buttons = ibp.queryByMean(VirtualRealityIbp.Mean.PRERESET_Z);
|
||||
if (CollectionUtils.isEmpty(buttons))
|
||||
continue;
|
||||
VirtualRealityIbp.SquareButton preResetButton =
|
||||
(VirtualRealityIbp.SquareButton) buttons.get(0);
|
||||
if (!preResetButton.isPressed())
|
||||
continue;
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
if (CollectionUtils.isEmpty(buttons)) { // 如果没有按钮,判断车站是否有预处理倒计时时间 20230530 wei
|
||||
if (station.getPreResetValidDuration().get() <= 0) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
VirtualRealityIbp.SquareButton preResetButton = (VirtualRealityIbp.SquareButton) buttons.get(0);
|
||||
if (!preResetButton.isPressed())
|
||||
continue;
|
||||
}
|
||||
LocalDateTime now = simulation.getCorrectSystemTime();
|
||||
for (VirtualRealityIbp.IbpElement ibpElement : ibp.queryByMean(VirtualRealityIbp.Mean.AXLE_PRE_RESET)) {
|
||||
VirtualRealityIbp.SquareButton button = (VirtualRealityIbp.SquareButton) ibpElement;
|
||||
if (!button.isPressed() || !button.isEffective())
|
||||
|
|
|
@ -214,12 +214,16 @@ public class PaperUserService {
|
|||
rsp.setCommonScore(scoreCommon);
|
||||
rsp.setTrainingScore(scoreTraining);
|
||||
rsp.setPassScore(composition.getPassScore());
|
||||
this.publishUserExam();
|
||||
return rsp;
|
||||
}
|
||||
|
||||
private void publishUserExam() {
|
||||
// UserExam ue = new UserExam();
|
||||
// ue.setExamId();
|
||||
// ue.setUserId(user.getAccount());
|
||||
//TODO 需要将 UserExam 发送 {@link UserExamService.submit 方法}
|
||||
// this.applicationContext.publishEvent(new UserExamRecordEvent(userExam));
|
||||
return rsp;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -472,6 +472,7 @@ public class Training2PublishService {
|
|||
List<PublishedTraining2WithBLOBs> training2WithBLOBsList = publishedDao.selectByExampleWithBLOBs(example);
|
||||
Map<Long, List<PublishedTraining2WithBLOBs>> mapTrainingMap = training2WithBLOBsList.stream().peek(t -> {
|
||||
t.setId(null);
|
||||
t.setMapId(null);
|
||||
t.setUpdateTime(null);
|
||||
t.setCreateTime(null);
|
||||
}).collect(Collectors.groupingBy(PublishedTraining2WithBLOBs::getMapId));
|
||||
|
|
|
@ -4,6 +4,7 @@ import club.joylink.rtss.dao.DraftTraining2DAO;
|
|||
import club.joylink.rtss.dao.PublishedTraining2DAO;
|
||||
import club.joylink.rtss.entity.training2.DraftTraining2WithBLOBs;
|
||||
import club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.services.training2.index.IndexAlgorithmService;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.ATSMessageCollectAndDispatcher;
|
||||
import club.joylink.rtss.simulation.cbtc.ATS.operation.AtsOperationDispatcher;
|
||||
|
@ -274,7 +275,7 @@ public class Training2Service {
|
|||
// 创建者退出,则清理实训
|
||||
if (simulation.getCreator().getId().equals(user.getId())) {
|
||||
training2.finish();
|
||||
removeTrainingJob(simulation);
|
||||
trainingStatusMessage(simulation, 0);
|
||||
}
|
||||
} else {
|
||||
return List.of();
|
||||
|
@ -522,6 +523,7 @@ public class Training2Service {
|
|||
throw new SimulationException(SimulationExceptionType.Data_Not_Exist, "实训不存在");
|
||||
}
|
||||
Simulation simulation = groupSimulationCache.getSimulationByGroup(group);
|
||||
loadTrainingPre(simulation);
|
||||
// 重置仿真状态
|
||||
// groupSimulationService.planOver(group);
|
||||
simulationService.reset(group);
|
||||
|
@ -553,10 +555,27 @@ public class Training2Service {
|
|||
} catch (Exception e) {
|
||||
log.error("loadTrainingToStep is error", e);
|
||||
training2.finish();
|
||||
removeTrainingJob(simulation);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 实训准备开始
|
||||
* @param group 仿真号
|
||||
* @param user 操作人
|
||||
*/
|
||||
public void prepareStart(String group, AccountVO user, ScriptBO.Mode mode) {
|
||||
Simulation simulation = groupSimulationCache.getSimulationByGroup(group);
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(simulation.getTraining2() != null, "未加载实训");
|
||||
Map<String, Object> messageMap = new HashMap<>();
|
||||
messageMap.put("id", simulation.getTraining2().getId());
|
||||
messageMap.put("mode", mode);
|
||||
SocketMessageVO<Map<String, Object>> message = SocketMessageFactory.build(
|
||||
WebSocketMessageType.Simulation_Training_Prepare_Start, simulation.getId(), messageMap);
|
||||
Set<String> userIdSet = simulation.getSimulationUserIds().stream()
|
||||
.filter(id -> !Objects.equals(id, user.getId().toString())).collect(Collectors.toSet());
|
||||
stompMessageService.sendToUser(userIdSet, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 实训时创建仿真对象
|
||||
*/
|
||||
|
@ -585,6 +604,7 @@ public class Training2Service {
|
|||
* 加载实训数据
|
||||
*/
|
||||
private void loadTraining(Simulation simulation, DraftTraining2WithBLOBs draftTraining2, LoginUserInfoVO loginUserInfoVO) {
|
||||
loadTrainingPre(simulation);
|
||||
// 没有背景不做加载,加载的时候不做背景加载,开始的时候重新加载背景即可
|
||||
if (!StringUtils.isEmpty(draftTraining2.getBgSceneJson())) {
|
||||
groupSimulationService.loadScenes(simulation.getId(), draftTraining2.getBgSceneJson());
|
||||
|
@ -605,6 +625,17 @@ public class Training2Service {
|
|||
simulationLifeCycleService.pause(simulation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 仿真加载实训时前置清空方法
|
||||
* @param simulation 仿真
|
||||
*/
|
||||
private void loadTrainingPre(Simulation simulation) {
|
||||
if (simulation.getTraining2() != null) { // 如果仿真存在旧的实训
|
||||
removeTrainingJob(simulation);
|
||||
clearJumpStep(simulation);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断实训步骤是否完成
|
||||
*/
|
||||
|
@ -656,7 +687,7 @@ public class Training2Service {
|
|||
}
|
||||
}
|
||||
// 发送步骤提示信息,需要跳过步骤不发消息
|
||||
if (!step.isPrompt() && !simulation.getTraining2().isJumpStep(step)) {
|
||||
if (!step.isPrompt() && !simulation.getTraining2().haveJumpStep()) {
|
||||
step.setPrompt(true); // 标识已发送过消息
|
||||
applicationContext.publishEvent(new SimulationStepTipEvent(this, simulation, step));
|
||||
}
|
||||
|
@ -911,6 +942,10 @@ public class Training2Service {
|
|||
addTrainingJob(simulation, training2);
|
||||
// 启动仿真
|
||||
simulationLifeCycleService.resume(simulation);
|
||||
// 发送开始消息,跳转不发送消息
|
||||
if (!training2.haveJumpStep()) {
|
||||
trainingStatusMessage(simulation, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -918,7 +953,19 @@ public class Training2Service {
|
|||
*/
|
||||
private void clearJumpStep(Simulation simulation) {
|
||||
simulation.updateSpeed(Simulation.MIN_SPEED);
|
||||
simulation.getTraining2().setJumpToStep(null);
|
||||
simulation.getTraining2().finish();
|
||||
if (simulation.getTraining2() != null) {
|
||||
simulation.getTraining2().setJumpToStep(null);
|
||||
simulation.getTraining2().finish();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 实训状态消息
|
||||
* @param simulation 仿真
|
||||
* @param status 状态
|
||||
*/
|
||||
private void trainingStatusMessage(Simulation simulation, int status) {
|
||||
SocketMessageVO<Integer> message = SocketMessageFactory.build(WebSocketMessageType.Simulation_Training_Status, simulation.getId(), status);
|
||||
stompMessageService.sendToUser(simulation.getSimulationUserIds(), message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -185,8 +185,11 @@ public class SimulationManager {
|
|||
String oldMemberId = simulationUser.getMemberId();
|
||||
if (oldMemberId != null) {
|
||||
SimulationMember old = simulation.getSimulationMemberById(oldMemberId);
|
||||
this.memberPlayChange(simulation, old, null);
|
||||
if (Objects.equals(old.getUserId(), userId)) { // 这里做同用户对比,防止角色替换时,置NULL问题
|
||||
this.memberPlayChange(simulation, old, null);
|
||||
}
|
||||
}
|
||||
log.info("memberId:" + memberId + ";userId:" + userId);
|
||||
this.memberPlayChange(simulation, simulationMember, simulationUser);
|
||||
} else {
|
||||
this.memberPlayChange(simulation, simulationMember, null);
|
||||
|
|
|
@ -507,6 +507,7 @@ public class AtsStationService {
|
|||
}
|
||||
station.setInterlockMachineStarting(true);
|
||||
station.setRestartTime(LocalTime.now());
|
||||
station.setPowerUnlockButtonShow(true);
|
||||
Station.Fault.INTERLOCK_FAULT.fix(station); //恢复联锁机故障
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
//该站范围内区段故障锁闭
|
||||
|
|
|
@ -17,24 +17,25 @@ import javax.annotation.Resource;
|
|||
public class TrainPositionService {
|
||||
|
||||
|
||||
@Resource
|
||||
TrainPositionTimeOverService timeOverService;
|
||||
@Resource
|
||||
TrainPositionTimeOverService timeOverService;
|
||||
|
||||
|
||||
/**
|
||||
* 初始化或更新列车的位置
|
||||
* @param mapName
|
||||
* @param json
|
||||
*/
|
||||
/**
|
||||
* 初始化或更新列车的位置
|
||||
*
|
||||
* @param mapName
|
||||
* @param json
|
||||
*/
|
||||
|
||||
public void initTrainOrUpdate(String mapName,String json){
|
||||
TrainPosition tp = JsonUtils.read(json, TrainPosition.class);
|
||||
tp.setReceiveTime(System.currentTimeMillis());
|
||||
log.debug(json);
|
||||
public void initTrainOrUpdate(String mapName, String json) {
|
||||
TrainPosition tp = JsonUtils.read(json, TrainPosition.class);
|
||||
tp.setReceiveTime(System.currentTimeMillis());
|
||||
log.debug(json);
|
||||
// SocketMessageVO<TrainPosition> vo = SocketMessageFactory.buildBasic(WebSocketMessageType.YJDDZH_TRAIN_POSITION,tp);
|
||||
// this.messageService.send(vo);
|
||||
this.timeOverService.addTrainAccept(mapName,tp);
|
||||
this.timeOverService.addTrainAccept(mapName, tp);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -555,6 +555,7 @@ public class CiApiServiceImpl2 implements CiApiService {
|
|||
|| Simulation.FunctionalType.EXAM.equals(simulation.getBuildParams().getFunctionalType()))
|
||||
? true : deviceStation.getRestartTime().plusMinutes(8).isAfter(LocalTime.now()));
|
||||
if (hasCTCFlag || powerOnFlag) {
|
||||
deviceStation.setPowerUnlockButtonShow(false);
|
||||
List<Section> sections = simulation.getRepository().getSectionList();
|
||||
sections.stream().filter(section -> Objects.equals(section.getDeviceStation(), deviceStation)).forEach(Section::faultUnlock);
|
||||
return;
|
||||
|
|
|
@ -303,12 +303,17 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation<Simulati
|
|||
SimulationBuildParams buildParams = this.getBuildParams();
|
||||
List<ConversationGroupVO> conversationGroupVOList = buildParams.getMap().getGraphDataNew()
|
||||
.getConversationGroupMap().get(buildParams.getWorkParamVO().getType());
|
||||
Map<Long, ConversationGroup> groupMap = conversationGroupVOList.stream().filter(ConversationGroupVO::isValid)
|
||||
.map(g ->{
|
||||
ConversationGroup group = new ConversationGroup(this, g);
|
||||
group.initGroupType();
|
||||
return group;
|
||||
}).collect(Collectors.toMap(ConversationGroup::getId, group -> group));
|
||||
Map<Long, ConversationGroup> groupMap = null;
|
||||
if (CollectionUtils.isEmpty(conversationGroupVOList)) {
|
||||
groupMap = new HashMap<>();
|
||||
} else {
|
||||
groupMap = conversationGroupVOList.stream().filter(ConversationGroupVO::isValid)
|
||||
.map(g ->{
|
||||
ConversationGroup group = new ConversationGroup(this, g);
|
||||
group.initGroupType();
|
||||
return group;
|
||||
}).collect(Collectors.toMap(ConversationGroup::getId, group -> group));
|
||||
}
|
||||
overCoverConversationGroupMap(groupMap);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import club.joylink.rtss.simulation.cbtc.data.map.*;
|
|||
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.StationTurnBackStrategyOption;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.*;
|
||||
import club.joylink.rtss.vo.map.MapCISwitchVO;
|
||||
import club.joylink.rtss.vo.map.MapGraphDataNewVO;
|
||||
import club.joylink.rtss.vo.map.MapVO;
|
||||
import club.joylink.rtss.vo.map.RealLineConfigVO;
|
||||
|
@ -114,6 +115,8 @@ public class MapDeviceBuilder {
|
|||
MapDeviceBuilder.buildCatenary(graphData, elementMap, errMsgList, mapDataBuildResult.getCatenaryMap());
|
||||
//应答器
|
||||
MapDeviceBuilder.buildResponderDataRef(graphData, elementMap, errMsgList, mapDataBuildResult.getSectionRespondersMap());
|
||||
// 设置信号机引导关键道岔信息
|
||||
initSignalGuideKeySwitch(graphData, elementMap, errMsgList);
|
||||
if (mapDataBuildResult.getErrMsgList().isEmpty()) {
|
||||
Map<String, Set<Section>> sectionArriveMap = MapDeviceBuilder.buildNormalStandTrackAdjoinSections(mapDataBuildResult.getDeviceMap());
|
||||
mapDataBuildResult.setSectionArriveNearMap(sectionArriveMap);
|
||||
|
@ -1568,4 +1571,26 @@ public class MapDeviceBuilder {
|
|||
private static boolean isCross(String type) {
|
||||
return Objects.equals(type, BusinessConsts.Section.SectionType.Type05);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化信号机的引导关键道岔设置(作用于引导信号的开放)
|
||||
* @param graphData 地图信息
|
||||
* @param elementMap 设备信息
|
||||
* @param errMsgList 错误提示信息
|
||||
*/
|
||||
private static void initSignalGuideKeySwitch(MapGraphDataNewVO graphData, Map<String, MapElement> elementMap, List<String> errMsgList) {
|
||||
graphData.getSignalList().stream().filter(s -> !CollectionUtils.isEmpty(s.getGuideKeySwitchList())).forEach(s -> {
|
||||
List<SwitchElement> switchElementList = new ArrayList<>(s.getGuideKeySwitchList().size());
|
||||
for (MapCISwitchVO ciSwitchVO : s.getGuideKeySwitchList()) {
|
||||
Switch aSwitch = (Switch) elementMap.get(ciSwitchVO.getSwitchCode());
|
||||
if (Objects.isNull(aSwitch)) {
|
||||
errMsgList.add(String.format("编码为[%s]的道岔不存在", ciSwitchVO.getSwitchCode()));
|
||||
} else {
|
||||
switchElementList.add(new SwitchElement(aSwitch, ciSwitchVO.isNormal()));
|
||||
}
|
||||
}
|
||||
Signal signal = (Signal) elementMap.get(s.getCode());
|
||||
signal.setGuideKeySwitchList(switchElementList);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,6 +159,11 @@ public class Signal extends DelayUnlockDevice {
|
|||
*/
|
||||
private List<Signal> replaceSignals;
|
||||
|
||||
/**
|
||||
* 信号机引导关键道岔列表
|
||||
*/
|
||||
private List<SwitchElement> guideKeySwitchList;
|
||||
|
||||
// ------------------状态属性---------------------
|
||||
|
||||
private int mode;
|
||||
|
|
|
@ -241,6 +241,11 @@ public class Station extends MayOutOfOrderDevice {
|
|||
*/
|
||||
private OperationModeApplication operationModeApplication;
|
||||
|
||||
/**
|
||||
* 上电解锁按钮显示状态
|
||||
*/
|
||||
private boolean powerUnlockButtonShow;
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
|
@ -270,6 +275,7 @@ public class Station extends MayOutOfOrderDevice {
|
|||
planControl = true;
|
||||
routeSetMode = RouteSetMode.Plan_Set_Route;
|
||||
operationMode = OperationMode.Center;
|
||||
powerUnlockButtonShow = false;
|
||||
}
|
||||
|
||||
public List<Stand> getStandOf(boolean right) {
|
||||
|
|
|
@ -112,6 +112,16 @@ public class StationStatus extends DeviceStatus {
|
|||
*/
|
||||
private Station.OperationMode operationMode;
|
||||
|
||||
/**
|
||||
* 车站故障状态
|
||||
*/
|
||||
private String fault;
|
||||
|
||||
/**
|
||||
* 上电解锁按钮状态
|
||||
*/
|
||||
private Boolean powerUnlockButtonShow;
|
||||
|
||||
public StationStatus(Station station) {
|
||||
super(station.getCode(), station.getDeviceType());
|
||||
controlMode = station.getControlMode();
|
||||
|
@ -135,6 +145,7 @@ public class StationStatus extends DeviceStatus {
|
|||
planControl = station.isPlanControl();
|
||||
routeSetMode = station.getRouteSetMode();
|
||||
operationMode = station.getOperationMode();
|
||||
powerUnlockButtonShow = station.isPowerUnlockButtonShow();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -242,6 +253,17 @@ public class StationStatus extends DeviceStatus {
|
|||
this.operationMode = station.getOperationMode();
|
||||
status.setOperationMode(station.getOperationMode());
|
||||
}
|
||||
String fault = station.getFault() == null ? null : station.getFault().toString();
|
||||
if (!Objects.equals(this.fault, fault)) {
|
||||
this.fault = fault;
|
||||
status.setFault(fault);
|
||||
change = true;
|
||||
}
|
||||
if (!Objects.equals(powerUnlockButtonShow, station.isPowerUnlockButtonShow())) {
|
||||
this.powerUnlockButtonShow = station.isPowerUnlockButtonShow();
|
||||
status.setPowerUnlockButtonShow(station.isPowerUnlockButtonShow());
|
||||
change = true;
|
||||
}
|
||||
return change;
|
||||
}
|
||||
|
||||
|
@ -266,6 +288,8 @@ public class StationStatus extends DeviceStatus {
|
|||
statusVO.setPlanControl(planControl);
|
||||
statusVO.setRouteSetMode(routeSetMode);
|
||||
statusVO.setOperationMode(operationMode);
|
||||
statusVO.setFault(fault);
|
||||
statusVO.setPowerUnlockButtonShow(powerUnlockButtonShow);
|
||||
return statusVO;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,6 +96,17 @@ public class StationStatusVO extends DeviceStatusVO {
|
|||
|
||||
private Station.OperationMode operationMode;
|
||||
|
||||
/**
|
||||
* 车站故障状态
|
||||
*/
|
||||
private String fault;
|
||||
|
||||
/**
|
||||
* 上电解锁按钮显示状态
|
||||
*/
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private Boolean powerUnlockButtonShow;
|
||||
|
||||
public StationStatusVO(Station station) {
|
||||
super(station.getCode(), station.getDeviceType());
|
||||
}
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package club.joylink.rtss.simulation.cbtc.device.real.modbustcp.gxsd;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.PlcGatewayService;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.RealDeviceService;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.PlcGateway;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.gzb.GzbSignalConfig;
|
||||
import club.joylink.rtss.vo.client.project.gzb.GzbSignalConfigVO;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.Channel;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@Slf4j
|
||||
public abstract class GxsdService implements RealDeviceService {
|
||||
|
||||
@Autowired
|
||||
@Getter
|
||||
protected PlcGatewayService plcGatewayService;
|
||||
|
||||
@Override
|
||||
public void init(Simulation simulation, RealDeviceConfig deviceConfig) {
|
||||
//设置plc 继电器的工作模式,此配置不在configVo中体现
|
||||
PlcGateway plcGateway = simulation.getPlcGateway();
|
||||
Channel channel = plcGateway.getChannel();
|
||||
log.info("设置plc继电器...");
|
||||
this.plcGatewayService.writeSingleCoil(0, 14, true, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测继电器
|
||||
*/
|
||||
public boolean checkElectricRelay(ByteBuf signalStatus) {
|
||||
boolean rReplay = RealDeviceConfig.getBitOf(signalStatus, 6);
|
||||
// boolean outReplay = RealDeviceConfig.getBitOf(signalStatus, 14);
|
||||
log.info("读取继电器... val:" + rReplay);
|
||||
return rReplay;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package club.joylink.rtss.simulation.cbtc.device.real.modbustcp.gxsd;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig;
|
||||
import club.joylink.rtss.util.JsonUtils;
|
||||
import club.joylink.rtss.vo.client.project.ProjectDeviceVO;
|
||||
import club.joylink.rtss.vo.client.project.gxsd.GxsdSignalConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.gzb.GzbSignalConfigVO;
|
||||
import java.util.Objects;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class GxsdSignalConfig extends RealDeviceConfig {
|
||||
|
||||
private GxsdSignalConfigVO config;
|
||||
|
||||
public GxsdSignalConfig(ProjectDeviceVO deviceVO) {
|
||||
super(deviceVO);
|
||||
if (Objects.nonNull(deviceVO.getConfig())) {
|
||||
this.config = JsonUtils.read(deviceVO.getConfig(), GxsdSignalConfigVO.class);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String findDeviceCode() {
|
||||
return config.findDeviceCode();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
GxsdSignalConfigVO vo = new GxsdSignalConfigVO();
|
||||
System.out.println(JsonUtils.writeValueAsString(vo));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,126 @@
|
|||
package club.joylink.rtss.simulation.cbtc.device.real.modbustcp.gxsd;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.constant.SignalAspect;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySignal;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySignal.Fault;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.PlcGatewayService;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.RealDeviceService;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.PlcGateway;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.gzb.GzbSignalConfig;
|
||||
import club.joylink.rtss.vo.client.project.gxsd.GxsdSignalConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.gzb.GzbSignalConfigVO;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.Channel;
|
||||
import java.util.Objects;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class GxsdSignalServiceImpl extends GxsdService {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canHandle(RealDeviceConfig deviceConfig) {
|
||||
return deviceConfig instanceof GxsdSignalConfig;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void init(Simulation simulation, RealDeviceConfig deviceConfig) {
|
||||
super.init(simulation, deviceConfig);
|
||||
GxsdSignalConfig switchConfig = (GxsdSignalConfig) deviceConfig;
|
||||
GxsdSignalConfigVO config = switchConfig.getConfig();
|
||||
PlcGateway plcGateway = simulation.getPlcGateway();
|
||||
Channel channel = plcGateway.getChannel();
|
||||
int baseAddr = plcGateway.getConfig().getAddr() + config.getAddr();
|
||||
this.plcGatewayService.writeSingleCoil(baseAddr, config.getW5(), true, channel);
|
||||
this.plcGatewayService.writeSingleCoil(baseAddr, config.getW3(), false, channel);
|
||||
this.plcGatewayService.writeSingleCoil(baseAddr, config.getW4(), false, channel);
|
||||
this.plcGatewayService.writeSingleCoil(baseAddr, config.getW7(), false, channel);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void handle(Simulation simulation, RealDeviceConfig deviceConfig, ByteBuf byteBuf) {
|
||||
PlcGateway plcGateway = simulation.queryPlcGatewayDevice();
|
||||
GxsdSignalConfig switchConfig = (GxsdSignalConfig) deviceConfig;
|
||||
VirtualRealitySignal vrSignal = ((VirtualRealitySignal) switchConfig.getMapElement());
|
||||
|
||||
if (Objects.isNull(vrSignal)) {
|
||||
return;
|
||||
}
|
||||
|
||||
GxsdSignalConfigVO config = switchConfig.getConfig();
|
||||
Channel channel = plcGateway.getChannel();
|
||||
int baseAddr = plcGateway.getConfig().getAddr() + config.getAddr();
|
||||
ByteBuf signalStatus = RealDeviceConfig.getDeviceCoilStatus(byteBuf, config.getAddr(), config.getQuantity());
|
||||
|
||||
boolean br0 = RealDeviceConfig.getBitOf(signalStatus, config.getR1());//红灯
|
||||
boolean br3 = RealDeviceConfig.getBitOf(signalStatus, config.getR3());//绿灯或黄灯
|
||||
boolean w3 = RealDeviceConfig.getBitOf(signalStatus, config.getW3()); //输出 绿灯
|
||||
boolean w4 = RealDeviceConfig.getBitOf(signalStatus, config.getW4()); //输出 黄灯
|
||||
boolean w5 = RealDeviceConfig.getBitOf(signalStatus, config.getW5()); //输出 灭灯 开启 默认就是红灯
|
||||
boolean w7 = RealDeviceConfig.getBitOf(signalStatus, config.getW7()); //输出 红黄灯
|
||||
|
||||
SignalAspect aspect = null;
|
||||
if (br0 && w5) {
|
||||
aspect = SignalAspect.No;
|
||||
} else if (br0) {
|
||||
aspect = SignalAspect.R;
|
||||
} else if (br3 && w3) {
|
||||
aspect = SignalAspect.G;
|
||||
} else if (br3 && w4) {
|
||||
aspect = SignalAspect.Y;
|
||||
} else if (w7) {
|
||||
aspect = SignalAspect.RY;
|
||||
}
|
||||
log.info("当前信号灯状态 读红[{}],读绿黄[{}],写红[{}],写黄[{}],写灭灯[{}],写红黄[{}]", br0, br3, w3, w4, w5, w7);
|
||||
if (Objects.nonNull(aspect)) {
|
||||
vrSignal.apply(aspect);
|
||||
}
|
||||
if (!this.checkElectricRelay(signalStatus)) {
|
||||
return;
|
||||
}
|
||||
if (!vrSignal.isTurning()) {
|
||||
return;
|
||||
}
|
||||
switch (vrSignal.getCommand()) {
|
||||
case RY: {
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getW3(), w3, false, channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getW4(), w4, false, channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getW5(), w5, false, channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getW7(), w7, true, channel);
|
||||
break;
|
||||
}
|
||||
|
||||
case G: {
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getW3(), w3, true, channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getW4(), w4, false, channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getW5(), w5, false, channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getW7(), w7, false, channel);
|
||||
break;
|
||||
}
|
||||
case Y: {
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getW3(), w3, false, channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getW4(), w4, true, channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getW5(), w5, false, channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getW7(), w7, false, channel);
|
||||
break;
|
||||
}
|
||||
case R:
|
||||
case No: {
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getW3(), w3, false, channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getW4(), w4, false, channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getW5(), w5, true, channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, config.getW7(), w7, false, channel);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
package club.joylink.rtss.simulation.cbtc.device.real.modbustcp.gxsd;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig;
|
||||
import club.joylink.rtss.util.JsonUtils;
|
||||
import club.joylink.rtss.vo.client.project.ProjectDeviceVO;
|
||||
import club.joylink.rtss.vo.client.project.gxsd.GxsdSignalConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.gxsd.GxsdSwitchConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.gzb.GzbSwitchConfigVO;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Objects;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class GxsdSwitchConfig extends RealDeviceConfig {
|
||||
|
||||
private GxsdSwitchConfigVO config;
|
||||
/**
|
||||
* 下令定操
|
||||
*/
|
||||
private boolean turnToN;
|
||||
|
||||
/**
|
||||
* 下令反操
|
||||
*/
|
||||
private boolean turnToP;
|
||||
|
||||
/**
|
||||
* 定反操继电器接通时刻。 3s后断开继电器,防止继电器长期接通。
|
||||
*/
|
||||
private LocalDateTime startTime;
|
||||
|
||||
public GxsdSwitchConfig(ProjectDeviceVO deviceVO) {
|
||||
super(deviceVO);
|
||||
if (Objects.nonNull(deviceVO.getConfig())) {
|
||||
this.config = JsonUtils.read(deviceVO.getConfig(), GxsdSwitchConfigVO.class);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String findDeviceCode() {
|
||||
return config.findDeviceCode();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 请求转向定位
|
||||
*
|
||||
* @return 是否可以操作继电器以转向定位
|
||||
*/
|
||||
public boolean turnToN() {
|
||||
if (turnToN) {
|
||||
return false;
|
||||
} else {
|
||||
turnToN = true;
|
||||
turnToP = false;
|
||||
startTime = LocalDateTime.now();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求转向反位
|
||||
*
|
||||
* @return 是否可以操作继电器以转向反位
|
||||
*/
|
||||
public boolean turnToP() {
|
||||
if (turnToP) {
|
||||
return false;
|
||||
} else {
|
||||
turnToN = false;
|
||||
turnToP = true;
|
||||
startTime = LocalDateTime.now();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 定反操的继电器操作是否可以结束。
|
||||
*/
|
||||
public boolean isEnd() {
|
||||
return startTime == null || LocalDateTime.now().isAfter(startTime.plusSeconds(3));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 同步道岔状态表示以限定此时道岔可以进行的操作。 此方法是为了防止类似以下情况:通过仿真将道岔操到定位,再手摇道岔到反位,则此时仿真中道岔表示为反位, 只能执行定操,又因此处记录上一次操作也是定操,不予执行,导致死循环:仿真中无法再操作道岔了。
|
||||
*/
|
||||
public void sync(boolean r_db, boolean r_fb) {
|
||||
if (r_db) {
|
||||
turnToN = true;
|
||||
turnToP = false;
|
||||
} else if (r_fb) {
|
||||
turnToN = false;
|
||||
turnToP = true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,118 @@
|
|||
package club.joylink.rtss.simulation.cbtc.device.real.modbustcp.gxsd;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySignal;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.PlcGatewayService;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.PlcGateway;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.gzb.GzbSignalConfig;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.say.SaySwitchConfig;
|
||||
import club.joylink.rtss.vo.client.project.gxsd.GxsdSwitchConfigVO;
|
||||
import club.joylink.rtss.vo.client.project.say.SaySwitchConfigVO;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.Channel;
|
||||
import java.util.Objects;
|
||||
import lombok.Getter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class GxsdSwitchServiceImpl extends GxsdService {
|
||||
|
||||
@Override
|
||||
public boolean canHandle(RealDeviceConfig deviceConfig) {
|
||||
return deviceConfig instanceof GxsdSwitchConfig;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void init(Simulation simulation, RealDeviceConfig deviceConfig) {
|
||||
super.init(simulation, deviceConfig);
|
||||
PlcGateway plcGateway = simulation.queryPlcGatewayDevice();
|
||||
if (plcGateway == null) {
|
||||
return;
|
||||
}
|
||||
GxsdSwitchConfig switchConfig = (GxsdSwitchConfig) deviceConfig;
|
||||
GxsdSwitchConfigVO configVO = switchConfig.getConfig();
|
||||
int baseAddr = plcGateway.getConfig().getAddr() + configVO.getAddr();
|
||||
Channel channel = plcGateway.getChannel();
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getWdc(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getWfc(), false, channel);
|
||||
plcGatewayService.writeSingleCoil(baseAddr, configVO.getWsj(), false, channel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(Simulation simulation, RealDeviceConfig deviceConfig, ByteBuf byteBuf) {
|
||||
PlcGateway plcGateway = simulation.queryPlcGatewayDevice();
|
||||
if (plcGateway == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
GxsdSwitchConfig config = (GxsdSwitchConfig) deviceConfig;
|
||||
GxsdSwitchConfigVO configVO = config.getConfig();
|
||||
ByteBuf deviceStatus = RealDeviceConfig.getDeviceCoilStatus(byteBuf, configVO.getAddr(), configVO.getQuantity());
|
||||
int baseAddr = plcGateway.getConfig().getAddr() + configVO.getAddr();
|
||||
Channel channel = plcGateway.getChannel();
|
||||
VirtualRealitySwitch vrSwitch = (VirtualRealitySwitch) config.getMapElement();
|
||||
if (vrSwitch == null) {
|
||||
release(deviceStatus, baseAddr, configVO, channel); //防止定反操继电器长时间接通
|
||||
return;
|
||||
}
|
||||
|
||||
boolean r_db = RealDeviceConfig.getBitOf(deviceStatus, configVO.getRdc());
|
||||
boolean r_fb = RealDeviceConfig.getBitOf(deviceStatus, configVO.getRfc());
|
||||
vrSwitch.apply(r_db, r_fb);
|
||||
if (!this.checkElectricRelay(deviceStatus)) {
|
||||
return;
|
||||
}
|
||||
//以下操作实体设备的逻辑中,防止继电器长期接通的逻辑将定反操视为技能,共用3秒冷却,技能持续时间也是3秒
|
||||
if (config.isEnd()) { //此判断既可视为操作是否冷却,也可视为持续时间是否耗尽
|
||||
config.sync(r_db, r_fb);
|
||||
release(deviceStatus, baseAddr, configVO, channel); //操作持续时间耗尽后断开所有继电器
|
||||
if (vrSwitch.isTurning()) {
|
||||
switch (vrSwitch.getCommand()) {
|
||||
case NP:
|
||||
if (config.turnToN()) {
|
||||
turnToN(deviceStatus, baseAddr, configVO, channel);
|
||||
}
|
||||
break;
|
||||
case RP:
|
||||
if (config.turnToP()) {
|
||||
turnToP(deviceStatus, baseAddr, configVO, channel);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void turnToN(ByteBuf deviceStatus, int baseAddr, GxsdSwitchConfigVO configVO, Channel channel) {
|
||||
boolean w_sb = RealDeviceConfig.getBitOf(deviceStatus, configVO.getWsj());
|
||||
boolean w_dc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getWdc());
|
||||
boolean w_fc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getWfc());
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getWsj(), w_sb, true, channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getWdc(), w_dc, true, channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getWfc(), w_fc, false, channel);
|
||||
}
|
||||
|
||||
private void turnToP(ByteBuf deviceStatus, int baseAddr, GxsdSwitchConfigVO configVO, Channel channel) {
|
||||
boolean w_sb = RealDeviceConfig.getBitOf(deviceStatus, configVO.getWsj());
|
||||
boolean w_dc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getWdc());
|
||||
boolean w_fc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getWfc());
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getWsj(), w_sb, true, channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getWdc(), w_dc, false, channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getWfc(), w_fc, true, channel);
|
||||
}
|
||||
|
||||
private void release(ByteBuf deviceStatus, int baseAddr, GxsdSwitchConfigVO configVO, Channel channel) {
|
||||
boolean w_sb = RealDeviceConfig.getBitOf(deviceStatus, configVO.getWsj());
|
||||
boolean w_dc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getWdc());
|
||||
boolean w_fc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getWfc());
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getWsj(), w_sb, false, channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getWdc(), w_dc, false, channel);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getWfc(), w_fc, false, channel);
|
||||
}
|
||||
}
|
|
@ -377,6 +377,14 @@ public enum WebSocketMessageType {
|
|||
/**
|
||||
* ------------ 新实训消息 -----------
|
||||
*/
|
||||
/**
|
||||
* 实训准备开始,其他成员加载实训内容消息
|
||||
*/
|
||||
Simulation_Training_Prepare_Start,
|
||||
/**
|
||||
* 实训开始、结束状态
|
||||
*/
|
||||
Simulation_Training_Status,
|
||||
/**
|
||||
* 步骤开始时提示信息
|
||||
*/
|
||||
|
@ -395,7 +403,7 @@ public enum WebSocketMessageType {
|
|||
/**
|
||||
* 实训完成
|
||||
*/
|
||||
Simulation_Training_Finish
|
||||
Simulation_Training_Finish,
|
||||
/** ------------ 新实训消息 ----------- */
|
||||
;
|
||||
}
|
||||
|
|
|
@ -155,12 +155,14 @@ public class SocketMessageFactory {
|
|||
break;
|
||||
}
|
||||
// 20220819
|
||||
case Simulation_Training_Prepare_Start:
|
||||
case Simulation_Training_Step_Tip:
|
||||
case Simulation_Training_Step_Finish:
|
||||
case Simulation_Training_Audio_MATCH_RESULT:
|
||||
// case Simulation_Training_Operate_Error:
|
||||
// case Simulation_Training_Operate_Finish:
|
||||
case Simulation_Training_Finish: {
|
||||
case Simulation_Training_Finish:
|
||||
case Simulation_Training_Status: {
|
||||
topicList.add(String.format(WebSocketSubscribeTopic.AssistantSimulation, group));
|
||||
topicList.add(String.format(WebSocketSubscribeTopic.Simulation, group));
|
||||
topicList.add(String.format(WebSocketSubscribeTopic.Sandbox3D, group));
|
||||
|
|
|
@ -5,6 +5,8 @@ import club.joylink.rtss.entity.ProjectDevice;
|
|||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.PlcGateway;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.gxsd.GxsdSignalConfig;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.gxsd.GxsdSwitchConfig;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.gzb.GzbSignalConfig;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.gzb.GzbSwitchConfig;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.heb.device.*;
|
||||
|
@ -47,349 +49,377 @@ import java.util.Objects;
|
|||
@NoArgsConstructor
|
||||
public class ProjectDeviceVO {
|
||||
|
||||
private Long id;
|
||||
/**
|
||||
* 所属项目
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 所属项目
|
||||
*/
|
||||
// @NotBlank(message = "所属项目编码不能为空")
|
||||
private String project;
|
||||
private String project;
|
||||
|
||||
/**
|
||||
* 设备编号(或名称),一个项目下唯一
|
||||
*/
|
||||
@NotBlank(message = "设备编号(或名称)不能为空")
|
||||
private String code;
|
||||
/**
|
||||
* 设备编号(或名称),一个项目下唯一
|
||||
*/
|
||||
@NotBlank(message = "设备编号(或名称)不能为空")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private ProjectDeviceType type;
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private ProjectDeviceType type;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long creator;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long creator;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 设备网关映射配置
|
||||
*/
|
||||
private String config;
|
||||
/**
|
||||
* 设备网关映射配置
|
||||
*/
|
||||
private String config;
|
||||
|
||||
public ProjectDeviceVO(ProjectDevice device) {
|
||||
this.id = device.getId();
|
||||
this.project = device.getProjectCode();
|
||||
this.code = device.getCode();
|
||||
this.type = ProjectDeviceType.valueOf(device.getType());
|
||||
this.creator = device.getCreator();
|
||||
this.createTime = device.getCreateTime();
|
||||
this.config = device.getConfig();
|
||||
public ProjectDeviceVO(ProjectDevice device) {
|
||||
this.id = device.getId();
|
||||
this.project = device.getProjectCode();
|
||||
this.code = device.getCode();
|
||||
this.type = ProjectDeviceType.valueOf(device.getType());
|
||||
this.creator = device.getCreator();
|
||||
this.createTime = device.getCreateTime();
|
||||
this.config = device.getConfig();
|
||||
}
|
||||
|
||||
public static List<ProjectDeviceVO> convert2VOList(List<ProjectDevice> list) {
|
||||
List<ProjectDeviceVO> voList = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
list.forEach(projectDevice -> voList.add(new ProjectDeviceVO(projectDevice)));
|
||||
}
|
||||
return voList;
|
||||
}
|
||||
|
||||
public static List<ProjectDeviceVO> convert2VOList(List<ProjectDevice> list) {
|
||||
List<ProjectDeviceVO> voList = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
list.forEach(projectDevice -> voList.add(new ProjectDeviceVO(projectDevice)));
|
||||
public static List<RealDeviceConfig> convert2RealDeviceList(List<ProjectDeviceVO> voList) {
|
||||
List<RealDeviceConfig> list = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(voList)) {
|
||||
String project = voList.get(0).getProject();
|
||||
String projectCode = StringUtils.hasText(project) ? project.toUpperCase() : "";
|
||||
switch (projectCode) {
|
||||
case "XTY": {
|
||||
return xtyDeviceConfigConvert(voList);
|
||||
}
|
||||
return voList;
|
||||
}
|
||||
|
||||
public static List<RealDeviceConfig> convert2RealDeviceList(List<ProjectDeviceVO> voList) {
|
||||
List<RealDeviceConfig> list = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(voList)) {
|
||||
String project = voList.get(0).getProject();
|
||||
switch (project) {
|
||||
case "XTY": {
|
||||
return xtyDeviceConfigConvert(voList);
|
||||
}
|
||||
case "GZB": {
|
||||
return gzbDeviceConfigConvert(voList);
|
||||
}
|
||||
case "HEB": {
|
||||
return heb1DeviceConfigConvert(voList);
|
||||
}
|
||||
case "SDY": {
|
||||
return sdyDeviceConfigConvert(voList);
|
||||
}
|
||||
case "RICHOR_JOINT": {
|
||||
return zjdDeviceConfigConvert(voList);
|
||||
}
|
||||
case "SR_SANDBOX": {
|
||||
return srSandboxDeviceConfigConvert(voList);
|
||||
}
|
||||
case "RICHOR_HHCJ": {
|
||||
return hhcjDeviceConfigConvert(voList);
|
||||
}
|
||||
case "SAY": {
|
||||
return sayDeviceConfigConvert(voList);
|
||||
}
|
||||
}
|
||||
case "GZB": {
|
||||
return gzbDeviceConfigConvert(voList);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private static List<RealDeviceConfig> sayDeviceConfigConvert(List<ProjectDeviceVO> voList) {
|
||||
List<RealDeviceConfig> list = new ArrayList<>();
|
||||
for (ProjectDeviceVO deviceVO : voList) {
|
||||
switch (deviceVO.getType()) {
|
||||
case IBP:
|
||||
list.add(new SayIbpConfig(deviceVO));
|
||||
break;
|
||||
case PLC_GATEWAY:
|
||||
list.add(new PlcGateway(deviceVO));
|
||||
break;
|
||||
case PSD:
|
||||
list.add(new SayPsdConfig(deviceVO));
|
||||
break;
|
||||
case SIGNAL:
|
||||
list.add(new SaySignalConfig(deviceVO));
|
||||
break;
|
||||
case SWITCH:
|
||||
list.add(new SaySwitchConfig(deviceVO));
|
||||
break;
|
||||
case SECTION:
|
||||
list.add(new SaySectionConfig(deviceVO));
|
||||
break;
|
||||
}
|
||||
case "HEB": {
|
||||
return heb1DeviceConfigConvert(voList);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static List<RealDeviceConfig> hhcjDeviceConfigConvert(List<ProjectDeviceVO> voList) {
|
||||
List<RealDeviceConfig> list = new ArrayList<>();
|
||||
for (ProjectDeviceVO deviceVO : voList) {
|
||||
switch (deviceVO.getType()) {
|
||||
case IBP:
|
||||
list.add(new HhcjIbpConfig(deviceVO));
|
||||
break;
|
||||
case PSD:
|
||||
list.add(new HhcjPsdConfig(deviceVO));
|
||||
break;
|
||||
case PLC_GATEWAY:
|
||||
list.add(new PlcGateway(deviceVO));
|
||||
break;
|
||||
}
|
||||
case "SDY": {
|
||||
return sdyDeviceConfigConvert(voList);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static List<RealDeviceConfig> srSandboxDeviceConfigConvert(List<ProjectDeviceVO> voList) {
|
||||
List<RealDeviceConfig> list = new ArrayList<>();
|
||||
for (ProjectDeviceVO deviceVO : voList) {
|
||||
switch (deviceVO.getType()) {
|
||||
case UDP_LOW:
|
||||
list.add(new UDPLowConfig(deviceVO));
|
||||
break;
|
||||
case UDP_CLIENT:
|
||||
list.add(new UDPClientConfig(deviceVO));
|
||||
break;
|
||||
case SIGNAL:
|
||||
list.add(new SrSignalConfig(deviceVO));
|
||||
break;
|
||||
case SECTION:
|
||||
list.add(new SrSectionConfig(deviceVO));
|
||||
break;
|
||||
case SWITCH:
|
||||
list.add(new SrSwitchConfig(deviceVO));
|
||||
break;
|
||||
case TRAIN:
|
||||
list.add(new SrTrainConfig(deviceVO));
|
||||
break;
|
||||
}
|
||||
case "RICHOR_JOINT": {
|
||||
return zjdDeviceConfigConvert(voList);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static List<RealDeviceConfig> zjdDeviceConfigConvert(List<ProjectDeviceVO> voList) {
|
||||
List<RealDeviceConfig> list = new ArrayList<>();
|
||||
for (ProjectDeviceVO deviceVO : voList) {
|
||||
switch (deviceVO.getType()) {
|
||||
case IBP:
|
||||
list.add(new ZjdIbpConfig(deviceVO));
|
||||
break;
|
||||
case PLC_GATEWAY:
|
||||
list.add(new PlcGateway(deviceVO));
|
||||
break;
|
||||
case PSD:
|
||||
list.add(new ZjdPsdConfig(deviceVO));
|
||||
break;
|
||||
case PSL:
|
||||
list.add(new ZjdPslConfig(deviceVO));
|
||||
break;
|
||||
}
|
||||
case "SR_SANDBOX": {
|
||||
return srSandboxDeviceConfigConvert(voList);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static List<RealDeviceConfig> sdyDeviceConfigConvert(List<ProjectDeviceVO> voList) {
|
||||
List<RealDeviceConfig> list = new ArrayList<>();
|
||||
for (ProjectDeviceVO deviceVO : voList) {
|
||||
switch (deviceVO.getType()) {
|
||||
case PSD:
|
||||
list.add(new SdyPsdConfig(deviceVO));
|
||||
break;
|
||||
case PLC_GATEWAY:
|
||||
list.add(new PlcGateway(deviceVO));
|
||||
break;
|
||||
case PSL:
|
||||
list.add(new SdyPslConfig(deviceVO));
|
||||
break;
|
||||
}
|
||||
case "RICHOR_HHCJ": {
|
||||
return hhcjDeviceConfigConvert(voList);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static List<RealDeviceConfig> heb1DeviceConfigConvert(List<ProjectDeviceVO> voList) {
|
||||
List<RealDeviceConfig> list = new ArrayList<>();
|
||||
for (ProjectDeviceVO deviceVO : voList) {
|
||||
switch (deviceVO.getType()) {
|
||||
case SWITCH:
|
||||
list.add(new Heb1SwitchConfig(deviceVO));
|
||||
break;
|
||||
case SIGNAL:
|
||||
list.add(new Heb1SignalConfig(deviceVO));
|
||||
break;
|
||||
case PSC:
|
||||
list.add(new Heb1PscConfig(deviceVO));
|
||||
break;
|
||||
case PSL:
|
||||
list.add(new Heb1PslConfig(deviceVO));
|
||||
break;
|
||||
case IBP:
|
||||
list.add(new Heb1IbpConfig(deviceVO));
|
||||
break;
|
||||
case PLC_GATEWAY:
|
||||
list.add(new PlcGateway(deviceVO));
|
||||
break;
|
||||
default: {
|
||||
log.warn(String.format("设备[%s]不是PLC可连接控制设备", deviceVO));
|
||||
break;
|
||||
}
|
||||
}
|
||||
case "SAY": {
|
||||
return sayDeviceConfigConvert(voList);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static List<RealDeviceConfig> gzbDeviceConfigConvert(List<ProjectDeviceVO> voList) {
|
||||
List<RealDeviceConfig> list = new ArrayList<>();
|
||||
for (ProjectDeviceVO deviceVO : voList) {
|
||||
switch (deviceVO.getType()) {
|
||||
case SWITCH:
|
||||
list.add(new GzbSwitchConfig(deviceVO));
|
||||
break;
|
||||
case SIGNAL:
|
||||
list.add(new GzbSignalConfig(deviceVO));
|
||||
break;
|
||||
case PLC_GATEWAY:
|
||||
list.add(new PlcGateway(deviceVO));
|
||||
break;
|
||||
default: {
|
||||
log.warn(String.format("设备[%s]不是PLC可连接控制设备", deviceVO));
|
||||
break;
|
||||
}
|
||||
}
|
||||
case "GXSD": {
|
||||
return gxsdDeviceConfigConvert(voList);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
private static List<RealDeviceConfig> xtyDeviceConfigConvert(List<ProjectDeviceVO> voList) {
|
||||
List<RealDeviceConfig> list = new ArrayList<>();
|
||||
for (ProjectDeviceVO deviceVO : voList) {
|
||||
switch (deviceVO.getType()) {
|
||||
case PSD:
|
||||
list.add(new XtyPsdConfig(deviceVO));
|
||||
break;
|
||||
case PLC_GATEWAY:
|
||||
list.add(new PlcGateway(deviceVO));
|
||||
break;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static List<RealDeviceConfig> gxsdDeviceConfigConvert(List<ProjectDeviceVO> voList) {
|
||||
List<RealDeviceConfig> list = new ArrayList<>();
|
||||
for (ProjectDeviceVO deviceVO : voList) {
|
||||
switch (deviceVO.getType()) {
|
||||
case SWITCH:
|
||||
list.add(new GxsdSwitchConfig(deviceVO));
|
||||
break;
|
||||
case SIGNAL:
|
||||
list.add(new GxsdSignalConfig(deviceVO));
|
||||
break;
|
||||
case PLC_GATEWAY:
|
||||
list.add(new PlcGateway(deviceVO));
|
||||
break;
|
||||
default: {
|
||||
log.warn(String.format("设备[%s]不是PLC可连接控制设备", deviceVO));
|
||||
break;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public ProjectDevice buildDB() {
|
||||
ProjectDevice device = new ProjectDevice();
|
||||
device.setProjectCode(this.getProject());
|
||||
device.setCode(this.getCode());
|
||||
device.setType(this.getType().name());
|
||||
return device;
|
||||
private static List<RealDeviceConfig> sayDeviceConfigConvert(List<ProjectDeviceVO> voList) {
|
||||
List<RealDeviceConfig> list = new ArrayList<>();
|
||||
for (ProjectDeviceVO deviceVO : voList) {
|
||||
switch (deviceVO.getType()) {
|
||||
case IBP:
|
||||
list.add(new SayIbpConfig(deviceVO));
|
||||
break;
|
||||
case PLC_GATEWAY:
|
||||
list.add(new PlcGateway(deviceVO));
|
||||
break;
|
||||
case PSD:
|
||||
list.add(new SayPsdConfig(deviceVO));
|
||||
break;
|
||||
case SIGNAL:
|
||||
list.add(new SaySignalConfig(deviceVO));
|
||||
break;
|
||||
case SWITCH:
|
||||
list.add(new SaySwitchConfig(deviceVO));
|
||||
break;
|
||||
case SECTION:
|
||||
list.add(new SaySectionConfig(deviceVO));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ProjectDeviceVO{" +
|
||||
"project=" + project +
|
||||
", code='" + code + '\'' +
|
||||
", type=" + type +
|
||||
'}';
|
||||
private static List<RealDeviceConfig> hhcjDeviceConfigConvert(List<ProjectDeviceVO> voList) {
|
||||
List<RealDeviceConfig> list = new ArrayList<>();
|
||||
for (ProjectDeviceVO deviceVO : voList) {
|
||||
switch (deviceVO.getType()) {
|
||||
case IBP:
|
||||
list.add(new HhcjIbpConfig(deviceVO));
|
||||
break;
|
||||
case PSD:
|
||||
list.add(new HhcjPsdConfig(deviceVO));
|
||||
break;
|
||||
case PLC_GATEWAY:
|
||||
list.add(new PlcGateway(deviceVO));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public LwConfigVO buildLwConfig() {
|
||||
BusinessExceptionAssertEnum
|
||||
.SYSTEM_EXCEPTION
|
||||
.assertTrue(Objects.equals(this.getType(), ProjectDeviceType.LW), "设备不是[现地工作站]");
|
||||
return JsonUtils.read(this.config, LwConfigVO.class);
|
||||
private static List<RealDeviceConfig> srSandboxDeviceConfigConvert(List<ProjectDeviceVO> voList) {
|
||||
List<RealDeviceConfig> list = new ArrayList<>();
|
||||
for (ProjectDeviceVO deviceVO : voList) {
|
||||
switch (deviceVO.getType()) {
|
||||
case UDP_LOW:
|
||||
list.add(new UDPLowConfig(deviceVO));
|
||||
break;
|
||||
case UDP_CLIENT:
|
||||
list.add(new UDPClientConfig(deviceVO));
|
||||
break;
|
||||
case SIGNAL:
|
||||
list.add(new SrSignalConfig(deviceVO));
|
||||
break;
|
||||
case SECTION:
|
||||
list.add(new SrSectionConfig(deviceVO));
|
||||
break;
|
||||
case SWITCH:
|
||||
list.add(new SrSwitchConfig(deviceVO));
|
||||
break;
|
||||
case TRAIN:
|
||||
list.add(new SrTrainConfig(deviceVO));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public VrIbpConfigVO buildVrIbpConfig() {
|
||||
BusinessExceptionAssertEnum
|
||||
.SYSTEM_EXCEPTION
|
||||
.assertTrue(Objects.equals(this.getType(), ProjectDeviceType.IBP), "设备不是[IBP盘]");
|
||||
return JsonUtils.read(this.config, VrIbpConfigVO.class);
|
||||
private static List<RealDeviceConfig> zjdDeviceConfigConvert(List<ProjectDeviceVO> voList) {
|
||||
List<RealDeviceConfig> list = new ArrayList<>();
|
||||
for (ProjectDeviceVO deviceVO : voList) {
|
||||
switch (deviceVO.getType()) {
|
||||
case IBP:
|
||||
list.add(new ZjdIbpConfig(deviceVO));
|
||||
break;
|
||||
case PLC_GATEWAY:
|
||||
list.add(new PlcGateway(deviceVO));
|
||||
break;
|
||||
case PSD:
|
||||
list.add(new ZjdPsdConfig(deviceVO));
|
||||
break;
|
||||
case PSL:
|
||||
list.add(new ZjdPslConfig(deviceVO));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public LswConfigVO buildLswConfig() {
|
||||
BusinessExceptionAssertEnum
|
||||
.SYSTEM_EXCEPTION
|
||||
.assertTrue(Objects.equals(this.getType(), ProjectDeviceType.LSW), "设备不是[大屏工作站]");
|
||||
return JsonUtils.read(this.config, LswConfigVO.class);
|
||||
private static List<RealDeviceConfig> sdyDeviceConfigConvert(List<ProjectDeviceVO> voList) {
|
||||
List<RealDeviceConfig> list = new ArrayList<>();
|
||||
for (ProjectDeviceVO deviceVO : voList) {
|
||||
switch (deviceVO.getType()) {
|
||||
case PSD:
|
||||
list.add(new SdyPsdConfig(deviceVO));
|
||||
break;
|
||||
case PLC_GATEWAY:
|
||||
list.add(new PlcGateway(deviceVO));
|
||||
break;
|
||||
case PSL:
|
||||
list.add(new SdyPslConfig(deviceVO));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public RelationLoginConfigVO buildRelationLoginConfig() {
|
||||
if (StringUtils.isEmpty(this.config)) {
|
||||
return null;
|
||||
private static List<RealDeviceConfig> heb1DeviceConfigConvert(List<ProjectDeviceVO> voList) {
|
||||
List<RealDeviceConfig> list = new ArrayList<>();
|
||||
for (ProjectDeviceVO deviceVO : voList) {
|
||||
switch (deviceVO.getType()) {
|
||||
case SWITCH:
|
||||
list.add(new Heb1SwitchConfig(deviceVO));
|
||||
break;
|
||||
case SIGNAL:
|
||||
list.add(new Heb1SignalConfig(deviceVO));
|
||||
break;
|
||||
case PSC:
|
||||
list.add(new Heb1PscConfig(deviceVO));
|
||||
break;
|
||||
case PSL:
|
||||
list.add(new Heb1PslConfig(deviceVO));
|
||||
break;
|
||||
case IBP:
|
||||
list.add(new Heb1IbpConfig(deviceVO));
|
||||
break;
|
||||
case PLC_GATEWAY:
|
||||
list.add(new PlcGateway(deviceVO));
|
||||
break;
|
||||
default: {
|
||||
log.warn(String.format("设备[%s]不是PLC可连接控制设备", deviceVO));
|
||||
break;
|
||||
}
|
||||
return JsonUtils.read(this.config, RelationLoginConfigVO.class);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public SwitchConfigVO buildSwitchConfig() {
|
||||
BusinessExceptionAssertEnum
|
||||
.SYSTEM_EXCEPTION
|
||||
.assertTrue(Objects.equals(this.getType(), ProjectDeviceType.SWITCH), "设备不是[道岔]");
|
||||
return JsonUtils.read(this.config, SwitchConfigVO.class);
|
||||
private static List<RealDeviceConfig> gzbDeviceConfigConvert(List<ProjectDeviceVO> voList) {
|
||||
List<RealDeviceConfig> list = new ArrayList<>();
|
||||
for (ProjectDeviceVO deviceVO : voList) {
|
||||
switch (deviceVO.getType()) {
|
||||
case SWITCH:
|
||||
list.add(new GzbSwitchConfig(deviceVO));
|
||||
break;
|
||||
case SIGNAL:
|
||||
list.add(new GzbSignalConfig(deviceVO));
|
||||
break;
|
||||
case PLC_GATEWAY:
|
||||
list.add(new PlcGateway(deviceVO));
|
||||
break;
|
||||
default: {
|
||||
log.warn(String.format("设备[%s]不是PLC可连接控制设备", deviceVO));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public PslConfigVO buildPslConfig() {
|
||||
BusinessExceptionAssertEnum
|
||||
.SYSTEM_EXCEPTION
|
||||
.assertTrue(Objects.equals(this.getType(), ProjectDeviceType.PSL), "设备不是[端头屏蔽门控制盒]");
|
||||
return JsonUtils.read(this.config, PslConfigVO.class);
|
||||
private static List<RealDeviceConfig> xtyDeviceConfigConvert(List<ProjectDeviceVO> voList) {
|
||||
List<RealDeviceConfig> list = new ArrayList<>();
|
||||
for (ProjectDeviceVO deviceVO : voList) {
|
||||
switch (deviceVO.getType()) {
|
||||
case PSD:
|
||||
list.add(new XtyPsdConfig(deviceVO));
|
||||
break;
|
||||
case PLC_GATEWAY:
|
||||
list.add(new PlcGateway(deviceVO));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public IbpConfigVO buildIbpConfig() {
|
||||
BusinessExceptionAssertEnum
|
||||
.SYSTEM_EXCEPTION
|
||||
.assertTrue(Objects.equals(this.getType(), ProjectDeviceType.IBP), "设备不是[IBP]");
|
||||
return JsonUtils.read(this.config, IbpConfigVO.class);
|
||||
}
|
||||
@JsonIgnore
|
||||
public ProjectDevice buildDB() {
|
||||
ProjectDevice device = new ProjectDevice();
|
||||
device.setProjectCode(this.getProject());
|
||||
device.setCode(this.getCode());
|
||||
device.setType(this.getType().name());
|
||||
return device;
|
||||
}
|
||||
|
||||
public PscConfigVO buildPscConfig() {
|
||||
BusinessExceptionAssertEnum
|
||||
.SYSTEM_EXCEPTION
|
||||
.assertTrue(Objects.equals(this.getType(), ProjectDeviceType.PSC), "设备不是[PSC]");
|
||||
return JsonUtils.read(this.config, PscConfigVO.class);
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ProjectDeviceVO{" +
|
||||
"project=" + project +
|
||||
", code='" + code + '\'' +
|
||||
", type=" + type +
|
||||
'}';
|
||||
}
|
||||
|
||||
public PlcGatewayConfigVO buildPlcGatewayConfig() {
|
||||
BusinessExceptionAssertEnum
|
||||
.SYSTEM_EXCEPTION
|
||||
.assertTrue(Objects.equals(this.getType(), ProjectDeviceType.PLC_GATEWAY), "设备不是[PLC网关]");
|
||||
return JsonUtils.read(this.config, PlcGatewayConfigVO.class);
|
||||
public LwConfigVO buildLwConfig() {
|
||||
BusinessExceptionAssertEnum
|
||||
.SYSTEM_EXCEPTION
|
||||
.assertTrue(Objects.equals(this.getType(), ProjectDeviceType.LW), "设备不是[现地工作站]");
|
||||
return JsonUtils.read(this.config, LwConfigVO.class);
|
||||
}
|
||||
|
||||
public VrIbpConfigVO buildVrIbpConfig() {
|
||||
BusinessExceptionAssertEnum
|
||||
.SYSTEM_EXCEPTION
|
||||
.assertTrue(Objects.equals(this.getType(), ProjectDeviceType.IBP), "设备不是[IBP盘]");
|
||||
return JsonUtils.read(this.config, VrIbpConfigVO.class);
|
||||
}
|
||||
|
||||
public LswConfigVO buildLswConfig() {
|
||||
BusinessExceptionAssertEnum
|
||||
.SYSTEM_EXCEPTION
|
||||
.assertTrue(Objects.equals(this.getType(), ProjectDeviceType.LSW), "设备不是[大屏工作站]");
|
||||
return JsonUtils.read(this.config, LswConfigVO.class);
|
||||
}
|
||||
|
||||
public RelationLoginConfigVO buildRelationLoginConfig() {
|
||||
if (StringUtils.isEmpty(this.config)) {
|
||||
return null;
|
||||
}
|
||||
return JsonUtils.read(this.config, RelationLoginConfigVO.class);
|
||||
}
|
||||
|
||||
public SwitchConfigVO buildSwitchConfig() {
|
||||
BusinessExceptionAssertEnum
|
||||
.SYSTEM_EXCEPTION
|
||||
.assertTrue(Objects.equals(this.getType(), ProjectDeviceType.SWITCH), "设备不是[道岔]");
|
||||
return JsonUtils.read(this.config, SwitchConfigVO.class);
|
||||
}
|
||||
|
||||
public PslConfigVO buildPslConfig() {
|
||||
BusinessExceptionAssertEnum
|
||||
.SYSTEM_EXCEPTION
|
||||
.assertTrue(Objects.equals(this.getType(), ProjectDeviceType.PSL),
|
||||
"设备不是[端头屏蔽门控制盒]");
|
||||
return JsonUtils.read(this.config, PslConfigVO.class);
|
||||
}
|
||||
|
||||
public IbpConfigVO buildIbpConfig() {
|
||||
BusinessExceptionAssertEnum
|
||||
.SYSTEM_EXCEPTION
|
||||
.assertTrue(Objects.equals(this.getType(), ProjectDeviceType.IBP), "设备不是[IBP]");
|
||||
return JsonUtils.read(this.config, IbpConfigVO.class);
|
||||
}
|
||||
|
||||
public PscConfigVO buildPscConfig() {
|
||||
BusinessExceptionAssertEnum
|
||||
.SYSTEM_EXCEPTION
|
||||
.assertTrue(Objects.equals(this.getType(), ProjectDeviceType.PSC), "设备不是[PSC]");
|
||||
return JsonUtils.read(this.config, PscConfigVO.class);
|
||||
}
|
||||
|
||||
public PlcGatewayConfigVO buildPlcGatewayConfig() {
|
||||
BusinessExceptionAssertEnum
|
||||
.SYSTEM_EXCEPTION
|
||||
.assertTrue(Objects.equals(this.getType(), ProjectDeviceType.PLC_GATEWAY),
|
||||
"设备不是[PLC网关]");
|
||||
return JsonUtils.read(this.config, PlcGatewayConfigVO.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
package club.joylink.rtss.vo.client.project.gxsd;
|
||||
|
||||
import club.joylink.rtss.vo.client.project.RealConfigVO;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
/**
|
||||
*广西水利电力职业技术学院项目信号机配置
|
||||
*/
|
||||
public class GxsdSignalConfigVO extends RealConfigVO {
|
||||
|
||||
/**
|
||||
* 信号输入位 红灯
|
||||
*/
|
||||
private Integer r1 = 1;
|
||||
|
||||
/**
|
||||
* 信号输入位 绿灯或黄灯
|
||||
*/
|
||||
private Integer r3 = 3;
|
||||
|
||||
|
||||
/**
|
||||
* 信号输出控制位 绿灯
|
||||
*/
|
||||
private Integer w3 = 11;
|
||||
|
||||
/**
|
||||
* 信号输出控制位 黄灯
|
||||
*/
|
||||
private Integer w4 = 12;
|
||||
|
||||
/**
|
||||
* 信号输出控制位 灭灯 开启 默认就是红灯
|
||||
*/
|
||||
private Integer w5 = 13;
|
||||
|
||||
/**
|
||||
* 信号输出控制位 红黄灯
|
||||
*/
|
||||
private Integer w7 = 15;
|
||||
|
||||
public GxsdSignalConfigVO() {
|
||||
super(0, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String findDeviceCode() {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package club.joylink.rtss.vo.client.project.gxsd;
|
||||
|
||||
import club.joylink.rtss.vo.client.project.RealConfigVO;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 广西水利电力职业技术学院项目道岔配置
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class GxsdSwitchConfigVO extends RealConfigVO {
|
||||
|
||||
/**
|
||||
* 设置定反位锁机
|
||||
* 道岔定位/反位
|
||||
* 设置锁接
|
||||
* 设置道岔定位/反位3秒后取消定反操
|
||||
* 道岔到位 取消锁接
|
||||
*/
|
||||
|
||||
/**
|
||||
* 读反位
|
||||
*/
|
||||
private Integer rfc = 0;
|
||||
|
||||
/**
|
||||
* 读定位
|
||||
*/
|
||||
private Integer rdc = 2;
|
||||
|
||||
|
||||
/**
|
||||
* 写反操
|
||||
*/
|
||||
private Integer wfc = 10;
|
||||
|
||||
/**
|
||||
* 写定操
|
||||
*/
|
||||
private Integer wdc = 9;
|
||||
|
||||
/**
|
||||
* 锁接
|
||||
*/
|
||||
private Integer wsj = 8;
|
||||
|
||||
public GxsdSwitchConfigVO() {
|
||||
super(0, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String findDeviceCode() {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -254,6 +254,12 @@ public class MapGraphDataNewVO {
|
|||
*/
|
||||
private Map<Simulation.Type, List<MapClientVO>> mapClientVOMap = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 上电解锁按钮
|
||||
*/
|
||||
private List<MapPowerUnlockButtonVO> powerUnLockButtonList;
|
||||
|
||||
|
||||
public MapGraphDataNewVO() {
|
||||
this.bigScreenConfig = new BigScreenConfig();
|
||||
this.generateConfig = new MapCiGenerateConfig();
|
||||
|
@ -288,6 +294,7 @@ public class MapGraphDataNewVO {
|
|||
this.arrowList = new ArrayList<>();
|
||||
this.directionRodList = new ArrayList<>();
|
||||
this.responderList = new ArrayList<>();
|
||||
this.powerUnLockButtonList = new ArrayList<>();
|
||||
}
|
||||
|
||||
public static MapGraphDataNewVO parse(String graphData) {
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package club.joylink.rtss.vo.map.graph;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* 上电解锁按钮
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class MapPowerUnlockButtonVO {
|
||||
|
||||
@NotBlank(message = "code不能为空")
|
||||
private String code;
|
||||
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 所属设备集中站code
|
||||
*/
|
||||
private String stationCode;
|
||||
|
||||
private Point position;
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package club.joylink.rtss.vo.map.graph;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Signal;
|
||||
import club.joylink.rtss.vo.map.MapCISwitchVO;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
@ -202,6 +203,11 @@ public class MapSignalNewVO {
|
|||
*/
|
||||
private String srCode;
|
||||
|
||||
/**
|
||||
* 引导关键道岔列表
|
||||
*/
|
||||
private List<MapCISwitchVO> guideKeySwitchList;
|
||||
|
||||
@JsonIgnore
|
||||
public boolean isShunting() {
|
||||
return Signal.SignalType.SHUNTING.equals(this.type);
|
||||
|
|
Loading…
Reference in New Issue