Merge remote-tracking branch 'origin/test'

This commit is contained in:
joylink_zhangsai 2020-12-07 19:24:44 +08:00
commit bfdede9f5f
7 changed files with 68 additions and 11 deletions

View File

@ -148,6 +148,7 @@ public class InterlockBuilder2 {
route.setDestinationButtonSignal(endButtonSignal);
}
}
if (route.getStart() == null) continue;
route.setTurnBack(mapRouteVO.isTurnBack());
route.setAtp(mapRouteVO.isAtp());
route.setGround(mapRouteVO.isGround());

View File

@ -13,7 +13,6 @@ 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.VirtualRealityTrain;
import club.joylink.rtss.simulation.cbtc.event.*;
import club.joylink.rtss.simulation.cbtc.member.MemberManager;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import club.joylink.rtss.vo.client.SocketMessageVO;
import club.joylink.rtss.vo.client.WebSocketMessageType;
@ -38,9 +37,6 @@ public class Joylink3DMessageService {
@Autowired
private StompMessageService stompMessageService;
@Autowired
private MemberManager memberManager;
@Autowired
private GroupSimulationService groupSimulationService;

View File

@ -144,7 +144,7 @@ public class SimulationSubscribeManager {
}
subscribeInfos.removeAll(removeList);
return set.stream()
.filter(dest -> this.containsSubDestination(dest) ? false : true)
.filter(dest -> !this.containsSubDestination(dest))
.collect(Collectors.toList());
}
@ -162,7 +162,7 @@ public class SimulationSubscribeManager {
.map(subscribeInfo -> subscribeInfo.destination)
.collect(Collectors.toSet())
.stream()
.filter(dest -> this.containsSubDestination(dest) ? false : true)
.filter(dest -> !this.containsSubDestination(dest))
.collect(Collectors.toList());
}

View File

@ -114,9 +114,31 @@ public class PassengerFlowSimulateService {
// 发送初始化数据
this.sendStandPassengerFlowData(simulation, standPassengerFlowMap);
this.sendTrainPassengerFlowData(simulation, trainPassengerFlowMap);
// 发送列车pis数据
this.sendTrainInitPisData(simulation, trainPassengerFlowMap);
log.debug(String.format("客流初始化成功"));
}
private void sendTrainInitPisData(Simulation simulation, Map<String, TrainPassengerFlow> trainPassengerFlowMap) {
List<Map<String, Object>> trainPisList = new ArrayList<>();
for (TrainPassengerFlow tpf : trainPassengerFlowMap.values()) {
VirtualRealityTrain train = tpf.getTrain();
Map<String, Object> pisInfo = new HashMap<>();
pisInfo.put("code", train.getGroupNumber());
pisInfo.put("nextStation", train.getNextStation() != null ? train.getNextStation().getCode() : null);
pisInfo.put("endStation", train.getTerminalStation() != null ? train.getTerminalStation().getCode() : null);
trainPisList.add(pisInfo);
}
if (!trainPisList.isEmpty()) {
Set<String> users = simulation.getSimulationUserIds();
String json = JsonUtils.writeValueNullableFieldAsString(trainPisList);
SocketMessageVO<String> message = SocketMessageFactory.build(
WebSocketMessageType.TRAIN_PIS,
simulation.getGroup(), json);
this.stompMessageService.sendToUser(users, message);
}
}
private void sendTrainPassengerFlowData(Simulation simulation, Map<String, TrainPassengerFlow> trainPassengerFlowMap) {
List<Map<String, Object>> trainPFNumList = new ArrayList<>();
for (TrainPassengerFlow flow : trainPassengerFlowMap.values()) {
@ -162,6 +184,8 @@ public class PassengerFlowSimulateService {
}
this.sendStandPassengerFlowData(simulation, passengerFlowSimulationData.getStandPassengerFlowMap());
this.sendTrainPassengerFlowData(simulation, passengerFlowSimulationData.getTrainPassengerFlowMap());
// 发生列车pis数据
this.sendTrainInitPisData(simulation, passengerFlowSimulationData.getTrainPassengerFlowMap());
}
private Map<String, TrainPassengerFlow> loadTrainPassengerFlow(Simulation simulation, PassengerFlowData passengerFlowData) {
@ -289,6 +313,7 @@ public class PassengerFlowSimulateService {
SimulationDataRepository repository = simulation.getRepository();
List<TrainPassengerFlow> allTrainPassengerFlows = passengerFlowSimulationData.getAllTrainPassengerFlow();
PassengerFlowData passengerFlowData = passengerFlowSimulationData.getPassengerFlowData();
Set<String> users = simulation.getSimulationUserIds();
for (TrainPassengerFlow trainPassengerFlow : allTrainPassengerFlows) {
VirtualRealityTrain train = trainPassengerFlow.getTrain();
TrainInfo trainInfo = repository.findSupervisedTrainByGroup(train.getGroupNumber());
@ -328,14 +353,46 @@ public class PassengerFlowSimulateService {
sendData.put("out", tripStationPassengerFlowData.getDown());
trainPassengerFlow.startBoarding(station, tripStationPassengerFlowData);
Set<String> users = simulation.getSimulationUserIds();
String json = JsonUtils.writeValueNullableFieldAsString(sendData);
SocketMessageVO<String> message = SocketMessageFactory.build(
WebSocketMessageType.TRAIN_PFI_BL,
simulation.getGroup(), json);
this.stompMessageService.sendToUser(users, message);
}
});
}
@Async("nsExecutor")
@Scheduled(fixedRate = 5000)
public void trainPis() {
passengerFlowSimulationDataMap.forEach((group, passengerFlowSimulationData) -> {
Simulation simulation = this.groupSimulationCache.getSimulationByGroup(group);
SimulationDataRepository repository = simulation.getRepository();
List<TrainPassengerFlow> allTrainPassengerFlows = passengerFlowSimulationData.getAllTrainPassengerFlow();
List<Map<String, Object>> trainPisList = new ArrayList<>();
for (TrainPassengerFlow trainPassengerFlow : allTrainPassengerFlows) {
VirtualRealityTrain train = trainPassengerFlow.getTrain();
TrainInfo trainInfo = repository.findSupervisedTrainByGroup(train.getGroupNumber());
if (Objects.isNull(trainInfo) || !trainInfo.isPlanTrain() || !trainInfo.isParking()) {
continue;
}
if (train.isStandReadyStart()) {
Map<String, Object> pisInfo = new HashMap<>();
pisInfo.put("code", train.getGroupNumber());
pisInfo.put("nextStation", train.getNextStation() != null ? train.getNextStation().getCode() : null);
pisInfo.put("endStation", train.getTerminalStation() != null ? train.getTerminalStation().getCode() : null);
trainPisList.add(pisInfo);
}
}
if (trainPisList.isEmpty()) {
return;
}
Set<String> users = simulation.getSimulationUserIds();
String json = JsonUtils.writeValueNullableFieldAsString(trainPisList);
SocketMessageVO<String> message = SocketMessageFactory.build(
WebSocketMessageType.TRAIN_PIS,
simulation.getGroup(), json);
this.stompMessageService.sendToUser(users, message);
});
}

View File

@ -164,6 +164,8 @@ public enum WebSocketMessageType {
TRAIN_PFI_NUM,
/** 列车客流乘降人数信息 */
TRAIN_PFI_BL,
/** 列车位置信息 */
TRAIN_PIS,
/** 车站客流当前人数信息 */
STATION_PFI_NUM,
// ------------客流消息end------------

View File

@ -131,6 +131,7 @@ public class SocketMessageFactory {
case STAND_PFI:
case TRAIN_PFI_NUM:
case TRAIN_PFI_BL:
case TRAIN_PIS:
case PFV:
case SJL3D_TrainStatus: {
topicList.add(String.format(WebSocketSubscribeTopic.Sandbox3D, group));

View File

@ -444,16 +444,16 @@
from sys_user left join user_company_rel ucr on sys_user.id = ucr.user_id left join company on ucr.company_id = company.id
<where>
<if test="name != null and name != ''">
and sys_user.`name` like '%#{name}%'
and sys_user.`name` like concat('%', #{name}, '%')
</if>
<if test="nickname != null and nickname != ''">
and sys_user.`nickname` like '%#{nickname}%'
and sys_user.`nickname` like concat('%', #{nickname}, '%')
</if>
<if test="mobile != null and mobile != ''">
and sys_user.`mobile` like '%#{mobile}%'
and sys_user.`mobile` like concat('%', #{mobile}, '%')
</if>
<if test="rolesStr != null and rolesStr != ''">
and sys_user.`roles` like '%${rolesStr}%'
and sys_user.`roles` like concat('%', #{rolesStr}, '%')
</if>
<if test="companyId != null">
and company.id = #{companyId}