增加仿真工作参数变更后发送ws消息逻辑;
This commit is contained in:
parent
19775a11ce
commit
c0c2e81ebf
@ -18,7 +18,7 @@ public interface IscsSystemResourcesDAO extends MyBatisBaseDao<IscsSystemResourc
|
|||||||
" values " +
|
" values " +
|
||||||
" <foreach collection=\"list\" item=\"entity\" separator=\",\"> " +
|
" <foreach collection=\"list\" item=\"entity\" separator=\",\"> " +
|
||||||
" (#{entity.mapId,jdbcType=BIGINT}, #{entity.system,jdbcType=VARCHAR}, " +
|
" (#{entity.mapId,jdbcType=BIGINT}, #{entity.system,jdbcType=VARCHAR}, " +
|
||||||
" #{entity.type,jdbcType=VARCHAR}, #{entity.resource_ids,jdbcType=VARCHAR})" +
|
" #{entity.type,jdbcType=VARCHAR}, #{entity.resourceIds,jdbcType=VARCHAR})" +
|
||||||
" </foreach>" +
|
" </foreach>" +
|
||||||
"</script>")
|
"</script>")
|
||||||
void batchInsert(@Param("list") List<IscsSystemResources> iscsSystemResources);
|
void batchInsert(@Param("list") List<IscsSystemResources> iscsSystemResources);
|
||||||
|
@ -104,18 +104,6 @@ public class FuZhouLineOne1PassengerFlowDataServiceImpl implements MapPassengerF
|
|||||||
this.iCacheService.remove(BusinessConsts.CachePrefix.Map_Passenger_Flow + mapId);
|
this.iCacheService.remove(BusinessConsts.CachePrefix.Map_Passenger_Flow + mapId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public MapPassengerFlowWithBLOBs queryMapPassengerFlowData(Long mapId) {
|
|
||||||
MapPassengerFlowExample example = new MapPassengerFlowExample();
|
|
||||||
example.createCriteria()
|
|
||||||
.andMapIdEqualTo(mapId);
|
|
||||||
List<MapPassengerFlowWithBLOBs> mpfs = this.mapPassengerFlowDAO.selectByExampleWithBLOBs(example);
|
|
||||||
if (!CollectionUtils.isEmpty(mpfs)) {
|
|
||||||
return mpfs.get(0);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MapPassengerFlowWithBLOBs queryInitialMapPassengerFlowData(Long mapId) {
|
public MapPassengerFlowWithBLOBs queryInitialMapPassengerFlowData(Long mapId) {
|
||||||
MapPassengerFlowExample example = new MapPassengerFlowExample();
|
MapPassengerFlowExample example = new MapPassengerFlowExample();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package club.joylink.rtss.services.publishData;
|
package club.joylink.rtss.services.publishData;
|
||||||
|
|
||||||
import club.joylink.rtss.simulation.cbtc.passenger.data.PassengerFlowData;
|
|
||||||
import club.joylink.rtss.entity.MapPassengerFlowWithBLOBs;
|
import club.joylink.rtss.entity.MapPassengerFlowWithBLOBs;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.passenger.data.PassengerFlowData;
|
||||||
import club.joylink.rtss.vo.client.passenger.MapPassengerFlowVO;
|
import club.joylink.rtss.vo.client.passenger.MapPassengerFlowVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -12,8 +12,6 @@ public interface MapPassengerFlowDataService {
|
|||||||
|
|
||||||
void importTripData(Long mapId, String data);
|
void importTripData(Long mapId, String data);
|
||||||
|
|
||||||
MapPassengerFlowWithBLOBs queryMapPassengerFlowData(Long mapId);
|
|
||||||
|
|
||||||
PassengerFlowData queryPassengerFlowDataOfMap(Long mapId, Long passengerFlowId);
|
PassengerFlowData queryPassengerFlowDataOfMap(Long mapId, Long passengerFlowId);
|
||||||
|
|
||||||
MapPassengerFlowWithBLOBs queryInitialMapPassengerFlowData(Long mapId);
|
MapPassengerFlowWithBLOBs queryInitialMapPassengerFlowData(Long mapId);
|
||||||
|
@ -9,8 +9,11 @@ import club.joylink.rtss.simulation.cbtc.work.SimulationWorkService;
|
|||||||
import club.joylink.rtss.simulation.cbtc.work.SimulationWorkServiceManager;
|
import club.joylink.rtss.simulation.cbtc.work.SimulationWorkServiceManager;
|
||||||
import club.joylink.rtss.simulation.messaging.websocket.DefaultMessageSender;
|
import club.joylink.rtss.simulation.messaging.websocket.DefaultMessageSender;
|
||||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||||
|
import club.joylink.rtss.vo.client.SocketMessageVO;
|
||||||
|
import club.joylink.rtss.vo.client.factory.SocketMessageFactory;
|
||||||
import club.joylink.rtss.vo.client.mapFunction.RtsMapFunctionVO;
|
import club.joylink.rtss.vo.client.mapFunction.RtsMapFunctionVO;
|
||||||
import club.joylink.rtss.vo.client.simulationv1.RunAsPlanParam;
|
import club.joylink.rtss.vo.client.simulationv1.RunAsPlanParam;
|
||||||
|
import club.joylink.rtss.websocket.StompMessageService;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
@ -21,6 +24,7 @@ import org.springframework.util.StringUtils;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class SimulationServiceImpl implements SimulationService {
|
public class SimulationServiceImpl implements SimulationService {
|
||||||
@ -36,6 +40,8 @@ public class SimulationServiceImpl implements SimulationService {
|
|||||||
private DefaultMessageSender defaultMessageSender;
|
private DefaultMessageSender defaultMessageSender;
|
||||||
@Autowired
|
@Autowired
|
||||||
private RtsMapFunctionService rtsMapFunctionService;
|
private RtsMapFunctionService rtsMapFunctionService;
|
||||||
|
@Autowired
|
||||||
|
private StompMessageService stompMessageService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String createSimulation(long mapId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO) {
|
public String createSimulation(long mapId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO) {
|
||||||
@ -91,6 +97,10 @@ public class SimulationServiceImpl implements SimulationService {
|
|||||||
"非仿真创建者不能使用该功能");
|
"非仿真创建者不能使用该功能");
|
||||||
}
|
}
|
||||||
initService.addItems(simulation, functionInfoMap, loginInfo);
|
initService.addItems(simulation, functionInfoMap, loginInfo);
|
||||||
|
SocketMessageVO<SimulationWorkParamVO> workParamMessage = SocketMessageFactory
|
||||||
|
.buildSimulationWorkParamMessage(simulationId, simulation.getBuildParams().getWorkParamVO());
|
||||||
|
Set<String> users = simulation.getSimulationUserIds();
|
||||||
|
stompMessageService.sendToUser(users, workParamMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import club.joylink.rtss.simulation.cbtc.data.plan.RealRun;
|
|||||||
import club.joylink.rtss.simulation.cbtc.data.status.DeviceStatus;
|
import club.joylink.rtss.simulation.cbtc.data.status.DeviceStatus;
|
||||||
import club.joylink.rtss.simulation.cbtc.event.*;
|
import club.joylink.rtss.simulation.cbtc.event.*;
|
||||||
import club.joylink.rtss.simulation.cbtc.member.SimulationUser;
|
import club.joylink.rtss.simulation.cbtc.member.SimulationUser;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO;
|
||||||
import club.joylink.rtss.simulation.event.SimulationUserDisconnectEvent;
|
import club.joylink.rtss.simulation.event.SimulationUserDisconnectEvent;
|
||||||
import club.joylink.rtss.simulation.event.SimulationUserSubscribeEvent;
|
import club.joylink.rtss.simulation.event.SimulationUserSubscribeEvent;
|
||||||
import club.joylink.rtss.simulation.event.SimulationUserUnsubscribeEvent;
|
import club.joylink.rtss.simulation.event.SimulationUserUnsubscribeEvent;
|
||||||
@ -151,6 +152,11 @@ public class SimulationUserWsListener {
|
|||||||
.build(WebSocketMessageType.Simulation_Alarm, simulation.getId(), alarmList);
|
.build(WebSocketMessageType.Simulation_Alarm, simulation.getId(), alarmList);
|
||||||
this.stompMessageService.sendToUser(userId, alarmMessageVO);
|
this.stompMessageService.sendToUser(userId, alarmMessageVO);
|
||||||
}
|
}
|
||||||
|
// 仿真工作参数同步
|
||||||
|
SimulationWorkParamVO workParamVO = simulation.getBuildParams().getWorkParamVO();
|
||||||
|
SocketMessageVO<SimulationWorkParamVO> message = SocketMessageFactory
|
||||||
|
.buildSimulationWorkParamMessage(simulation.getId(), workParamVO);
|
||||||
|
this.stompMessageService.sendToUser(userId, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Async("nsExecutor")
|
@Async("nsExecutor")
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package club.joylink.rtss.simulation.cbtc.vo;
|
package club.joylink.rtss.simulation.cbtc.vo;
|
||||||
|
|
||||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
@ -23,7 +22,6 @@ public class SimulationWorkParamVO {
|
|||||||
/**
|
/**
|
||||||
* 仿真加载项
|
* 仿真加载项
|
||||||
*/
|
*/
|
||||||
@JsonInclude(value = JsonInclude.Include.NON_NULL)
|
|
||||||
private Map<Item, String> itemMap;
|
private Map<Item, String> itemMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,6 +55,10 @@ public enum WebSocketMessageType {
|
|||||||
* 仿真-时间同步消息
|
* 仿真-时间同步消息
|
||||||
*/
|
*/
|
||||||
Simulation_Time_Sync,
|
Simulation_Time_Sync,
|
||||||
|
/**
|
||||||
|
* 仿真-工作参数
|
||||||
|
*/
|
||||||
|
SIMULATION_WORK_PARAM,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 仿真-设备状态消息
|
* 仿真-设备状态消息
|
||||||
|
@ -17,6 +17,7 @@ import club.joylink.rtss.simulation.cbtc.data.vo.*;
|
|||||||
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.simulation.cbtc.message.SimulationSubscribeTopic;
|
import club.joylink.rtss.simulation.cbtc.message.SimulationSubscribeTopic;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO;
|
||||||
import club.joylink.rtss.util.JsonUtils;
|
import club.joylink.rtss.util.JsonUtils;
|
||||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||||
import club.joylink.rtss.vo.client.SocketMessageVO;
|
import club.joylink.rtss.vo.client.SocketMessageVO;
|
||||||
@ -77,6 +78,7 @@ public class SocketMessageFactory {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Simulation_Time_Sync:
|
case Simulation_Time_Sync:
|
||||||
|
case SIMULATION_WORK_PARAM:
|
||||||
case Simulation_User:
|
case Simulation_User:
|
||||||
case Simulation_Member:
|
case Simulation_Member:
|
||||||
case Simulation_DeviceStatus:
|
case Simulation_DeviceStatus:
|
||||||
@ -447,4 +449,11 @@ public class SocketMessageFactory {
|
|||||||
public static SocketMessageVO<Ticket> buildRailTicketMessage(String sId, Ticket body) {
|
public static SocketMessageVO<Ticket> buildRailTicketMessage(String sId, Ticket body) {
|
||||||
return build(WebSocketMessageType.SIMULATION_RAIL_TICKET, sId, body);
|
return build(WebSocketMessageType.SIMULATION_RAIL_TICKET, sId, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建仿真工作参数
|
||||||
|
*/
|
||||||
|
public static SocketMessageVO<SimulationWorkParamVO> buildSimulationWorkParamMessage(String sId, SimulationWorkParamVO body) {
|
||||||
|
return build(WebSocketMessageType.SIMULATION_WORK_PARAM, sId, body);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ public class PictureVO {
|
|||||||
|
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
private String stationCode;
|
private List<String> stationCodes;
|
||||||
|
|
||||||
private Map<String, Device> deviceMap;
|
private Map<String, Device> deviceMap;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user