站间运行等级和停站时间数据创建、修改流程

This commit is contained in:
walker-sheng 2021-05-24 10:43:36 +08:00
parent 910aeab327
commit 79dca6bd8d
32 changed files with 684 additions and 289 deletions

3
sql/20210520-sheng.sql Normal file
View File

@ -0,0 +1,3 @@
ALTER TABLE `draft_map_parking_time`
CHANGE COLUMN `section_parking_time` `section_code` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '区段code' AFTER `station_code`,
ADD COLUMN `parking_time` int NOT NULL COMMENT '停站时间' AFTER `section_code`;

View File

@ -0,0 +1,34 @@
package club.joylink.rtss.controller.draft;
import club.joylink.rtss.services.draftData.ParkTimeService;
import club.joylink.rtss.vo.client.map.newmap.MapStationParkingTimeVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api/draftMap/{mapId}/parkTime")
@Slf4j
public class DraftMapParkTimeController {
@Autowired
private ParkTimeService parkTimeService;
@PostMapping("/generate")
public List<MapStationParkingTimeVO> generate(@PathVariable Long mapId) {
return this.parkTimeService.generate(mapId);
}
@GetMapping("/all")
public List<MapStationParkingTimeVO> queryAll(@PathVariable Long mapId) {
return this.parkTimeService.queryAll(mapId);
}
@PutMapping("/{id}")
public void update(@PathVariable Long mapId, @PathVariable Long id, @RequestBody MapStationParkingTimeVO parkingTimeVO) {
this.parkTimeService.update(mapId, id, parkingTimeVO);
}
}

View File

@ -0,0 +1,34 @@
package club.joylink.rtss.controller.draft;
import club.joylink.rtss.services.draftData.RunLevelService;
import club.joylink.rtss.vo.client.map.newmap.MapStationRunLevelVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api/draftMap/{mapId}/runLevel")
@Slf4j
public class DraftMapRunLevelController {
@Autowired
private RunLevelService runLevelService;
@PostMapping("/generate")
public List<MapStationRunLevelVO> generate(@PathVariable Long mapId) {
return this.runLevelService.generate(mapId);
}
@GetMapping("/all")
public List<MapStationRunLevelVO> queryAll(@PathVariable Long mapId) {
return this.runLevelService.queryAll(mapId);
}
@PutMapping("/{id}")
public void update(@PathVariable Long mapId, @PathVariable Long id, @RequestBody MapStationRunLevelVO runLevelVO) {
this.runLevelService.update(mapId, id, runLevelVO);
}
}

View File

@ -7,7 +7,6 @@ import club.joylink.rtss.services.IRunPlanDraftService;
import club.joylink.rtss.services.runplan.IRunPlanRoutingService;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.map.newmap.MapStationParkingTimeVO;
import club.joylink.rtss.vo.client.map.newmap.MapStationRunLevelVO;
import club.joylink.rtss.vo.client.runplan.*;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingSection;
@ -15,7 +14,6 @@ import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingVO;
import club.joylink.rtss.vo.client.validGroup.RunPlanCreateCheck;
import club.joylink.rtss.vo.client.validGroup.RunPlanNameCheck;
import club.joylink.rtss.vo.client.validGroup.ValidList;
import club.joylink.rtss.vo.runplan.RunPlanInput;
import club.joylink.rtss.vo.runplan.RunPlanInputData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -127,12 +125,6 @@ public class RunPlanDraftController {
return this.iRunPlanDraftService.getStationRunLevel(mapId);
}
@ApiOperation(value = "获取地图原始车站停站时间")
@GetMapping(path = "/{mapId}/stationParkingTime")
public List<MapStationParkingTimeVO> getStationParkingTimes(@PathVariable Long mapId) {
return this.iRunPlanDraftService.getStationParkingTimeList(mapId);
}
@ApiOperation(value = "查询运行图服务号是否存在")
@GetMapping(path = "/{planId}/{serviceNumber}/service")
public boolean ifServerExists(@PathVariable Long planId, @PathVariable String serviceNumber) {

View File

@ -3,39 +3,12 @@ package club.joylink.rtss.dao;
import club.joylink.rtss.entity.DraftMapParkingTime;
import club.joylink.rtss.entity.DraftMapParkingTimeExample;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* DraftMapParkingTimeDAO继承基类
*/
@Mapper
@Repository
public interface DraftMapParkingTimeDAO {
long countByExample(DraftMapParkingTimeExample example);
int deleteByExample(DraftMapParkingTimeExample example);
int deleteByPrimaryKey(Long id);
int insert(DraftMapParkingTime record);
int insertSelective(DraftMapParkingTime record);
List<DraftMapParkingTime> selectByExampleWithBLOBs(DraftMapParkingTimeExample example);
List<DraftMapParkingTime> selectByExample(DraftMapParkingTimeExample example);
DraftMapParkingTime selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") DraftMapParkingTime record, @Param("example") DraftMapParkingTimeExample example);
int updateByExampleWithBLOBs(@Param("record") DraftMapParkingTime record, @Param("example") DraftMapParkingTimeExample example);
int updateByExample(@Param("record") DraftMapParkingTime record, @Param("example") DraftMapParkingTimeExample example);
int updateByPrimaryKeySelective(DraftMapParkingTime record);
int updateByPrimaryKeyWithBLOBs(DraftMapParkingTime record);
int updateByPrimaryKey(DraftMapParkingTime record);
public interface DraftMapParkingTimeDAO extends MyBatisBaseDao<DraftMapParkingTime, Long, DraftMapParkingTimeExample> {
}

View File

@ -23,9 +23,14 @@ public class DraftMapParkingTime implements Serializable {
private String stationCode;
/**
* 此车站下站台区段停站时间
* 区段code
*/
private String sectionParkingTime;
private String sectionCode;
/**
* 停站时间
*/
private Integer parkingTime;
private static final long serialVersionUID = 1L;
}

View File

@ -313,6 +313,136 @@ public class DraftMapParkingTimeExample {
addCriterion("station_code not between", value1, value2, "stationCode");
return (Criteria) this;
}
public Criteria andSectionCodeIsNull() {
addCriterion("section_code is null");
return (Criteria) this;
}
public Criteria andSectionCodeIsNotNull() {
addCriterion("section_code is not null");
return (Criteria) this;
}
public Criteria andSectionCodeEqualTo(String value) {
addCriterion("section_code =", value, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeNotEqualTo(String value) {
addCriterion("section_code <>", value, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeGreaterThan(String value) {
addCriterion("section_code >", value, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeGreaterThanOrEqualTo(String value) {
addCriterion("section_code >=", value, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeLessThan(String value) {
addCriterion("section_code <", value, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeLessThanOrEqualTo(String value) {
addCriterion("section_code <=", value, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeLike(String value) {
addCriterion("section_code like", value, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeNotLike(String value) {
addCriterion("section_code not like", value, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeIn(List<String> values) {
addCriterion("section_code in", values, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeNotIn(List<String> values) {
addCriterion("section_code not in", values, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeBetween(String value1, String value2) {
addCriterion("section_code between", value1, value2, "sectionCode");
return (Criteria) this;
}
public Criteria andSectionCodeNotBetween(String value1, String value2) {
addCriterion("section_code not between", value1, value2, "sectionCode");
return (Criteria) this;
}
public Criteria andParkingTimeIsNull() {
addCriterion("parking_time is null");
return (Criteria) this;
}
public Criteria andParkingTimeIsNotNull() {
addCriterion("parking_time is not null");
return (Criteria) this;
}
public Criteria andParkingTimeEqualTo(Integer value) {
addCriterion("parking_time =", value, "parkingTime");
return (Criteria) this;
}
public Criteria andParkingTimeNotEqualTo(Integer value) {
addCriterion("parking_time <>", value, "parkingTime");
return (Criteria) this;
}
public Criteria andParkingTimeGreaterThan(Integer value) {
addCriterion("parking_time >", value, "parkingTime");
return (Criteria) this;
}
public Criteria andParkingTimeGreaterThanOrEqualTo(Integer value) {
addCriterion("parking_time >=", value, "parkingTime");
return (Criteria) this;
}
public Criteria andParkingTimeLessThan(Integer value) {
addCriterion("parking_time <", value, "parkingTime");
return (Criteria) this;
}
public Criteria andParkingTimeLessThanOrEqualTo(Integer value) {
addCriterion("parking_time <=", value, "parkingTime");
return (Criteria) this;
}
public Criteria andParkingTimeIn(List<Integer> values) {
addCriterion("parking_time in", values, "parkingTime");
return (Criteria) this;
}
public Criteria andParkingTimeNotIn(List<Integer> values) {
addCriterion("parking_time not in", values, "parkingTime");
return (Criteria) this;
}
public Criteria andParkingTimeBetween(Integer value1, Integer value2) {
addCriterion("parking_time between", value1, value2, "parkingTime");
return (Criteria) this;
}
public Criteria andParkingTimeNotBetween(Integer value1, Integer value2) {
addCriterion("parking_time not between", value1, value2, "parkingTime");
return (Criteria) this;
}
}
/**

View File

@ -444,8 +444,8 @@ public class DraftMapService implements IDraftMapService {
//车站轨道停站时间
DraftMapParkingTimeExample parkingTimeExample = new DraftMapParkingTimeExample();
parkingTimeExample.createCriteria().andMapIdEqualTo(id);
List<DraftMapParkingTime> parkingTimeList = draftMapParkingTimeDAO.selectByExampleWithBLOBs(parkingTimeExample);
logicDataVO.setParkingTimeList(CollectionUtils.isEmpty(draftMapRunLevels) ? new ArrayList<>() :
List<DraftMapParkingTime> parkingTimeList = draftMapParkingTimeDAO.selectByExample(parkingTimeExample);
logicDataVO.setParkingTimeList(CollectionUtils.isEmpty(parkingTimeList) ? new ArrayList<>() :
parkingTimeList.stream().map(MapStationParkingTimeVO::convertRel2VO).collect(Collectors.toList()));
// 自动信号
DraftMapAutoSignalExample autoSignalExample = new DraftMapAutoSignalExample();
@ -1350,7 +1350,7 @@ public class DraftMapService implements IDraftMapService {
if (StringUtils.hasText(queryVO.getStationCode())) {
criteria.andStationCodeEqualTo(queryVO.getStationCode());
}
Page<DraftMapParkingTime> page = (Page<DraftMapParkingTime>) this.draftMapParkingTimeDAO.selectByExampleWithBLOBs(example);
Page<DraftMapParkingTime> page = (Page<DraftMapParkingTime>) this.draftMapParkingTimeDAO.selectByExample(example);
List<MapStationParkingTimeVO> parkingTimeList = page.getResult().stream().map(MapStationParkingTimeVO::convert2VO).collect(Collectors.toList());
return PageVO.convert(page, parkingTimeList);
}
@ -1363,9 +1363,9 @@ public class DraftMapService implements IDraftMapService {
@Override
public void updateStationParkTime(Long id, MapStationParkingTimeVO parkingTimeVO) {
DraftMapParkingTime draftMapParkingTime = getDraftMapParkingTimeEntity(id);
draftMapParkingTime.setSectionParkingTime(JsonUtils.writeValueAsString(parkingTimeVO.getParkingTimeVOList()));
this.draftMapParkingTimeDAO.updateByPrimaryKeyWithBLOBs(draftMapParkingTime);
// DraftMapParkingTime draftMapParkingTime = getDraftMapParkingTimeEntity(id);
// draftMapParkingTime.setSectionParkingTime(JsonUtils.writeValueAsString(parkingTimeVO.getParkingTimeVOList()));
// this.draftMapParkingTimeDAO.updateByPrimaryKeyWithBLOBs(draftMapParkingTime);
}
@Override

View File

@ -4,10 +4,8 @@ import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.map.MapRoutingSectionVO;
import club.joylink.rtss.vo.client.map.newmap.MapStationParkingTimeVO;
import club.joylink.rtss.vo.client.map.newmap.MapStationRunLevelVO;
import club.joylink.rtss.vo.client.runplan.*;
import club.joylink.rtss.vo.runplan.RunPlanInput;
import club.joylink.rtss.vo.runplan.RunPlanInputData;
import org.springframework.transaction.annotation.Transactional;
@ -95,9 +93,6 @@ public interface IRunPlanDraftService {
/**获取地图原始站间运行等级*/
List<MapStationRunLevelVO> getStationRunLevel(Long mapId);
/**获取地图原始车站轨道停站时间*/
List<MapStationParkingTimeVO> getStationParkingTimeList(Long mapId);
/**
* 设置站间运行时间
* @param mapId

View File

@ -7,14 +7,13 @@ import club.joylink.rtss.dao.RunPlanDraftDAO;
import club.joylink.rtss.dao.RunPlanLevelDAO;
import club.joylink.rtss.entity.*;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.runplan.*;
import club.joylink.rtss.services.runplan.IRunPlanRoutingService;
import club.joylink.rtss.services.runplan.IRunPlanRunlevelService;
import club.joylink.rtss.services.runplan.RunPlanGenerator;
import club.joylink.rtss.services.runplan.importReal.IRunPlanStrategyNew;
import club.joylink.rtss.services.runplan.importReal.RunPlanImportStrategyEnum;
import club.joylink.rtss.simulation.cbtc.GroupSimulationService;
import club.joylink.rtss.simulation.cbtc.build.RunPlanBuilder;
import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.UserVO;
@ -25,13 +24,10 @@ import club.joylink.rtss.vo.client.map.newmap.*;
import club.joylink.rtss.vo.client.runplan.*;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRoutingVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRunlevelVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanUserConfigVO;
import club.joylink.rtss.vo.runplan.RunPlanInputData;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -39,7 +35,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.lang.reflect.Array;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.temporal.ChronoUnit;
@ -263,11 +258,6 @@ public class RunPlanDraftService implements IRunPlanDraftService {
return this.iMapService.getMapDetail(mapId).getLogicDataNew().getRunLevelList();
}
@Override
public List<MapStationParkingTimeVO> getStationParkingTimeList(Long mapId) {
return this.iMapService.getMapDetail(mapId).getLogicDataNew().getParkingTimeList();
}
@Override
@Transactional
public void setStationRunningTime(Long mapId, List<RunPlanLevelVO> runPlanLevelVOList, UserVO userVO) {

View File

@ -29,7 +29,6 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
@Autowired
private DraftMapService draftMapService;
@Autowired
private RoutingGenerator routingGenerator;
@ -88,7 +87,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
// 删除旧联锁数据保存新联锁数据
this.draftMapService.cleanAndSaveCiData(mapId, approachSectionVOList,
routeVOList, overlapVOList, flsVOList, autoSignalNewVOList,
autoReentryVOList, destinationCodeDefinitionVOList, result.getRoutingList(), result.getStationRunLevelList());
autoReentryVOList, destinationCodeDefinitionVOList, result.getRoutingList());
return result.convert2VO();
}
@ -123,11 +122,10 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
private List<DestinationCodeDefinition> destinationCodeDefinitionList;
List<MapRoutingDataVO> routingList;
List<MapStationRunLevelVO> stationRunLevelList;
public CiGenerateResult(List<String> errMsgList, List<Signal> approachList, List<AutoSignal> autoSignalList, List<Route> routeList,
List<RouteOverlap> overlapList, List<RouteFls> flsList, List<Cycle> generateCycleList, List<MapRoutingDataVO> routingList,
List<MapStationRunLevelVO> stationRunLevelList, List<DestinationCodeDefinition> destinationCodeDefinitionList) {
List<DestinationCodeDefinition> destinationCodeDefinitionList) {
this.errMsgList = errMsgList;
this.approachList = approachList;
this.autoSignalList = autoSignalList;
@ -137,7 +135,6 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
this.cycleList = generateCycleList;
this.destinationCodeDefinitionList = destinationCodeDefinitionList;
this.routingList = routingList;
this.stationRunLevelList = stationRunLevelList;
log.info(String.format("生成信号机接近区段数据[%s]条", approachList.size()));
log.info(String.format("生成进路数据总计[%s]条", routeList.size()));
log.info(String.format("生成延续保护数据[%s]条", overlapList.size()));
@ -145,7 +142,6 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
log.info(String.format("生成自动信号数据[%s]条", autoSignalList.size()));
log.info(String.format("生成自动折返数据[%s]条", generateCycleList.size()));
log.info(String.format("生成交路数据[%s]条", routingList.size()));
log.info(String.format("生成站间运行数据[%s]条", stationRunLevelList.size()));
}
public CiGenerateResultVO convert2VO() {
@ -155,7 +151,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
resultVO.setCycleCount(this.cycleList.size());
resultVO.setAutoSignalCount(this.autoSignalList.size());
resultVO.setRoutingCount(this.routingList.size());
resultVO.setStationRunlevelCount(this.stationRunLevelList.size());
// resultVO.setStationRunlevelCount(this.stationRunLevelList.size());
// resultVO.setStationParkTimeCount(this.parkTimeList.size());
resultVO.setDestinationCodeDefinitionCount(this.destinationCodeDefinitionList.size());
return resultVO;
}
@ -306,9 +303,12 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
List<MapRoutingDataVO> generateRoutingList = this.routingGenerator.generateAllRouting(deviceMap, errorList);
//站间运行等级生成
List<MapStationRunLevelVO> generatedStationRunLevelList = new ArrayList<>();
// generateRunLevel(deviceMap, errorList, generateRoutingList, generatedStationRunLevelList);
generateRunLevel(deviceMap, errorList, generatedStationRunLevelList);
// List<MapStationRunLevelVO> generatedStationRunLevelList =
// this.runLevelGenerator.generateRunLevels(
// generateRoutingList, deviceMap, errorList
// );
// 停站时间生成
// List<MapStationParkingTimeVO> parkTimeList = this.parkTimeGenerator.generate(deviceMap, errorList);
//目的地码生成
List<DestinationCodeDefinition> destinationCodeDefinitionList = new ArrayList<>();
@ -374,7 +374,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
return new CiGenerateResult(errorList, approachList,
autoSignalList, generatedRouteList, generatedOverlapList, flsList,
generateCycleList, generateRoutingList, generatedStationRunLevelList, destinationCodeDefinitionList);
generateCycleList, generateRoutingList, destinationCodeDefinitionList);
}
/**
@ -936,79 +936,6 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
}
}
private void generateRunLevel(Map<String, MapElement> deviceMap, List<String> errorList, List<MapStationRunLevelVO> generatedStationRunLevelList) {
deviceMap.values().stream().filter(mapElement -> {
if (mapElement.getDeviceType().equals(MapElement.DeviceType.SECTION)) {
Section section = (Section) mapElement;
if (section.isTransferTrack() || section.isNormalStandTrack() || section.isTurnBackTrack()) {
return true;
}
return false;
}
return false;
}).map(mapElement -> (Section) mapElement).forEach(startSection -> {
getStationRunLevel(generatedStationRunLevelList, startSection, true, errorList);
getStationRunLevel(generatedStationRunLevelList, startSection, false, errorList);
});
}
private void getStationRunLevel(List<MapStationRunLevelVO> generatedStationRunLevelList, Section startSection, boolean right, List<String> errorList) {
List<Section> adjacentSections = CalculateService.findAdjacentSections(startSection, right);
log.debug(" 车站{}区段({}) 的相邻 {} 站间区段为:{}", startSection.getStation().getName(), startSection.getName(), right ? "右向" : "左向", JsonUtils.writeValueAsString(adjacentSections.stream().map(Section::getCode).collect(Collectors.toList())));
adjacentSections.forEach(endSection -> {
//验证是否是进路路径的站间
List<RoutePath> routePaths = CalculateService.queryRoutePathsOnDirection(startSection, endSection, right, 10);
if (CollectionUtils.isEmpty(routePaths)) {
log.warn(String.format("站间运行等级数据生成失败:没有找到[%s(%s) ——> %s(%s)]对应方向[%s]的进路路径可达的站间",
startSection.getStation().getName(), startSection.getName(), endSection.getStation().getName(), endSection.getName(), right ? "右向" : "左向"));
errorList.add(String.format("站间运行等级数据生成失败:没有找到[%s(%s) ——> %s(%s)]对应方向[%s]的进路路径可达的站间",
startSection.getStation().getName(), startSection.getName(), endSection.getStation().getName(), endSection.getName(), right ? "右向" : "左向"));
return;
}
// 创建
MapStationRunLevelVO runLevelVO = new MapStationRunLevelVO();
runLevelVO.setStartSectionCode(startSection.getCode());
runLevelVO.setStartStationCode(startSection.getStation().getCode());
runLevelVO.setEndSectionCode(endSection.getCode());
runLevelVO.setEndStationCode(endSection.getStation().getCode());
runLevelVO.setRight(right);
// List<RoutePath> routePaths = CalculateService.queryRoutePathsOnDirection(startSection, endSection, right);
// if (CollectionUtils.isEmpty(routePaths)) {
// // 未找到反方向再找
// routePaths = CalculateService.queryRoutePathsOnDirection(startSection, endSection, !right);
// if (!CollectionUtils.isEmpty(routePaths)) {
// runLevelVO.setRight(!right);
// }
// }
// if (CollectionUtils.isEmpty(routePaths)) {
// log.warn(String.format("站间运行等级数据生成失败:没有找到[%s(%s) ——> %s(%s)]对应方向[%s]的站间",
// startSection.getStation().getName(), startSection.getName(), endSection.getStation().getName(), endSection.getName(), right ? "右向" : "左向"));
//// errorList.add(String.format("站间运行等级数据生成失败:没有找到[%s(%s) ——> %s(%s)]对应方向[%s]的站间",
//// startSection.getStation().getName(), startSection.getName(), endSection.getStation().getName(), endSection.getName(), right ? "右向" : "左向"));
// continue;
// }
// 找到计算距离
// float distance = routePaths.get(0).calculateDistance();
Float distance = CalculateService.calculateDistance(startSection, endSection, right);
if (Objects.isNull(distance)) {
errorList.add(String.format("站间运行等级数据生成失败:没有找到[%s(%s) ——> %s(%s)]对应方向[%s]的站间",
startSection.getStation().getName(), startSection.getName(), endSection.getStation().getName(), endSection.getName(), right ? "右向" : "左向"));
return;
}
runLevelVO.setDistance(distance);
runLevelVO.generateDefaultRunLevel();
log.debug(String.format("站间运行等级[%s]生成成功",
String.format("%s(%s(%s))->%s(%s(%s))",
startSection.getStation().getName(), startSection.getName(), startSection.getCode(),
endSection.getStation().getName(), endSection.getName(), endSection.getCode())));
generatedStationRunLevelList.add(runLevelVO);
});
}
private void buildAutoSignalRouteConflict(List<AutoSignal> autoSignalList, List<Route> generatedRouteList) {
if (CollectionUtils.isEmpty(autoSignalList)) {
// 自动信号为空返回
@ -1591,17 +1518,15 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
SectionPath tempPath, List<SectionPath> overlapPathList,
MapCiGenerateConfig config, List<String> errorList) {
if (!CollectionUtils.isEmpty(tempPath.getSectionList())) { // 已经有路径
Section lastSection = tempPath.getLastSection();
if (Objects.isNull(section) ||
!section.isSwitchTrack() ||
!tempPath.getLastSection().isSwitchTrack()) {
!lastSection.isSwitchTrack()) {
// 且后面的是尽头或路径最后已经是非道岔区段构建成功返回
overlapPathList.add(tempPath);
return;
} else if (config.isOverlapOnlyOneSwitch() &&
Objects.nonNull(section) &&
section.isSwitchTrack() &&
!Objects.equals(tempPath.getLastSection().getParent(), section.getParent())) {
// 配置只构建一个道岔计轴的情况如果已经不是相同道岔计轴完成返回
} else if (tempPath.getTotalLen() > config.getOverlapMinLen()) {
// 延续保护长度已经足够返回
overlapPathList.add(tempPath);
return;
}
@ -1632,7 +1557,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
SectionPath rpPath = tempPath.cloneNew();// 反位路径
rpPath.addSection(relSwitch.getC());
rpPath.addSwitchElement(new SwitchElement(relSwitch, false));
if (!config.isGenerateFls() && Objects.nonNull(linkedSwitch) && config.isOverlapOnlyOneSwitch()) {
if (!config.isGenerateFls() && Objects.nonNull(linkedSwitch)) {
// 如果有联动道岔且配置只构建一个道岔这里添加上联动道岔
rpPath.addSwitchElement(new SwitchElement(linkedSwitch, false));
}

View File

@ -31,6 +31,15 @@ public interface DraftMapService {
List<MapRouteFlankProtectionNewVO> flsVOList, List<MapAutoSignalNewVO> autoSignalVOList,
List<MapAutoReentryVO> autoReentryVOList,
List<MapDestinationCodeDefinitionVO> destinationCodeDefinitionVOList,
List<MapRoutingDataVO> generatedRoutingList,
List<MapStationRunLevelVO> generatedStationRunLevelList);
List<MapRoutingDataVO> generatedRoutingList);
List<MapRoutingDataVO> queryRoutings(Long mapId);
void cleanAndSaveRunLevel(Long mapId, List<MapStationRunLevelVO> runLevelVOList);
List<MapStationRunLevelVO> queryRunLevels(Long mapId);
void cleanAndSaveParkTime(Long mapId, List<MapStationParkingTimeVO> parkTimeList);
List<MapStationParkingTimeVO> queryParkTimes(Long mapId);
}

View File

@ -11,36 +11,31 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class DraftMapServiceImpl implements DraftMapService {
@Autowired
private DraftMapDAO draftMapDAO;
@Autowired
private DraftMapSignalApproachSectionDAO draftMapSignalApproachSectionDAO;
@Autowired
private DraftMapOverlapDAO draftMapOverlapDAO;
@Autowired
private DraftMapRouteDAO draftMapRouteDAO;
@Autowired
private DraftMapRouteFlankProtectionDAO draftMapRouteFlankProtectionDAO;
@Autowired
private DraftMapAutoSignalDAO draftMapAutoSignalDAO;
@Autowired
private DraftMapAutoReentryDAO draftMapAutoReentryDAO;
@Autowired
private DraftMapRoutingDAO draftMapRoutingDAO;
@Autowired
private DraftMapRunLevelDAO draftMapRunLevelDAO;
@Autowired
private DraftMapParkingTimeDAO draftMapParkingTimeDAO;
@Override
public MapVO getDraftMapData(Long mapId) {
@ -59,8 +54,7 @@ public class DraftMapServiceImpl implements DraftMapService {
List<MapAutoSignalNewVO> autoSignalVOList,
List<MapAutoReentryVO> autoReentryVOList,
List<MapDestinationCodeDefinitionVO> destinationCodeDefinitionVOList,
List<MapRoutingDataVO> generatedRoutingList,
List<MapStationRunLevelVO> generatedStationRunLevelList) {
List<MapRoutingDataVO> generatedRoutingList) {
// 删除旧数据
this.cleanMapApproachSection(mapId);
this.cleanMapRoute(mapId);
@ -69,7 +63,6 @@ public class DraftMapServiceImpl implements DraftMapService {
this.cleanMapAutoSignal(mapId);
this.cleanMapCycle(mapId);
this.cleanMapRouting(mapId);
this.cleanMapRunLevel(mapId);
// 保存新数据
this.saveMapApproachSection(mapId, approachVOList);
this.saveMapRoute(mapId, routeVOList);
@ -78,13 +71,55 @@ public class DraftMapServiceImpl implements DraftMapService {
this.saveMapAutoSignal(mapId, autoSignalVOList);
this.saveMapCycle(mapId, autoReentryVOList);
this.saveMapRouting(mapId, generatedRoutingList);
this.saveMapRunLevel(mapId, generatedStationRunLevelList);
//目的地码数据
if (!CollectionUtils.isEmpty(destinationCodeDefinitionVOList)) {
this.updateMapDestinationCodeDefinition(mapId, destinationCodeDefinitionVOList);
}
}
@Override
public List<MapRoutingDataVO> queryRoutings(Long mapId) {
DraftMapRoutingExample example = new DraftMapRoutingExample();
example.createCriteria()
.andMapIdEqualTo(mapId);
List<DraftMapRouting> draftMapRoutings = this.draftMapRoutingDAO.selectByExampleWithBLOBs(example);
return draftMapRoutings.stream()
.map(MapRoutingDataVO::convert2VO)
.collect(Collectors.toList());
}
@Override
public void cleanAndSaveRunLevel(Long mapId, List<MapStationRunLevelVO> runLevelVOList) {
this.cleanMapRunLevel(mapId);
this.saveMapRunLevel(mapId, runLevelVOList);
}
@Override
public List<MapStationRunLevelVO> queryRunLevels(Long mapId) {
DraftMapRunLevelExample example = new DraftMapRunLevelExample();
example.createCriteria()
.andMapIdEqualTo(mapId);
List<DraftMapRunLevel> draftMapRunLevels = this.draftMapRunLevelDAO.selectByExampleWithBLOBs(example);
return MapStationRunLevelVO.convert2VOList(draftMapRunLevels);
}
@Override
public void cleanAndSaveParkTime(Long mapId, List<MapStationParkingTimeVO> parkTimeList) {
this.cleanMapStationParkTime(mapId);
this.saveMapStationParkTime(mapId, parkTimeList);
}
@Override
public List<MapStationParkingTimeVO> queryParkTimes(Long mapId) {
DraftMapParkingTimeExample example = new DraftMapParkingTimeExample();
example.createCriteria()
.andMapIdEqualTo(mapId);
List<DraftMapParkingTime> parkingTimes = this.draftMapParkingTimeDAO.selectByExample(example);
return parkingTimes.stream()
.map(MapStationParkingTimeVO::convert2VO)
.collect(Collectors.toList());
}
private void saveMapCycle(Long mapId, List<MapAutoReentryVO> autoReentryVOList) {
if (!CollectionUtils.isEmpty(autoReentryVOList)) {
for (MapAutoReentryVO autoReentryVO : autoReentryVOList) {
@ -170,6 +205,17 @@ public class DraftMapServiceImpl implements DraftMapService {
}
}
@Transactional
public void saveMapStationParkTime(Long mapId, List<MapStationParkingTimeVO> parkTimeList) {
if (!CollectionUtils.isEmpty(parkTimeList)) {
for (MapStationParkingTimeVO vo : parkTimeList) {
vo.setMapId(mapId);
DraftMapParkingTime entity = vo.convert2Draft();
this.draftMapParkingTimeDAO.insert(entity);
}
}
}
private void cleanMapOverlap(Long mapId) {
DraftMapOverlapExample example = new DraftMapOverlapExample();
example.createCriteria()
@ -231,4 +277,11 @@ public class DraftMapServiceImpl implements DraftMapService {
.andMapIdEqualTo(mapId);
this.draftMapRunLevelDAO.deleteByExample(example);
}
private void cleanMapStationParkTime(Long mapId) {
DraftMapParkingTimeExample example = new DraftMapParkingTimeExample();
example.createCriteria()
.andMapIdEqualTo(mapId);
this.draftMapParkingTimeDAO.deleteByExample(example);
}
}

View File

@ -0,0 +1,67 @@
package club.joylink.rtss.services.draftData;
import club.joylink.rtss.dao.DraftMapParkingTimeDAO;
import club.joylink.rtss.entity.DraftMapParkingTime;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import club.joylink.rtss.simulation.cbtc.data.map.Section;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.client.map.MapVO;
import club.joylink.rtss.vo.client.map.newmap.MapStationParkingTimeVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 停站时间生成
*/
@Slf4j
@Service
public class ParkTimeService {
@Autowired
private DraftMapService draftMapService;
@Autowired
private DraftMapParkingTimeDAO draftMapParkingTimeDAO;
public List<MapStationParkingTimeVO> generate(Map<String, MapElement> deviceMap) {
List<MapStationParkingTimeVO> list = new ArrayList<>();
List<Section> standSectionList = deviceMap.values().stream()
.filter(mapElement -> mapElement.getDeviceType().equals(MapElement.DeviceType.SECTION))
.map(mapElement -> ((Section) mapElement))
.filter(section -> section.isNormalStandTrack())
.collect(Collectors.toList());
for (Section section : standSectionList) {
list.add(new MapStationParkingTimeVO(section.getStation().getCode(), section.getCode()));
}
return list;
}
public List<MapStationParkingTimeVO> generate(Long mapId) {
// 先校验地图基础数据
MapVO mapVO = this.draftMapService.getDraftMapData(mapId);
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildBasicMapData(mapVO);
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
String.format("地图基础数据有错误: %s", JsonUtils.writeValueAsString(buildResult.getErrMsgList())));
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
List<MapStationParkingTimeVO> parkTimeList = this.generate(deviceMap);
this.draftMapService.cleanAndSaveParkTime(mapId, parkTimeList);
return parkTimeList;
}
public List<MapStationParkingTimeVO> queryAll(Long mapId) {
return draftMapService.queryParkTimes(mapId);
}
public void update(Long mapId, Long id, MapStationParkingTimeVO parkingTimeVO) {
DraftMapParkingTime parkingTime = this.draftMapParkingTimeDAO.selectByPrimaryKey(id);
parkingTime.setParkingTime(parkingTimeVO.getParkingTime());
this.draftMapParkingTimeDAO.updateByPrimaryKeySelective(parkingTime);
}
}

View File

@ -0,0 +1,107 @@
package club.joylink.rtss.services.draftData;
import club.joylink.rtss.dao.DraftMapRunLevelDAO;
import club.joylink.rtss.entity.DraftMapRunLevel;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import club.joylink.rtss.simulation.cbtc.data.map.Section;
import club.joylink.rtss.simulation.cbtc.data.support.RoutePath;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.client.map.MapVO;
import club.joylink.rtss.vo.client.map.newmap.MapRoutingDataVO;
import club.joylink.rtss.vo.client.map.newmap.MapRoutingSectionNewVO;
import club.joylink.rtss.vo.client.map.newmap.MapStationRunLevelVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 运行等级生成
*/
@Slf4j
@Service
public class RunLevelService {
@Autowired
private DraftMapService draftMapService;
@Autowired
private DraftMapRunLevelDAO draftMapRunLevelDAO;
/**
* 生成正常站间运行等级基于生成交路
* @param routingList
* @param deviceMap
* @return
*/
public List<MapStationRunLevelVO> generateRunLevels(List<MapRoutingDataVO> routingList,
Map<String, MapElement> deviceMap) {
Map<String, MapStationRunLevelVO> runLevelVOMap = new HashMap<>();
for (MapRoutingDataVO routingDataVO : routingList) {
List<MapRoutingSectionNewVO> allStationSectionList = routingDataVO.getAllStationSectionList();
for (int i = 1; i < allStationSectionList.size(); i++) {
MapRoutingSectionNewVO start = allStationSectionList.get(i - 1);
MapRoutingSectionNewVO end = allStationSectionList.get(i);
if (start.getSectionCode().equals(end.getSectionCode())) {
continue;
}
String key = MapStationRunLevelVO.buildKey(start.getSectionCode(), end.getSectionCode());
if (runLevelVOMap.containsKey(key)) {
continue;
}
MapStationRunLevelVO vo = new MapStationRunLevelVO(start, end, routingDataVO.getRight());
float distance = this.calculateDistance(vo, deviceMap);
vo.setDistance(distance);
vo.generateDefaultRunLevel();
log.debug(String.format("生成站间运行等级:[%s]", vo.debugStr()));
runLevelVOMap.put(key, vo);
}
}
return new ArrayList<>(runLevelVOMap.values());
}
private float calculateDistance(MapStationRunLevelVO vo, Map<String, MapElement> deviceMap) {
Section start = (Section) deviceMap.get(vo.getStartSectionCode());
Section end = (Section) deviceMap.get(vo.getEndSectionCode());
boolean right = vo.getRight();
List<RoutePath> routePaths = CalculateService.queryRoutePathsOnDirection(start, end, right, 20);
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionNotEmpty(routePaths,
String.format("进路路径[%s->%s]未找到", start.debugStr(), end.debugStr()));
return routePaths.get(0).getLength();
}
public List<MapStationRunLevelVO> generate(Long mapId) {
// 先校验地图基础数据
MapVO mapVO = this.draftMapService.getDraftMapData(mapId);
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildBasicMapData(mapVO);
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
String.format("地图基础数据有错误: %s", JsonUtils.writeValueAsString(buildResult.getErrMsgList())));
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
List<MapRoutingDataVO> routingDataVOList = this.draftMapService.queryRoutings(mapId);
List<MapStationRunLevelVO> runLevelVOList = this.generateRunLevels(routingDataVOList, deviceMap);
this.draftMapService.cleanAndSaveRunLevel(mapId, runLevelVOList);
return runLevelVOList;
}
public List<MapStationRunLevelVO> queryAll(Long mapId) {
return this.draftMapService.queryRunLevels(mapId);
}
public void update(Long mapId, Long rlId, MapStationRunLevelVO runLevelVO) {
DraftMapRunLevel draftMapRunLevel = this.draftMapRunLevelDAO.selectByPrimaryKey(rlId);
MapStationRunLevelVO vo = MapStationRunLevelVO.fromDraft(draftMapRunLevel);
vo.setL1(runLevelVO.getL1());
vo.setL2(runLevelVO.getL2());
vo.setL3(runLevelVO.getL3());
vo.setL4(runLevelVO.getL4());
vo.setL5(runLevelVO.getL5());
draftMapRunLevel.setRunLevelData(vo.getRunLevelData());
this.draftMapRunLevelDAO.updateByPrimaryKeyWithBLOBs(draftMapRunLevel);
}
}

View File

@ -412,6 +412,12 @@ public class Operation {
//--------------------------- 方向杆 ---------------------------
/** 方向转换 */
Direction_Change,
//--------------------------- 运行计划 ---------------------------
/** 添加计划 */
RunPlan_Add_Trip,
/** 删除计划 */
RunPlan_Delete_Trip,
}
/**操作对象枚举*/

View File

@ -0,0 +1,24 @@
package club.joylink.rtss.simulation.cbtc.ATS.operation.handler;
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandler;
import club.joylink.rtss.simulation.cbtc.ATS.operation.annotation.OperateHandlerMapping;
import club.joylink.rtss.simulation.cbtc.Simulation;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@OperateHandler
public class RunPlanOperateHandler {
@OperateHandlerMapping(type = Operation.Type.RunPlan_Add_Trip)
public void addTripPlan(Simulation simulation) {
}
@OperateHandlerMapping(type = Operation.Type.RunPlan_Delete_Trip)
public void deleteTripPlan(Simulation simulation, String serviceNumber,
String tripNumber, String stationCode) {
}
}

View File

@ -61,8 +61,8 @@ public class SimulationBuilder {
// simulation.getRepository().setRunLevelList(mapDataBuildResult.getRunLevelList());
simulation.getRepository().getCatenaryMap().putAll(mapDataBuildResult.getCatenaryMap());
simulation.getRepository().getSectionRespondersMap().putAll(mapDataBuildResult.getSectionRespondersMap());
UserConfigDataBuilder.buildUserRunLevel(simulation.getRepository(), buildParams.getUserRunLevelList());
UserConfigDataBuilder.buildUserParkTime(simulation.getRepository(), buildParams.getUserParkTimeList());
UserConfigDataBuilder.buildRunLevel(simulation.getRepository(), buildParams.getUserRunLevelList(), buildParams.getMap());
UserConfigDataBuilder.buildParkTime(simulation.getRepository(), buildParams.getUserParkTimeList(), buildParams.getMap());
// 加载运行图
checkAndLoadRunPlan(simulation, buildParams.getRunPlan());
// 加载派班计划

View File

@ -5,17 +5,31 @@ import club.joylink.rtss.simulation.cbtc.data.map.Section;
import club.joylink.rtss.simulation.cbtc.data.map.Station;
import club.joylink.rtss.simulation.cbtc.data.map.StationParkTime;
import club.joylink.rtss.simulation.cbtc.data.map.StationRunLevel;
import club.joylink.rtss.vo.client.map.MapVO;
import club.joylink.rtss.vo.client.map.newmap.MapStationParkingTimeVO;
import club.joylink.rtss.vo.client.map.newmap.MapStationRunLevelVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanParkingTimeVO;
import club.joylink.rtss.vo.client.runplan.user.RunPlanRunlevelVO;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
public class UserConfigDataBuilder {
public static void buildUserRunLevel(SimulationDataRepository repository, List<RunPlanRunlevelVO> userRunLevelList) {
public static void buildRunLevel(SimulationDataRepository repository, List<RunPlanRunlevelVO> userRunLevelList, MapVO map) {
Map<String, RunPlanRunlevelVO> voMap = userRunLevelList.stream()
.collect(Collectors.toMap(
vo -> StationRunLevel.buildKey(vo.getStartSectionCode(), vo.getEndSectionCode()),
Function.identity()));
List<MapStationRunLevelVO> runLevelList = map.getLogicDataNew().getRunLevelList();
for (MapStationRunLevelVO vo : runLevelList) {
String key = StationRunLevel.buildKey(vo.getStartSectionCode(), vo.getEndSectionCode());
voMap.putIfAbsent(key, new RunPlanRunlevelVO(vo));
}
Map<String, StationRunLevel> runLevelMap = new HashMap<>();
for (RunPlanRunlevelVO vo : userRunLevelList) {
for (RunPlanRunlevelVO vo : voMap.values()) {
Station startStation = repository.getByCode(vo.getStartStationCode(), Station.class);
Section startSection = repository.getByCode(vo.getStartSectionCode(), Section.class);
Station endStation = repository.getByCode(vo.getEndStationCode(), Station.class);
@ -37,8 +51,20 @@ public class UserConfigDataBuilder {
repository.setRunLevelMap(runLevelMap);
}
public static void buildUserParkTime(SimulationDataRepository repository, List<RunPlanParkingTimeVO> userParkTimeList) {
public static void buildParkTime(SimulationDataRepository repository,
List<RunPlanParkingTimeVO> userParkTimeList, MapVO map) {
Map<String, RunPlanParkingTimeVO> voMap = userParkTimeList.stream()
.collect(Collectors.toMap(RunPlanParkingTimeVO::getSectionCode, Function.identity()));
List<MapStationParkingTimeVO> parkingTimeList = map.getLogicDataNew().getParkingTimeList();
for (MapStationParkingTimeVO vo : parkingTimeList) {
voMap.putIfAbsent(vo.getSectionCode(), new RunPlanParkingTimeVO(vo));
}
Map<String, StationParkTime> parkTimeMap = new HashMap<>();
for (RunPlanParkingTimeVO vo : voMap.values()) {
Section section = repository.getByCode(vo.getSectionCode(), Section.class);
StationParkTime stationParkTime = new StationParkTime(section, vo.getParkingTime());
parkTimeMap.putIfAbsent(section.getCode(), stationParkTime);
}
repository.setParkTimeMap(parkTimeMap);
}
}

View File

@ -149,4 +149,9 @@ public class SectionPath {
public boolean isStraight() {
return !this.containRpSwitch();
}
public boolean isNormalPosition(Switch relSwitch) {
SwitchElement element = this.getSwitchElement(relSwitch);
return element.isNormal();
}
}

View File

@ -4,4 +4,15 @@ import lombok.Getter;
@Getter
public class StationParkTime {
Section section;
int parkTime;
public StationParkTime(Section section, Integer parkingTime) {
this.section = section;
this.parkTime = parkingTime;
}
public void setParkTime(int parkTime) {
this.parkTime = parkTime;
}
}

View File

@ -54,4 +54,8 @@ public class StationRunLevel {
public String buildKey() {
return String.format("%s-%s", this.startSection.getCode(), this.endSection.getCode());
}
public static String buildKey(String startSectionCode, String endSectionCode) {
return String.format("%s-%s", startSectionCode, endSectionCode);
}
}

View File

@ -22,6 +22,8 @@ public class CiGenerateResultVO {
private int routingCount;
@ApiModelProperty(value = "站间运行等级数量")
private int stationRunlevelCount;
// 停站时间数量
private int stationParkTimeCount;
@ApiModelProperty(value = "目的地码定义")
private int destinationCodeDefinitionCount;

View File

@ -44,9 +44,13 @@ public class MapCiGenerateConfig {
@ApiModelProperty(value = "延续保护是否只构建道岔")
private boolean overlapOnlySwitch;
@ApiModelProperty(value = "延续保护构建是否只考虑一个道岔计轴")
private boolean overlapOnlyOneSwitch;
//
// @ApiModelProperty(value = "延续保护构建是否只考虑一个道岔计轴")
// private boolean overlapOnlyOneSwitch;
/**
* 延续保护最小长度
*/
private float overlapMinLen = 55;
@ApiModelProperty(value = "延续保护道岔是否只构建定位道岔")
private boolean overlapSwitchNpOnly;

View File

@ -1,7 +1,6 @@
package club.joylink.rtss.vo.client.map.newmap;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.client.runplan.user.RunPlanParkingTimeVO;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
@ -31,12 +30,6 @@ public class MapLogicDataNewVO {
@ApiModelProperty(value = "站间运行等级列表")
private List<MapStationRunLevelVO> runLevelList;
/**
* 停站时间列表
*/
private List<RunPlanParkingTimeVO> parkTimeList;
@Deprecated
@ApiModelProperty(value = "车站区段停站时间列表")
private List<MapStationParkingTimeVO> parkingTimeList;

View File

@ -1,8 +1,9 @@
package club.joylink.rtss.vo.client.map.newmap;
import club.joylink.rtss.simulation.cbtc.data.map.Routing;
import club.joylink.rtss.entity.DraftMapRouting;
import club.joylink.rtss.simulation.cbtc.data.map.Routing;
import club.joylink.rtss.util.JsonUtils;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
@ -130,4 +131,13 @@ public class MapRoutingDataVO {
routing.setDescription(description+LOOP_MARK);
return routing;
}
@JsonIgnore
public List<MapRoutingSectionNewVO> getAllStationSectionList() {
List<MapRoutingSectionNewVO> list = new ArrayList<>();
list.add(new MapRoutingSectionNewVO(this.startStationCode, this.startSectionCode));
list.addAll(this.parkSectionCodeList);
list.add(new MapRoutingSectionNewVO(this.endStationCode, this.endSectionCode));
return list;
}
}

View File

@ -1,17 +1,14 @@
package club.joylink.rtss.vo.client.map.newmap;
import club.joylink.rtss.entity.DraftMapParkingTime;
import club.joylink.rtss.util.JsonUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.util.List;
import javax.validation.constraints.NotNull;
@ApiModel(value = "地图车站区段停站时间对象")
@Getter
@ -27,17 +24,27 @@ public class MapStationParkingTimeVO {
@NotBlank(message = "车站code不能为空")
private String stationCode;
@ApiModelProperty(value = "车站站台区段停车时间列表")
@Valid
@NotEmpty(message = "车站站台区段停车时间不能为空")
private List<SectionParkingTimeVO> parkingTimeVOList;
@ApiModelProperty(value = "站台轨/折返轨/转换轨区段code")
@NotBlank(message = "区段code不能为空")
private String sectionCode;
@ApiModelProperty(value = "停站时间,单位秒(s)")
@NotNull(message = "停站时间不能为空")
private Integer parkingTime;
public MapStationParkingTimeVO(String stationCode, String sectionCode) {
this.stationCode = stationCode;
this.sectionCode = sectionCode;
this.parkingTime = 30;
}
public DraftMapParkingTime convert2Draft(){
DraftMapParkingTime draftMapParkingTime = new DraftMapParkingTime();
draftMapParkingTime.setId(this.id);
draftMapParkingTime.setMapId(this.mapId);
draftMapParkingTime.setStationCode(this.stationCode);
draftMapParkingTime.setSectionParkingTime(JsonUtils.writeValueAsString(this.parkingTimeVOList));
draftMapParkingTime.setSectionCode(this.sectionCode);
draftMapParkingTime.setParkingTime(this.parkingTime);
return draftMapParkingTime;
}
@ -46,14 +53,16 @@ public class MapStationParkingTimeVO {
vo.setId(draftMapParkingTime.getId());
vo.setMapId(draftMapParkingTime.getMapId());
vo.setStationCode(draftMapParkingTime.getStationCode());
vo.setParkingTimeVOList(JsonUtils.read(draftMapParkingTime.getSectionParkingTime(), JsonUtils.getCollectionType(List.class, SectionParkingTimeVO.class)));
vo.setSectionCode(draftMapParkingTime.getSectionCode());
vo.setParkingTime(draftMapParkingTime.getParkingTime());
return vo;
}
public static MapStationParkingTimeVO convertRel2VO(DraftMapParkingTime draftMapParkingTime) {
MapStationParkingTimeVO vo = new MapStationParkingTimeVO();
vo.setStationCode(draftMapParkingTime.getStationCode());
vo.setParkingTimeVOList(JsonUtils.read(draftMapParkingTime.getSectionParkingTime(), JsonUtils.getCollectionType(List.class, SectionParkingTimeVO.class)));
vo.setSectionCode(draftMapParkingTime.getSectionCode());
vo.setParkingTime(draftMapParkingTime.getParkingTime());
return vo;
}
}

View File

@ -96,6 +96,14 @@ public class MapStationRunLevelVO {
this.l5 = runPlanRunlevelVO.getL5();
}
public MapStationRunLevelVO(MapRoutingSectionNewVO start, MapRoutingSectionNewVO end, Boolean right) {
this.startStationCode = start.getStationCode();
this.startSectionCode = start.getSectionCode();
this.endStationCode = end.getStationCode();
this.endSectionCode = end.getSectionCode();
this.right = right;
}
public static List<MapStationRunLevelVO> convert2VOList(List<DraftMapRunLevel> list) {
List<MapStationRunLevelVO> voList = new ArrayList<>();
if (!CollectionUtils.isEmpty(list)) {
@ -191,6 +199,10 @@ public class MapStationRunLevelVO {
return String.format("%s-%s", this.startSectionCode, this.endSectionCode);
}
public static String buildKey(String startSectionCode, String endSectionCode) {
return String.format("%s-%s", startSectionCode, endSectionCode);
}
public boolean isSameOf(String startSectionCode, String endSectionCode) {
if (Objects.equals(this.startSectionCode, startSectionCode) &&
Objects.equals(this.endSectionCode, endSectionCode)) {
@ -198,4 +210,10 @@ public class MapStationRunLevelVO {
}
return false;
}
public String debugStr() {
return String.format("站间运行等级:%s->%s, distance:%s, l1:%s, l2:%s, l3:%s, l4:%s, l5:%s",
this.startSectionCode, this.endSectionCode, this.distance,
this.l1, this.l2, this.l3, this.l4, this.l5);
}
}

View File

@ -1,26 +0,0 @@
package club.joylink.rtss.vo.client.map.newmap;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@ApiModel(value = "区段停站时间对象")
@Getter
@Setter
@NoArgsConstructor
public class SectionParkingTimeVO {
@ApiModelProperty(value = "站台轨/折返轨/转换轨区段code")
@NotBlank(message = "区段code不能为空")
private String sectionCode;
@ApiModelProperty(value = "停站时间,单位秒(s)")
@NotNull(message = "停站时间不能为空")
private Integer parkingTime;
}

View File

@ -1,6 +1,7 @@
package club.joylink.rtss.vo.client.runplan.user;
import club.joylink.rtss.entity.RunPlanParktime;
import club.joylink.rtss.vo.client.map.newmap.MapStationParkingTimeVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
@ -39,6 +40,13 @@ public class RunPlanParkingTimeVO {
@NotNull(message = "停站时间不能为空")
private Integer parkingTime;
public RunPlanParkingTimeVO(MapStationParkingTimeVO vo) {
this.mapId = vo.getMapId();
this.stationCode = vo.getStationCode();
this.sectionCode = vo.getSectionCode();
this.parkingTime = vo.getParkingTime();
}
public RunPlanParktime convert2Entity() {
RunPlanParktime runPlanParktime = new RunPlanParktime();

View File

@ -88,6 +88,21 @@ public class RunPlanRunlevelVO {
@PositiveOrZero
private Integer l5;
public RunPlanRunlevelVO(MapStationRunLevelVO vo) {
this.mapId = vo.getMapId();
this.startStationCode = vo.getStartStationCode();
this.startSectionCode = vo.getStartSectionCode();
this.endStationCode = vo.getEndStationCode();
this.endSectionCode = vo.getEndSectionCode();
this.right = vo.getRight();
this.distance = vo.getDistance();
this.l1 = vo.getL1();
this.l2 = vo.getL2();
this.l3 = vo.getL3();
this.l4 = vo.getL4();
this.l5 = vo.getL5();
}
public static List<RunPlanRunlevelVO> convert2VOList(List<RunPlanRunlevel> list) {
List<RunPlanRunlevelVO> voList = new ArrayList<>();
if (!CollectionUtils.isEmpty(list)) {

View File

@ -5,9 +5,8 @@
<id column="id" jdbcType="BIGINT" property="id" />
<result column="map_id" jdbcType="BIGINT" property="mapId" />
<result column="station_code" jdbcType="VARCHAR" property="stationCode" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="club.joylink.rtss.entity.DraftMapParkingTime">
<result column="section_parking_time" jdbcType="LONGVARCHAR" property="sectionParkingTime" />
<result column="section_code" jdbcType="VARCHAR" property="sectionCode" />
<result column="parking_time" jdbcType="INTEGER" property="parkingTime" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -68,35 +67,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, map_id, station_code
id, map_id, station_code, section_code, parking_time
</sql>
<sql id="Blob_Column_List">
section_parking_time
</sql>
<select id="selectByExampleWithBLOBs" parameterType="club.joylink.rtss.entity.DraftMapParkingTimeExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from draft_map_parking_time
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<select id="selectByExample" parameterType="club.joylink.rtss.entity.DraftMapParkingTimeExample" resultMap="BaseResultMap">
select
<if test="distinct">
@ -119,11 +91,9 @@
</if>
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from draft_map_parking_time
where id = #{id,jdbcType=BIGINT}
</select>
@ -138,10 +108,10 @@
</if>
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.DraftMapParkingTime" useGeneratedKeys="true">
insert into draft_map_parking_time (map_id, station_code, section_parking_time
)
values (#{mapId,jdbcType=BIGINT}, #{stationCode,jdbcType=VARCHAR}, #{sectionParkingTime,jdbcType=LONGVARCHAR}
)
insert into draft_map_parking_time (map_id, station_code, section_code,
parking_time)
values (#{mapId,jdbcType=BIGINT}, #{stationCode,jdbcType=VARCHAR}, #{sectionCode,jdbcType=VARCHAR},
#{parkingTime,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.DraftMapParkingTime" useGeneratedKeys="true">
insert into draft_map_parking_time
@ -152,8 +122,11 @@
<if test="stationCode != null">
station_code,
</if>
<if test="sectionParkingTime != null">
section_parking_time,
<if test="sectionCode != null">
section_code,
</if>
<if test="parkingTime != null">
parking_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
@ -163,8 +136,11 @@
<if test="stationCode != null">
#{stationCode,jdbcType=VARCHAR},
</if>
<if test="sectionParkingTime != null">
#{sectionParkingTime,jdbcType=LONGVARCHAR},
<if test="sectionCode != null">
#{sectionCode,jdbcType=VARCHAR},
</if>
<if test="parkingTime != null">
#{parkingTime,jdbcType=INTEGER},
</if>
</trim>
</insert>
@ -186,29 +162,24 @@
<if test="record.stationCode != null">
station_code = #{record.stationCode,jdbcType=VARCHAR},
</if>
<if test="record.sectionParkingTime != null">
section_parking_time = #{record.sectionParkingTime,jdbcType=LONGVARCHAR},
<if test="record.sectionCode != null">
section_code = #{record.sectionCode,jdbcType=VARCHAR},
</if>
<if test="record.parkingTime != null">
parking_time = #{record.parkingTime,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update draft_map_parking_time
set id = #{record.id,jdbcType=BIGINT},
map_id = #{record.mapId,jdbcType=BIGINT},
station_code = #{record.stationCode,jdbcType=VARCHAR},
section_parking_time = #{record.sectionParkingTime,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update draft_map_parking_time
set id = #{record.id,jdbcType=BIGINT},
map_id = #{record.mapId,jdbcType=BIGINT},
station_code = #{record.stationCode,jdbcType=VARCHAR}
station_code = #{record.stationCode,jdbcType=VARCHAR},
section_code = #{record.sectionCode,jdbcType=VARCHAR},
parking_time = #{record.parkingTime,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -222,23 +193,21 @@
<if test="stationCode != null">
station_code = #{stationCode,jdbcType=VARCHAR},
</if>
<if test="sectionParkingTime != null">
section_parking_time = #{sectionParkingTime,jdbcType=LONGVARCHAR},
<if test="sectionCode != null">
section_code = #{sectionCode,jdbcType=VARCHAR},
</if>
<if test="parkingTime != null">
parking_time = #{parkingTime,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="club.joylink.rtss.entity.DraftMapParkingTime">
update draft_map_parking_time
set map_id = #{mapId,jdbcType=BIGINT},
station_code = #{stationCode,jdbcType=VARCHAR},
section_parking_time = #{sectionParkingTime,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.DraftMapParkingTime">
update draft_map_parking_time
set map_id = #{mapId,jdbcType=BIGINT},
station_code = #{stationCode,jdbcType=VARCHAR}
station_code = #{stationCode,jdbcType=VARCHAR},
section_code = #{sectionCode,jdbcType=VARCHAR},
parking_time = #{parkingTime,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>