新仿真结构完善中

This commit is contained in:
joylink_zhangsai 2022-10-14 14:57:30 +08:00
parent 820ea94b26
commit b50d1ead24
31 changed files with 465 additions and 345 deletions

View File

@ -11,17 +11,17 @@
Target Server Version : 50727
File Encoding : 65001
Date: 10/10/2022 13:24:17
Date: 12/10/2022 16:44:21
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for map_system_new
-- Table structure for rts_map_system
-- ----------------------------
DROP TABLE IF EXISTS `map_system_new`;
CREATE TABLE `map_system_new` (
DROP TABLE IF EXISTS `rts_map_system`;
CREATE TABLE `rts_map_system` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`map_id` bigint(20) NOT NULL COMMENT '地图id',
`name` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '名称',
@ -34,6 +34,6 @@ CREATE TABLE `map_system_new` (
`updater_id` bigint(20) NULL DEFAULT NULL COMMENT '更新人id',
`update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;

View File

@ -6,6 +6,7 @@ import club.joylink.rtss.controller.advice.Role;
import club.joylink.rtss.services.IMapService;
import club.joylink.rtss.services.IReleaseService;
import club.joylink.rtss.services.local.LocalDataService;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.*;
@ -14,10 +15,7 @@ import club.joylink.rtss.vo.client.map.MapCopyOption;
import club.joylink.rtss.vo.client.map.MapInfoUpdateVO;
import club.joylink.rtss.vo.client.validGroup.MapInfoSortCheck;
import club.joylink.rtss.vo.map.*;
import club.joylink.rtss.vo.map.graph.MapPSDVO;
import club.joylink.rtss.vo.map.graph.MapSectionNewVO;
import club.joylink.rtss.vo.map.graph.MapStationNewVO;
import club.joylink.rtss.vo.map.graph.MapStationStandNewVO;
import club.joylink.rtss.vo.map.graph.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -25,6 +23,7 @@ import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;
/**
*发布地图管理接口
@ -398,4 +397,20 @@ public class MapController {
public List<MapSectionNewVO> querySectionsUnderMap(@PathVariable Long id) {
return iMapService.querySectionsUnderMap(id);
}
/**
* 查询地图下所有列车
*/
@GetMapping("/{id}/trains")
public List<MapTrainVO> queryTrains(@PathVariable long id) {
return iMapService.queryTrains(id);
}
/**
* 查询地图成员Map
*/
@GetMapping("/{id}/memberMap")
public Map<Simulation.Type, List<MapMemberVO>> queryMemberMap(@PathVariable long id) {
return iMapService.queryMemberMap(id);
}
}

View File

@ -4,15 +4,15 @@ import club.joylink.rtss.constants.RoleEnum;
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
import club.joylink.rtss.controller.advice.Role;
import club.joylink.rtss.services.IMapSystemService;
import club.joylink.rtss.services.mapSystem.MapSystemNewService;
import club.joylink.rtss.services.mapSystem.RtsMapSystemService;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.TreeNode;
import club.joylink.rtss.vo.client.mapSystem.MapSystemCreateVO;
import club.joylink.rtss.vo.client.mapSystem.MapSystemNewQueryVO;
import club.joylink.rtss.vo.client.mapSystem.MapSystemNewVO;
import club.joylink.rtss.vo.client.mapSystem.MapSystemUpdateVO;
import club.joylink.rtss.vo.client.mapSystem.RtsMapSystemQueryVO;
import club.joylink.rtss.vo.client.mapSystem.RtsMapSystemVO;
import club.joylink.rtss.vo.client.sub.MapSystemDetailVO;
import club.joylink.rtss.vo.client.sub.MapSystemQueryVO;
import club.joylink.rtss.vo.client.sub.MapSystemVO;
@ -33,7 +33,7 @@ public class MapSystemController {
private IMapSystemService iMapSystemService;
@Autowired
private MapSystemNewService mapSystemNewService;
private RtsMapSystemService rtsMapSystemService;
/**
*生成地图系统
@ -119,23 +119,23 @@ public class MapSystemController {
@Role(RoleEnum.Admin)
@PostMapping("/new")
public void create(@RequestBody MapSystemCreateVO createVO, @RequestAttribute LoginUserInfoVO loginInfo) {
mapSystemNewService.create(createVO, loginInfo.getAccountVO().getId());
rtsMapSystemService.create(createVO, loginInfo.getAccountVO().getId());
}
/**
* 列表查询地图系统
*/
@GetMapping("/new/list")
public List<MapSystemNewVO> listQuery(MapSystemNewQueryVO queryVO) {
return mapSystemNewService.listQuery(queryVO);
public List<RtsMapSystemVO> listQuery(RtsMapSystemQueryVO queryVO) {
return rtsMapSystemService.listQuery(queryVO);
}
/**
* 分页查询地图系统
*/
@GetMapping("/new/paged")
public PageVO<MapSystemNewVO> pagedQuery(MapSystemNewQueryVO queryVO) {
return mapSystemNewService.pagedQuery(queryVO);
public PageVO<RtsMapSystemVO> pagedQuery(RtsMapSystemQueryVO queryVO) {
return rtsMapSystemService.pagedQuery(queryVO);
}
/**
@ -144,7 +144,7 @@ public class MapSystemController {
@Role(RoleEnum.Admin)
@DeleteMapping("/new/{id}")
public void delete(@PathVariable long id) {
mapSystemNewService.delete(id);
rtsMapSystemService.delete(id);
}
/**
@ -153,6 +153,6 @@ public class MapSystemController {
@Role(RoleEnum.Admin)
@PostMapping("/new/{id}")
public void update(@PathVariable long id, @RequestBody MapSystemUpdateVO updateVO, @RequestAttribute LoginUserInfoVO loginInfo) {
mapSystemNewService.update(id, updateVO, loginInfo.getAccountVO().getId());
rtsMapSystemService.update(id, updateVO, loginInfo.getAccountVO().getId());
}
}

View File

@ -488,24 +488,6 @@ public class SimulationV1Controller {
return simulationService.createSimulation(loginUserInfoVO, paramVO);
}
/**
* 给仿真添加功能
*/
@PostMapping("/new/{simulationId}/addFunctions")
public void addFunctions(@PathVariable String simulationId, @RequestBody LinkedHashMap<Simulation.Function, Map<String, Object>> functionMap,
@RequestAttribute LoginUserInfoVO loginInfo) {
simulationService.addFunctions(simulationId, functionMap, loginInfo);
}
/**
* 从仿真中移除功能
*/
@PostMapping("/new/{simulationId}/removeFunctions")
public void removeFunctions(@PathVariable String simulationId, @RequestBody List<Simulation.Function> functions,
@RequestAttribute LoginUserInfoVO loginInfo) {
simulationService.removeFunctions(simulationId, functions, loginInfo);
}
/**
* 按计划行车
*/

View File

@ -1,39 +0,0 @@
package club.joylink.rtss.dao;
import club.joylink.rtss.entity.MapSystemNew;
import club.joylink.rtss.entity.MapSystemNewExample;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface MapSystemNewDAO {
long countByExample(MapSystemNewExample example);
int deleteByExample(MapSystemNewExample example);
int deleteByPrimaryKey(Long id);
int insert(MapSystemNew record);
int insertSelective(MapSystemNew record);
List<MapSystemNew> selectByExampleWithBLOBs(MapSystemNewExample example);
List<MapSystemNew> selectByExample(MapSystemNewExample example);
MapSystemNew selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") MapSystemNew record, @Param("example") MapSystemNewExample example);
int updateByExampleWithBLOBs(@Param("record") MapSystemNew record, @Param("example") MapSystemNewExample example);
int updateByExample(@Param("record") MapSystemNew record, @Param("example") MapSystemNewExample example);
int updateByPrimaryKeySelective(MapSystemNew record);
int updateByPrimaryKeyWithBLOBs(MapSystemNew record);
int updateByPrimaryKey(MapSystemNew record);
}

View File

@ -0,0 +1,39 @@
package club.joylink.rtss.dao;
import club.joylink.rtss.entity.RtsMapSystem;
import club.joylink.rtss.entity.RtsMapSystemExample;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface RtsMapSystemDAO {
long countByExample(RtsMapSystemExample example);
int deleteByExample(RtsMapSystemExample example);
int deleteByPrimaryKey(Long id);
int insert(RtsMapSystem record);
int insertSelective(RtsMapSystem record);
List<RtsMapSystem> selectByExampleWithBLOBs(RtsMapSystemExample example);
List<RtsMapSystem> selectByExample(RtsMapSystemExample example);
RtsMapSystem selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") RtsMapSystem record, @Param("example") RtsMapSystemExample example);
int updateByExampleWithBLOBs(@Param("record") RtsMapSystem record, @Param("example") RtsMapSystemExample example);
int updateByExample(@Param("record") RtsMapSystem record, @Param("example") RtsMapSystemExample example);
int updateByPrimaryKeySelective(RtsMapSystem record);
int updateByPrimaryKeyWithBLOBs(RtsMapSystem record);
int updateByPrimaryKey(RtsMapSystem record);
}

View File

@ -4,10 +4,10 @@ import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @author
*
* @author
*
*/
public class MapSystemNew implements Serializable {
public class RtsMapSystem implements Serializable {
private Long id;
/**
@ -161,7 +161,7 @@ public class MapSystemNew implements Serializable {
if (getClass() != that.getClass()) {
return false;
}
MapSystemNew other = (MapSystemNew) that;
RtsMapSystem other = (RtsMapSystem) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getMapId() == null ? other.getMapId() == null : this.getMapId().equals(other.getMapId()))
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
@ -214,4 +214,4 @@ public class MapSystemNew implements Serializable {
sb.append("]");
return sb.toString();
}
}
}

View File

@ -4,7 +4,7 @@ import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
public class MapSystemNewExample {
public class RtsMapSystemExample {
protected String orderByClause;
protected boolean distinct;
@ -15,7 +15,9 @@ public class MapSystemNewExample {
private Long offset;
public MapSystemNewExample() {
private Boolean forUpdate;
public RtsMapSystemExample() {
oredCriteria = new ArrayList<Criteria>();
}
@ -84,6 +86,14 @@ public class MapSystemNewExample {
return offset;
}
public void setForUpdate(Boolean forUpdate) {
this.forUpdate = forUpdate;
}
public Boolean getForUpdate() {
return forUpdate;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
@ -860,4 +870,4 @@ public class MapSystemNewExample {
this(condition, value, secondValue, null);
}
}
}
}

View File

@ -1,5 +1,6 @@
package club.joylink.rtss.services;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.DictionaryDetailVO;
@ -13,12 +14,10 @@ import club.joylink.rtss.vo.map.Map3dDataVO;
import club.joylink.rtss.vo.map.MapUpdateVO;
import club.joylink.rtss.vo.map.MapVO;
import club.joylink.rtss.vo.map.MapVersionVO;
import club.joylink.rtss.vo.map.graph.MapPSDVO;
import club.joylink.rtss.vo.map.graph.MapSectionNewVO;
import club.joylink.rtss.vo.map.graph.MapStationNewVO;
import club.joylink.rtss.vo.map.graph.MapStationStandNewVO;
import club.joylink.rtss.vo.map.graph.*;
import java.util.List;
import java.util.Map;
public interface IMapService {
@ -348,4 +347,14 @@ public interface IMapService {
* @return
*/
List<MapVO> doSimulationCheckAll(LoginUserInfoVO userInfo);
/**
* 查询地图下所有列车
*/
List<MapTrainVO> queryTrains(long mapId);
/**
* 查询地图成员Map
*/
Map<Simulation.Type, List<MapMemberVO>> queryMemberMap(long mapId);
}

View File

@ -34,10 +34,7 @@ import club.joylink.rtss.vo.client.runplan.RunPlanVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingVO;
import club.joylink.rtss.vo.client.schedulingNew.SchedulingPlanNewVO;
import club.joylink.rtss.vo.map.*;
import club.joylink.rtss.vo.map.graph.MapPSDVO;
import club.joylink.rtss.vo.map.graph.MapSectionNewVO;
import club.joylink.rtss.vo.map.graph.MapStationNewVO;
import club.joylink.rtss.vo.map.graph.MapStationStandNewVO;
import club.joylink.rtss.vo.map.graph.*;
import club.joylink.rtss.vo.map.logic.MapRoutingDataVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
@ -858,6 +855,20 @@ public class MapService implements IMapService {
return errorMaps;
}
@Override
public List<MapTrainVO> queryTrains(long mapId) {
MapVO mapDetail = getMapDetail(mapId);
List<MapTrainVO> trainList = mapDetail.getGraphDataNew().getTrainList();
return trainList == null ? new ArrayList<>() : trainList;
}
@Override
public Map<Simulation.Type, List<MapMemberVO>> queryMemberMap(long mapId) {
MapVO mapDetail = getMapDetail(mapId);
Map<Simulation.Type, List<MapMemberVO>> memberMap = mapDetail.getGraphDataNew().getMemberMap();
return memberMap == null ? new HashMap<>() : memberMap;
}
/**
* 该版本的地图数据是否存在
*/

View File

@ -2,20 +2,20 @@ package club.joylink.rtss.services.mapSystem;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.mapSystem.MapSystemCreateVO;
import club.joylink.rtss.vo.client.mapSystem.MapSystemNewQueryVO;
import club.joylink.rtss.vo.client.mapSystem.MapSystemNewVO;
import club.joylink.rtss.vo.client.mapSystem.MapSystemUpdateVO;
import club.joylink.rtss.vo.client.mapSystem.RtsMapSystemQueryVO;
import club.joylink.rtss.vo.client.mapSystem.RtsMapSystemVO;
import java.util.List;
public interface MapSystemNewService {
public interface RtsMapSystemService {
void create(MapSystemCreateVO createVO, long creatorId);
void delete(long id);
void update(long id, MapSystemUpdateVO updateVO, long updaterId);
List<MapSystemNewVO> listQuery(MapSystemNewQueryVO queryVO);
List<RtsMapSystemVO> listQuery(RtsMapSystemQueryVO queryVO);
PageVO<MapSystemNewVO> pagedQuery(MapSystemNewQueryVO queryVO);
PageVO<RtsMapSystemVO> pagedQuery(RtsMapSystemQueryVO queryVO);
}

View File

@ -1,14 +1,14 @@
package club.joylink.rtss.services.mapSystem;
import club.joylink.rtss.dao.MapSystemNewDAO;
import club.joylink.rtss.entity.MapSystemNew;
import club.joylink.rtss.entity.MapSystemNewExample;
import club.joylink.rtss.dao.RtsMapSystemDAO;
import club.joylink.rtss.entity.RtsMapSystem;
import club.joylink.rtss.entity.RtsMapSystemExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.mapSystem.MapSystemCreateVO;
import club.joylink.rtss.vo.client.mapSystem.MapSystemNewQueryVO;
import club.joylink.rtss.vo.client.mapSystem.MapSystemNewVO;
import club.joylink.rtss.vo.client.mapSystem.MapSystemUpdateVO;
import club.joylink.rtss.vo.client.mapSystem.RtsMapSystemQueryVO;
import club.joylink.rtss.vo.client.mapSystem.RtsMapSystemVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
@ -21,37 +21,37 @@ import java.util.Optional;
import java.util.stream.Collectors;
@Service
public class MapSystemNewServiceImpl implements MapSystemNewService {
public class RtsMapSystemServiceImpl implements RtsMapSystemService {
@Autowired
private MapSystemNewDAO mapSystemNewDAO;
private RtsMapSystemDAO rtsMapSystemDAO;
@Override
public void create(MapSystemCreateVO createVO, long creatorId) {
confirmNameNotExist(createVO.getMapId(), createVO.getName());
MapSystemNew entity = createVO.convert2DB();
RtsMapSystem entity = createVO.convert2DB();
entity.setCreatorId(creatorId);
entity.setCreateTime(LocalDateTime.now());
mapSystemNewDAO.insert(entity);
rtsMapSystemDAO.insert(entity);
}
@Override
public void delete(long id) {
mapSystemNewDAO.deleteByPrimaryKey(id);
rtsMapSystemDAO.deleteByPrimaryKey(id);
}
@Override
public void update(long id, MapSystemUpdateVO updateVO, long updaterId) {
MapSystemNew entity = getEntity(id);
RtsMapSystem entity = getEntity(id);
updateVO.override(entity);
entity.setUpdaterId(updaterId);
entity.setUpdateTime(LocalDateTime.now());
mapSystemNewDAO.updateByPrimaryKeyWithBLOBs(entity);
rtsMapSystemDAO.updateByPrimaryKeyWithBLOBs(entity);
}
@Override
public List<MapSystemNewVO> listQuery(MapSystemNewQueryVO queryVO) {
MapSystemNewExample example = new MapSystemNewExample();
MapSystemNewExample.Criteria criteria = example.createCriteria();
public List<RtsMapSystemVO> listQuery(RtsMapSystemQueryVO queryVO) {
RtsMapSystemExample example = new RtsMapSystemExample();
RtsMapSystemExample.Criteria criteria = example.createCriteria();
if (queryVO.getMapId() != null)
criteria.andMapIdEqualTo(queryVO.getMapId());
if (StringUtils.hasText(queryVO.getName()))
@ -60,24 +60,24 @@ public class MapSystemNewServiceImpl implements MapSystemNewService {
criteria.andTypeEqualTo(queryVO.getSimType().name());
if (queryVO.getSimUsage() != null)
criteria.andUsageEqualTo(queryVO.getSimUsage().name());
List<MapSystemNew> entities = mapSystemNewDAO.selectByExampleWithBLOBs(example);
return entities.stream().map(MapSystemNewVO::new).collect(Collectors.toList());
List<RtsMapSystem> entities = rtsMapSystemDAO.selectByExampleWithBLOBs(example);
return entities.stream().map(RtsMapSystemVO::new).collect(Collectors.toList());
}
@Override
public PageVO<MapSystemNewVO> pagedQuery(MapSystemNewQueryVO queryVO) {
public PageVO<RtsMapSystemVO> pagedQuery(RtsMapSystemQueryVO queryVO) {
Page<Object> page = PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
List<MapSystemNewVO> list = listQuery(queryVO);
List<RtsMapSystemVO> list = listQuery(queryVO);
return PageVO.convert(page, list);
}
private Optional<MapSystemNew> findEntityOptional(long id) {
MapSystemNew entity = mapSystemNewDAO.selectByPrimaryKey(id);
private Optional<RtsMapSystem> findEntityOptional(long id) {
RtsMapSystem entity = rtsMapSystemDAO.selectByPrimaryKey(id);
return Optional.ofNullable(entity);
}
private MapSystemNew getEntity(long id) {
Optional<MapSystemNew> optional = findEntityOptional(id);
private RtsMapSystem getEntity(long id) {
Optional<RtsMapSystem> optional = findEntityOptional(id);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(optional.isPresent(), String.format("[id:%s]的系统不存在", id));
return optional.get();
}
@ -86,9 +86,9 @@ public class MapSystemNewServiceImpl implements MapSystemNewService {
* 确认系统不存在
*/
private void confirmNameNotExist(long mapId, String name) {
MapSystemNewExample example = new MapSystemNewExample();
RtsMapSystemExample example = new RtsMapSystemExample();
example.createCriteria().andMapIdEqualTo(mapId).andNameEqualTo(name);
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(mapSystemNewDAO.countByExample(example) < 1,
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(rtsMapSystemDAO.countByExample(example) < 1,
String.format("名称[%s]的系统已存在", name));
}
}

View File

@ -770,12 +770,36 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation<Simulati
EXAM,
}
/**
* 客户端/终端
*/
public enum Client {
/** 联锁 */
INTERLOCK,
/** 大屏 */
BIG_SCREEN,
/** 综合监控 */
ISCS,
/** 中心ATS工作站 */
C_ATS,
/** 中心ATS大屏百度到的资料里使用了“中央级ATS大屏幕显示器”的命名*/
C_ATS_BS,
/** 中心PA系统行调共用 */
C_PA,
/** 中心视频监控系统 */
C_CCTV,
/** 现地ATS工作站 */
L_ATS,
/** 本地控制工作站Local Control Workstation */
LCW,
/** 现地PA系统 */
L_PA,
/** 现地视频监控系统 */
L_CCTV,
/** 调度台终端(含 WintgTerm、LayoutTerm、DcmdTerm、TSRTerm、C3Term、ShuntTerm来源文档 */
GPC,
/** 联锁工作站Interlock PC根据车务终端命名猜的 */
IPC,
/** 车务终端Station PC来源文档 */
STPC,
/** 车务管理终端(来源:文档) */
DMP,
}
}

View File

@ -0,0 +1,57 @@
package club.joylink.rtss.simulation.cbtc.bo;
import club.joylink.rtss.simulation.cbtc.vo.TrainingParamVO;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import lombok.Getter;
public class SimulationWorkParam {
public static void main(String[] args) {
FunctionInfo functionInfo = new TrainingFunctionInfo(Function.TRAINING, new TrainingParamVO());
functionInfo.getParam();
}
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "function")
@Getter
public static abstract class FunctionInfo {
Function function;
public Object param;
public FunctionInfo(Function function, Object param) {
this.function = function;
this.param = param;
}
}
@Getter
@JsonTypeName("TRAINING")
public static class TrainingFunctionInfo extends FunctionInfo{
TrainingParamVO param;
public TrainingFunctionInfo(Function function, TrainingParamVO param) {
super(function, param);
}
}
public enum Function {
/** 大客流Large passenger flow */
LPF(Object.class),
/** 实训室 */
TRAINING_ROOM(Object.class),
/** 实训设计 */
TRAINING_DESIGN(Object.class),
/** 实训 */
TRAINING(TrainingParamVO.class),
/** 考试 */
EXAM(Object.class),
;
private Class<?> paramCls;
Function(Class<?> paramCls) {
this.paramCls = paramCls;
}
}
}

View File

@ -8,7 +8,6 @@ import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
import club.joylink.rtss.simulation.cbtc.data.support.StationTurnBackStrategyOption;
import club.joylink.rtss.simulation.cbtc.data.vr.*;
import club.joylink.rtss.vo.map.MapGraphDataNewVO;
import club.joylink.rtss.vo.map.MapLogicDataNewVO;
import club.joylink.rtss.vo.map.MapVO;
import club.joylink.rtss.vo.map.graph.*;
import club.joylink.rtss.vo.map.logic.MapDisStationNewVO;

View File

@ -17,6 +17,7 @@ import club.joylink.rtss.simulation.cbtc.data.support.RoutePath;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityAudio;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityDevice;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityIbp;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.client.ibp.IbpData;
import club.joylink.rtss.vo.client.iscs.device.IscsDeviceVO;
@ -656,6 +657,8 @@ public class SimulationBuilder {
Map<Station, List<Section>> parkingTracksMap = new HashMap<>();
Map<String, SimulationMember> simulationMemberMap = new HashMap<>();
/**
* 数据错误信息列表
*/

View File

@ -58,10 +58,10 @@ public class MemberManager {
}
// 工电调度
this.addRole(simulation, SimulationMember.Type.ELECTRIC_DISPATCHER);
// 车辆段信号楼
this.addRole(simulation, SimulationMember.Type.DEPOT_SIGNAL_BUILDING);
// 停车场信号楼
this.addRole(simulation, SimulationMember.Type.PARKING_LOT_SIGNAL_BUILDING);
// // 车辆段信号楼
// this.addRole(simulation, SimulationMember.Type.DEPOT_SIGNAL_BUILDING);
// // 停车场信号楼
// this.addRole(simulation, SimulationMember.Type.PARKING_LOT_SIGNAL_BUILDING);
// 上级部门
this.addRole(simulation, SimulationMember.Type.PARENT_DEPARTMENT);
// 派班员
@ -120,10 +120,10 @@ public class MemberManager {
this.addRole(simulation, SimulationMember.Type.ELECTRIC_DISPATCHER);
// // 车辆段调度
// this.addRole(simulation, SimulationMember.Type.DEPOT_DISPATCHER);
// 车辆段信号楼
this.addRole(simulation, SimulationMember.Type.DEPOT_SIGNAL_BUILDING);
// 停车场信号楼
this.addRole(simulation, SimulationMember.Type.PARKING_LOT_SIGNAL_BUILDING);
// // 车辆段信号楼
// this.addRole(simulation, SimulationMember.Type.DEPOT_SIGNAL_BUILDING);
// // 停车场信号楼
// this.addRole(simulation, SimulationMember.Type.PARKING_LOT_SIGNAL_BUILDING);
// 上级部门
this.addRole(simulation, SimulationMember.Type.PARENT_DEPARTMENT);
// 派班员
@ -307,27 +307,21 @@ public class MemberManager {
}
public void addRailMembers(Simulation simulation) {
// 调度
if (!simulation.getRepository().getConfig().isRailway()) {
this.addRole(simulation, SimulationMember.Type.DISPATCHER);
}
// 通号
this.addRole(simulation, SimulationMember.Type.MAINTAINER);
// 行值
List<Station> stationList = simulation.getRepository().getSortedStationList();
for (Station station : stationList) {
// if (station.isNormal()) {
// this.addRole(simulation, SimulationMember.Type.STATION_SUPERVISOR, null, station);
// } else if (station.isDepot()) {
// // 车辆段调度
// this.addRole(simulation, SimulationMember.Type.DEPOT_DISPATCHER, station.getName() + "调度", station);
// }
Arrays.asList(
SimulationMember.Type.STATION_SUPERVISOR,
SimulationMember.Type.STATION_ASSISTANT, SimulationMember.Type.STATION_MASTER,
SimulationMember.Type.STATION_SIGNALER, SimulationMember.Type.STATION_PASSENGER,
SimulationMember.Type.STATION_SWITCH_MAN, SimulationMember.Type.STATION_FACILITATOR,
SimulationMember.Type.STATION_WORKER, SimulationMember.Type.DEVICE_MANAGER
SimulationMember.Type.STATION_ASSISTANT,
SimulationMember.Type.STATION_MASTER,
SimulationMember.Type.STATION_SIGNALER,
SimulationMember.Type.STATION_PASSENGER,
SimulationMember.Type.STATION_SWITCH_MAN,
SimulationMember.Type.STATION_FACILITATOR,
SimulationMember.Type.STATION_WORKER,
SimulationMember.Type.DEVICE_MANAGER
).forEach(type -> this.addRole(simulation, type, null, station));
}
// 调度台--调度关联
@ -342,19 +336,7 @@ public class MemberManager {
for (VirtualRealityTrain vrTrain : vrTrainList) {
this.addRole(simulation, SimulationMember.Type.DRIVER, null, vrTrain);
}
// // 工电调度
// this.addRole(simulation, SimulationMember.Type.ELECTRIC_DISPATCHER);
// // 车辆段调度
// this.addRole(simulation, SimulationMember.Type.DEPOT_DISPATCHER);
// // 车辆段信号楼
// this.addRole(simulation, SimulationMember.Type.DEPOT_SIGNAL_BUILDING);
// // 停车场信号楼
// this.addRole(simulation, SimulationMember.Type.PARKING_LOT_SIGNAL_BUILDING);
// 上级部门
this.addRole(simulation, SimulationMember.Type.PARENT_DEPARTMENT);
// // 派班员
// this.addRole(simulation, SimulationMember.Type.SCHEDULING);
// // 车务段段长
// this.addRole(simulation, SimulationMember.Type.TRAIN_MASTER);
}
}

View File

@ -16,6 +16,38 @@ import java.util.Objects;
@Getter
public class SimulationMember extends club.joylink.rtss.simulation.SimulationMember<SimulationMember.Type> {
// {
// //地铁角色
// Type[] metroTypes = {
// Type.DISPATCHER,
// Type.MAINTAINER,
// Type.STATION_SUPERVISOR,
// Type.DEPOT_DISPATCHER,
// Type.DRIVER,
// Type.ELECTRIC_DISPATCHER,
// Type.PARENT_DEPARTMENT,
// Type.SCHEDULING,
// Type.TRAIN_MASTER,
// Type.SIGNAL_BUILDING
// };
// //大铁角色
// Type[] railTypes = {
// Type.MAINTAINER,
// Type.DRIVER,
// Type.DISPATCHER,
// Type.MAINTAINER,
// Type.STATION_SUPERVISOR,
// Type.STATION_ASSISTANT,
// Type.STATION_MASTER,
// Type.STATION_SIGNALER,
// Type.STATION_PASSENGER,
// Type.STATION_SWITCH_MAN,
// Type.STATION_FACILITATOR,
// Type.STATION_WORKER,
// Type.DEVICE_MANAGER
// };
// }
private String id;
private Type type;
@ -113,10 +145,10 @@ public class SimulationMember extends club.joylink.rtss.simulation.SimulationMem
* 仿真成员岗位
*/
public enum Type {
/**
* 车务段段长
*/
TRAIN_MASTER,
/**
* 车务段段长
*/
TRAIN_MASTER,
/**
* 中心调度员
*/
@ -143,12 +175,24 @@ public class SimulationMember extends club.joylink.rtss.simulation.SimulationMem
MAINTAINER,
/**
* 车辆段信号楼
* 车辆段和停车场信号楼合并防止以前的剧本反序列化出问题所以暂不删除
*
* @see #SIGNAL_BUILDING
*/
@Deprecated(since = "2022.10.13", forRemoval = true)
DEPOT_SIGNAL_BUILDING,
/**
* 停车场信号楼
* 车辆段和停车场信号楼合并防止以前的剧本反序列化出问题所以暂不删除
*
* @see #SIGNAL_BUILDING
*/
@Deprecated(since = "2022.10.13", forRemoval = true)
PARKING_LOT_SIGNAL_BUILDING,
/**
* 车辆段/停车场信号楼
*/
SIGNAL_BUILDING,
/**
* 上级部门
*/
@ -157,10 +201,6 @@ public class SimulationMember extends club.joylink.rtss.simulation.SimulationMem
* 派班员
*/
SCHEDULING,
/**
* 大铁CTC
*/
RAIL_CTC,
/**
* 车站助理
*/

View File

@ -27,7 +27,7 @@ public class SimulationWorkParamVO {
@NotNull(message = "仿真类型不能为空")
private Simulation.Type type;
private UsageInfo usageInfo;
private UsageInfoVO usageInfo;
/**
* 仿真所使用的功能
@ -59,18 +59,21 @@ public class SimulationWorkParamVO {
@Getter
@Setter
@NoArgsConstructor
public static class UsageInfo {
public static class UsageInfoVO {
private Simulation.Usage usage;
private Map<String, Object> param;
private UsageParamVO param;
}
/**
* 使用方式参数
*/
@Getter
@Setter
@NoArgsConstructor
public static class FunctionInfo {
private Simulation.Function function;
public static class UsageParamVO {
private String memberId;
private Map<String, Object> param;
private Simulation.Client client;
}
}

View File

@ -1,15 +0,0 @@
package club.joylink.rtss.simulation.cbtc.vo;
import club.joylink.rtss.simulation.cbtc.Simulation;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class SingleClientParamVO {
private Simulation.Client client;
private String deviceCode;
}

View File

@ -5,7 +5,6 @@ import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.*;
import club.joylink.rtss.services.iscs.IscsDeviceService;
import club.joylink.rtss.services.iscs.IscsSystemResourcesService;
import club.joylink.rtss.services.project.DeviceService;
import club.joylink.rtss.services.psl.IVirtualRealityPslService;
import club.joylink.rtss.services.publishData.IbpService;
import club.joylink.rtss.services.runplan.IRunPlanParktimeService;
@ -28,7 +27,6 @@ import club.joylink.rtss.simulation.cbtc.device.virtual.VRDeviceLogicLoop;
import club.joylink.rtss.simulation.cbtc.device.virtual.VRTrainRunningService;
import club.joylink.rtss.simulation.cbtc.fault.FaultGenerator;
import club.joylink.rtss.simulation.cbtc.member.MemberManager;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import club.joylink.rtss.simulation.cbtc.member.SimulationUser;
import club.joylink.rtss.simulation.cbtc.onboard.ATP.ATPLogicLoop;
import club.joylink.rtss.simulation.cbtc.onboard.TrainTargetUpdateService;
@ -37,7 +35,6 @@ import club.joylink.rtss.simulation.cbtc.passenger.strategy.LargePassengerFlowSt
import club.joylink.rtss.simulation.cbtc.pis.PisLogicLoop;
import club.joylink.rtss.simulation.cbtc.robot.SimulationRobotService;
import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO;
import club.joylink.rtss.simulation.cbtc.vo.SingleMemberParamVO;
import club.joylink.rtss.simulation.cbtc.vo.TrainingParamVO;
import club.joylink.rtss.simulation.rt.iscs.IscsStatusPublisher;
import club.joylink.rtss.simulation.rt.pis.PisStatusPublisher;
@ -58,7 +55,6 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.time.LocalDate;
import java.time.LocalDateTime;
@ -139,7 +135,7 @@ public class MetroSimulationWorkServiceImpl implements SimulationWorkService {
@Autowired
private LargePassengerFlowStrategyService largePassengerFlowStrategyService;
@Autowired
private DeviceService deviceService;
private SimulationWorkServiceManager simulationWorkServiceManager;
@Override
public Simulation.Type getType() {
@ -178,7 +174,7 @@ public class MetroSimulationWorkServiceImpl implements SimulationWorkService {
SimulationUser simulationUser = new SimulationUser(simulation, params.getLoginUserInfo());
simulation.addSimulationUser(simulationUser);
// 添加仿真成员
memberManager.addMetroMembers(simulation);
simulationWorkServiceManager.buildMember(simulation);
}
@Override
@ -213,7 +209,7 @@ public class MetroSimulationWorkServiceImpl implements SimulationWorkService {
// 初始化设备状态
deviceStatusService.init(simulation);
// 根据使用方式设置用户扮演角色
playSimulationMember(simulation);
simulationWorkServiceManager.playMember(simulation);
}
@Override
@ -322,50 +318,9 @@ public class MetroSimulationWorkServiceImpl implements SimulationWorkService {
simulation.getBuildParams().getWorkParamVO().removeFunctions(functions);
}
private void playSimulationMember(Simulation simulation) {
Long creatorId = simulation.getBuildParams().getLoginUserInfo().getAccountVO().getId();
SimulationWorkParamVO createParamVO = simulation.getBuildParams().getWorkParamVO();
SimulationWorkParamVO.UsageInfo usageInfo = createParamVO.getUsageInfo();
SimulationMember simulationMember = null;
if (usageInfo != null) {
switch (usageInfo.getUsage()) {
case SINGLE_MEMBER:
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertMapNotEmpty(usageInfo.getParam(), "单角色仿真必须指定角色");
simulationMember = selectSimulationMemberByMemberInfo(simulation, usageInfo);
break;
case SINGLE_CLIENT:
throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("待实现");
case JOINT:
if (!CollectionUtils.isEmpty(usageInfo.getParam())) {
simulationMember = selectSimulationMemberByMemberInfo(simulation, usageInfo);
} else {
simulationMember = simulation.getMemberListByType(SimulationMember.Type.DISPATCHER).get(0);
}
break;
default:
throw new IllegalStateException("Unexpected value: " + usageInfo.getUsage());
}
}
if (simulationMember != null) {
memberManager.playRole(simulation, creatorId, simulationMember.getId());
}
}
private SimulationMember selectSimulationMemberByMemberInfo(Simulation simulation, SimulationWorkParamVO.UsageInfo usageInfo) {
SingleMemberParamVO singleMemberParamVO = JsonUtils.read(JsonUtils.writeValueAsString(usageInfo.getParam()), SingleMemberParamVO.class);
SimulationMember.Type memberType = singleMemberParamVO.getMemberType();
String deviceCode = singleMemberParamVO.getDeviceCode();
SimulationMember simulationMember = null;
if (memberType != null && StringUtils.hasText(deviceCode)) {
simulationMember = simulation.getSimulationMember(memberType, deviceCode);
} else if (memberType != null) {
simulationMember = simulation.getMemberListByType(memberType).get(0);
} else if (StringUtils.hasText(deviceCode)) {
simulationMember = simulation.getSimulationMembersByDeviceCode(deviceCode).get(0);
}
return simulationMember;
}
/**
* 加载地图设备及联锁数据
*/
private void loadMapData(Simulation simulation) {
SimulationBuildParams buildParams = simulation.getBuildParams();
simulation.setBuildParams(buildParams);

View File

@ -1,6 +1,5 @@
package club.joylink.rtss.simulation.cbtc.work;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.ICommandService;
import club.joylink.rtss.services.IMapService;
import club.joylink.rtss.simulation.cbtc.ATS.ATSLogicLoop;
@ -18,13 +17,10 @@ import club.joylink.rtss.simulation.cbtc.device.virtual.VRDeviceLogicLoop;
import club.joylink.rtss.simulation.cbtc.device.virtual.VRTrainRunningService;
import club.joylink.rtss.simulation.cbtc.fault.FaultGenerator;
import club.joylink.rtss.simulation.cbtc.member.MemberManager;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import club.joylink.rtss.simulation.cbtc.member.SimulationUser;
import club.joylink.rtss.simulation.cbtc.onboard.ATP.ATPLogicLoop;
import club.joylink.rtss.simulation.cbtc.robot.SimulationRobotService;
import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO;
import club.joylink.rtss.simulation.cbtc.vo.SingleMemberParamVO;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.CommandDefinitionVO;
import club.joylink.rtss.vo.client.simulationv1.RunAsPlanParam;
@ -33,7 +29,6 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.util.Collection;
@ -74,6 +69,8 @@ public class RailwaySimulationWorkServiceImpl implements SimulationWorkService {
private DeviceStatusService deviceStatusService;
@Autowired
private SimulationLifeCycleService simulationLifeCycleService;
@Autowired
private SimulationWorkServiceManager simulationWorkServiceManager;
@Override
public Simulation.Type getType() {
@ -101,7 +98,7 @@ public class RailwaySimulationWorkServiceImpl implements SimulationWorkService {
SimulationUser simulationUser = new SimulationUser(simulation, params.getLoginUserInfo());
simulation.addSimulationUser(simulationUser);
// 添加仿真成员
memberManager.addRailMembers(simulation);
simulationWorkServiceManager.buildMember(simulation);
}
@Override
@ -128,7 +125,7 @@ public class RailwaySimulationWorkServiceImpl implements SimulationWorkService {
// 初始化设备状态
deviceStatusService.init(simulation);
// 根据使用方式设置用户扮演角色
playSimulationMember(simulation);
simulationWorkServiceManager.playMember(simulation);
}
@Override
@ -207,48 +204,4 @@ public class RailwaySimulationWorkServiceImpl implements SimulationWorkService {
SimulationBuilder.buildCtcStationRunPlanLog(simulation);
}
}
private void playSimulationMember(Simulation simulation) {
Long creatorId = simulation.getBuildParams().getLoginUserInfo().getAccountVO().getId();
SimulationWorkParamVO createParamVO = simulation.getBuildParams().getWorkParamVO();
SimulationWorkParamVO.UsageInfo usageInfo = createParamVO.getUsageInfo();
SimulationMember simulationMember = null;
if (usageInfo != null) {
switch (usageInfo.getUsage()) {
case SINGLE_MEMBER:
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertMapNotEmpty(usageInfo.getParam(), "单角色仿真必须指定角色");
simulationMember = selectSimulationMemberFromParam(simulation, usageInfo);
break;
case SINGLE_CLIENT:
throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("待实现");
case JOINT:
if (!CollectionUtils.isEmpty(usageInfo.getParam())) {
simulationMember = selectSimulationMemberFromParam(simulation, usageInfo);
} else {
simulationMember = simulation.getMemberListByType(SimulationMember.Type.DISPATCHER).get(0);
}
break;
default:
throw new IllegalStateException("Unexpected value: " + usageInfo.getUsage());
}
}
if (simulationMember != null) {
memberManager.playRole(simulation, creatorId, simulationMember.getId());
}
}
private SimulationMember selectSimulationMemberFromParam(Simulation simulation, SimulationWorkParamVO.UsageInfo usageInfo) {
SingleMemberParamVO singleMemberParamVO = JsonUtils.read(JsonUtils.writeValueAsString(usageInfo.getParam()), SingleMemberParamVO.class);
SimulationMember.Type memberType = singleMemberParamVO.getMemberType();
String deviceCode = singleMemberParamVO.getDeviceCode();
SimulationMember simulationMember = null;
if (memberType != null && StringUtils.hasText(deviceCode)) {
simulationMember = simulation.getSimulationMember(memberType, deviceCode);
} else if (memberType != null) {
simulationMember = simulation.getMemberListByType(memberType).get(0);
} else if (StringUtils.hasText(deviceCode)) {
simulationMember = simulation.getSimulationMembersByDeviceCode(deviceCode).get(0);
}
return simulationMember;
}
}

View File

@ -2,18 +2,30 @@ package club.joylink.rtss.simulation.cbtc.work;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import club.joylink.rtss.simulation.cbtc.member.MemberManager;
import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO;
import club.joylink.rtss.vo.map.graph.MapMemberVO;
import lombok.NonNull;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
@Component
public class SimulationWorkServiceManager implements ApplicationContextAware {
@Autowired
private MemberManager memberManager;
private Map<Simulation.Type, SimulationWorkService> map;
@Override
@ -27,4 +39,65 @@ public class SimulationWorkServiceManager implements ApplicationContextAware {
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(initService, String.format("[%s]仿真未配置初始化服务", simulationType));
return initService;
}
/**
* 构建仿真成员实体
*/
public void buildMember(Simulation simulation) {
Map<Simulation.Type, List<MapMemberVO>> memberMap = simulation.getBuildParams().getMap().getGraphDataNew().getMemberMap();
if (CollectionUtils.isEmpty(memberMap))
return;
List<MapMemberVO> memberVOS = memberMap.get(simulation.getBuildParams().getWorkParamVO().getType());
if (CollectionUtils.isEmpty(memberVOS))
return;
List<String> dataErrMsgList = simulation.getDataErrMsgList();
SimulationDataRepository repository = simulation.getRepository();
for (MapMemberVO memberVO : memberVOS) {
if (memberVO.getId() == null) {
dataErrMsgList.add(String.format("成员数据[%s]未设置id", memberVO));
continue;
}
if (memberVO.getType() == null) {
dataErrMsgList.add(String.format("成员数据[%s]未设置类型", memberVO));
continue;
}
MapElement mapElement = null;
if (StringUtils.hasText(memberVO.getDeviceCode())) {
mapElement = repository.getByCode(memberVO.getDeviceCode());
}
memberManager.addRole(simulation, memberVO.getType(), memberVO.getName(), mapElement);
}
if (!dataErrMsgList.isEmpty())
simulation.setMapDataError(true);
}
/**
* 仿真初始化时设置仿真创建者扮演的角色
*/
public void playMember(Simulation simulation) {
SimulationWorkParamVO workParamVO = simulation.getBuildParams().getWorkParamVO();
SimulationWorkParamVO.UsageInfoVO usageInfo = workParamVO.getUsageInfo();
SimulationWorkParamVO.UsageParamVO usageParamVO = usageInfo.getParam();
switch (usageInfo.getUsage()) {
case SINGLE_MEMBER:
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(usageParamVO, "缺少要扮演的角色参数");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(usageParamVO.getMemberId(), "缺少要扮演的角色参数");
break;
case SINGLE_CLIENT:
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(usageParamVO, "缺少要扮演的角色参数");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(usageParamVO.getMemberId(), "缺少要扮演的角色参数");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(usageParamVO.getClient(), "缺少要使用的客户端参数");
break;
case JOINT:
break;
default:
throw new IllegalStateException("Unexpected value: " + usageInfo.getUsage());
}
if (usageParamVO != null && usageParamVO.getMemberId() != null) {
Long creatorId = simulation.getBuildParams().getLoginUserInfo().getAccountVO().getId();
memberManager.playRole(simulation, creatorId, usageParamVO.getMemberId());
}
}
}

View File

@ -1,6 +1,6 @@
package club.joylink.rtss.vo.client.mapSystem;
import club.joylink.rtss.entity.MapSystemNew;
import club.joylink.rtss.entity.RtsMapSystem;
import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO;
import club.joylink.rtss.util.JsonUtils;
import lombok.Getter;
@ -25,8 +25,8 @@ public class MapSystemCreateVO {
@NotNull(message = "参数不能为空")
private SimulationWorkParamVO paramVO;
public MapSystemNew convert2DB() {
MapSystemNew mapSystemNew = new MapSystemNew();
public RtsMapSystem convert2DB() {
RtsMapSystem mapSystemNew = new RtsMapSystem();
mapSystemNew.setMapId(mapId);
mapSystemNew.setName(name);
mapSystemNew.setDesc(desc);

View File

@ -1,6 +1,6 @@
package club.joylink.rtss.vo.client.mapSystem;
import club.joylink.rtss.entity.MapSystemNew;
import club.joylink.rtss.entity.RtsMapSystem;
import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO;
import club.joylink.rtss.util.JsonUtils;
import lombok.Getter;
@ -22,7 +22,7 @@ public class MapSystemUpdateVO {
@NotNull(message = "参数不能为空")
private SimulationWorkParamVO paramVO;
public void override(MapSystemNew entity) {
public void override(RtsMapSystem entity) {
entity.setName(name);
entity.setDesc(desc);
entity.setType(paramVO.getType().name());

View File

@ -9,7 +9,7 @@ import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class MapSystemNewQueryVO extends PageQueryVO {
public class RtsMapSystemQueryVO extends PageQueryVO {
private Long mapId;
private String name;

View File

@ -1,6 +1,6 @@
package club.joylink.rtss.vo.client.mapSystem;
import club.joylink.rtss.entity.MapSystemNew;
import club.joylink.rtss.entity.RtsMapSystem;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO;
import club.joylink.rtss.util.JsonUtils;
@ -13,7 +13,7 @@ import java.time.LocalDateTime;
@Getter
@Setter
@NoArgsConstructor
public class MapSystemNewVO {
public class RtsMapSystemVO {
private Long id;
private Long mapId;
@ -36,7 +36,7 @@ public class MapSystemNewVO {
private LocalDateTime updateTime;
public MapSystemNewVO(MapSystemNew entity) {
public RtsMapSystemVO(RtsMapSystem entity) {
id = entity.getId();
mapId = entity.getMapId();
name = entity.getName();

View File

@ -1,10 +1,10 @@
package club.joylink.rtss.vo.map;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.map.display.DisplayVO;
import club.joylink.rtss.vo.map.display.PictureVO;
import club.joylink.rtss.vo.map.graph.*;
import club.joylink.rtss.vo.map.logic.MapDisStationNewVO;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;
@ -13,7 +13,9 @@ import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Getter
@Setter
@ -224,8 +226,16 @@ public class MapGraphDataNewVO {
*/
private List<MapResponderVO> responderList;
/**
* 信号按钮
*/
private List<MapSignalButtonVO> signalButtonList = new ArrayList<>();
/**
* 地图成员
*/
private Map<Simulation.Type, List<MapMemberVO>> memberMap = new HashMap<>();
public MapGraphDataNewVO() {
this.bigScreenConfig = new BigScreenConfig();
this.generateConfig = new MapCiGenerateConfig();

View File

@ -1,18 +1,21 @@
package club.joylink.rtss.simulation.cbtc.vo;
package club.joylink.rtss.vo.map.graph;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
/**
* 单角色仿真参数
*/
@Getter
@Setter
@ToString
@NoArgsConstructor
public class SingleMemberParamVO {
private SimulationMember.Type memberType;
public class MapMemberVO {
private String id;
private SimulationMember.Type type;
private String deviceCode;
private String name;
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="club.joylink.rtss.dao.MapSystemNewDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.MapSystemNew">
<mapper namespace="club.joylink.rtss.dao.RtsMapSystemDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.RtsMapSystem">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="map_id" jdbcType="BIGINT" property="mapId" />
<result column="name" jdbcType="VARCHAR" property="name" />
@ -13,7 +13,7 @@
<result column="updater_id" jdbcType="BIGINT" property="updaterId" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="club.joylink.rtss.entity.MapSystemNew">
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="club.joylink.rtss.entity.RtsMapSystem">
<result column="param" jdbcType="LONGVARCHAR" property="param" />
</resultMap>
<sql id="Example_Where_Clause">
@ -75,13 +75,13 @@
</where>
</sql>
<sql id="Base_Column_List">
id, map_id, `name`, `desc`, `type`, `usage`, creator_id, create_time, updater_id,
id, map_id, `name`, `desc`, `type`, `usage`, creator_id, create_time, updater_id,
update_time
</sql>
<sql id="Blob_Column_List">
param
</sql>
<select id="selectByExampleWithBLOBs" parameterType="club.joylink.rtss.entity.MapSystemNewExample" resultMap="ResultMapWithBLOBs">
<select id="selectByExampleWithBLOBs" parameterType="club.joylink.rtss.entity.RtsMapSystemExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
@ -89,7 +89,7 @@
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from map_system_new
from rts_map_system
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
@ -104,14 +104,17 @@
limit ${limit}
</if>
</if>
<if test="forUpdate != null and forUpdate == true">
for update
</if>
</select>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.MapSystemNewExample" resultMap="BaseResultMap">
<select id="selectByExample" parameterType="club.joylink.rtss.entity.RtsMapSystemExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from map_system_new
from rts_map_system
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
@ -126,37 +129,40 @@
limit ${limit}
</if>
</if>
<if test="forUpdate != null and forUpdate == true">
for update
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
select
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from map_system_new
from rts_map_system
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from map_system_new
delete from rts_map_system
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.MapSystemNewExample">
delete from map_system_new
<delete id="deleteByExample" parameterType="club.joylink.rtss.entity.RtsMapSystemExample">
delete from rts_map_system
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.MapSystemNew" useGeneratedKeys="true">
insert into map_system_new (map_id, `name`, `desc`,
`type`, `usage`, creator_id,
create_time, updater_id, update_time,
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.RtsMapSystem" useGeneratedKeys="true">
insert into rts_map_system (map_id, `name`, `desc`,
`type`, `usage`, creator_id,
create_time, updater_id, update_time,
param)
values (#{mapId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{desc,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR}, #{usage,jdbcType=VARCHAR}, #{creatorId,jdbcType=BIGINT},
#{createTime,jdbcType=TIMESTAMP}, #{updaterId,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP},
values (#{mapId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{desc,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR}, #{usage,jdbcType=VARCHAR}, #{creatorId,jdbcType=BIGINT},
#{createTime,jdbcType=TIMESTAMP}, #{updaterId,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP},
#{param,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.MapSystemNew" useGeneratedKeys="true">
insert into map_system_new
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.RtsMapSystem" useGeneratedKeys="true">
insert into rts_map_system
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="mapId != null">
map_id,
@ -222,14 +228,14 @@
</if>
</trim>
</insert>
<select id="countByExample" parameterType="club.joylink.rtss.entity.MapSystemNewExample" resultType="java.lang.Long">
select count(*) from map_system_new
<select id="countByExample" parameterType="club.joylink.rtss.entity.RtsMapSystemExample" resultType="java.lang.Long">
select count(*) from rts_map_system
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update map_system_new
update rts_map_system
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
@ -270,7 +276,7 @@
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update map_system_new
update rts_map_system
set id = #{record.id,jdbcType=BIGINT},
map_id = #{record.mapId,jdbcType=BIGINT},
`name` = #{record.name,jdbcType=VARCHAR},
@ -287,7 +293,7 @@
</if>
</update>
<update id="updateByExample" parameterType="map">
update map_system_new
update rts_map_system
set id = #{record.id,jdbcType=BIGINT},
map_id = #{record.mapId,jdbcType=BIGINT},
`name` = #{record.name,jdbcType=VARCHAR},
@ -302,8 +308,8 @@
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.MapSystemNew">
update map_system_new
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.RtsMapSystem">
update rts_map_system
<set>
<if test="mapId != null">
map_id = #{mapId,jdbcType=BIGINT},
@ -338,8 +344,8 @@
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="club.joylink.rtss.entity.MapSystemNew">
update map_system_new
<update id="updateByPrimaryKeyWithBLOBs" parameterType="club.joylink.rtss.entity.RtsMapSystem">
update rts_map_system
set map_id = #{mapId,jdbcType=BIGINT},
`name` = #{name,jdbcType=VARCHAR},
`desc` = #{desc,jdbcType=VARCHAR},
@ -352,8 +358,8 @@
param = #{param,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.MapSystemNew">
update map_system_new
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.RtsMapSystem">
update rts_map_system
set map_id = #{mapId,jdbcType=BIGINT},
`name` = #{name,jdbcType=VARCHAR},
`desc` = #{desc,jdbcType=VARCHAR},
@ -365,4 +371,4 @@
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
</mapper>