Merge branch 'test-training2' of https://git.code.tencent.com/lian-cbtc/rtss-server into test-training2

This commit is contained in:
weizhihong 2022-12-01 10:58:05 +08:00
commit 54599af87a
12 changed files with 441 additions and 204 deletions

View File

@ -2,14 +2,19 @@ package club.joylink.rtss.controller.publish;
import club.joylink.rtss.constants.RoleEnum; import club.joylink.rtss.constants.RoleEnum;
import club.joylink.rtss.controller.advice.Role; import club.joylink.rtss.controller.advice.Role;
import club.joylink.rtss.dao.MapDataDAO;
import club.joylink.rtss.dao.MapSystemDAO;
import club.joylink.rtss.services.IMapService;
import club.joylink.rtss.services.mapFunction.RtsMapFunctionService; import club.joylink.rtss.services.mapFunction.RtsMapFunctionService;
import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.mapFunction.*; import club.joylink.rtss.vo.client.mapFunction.*;
import club.joylink.rtss.vo.map.MapVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@ -90,4 +95,25 @@ public class MapFunctionController {
public RtsMapFunctionVO queryOne(@PathVariable Long id) { public RtsMapFunctionVO queryOne(@PathVariable Long id) {
return rtsMapFunctionService.get(id); return rtsMapFunctionService.get(id);
} }
@Autowired
private IMapService iMapService;
@Autowired
private MapSystemDAO mapSystemDAO;
@Autowired
private MapDataDAO mapDataDAO;
/**
* 旧数据处理用完删除
*/
@PostMapping("/oldDataHandle")
public List<String> oldDataHandle() {
List<MapVO> onlineMaps = iMapService.listOnline();
List<String> msgList = new ArrayList<>();
for (MapVO onlineMap : onlineMaps) {
List<String> list = rtsMapFunctionService.transferOldData(onlineMap.getId());
msgList.addAll(list);
}
return msgList;
}
} }

View File

@ -45,4 +45,6 @@ public interface RtsMapFunctionService {
* 批量删除地图下所有地图功能 * 批量删除地图下所有地图功能
*/ */
void batchDelete(long mapId); void batchDelete(long mapId);
List<String> transferOldData(Long mapId);
} }

View File

@ -1,6 +1,12 @@
package club.joylink.rtss.services.mapFunction; package club.joylink.rtss.services.mapFunction;
import club.joylink.rtss.constants.MapPrdTypeEnum;
import club.joylink.rtss.dao.MapDataDAO;
import club.joylink.rtss.dao.MapInfoDAO;
import club.joylink.rtss.dao.MapSystemDAO;
import club.joylink.rtss.dao.RtsMapFunctionDAO; import club.joylink.rtss.dao.RtsMapFunctionDAO;
import club.joylink.rtss.entity.MapSystem;
import club.joylink.rtss.entity.MapSystemExample;
import club.joylink.rtss.entity.RtsMapFunction; import club.joylink.rtss.entity.RtsMapFunction;
import club.joylink.rtss.entity.RtsMapFunctionExample; import club.joylink.rtss.entity.RtsMapFunctionExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
@ -16,10 +22,12 @@ import club.joylink.rtss.vo.map.MapVO;
import club.joylink.rtss.vo.map.graph.MapMemberVO; import club.joylink.rtss.vo.map.graph.MapMemberVO;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import org.jetbrains.annotations.Nullable;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -176,6 +184,118 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
rtsMapFunctionDAO.deleteByExample(rtsMapFunctionExample); rtsMapFunctionDAO.deleteByExample(rtsMapFunctionExample);
} }
@Autowired
private MapInfoDAO mapInfoDAO;
@Autowired
private MapSystemDAO mapSystemDAO;
@Autowired
private MapDataDAO mapDataDAO;
@Transactional
@Override
public List<String> transferOldData(Long mapId) {
List<String> msgList = new ArrayList<>();
MapVO mapDetail = iMapService.getMapDetail(mapId);
Set<String> systemNameSet = new HashSet<>();
Simulation.Type simType;
if (mapDetail.getConfigVO().isRailway()) {
simType = Simulation.Type.RAILWAY;
} else {
simType = Simulation.Type.METRO;
}
MapSystemExample mapSystemExample = new MapSystemExample();
mapSystemExample.createCriteria().andMapIdEqualTo(mapDetail.getId());
List<MapSystem> mapSystems = mapSystemDAO.selectByExample(mapSystemExample);
Map<Simulation.Type, List<MapMemberVO>> memberMap = mapDetail.getGraphDataNew().getMemberMap();
String prefixMsg = String.format("地图[id:%s]", mapDetail.getId());
if (CollectionUtils.isEmpty(memberMap)) {
msgList.add(String.format("%s无成员数据", prefixMsg));
return msgList;
}
List<MapMemberVO> mapMemberVOS = memberMap.get(simType);
if (CollectionUtils.isEmpty(mapMemberVOS)) {
msgList.add(String.format("%s无%s成员数据", prefixMsg, simType));
return msgList;
}
Optional<MapMemberVO> dispatcherOptional = mapMemberVOS.stream()
.filter(member -> Objects.equals(member.getType(), SimulationMember.Type.DISPATCHER))
.findFirst();
Optional<MapMemberVO> stationOptional = mapMemberVOS.stream()
.filter(member -> Objects.equals(member.getType(), SimulationMember.Type.STATION_SUPERVISOR))
.findFirst();
boolean hasTraining = false;
boolean hasExam = false;
for (MapSystem mapSystem : mapSystems) {
Supplier<RtsMapFunctionCreateVO> supplier;
if (mapSystem.getType().equals("Simulation")) {
MapPrdTypeEnum prdType = MapPrdTypeEnum.getMapPrdTypeEnumByCode(mapSystem.getPrdType());
switch (prdType) {
case LOCAL:
supplier = getStationFunctionSupplier(mapSystem.getMapId(), systemNameSet, msgList, prefixMsg, simType, stationOptional);
break;
case CENTER:
supplier = getDispatcherFunctionSupplier(mapId, systemNameSet, msgList, prefixMsg, simType, dispatcherOptional);
break;
case JOINT:
supplier = getJointFunctionSupplier(mapId, systemNameSet, msgList, prefixMsg, simType, dispatcherOptional);
break;
case DRIVER:
supplier = getDriverFunctionSupplier(mapId, systemNameSet, msgList, prefixMsg, simType, mapMemberVOS);
break;
case SCHEDULING:
supplier = getSchedulingFunctionSupplier(mapId, systemNameSet, msgList, prefixMsg, simType, dispatcherOptional);
break;
case ISCS:
supplier = () -> null;
break;
case BIG_SCREEN:
supplier = () -> null;
break;
case RUN_PLAN_MAKE:
supplier = getRunPlanDesignFunctionSupplier(mapId, systemNameSet, msgList, simType);
break;
case DEPOT_IL:
supplier = getDepotILFunctionSupplier(mapId, systemNameSet, msgList, prefixMsg, simType, mapMemberVOS);
break;
case YJDDZH:
supplier = getEmergencyFunctionSupplier(mapId, systemNameSet, msgList, Simulation.Type.EMERGENCY);
break;
default:
throw new RuntimeException();
}
RtsMapFunctionCreateVO rtsMapFunctionCreateVO = supplier.get();
if (rtsMapFunctionCreateVO != null) {
create(rtsMapFunctionCreateVO, 1);
}
} else if (mapSystem.getType().equals("Lesson")) {
if (!hasTraining) {
hasTraining = true;
RtsMapFunctionCreateVO rtsMapFunctionCreateVO = getSingleOperationTrainingFunctionSupplier(mapId, systemNameSet, msgList, simType).get();
if (rtsMapFunctionCreateVO != null) {
create(rtsMapFunctionCreateVO, 1);
}
}
} else if (mapSystem.getType().equals("Exam")) {
if (!hasExam) {
hasExam = true;
RtsMapFunctionCreateVO rtsMapFunctionCreateVO = getExamFunctionSupplier(mapId, systemNameSet, msgList, simType).get();
if (rtsMapFunctionCreateVO != null) {
create(rtsMapFunctionCreateVO, 1);
}
}
} else {
throw new RuntimeException();
}
}
return msgList;
}
private RtsMapFunctionCreateVO buildCreateVO(long mapId, String name, String desc, Simulation.Type simType, private RtsMapFunctionCreateVO buildCreateVO(long mapId, String name, String desc, Simulation.Type simType,
Map<SimulationWorkParamVO.Item, String> itemMap, SimulationWorkParamVO.DomConfigVO domConfig) { Map<SimulationWorkParamVO.Item, String> itemMap, SimulationWorkParamVO.DomConfigVO domConfig) {
RtsMapFunctionCreateVO createVO = new RtsMapFunctionCreateVO(); RtsMapFunctionCreateVO createVO = new RtsMapFunctionCreateVO();
@ -209,47 +329,120 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
Optional<MapMemberVO> stationSupervisorOptional = mapMemberVOS.stream() Optional<MapMemberVO> stationSupervisorOptional = mapMemberVOS.stream()
.filter(member -> Objects.equals(member.getType(), SimulationMember.Type.STATION_SUPERVISOR)) .filter(member -> Objects.equals(member.getType(), SimulationMember.Type.STATION_SUPERVISOR))
.findFirst(); .findFirst();
//ATS行调工作站 Supplier<RtsMapFunctionCreateVO> dispatchSystem = getDispatcherFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, dispatcherOptional);
Supplier<RtsMapFunctionCreateVO> dispatchSystem = () -> { Supplier<RtsMapFunctionCreateVO> stationSystem = getStationFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, stationSupervisorOptional);
String name = "行调仿真系统"; Supplier<RtsMapFunctionCreateVO> driveSystem = getDriverFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, mapMemberVOS);
Supplier<RtsMapFunctionCreateVO> dispatchTrainingSystem = getSingleOperationTrainingFunctionSupplier(mapId, systemNameSet, msgList, simType);
Supplier<RtsMapFunctionCreateVO> stationTrainingSystem = getSceneTrainingFunctionSupplier(mapId, systemNameSet, msgList, simType);
Supplier<RtsMapFunctionCreateVO> stationExamSystem = getExamFunctionSupplier(mapId, systemNameSet, msgList, simType);
Supplier<RtsMapFunctionCreateVO> joint = getJointFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, dispatcherOptional);
Supplier<RtsMapFunctionCreateVO> trainingDesign = getTrainingDesignFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, dispatcherOptional);
fillFunctions.add(dispatchSystem);
fillFunctions.add(stationSystem);
fillFunctions.add(driveSystem);
fillFunctions.add(dispatchTrainingSystem);
fillFunctions.add(stationTrainingSystem);
fillFunctions.add(stationExamSystem);
fillFunctions.add(joint);
fillFunctions.add(trainingDesign);
return fillFunctions;
}
private Supplier<RtsMapFunctionCreateVO> getTrainingDesignFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix, Simulation.Type simType, Optional<MapMemberVO> dispatcherOptional) {
//实训设计
return () -> {
String name = "实训设计";
if (systemNameSet.contains(name)) { if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name)); msgList.add(String.format("%s已存在不生成", name));
return null; return null;
} }
Map<SimulationWorkParamVO.Item, String> itemMap = null;
if (dispatcherOptional.isEmpty()) { if (dispatcherOptional.isEmpty()) {
msgList.add(String.format("%s无行调成员未生成%s", msgPrefix, name)); msgList.add(String.format("%s无行调成员未设置%s默认扮演成员", msgPrefix, name));
return null; } else {
itemMap = new HashMap<>();
itemMap.put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, dispatcherOptional.get().getId());
} }
SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder() SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder()
.singleMember(true) .trainingDesign(true)
.hasMemberManager(true) .hasMemberManager(true)
.build(); .build();
Map<SimulationWorkParamVO.Item, String> itemMap = new HashMap<>();
itemMap.put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, dispatcherOptional.get().getId());
return buildCreateVO(mapId, name, name, simType, itemMap, domConfig); return buildCreateVO(mapId, name, name, simType, itemMap, domConfig);
}; };
//ATS现地工作站 }
Supplier<RtsMapFunctionCreateVO> stationSystem = () -> {
String name = "行值仿真系统"; private Supplier<RtsMapFunctionCreateVO> getJointFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix, Simulation.Type simType, Optional<MapMemberVO> dispatcherOptional) {
//综合演练
return () -> {
String name = "综合演练";
if (systemNameSet.contains(name)) { if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name)); msgList.add(String.format("%s已存在不生成", name));
return null; return null;
} }
if (stationSupervisorOptional.isEmpty()) { Map<SimulationWorkParamVO.Item, String> itemMap = null;
msgList.add(String.format("%s无行值成员未生成%s", msgPrefix, name)); if (dispatcherOptional.isEmpty()) {
msgList.add(String.format("%s无行调成员未设置%s默认扮演成员", msgPrefix, name));
} else {
itemMap = new HashMap<>();
itemMap.put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, dispatcherOptional.get().getId());
}
SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder()
.isJoint(true)
.hasMemberManager(true)
.build();
return buildCreateVO(mapId, name, name, simType, itemMap, domConfig);
};
}
private Supplier<RtsMapFunctionCreateVO> getExamFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, Simulation.Type simType) {
return () -> {
String name = "考试";
if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name));
return null; return null;
} }
SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder() SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder()
.singleMember(true) .hasExam(true)
.build();
return buildCreateVO(mapId, name, name, simType, null, domConfig);
};
}
private Supplier<RtsMapFunctionCreateVO> getSceneTrainingFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, Simulation.Type simType) {
return () -> {
String name = "场景实训";
if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name));
return null;
}
SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder()
.hasTraining(true)
.hasMemberManager(true) .hasMemberManager(true)
.build(); .build();
Map<SimulationWorkParamVO.Item, String> itemMap = new HashMap<>(); return buildCreateVO(mapId, name, name, simType, null, domConfig);
itemMap.put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, stationSupervisorOptional.get().getId());
return buildCreateVO(mapId, name, name, simType, itemMap, domConfig);
}; };
//司机模拟驾驶系统 }
Supplier<RtsMapFunctionCreateVO> driveSystem = () -> {
String name = "司机仿真"; private Supplier<RtsMapFunctionCreateVO> getSingleOperationTrainingFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, Simulation.Type simType) {
return () -> {
String name = "单操实训";
if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name));
return null;
}
SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder()
.hasTraining(true)
.build();
return buildCreateVO(mapId, name, name, simType, null, domConfig);
};
}
private Supplier<RtsMapFunctionCreateVO> getDriverFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix,
Simulation.Type simType, List<MapMemberVO> mapMemberVOS) {
return () -> {
String name = "模拟驾驶";
if (systemNameSet.contains(name)) { if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name)); msgList.add(String.format("%s已存在不生成", name));
return null; return null;
@ -269,29 +462,13 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
itemMap.put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, memberOptional.get().getId()); itemMap.put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, memberOptional.get().getId());
return buildCreateVO(mapId, name, name, simType, itemMap, domConfig); return buildCreateVO(mapId, name, name, simType, itemMap, domConfig);
}; };
//ATS行调实训系统
Supplier<RtsMapFunctionCreateVO> dispatchTrainingSystem = () -> {
String name = "行调实训系统";
if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name));
return null;
} }
if (dispatcherOptional.isEmpty()) {
msgList.add(String.format("%s无行调成员未生成%s", msgPrefix, name)); private Supplier<RtsMapFunctionCreateVO> getStationFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix,
return null; Simulation.Type simType, Optional<MapMemberVO> stationSupervisorOptional) {
} //ATS现地工作站
SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder() return () -> {
.singleMember(true) String name = "车站仿真";
.hasTraining(true)
.hasMemberManager(true)
.build();
Map<SimulationWorkParamVO.Item, String> itemMap = new HashMap<>();
itemMap.put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, dispatcherOptional.get().getId());
return buildCreateVO(mapId, name, name, simType, itemMap, domConfig);
};
//ATS现地实训系统
Supplier<RtsMapFunctionCreateVO> stationTrainingSystem = () -> {
String name = "行值实训系统";
if (systemNameSet.contains(name)) { if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name)); msgList.add(String.format("%s已存在不生成", name));
return null; return null;
@ -302,16 +479,19 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
} }
SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder() SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder()
.singleMember(true) .singleMember(true)
.hasTraining(true)
.hasMemberManager(true) .hasMemberManager(true)
.build(); .build();
Map<SimulationWorkParamVO.Item, String> itemMap = new HashMap<>(); Map<SimulationWorkParamVO.Item, String> itemMap = new HashMap<>();
itemMap.put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, stationSupervisorOptional.get().getId()); itemMap.put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, stationSupervisorOptional.get().getId());
return buildCreateVO(mapId, name, name, simType, itemMap, domConfig); return buildCreateVO(mapId, name, name, simType, itemMap, domConfig);
}; };
//ATS行调考试系统 }
Supplier<RtsMapFunctionCreateVO> dispatchExamSystem = () -> {
String name = "行调考试系统"; private Supplier<RtsMapFunctionCreateVO> getDispatcherFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix,
Simulation.Type simType, Optional<MapMemberVO> dispatcherOptional) {
//ATS行调工作站
return () -> {
String name = "调度仿真";
if (systemNameSet.contains(name)) { if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name)); msgList.add(String.format("%s已存在不生成", name));
return null; return null;
@ -321,82 +501,13 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
return null; return null;
} }
SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder() SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder()
.hasExam(true) .singleMember(true)
.hasMemberManager(true)
.build(); .build();
Map<SimulationWorkParamVO.Item, String> itemMap = new HashMap<>(); Map<SimulationWorkParamVO.Item, String> itemMap = new HashMap<>();
itemMap.put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, dispatcherOptional.get().getId()); itemMap.put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, dispatcherOptional.get().getId());
return buildCreateVO(mapId, name, name, simType, itemMap, domConfig); return buildCreateVO(mapId, name, name, simType, itemMap, domConfig);
}; };
//ATS现地考试系统
Supplier<RtsMapFunctionCreateVO> stationExamSystem = () -> {
String name = "行值考试系统";
if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name));
return null;
}
if (stationSupervisorOptional.isEmpty()) {
msgList.add(String.format("%s无行值成员未生成%s", msgPrefix, name));
return null;
}
SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder()
.hasExam(true)
.build();
Map<SimulationWorkParamVO.Item, String> itemMap = new HashMap<>();
itemMap.put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, stationSupervisorOptional.get().getId());
return buildCreateVO(mapId, name, name, simType, itemMap, domConfig);
};
//综合演练
Supplier<RtsMapFunctionCreateVO> joint = () -> {
String name = "综合演练";
if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name));
return null;
}
Map<SimulationWorkParamVO.Item, String> itemMap = null;
if (dispatcherOptional.isEmpty()) {
msgList.add(String.format("%s无行调成员未设置%s默认扮演成员", msgPrefix, name));
} else {
itemMap = new HashMap<>();
itemMap.put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, dispatcherOptional.get().getId());
}
SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder()
.isJoint(true)
.hasMemberManager(true)
.build();
return buildCreateVO(mapId, name, name, simType, itemMap, domConfig);
};
//实训设计
Supplier<RtsMapFunctionCreateVO> trainingDesign = () -> {
String name = "实训设计";
if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name));
return null;
}
Map<SimulationWorkParamVO.Item, String> itemMap = null;
if (dispatcherOptional.isEmpty()) {
msgList.add(String.format("%s无行调成员未设置%s默认扮演成员", msgPrefix, name));
} else {
itemMap = new HashMap<>();
itemMap.put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, dispatcherOptional.get().getId());
}
SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder()
.trainingDesign(true)
.hasMemberManager(true)
.build();
return buildCreateVO(mapId, name, name, simType, itemMap, domConfig);
};
fillFunctions.add(dispatchSystem);
fillFunctions.add(stationSystem);
fillFunctions.add(driveSystem);
fillFunctions.add(dispatchTrainingSystem);
fillFunctions.add(stationTrainingSystem);
fillFunctions.add(dispatchExamSystem);
fillFunctions.add(stationExamSystem);
fillFunctions.add(joint);
fillFunctions.add(trainingDesign);
return fillFunctions;
} }
/** /**
@ -417,27 +528,29 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
Optional<MapMemberVO> stationSupervisorOptional = mapMemberVOS.stream() Optional<MapMemberVO> stationSupervisorOptional = mapMemberVOS.stream()
.filter(member -> Objects.equals(member.getType(), SimulationMember.Type.STATION_SUPERVISOR)) .filter(member -> Objects.equals(member.getType(), SimulationMember.Type.STATION_SUPERVISOR))
.findFirst(); .findFirst();
//调度台 Supplier<RtsMapFunctionCreateVO> dispatchSystem = getRailDispatcherFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, dispatcherOptional);
Supplier<RtsMapFunctionCreateVO> dispatchSystem = () -> { Supplier<RtsMapFunctionCreateVO> stationSystem = getRailStationFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, stationSupervisorOptional);
String name = "调度台"; Supplier<RtsMapFunctionCreateVO> singleOperationTrainingFunctionSupplier = getSingleOperationTrainingFunctionSupplier(mapId, systemNameSet, msgList, simType);
if (systemNameSet.contains(name)) { Supplier<RtsMapFunctionCreateVO> sceneTrainingFunctionSupplier = getSceneTrainingFunctionSupplier(mapId, systemNameSet, msgList, simType);
msgList.add(String.format("%s已存在不生成", name)); Supplier<RtsMapFunctionCreateVO> examFunctionSupplier = getExamFunctionSupplier(mapId, systemNameSet, msgList, simType);
return null; Supplier<RtsMapFunctionCreateVO> joint = getJointFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, dispatcherOptional);
Supplier<RtsMapFunctionCreateVO> trainingDesign = getTrainingDesignFunctionSupplier(mapId, systemNameSet, msgList, msgPrefix, simType, dispatcherOptional);
fillFunctions.add(dispatchSystem);
fillFunctions.add(stationSystem);
fillFunctions.add(singleOperationTrainingFunctionSupplier);
fillFunctions.add(sceneTrainingFunctionSupplier);
fillFunctions.add(examFunctionSupplier);
fillFunctions.add(joint);
fillFunctions.add(trainingDesign);
return fillFunctions;
} }
if (dispatcherOptional.isEmpty()) {
msgList.add(String.format("%s无行调成员未生成%s", msgPrefix, name)); private Supplier<RtsMapFunctionCreateVO> getRailStationFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix,
return null; Simulation.Type simType, Optional<MapMemberVO> stationSupervisorOptional) {
}
SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder()
.singleMember(true)
.hasMemberManager(true)
.build();
Map<SimulationWorkParamVO.Item, String> itemMap = new HashMap<>();
itemMap.put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, dispatcherOptional.get().getId());
return buildCreateVO(mapId, name, name, simType, itemMap, domConfig);
};
//车站 //车站
Supplier<RtsMapFunctionCreateVO> stationSystem = () -> { return () -> {
String name = "车站"; String name = "车站";
if (systemNameSet.contains(name)) { if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name)); msgList.add(String.format("%s已存在不生成", name));
@ -455,76 +568,147 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
itemMap.put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, stationSupervisorOptional.get().getId()); itemMap.put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, stationSupervisorOptional.get().getId());
return buildCreateVO(mapId, name, name, simType, itemMap, domConfig); return buildCreateVO(mapId, name, name, simType, itemMap, domConfig);
}; };
//综合演练 }
Supplier<RtsMapFunctionCreateVO> joint = () -> {
String name = "综合演练"; private Supplier<RtsMapFunctionCreateVO> getRailDispatcherFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix,
Simulation.Type simType, Optional<MapMemberVO> dispatcherOptional) {
//调度台
return () -> {
String name = "调度台";
if (systemNameSet.contains(name)) { if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name)); msgList.add(String.format("%s已存在不生成", name));
return null; return null;
} }
Map<SimulationWorkParamVO.Item, String> itemMap = null;
if (dispatcherOptional.isEmpty()) { if (dispatcherOptional.isEmpty()) {
msgList.add(String.format("%s无行调成员未设置%s默认扮演成员", msgPrefix, name)); msgList.add(String.format("%s无行调成员未生成%s", msgPrefix, name));
} else { return null;
itemMap = new HashMap<>();
itemMap.put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, dispatcherOptional.get().getId());
} }
SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder() SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder()
.isJoint(true) .singleMember(true)
.hasMemberManager(true) .hasMemberManager(true)
.build(); .build();
Map<SimulationWorkParamVO.Item, String> itemMap = new HashMap<>();
itemMap.put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, dispatcherOptional.get().getId());
return buildCreateVO(mapId, name, name, simType, itemMap, domConfig); return buildCreateVO(mapId, name, name, simType, itemMap, domConfig);
}; };
//实训设计 }
Supplier<RtsMapFunctionCreateVO> trainingDesign = () -> {
String name = "实训设计"; private Supplier<RtsMapFunctionCreateVO> getSchedulingFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix,
Simulation.Type simType, Optional<MapMemberVO> dispatcherOptional) {
return () -> {
String name = "派班";
if (systemNameSet.contains(name)) { if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name)); msgList.add(String.format("%s已存在不生成", name));
return null; return null;
} }
Map<SimulationWorkParamVO.Item, String> itemMap = null;
if (dispatcherOptional.isEmpty()) { if (dispatcherOptional.isEmpty()) {
msgList.add(String.format("%s无行调成员未设置%s默认扮演成员", msgPrefix, name)); msgList.add(String.format("%s无行调成员未生成%s", msgPrefix, name));
} else { return null;
itemMap = new HashMap<>();
itemMap.put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, dispatcherOptional.get().getId());
} }
SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder() SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder()
.trainingDesign(true) .singleClient(true)
.hasMemberManager(true) .client(Simulation.Client.SCHEDULING.name())
.build(); .build();
Map<SimulationWorkParamVO.Item, String> itemMap = new HashMap<>();
itemMap.put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, dispatcherOptional.get().getId());
return buildCreateVO(mapId, name, name, simType, itemMap, domConfig); return buildCreateVO(mapId, name, name, simType, itemMap, domConfig);
}; };
}
fillFunctions.add(dispatchSystem); private Supplier<RtsMapFunctionCreateVO> getIscsFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix,
fillFunctions.add(stationSystem); Simulation.Type simType, Optional<MapMemberVO> dispatcherOptional) {
fillFunctions.add(joint); return () -> {
fillFunctions.add(trainingDesign); String name = "综合监控";
if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name));
return null;
}
if (dispatcherOptional.isEmpty()) {
msgList.add(String.format("%s无行调成员未生成%s", msgPrefix, name));
return null;
}
SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder()
.singleClient(true)
.client(Simulation.Client.ISCS.name())
.build();
Map<SimulationWorkParamVO.Item, String> itemMap = new HashMap<>();
itemMap.put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, dispatcherOptional.get().getId());
return buildCreateVO(mapId, name, name, simType, itemMap, domConfig);
};
}
return fillFunctions; private Supplier<RtsMapFunctionCreateVO> getRunPlanDesignFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, Simulation.Type simType) {
return () -> {
String name = "运行图编制";
if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name));
return null;
}
SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder()
.singleClient(true)
.client(Simulation.Client.RUN_PLAN_DESIGN.name())
.build();
return buildCreateVO(mapId, name, name, simType, null, domConfig);
};
}
private Supplier<RtsMapFunctionCreateVO> getBigScreenFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, Simulation.Type simType) {
return () -> {
String name = "中心大屏";
if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name));
return null;
}
SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder()
.singleClient(true)
.client(Simulation.Client.C_ATS_BS.name())
.build();
return buildCreateVO(mapId, name, name, simType, null, domConfig);
};
}
private Supplier<RtsMapFunctionCreateVO> getDepotILFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, String msgPrefix,
Simulation.Type simType, List<MapMemberVO> mapMemberVOS) {
return () -> {
String name = "车辆段联锁";
if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name));
return null;
}
Optional<MapMemberVO> optional = mapMemberVOS.stream().filter(member -> SimulationMember.Type.DEPOT_DISPATCHER.equals(member.getType()))
.findFirst();
if (optional.isEmpty()) {
msgList.add(String.format("%s无车辆段行调成员未生成%s", msgPrefix, name));
return null;
}
SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder()
.build();
Map<SimulationWorkParamVO.Item, String> itemMap = new HashMap<>();
itemMap.put(SimulationWorkParamVO.Item.DEFAULT_MEMBER, optional.get().getId());
return buildCreateVO(mapId, name, name, simType, itemMap, domConfig);
};
} }
private List<Supplier<RtsMapFunctionCreateVO>> buildEmergencyFillCreateVOSuppliers(long mapId, Set<String> systemNameSet, private List<Supplier<RtsMapFunctionCreateVO>> buildEmergencyFillCreateVOSuppliers(long mapId, Set<String> systemNameSet,
List<String> msgList, String msgPrefix, List<String> msgList, String msgPrefix,
Simulation.Type simType, List<MapMemberVO> mapMemberVOS) { Simulation.Type simType, List<MapMemberVO> mapMemberVOS) {
List<Supplier<RtsMapFunctionCreateVO>> fillFunctions = new ArrayList<>(); List<Supplier<RtsMapFunctionCreateVO>> fillFunctions = new ArrayList<>();
// Optional<MapMemberVO> dispatcherOptional = mapMemberVOS.stream() Supplier<RtsMapFunctionCreateVO> system = getEmergencyFunctionSupplier(mapId, systemNameSet, msgList, simType);
// .filter(member -> Objects.equals(member.getType(), SimulationMember.Type.DISPATCHER))
// .findFirst(); fillFunctions.add(system);
// Optional<MapMemberVO> stationSupervisorOptional = mapMemberVOS.stream()
// .filter(member -> Objects.equals(member.getType(), SimulationMember.Type.STATION_SUPERVISOR)) return fillFunctions;
// .findFirst(); }
@Nullable
private Supplier<RtsMapFunctionCreateVO> getEmergencyFunctionSupplier(long mapId, Set<String> systemNameSet, List<String> msgList, Simulation.Type simType) {
//应急调度指挥系统 //应急调度指挥系统
Supplier<RtsMapFunctionCreateVO> system = () -> { Supplier<RtsMapFunctionCreateVO> system = () -> {
String name = "应急调度指挥系统"; String name = "应急调度指挥仿真";
if (systemNameSet.contains(name)) { if (systemNameSet.contains(name)) {
msgList.add(String.format("%s已存在不生成", name)); msgList.add(String.format("%s已存在不生成", name));
return null; return null;
} }
// if (dispatcherOptional.isEmpty()) {
// msgList.add(String.format("%s无行调成员未生成%s", msgPrefix, name));
// return null;
// }
SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder() SimulationWorkParamVO.DomConfigVO domConfig = SimulationWorkParamVO.DomConfigVO.builder()
.singleClient(true) .singleClient(true)
.client(SimulationWorkParamVO.DomConfigVO.EMERGENCY) .client(SimulationWorkParamVO.DomConfigVO.EMERGENCY)
@ -532,10 +716,7 @@ public class RtsMapFunctionServiceImpl implements RtsMapFunctionService {
Map<SimulationWorkParamVO.Item, String> itemMap = new HashMap<>(); Map<SimulationWorkParamVO.Item, String> itemMap = new HashMap<>();
return buildCreateVO(mapId, name, name, simType, itemMap, domConfig); return buildCreateVO(mapId, name, name, simType, itemMap, domConfig);
}; };
return system;
fillFunctions.add(system);
return fillFunctions;
} }
private Optional<RtsMapFunction> findEntityOptional(long id) { private Optional<RtsMapFunction> findEntityOptional(long id) {

View File

@ -459,6 +459,9 @@ public abstract class Simulation<U extends SimulationUser, M extends SimulationM
public void addSimulationUser(U user) { public void addSimulationUser(U user) {
if (this.simulationUserMap.isEmpty()) { if (this.simulationUserMap.isEmpty()) {
user.creator = true; user.creator = true;
user.setType(SimulationUser.Type.TEACHER);
} else {
user.setType(SimulationUser.Type.STUDENT);
} }
this.simulationUserMap.put(user.getId(), user); this.simulationUserMap.put(user.getId(), user);
} }

View File

@ -2,6 +2,8 @@ package club.joylink.rtss.simulation;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.vo.SimulationUserVO; import club.joylink.rtss.simulation.vo.SimulationUserVO;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import java.util.HashSet; import java.util.HashSet;
@ -17,6 +19,13 @@ public abstract class SimulationUser {
private String id; private String id;
private String name; private String name;
boolean creator; boolean creator;
/**
* 仿真用户类型
*/
@Getter
@Setter
private Type type;
/** /**
* 用户仿真消息订阅 * 用户仿真消息订阅
* key-wsSessionId * key-wsSessionId
@ -109,4 +118,9 @@ public abstract class SimulationUser {
} }
protected abstract SimulationUserVO buildVO(); protected abstract SimulationUserVO buildVO();
public enum Type {
TEACHER,
STUDENT,
}
} }

View File

@ -271,7 +271,7 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation<Simulati
public boolean isAdmin(AccountVO user) { public boolean isAdmin(AccountVO user) {
SimulationUser simulationUser = this.querySimulationUserById(user.getId().toString()); SimulationUser simulationUser = this.querySimulationUserById(user.getId().toString());
if (Objects.nonNull(simulationUser) && simulationUser.isAdmin()) { if (Objects.nonNull(simulationUser) && simulationUser.isTeacher()) {
return true; return true;
} }
return false; return false;
@ -649,7 +649,7 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation<Simulati
public SimulationUser getAdmin() { public SimulationUser getAdmin() {
for (SimulationUser simulationUser : getSimulationUsers()) { for (SimulationUser simulationUser : getSimulationUsers()) {
if (simulationUser.isAdmin()) { if (simulationUser.isTeacher()) {
return simulationUser; return simulationUser;
} }
} }
@ -770,6 +770,8 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation<Simulati
C_CCTV, C_CCTV,
/** 综合监控 */ /** 综合监控 */
ISCS, ISCS,
/** 派班工作站 */
SCHEDULING,
/** 现地ATS工作站 */ /** 现地ATS工作站 */
L_ATS, L_ATS,

View File

@ -22,11 +22,6 @@ public class SimulationUser extends club.joylink.rtss.simulation.SimulationUser
*/ */
private ProjectDeviceVO projectDevice; private ProjectDeviceVO projectDevice;
/**
* 是否管理员
*/
private boolean admin;
/** /**
* 是否裁判 * 是否裁判
*/ */
@ -50,9 +45,6 @@ public class SimulationUser extends club.joylink.rtss.simulation.SimulationUser
if (Client.Referee.equals(loginUserInfoVO.getClient())) { if (Client.Referee.equals(loginUserInfoVO.getClient())) {
this.referee = true; this.referee = true;
} }
if (Objects.equals(simulation.getBuildParams().getUser(), loginUserInfoVO.getAccountVO())) {
this.admin = true;
}
} }
public SimulationUser(Simulation simulation, AccountVO user) { public SimulationUser(Simulation simulation, AccountVO user) {
@ -115,4 +107,8 @@ public class SimulationUser extends club.joylink.rtss.simulation.SimulationUser
protected SimulationUserVO buildVO() { protected SimulationUserVO buildVO() {
return null; return null;
} }
public boolean isTeacher() {
return Type.TEACHER.equals(getType());
}
} }

View File

@ -19,7 +19,8 @@ public enum SimulationSubscribeTopic {
Ctc("/queue/simulation/{id}/ctc"), //大铁CTC Ctc("/queue/simulation/{id}/ctc"), //大铁CTC
Room("/queue/room/{id}"), Room("/queue/room/{id}"),
Wgu3d("/topic/simulation/wgu3d/{id}"), Wgu3d("/topic/simulation/wgu3d/{id}"),
YJDDZH_TRAIN_POSITION("/topic/yjddzh/trainPosition/simulation/{id}") YJDDZH_TRAIN_POSITION("/topic/yjddzh/trainPosition/simulation/{id}"),
RUN_FACT("/queue/simulation/{id}/runFact")
; ;
private String destPattern; private String destPattern;

View File

@ -118,6 +118,16 @@ public class SimulationUserWsListener {
ctcLogicLoop.sendMessageWhenSubscribeCtc(simulation, userId); ctcLogicLoop.sendMessageWhenSubscribeCtc(simulation, userId);
break; break;
} }
case RUN_FACT: {
// 将当前所有列车实际运行数据同步给用户
List<RealRun> realRunRecordList = simulation.getRepository().getRealRunRecordList();
if (!CollectionUtils.isEmpty(realRunRecordList)) {
SocketMessageVO allTrainRealRunRecord =
SocketMessageFactory.build(WebSocketMessageType.Simulation_RunFact,
simulation.getId(), realRunRecordList);
this.stompMessageService.sendToUser(userId, allTrainRealRunRecord);
}
}
// case Room: // case Room:
// break; // break;
// case Wgu3d: // case Wgu3d:
@ -133,14 +143,6 @@ public class SimulationUserWsListener {
private void handleSubscribeSimulationMain(club.joylink.rtss.simulation.cbtc.Simulation simulation, SimulationUser simulationUser) { private void handleSubscribeSimulationMain(club.joylink.rtss.simulation.cbtc.Simulation simulation, SimulationUser simulationUser) {
String group = simulation.getId(); String group = simulation.getId();
String userId = simulationUser.getId(); String userId = simulationUser.getId();
// 将当前所有列车实际运行数据同步给用户
List<RealRun> realRunRecordList = simulation.getRepository().getRealRunRecordList();
if (!CollectionUtils.isEmpty(realRunRecordList)) {
SocketMessageVO allTrainRealRunRecord =
SocketMessageFactory.build(WebSocketMessageType.Simulation_RunFact,
group, realRunRecordList);
this.stompMessageService.sendToUser(userId, allTrainRealRunRecord);
}
// 将车次计划变化信息同步给用户 // 将车次计划变化信息同步给用户
List<RunPlanTripVO> changeTrips = simulation.getRepository().getChangeTrips(); List<RunPlanTripVO> changeTrips = simulation.getRepository().getChangeTrips();
if (!CollectionUtils.isEmpty(changeTrips)) { if (!CollectionUtils.isEmpty(changeTrips)) {

View File

@ -14,6 +14,7 @@ public class SimulationUserVO {
private String id; private String id;
private String name; private String name;
private int creator; private int creator;
private SimulationUser.Type type;
/** /**
* 用户仿真消息订阅 * 用户仿真消息订阅
* key-wsSessionId * key-wsSessionId
@ -27,6 +28,7 @@ public class SimulationUserVO {
this.id = user.getId(); this.id = user.getId();
this.name = user.getName(); this.name = user.getName();
this.creator = convert(user.isCreator()); this.creator = convert(user.isCreator());
this.type = user.getType();
this.wsSubscribeMap = user.getSubscribeMap(); this.wsSubscribeMap = user.getSubscribeMap();
this.memberId = user.getMemberId(); this.memberId = user.getMemberId();
} }

View File

@ -77,6 +77,10 @@ public class SocketMessageFactory {
topicList.add(WebSocketSubscribeTopic.Common); topicList.add(WebSocketSubscribeTopic.Common);
break; break;
} }
case Simulation_RunFact: {
topicList.add(SimulationSubscribeTopic.RUN_FACT.buildDestination(group));
break;
}
case Simulation_Time_Sync: case Simulation_Time_Sync:
case SIMULATION_WORK_PARAM: case SIMULATION_WORK_PARAM:
case Simulation_User: case Simulation_User:
@ -86,7 +90,6 @@ public class SocketMessageFactory {
case Simulation_AutoFault_Trigger: case Simulation_AutoFault_Trigger:
case Simulation_Error: case Simulation_Error:
case Simulation_RunAsPlan_Start: case Simulation_RunAsPlan_Start:
case Simulation_RunFact:
case Simulation_ApplyHandle: case Simulation_ApplyHandle:
case Simulation_Control_Pause: case Simulation_Control_Pause:
case Simulation_Run_Plan_Reload: case Simulation_Run_Plan_Reload:

View File

@ -24,10 +24,10 @@ public class SimulationUserVO {
private ProjectDeviceVO deviceVO; private ProjectDeviceVO deviceVO;
/** // /**
* 是否管理员 // * 是否管理员
*/ // */
private boolean admin; // private boolean admin;
/** /**
* 是否裁判 * 是否裁判
@ -54,11 +54,15 @@ public class SimulationUserVO {
*/ */
private String deviceCode; private String deviceCode;
/**
* 仿真用户类型
*/
private club.joylink.rtss.simulation.SimulationUser.Type userType;
public SimulationUserVO(SimulationUser simulationUser) { public SimulationUserVO(SimulationUser simulationUser) {
this.userId = simulationUser.getUser().getId(); this.userId = simulationUser.getUser().getId();
this.nickName = simulationUser.getUser().getNickname(); this.nickName = simulationUser.getUser().getNickname();
this.deviceVO = simulationUser.getProjectDevice(); this.deviceVO = simulationUser.getProjectDevice();
this.admin = simulationUser.isAdmin();
this.referee = simulationUser.isReferee(); this.referee = simulationUser.isReferee();
this.online = simulationUser.isOnline(); this.online = simulationUser.isOnline();
if (Objects.nonNull(simulationUser.getPlayedMember())) { if (Objects.nonNull(simulationUser.getPlayedMember())) {
@ -68,6 +72,7 @@ public class SimulationUserVO {
this.deviceCode = simulationUser.getPlayedMember().getDevice().getCode(); this.deviceCode = simulationUser.getPlayedMember().getDevice().getCode();
} }
} }
this.userType = simulationUser.getType();
} }
public static List<SimulationUserVO> convert2VOList(List<SimulationUser> list) { public static List<SimulationUserVO> convert2VOList(List<SimulationUser> list) {