Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
4e5cd4dce4
@ -6,7 +6,7 @@ package club.joylink.rtss.constants;
|
||||
public enum Project {
|
||||
/** 自己项目 */
|
||||
DEFAULT,
|
||||
/** 西铁院定制项目 */
|
||||
/** 西铁院项目 */
|
||||
XTY,
|
||||
/** 南铁院项目 */
|
||||
NTY,
|
||||
|
@ -4,6 +4,7 @@ import club.joylink.rtss.entity.RunPlanRouting;
|
||||
import club.joylink.rtss.entity.RunPlanRoutingExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.ResultMap;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@ -45,4 +46,14 @@ public interface RunPlanRoutingDAO {
|
||||
"AND section_data = #{sectionData} " +
|
||||
"</script>")
|
||||
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);
|
||||
}
|
||||
|
@ -11,6 +11,9 @@ import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.services.runplan.IRunPlanRoutingService;
|
||||
import club.joylink.rtss.services.runplan.IRunPlanUserConfigService;
|
||||
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.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
@ -881,75 +884,15 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
||||
if (CollectionUtils.isEmpty(planVO.getTripList())) {
|
||||
errorList.add("运行图数据为空!");
|
||||
}
|
||||
// Map<String, List<RunPlanTripVO>> serviceMap = planVO.getTripList().stream().collect(Collectors.groupingBy(RunPlanTripVO::getServiceNumber));
|
||||
// MapVO mapVO = this.iMapService.getMapDetail(planVO.getMapId());
|
||||
// // 转换轨
|
||||
//// List<MapSectionVO> transferTrackSectionList = mapVO.findTransferTrackList();
|
||||
//// List<String> transferTrackSectionCodeList = transferTrackSectionList.stream().map(MapSectionVO::getCode).collect(Collectors.toList());
|
||||
// // 车次数据检查
|
||||
// serviceMap.forEach((serviceNumber, list) -> {
|
||||
// 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())));
|
||||
//// }
|
||||
//// }
|
||||
//// });
|
||||
|
||||
MapVO map = this.iMapService.getMapDetail(planVO.getMapId());
|
||||
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
|
||||
"地图基础数据校验不通过");
|
||||
Map<String, MapElement> deviceMap = buildResult.getDeviceMap();
|
||||
RunPlanBuilder.RunPlanBuildResult runPlanBuildResult =
|
||||
RunPlanBuilder.buildRunDiagram(deviceMap, planVO);
|
||||
//先屏蔽掉数据检查
|
||||
return new ArrayList<>();
|
||||
return runPlanBuildResult.getErrMsgList();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ -982,7 +925,6 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
||||
public String simulationCheck(Long planId, LoginUserInfoVO loginUserInfoVO) {
|
||||
RunPlanVO planVO = getRunPlanById(planId);
|
||||
// 查询运行图数据
|
||||
MapVO mapVO = this.iMapService.getMapDetail(planVO.getMapId());
|
||||
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.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collector;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@ -54,7 +53,7 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
|
||||
@Transactional
|
||||
@Override
|
||||
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());
|
||||
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
|
||||
@ -86,7 +85,7 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
|
||||
@Transactional
|
||||
@Override
|
||||
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());
|
||||
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
|
||||
@ -178,11 +177,15 @@ public class RunPlanRoutingService implements IRunPlanRoutingService {
|
||||
.filter(tripVO -> tripVO.getSDTNumberNew().equals(SDTNumber))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> BusinessExceptionAssertEnum.DATA_NOT_EXIST.exception());
|
||||
RunPlanRoutingExample example = new RunPlanRoutingExample();
|
||||
example.createCriteria().andMapIdEqualTo(planVO.getMapId()).andUserIdEqualTo(userId).andStartSectionCodeEqualTo(trip.getStartSectionCode()).andEndSectionCodeEqualTo(trip.getEndSectionCode());
|
||||
List<RunPlanRouting> runPlanRoutings = runPlanRoutingDAO.selectByExampleWithBLOBs(example);
|
||||
if (CollectionUtils.isEmpty(runPlanRoutings)) return null;
|
||||
return RunPlanRoutingVO.convert2VO(runPlanRoutings.get(0));
|
||||
List<RunPlanRoutingSection> routingSections = trip.getTimeList().stream().map(rt -> {
|
||||
RunPlanRoutingSection routingSection = new RunPlanRoutingSection();
|
||||
routingSection.setStationCode(rt.getStationCode());
|
||||
routingSection.setSectionCode(rt.getSectionCode());
|
||||
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
|
||||
|
@ -49,7 +49,7 @@ public class RunPlanBuilder {
|
||||
* @param runPlan
|
||||
* @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();
|
||||
List<String> errMsgList = result.getErrMsgList();
|
||||
Map<String, List<TripPlan>> serverTripMap = result.getServerTripMap();
|
||||
|
@ -62,7 +62,8 @@ public class Joylink3DMessageService {
|
||||
public void tdtStatusCollectAndSend(Simulation simulation) {
|
||||
List<TdtStatusVO> list = new ArrayList<>();
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
for (Stand stand : repository.getStandList()) {
|
||||
List<Stand> standList = repository.getStandList();
|
||||
for (Stand stand : standList) {
|
||||
if (!stand.isSmall()) {
|
||||
TdtStatusVO statusVO = repository.queryTdtStatus(stand.getCode());
|
||||
if (Objects.isNull(statusVO)) {
|
||||
@ -74,8 +75,6 @@ public class Joylink3DMessageService {
|
||||
list.add(statusVO);
|
||||
}
|
||||
}
|
||||
TdtStatusVO tdtStatusVO = new TdtStatusVO(stand);
|
||||
list.add(tdtStatusVO);
|
||||
}
|
||||
}
|
||||
SocketMessageVO message = SocketMessageFactory.buildTrainIsAbout2ArriveMessage(simulation.getGroup(), list);
|
||||
|
@ -163,6 +163,9 @@ public class RunPlanGenerator {
|
||||
runPlanTripVO.setTimeList(tripTimeList);
|
||||
setTripTerminalTime(runPlanTripVO, tripTimeList, runPlanInput.getReentryTime());
|
||||
lastTripEndTime = runPlanTripVO.getEndTime();
|
||||
if(CollectionUtils.isEmpty(tempTripList)){
|
||||
runPlanTripVO.setIsOutbound(true);
|
||||
}
|
||||
tempTripList.add(runPlanTripVO);
|
||||
if (tempTripList.size() > 50) { // 最快半小时跑一趟的一天车次数,如果大于这个,可能死循环,此时停止发车
|
||||
|
||||
|
@ -7,10 +7,8 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Positive;
|
||||
import java.time.LocalTime;
|
||||
|
||||
@ApiModel(value = "运行图生成输入参数")
|
||||
|
Loading…
Reference in New Issue
Block a user