迁移/common接口;仿真客户端使用前端定义的值

This commit is contained in:
joylink_zhangsai 2022-12-02 10:46:59 +08:00
parent ce4744f519
commit cd2ddbd106
4 changed files with 246 additions and 72 deletions

View File

@ -5,6 +5,7 @@ import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.IVirtualRealityIbpService;
import club.joylink.rtss.services.psl.IVirtualRealityPslService;
import club.joylink.rtss.services.simulation.SimulationSupportService;
import club.joylink.rtss.simulation.SimulationManager;
import club.joylink.rtss.simulation.cbtc.ATS.data.AtsAlarm;
import club.joylink.rtss.simulation.cbtc.ATS.data.SimulationLog;
import club.joylink.rtss.simulation.cbtc.GroupSimulationService;
@ -18,6 +19,7 @@ import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityPsl;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO;
import club.joylink.rtss.simulation.vo.SimulationInfoVO;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.PageVO;
@ -30,14 +32,12 @@ import club.joylink.rtss.vo.client.operation.DriveParamVO;
import club.joylink.rtss.vo.client.psl.PslStatus;
import club.joylink.rtss.vo.client.runplan.PlanTripNumberVO;
import club.joylink.rtss.vo.client.runplan.RunPlanEChartsDataVO;
import club.joylink.rtss.vo.client.simulationv1.RunAsPlanParam;
import club.joylink.rtss.vo.client.simulationv1.SimulationLogPagedQueryVO;
import club.joylink.rtss.vo.client.simulationv1.SimulationMemberVO;
import club.joylink.rtss.vo.client.simulationv1.SimulationUserVO;
import club.joylink.rtss.vo.client.simulationv1.*;
import club.joylink.rtss.vo.map.MapVO;
import club.joylink.rtss.vo.map.graph.MapStationNewVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -46,6 +46,8 @@ import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 新仿真接口
@ -67,6 +69,8 @@ public class SimulationV1Controller {
private IVirtualRealityPslService iVirtualRealityPslService;
@Autowired
private SimulationService simulationService;
@Autowired
private SimulationManager simulationManager;
/**
* 根据产品类型创建仿真
@ -203,7 +207,7 @@ public class SimulationV1Controller {
@PostMapping("/{group}/operate/{type}")
public Object operate(@PathVariable @NotBlank String group, @PathVariable @NotNull String type,
@RequestBody(required = false) Map<String, Object> param, @RequestAttribute AccountVO user) {
if(null == param){
if (null == param) {
param = new HashMap<>();
}
return this.groupSimulationService.operate(group, type, param, user);
@ -306,21 +310,21 @@ public class SimulationV1Controller {
return this.groupSimulationService.getSimulationMembers(group);
}
/**
* 仿真暂停
*/
@PutMapping(path = "/{group}/pause")
public void pause(@PathVariable String group) {
groupSimulationService.pauseSimulation(group);
}
// /**
// * 仿真暂停
// */
// @PutMapping(path = "/{group}/pause")
// public void pause(@PathVariable String group) {
// groupSimulationService.pauseSimulation(group);
// }
/**
* 仿真恢复运行
*/
@PutMapping(path = "/{group}/resume")
public void resume(@PathVariable String group) {
groupSimulationService.resumeSimulation(group);
}
// /**
// * 仿真恢复运行
// */
// @PutMapping(path = "/{group}/resume")
// public void resume(@PathVariable String group) {
// groupSimulationService.resumeSimulation(group);
// }
/**
* 获取仿真设备故障列表
@ -541,4 +545,82 @@ public class SimulationV1Controller {
, @PathVariable("functionId") long mapFunctionId) {
return simulationService.querySimulationByMapIdAndMapFunction(mapId, mapFunctionId);
}
/**
* 监管仿真
*/
@GetMapping("/supervise")
public List<SimulationInfoVO> superviseSimulation(@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO loginUserInfoVO, SimulationInfoQueryVO queryVO) {
List<Simulation> simulationList = this.simulationManager.getSimulationList();
Stream<Simulation> stream = simulationList.stream();
stream = stream.filter(simulation -> simulation instanceof club.joylink.rtss.simulation.cbtc.Simulation
&& Objects.equals(loginUserInfoVO.getTopOrgId(), ((club.joylink.rtss.simulation.cbtc.Simulation) simulation).getBuildParams().getLoginUserInfo().getTopOrgId()));
if (StringUtils.hasText(queryVO.getGroup())) {
stream = stream.filter(simulation -> simulation.getId().contains(queryVO.getGroup()));
}
if (StringUtils.hasText(queryVO.getUserName())) {
stream = stream.filter(simulation -> simulation.getSimulationUsers().stream().anyMatch(user -> user.getName().contains(queryVO.getUserName())));
}
if (StringUtils.hasText(queryVO.getPrdType())) {
stream = stream.filter(simulation -> simulation instanceof club.joylink.rtss.simulation.cbtc.Simulation
&& queryVO.getPrdType().equals(simulation.getBuildParams().getProdType().getCode()));
}
return stream.map(Simulation::convertToVO).collect(Collectors.toList());
}
/**
* 获取所有存在的仿真
*/
@GetMapping("/list")
public List<SimulationInfoVO> queryInfo(SimulationInfoQueryVO queryVO) {
List<Simulation> simulationList = this.simulationManager.getSimulationList();
Stream<Simulation> stream = simulationList.stream();
if (StringUtils.hasText(queryVO.getGroup())) {
stream = stream.filter(simulation -> simulation.getId().contains(queryVO.getGroup()));
}
if (StringUtils.hasText(queryVO.getUserName())) {
stream = stream.filter(simulation -> simulation.getSimulationUsers().stream().anyMatch(user -> user.getName().contains(queryVO.getUserName())));
}
if (StringUtils.hasText(queryVO.getPrdType())) {
stream = stream.filter(simulation -> simulation instanceof club.joylink.rtss.simulation.cbtc.Simulation
&& queryVO.getPrdType().equals(simulation.getBuildParams().getProdType().getCode()));
}
return stream.map(Simulation::convertToVO).collect(Collectors.toList());
}
/**
* 暂停
*/
@PutMapping("/{id}/pause")
public void pause(@PathVariable String id) {
this.simulationManager.pause(id);
}
/**
* 开始
*/
@PutMapping("/{id}/start")
public void start(@PathVariable String id) {
this.simulationManager.start(id);
}
/**
* 调整倍速
*/
@PutMapping("/{id}/updateSpeed/{speed}")
public void updateSpeed(@PathVariable String id, @PathVariable int speed) {
this.simulationManager.updateSpeed(id, speed);
}
/**
* 获取仿真中所有仿真用户
*/
@GetMapping("/{id}/users")
public List<club.joylink.rtss.simulation.vo.SimulationUserVO> getSimulationUsers(@PathVariable String id) {
return this.simulationManager.getSimulationUsers(id).stream()
.map(club.joylink.rtss.simulation.SimulationUser::convertToVO)
.collect(Collectors.toList());
}
}

View File

@ -607,7 +607,7 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
}
SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder()
.singleClient(true)
.client(Simulation.Client.SCHEDULING.name())
.client(Simulation.Client.scheduleWork.name())
.build();
Map<SimulationWorkParamVO.Item, String> itemMap = new HashMap<>();
itemMap.put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, dispatcherOptional.get().getId());
@ -629,7 +629,7 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
}
SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder()
.singleClient(true)
.client(Simulation.Client.ISCS.name())
.client(Simulation.Client.iscsView.name())
.build();
Map<SimulationWorkParamVO.Item, String> itemMap = new HashMap<>();
itemMap.put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, dispatcherOptional.get().getId());
@ -646,7 +646,7 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
}
SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder()
.singleClient(true)
.client(Simulation.Client.RUN_PLAN_DESIGN.name())
.client(Simulation.Client.diagramEdit.name())
.build();
return buildCreateVO(mapId, name, name, simType, null, domConfig);
};
@ -661,7 +661,7 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
}
SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder()
.singleClient(true)
.client(Simulation.Client.C_ATS_BS.name())
.client(Simulation.Client.bigScreen.name())
.build();
return buildCreateVO(mapId, name, name, simType, null, domConfig);
};

View File

@ -18,10 +18,7 @@ import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
@ -192,8 +189,8 @@ public class SimulationManager {
}
}
public List<Simulation> getSimulationList() {
return new ArrayList<>(simulationCache.values());
public <T extends Simulation> List<T> getSimulationList() {
return new ArrayList<T>((Collection<? extends T>) simulationCache.values());
}
public List<SimulationMember> getSimulationMembers(String id) {

View File

@ -748,11 +748,17 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation<Simulati
}
public enum Type {
/** 地铁 */
/**
* 地铁
*/
METRO,
/** 铁路/大铁 */
/**
* 铁路/大铁
*/
RAILWAY,
/** 应急调度Emergency dispatching command system */
/**
* 应急调度Emergency dispatching command system
*/
EMERGENCY,
}
@ -760,42 +766,131 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation<Simulati
* 客户端/终端
*/
public enum Client {
/** 中心ATS工作站 */
C_ATS,
/** 中心ATS大屏百度到的资料里使用了“中央级ATS大屏幕显示器”的命名*/
C_ATS_BS,
/** 中心PA系统行调共用 */
C_PA,
/** 中心视频监控系统 */
C_CCTV,
/** 综合监控 */
ISCS,
/** 派班工作站 */
SCHEDULING,
// /** 中心ATS工作站 */
// C_ATS,
// /** 中心ATS大屏百度到的资料里使用了“中央级ATS大屏幕显示器”的命名*/
// C_ATS_BS,
// /** 中心PA系统行调共用 */
// C_PA,
// /** 中心视频监控系统 */
// C_CCTV,
// /** 综合监控 */
// ISCS,
// /** 派班工作站 */
// SCHEDULING,
//
// /** 现地ATS工作站 */
// L_ATS,
// /** 本地控制工作站Local Control Workstation */
// LCW,
// /** 现地PA系统 */
// L_PA,
// /** 现地视频监控系统 */
// L_CCTV,
// IBP,
// PSL,
// /** 列车驾驶 */
// DRIVE,
// /** 运行图编制/设计 */
// RUN_PLAN_DESIGN,
//
//
// /** 调度台终端(含 WintgTerm、LayoutTerm、DcmdTerm、TSRTerm、C3Term、ShuntTerm来源文档 */
// GPC,
// /** 联锁工作站Interlock PC根据车务终端命名猜的 */
// IPC,
// /** 车务终端Station PC来源文档 */
// STPC,
// /** 车务管理终端(来源:文档) */
// DMP,
/** 现地ATS工作站 */
L_ATS,
/** 本地控制工作站Local Control Workstation */
LCW,
/** 现地PA系统 */
L_PA,
/** 现地视频监控系统 */
L_CCTV,
IBP,
PSL,
/** 列车驾驶 */
DRIVE,
/** 运行图编制/设计 */
RUN_PLAN_DESIGN,
/** 调度台终端(含 WintgTerm、LayoutTerm、DcmdTerm、TSRTerm、C3Term、ShuntTerm来源文档 */
GPC,
/** 联锁工作站Interlock PC根据车务终端命名猜的 */
IPC,
/** 车务终端Station PC来源文档 */
STPC,
/** 车务管理终端(来源:文档) */
DMP,
/**
* 中心ATS工作站
*/
dispatchWork,
/**
* 中心ATS大屏
*/
bigScreen,
/**
* 现地ATS工作站
*/
localWork,
/**
* ISCS
*/
iscsView,
/**
* IBP
*/
ibp,
/**
* PSL
*/
psl,
/**
* 列车驾驶
*/
drivingPlan,
/**
* CCTV
*/
cctvView,
/**
* 设备视图
*/
jl3dModle,
/**
* 数字沙盘
*/
digitalStand,
/**
* 车务终端
*/
trafficTerminal,
/**
* 车务管理终端
*/
trafficManageTerminal,
/**
* 调度命令
*/
dispatchingCommand,
/**
* 调度计划
*/
schedulingPlan,
/**
* 大客流策略
*/
largePassengerStrategy,
/**
* 大客流视图
*/
largePassengerView,
/**
* 行调台
*/
dispatcherManage,
/**
* 派班工作站
*/
scheduleWork,
/**
* 应急调度
*/
emergency,
/**
* 运行图编制
*/
diagramEdit,
/**
* 运行图预览
*/
diagramPreview,
/**
* 运行图加载
*/
diagramLoad,
}
}