Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
67ac1683c4
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import club.joylink.rtss.simulation.cbtc.CI.device.CiRouteService;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Button;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Indicator;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Route;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Station;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||
@ -20,7 +19,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
@ -100,48 +98,25 @@ public class AssistService {
|
||||
Indicator receiveIndicator = getStationIndicatorByType(curStation, labelEnum, IndicatorTypeEnum.RECEIVE);
|
||||
// 获取发车指示灯
|
||||
Indicator deliverIndicator = getStationIndicatorByType(curStation, labelEnum, IndicatorTypeEnum.DELIVER);
|
||||
if (receiveIndicator == null || deliverIndicator == null) {
|
||||
return;
|
||||
}
|
||||
// 接车进路
|
||||
Route receiveRoute = receiveIndicator.getRoute();
|
||||
// 发车进路
|
||||
Route deliverRoute = deliverIndicator.getRoute();
|
||||
IndicatorStatusEnum receiveStatus;
|
||||
IndicatorStatusEnum deliverStatus;
|
||||
// X、S 优先判断发车灯
|
||||
if (DirectionLabelEnum.X.equals(labelEnum) || DirectionLabelEnum.S.equals(labelEnum)) {
|
||||
// 当发车进路办理时,必须亮起发车灯
|
||||
if (deliverRoute.isLock()) {
|
||||
deliverIndicator.setOn(true);
|
||||
receiveIndicator.setOn(false);
|
||||
deliverStatus = IndicatorStatusEnum.R;
|
||||
receiveStatus = IndicatorStatusEnum.No;
|
||||
// 如果都没有亮
|
||||
if (deliverIndicator != null && receiveIndicator != null && !deliverIndicator.isOn() && !receiveIndicator.isOn()) {
|
||||
if (DirectionLabelEnum.X.equals(labelEnum) || DirectionLabelEnum.S.equals(labelEnum)) {
|
||||
receiveIndicator.setOn(true);
|
||||
} else {
|
||||
// 发车灯自身亮、并且发车进路并没锁闭、接车进路也没办理,说明刚完成改方操作
|
||||
if (deliverIndicator.isOn() && !deliverRoute.isLock() && !receiveRoute.isLock()) {
|
||||
deliverIndicator.setOn(true);
|
||||
receiveIndicator.setOn(false);
|
||||
deliverStatus = IndicatorStatusEnum.G;
|
||||
receiveStatus = IndicatorStatusEnum.No;
|
||||
} else { // 其他操作均已接车灯为主
|
||||
deliverIndicator.setOn(false);
|
||||
receiveIndicator.setOn(true);
|
||||
deliverStatus = IndicatorStatusEnum.No;
|
||||
receiveStatus = IndicatorStatusEnum.Y;
|
||||
}
|
||||
deliverIndicator.setOn(true);
|
||||
}
|
||||
} else {
|
||||
// 如果接车灯不亮就发车灯亮
|
||||
receiveIndicator.setOn(receiveRoute.isLock());
|
||||
deliverIndicator.setOn(!receiveRoute.isLock());
|
||||
deliverStatus = deliverIndicator.isOn() ? IndicatorStatusEnum.G : IndicatorStatusEnum.No;
|
||||
receiveStatus = receiveIndicator.isOn() ? IndicatorStatusEnum.Y : IndicatorStatusEnum.No;
|
||||
}
|
||||
receiveIndicator.setAspect(receiveStatus);
|
||||
deliverIndicator.setAspect(deliverStatus);
|
||||
IndicatorStatusEnum receiveStatus = getRDIndicatorStatusEnum(receiveIndicator, deliverIndicator);
|
||||
IndicatorStatusEnum deliverStatus = getRDIndicatorStatusEnum(deliverIndicator, receiveIndicator);
|
||||
if (receiveIndicator != null) {
|
||||
receiveIndicator.setAspect(receiveStatus);
|
||||
}
|
||||
if (deliverIndicator != null) {
|
||||
deliverIndicator.setAspect(deliverStatus);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 改方按钮按下校验
|
||||
*/
|
||||
@ -149,19 +124,25 @@ public class AssistService {
|
||||
if (button == null) {
|
||||
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:按钮不存在");
|
||||
}
|
||||
List<Station> stationList = simulation.getRepository().getStationList();
|
||||
// 当前站位置
|
||||
int index = stationList.indexOf(button.getStation());
|
||||
// 检查是否是首站
|
||||
if (index == 0 || index == stationList.size() - 1) {
|
||||
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:首站不可改方");
|
||||
}
|
||||
// 由数据控制,不做逻辑判断
|
||||
// List<Station> stationList = simulation.getRepository().getStationList();
|
||||
// // 当前站位置
|
||||
// int index = stationList.indexOf(button.getStation());
|
||||
// // 检查是否是首站
|
||||
// if (index == 0 || index == stationList.size() - 1) {
|
||||
// throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:首站不可改方");
|
||||
// }
|
||||
// 获取区间指示灯
|
||||
Indicator sectionIndicator = getStationIndicatorByType(button.getStation(), button.getLabel(), IndicatorTypeEnum.SECTION);
|
||||
// 获取区间路径,判断本站台与相邻站台是否空闲
|
||||
if (IndicatorStatusEnum.R.equals(sectionIndicator.getAspect())) {
|
||||
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:区段非空闲");
|
||||
}
|
||||
// 判断接车灯进路是否办理
|
||||
Indicator receiveIndicator = getStationIndicatorByType(button.getStation(), button.getLabel(), IndicatorTypeEnum.RECEIVE);
|
||||
if (receiveIndicator.getRoute().isLock()) {
|
||||
throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:进路冲突");
|
||||
}
|
||||
// 获取靠停列车
|
||||
VirtualRealityTrain train = getSandStopTrain(simulation, button.getStand().getSection().getCode());
|
||||
if (train == null || !train.isStop()) {
|
||||
@ -283,4 +264,28 @@ public class AssistService {
|
||||
}
|
||||
return train;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取接发车指示灯状态
|
||||
*
|
||||
* @param indicator 指示灯
|
||||
* @param mutexIndicator 同组指示灯,接-发
|
||||
* @return 点灯状态
|
||||
*/
|
||||
private IndicatorStatusEnum getRDIndicatorStatusEnum(Indicator indicator, Indicator mutexIndicator) {
|
||||
if (indicator == null) {
|
||||
return IndicatorStatusEnum.No;
|
||||
}
|
||||
boolean isLock = indicator.getRoute() != null && indicator.getRoute().isLock();
|
||||
if (isLock) {
|
||||
indicator.setOn(true);
|
||||
if (mutexIndicator != null) {
|
||||
mutexIndicator.setOn(false);
|
||||
}
|
||||
}
|
||||
IndicatorStatusEnum statusEnum = indicator.isOn() ?
|
||||
(isLock ? IndicatorStatusEnum.R : indicator.getDefaultStatus())
|
||||
: IndicatorStatusEnum.No;
|
||||
return statusEnum;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
// 缓存
|
||||
|
@ -57,7 +57,7 @@ public class Indicator extends MapNamedElement {
|
||||
|
||||
public Indicator(String code, String name) {
|
||||
super(code, name, DeviceType.INDICATOR);
|
||||
on = Boolean.FALSE;
|
||||
on = false;
|
||||
}
|
||||
|
||||
protected Indicator(String code, String name, DeviceType deviceType) {
|
||||
@ -66,7 +66,7 @@ public class Indicator extends MapNamedElement {
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
on = Boolean.FALSE;
|
||||
on = false;
|
||||
aspect = getDefaultStatus();
|
||||
}
|
||||
|
||||
@ -77,10 +77,10 @@ public class Indicator extends MapNamedElement {
|
||||
*/
|
||||
public IndicatorStatusEnum getDefaultStatus() {
|
||||
// 接
|
||||
if ((DirectionLabelEnum.S.equals(label) || DirectionLabelEnum.X.equals(label)) && IndicatorTypeEnum.RECEIVE.equals(type)) {
|
||||
if (IndicatorTypeEnum.RECEIVE.equals(type)) {
|
||||
return IndicatorStatusEnum.Y;
|
||||
// 发
|
||||
} else if ((DirectionLabelEnum.XF.equals(label) || DirectionLabelEnum.SF.equals(label)) && IndicatorTypeEnum.DELIVER.equals(type)) {
|
||||
} else if (IndicatorTypeEnum.DELIVER.equals(type)) {
|
||||
return IndicatorStatusEnum.G;
|
||||
} else {
|
||||
return IndicatorStatusEnum.No;
|
||||
|
Loading…
Reference in New Issue
Block a user