【草稿发布功能修改】

【仿真数据加载逻辑修改】

Signed-off-by: weizhihong <weizhihong@joylink.club>
This commit is contained in:
weizhihong 2022-04-24 13:02:08 +08:00
parent 9d7a9422d0
commit ce25b8458d
3 changed files with 35 additions and 37 deletions

View File

@ -97,8 +97,11 @@ public class DraftMapService implements IDraftMapService {
@Autowired @Autowired
private DraftMapRouteService draftMapRouteService; private DraftMapRouteService draftMapRouteService;
@Autowired
private IAssistButtonIndicatorService assistButtonIndicatorService;
@Override @Override
public List<DraftMapVO> list( AccountVO accountVO) { public List<DraftMapVO> list(AccountVO accountVO) {
DraftMapExample example = new DraftMapExample(); DraftMapExample example = new DraftMapExample();
DraftMapExample.Criteria criteria = example.createCriteria(); DraftMapExample.Criteria criteria = example.createCriteria();
if (Objects.nonNull(accountVO)) { if (Objects.nonNull(accountVO)) {
@ -151,9 +154,9 @@ public class DraftMapService implements IDraftMapService {
// 名称唯一性校验 // 名称唯一性校验
confirmDraftMapNameNotExist(draftMap); confirmDraftMapNameNotExist(draftMap);
draftMap.setUpdateTime(LocalDateTime.now()); draftMap.setUpdateTime(LocalDateTime.now());
MapGraphDataNewVO graphDataVO = new MapGraphDataNewVO(); MapGraphDataNewVO graphDataVO = new MapGraphDataNewVO();
graphDataVO.setSkinVO(iRealLineService.get(draftMapVo.getLineCode())); graphDataVO.setSkinVO(iRealLineService.get(draftMapVo.getLineCode()));
draftMap.setGraphData(JsonUtils.writeValueAsString(graphDataVO)); draftMap.setGraphData(JsonUtils.writeValueAsString(graphDataVO));
draftMapDAO.insert(draftMap); draftMapDAO.insert(draftMap);
return draftMap.getId().toString(); return draftMap.getId().toString();
} }
@ -189,7 +192,7 @@ public class DraftMapService implements IDraftMapService {
confirmDraftMapNameNotExist(draftMap); confirmDraftMapNameNotExist(draftMap);
// 插入新副本 // 插入新副本
draftMapDAO.insert(draftMap); draftMapDAO.insert(draftMap);
saveMapLogicDataNew(draftMap, getMapLogicDataNew(id)); saveMapLogicDataNew(draftMap, getMapLogicDataNew(id));
// 3d数据处理 // 3d数据处理
Map3dDataVO map3dDataVO = find3dMapDataByMapId(id); Map3dDataVO map3dDataVO = find3dMapDataByMapId(id);
if (Objects.nonNull(map3dDataVO)) { if (Objects.nonNull(map3dDataVO)) {
@ -207,13 +210,13 @@ public class DraftMapService implements IDraftMapService {
public MapGraphDataNewVO getMapShapeData(Long id) { public MapGraphDataNewVO getMapShapeData(Long id) {
DraftMapWithBLOBs draftMap = draftMapDAO.selectByPrimaryKey(id); DraftMapWithBLOBs draftMap = draftMapDAO.selectByPrimaryKey(id);
String shapeData = draftMap.getGraphData(); String shapeData = draftMap.getGraphData();
MapGraphDataNewVO mapGraphDataNewVO; MapGraphDataNewVO mapGraphDataNewVO;
if (!StringUtils.hasText(shapeData)) { if (!StringUtils.hasText(shapeData)) {
mapGraphDataNewVO = new MapGraphDataNewVO(); mapGraphDataNewVO = new MapGraphDataNewVO();
} else { } else {
mapGraphDataNewVO = JsonUtils.read(shapeData, MapGraphDataNewVO.class); mapGraphDataNewVO = JsonUtils.read(shapeData, MapGraphDataNewVO.class);
} }
return mapGraphDataNewVO; return mapGraphDataNewVO;
} }
@Override @Override
@ -505,6 +508,9 @@ public class DraftMapService implements IDraftMapService {
flankProtectionExample.createCriteria().andMapIdEqualTo(id); flankProtectionExample.createCriteria().andMapIdEqualTo(id);
List<DraftMapRouteFlankProtection> draftMapRouteFlankProtections = this.draftMapRouteFlankProtectionDAO.selectByExampleWithBLOBs(flankProtectionExample); List<DraftMapRouteFlankProtection> draftMapRouteFlankProtections = this.draftMapRouteFlankProtectionDAO.selectByExampleWithBLOBs(flankProtectionExample);
logicDataVO.setFlankProtectionList(MapRouteFlankProtectionNewVO.convert2VOList(draftMapRouteFlankProtections)); logicDataVO.setFlankProtectionList(MapRouteFlankProtectionNewVO.convert2VOList(draftMapRouteFlankProtections));
// 获取指示灯按钮等关联关系
logicDataVO.setIndicatorButtonVOList(assistButtonIndicatorService.queryAllIndicatorSectionByMapId(id));
return logicDataVO; return logicDataVO;
} }
@ -1192,23 +1198,23 @@ public class DraftMapService implements IDraftMapService {
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(ifRoutingDataExist(routingVO, null), BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(ifRoutingDataExist(routingVO, null),
"对应回路已经存在"); "对应回路已经存在");
MapDataVO mapData = this.iDraftMapService.getMapData(routingVO.getMapId()); MapDataVO mapData = this.iDraftMapService.getMapData(routingVO.getMapId());
MapVO map = new MapVO(); MapVO map = new MapVO();
map.setMapData(mapData); map.setMapData(mapData);
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map); SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(CollectionUtils.isEmpty(buildResult.getErrMsgList()), BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(CollectionUtils.isEmpty(buildResult.getErrMsgList()),
"地图基础数据校验不通过,不能生成"); "地图基础数据校验不通过,不能生成");
Section startSection = (Section) buildResult.getDeviceMap().get(routingVO.getStartSectionCode()); Section startSection = (Section) buildResult.getDeviceMap().get(routingVO.getStartSectionCode());
Section endSection = (Section) buildResult.getDeviceMap().get(routingVO.getEndSectionCode()); Section endSection = (Section) buildResult.getDeviceMap().get(routingVO.getEndSectionCode());
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(Objects.isNull(startSection) || Objects.isNull(endSection), BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(Objects.isNull(startSection) || Objects.isNull(endSection),
String.format("站间从区段code[%s]——至区段code[%s],两个区段中某个区段不存在", routingVO.getStartSectionCode(), routingVO.getEndSectionCode())); String.format("站间从区段code[%s]——至区段code[%s],两个区段中某个区段不存在", routingVO.getStartSectionCode(), routingVO.getEndSectionCode()));
//中间经停所有站台轨 //中间经停所有站台轨
List<Section> passingStandTrack = CalculateService.findPassingStandTrack(startSection, endSection, routingVO.getRight()); List<Section> passingStandTrack = CalculateService.findPassingStandTrack(startSection, endSection, routingVO.getRight());
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotNull(passingStandTrack, BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotNull(passingStandTrack,
"没有找到对应方向的中间经停区段,是否可手动添加或者直接保存交路"); "没有找到对应方向的中间经停区段,是否可手动添加或者直接保存交路");
LinkedList<MapRoutingSectionNewVO> parkSectionCodeList = passingStandTrack.stream().map(section -> new MapRoutingSectionNewVO(section.getStation().getCode(), section.getCode())).collect(Collectors.toCollection(LinkedList::new)); LinkedList<MapRoutingSectionNewVO> parkSectionCodeList = passingStandTrack.stream().map(section -> new MapRoutingSectionNewVO(section.getStation().getCode(), section.getCode())).collect(Collectors.toCollection(LinkedList::new));
parkSectionCodeList.addFirst(new MapRoutingSectionNewVO(routingVO.getStartStationCode(), routingVO.getStartSectionCode())); parkSectionCodeList.addFirst(new MapRoutingSectionNewVO(routingVO.getStartStationCode(), routingVO.getStartSectionCode()));
parkSectionCodeList.addLast(new MapRoutingSectionNewVO(routingVO.getEndStationCode(), routingVO.getEndSectionCode())); parkSectionCodeList.addLast(new MapRoutingSectionNewVO(routingVO.getEndStationCode(), routingVO.getEndSectionCode()));
routingVO.setParkSectionCodeList(parkSectionCodeList); routingVO.setParkSectionCodeList(parkSectionCodeList);
return routingVO; return routingVO;
} }

View File

@ -2,7 +2,6 @@ package club.joylink.rtss.services.draftData;
import club.joylink.rtss.dao.*; import club.joylink.rtss.dao.*;
import club.joylink.rtss.entity.*; import club.joylink.rtss.entity.*;
import club.joylink.rtss.services.IAssistButtonIndicatorService;
import club.joylink.rtss.util.JsonUtils; import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.map.MapLogicDataNewVO; import club.joylink.rtss.vo.map.MapLogicDataNewVO;
import club.joylink.rtss.vo.map.MapVO; import club.joylink.rtss.vo.map.MapVO;
@ -54,9 +53,6 @@ public class DraftMapServiceImpl implements DraftMapService {
@Autowired @Autowired
private DraftMapSignalApproachSectionService draftMapSignalApproachSectionService; private DraftMapSignalApproachSectionService draftMapSignalApproachSectionService;
@Autowired
private IAssistButtonIndicatorService assistButtonIndicatorService;
@Override @Override
public MapVO getDraftMapData(Long mapId) { public MapVO getDraftMapData(Long mapId) {
DraftMapWithBLOBs draftMap = draftMapDAO.selectByPrimaryKey(mapId); DraftMapWithBLOBs draftMap = draftMapDAO.selectByPrimaryKey(mapId);
@ -80,8 +76,6 @@ public class DraftMapServiceImpl implements DraftMapService {
// logicDataNew.setRoutingList(); 待补 // logicDataNew.setRoutingList(); 待补
logicDataNew.setSignalApproachSectionList(draftMapSignalApproachSectionService.queryAll(mapId)); logicDataNew.setSignalApproachSectionList(draftMapSignalApproachSectionService.queryAll(mapId));
// 获取指示灯按钮等关联关系
logicDataNew.setIndicatorButtonVOList(assistButtonIndicatorService.queryAllIndicatorSectionByMapId(mapId));
map.setLogicDataNew(logicDataNew); map.setLogicDataNew(logicDataNew);
return map; return map;
} }

View File

@ -149,8 +149,6 @@ public class SimulationLifeCycleServiceImpl implements SimulationLifeCycleServic
queryVO.setMapId(params.getMap().getId()); queryVO.setMapId(params.getMap().getId());
List<IscsSystemResourcesVO> resourceList = iscsSystemResourcesService.criteriaQuery(queryVO); List<IscsSystemResourcesVO> resourceList = iscsSystemResourcesService.criteriaQuery(queryVO);
params.getMap().setIscsSystemResourceList(resourceList); params.getMap().setIscsSystemResourceList(resourceList);
// 获取指示灯按钮等关联关系
params.getMap().getLogicDataNew().setIndicatorButtonVOList(assistButtonIndicatorService.queryAllIndicatorSectionByMapId(params.getMap().getId()));
Simulation simulation = SimulationBuilder.build(group, params); Simulation simulation = SimulationBuilder.build(group, params);
// 缓存 // 缓存