Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/rtss-server into test
This commit is contained in:
commit
3e6bd50e11
@ -412,6 +412,7 @@ public class SimulationMainThread {
|
|||||||
}
|
}
|
||||||
case MESSAGE_3D: {
|
case MESSAGE_3D: {
|
||||||
this.joylink3DMessageService.collectAndSendTrainHmiDisplayMessage(simulation);
|
this.joylink3DMessageService.collectAndSendTrainHmiDisplayMessage(simulation);
|
||||||
|
this.joylink3DMessageService.tdtStatusCollectAndSend(simulation);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TRAIN_POSITION_3D: {
|
case TRAIN_POSITION_3D: {
|
||||||
|
@ -7,7 +7,9 @@ import club.joylink.rtss.simulation.cbtc.communication.vo.*;
|
|||||||
import club.joylink.rtss.simulation.cbtc.communication.vo.fault.DeviceFaultInfo;
|
import club.joylink.rtss.simulation.cbtc.communication.vo.fault.DeviceFaultInfo;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
|
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.map.Stand;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.status.TrainStatus;
|
import club.joylink.rtss.simulation.cbtc.data.status.TrainStatus;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.vo.TdtStatusVO;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityScreenDoor;
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityScreenDoor;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySignal;
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySignal;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch;
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch;
|
||||||
@ -57,6 +59,29 @@ public class Joylink3DMessageService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void tdtStatusCollectAndSend(Simulation simulation) {
|
||||||
|
List<TdtStatusVO> list = new ArrayList<>();
|
||||||
|
SimulationDataRepository repository = simulation.getRepository();
|
||||||
|
for (Stand stand : repository.getStandList()) {
|
||||||
|
if (!stand.isSmall()) {
|
||||||
|
TdtStatusVO statusVO = repository.queryTdtStatus(stand.getCode());
|
||||||
|
if (Objects.isNull(statusVO)) {
|
||||||
|
statusVO = new TdtStatusVO(stand);
|
||||||
|
repository.addTdtStatus(statusVO);
|
||||||
|
list.add(statusVO);
|
||||||
|
} else {
|
||||||
|
if (statusVO.compareAndChange(stand)) {
|
||||||
|
list.add(statusVO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TdtStatusVO tdtStatusVO = new TdtStatusVO(stand);
|
||||||
|
list.add(tdtStatusVO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SocketMessageVO message = SocketMessageFactory.buildTrainIsAbout2ArriveMessage(simulation.getGroup(), list);
|
||||||
|
this.stompMessageService.sendToUser(simulation.getSimulationUserIds(), message);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建并发送列车状态信息
|
* 构建并发送列车状态信息
|
||||||
*
|
*
|
||||||
@ -305,4 +330,6 @@ public class Joylink3DMessageService {
|
|||||||
Set<String> users = simulation.getSimulationUserIds();
|
Set<String> users = simulation.getSimulationUserIds();
|
||||||
this.collectAndSend3DInitDeviceList(simulation, users);
|
this.collectAndSend3DInitDeviceList(simulation, users);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import club.joylink.rtss.simulation.cbtc.data.status.IbpStatus;
|
|||||||
import club.joylink.rtss.simulation.cbtc.data.status.TrainStatus;
|
import club.joylink.rtss.simulation.cbtc.data.status.TrainStatus;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.support.RoutePath;
|
import club.joylink.rtss.simulation.cbtc.data.support.RoutePath;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
|
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.vo.TdtStatusVO;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo;
|
import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityDevice;
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityDevice;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||||
@ -77,6 +78,13 @@ public class SimulationDataRepository {
|
|||||||
*/
|
*/
|
||||||
private Map<String, TrainHmiDisplay> trainHmiMap = new ConcurrentHashMap<>();
|
private Map<String, TrainHmiDisplay> trainHmiMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TDT(train depart timer)状态数据
|
||||||
|
* key-站台code
|
||||||
|
* val-tdt状态对象
|
||||||
|
*/
|
||||||
|
private Map<String, TdtStatusVO> tdtStatusMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ATS监控的列车信息map
|
* ATS监控的列车信息map
|
||||||
* key-车组号
|
* key-车组号
|
||||||
@ -643,6 +651,7 @@ public class SimulationDataRepository {
|
|||||||
// 清空设备状态
|
// 清空设备状态
|
||||||
this.deviceInfoMap.clear();
|
this.deviceInfoMap.clear();
|
||||||
this.trainHmiMap.clear();
|
this.trainHmiMap.clear();
|
||||||
|
this.tdtStatusMap.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -904,6 +913,18 @@ public class SimulationDataRepository {
|
|||||||
this.trainHmiMap.remove(code);
|
this.trainHmiMap.remove(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TdtStatusVO queryTdtStatus(String code) {
|
||||||
|
return this.tdtStatusMap.get(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addTdtStatus(TdtStatusVO tdtStatusVO) {
|
||||||
|
this.tdtStatusMap.put(tdtStatusVO.getStandCode(), tdtStatusVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeTdtStatus(String code) {
|
||||||
|
this.tdtStatusMap.remove(code);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取该车站某个方向的相邻车站
|
* 获取该车站某个方向的相邻车站
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,66 @@
|
|||||||
|
package club.joylink.rtss.simulation.cbtc.data.vo;
|
||||||
|
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.map.Stand;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class TdtStatusVO {
|
||||||
|
/**
|
||||||
|
* 站台code
|
||||||
|
*/
|
||||||
|
private String standCode;
|
||||||
|
/**
|
||||||
|
* 是否扣车
|
||||||
|
*/
|
||||||
|
private boolean hold;
|
||||||
|
/**
|
||||||
|
* 是否跳停
|
||||||
|
*/
|
||||||
|
private boolean jump;
|
||||||
|
/**
|
||||||
|
* 倒计时剩余时间
|
||||||
|
*/
|
||||||
|
private int remain;
|
||||||
|
/**
|
||||||
|
* 是否有停靠列车
|
||||||
|
*/
|
||||||
|
private boolean parking;
|
||||||
|
|
||||||
|
public TdtStatusVO(Stand stand) {
|
||||||
|
this.standCode = stand.getCode();
|
||||||
|
boolean trainParking = stand.isTrainParking();
|
||||||
|
this.parking = trainParking;
|
||||||
|
if (trainParking) {
|
||||||
|
this.remain = stand.getRemainTime() / 1000;
|
||||||
|
}
|
||||||
|
this.hold = stand.isHoldTrain();
|
||||||
|
this.jump = stand.isJumpStop();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean compareAndChange(Stand stand) {
|
||||||
|
boolean change = false;
|
||||||
|
boolean trainParking = stand.isTrainParking();
|
||||||
|
if (!Objects.equals(this.parking, trainParking)) {
|
||||||
|
change = true;
|
||||||
|
this.parking = trainParking;
|
||||||
|
}
|
||||||
|
int remainTime = stand.getRemainTime() / 1000;
|
||||||
|
if (trainParking && !Objects.equals(this.remain, remainTime)) {
|
||||||
|
change = true;
|
||||||
|
this.remain = remainTime;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(this.jump, stand.isJumpStop())) {
|
||||||
|
change = true;
|
||||||
|
this.jump = stand.isJumpStop();
|
||||||
|
}
|
||||||
|
if (!Objects.equals(this.hold, stand.isHoldTrain())) {
|
||||||
|
change = true;
|
||||||
|
this.hold = stand.isHoldTrain();
|
||||||
|
}
|
||||||
|
return change;
|
||||||
|
}
|
||||||
|
}
|
@ -141,6 +141,8 @@ public enum WebSocketMessageType {
|
|||||||
DeviceCtrl_3D,
|
DeviceCtrl_3D,
|
||||||
/** 列车即将进站消息 */
|
/** 列车即将进站消息 */
|
||||||
BeAbout2Arrive_3D,
|
BeAbout2Arrive_3D,
|
||||||
|
/** 列车即将进站消息 */
|
||||||
|
TDT_3D,
|
||||||
/** 3D设备故障设置消息 */
|
/** 3D设备故障设置消息 */
|
||||||
Device_Fault_Set_3D,
|
Device_Fault_Set_3D,
|
||||||
/** 3D设备故障解决消息 */
|
/** 3D设备故障解决消息 */
|
||||||
|
@ -6,10 +6,7 @@ import club.joylink.rtss.simulation.cbtc.communication.vo.TrainPosition;
|
|||||||
import club.joylink.rtss.simulation.cbtc.conversation.Conversation;
|
import club.joylink.rtss.simulation.cbtc.conversation.Conversation;
|
||||||
import club.joylink.rtss.simulation.cbtc.conversation.ConversationMessage;
|
import club.joylink.rtss.simulation.cbtc.conversation.ConversationMessage;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.status.IbpStatus;
|
import club.joylink.rtss.simulation.cbtc.data.status.IbpStatus;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vo.ConversationSocketMessageVO;
|
import club.joylink.rtss.simulation.cbtc.data.vo.*;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vo.DeviceStatusVO;
|
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vo.SimulationVO;
|
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vo.TrainIsAbout2ArriveVO;
|
|
||||||
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
||||||
import club.joylink.rtss.simulation.cbtc.member.SimulationUser;
|
import club.joylink.rtss.simulation.cbtc.member.SimulationUser;
|
||||||
import club.joylink.rtss.vo.client.SocketMessageVO;
|
import club.joylink.rtss.vo.client.SocketMessageVO;
|
||||||
@ -139,6 +136,7 @@ public class SocketMessageFactory {
|
|||||||
}
|
}
|
||||||
case Device_Load_Destroy_3D:
|
case Device_Load_Destroy_3D:
|
||||||
case DeviceCtrl_3D:
|
case DeviceCtrl_3D:
|
||||||
|
case TDT_3D:
|
||||||
case BeAbout2Arrive_3D: {
|
case BeAbout2Arrive_3D: {
|
||||||
topicList.add(String.format(WebSocketSubscribeTopic.Sandbox3D, group));
|
topicList.add(String.format(WebSocketSubscribeTopic.Sandbox3D, group));
|
||||||
topicList.add(String.format(WebSocketSubscribeTopic.TrainDrive3D, group));
|
topicList.add(String.format(WebSocketSubscribeTopic.TrainDrive3D, group));
|
||||||
@ -320,6 +318,14 @@ public class SocketMessageFactory {
|
|||||||
return build(WebSocketMessageType.BeAbout2Arrive_3D, group, arriveVO);
|
return build(WebSocketMessageType.BeAbout2Arrive_3D, group, arriveVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建列车即将到站消息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static SocketMessageVO<List<TdtStatusVO>> buildTrainIsAbout2ArriveMessage(String group, List<TdtStatusVO> list) {
|
||||||
|
return build(WebSocketMessageType.TDT_3D, group, list);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建VR同步消息
|
* 构建VR同步消息
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user