设置人工车时,列车在停止状态下才清除target;添加创建进路接口;列车最大速度降低至80km/h

This commit is contained in:
joylink_zhangsai 2021-08-03 13:58:39 +08:00
parent 6840372770
commit 0296d007ab
6 changed files with 39 additions and 62 deletions

View File

@ -52,4 +52,9 @@ public class DraftMapRouteController {
public void setSetOverlapInCtcFalse(@PathVariable Long id) {
this.draftMapRouteService.setSetOverlapInCtcFalse(id);
}
@PostMapping("")
public void createRoute(@PathVariable Long id, @RequestBody MapRouteNewVO routeNewVO) {
this.draftMapRouteService.createRoute(id, routeNewVO);
}
}

View File

@ -20,4 +20,6 @@ public interface DraftMapRouteService {
void deleteStandHoldList(Long mapId);
void setSetOverlapInCtcFalse(Long mapId);
void createRoute(long draftMapId, MapRouteNewVO routeNewVO);
}

View File

@ -39,10 +39,7 @@ public class DraftMapRouteServiceImpl implements DraftMapRouteService {
@Override
public MapRouteNewVO createRailwayRoute(Long id, MapRouteNewVO routeNewVO) {
DraftMapRouteExample example = new DraftMapRouteExample();
example.createCriteria()
.andMapIdEqualTo(id);
List<DraftMapRoute> routeList = this.draftMapRouteDAO.selectByExampleWithBLOBs(example);
List<DraftMapRoute> routeList = findEntitiesByMapId(id);
Map<String, MapRouteNewVO> routeVOMap = routeList.stream()
.map(draftMapRoute -> MapRouteNewVO.convert2VO(draftMapRoute))
.collect(Collectors.toMap(MapRouteNewVO::getCode, Function.identity()));
@ -97,11 +94,15 @@ public class DraftMapRouteServiceImpl implements DraftMapRouteService {
@Override
public List<MapRouteNewVO> queryAllRoutes(Long id) {
List<DraftMapRoute> routeList = findEntitiesByMapId(id);
return MapRouteNewVO.convertDraft2VOList(routeList);
}
private List<DraftMapRoute> findEntitiesByMapId(Long mapId) {
DraftMapRouteExample example = new DraftMapRouteExample();
example.createCriteria()
.andMapIdEqualTo(id);
List<DraftMapRoute> routeList = this.draftMapRouteDAO.selectByExampleWithBLOBs(example);
return MapRouteNewVO.convertDraft2VOList(routeList);
.andMapIdEqualTo(mapId);
return this.draftMapRouteDAO.selectByExampleWithBLOBs(example);
}
@Override
@ -131,10 +132,7 @@ public class DraftMapRouteServiceImpl implements DraftMapRouteService {
public void deleteRoute(Long id, String code) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(code,
String.format("code不能为空"));
DraftMapRouteExample example = new DraftMapRouteExample();
example.createCriteria()
.andMapIdEqualTo(id);
List<DraftMapRoute> routeList = this.draftMapRouteDAO.selectByExampleWithBLOBs(example);
List<DraftMapRoute> routeList = findEntitiesByMapId(id);
Map<String, MapRouteNewVO> routeVOMap = routeList.stream()
.map(draftMapRoute -> MapRouteNewVO.convert2VO(draftMapRoute))
.collect(Collectors.toMap(MapRouteNewVO::getCode, Function.identity()));
@ -172,4 +170,23 @@ public class DraftMapRouteServiceImpl implements DraftMapRouteService {
update(mapId, route.getCode(), route);
});
}
@Override
public void createRoute(long draftMapId, MapRouteNewVO routeNewVO) {
List<DraftMapRoute> routes = findEntitiesByMapId(draftMapId);
String prefix_route = DraftMapCiDataGeneratorImpl.CodeGenerator.Prefix_Route;
DraftMapCiDataGeneratorImpl.CodeGenerator routeCodeGenerator;
if (CollectionUtils.isEmpty(routes)) {
routeCodeGenerator = DraftMapCiDataGeneratorImpl.CodeGenerator.getRouteCodeGenerator(0);
} else {
Integer sn = routes.stream()
.map(DraftMapRoute::getCode)
.map(c -> Integer.parseInt(c.replace(prefix_route, "")))
.max(Integer::compareTo).get();
routeCodeGenerator = DraftMapCiDataGeneratorImpl.CodeGenerator.getRouteCodeGenerator(sn);
}
String code = routeCodeGenerator.next();
routeNewVO.setCode(code);
draftMapRouteDAO.insert(routeNewVO.convert2Draft());
}
}

View File

@ -146,55 +146,6 @@ public class AtsRouteSettingService {
}
}
}
// // 如果已经到达目的地返回
// if (Objects.equals(headSection, destDefinition.getSection())) {
// return null;
// }
// // 目的地定义存在根据目的地定义查询路径办理进路
// // 判断是否终点站折返办理
// if (train.isParking() && destDefinition.isLoop()) { // 列车停车且目的地为环路运营
// Section section = destDefinition.getEndStationParkSection(right);
// if (Objects.equals(section, headSection)) { // 列车停靠终点站对应站台
// Station station = destDefinition.getStationOf(right);
// if (destDefinition.isFrontTurnBack(station)) { // 站前折返
// neededSignal = section.getSignalOf(!right);
// List<RoutePath> paths = repository.queryRoutePathsByStart(section);
// for (RoutePath path : paths) { // 筛选方向一致且终端区段是站台轨的
// if (Objects.equals(path.isRight(), !right) && path.getEnd().isNormalStandTrack()) {
// routePaths.add(path);
// }
// }
// } else { // 站后折返
// train.startTurnBack(null);
// StationTurnBackStrategyOption strategy = null;
// if (Objects.nonNull(station.getTbStrategyId())) {
// strategy = station.getCurrentTurnBackStrategy();
// }
// return this.selectTbRouteByStrategy(simulation, train, signal, null, strategy, trainList);
// }
// }
// }
// // 非终点折返办理根据列车预计到站查询
// if (Objects.nonNull(train.getEstimatedArriveStandTrack())) {
// // 查询到达预计到站的路径
// Section eaStandSection = repository.getByCode(train.getEstimatedArriveStandTrack(), Section.class);
// List<RoutePath> paths = repository.queryRoutePathsByEnd(eaStandSection);
// for (RoutePath path : paths) {
// if (path.containsSection(headSection) && path.isRight() == right) {
// routePaths.add(path);
// }
// }
// // 如果预计到达不是终点尝试查询从预计到达开始的路径
// if (!destDefinition.isEndSection(eaStandSection, right)) {
// List<RoutePath> pathList = repository.queryRoutePathsByStart(eaStandSection);
// for (RoutePath routePath : pathList) {
// if (destDefinition.containsSection(routePath.getEnd(), right)) {
// routePaths.add(routePath);
// }
// }
// }
// }
} else {
// 按交路查询办理如果找到才办理
Routing routing = train.getRouting();

View File

@ -345,7 +345,9 @@ public class AtsTrainService {
// this.onboardAtpApiService.change2Manual(simulation, groupNumber);
supervisedTrain.change2Manual();
VirtualRealityTrain train = repository.getOnlineTrainBy(groupNumber);
train.setTarget(null);
if (train.isStop()) {
train.setTarget(null);
}
}
/**

View File

@ -73,7 +73,7 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
/**
* 列车前进最大速度
*/
private float speedMax = (float) (100 / 3.6);
private float speedMax = (float) (80 / 3.6);
/**
* 列车倒车最大速度