Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
f1ed0d632f
@ -4,6 +4,7 @@ import club.joylink.rtss.entity.RunPlanRouting;
|
|||||||
import club.joylink.rtss.entity.RunPlanRoutingExample;
|
import club.joylink.rtss.entity.RunPlanRoutingExample;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.ResultMap;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@ -45,4 +46,14 @@ public interface RunPlanRoutingDAO {
|
|||||||
"AND section_data = #{sectionData} " +
|
"AND section_data = #{sectionData} " +
|
||||||
"</script>")
|
"</script>")
|
||||||
Integer countUserRoutingBySectionData(@Param("userId") Long userId, @Param("mapId") Long mapId, @Param("sectionData") String sectionData);
|
Integer countUserRoutingBySectionData(@Param("userId") Long userId, @Param("mapId") Long mapId, @Param("sectionData") String sectionData);
|
||||||
|
|
||||||
|
@ResultMap("ResultMapWithBLOBs")
|
||||||
|
@Select("<script>" +
|
||||||
|
"SELECT * " +
|
||||||
|
"FROM run_plan_routing " +
|
||||||
|
"WHERE map_id = #{mapId} " +
|
||||||
|
"AND user_id = #{userId} " +
|
||||||
|
"AND section_data = #{sectionData} " +
|
||||||
|
"</script>")
|
||||||
|
RunPlanRouting getUserRoutingBySectionData(@Param("userId") Long userId, @Param("mapId") Long mapId, @Param("sectionData") String sectionData);
|
||||||
}
|
}
|
||||||
|
@ -181,6 +181,7 @@ public class MapService implements IMapService {
|
|||||||
public PageVO<MapVO> queryPagedMaps(MapQueryVO queryVO) {
|
public PageVO<MapVO> queryPagedMaps(MapQueryVO queryVO) {
|
||||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||||
MapInfoExample example = new MapInfoExample();
|
MapInfoExample example = new MapInfoExample();
|
||||||
|
example.setOrderByClause("id");
|
||||||
MapInfoExample.Criteria criteria = example.createCriteria();
|
MapInfoExample.Criteria criteria = example.createCriteria();
|
||||||
criteria.andStatusNotEqualTo(MapStatus.Delete.getCode());
|
criteria.andStatusNotEqualTo(MapStatus.Delete.getCode());
|
||||||
if (StringUtils.hasText(queryVO.getName())) {
|
if (StringUtils.hasText(queryVO.getName())) {
|
||||||
@ -557,6 +558,7 @@ public class MapService implements IMapService {
|
|||||||
@Override
|
@Override
|
||||||
public List<MapVO> findOnlineMapByProjectCode(String projectCode) {
|
public List<MapVO> findOnlineMapByProjectCode(String projectCode) {
|
||||||
MapInfoExample example = new MapInfoExample();
|
MapInfoExample example = new MapInfoExample();
|
||||||
|
example.setOrderByClause("order_number");
|
||||||
example.createCriteria().andProjectCodeEqualTo(projectCode).andStatusEqualTo(MapStatus.Online.getCode());
|
example.createCriteria().andProjectCodeEqualTo(projectCode).andStatusEqualTo(MapStatus.Online.getCode());
|
||||||
List<MapInfo> mapInfoList = mapInfoDAO.selectByExample(example);
|
List<MapInfo> mapInfoList = mapInfoDAO.selectByExample(example);
|
||||||
return MapVO.convert2VOList(mapInfoList);
|
return MapVO.convert2VOList(mapInfoList);
|
||||||
|
@ -11,6 +11,9 @@ import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
|||||||
import club.joylink.rtss.services.runplan.IRunPlanRoutingService;
|
import club.joylink.rtss.services.runplan.IRunPlanRoutingService;
|
||||||
import club.joylink.rtss.services.runplan.IRunPlanUserConfigService;
|
import club.joylink.rtss.services.runplan.IRunPlanUserConfigService;
|
||||||
import club.joylink.rtss.simulation.cbtc.GroupSimulationService;
|
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.data.map.MapElement;
|
||||||
import club.joylink.rtss.util.JsonUtils;
|
import club.joylink.rtss.util.JsonUtils;
|
||||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||||
import club.joylink.rtss.vo.UserVO;
|
import club.joylink.rtss.vo.UserVO;
|
||||||
@ -881,75 +884,15 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
|||||||
if (CollectionUtils.isEmpty(planVO.getTripList())) {
|
if (CollectionUtils.isEmpty(planVO.getTripList())) {
|
||||||
errorList.add("运行图数据为空!");
|
errorList.add("运行图数据为空!");
|
||||||
}
|
}
|
||||||
// Map<String, List<RunPlanTripVO>> serviceMap = planVO.getTripList().stream().collect(Collectors.groupingBy(RunPlanTripVO::getServiceNumber));
|
MapVO map = this.iMapService.getMapDetail(planVO.getMapId());
|
||||||
// MapVO mapVO = this.iMapService.getMapDetail(planVO.getMapId());
|
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
|
||||||
// // 转换轨
|
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
|
||||||
//// List<MapSectionVO> transferTrackSectionList = mapVO.findTransferTrackList();
|
"地图基础数据校验不通过");
|
||||||
//// List<String> transferTrackSectionCodeList = transferTrackSectionList.stream().map(MapSectionVO::getCode).collect(Collectors.toList());
|
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
|
||||||
// // 车次数据检查
|
RunPlanBuilder.RunPlanBuildResult runPlanBuildResult =
|
||||||
// serviceMap.forEach((serviceNumber, list) -> {
|
RunPlanBuilder.buildRunDiagram(deviceMap, planVO);
|
||||||
// list.sort(Comparator.comparing(runPlanTripVO -> runPlanTripVO.getTimeList().get(0).getArrivalTime()));
|
|
||||||
// // 检查出入库
|
|
||||||
// if (Objects.isNull(list.get(0).getIsOutbound()) || !list.get(0).getIsOutbound()) {
|
|
||||||
// errorList.add(String.format("服务号 %s 没有出库数据!", serviceNumber));
|
|
||||||
// }
|
|
||||||
// if (Objects.isNull(list.get(list.size() - 1).getIsInbound()) || !list.get(list.size() - 1).getIsInbound()) {
|
|
||||||
// errorList.add(String.format("服务号 %s 没有入库数据!", serviceNumber));
|
|
||||||
// }
|
|
||||||
// // 检查方向,折返前后车站
|
|
||||||
// for (int i = 0; i < list.size() - 1; i++) {
|
|
||||||
// RunPlanTripVO tripVO1 = list.get(i);
|
|
||||||
// RunPlanTripVO tripVO2 = list.get(i + 1);
|
|
||||||
//// if(transferTrackSectionCodeList.contains(tripVO1.getEndSectionCode())
|
|
||||||
//// && transferTrackSectionCodeList.contains(sequenceDraft2.getStartSectionCode())) {
|
|
||||||
//// continue;
|
|
||||||
//// }
|
|
||||||
// // TODO
|
|
||||||
//// if(Objects.equals(tripVO1.getDirectionCode(), tripVO2.getDirectionCode())) {
|
|
||||||
//// String SDTNumber1 = tripVO1.getServiceNumber() + tripVO1.getDirectionCode() + tripVO1.getTripNumber();
|
|
||||||
//// String SDTNumber2 = tripVO2.getServiceNumber() + tripVO2.getDirectionCode() + tripVO2.getTripNumber();
|
|
||||||
//// errorList.add(String.format("车次号 %s 与车次号 %s 列车存在运行方向冲突!", SDTNumber1, SDTNumber2));
|
|
||||||
//// }
|
|
||||||
//// if(!Objects.equals(sequenceDraft1.getEndSectionCode(), sequenceDraft2.getStartSectionCode())) {
|
|
||||||
//// String SDTNumber1 = sequenceDraft1.getServiceNumber() + sequenceDraft1.getDirectionCode() + sequenceDraft1.getTripNumber();
|
|
||||||
//// String SDTNumber2 = sequenceDraft2.getServiceNumber() + sequenceDraft2.getDirectionCode() + sequenceDraft2.getTripNumber();
|
|
||||||
//// errorList.add(String.format("车次号 %s 终点与车次号 %s 起点不一致!", SDTNumber1, SDTNumber2));
|
|
||||||
//// }
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// // 检查运行时间
|
|
||||||
//// List<MapStationVO> stationVOList = this.iMapService.getSortedStationListByMapSkin(runPlanDraft.getSkinCode());
|
|
||||||
//// Map<String, String> stationVOMap = stationVOList.stream()
|
|
||||||
//// .collect(Collectors.toMap(MapStationVO::getCode, MapStationVO::getName));
|
|
||||||
//// List<MapSectionVO> standTrackList = iMapService.getStandTrackListByMapSkin(runPlanDraft.getSkinCode());
|
|
||||||
//// Map<String, List<RunPlanArrivalDraft>> arriveSectionMap = arrivalDraftList.stream()
|
|
||||||
//// .collect(Collectors.groupingBy(RunPlanArrivalDraft::getSectionCode));
|
|
||||||
//// arrivalDraftList.sort(Comparator.comparing(RunPlanArrivalDraft::getArriveTime));
|
|
||||||
//// arriveSectionMap.forEach((sectionCode, arriveList) -> {
|
|
||||||
//// arriveList.sort(Comparator.comparing(RunPlanArrivalDraft::getArriveTime));
|
|
||||||
//// for(int i = 0; i < arriveList.size() - 1; ++i) {
|
|
||||||
//// RunPlanArrivalDraft arrivalDraft1 = arriveList.get(i);
|
|
||||||
//// RunPlanArrivalDraft arrivalDraft2 = arriveList.get(i + 1);
|
|
||||||
//// if(arrivalDraft1.getArriveTime().equals(arrivalDraft1.getDepartureTime())
|
|
||||||
//// || arrivalDraft2.getArriveTime().equals(arrivalDraft2.getDepartureTime()) ) {
|
|
||||||
//// continue;
|
|
||||||
//// }
|
|
||||||
//// long seconds = Duration.between(arrivalDraft1.getArriveTime(), arrivalDraft2.getArriveTime()).getSeconds();
|
|
||||||
//// if(seconds < 90) {
|
|
||||||
//// if(standTrackList.stream().anyMatch(sectionVO -> sectionVO.getCode().equals(arrivalDraft1.getSectionCode()))
|
|
||||||
//// && seconds >= 15) { // 站前折返
|
|
||||||
//// continue;
|
|
||||||
//// }
|
|
||||||
//// String SDTNumber1 = arrivalDraft1.getServiceNumber() + arrivalDraft1.getDirectionCode() + arrivalDraft1.getTripNumber();
|
|
||||||
//// String SDTNumber2 = arrivalDraft2.getServiceNumber() + arrivalDraft2.getDirectionCode() + arrivalDraft2.getTripNumber();
|
|
||||||
//// errorList.add(String.format("车次号 %s 与车次号 %s 列车存在运行时刻超过最大运行间隔冲突:车站 %s!",
|
|
||||||
//// SDTNumber1, SDTNumber2, stationVOMap.get(arrivalDraft1.getStationCode())));
|
|
||||||
//// }
|
|
||||||
//// }
|
|
||||||
//// });
|
|
||||||
|
|
||||||
//先屏蔽掉数据检查
|
//先屏蔽掉数据检查
|
||||||
return new ArrayList<>();
|
return runPlanBuildResult.getErrMsgList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -982,7 +925,6 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
|||||||
public String simulationCheck(Long planId, LoginUserInfoVO loginUserInfoVO) {
|
public String simulationCheck(Long planId, LoginUserInfoVO loginUserInfoVO) {
|
||||||
RunPlanVO planVO = getRunPlanById(planId);
|
RunPlanVO planVO = getRunPlanById(planId);
|
||||||
// 查询运行图数据
|
// 查询运行图数据
|
||||||
MapVO mapVO = this.iMapService.getMapDetail(planVO.getMapId());
|
|
||||||
return groupSimulationService.runPlanTestSimulation(planVO.getMapId(), planVO, loginUserInfoVO);
|
return groupSimulationService.runPlanTestSimulation(planVO.getMapId(), planVO, loginUserInfoVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,11 +26,10 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
import java.util.stream.Collector;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ -54,7 +53,7 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
|
|||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public void createUserRouting(RunPlanRoutingVO routingVO) {
|
public void createUserRouting(RunPlanRoutingVO routingVO) {
|
||||||
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(ifRoutingDataExist(routingVO));
|
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(ifRoutingDataExist(routingVO),"存在相同经停轨道的交路");
|
||||||
MapVO map = this.iMapService.getMapDetail(routingVO.getMapId());
|
MapVO map = this.iMapService.getMapDetail(routingVO.getMapId());
|
||||||
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
|
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
|
||||||
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
|
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
|
||||||
@ -86,7 +85,7 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
|
|||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public void updateUserRouting(Long routingId, RunPlanRoutingVO routingVO) {
|
public void updateUserRouting(Long routingId, RunPlanRoutingVO routingVO) {
|
||||||
// BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(ifRoutingDataExist(routingVO));
|
BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(ifRoutingDataExist(routingVO),"存在相同经停轨道的交路");
|
||||||
MapVO map = this.iMapService.getMapDetail(routingVO.getMapId());
|
MapVO map = this.iMapService.getMapDetail(routingVO.getMapId());
|
||||||
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
|
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
|
||||||
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
|
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
|
||||||
@ -178,11 +177,15 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
|
|||||||
.filter(tripVO -> tripVO.getSDTNumberNew().equals(SDTNumber))
|
.filter(tripVO -> tripVO.getSDTNumberNew().equals(SDTNumber))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElseThrow(() -> BusinessExceptionAssertEnum.DATA_NOT_EXIST.exception());
|
.orElseThrow(() -> BusinessExceptionAssertEnum.DATA_NOT_EXIST.exception());
|
||||||
RunPlanRoutingExample example = new RunPlanRoutingExample();
|
List<RunPlanRoutingSection> routingSections = trip.getTimeList().stream().map(rt -> {
|
||||||
example.createCriteria().andMapIdEqualTo(planVO.getMapId()).andUserIdEqualTo(userId).andStartSectionCodeEqualTo(trip.getStartSectionCode()).andEndSectionCodeEqualTo(trip.getEndSectionCode());
|
RunPlanRoutingSection routingSection = new RunPlanRoutingSection();
|
||||||
List<RunPlanRouting> runPlanRoutings = runPlanRoutingDAO.selectByExampleWithBLOBs(example);
|
routingSection.setStationCode(rt.getStationCode());
|
||||||
if (CollectionUtils.isEmpty(runPlanRoutings)) return null;
|
routingSection.setSectionCode(rt.getSectionCode());
|
||||||
return RunPlanRoutingVO.convert2VO(runPlanRoutings.get(0));
|
return routingSection;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
RunPlanRouting runPlanRouting = runPlanRoutingDAO.getUserRoutingBySectionData(userId,planVO.getMapId(),JsonUtils.writeValueAsString(routingSections));
|
||||||
|
if (Objects.isNull(runPlanRouting)) return null;
|
||||||
|
return RunPlanRoutingVO.convert2VO(runPlanRouting);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -49,7 +49,7 @@ public class RunPlanBuilder {
|
|||||||
* @param runPlan
|
* @param runPlan
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
static RunPlanBuildResult buildRunDiagram(Map<String, ? extends MapElement> deviceMap, RunPlanVO runPlan) {
|
public static RunPlanBuildResult buildRunDiagram(Map<String, ? extends MapElement> deviceMap, RunPlanVO runPlan) {
|
||||||
RunPlanBuildResult result = new RunPlanBuildResult();
|
RunPlanBuildResult result = new RunPlanBuildResult();
|
||||||
List<String> errMsgList = result.getErrMsgList();
|
List<String> errMsgList = result.getErrMsgList();
|
||||||
Map<String, List<TripPlan>> serverTripMap = result.getServerTripMap();
|
Map<String, List<TripPlan>> serverTripMap = result.getServerTripMap();
|
||||||
|
@ -50,6 +50,8 @@ public class SimulationVO {
|
|||||||
|
|
||||||
private LocalDateTime delTime;
|
private LocalDateTime delTime;
|
||||||
|
|
||||||
|
private List<String> errorMsgList;
|
||||||
|
|
||||||
public static SimulationVO buildBasicInfo(Simulation simulation) {
|
public static SimulationVO buildBasicInfo(Simulation simulation) {
|
||||||
MapVO map = simulation.getBuildParams().getMap();
|
MapVO map = simulation.getBuildParams().getMap();
|
||||||
MapVO mapVO = new MapVO();
|
MapVO mapVO = new MapVO();
|
||||||
@ -71,6 +73,7 @@ public class SimulationVO {
|
|||||||
.type(simulation.getBuildParams().getFunctionalType())
|
.type(simulation.getBuildParams().getFunctionalType())
|
||||||
.prodType(Objects.nonNull(simulation.getBuildParams().getProdType()) ? simulation.getBuildParams().getProdType().getCode() : null)
|
.prodType(Objects.nonNull(simulation.getBuildParams().getProdType()) ? simulation.getBuildParams().getProdType().getCode() : null)
|
||||||
.dataError(simulation.isMapDataError() || simulation.isPlanDataError())
|
.dataError(simulation.isMapDataError() || simulation.isPlanDataError())
|
||||||
|
.errorMsgList(simulation.getDataErrMsgList())
|
||||||
.systemTime(systemTime)
|
.systemTime(systemTime)
|
||||||
.planRunning(simulation.isPlanRunning())
|
.planRunning(simulation.isPlanRunning())
|
||||||
.scriptId(Objects.isNull(simulation.getScript()) ? null : simulation.getScript().getId())
|
.scriptId(Objects.isNull(simulation.getScript()) ? null : simulation.getScript().getId())
|
||||||
|
@ -163,6 +163,9 @@ public class RunPlanGenerator {
|
|||||||
runPlanTripVO.setTimeList(tripTimeList);
|
runPlanTripVO.setTimeList(tripTimeList);
|
||||||
setTripTerminalTime(runPlanTripVO, tripTimeList, runPlanInput.getReentryTime());
|
setTripTerminalTime(runPlanTripVO, tripTimeList, runPlanInput.getReentryTime());
|
||||||
lastTripEndTime = runPlanTripVO.getEndTime();
|
lastTripEndTime = runPlanTripVO.getEndTime();
|
||||||
|
if(CollectionUtils.isEmpty(tempTripList)){
|
||||||
|
runPlanTripVO.setIsOutbound(true);
|
||||||
|
}
|
||||||
tempTripList.add(runPlanTripVO);
|
tempTripList.add(runPlanTripVO);
|
||||||
if (tempTripList.size() > 50) { // 最快半小时跑一趟的一天车次数,如果大于这个,可能死循环,此时停止发车
|
if (tempTripList.size() > 50) { // 最快半小时跑一趟的一天车次数,如果大于这个,可能死循环,此时停止发车
|
||||||
|
|
||||||
|
@ -7,10 +7,8 @@ import lombok.Getter;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import javax.validation.constraints.Min;
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import javax.validation.constraints.Positive;
|
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
|
|
||||||
@ApiModel(value = "运行图生成输入参数")
|
@ApiModel(value = "运行图生成输入参数")
|
||||||
|
Loading…
Reference in New Issue
Block a user