【草稿发布功能修改】

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

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

View File

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

View File

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