【车站模式申请消息返回格式修改】
This commit is contained in:
parent
8cfa715e37
commit
3cc442b0fa
@ -666,32 +666,48 @@ public class AtsStationService {
|
||||
/**
|
||||
* 发送申请转换操作模式申请
|
||||
* @param simulation
|
||||
* @param station
|
||||
*/
|
||||
public void replyOperationMode(Simulation simulation, Station station) {
|
||||
Station.OperationModeApplication modeApplication = station.getOperationModeApplication();
|
||||
if (modeApplication == null) {
|
||||
return;
|
||||
}
|
||||
// 申请超过两分钟
|
||||
if (simulation.getCorrectSystemTime().isAfter(modeApplication.getApplyDateTime().plusMinutes(2))) {
|
||||
station.setOperationModeApplication(null);
|
||||
return;
|
||||
}
|
||||
if (CollectionUtils.isEmpty(modeApplication.getApprovalMember())) {
|
||||
return;
|
||||
}
|
||||
Set<String> userSet = modeApplication.getApprovalMember().stream()
|
||||
.filter(m -> !m.isRobot()).map(club.joylink.rtss.simulation.SimulationMember::getUserId).collect(Collectors.toSet());
|
||||
if (!CollectionUtils.isEmpty(userSet)) {
|
||||
Map<String, Object> messageMap = new HashMap<>();
|
||||
messageMap.put("source", modeApplication.getSource());
|
||||
messageMap.put("target", modeApplication.getTarget());
|
||||
messageMap.put("applyMember", modeApplication.getApplicationMember().getId());
|
||||
messageMap.put("applyDateTime", modeApplication.getApplyDateTime());
|
||||
SocketMessageVO<Map<String, Object>> socketMessageVO =
|
||||
SocketMessageFactory.build(WebSocketMessageType.Simulation_Operation_Mode_Apply, simulation.getId(), messageMap);
|
||||
stompMessageService.sendToUser(userSet, socketMessageVO);
|
||||
public void replyOperationMode(Simulation simulation) {
|
||||
List<Station> stationList = simulation.getRepository().getStationList();
|
||||
// 需要给用户发送的申请列表
|
||||
Map<String, List<Map<String,Object>>> userMessageMap = new HashMap<>(stationList.size());
|
||||
stationList.stream().filter(station -> {
|
||||
Station.OperationModeApplication modeApplication = station.getOperationModeApplication();
|
||||
if (modeApplication== null) {
|
||||
return false;
|
||||
}
|
||||
if (CollectionUtils.isEmpty(modeApplication.getApprovalMember())) {
|
||||
return false;
|
||||
}
|
||||
// 申请超过两分钟
|
||||
if (simulation.getCorrectSystemTime().isAfter(modeApplication.getApplyDateTime().plusMinutes(2))) {
|
||||
station.setOperationModeApplication(null);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}).forEach(station -> {
|
||||
Station.OperationModeApplication modeApplication = station.getOperationModeApplication();
|
||||
Set<String> userSet = modeApplication.getApprovalMember().stream().filter(m -> !m.isRobot())
|
||||
.map(club.joylink.rtss.simulation.SimulationMember::getUserId).collect(Collectors.toSet());
|
||||
if (!CollectionUtils.isEmpty(userSet)) {
|
||||
Map<String, Object> messageMap = new HashMap<>();
|
||||
messageMap.put("code", station.getCode());
|
||||
messageMap.put("source", modeApplication.getSource());
|
||||
messageMap.put("target", modeApplication.getTarget());
|
||||
messageMap.put("applyMember", modeApplication.getApplicationMember().getId());
|
||||
messageMap.put("applyDateTime", modeApplication.getApplyDateTime());
|
||||
for (String userId : userSet) {
|
||||
if (!userMessageMap.containsKey(userId)) {
|
||||
userMessageMap.put(userId, new ArrayList<>());
|
||||
}
|
||||
userMessageMap.get(userId).add(messageMap);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!CollectionUtils.isEmpty(userMessageMap)) {
|
||||
userMessageMap.forEach((k, v) ->
|
||||
stompMessageService.sendToUser(k,
|
||||
SocketMessageFactory.build(WebSocketMessageType.Simulation_Operation_Mode_Apply, simulation.getId(), v)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,10 +64,10 @@ public class CiLogic {
|
||||
|
||||
// 区间灯点灯逻辑
|
||||
if (simulation.getRepository().getConfig().isRailway()) {
|
||||
// 车站站控操作模式转换
|
||||
atsStationService.replyOperationMode(simulation);
|
||||
// 车站
|
||||
simulation.getRepository().getStationList().stream().forEach(station -> {
|
||||
// 车站站控操作模式转换
|
||||
atsStationService.replyOperationMode(simulation, station);
|
||||
// 允许自律状态刷新
|
||||
station.refreshAllowAutonomyStatus();
|
||||
// 接、发辅助按钮倒计时刷新
|
||||
|
Loading…
Reference in New Issue
Block a user