增加生成子系统的接口;增加仿真客户端类型;
This commit is contained in:
parent
761d7e353b
commit
3a5fbb16e9
@ -9,6 +9,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 草稿地图 调度台 接口
|
||||
* <p>
|
||||
@ -49,6 +51,15 @@ public class DraftMapDisStationController {
|
||||
public PageVO<MapDisStationNewVO> findByPage(@PathVariable("id") Long mapId, @RequestBody FindByPageReq req){
|
||||
return this.draftMapDisStationService.findByPage(mapId,req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询所有调度台
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public List<MapDisStationNewVO> listQuery(@PathVariable long id) {
|
||||
return draftMapDisStationService.listQuery(id);
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class FindByPageReq extends PageQueryVO{
|
||||
/**
|
||||
|
@ -9,10 +9,7 @@ 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.MapSystemUpdateVO;
|
||||
import club.joylink.rtss.vo.client.mapSystem.RtsMapSystemQueryVO;
|
||||
import club.joylink.rtss.vo.client.mapSystem.RtsMapSystemVO;
|
||||
import club.joylink.rtss.vo.client.mapSystem.*;
|
||||
import club.joylink.rtss.vo.client.sub.MapSystemDetailVO;
|
||||
import club.joylink.rtss.vo.client.sub.MapSystemQueryVO;
|
||||
import club.joylink.rtss.vo.client.sub.MapSystemVO;
|
||||
@ -122,6 +119,16 @@ public class MapSystemController {
|
||||
rtsMapSystemService.create(createVO, loginInfo.getAccountVO().getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成地图子系统(新)
|
||||
*/
|
||||
@Role(RoleEnum.Admin)
|
||||
@PostMapping("/new/{mapId}/generate")
|
||||
public List<String> generate(@PathVariable long mapId, @RequestBody @Validated MapSystemGenerateParamVO paramVO,
|
||||
@RequestAttribute LoginUserInfoVO loginInfo) {
|
||||
return rtsMapSystemService.generate(mapId, paramVO, loginInfo.getAccountVO().getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询地图系统(新)
|
||||
*/
|
||||
|
@ -4,13 +4,10 @@ import club.joylink.rtss.controller.draft.DraftMapDisStationController;
|
||||
import club.joylink.rtss.dao.DraftMapDisStationDAO;
|
||||
import club.joylink.rtss.entity.DraftMapDisStation;
|
||||
import club.joylink.rtss.entity.DraftMapDisStationExample;
|
||||
import club.joylink.rtss.entity.paper.PaperUser;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.util.JsonUtils;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.map.logic.MapDisStationNewVO;
|
||||
import club.joylink.rtss.vo.paper.PaperUserInfoVo;
|
||||
import club.joylink.rtss.vo.paper.convertor.PaperUserConvertor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -18,6 +15,7 @@ import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class DraftMapDisStationService {
|
||||
@ -121,7 +119,7 @@ public class DraftMapDisStationService {
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@Transactional(readOnly = true)
|
||||
|
||||
private List<DraftMapDisStation> findByMapIdAndCode(Long mapId, String code){
|
||||
DraftMapDisStationExample example = new DraftMapDisStationExample();
|
||||
example.createCriteria().andMapIdEqualTo(mapId).andCodeEqualTo(code);
|
||||
@ -149,4 +147,11 @@ public class DraftMapDisStationService {
|
||||
entity.setStationList(JsonUtils.writeValueAsString(from.getStationList()));
|
||||
return entity;
|
||||
}
|
||||
|
||||
public List<MapDisStationNewVO> listQuery(long mapId) {
|
||||
DraftMapDisStationExample example = new DraftMapDisStationExample();
|
||||
example.createCriteria().andMapIdEqualTo(mapId);
|
||||
List<DraftMapDisStation> list = draftMapDisStationDAO.selectByExample(example);
|
||||
return list.stream().map(DraftMapDisStationService::convert).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,7 @@
|
||||
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.MapSystemUpdateVO;
|
||||
import club.joylink.rtss.vo.client.mapSystem.RtsMapSystemQueryVO;
|
||||
import club.joylink.rtss.vo.client.mapSystem.RtsMapSystemVO;
|
||||
import club.joylink.rtss.vo.client.mapSystem.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -15,7 +12,23 @@ public interface RtsMapSystemService {
|
||||
|
||||
void update(long id, MapSystemUpdateVO updateVO, long updaterId);
|
||||
|
||||
/**
|
||||
* 列表查询地图子系统
|
||||
*/
|
||||
List<RtsMapSystemVO> listQuery(RtsMapSystemQueryVO queryVO);
|
||||
|
||||
/**
|
||||
* 分页查询地图子系统
|
||||
*/
|
||||
PageVO<RtsMapSystemVO> pagedQuery(RtsMapSystemQueryVO queryVO);
|
||||
|
||||
/**
|
||||
* 生成地图子系统
|
||||
*
|
||||
* @param mapId 要生成子系统的地图id
|
||||
* @param paramVO 指示生成内容的参数
|
||||
* @param creatorId
|
||||
* @return 一些特殊的,但是算不上异常的信息
|
||||
*/
|
||||
List<String> generate(long mapId, MapSystemGenerateParamVO paramVO, long creatorId);
|
||||
}
|
||||
|
@ -4,19 +4,25 @@ 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.services.IMapService;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
||||
import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.mapSystem.MapSystemCreateVO;
|
||||
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.mapSystem.*;
|
||||
import club.joylink.rtss.vo.map.MapVO;
|
||||
import club.joylink.rtss.vo.map.graph.MapMemberVO;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -24,6 +30,8 @@ import java.util.stream.Collectors;
|
||||
public class RtsMapSystemServiceImpl implements RtsMapSystemService {
|
||||
@Autowired
|
||||
private RtsMapSystemDAO rtsMapSystemDAO;
|
||||
@Autowired
|
||||
private IMapService iMapService;
|
||||
|
||||
@Override
|
||||
public void create(MapSystemCreateVO createVO, long creatorId) {
|
||||
@ -71,6 +79,258 @@ public class RtsMapSystemServiceImpl implements RtsMapSystemService {
|
||||
return PageVO.convert(page, list);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public List<String> generate(long mapId, MapSystemGenerateParamVO paramVO, long creatorId) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(paramVO.getSimTypes(),
|
||||
"要生成子系统的仿真系统类型不能为空");
|
||||
//删除所有旧数据
|
||||
RtsMapSystemExample example = new RtsMapSystemExample();
|
||||
example.createCriteria().andMapIdEqualTo(mapId);
|
||||
rtsMapSystemDAO.deleteByExample(example);
|
||||
|
||||
List<String> msgList = new ArrayList<>();
|
||||
MapVO mapData = iMapService.getMapDetail(mapId);
|
||||
for (Simulation.Type simType : paramVO.getSimTypes()) {
|
||||
switch (simType) {
|
||||
case METRO:
|
||||
generateMetroSystem(mapId, mapData, creatorId, msgList);
|
||||
break;
|
||||
case RAILWAY:
|
||||
generateRailwaySystem(mapId, mapData, creatorId, msgList);
|
||||
break;
|
||||
case EMERGENCY:
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("Unexpected value: " + simType);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void generateRailwaySystem(long mapId, MapVO mapData, long creatorId, List<String> msgList) {
|
||||
String msgPrefix = "大铁CTC系统";
|
||||
Simulation.Type simType = Simulation.Type.RAILWAY;
|
||||
List<MapMemberVO> mapMemberVOS = mapData.getGraphDataNew().getMemberMap().get(simType);
|
||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertCollectionNotEmpty(mapMemberVOS,
|
||||
String.format("%s成员列表为空,不能生成子系统", msgPrefix));
|
||||
|
||||
MapSystemCreateVO createVO;
|
||||
SimulationWorkParamVO workParamVO;
|
||||
SimulationWorkParamVO.InitParamVO initParamVO;
|
||||
SimulationWorkParamVO.DomConfigVO domConfigVO;
|
||||
//调度台终端
|
||||
Optional<MapMemberVO> dispatcherOptional = mapMemberVOS.stream()
|
||||
.filter(vo -> Objects.equals(vo.getType(), SimulationMember.Type.DISPATCHER))
|
||||
.findFirst();
|
||||
if (dispatcherOptional.isEmpty()) {
|
||||
msgList.add(String.format("%s无行调角色,未生成调度台", msgPrefix));
|
||||
} else {
|
||||
MapMemberVO mapMemberVO = dispatcherOptional.get();
|
||||
createVO = new MapSystemCreateVO();
|
||||
createVO.setMapId(mapId);
|
||||
createVO.setDesc("调度台");
|
||||
createVO.setName("调度台");
|
||||
|
||||
workParamVO = new SimulationWorkParamVO();
|
||||
createVO.setParamVO(workParamVO);
|
||||
workParamVO.setType(simType);
|
||||
|
||||
initParamVO = new SimulationWorkParamVO.InitParamVO(mapMemberVO.getId(), null);
|
||||
workParamVO.setInitParam(initParamVO);
|
||||
|
||||
domConfigVO = new SimulationWorkParamVO.DomConfigVO(true, false, false);
|
||||
workParamVO.setDomConfig(domConfigVO);
|
||||
create(createVO, creatorId);
|
||||
}
|
||||
//车站
|
||||
Optional<MapMemberVO> stationSupervisorOptional = mapMemberVOS.stream()
|
||||
.filter(vo -> Objects.equals(vo.getType(), SimulationMember.Type.STATION_SUPERVISOR))
|
||||
.findFirst();
|
||||
if (stationSupervisorOptional.isEmpty()) {
|
||||
msgList.add(String.format("%s无行值角色,未生成调度台", msgPrefix));
|
||||
} else {
|
||||
MapMemberVO mapMemberVO = stationSupervisorOptional.get();
|
||||
createVO = new MapSystemCreateVO();
|
||||
createVO.setMapId(mapId);
|
||||
createVO.setDesc("车站");
|
||||
createVO.setName("车站");
|
||||
|
||||
workParamVO = new SimulationWorkParamVO();
|
||||
createVO.setParamVO(workParamVO);
|
||||
workParamVO.setType(simType);
|
||||
|
||||
initParamVO = new SimulationWorkParamVO.InitParamVO(mapMemberVO.getId(), null);
|
||||
workParamVO.setInitParam(initParamVO);
|
||||
|
||||
domConfigVO = new SimulationWorkParamVO.DomConfigVO(true, false, false);
|
||||
workParamVO.setDomConfig(domConfigVO);
|
||||
create(createVO, creatorId);
|
||||
}
|
||||
}
|
||||
|
||||
private void generateMetroSystem(long mapId, MapVO mapData, long creatorId, List<String> msgList) {
|
||||
String msgPrefix = "地铁CBTC系统";
|
||||
Simulation.Type simType = Simulation.Type.METRO;
|
||||
List<MapMemberVO> mapMemberVOS = mapData.getGraphDataNew().getMemberMap().get(simType);
|
||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertCollectionNotEmpty(mapMemberVOS,
|
||||
String.format("%s成员列表为空,不能生成子系统", msgPrefix));
|
||||
|
||||
MapSystemCreateVO createVO;
|
||||
SimulationWorkParamVO workParamVO;
|
||||
SimulationWorkParamVO.InitParamVO initParamVO;
|
||||
SimulationWorkParamVO.DomConfigVO domConfigVO;
|
||||
String name;
|
||||
//行调工作站
|
||||
name = "行调工作站";
|
||||
Optional<MapMemberVO> dispatcherOptional = mapMemberVOS.stream()
|
||||
.filter(vo -> Objects.equals(vo.getType(), SimulationMember.Type.DISPATCHER))
|
||||
.findFirst();
|
||||
if (dispatcherOptional.isEmpty()) {
|
||||
msgList.add(String.format("%s无行调角色,未生成%s", msgPrefix, name));
|
||||
} else {
|
||||
MapMemberVO mapMemberVO = dispatcherOptional.get();
|
||||
createVO = new MapSystemCreateVO();
|
||||
createVO.setMapId(mapId);
|
||||
createVO.setDesc(name);
|
||||
createVO.setName(name);
|
||||
|
||||
workParamVO = new SimulationWorkParamVO();
|
||||
createVO.setParamVO(workParamVO);
|
||||
workParamVO.setType(simType);
|
||||
|
||||
initParamVO = new SimulationWorkParamVO.InitParamVO(mapMemberVO.getId(), null);
|
||||
workParamVO.setInitParam(initParamVO);
|
||||
|
||||
domConfigVO = new SimulationWorkParamVO.DomConfigVO(true, false, false);
|
||||
workParamVO.setDomConfig(domConfigVO);
|
||||
create(createVO, creatorId);
|
||||
}
|
||||
//行值工作站
|
||||
name = "现地工作站";
|
||||
Optional<MapMemberVO> stationSupervisorOptional = mapMemberVOS.stream()
|
||||
.filter(vo -> Objects.equals(vo.getType(), SimulationMember.Type.STATION_SUPERVISOR))
|
||||
.findFirst();
|
||||
if (dispatcherOptional.isEmpty()) {
|
||||
msgList.add(String.format("%s无行值角色,未生成%s", name));
|
||||
} else {
|
||||
MapMemberVO mapMemberVO = stationSupervisorOptional.get();
|
||||
createVO = new MapSystemCreateVO();
|
||||
createVO.setMapId(mapId);
|
||||
createVO.setDesc(name);
|
||||
createVO.setName(name);
|
||||
|
||||
workParamVO = new SimulationWorkParamVO();
|
||||
createVO.setParamVO(workParamVO);
|
||||
workParamVO.setType(simType);
|
||||
|
||||
initParamVO = new SimulationWorkParamVO.InitParamVO(mapMemberVO.getId(), null);
|
||||
workParamVO.setInitParam(initParamVO);
|
||||
|
||||
domConfigVO = new SimulationWorkParamVO.DomConfigVO(true, false, false);
|
||||
workParamVO.setDomConfig(domConfigVO);
|
||||
create(createVO, creatorId);
|
||||
}
|
||||
//司机模拟驾驶系统
|
||||
name = "司机模拟驾驶系统";
|
||||
Optional<MapMemberVO> driverOptional = mapMemberVOS.stream()
|
||||
.filter(vo -> Objects.equals(vo.getType(), SimulationMember.Type.DRIVER))
|
||||
.findFirst();
|
||||
if (driverOptional.isEmpty()) {
|
||||
msgList.add(String.format("%s无司机角色,未生成%s", msgPrefix, name));
|
||||
} else {
|
||||
MapMemberVO mapMemberVO = driverOptional.get();
|
||||
createVO = new MapSystemCreateVO();
|
||||
createVO.setMapId(mapId);
|
||||
createVO.setDesc(name);
|
||||
createVO.setName(name);
|
||||
|
||||
workParamVO = new SimulationWorkParamVO();
|
||||
createVO.setParamVO(workParamVO);
|
||||
workParamVO.setType(simType);
|
||||
|
||||
initParamVO = new SimulationWorkParamVO.InitParamVO(mapMemberVO.getId(), Simulation.Client.DRIVE);
|
||||
workParamVO.setInitParam(initParamVO);
|
||||
|
||||
domConfigVO = new SimulationWorkParamVO.DomConfigVO(false, false, false);
|
||||
workParamVO.setDomConfig(domConfigVO);
|
||||
create(createVO, creatorId);
|
||||
}
|
||||
//大屏工作站
|
||||
name = "大屏工作站";
|
||||
createVO = new MapSystemCreateVO();
|
||||
createVO.setMapId(mapId);
|
||||
createVO.setDesc(name);
|
||||
createVO.setName(name);
|
||||
|
||||
workParamVO = new SimulationWorkParamVO();
|
||||
createVO.setParamVO(workParamVO);
|
||||
workParamVO.setType(simType);
|
||||
|
||||
initParamVO = new SimulationWorkParamVO.InitParamVO(null, Simulation.Client.C_ATS_BS);
|
||||
workParamVO.setInitParam(initParamVO);
|
||||
|
||||
domConfigVO = new SimulationWorkParamVO.DomConfigVO(true, true, false);
|
||||
workParamVO.setDomConfig(domConfigVO);
|
||||
create(createVO, creatorId);
|
||||
//ISCS工作站
|
||||
name = "ISCS工作站";
|
||||
createVO = new MapSystemCreateVO();
|
||||
createVO.setMapId(mapId);
|
||||
createVO.setDesc(name);
|
||||
createVO.setName(name);
|
||||
|
||||
workParamVO = new SimulationWorkParamVO();
|
||||
createVO.setParamVO(workParamVO);
|
||||
workParamVO.setType(simType);
|
||||
|
||||
initParamVO = new SimulationWorkParamVO.InitParamVO(null, Simulation.Client.ISCS);
|
||||
workParamVO.setInitParam(initParamVO);
|
||||
|
||||
domConfigVO = new SimulationWorkParamVO.DomConfigVO(true, true, false);
|
||||
workParamVO.setDomConfig(domConfigVO);
|
||||
create(createVO, creatorId);
|
||||
//运行图编制工作站
|
||||
name = "运行图编制工作站";
|
||||
createVO = new MapSystemCreateVO();
|
||||
createVO.setMapId(mapId);
|
||||
createVO.setDesc(name);
|
||||
createVO.setName(name);
|
||||
|
||||
workParamVO = new SimulationWorkParamVO();
|
||||
createVO.setParamVO(workParamVO);
|
||||
workParamVO.setType(simType);
|
||||
|
||||
initParamVO = new SimulationWorkParamVO.InitParamVO(null, Simulation.Client.RUN_PLAN_DESIGN);
|
||||
workParamVO.setInitParam(initParamVO);
|
||||
|
||||
domConfigVO = new SimulationWorkParamVO.DomConfigVO(false, true, false);
|
||||
workParamVO.setDomConfig(domConfigVO);
|
||||
create(createVO, creatorId);
|
||||
//综合演练
|
||||
name = "综合演练";
|
||||
Optional<MapMemberVO> memberOptional = mapMemberVOS.stream().findFirst();
|
||||
if (memberOptional.isEmpty()) {
|
||||
msgList.add(String.format("%s无成员,未生成%s", msgPrefix, name));
|
||||
} else {
|
||||
createVO = new MapSystemCreateVO();
|
||||
createVO.setMapId(mapId);
|
||||
createVO.setDesc(name);
|
||||
createVO.setName(name);
|
||||
|
||||
workParamVO = new SimulationWorkParamVO();
|
||||
createVO.setParamVO(workParamVO);
|
||||
workParamVO.setType(simType);
|
||||
|
||||
initParamVO = new SimulationWorkParamVO.InitParamVO(memberOptional.get().getId(), null);
|
||||
workParamVO.setInitParam(initParamVO);
|
||||
|
||||
domConfigVO = new SimulationWorkParamVO.DomConfigVO(false, false, false);
|
||||
workParamVO.setDomConfig(domConfigVO);
|
||||
create(createVO, creatorId);
|
||||
}
|
||||
}
|
||||
|
||||
private Optional<RtsMapSystem> findEntityOptional(long id) {
|
||||
RtsMapSystem entity = rtsMapSystemDAO.selectByPrimaryKey(id);
|
||||
return Optional.ofNullable(entity);
|
||||
|
@ -1,8 +1,6 @@
|
||||
package club.joylink.rtss.services.student;
|
||||
|
||||
import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.client.student.ExportStudentInfo;
|
||||
import club.joylink.rtss.vo.client.student.ImportStudentInfo;
|
||||
import club.joylink.rtss.vo.client.student.StudentInfoExportParam;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -759,15 +759,21 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation<Simulati
|
||||
|
||||
public enum Function {
|
||||
/** 大客流(Large passenger flow) */
|
||||
LPF,
|
||||
LPF("LPF"),
|
||||
/** 实训室 */
|
||||
TRAINING_ROOM,
|
||||
TRAINING_ROOM("TRAINING_ROOM"),
|
||||
/** 实训设计 */
|
||||
TRAINING_DESIGN,
|
||||
TRAINING_DESIGN("TRAINING_DESIGN"),
|
||||
/** 实训 */
|
||||
TRAINING,
|
||||
TRAINING("TRAINING"),
|
||||
/** 考试 */
|
||||
EXAM,
|
||||
EXAM("EXAM"),
|
||||
;
|
||||
public final String name;
|
||||
|
||||
Function(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -782,6 +788,8 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation<Simulati
|
||||
C_PA,
|
||||
/** 中心视频监控系统 */
|
||||
C_CCTV,
|
||||
/** 综合监控 */
|
||||
ISCS,
|
||||
|
||||
/** 现地ATS工作站 */
|
||||
L_ATS,
|
||||
@ -791,6 +799,12 @@ public class Simulation extends club.joylink.rtss.simulation.Simulation<Simulati
|
||||
L_PA,
|
||||
/** 现地视频监控系统 */
|
||||
L_CCTV,
|
||||
IBP,
|
||||
PSL,
|
||||
/** 列车驾驶 */
|
||||
DRIVE,
|
||||
/** 运行图编制/设计 */
|
||||
RUN_PLAN_DESIGN,
|
||||
|
||||
|
||||
/** 调度台终端(含 WintgTerm、LayoutTerm、DcmdTerm、TSRTerm、C3Term、ShuntTerm)(来源:文档) */
|
||||
|
@ -18,6 +18,7 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
public class SimulationServiceImpl implements SimulationService {
|
||||
@ -37,6 +38,13 @@ public class SimulationServiceImpl implements SimulationService {
|
||||
SimulationWorkService initService = simulationWorkServiceManager.getInitService(workParamVO.getType());
|
||||
Simulation simulation = initService.create(loginUserInfoVO, workParamVO);
|
||||
|
||||
LoginUserInfoVO loginUserInfo = simulation.getBuildParams().getLoginUserInfo();
|
||||
if (Objects.nonNull(loginUserInfo)) {
|
||||
simulation.setCreatorId(loginUserInfo.getAccountVO().getIdStr());
|
||||
simulation.setProject(loginUserInfo.getProject());
|
||||
simulation.setProjectVO(loginUserInfo.getProjectInfo());
|
||||
}
|
||||
|
||||
// 删除旧仿真,保存新仿真
|
||||
club.joylink.rtss.simulation.Simulation oldSimulation = simulationManager.queryByCreatorId(simulation.getCreatorId());
|
||||
if (oldSimulation != null) {
|
||||
|
@ -1,57 +1,73 @@
|
||||
package club.joylink.rtss.simulation.cbtc.bo;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.vo.TrainingParamVO;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO;
|
||||
import club.joylink.rtss.util.JsonUtils;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Getter
|
||||
public class SimulationWorkParam {
|
||||
private Simulation.Type type;
|
||||
|
||||
public static void main(String[] args) {
|
||||
FunctionInfo functionInfo = new TrainingFunctionInfo(Function.TRAINING, new TrainingParamVO());
|
||||
functionInfo.getParam();
|
||||
}
|
||||
private SimulationWorkParamVO.InitParamVO initParam;
|
||||
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "function")
|
||||
/**
|
||||
* 仿真所使用的功能
|
||||
*/
|
||||
@JsonInclude(value = JsonInclude.Include.NON_NULL)
|
||||
private Map<Simulation.Function, FunctionParam> functionMap;
|
||||
|
||||
/**
|
||||
* 前端控制元素显隐的配置
|
||||
*/
|
||||
private SimulationWorkParamVO.DomConfigVO domConfig;
|
||||
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT)
|
||||
@JsonSubTypes({
|
||||
@JsonSubTypes.Type(value = TrainingFunctionParam.class, name = "TRAINING"),
|
||||
@JsonSubTypes.Type(value = LPFFunctionParam.class, name = "LPF")
|
||||
})
|
||||
@Getter
|
||||
public static abstract class FunctionInfo {
|
||||
Function function;
|
||||
|
||||
public Object param;
|
||||
|
||||
public FunctionInfo(Function function, Object param) {
|
||||
this.function = function;
|
||||
this.param = param;
|
||||
}
|
||||
@ToString
|
||||
public static abstract class FunctionParam {
|
||||
}
|
||||
|
||||
@Getter
|
||||
@JsonTypeName("TRAINING")
|
||||
public static class TrainingFunctionInfo extends FunctionInfo{
|
||||
TrainingParamVO param;
|
||||
|
||||
public TrainingFunctionInfo(Function function, TrainingParamVO param) {
|
||||
super(function, param);
|
||||
}
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public static class TrainingFunctionParam extends FunctionParam {
|
||||
private Long trainingId;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public static class LPFFunctionParam extends FunctionParam {
|
||||
private Long dataId;
|
||||
}
|
||||
|
||||
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;
|
||||
public SimulationWorkParam(SimulationWorkParamVO vo) {
|
||||
this.type = vo.getType();
|
||||
this.initParam = vo.getInitParam();
|
||||
Map<Simulation.Function, Map<String, Object>> voFunctionMap = vo.getFunctionMap();
|
||||
if (!CollectionUtils.isEmpty(voFunctionMap)) {
|
||||
this.functionMap = new HashMap<>();
|
||||
for (Map.Entry<Simulation.Function, Map<String, Object>> entry : voFunctionMap.entrySet()) {
|
||||
String json = JsonUtils.writeValueAsString(entry);
|
||||
FunctionParam param = JsonUtils.read(json, FunctionParam.class);
|
||||
this.functionMap.put(entry.getKey(), param);
|
||||
}
|
||||
}
|
||||
this.domConfig = vo.getDomConfig();
|
||||
}
|
||||
}
|
||||
|
@ -31,8 +31,7 @@ public class InterlockBuilder2 {
|
||||
static void checkAndBuildMapCILogicData(MapVO map, SimulationBuilder.SimulationDeviceBuildResult mapDataBuildResult) {
|
||||
MapLogicDataNewVO logicData = map.getLogicDataNew();
|
||||
MapGraphDataNewVO graphData = map.getGraphDataNew();
|
||||
|
||||
MapCiGenerateConfig generateConfig = graphData.getGenerateConfig();
|
||||
boolean railway = map.getConfigVO().isRailway();
|
||||
|
||||
Map<String, MapElement> elementMap = mapDataBuildResult.getDeviceMap();
|
||||
List<String> errMsgList = mapDataBuildResult.getErrMsgList();
|
||||
@ -50,7 +49,7 @@ public class InterlockBuilder2 {
|
||||
// 接近区段
|
||||
InterlockBuilder2.buildApproachSections(logicData, elementMap, errMsgList);
|
||||
// ------------进路start-------------
|
||||
if (generateConfig != null && generateConfig.isRailway()) {
|
||||
if (railway) {
|
||||
InterlockBuilder2.buildRailRoute(graphData, logicData, elementMap, errMsgList, flsMap);
|
||||
} else {
|
||||
InterlockBuilder2.buildRoute(logicData, elementMap, errMsgList, flsMap);
|
||||
@ -90,14 +89,14 @@ public class InterlockBuilder2 {
|
||||
// if (!errMsgList.isEmpty()) {
|
||||
// return;
|
||||
// }
|
||||
InterlockBuilder2.buildRoutePathFromStationRunLevel(generateConfig, stationRunLevelList, mapDataBuildResult, errMsgList);
|
||||
InterlockBuilder2.buildRoutePathFromStationRunLevel(stationRunLevelList, mapDataBuildResult, errMsgList);
|
||||
// buildParkTimes(logicData, elementMap, mapDataBuildResult.getParkTimeMap(), errMsgList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建自动折返
|
||||
*/
|
||||
private static void buildAutoReentry(MapLogicDataNewVO logicData, Map<String, MapElement> elementMap, List<String> errMsgList) {
|
||||
public static void buildAutoReentry(MapLogicDataNewVO logicData, Map<String, MapElement> elementMap, List<String> errMsgList) {
|
||||
List<MapAutoReentryVO> autoReentryList = logicData.getAutoReentryList();
|
||||
for (MapAutoReentryVO mapAutoReentryVO : autoReentryList) {
|
||||
Cycle cycle = new Cycle(mapAutoReentryVO.getCode(), mapAutoReentryVO.getName());
|
||||
@ -185,7 +184,7 @@ public class InterlockBuilder2 {
|
||||
/**
|
||||
* 构建自动信号
|
||||
*/
|
||||
private static void buildAutoSignal(MapLogicDataNewVO logicData, Map<String, MapElement> elementMap, List<String> errMsgList) {
|
||||
public static void buildAutoSignal(MapLogicDataNewVO logicData, Map<String, MapElement> elementMap, List<String> errMsgList) {
|
||||
List<MapAutoSignalNewVO> autoSignalList = logicData.getAutoSignalList();
|
||||
for (MapAutoSignalNewVO autoSignalNewVO : autoSignalList) {
|
||||
AutoSignal autoSignal = new AutoSignal(autoSignalNewVO.getCode());
|
||||
@ -272,7 +271,7 @@ public class InterlockBuilder2 {
|
||||
/**
|
||||
* 从大铁数据构建
|
||||
*/
|
||||
private static void buildRailRoute(MapGraphDataNewVO graphData, MapLogicDataNewVO logicData, Map<String, MapElement> elementMap, List<String> errMsgList, Map<String, RouteFls> flsMap) {
|
||||
public static void buildRailRoute(MapGraphDataNewVO graphData, MapLogicDataNewVO logicData, Map<String, MapElement> elementMap, List<String> errMsgList, Map<String, RouteFls> flsMap) {
|
||||
Map<String, MapSignalButtonVO> signalButtonMap = graphData.getSignalButtonList().stream()
|
||||
.collect(Collectors.toMap(MapSignalButtonVO::getCode, Function.identity()));
|
||||
List<MapRouteNewVO> routeList = logicData.getRouteList();
|
||||
@ -460,7 +459,7 @@ public class InterlockBuilder2 {
|
||||
}
|
||||
}
|
||||
|
||||
private static void buildRoute(MapLogicDataNewVO logicData, Map<String, MapElement> elementMap, List<String> errMsgList, Map<String, RouteFls> flsMap) {
|
||||
public static void buildRoute(MapLogicDataNewVO logicData, Map<String, MapElement> elementMap, List<String> errMsgList, Map<String, RouteFls> flsMap) {
|
||||
List<MapRouteNewVO> routeList = logicData.getRouteList();
|
||||
for (MapRouteNewVO mapRouteVO : routeList) {
|
||||
Route route = new Route(mapRouteVO.getCode(), mapRouteVO.getName());
|
||||
@ -618,7 +617,7 @@ public class InterlockBuilder2 {
|
||||
}
|
||||
}
|
||||
|
||||
private static void buildApproachSections(MapLogicDataNewVO logicData, Map<String, MapElement> elementMap, List<String> errMsgList) {
|
||||
public static void buildApproachSections(MapLogicDataNewVO logicData, Map<String, MapElement> elementMap, List<String> errMsgList) {
|
||||
List<MapSignalApproachSectionVO> signalApproachSectionList = logicData.getSignalApproachSectionList();
|
||||
for (MapSignalApproachSectionVO approachSectionVO : signalApproachSectionList) {
|
||||
Signal signal = (Signal) elementMap.get(approachSectionVO.getSignalCode());
|
||||
@ -650,7 +649,7 @@ public class InterlockBuilder2 {
|
||||
/**
|
||||
* 构建延续保护
|
||||
*/
|
||||
private static void buildOverlap(MapLogicDataNewVO logicData, Map<String, MapElement> elementMap, List<String> errMsgList, Map<String, RouteFls> flsMap) {
|
||||
public static void buildOverlap(MapLogicDataNewVO logicData, Map<String, MapElement> elementMap, List<String> errMsgList, Map<String, RouteFls> flsMap) {
|
||||
List<MapOverlapVO> overlapList = logicData.getOverlapList();
|
||||
for (MapOverlapVO mapOverlapVO : overlapList) {
|
||||
RouteOverlap routeOverlap = new RouteOverlap(mapOverlapVO.getCode(), mapOverlapVO.getName());
|
||||
@ -720,7 +719,7 @@ public class InterlockBuilder2 {
|
||||
}
|
||||
}
|
||||
|
||||
private static void buildOverrun(List<MapRouteOverrunVO> overrunList, Map<String, MapElement> elementMap, List<String> errMsgList) {
|
||||
public static void buildOverrun(List<MapRouteOverrunVO> overrunList, Map<String, MapElement> elementMap, List<String> errMsgList) {
|
||||
if (CollectionUtils.isEmpty(overrunList))
|
||||
return;
|
||||
for (MapRouteOverrunVO vo : overrunList) {
|
||||
@ -756,7 +755,7 @@ public class InterlockBuilder2 {
|
||||
}
|
||||
}
|
||||
|
||||
private static Map<String, RouteFls> checkAndBuildRouteFls(List<MapRouteFlankProtectionNewVO> flankProtectionList, Map<String, MapElement> elementMap) {
|
||||
public static Map<String, RouteFls> checkAndBuildRouteFls(List<MapRouteFlankProtectionNewVO> flankProtectionList, Map<String, MapElement> elementMap) {
|
||||
long start = System.currentTimeMillis();
|
||||
Map<String, RouteFls> map = new HashMap<>();
|
||||
for (MapRouteFlankProtectionNewVO fpVO : flankProtectionList) {
|
||||
@ -1128,7 +1127,7 @@ public class InterlockBuilder2 {
|
||||
return stationRunLevelList;
|
||||
}
|
||||
|
||||
private static void buildRoutePathFromStationRunLevel(MapCiGenerateConfig generateConfig, List<StationRunLevel> stationRunLevelList,
|
||||
private static void buildRoutePathFromStationRunLevel(List<StationRunLevel> stationRunLevelList,
|
||||
SimulationBuilder.SimulationDeviceBuildResult buildResult,
|
||||
List<String> errMsgList) {
|
||||
// long s = System.currentTimeMillis();
|
||||
@ -1599,7 +1598,7 @@ public class InterlockBuilder2 {
|
||||
return new SectionPath(sectionPathVO.isRight(), switchElementList, sectionList, logicList);
|
||||
}
|
||||
|
||||
private static void checkBetweenRouteSameDirectionSignal(Map<String, MapElement> elementMap, List<String> errMsgList) {
|
||||
public static void checkBetweenRouteSameDirectionSignal(Map<String, MapElement> elementMap, List<String> errMsgList) {
|
||||
long start = System.currentTimeMillis();
|
||||
InterlockBuilder2.log.debug("构建自动折返进路开始");
|
||||
if (!CollectionUtils.isEmpty(errMsgList)) { // 数据中本身存在错误,不检查
|
||||
@ -1646,7 +1645,7 @@ public class InterlockBuilder2 {
|
||||
* @param stationDirectionList 逻辑关联关系
|
||||
* @param elementMap 设备信息
|
||||
*/
|
||||
private static void buildStationDirectionLabelLogic(Map<String, MapElement> elementMap, List<String> errMsgList, List<DraftMapStationDirection> stationDirectionList) {
|
||||
public static void buildStationDirectionLabelLogic(Map<String, MapElement> elementMap, List<String> errMsgList, List<DraftMapStationDirection> stationDirectionList) {
|
||||
if (!CollectionUtils.isEmpty(stationDirectionList)) {
|
||||
// 过滤掉调车进路,调车进路不影响运行方向开关
|
||||
List<Route> routeList = elementMap.values().stream()
|
||||
|
@ -32,44 +32,6 @@ public class MemberManager {
|
||||
@Autowired
|
||||
private SimulationManager simulationManager;
|
||||
|
||||
/**
|
||||
* 初始化地铁成员
|
||||
*/
|
||||
public void addMetroMembers(Simulation simulation) {
|
||||
/* -----------默认创建一个行调,一个通号;车站和司机按设备创建----------- */
|
||||
// 调度
|
||||
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);
|
||||
}
|
||||
}
|
||||
// 司机
|
||||
List<VirtualRealityTrain> vrTrainList = simulation.getRepository().getAllVrTrain();
|
||||
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_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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化仿真成员
|
||||
*/
|
||||
@ -124,10 +86,10 @@ public class MemberManager {
|
||||
// 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.PARENT_DEPARTMENT);
|
||||
// // 派班员
|
||||
// this.addRole(simulation, SimulationMember.Type.SCHEDULING);
|
||||
// 车务段段长
|
||||
this.addRole(simulation, SimulationMember.Type.TRAIN_MASTER);
|
||||
}
|
||||
@ -182,9 +144,9 @@ public class MemberManager {
|
||||
String name, MapElement device) {
|
||||
switch (type) {
|
||||
case DISPATCHER:
|
||||
case SCHEDULING: {
|
||||
break;
|
||||
}
|
||||
// case SCHEDULING: {
|
||||
// break;
|
||||
// }
|
||||
case DEPOT_DISPATCHER: {
|
||||
if (Objects.isNull(device) ||
|
||||
!Objects.equals(device.getDeviceType(), MapElement.DeviceType.STATION) ||
|
||||
@ -305,38 +267,4 @@ public class MemberManager {
|
||||
this.cancelPlay(simulation, userId);
|
||||
}
|
||||
}
|
||||
|
||||
public void addRailMembers(Simulation simulation) {
|
||||
// 通号
|
||||
this.addRole(simulation, SimulationMember.Type.MAINTAINER);
|
||||
// 行值
|
||||
List<Station> stationList = simulation.getRepository().getSortedStationList();
|
||||
for (Station station : stationList) {
|
||||
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
|
||||
).forEach(type -> this.addRole(simulation, type, null, station));
|
||||
}
|
||||
// 调度台--调度关联
|
||||
List<DisStation> disStationList = simulation.getRepository().getDisStationList();
|
||||
if (null != disStationList) {
|
||||
for (DisStation disStation : disStationList) {
|
||||
this.addRole(simulation, SimulationMember.Type.DISPATCHER, disStation.getName() + "调度", disStation);
|
||||
}
|
||||
}
|
||||
// 司机
|
||||
List<VirtualRealityTrain> vrTrainList = simulation.getRepository().getAllVrTrain();
|
||||
for (VirtualRealityTrain vrTrain : vrTrainList) {
|
||||
this.addRole(simulation, SimulationMember.Type.DRIVER, null, vrTrain);
|
||||
}
|
||||
// 上级部门
|
||||
this.addRole(simulation, SimulationMember.Type.PARENT_DEPARTMENT);
|
||||
}
|
||||
}
|
||||
|
@ -141,88 +141,107 @@ public class SimulationMember extends club.joylink.rtss.simulation.SimulationMem
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 区域
|
||||
*/
|
||||
public interface Area {
|
||||
/** OCC(控制中心) */
|
||||
int OCC = 0;
|
||||
/** 车站 */
|
||||
int STATION = 1;
|
||||
/** 地铁车辆段/停车场 */
|
||||
int VEHICLE_DEPOT = 2;
|
||||
/** 列车上 */
|
||||
int TRAIN = 3;
|
||||
/** 大铁车务段 */
|
||||
int TRAIN_DEPOT = 4;
|
||||
}
|
||||
|
||||
/**
|
||||
* 仿真成员岗位
|
||||
*/
|
||||
public enum Type {
|
||||
/**
|
||||
* 车务段段长
|
||||
* 值班主任
|
||||
*/
|
||||
TRAIN_MASTER,
|
||||
SHIFT_MANAGER(Area.OCC),
|
||||
/**
|
||||
* 中心调度员
|
||||
*/
|
||||
DISPATCHER,
|
||||
DISPATCHER(Area.OCC),
|
||||
/**
|
||||
* 工电调度
|
||||
* 电力调度
|
||||
*/
|
||||
ELECTRIC_DISPATCHER,
|
||||
ELECTRIC_DISPATCHER(Area.OCC),
|
||||
/**
|
||||
* 环控调度
|
||||
*/
|
||||
ENVIRONMENT_DISPATCHER(Area.OCC),
|
||||
/**
|
||||
* 车辆段调度
|
||||
*/
|
||||
DEPOT_DISPATCHER,
|
||||
DEPOT_DISPATCHER(Area.VEHICLE_DEPOT),
|
||||
/**
|
||||
* 车站值班员
|
||||
*/
|
||||
STATION_SUPERVISOR,
|
||||
STATION_SUPERVISOR(Area.STATION),
|
||||
/**
|
||||
* 司机
|
||||
*/
|
||||
DRIVER,
|
||||
DRIVER(Area.TRAIN),
|
||||
/**
|
||||
* 通号
|
||||
*/
|
||||
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,
|
||||
MAINTAINER(Area.STATION),
|
||||
/**
|
||||
* 车辆段/停车场信号楼
|
||||
*/
|
||||
SIGNAL_BUILDING,
|
||||
SIGNAL_BUILDING(Area.VEHICLE_DEPOT),
|
||||
/**
|
||||
* 上级部门
|
||||
*/
|
||||
PARENT_DEPARTMENT,
|
||||
@Deprecated(since = "2022-10-17", forRemoval = true)
|
||||
PARENT_DEPARTMENT(Area.OCC),
|
||||
/**
|
||||
* 派班员
|
||||
*/
|
||||
SCHEDULING,
|
||||
@Deprecated(since = "2022-10-17", forRemoval = true)
|
||||
SCHEDULING(Area.OCC),
|
||||
|
||||
|
||||
/**
|
||||
* 车务段段长
|
||||
*/
|
||||
TRAIN_MASTER(Area.TRAIN_DEPOT),
|
||||
/**
|
||||
* 车站助理
|
||||
*/
|
||||
STATION_ASSISTANT,
|
||||
STATION_ASSISTANT(Area.STATION),
|
||||
/*** 车站站长 */
|
||||
STATION_MASTER,
|
||||
STATION_MASTER(Area.STATION),
|
||||
/**
|
||||
* 车站信号员
|
||||
*/
|
||||
STATION_SIGNALER,
|
||||
STATION_SIGNALER(Area.STATION),
|
||||
/**
|
||||
* 车站客运员
|
||||
*/
|
||||
STATION_PASSENGER,
|
||||
/*** 车站扳道员 */
|
||||
STATION_SWITCH_MAN,
|
||||
/*** 车站引导员 */
|
||||
STATION_FACILITATOR,
|
||||
/*** 车站工务工*/
|
||||
STATION_WORKER,
|
||||
/*** 设备管理员 **/
|
||||
DEVICE_MANAGER,
|
||||
STATION_PASSENGER(Area.STATION),
|
||||
/** 车站扳道员 */
|
||||
STATION_SWITCH_MAN(Area.STATION),
|
||||
/** 车站引导员 */
|
||||
STATION_FACILITATOR(Area.STATION),
|
||||
/** 车站工务工*/
|
||||
STATION_WORKER(Area.STATION),
|
||||
/** 设备管理员 */
|
||||
DEVICE_MANAGER(Area.STATION),
|
||||
;
|
||||
|
||||
private final int area;
|
||||
|
||||
Type(int area) {
|
||||
this.area = area;
|
||||
}
|
||||
}
|
||||
|
||||
public enum Gender {
|
||||
|
@ -1,12 +1,8 @@
|
||||
package club.joylink.rtss.simulation.cbtc.vo;
|
||||
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.NonNull;
|
||||
import lombok.Setter;
|
||||
import lombok.*;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
@ -21,13 +17,12 @@ import java.util.Map;
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SimulationWorkParamVO {
|
||||
@NotNull(message = "线路id不能为空")
|
||||
private Long mapId;
|
||||
|
||||
@NotNull(message = "仿真类型不能为空")
|
||||
private Simulation.Type type;
|
||||
|
||||
private UsageInfoVO usageInfo;
|
||||
private InitParamVO initParam;
|
||||
|
||||
/**
|
||||
* 仿真所使用的功能
|
||||
@ -35,34 +30,22 @@ public class SimulationWorkParamVO {
|
||||
@JsonInclude(value = JsonInclude.Include.NON_NULL)
|
||||
private Map<Simulation.Function, Map<String, Object>> functionMap;
|
||||
|
||||
public Simulation.Usage findUsage() {
|
||||
return usageInfo == null ? null : usageInfo.getUsage();
|
||||
}
|
||||
|
||||
public Simulation.Usage getUsage() {
|
||||
Simulation.Usage usage = findUsage();
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(usage, "仿真创建参数的使用方式不能为空");
|
||||
return usage;
|
||||
}
|
||||
/**
|
||||
* 前端控制元素显隐的配置(后端暂时用不到,所以先用Map接收)
|
||||
*/
|
||||
private DomConfigVO domConfig;
|
||||
|
||||
public void addFunctionInfos(@NonNull Map<Simulation.Function, Map<String, Object>> functionMap) {
|
||||
if (CollectionUtils.isEmpty(this.functionMap))
|
||||
if (CollectionUtils.isEmpty(this.functionMap)) {
|
||||
this.functionMap = new LinkedHashMap<>();
|
||||
}
|
||||
this.functionMap.putAll(functionMap);
|
||||
}
|
||||
|
||||
public void removeFunctions(Collection<Simulation.Function> functions) {
|
||||
if (!CollectionUtils.isEmpty(functionMap))
|
||||
if (!CollectionUtils.isEmpty(functionMap)) {
|
||||
functions.forEach(function -> functionMap.remove(function));
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public static class UsageInfoVO {
|
||||
private Simulation.Usage usage;
|
||||
|
||||
private UsageParamVO param;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -71,9 +54,23 @@ public class SimulationWorkParamVO {
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public static class UsageParamVO {
|
||||
@AllArgsConstructor
|
||||
public static class InitParamVO {
|
||||
private String memberId;
|
||||
|
||||
private Simulation.Client client;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class DomConfigVO {
|
||||
private boolean singleMember;
|
||||
|
||||
private boolean singleClient;
|
||||
|
||||
private boolean hasTraining;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,9 +10,12 @@ import club.joylink.rtss.simulation.cbtc.DeviceStatusService;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.SimulationIdGenerator;
|
||||
import club.joylink.rtss.simulation.cbtc.SimulationLifeCycleService;
|
||||
import club.joylink.rtss.simulation.cbtc.build.InterlockBuilder2;
|
||||
import club.joylink.rtss.simulation.cbtc.build.SimulationBuildParams;
|
||||
import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
|
||||
import club.joylink.rtss.simulation.cbtc.communication.Joylink3DMessageService;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.RouteFls;
|
||||
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;
|
||||
@ -24,6 +27,8 @@ import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.client.CommandDefinitionVO;
|
||||
import club.joylink.rtss.vo.client.simulationv1.RunAsPlanParam;
|
||||
import club.joylink.rtss.vo.map.MapGraphDataNewVO;
|
||||
import club.joylink.rtss.vo.map.MapLogicDataNewVO;
|
||||
import club.joylink.rtss.vo.map.MapVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -34,7 +39,6 @@ import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@ -167,26 +171,23 @@ public class RailwaySimulationWorkServiceImpl implements SimulationWorkService {
|
||||
|
||||
private void loadMapData(Simulation simulation) {
|
||||
SimulationBuildParams buildParams = simulation.getBuildParams();
|
||||
simulation.setBuildParams(buildParams);
|
||||
if (Objects.nonNull(buildParams.getLoginUserInfo())) {
|
||||
simulation.setCreatorId(buildParams.getLoginUserInfo().getAccountVO().getIdStr());
|
||||
simulation.setProject(buildParams.getLoginUserInfo().getProject());
|
||||
simulation.setProjectVO(buildParams.getLoginUserInfo().getProjectInfo());
|
||||
}
|
||||
// 线路配置参数
|
||||
simulation.getRepository().setConfig(SimulationBuilder.buildConfig(buildParams.getMap().getConfigVO(),
|
||||
buildParams.getMap().getGraphDataNew().getMapFunctionConfig()));
|
||||
MapVO map = buildParams.getMap();
|
||||
simulation.getRepository().setConfig(SimulationBuilder.buildConfig(map.getConfigVO(),
|
||||
map.getGraphDataNew().getMapFunctionConfig()));
|
||||
simulation.getRepository().getConfig()
|
||||
.setRouteLikeHa1(buildParams.getMap().getGraphDataNew().getGenerateConfig().isLikeHa1());
|
||||
.setRouteLikeHa1(map.getGraphDataNew().getGenerateConfig().isLikeHa1());
|
||||
simulation.getRepository().getConfig()
|
||||
.setOverlapSettingByTrigger(buildParams.getMap().getGraphDataNew().getGenerateConfig().isOverlapSettingByTrigger());
|
||||
.setOverlapSettingByTrigger(map.getGraphDataNew().getGenerateConfig().isOverlapSettingByTrigger());
|
||||
simulation.getRepository().getConfig()
|
||||
.setSharingECStations(buildParams.getMap().getGraphDataNew().getGenerateConfig().getSharingECStations());
|
||||
.setSharingECStations(map.getGraphDataNew().getGenerateConfig().getSharingECStations());
|
||||
simulation.getRepository().getConfig()
|
||||
.setHandleDepot(buildParams.getMap().getGraphDataNew().getGenerateConfig().isHandleDepot());
|
||||
.setHandleDepot(map.getGraphDataNew().getGenerateConfig().isHandleDepot());
|
||||
// 地图数据构建
|
||||
SimulationBuilder.SimulationDeviceBuildResult mapDataBuildResult = SimulationBuilder.checkAndBuildMapData(buildParams.getMap());
|
||||
|
||||
SimulationBuilder.SimulationDeviceBuildResult mapDataBuildResult = SimulationBuilder.checkAndBuildBasicMapData(map); //地图基础数据
|
||||
if (CollectionUtils.isEmpty(mapDataBuildResult.getErrMsgList())) {
|
||||
buildLogicData(map, mapDataBuildResult);
|
||||
}
|
||||
simulation.getRepository().setDeviceMap(mapDataBuildResult.getDeviceMap());
|
||||
simulation.getRepository().setSectionArriveNearMap(mapDataBuildResult.getSectionArriveNearMap());
|
||||
simulation.getRepository().setVrDeviceMap(mapDataBuildResult.getVrDeviceMap());
|
||||
@ -195,13 +196,46 @@ public class RailwaySimulationWorkServiceImpl implements SimulationWorkService {
|
||||
simulation.getRepository().getSectionRespondersMap().putAll(mapDataBuildResult.getSectionRespondersMap());
|
||||
if (!CollectionUtils.isEmpty(mapDataBuildResult.getErrMsgList())) { // 存在数据异常
|
||||
mapDataBuildResult.getErrMsgList().forEach(errMsg -> log.warn(String.format("地图数据异常:%s", errMsg)));
|
||||
// simulation.setMapDataError(true); //目前大铁线路缺少数据导致检验不通过;后续修改之后取消注释
|
||||
simulation.setMapDataError(true); //目前大铁线路缺少数据导致检验不通过;后续修改之后取消注释
|
||||
simulation.addDataErrMsgs(mapDataBuildResult.getErrMsgList());
|
||||
}
|
||||
SimulationBuilder.loadDepotInOutRoutePath(simulation);
|
||||
// CTC行车日志数据结构构建
|
||||
if (simulation.getRepository().getConfig().isRailway()) {
|
||||
SimulationBuilder.buildCtcStationRunPlanLog(simulation);
|
||||
}
|
||||
SimulationBuilder.buildCtcStationRunPlanLog(simulation);
|
||||
}
|
||||
|
||||
private void buildLogicData(MapVO map, SimulationBuilder.SimulationDeviceBuildResult mapDataBuildResult) {
|
||||
MapLogicDataNewVO logicData = map.getLogicDataNew();
|
||||
MapGraphDataNewVO graphData = map.getGraphDataNew();
|
||||
|
||||
Map<String, MapElement> elementMap = mapDataBuildResult.getDeviceMap();
|
||||
List<String> errMsgList = mapDataBuildResult.getErrMsgList();
|
||||
// ------------侧防start-------------
|
||||
Map<String, RouteFls> flsMap = InterlockBuilder2.checkAndBuildRouteFls(logicData.getFlankProtectionList(), elementMap);
|
||||
// ------------侧防end-------------
|
||||
|
||||
// ------------延续保护start-------------
|
||||
InterlockBuilder2.buildOverlap(logicData, elementMap, errMsgList, flsMap);
|
||||
// ------------延续保护end-------------
|
||||
//超限区段
|
||||
InterlockBuilder2.buildOverrun(logicData.getOverrunList(), elementMap, errMsgList);
|
||||
// 接近区段
|
||||
InterlockBuilder2.buildApproachSections(logicData, elementMap, errMsgList);
|
||||
// ------------进路start-------------
|
||||
InterlockBuilder2.buildRailRoute(graphData, logicData, elementMap, errMsgList, flsMap);
|
||||
// ------------进路end-------------
|
||||
|
||||
// ------------自动信号start-------------
|
||||
InterlockBuilder2.buildAutoSignal(logicData, elementMap, errMsgList);
|
||||
// ------------自动信号end-------------
|
||||
|
||||
// ------------自动折返进路start-------------
|
||||
InterlockBuilder2.buildAutoReentry(logicData, elementMap, errMsgList);
|
||||
// ------------自动折返进路end-------------
|
||||
|
||||
InterlockBuilder2.checkBetweenRouteSameDirectionSignal(elementMap, errMsgList);
|
||||
|
||||
// 处理指示灯、按钮逻辑信息
|
||||
InterlockBuilder2.buildStationDirectionLabelLogic(elementMap, errMsgList, logicData.getDraftMapStationDirectionList());
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,6 @@ public interface SimulationWorkService {
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(workParamVO, "仿真工作参数不能为空");
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(workParamVO.getMapId(), "仿真线路id不能为空");
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(workParamVO.getType(), "仿真类型不能为空");
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(workParamVO.findUsage(), "仿真用途不能为空");
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotTrue(!CollectionUtils.isEmpty(workParamVO.getFunctionMap())
|
||||
&& workParamVO.getFunctionMap().size() > 1, "功能数量超限");
|
||||
}
|
||||
|
@ -70,8 +70,6 @@ public class SimulationWorkServiceManager implements ApplicationContextAware {
|
||||
}
|
||||
memberManager.addRole(simulation, memberVO.getType(), memberVO.getName(), mapElement);
|
||||
}
|
||||
if (!dataErrMsgList.isEmpty())
|
||||
simulation.setMapDataError(true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -79,28 +77,10 @@ public class SimulationWorkServiceManager implements ApplicationContextAware {
|
||||
*/
|
||||
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) {
|
||||
SimulationWorkParamVO.InitParamVO initParamVO = workParamVO.getInitParam();
|
||||
if (initParamVO != null && initParamVO.getMemberId() != null) {
|
||||
Long creatorId = simulation.getBuildParams().getLoginUserInfo().getAccountVO().getId();
|
||||
memberManager.playRole(simulation, creatorId, usageParamVO.getMemberId());
|
||||
memberManager.playRole(simulation, creatorId, initParamVO.getMemberId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ public class MapSystemCreateVO {
|
||||
mapSystemNew.setName(name);
|
||||
mapSystemNew.setDesc(desc);
|
||||
mapSystemNew.setType(paramVO.getType().name());
|
||||
mapSystemNew.setUsage(paramVO.getUsage().name());
|
||||
mapSystemNew.setParam(JsonUtils.writeValueAsString(paramVO));
|
||||
return mapSystemNew;
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
package club.joylink.rtss.vo.client.mapSystem;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 地图子系统自动生成的参数
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class MapSystemGenerateParamVO {
|
||||
/** 要生成子系统的仿真系统类型 */
|
||||
@NotEmpty(message = "要生成子系统的仿真系统类型不能为空")
|
||||
private List<Simulation.Type> simTypes;
|
||||
}
|
@ -26,7 +26,6 @@ public class MapSystemUpdateVO {
|
||||
entity.setName(name);
|
||||
entity.setDesc(desc);
|
||||
entity.setType(paramVO.getType().name());
|
||||
entity.setUsage(paramVO.getUsage().name());
|
||||
entity.setParam(JsonUtils.writeValueAsString(paramVO));
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import club.joylink.rtss.util.JsonUtils;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@ -42,7 +43,9 @@ public class RtsMapSystemVO {
|
||||
name = entity.getName();
|
||||
desc = entity.getDesc();
|
||||
simType = Simulation.Type.valueOf(entity.getType());
|
||||
simUsage = Simulation.Usage.valueOf(entity.getUsage());
|
||||
if (StringUtils.hasText(entity.getUsage())) {
|
||||
simUsage = Simulation.Usage.valueOf(entity.getUsage());
|
||||
}
|
||||
paramVO = JsonUtils.read(entity.getParam(), SimulationWorkParamVO.class);
|
||||
creatorId = entity.getCreatorId();
|
||||
createTime = entity.getCreateTime();
|
||||
|
Loading…
Reference in New Issue
Block a user