西安3号线新运行图导入调整

This commit is contained in:
walker-sheng 2021-05-19 17:56:08 +08:00
parent 9f2a02fe99
commit 0ba42e1021
14 changed files with 142 additions and 84 deletions

View File

@ -30,7 +30,7 @@ public class BeiJingLine1RunPlanNew implements IRunPlanStrategyNew {
if(!StringUtils.hasText(runPlanImport.getDirectionCode())) { if(!StringUtils.hasText(runPlanImport.getDirectionCode())) {
emptyDirection.add(runPlanImport.getServiceNumber()); emptyDirection.add(runPlanImport.getServiceNumber());
} }
handleStationAndTime(stationMap, runPlanImport.getArrivalList()); handleStationAndTime(stationMap, runPlanImport);
}); });
// 筛选存在 只有服务号的数据 // 筛选存在 只有服务号的数据
Map<String, List<RunPlanImport>> onlyServNumMap = runPlanImportList.stream().filter(runPlanImport -> Map<String, List<RunPlanImport>> onlyServNumMap = runPlanImportList.stream().filter(runPlanImport ->

View File

@ -32,7 +32,7 @@ public class ChengDuLine1RunPlanNew implements IRunPlanStrategyNew {
runPlanImportList.forEach(runPlanImport -> { runPlanImportList.forEach(runPlanImport -> {
this.analyzeAndConvertCode(runPlanImport,upDirection); this.analyzeAndConvertCode(runPlanImport,upDirection);
List<RunPlanArrivalTime> arrivalList = runPlanImport.getArrivalList(); List<RunPlanArrivalTime> arrivalList = runPlanImport.getArrivalList();
handleStationAndTime(stationMap, arrivalList); handleStationAndTime(stationMap, runPlanImport);
}); });
} }

View File

@ -29,7 +29,7 @@ public class ChengDuLine3RunPlanNew implements IRunPlanStrategyNew {
runPlanImportList.forEach(runPlanImport -> { runPlanImportList.forEach(runPlanImport -> {
this.analyzeAndConvertCode(runPlanImport, upDirection); this.analyzeAndConvertCode(runPlanImport, upDirection);
List<RunPlanArrivalTime> arrivalList = runPlanImport.getArrivalList(); List<RunPlanArrivalTime> arrivalList = runPlanImport.getArrivalList();
handleStationAndTime(stationMap, arrivalList); handleStationAndTime(stationMap, runPlanImport);
if(Arrays.asList("85331301","85124302","85246602").contains(runPlanImport.getCode())) { if(Arrays.asList("85331301","85124302","85246602").contains(runPlanImport.getCode())) {
runPlanImport.setBackup(true); runPlanImport.setBackup(true);
} }

View File

@ -33,7 +33,7 @@ public class FoshanTramRunPlanNew implements IRunPlanStrategyNew {
runPlanImportList.forEach(runPlanImport -> { runPlanImportList.forEach(runPlanImport -> {
this.analyzeAndConvertCode(runPlanImport, upDirection); this.analyzeAndConvertCode(runPlanImport, upDirection);
List<RunPlanArrivalTime> arrivalList = runPlanImport.getArrivalList(); List<RunPlanArrivalTime> arrivalList = runPlanImport.getArrivalList();
handleStationAndTime(stationMap, arrivalList); handleStationAndTime(stationMap, runPlanImport);
}); });
} }

View File

@ -32,7 +32,7 @@ public class FuZhouLine1RunPlanNew implements IRunPlanStrategyNew {
runPlanImportList.forEach(runPlanImport -> { runPlanImportList.forEach(runPlanImport -> {
this.analyzeAndConvertCode(runPlanImport, upDirection); this.analyzeAndConvertCode(runPlanImport, upDirection);
List<RunPlanArrivalTime> arrivalList = runPlanImport.getArrivalList(); List<RunPlanArrivalTime> arrivalList = runPlanImport.getArrivalList();
handleStationAndTime(stationMap, arrivalList); handleStationAndTime(stationMap, runPlanImport);
// 判断是否备用计划 // 判断是否备用计划
// RunPlanArrivalTime last = arrivalList.get(arrivalList.size() - 1); // RunPlanArrivalTime last = arrivalList.get(arrivalList.size() - 1);
// if(!last.isFlag() && last.getArriveTime().equals(last.getDepartureTime())) { // if(!last.isFlag() && last.getArriveTime().equals(last.getDepartureTime())) {

View File

@ -33,7 +33,7 @@ public class HarBinLine1RunPlanNew implements IRunPlanStrategyNew {
runPlanImportList.forEach(runPlanImport -> { runPlanImportList.forEach(runPlanImport -> {
this.analyzeAndConvertCode(runPlanImport,upDirection); this.analyzeAndConvertCode(runPlanImport,upDirection);
List<RunPlanArrivalTime> arrivalList = runPlanImport.getArrivalList(); List<RunPlanArrivalTime> arrivalList = runPlanImport.getArrivalList();
handleStationAndTime(stationMap, arrivalList); handleStationAndTime(stationMap, runPlanImport);
}); });
} }

View File

@ -170,6 +170,11 @@ public interface IRunPlanStrategyNew {
tempTripList.add(tripVO); tempTripList.add(tripVO);
} }
for (int i = 1; i < tempTripList.size(); i++) {
RunPlanTripVO pre = tempTripList.get(i - 1);
RunPlanTripVO vo = tempTripList.get(i);
vo.setStartSectionCode(pre.getEndSectionCode());
}
tripList.addAll(tempTripList); tripList.addAll(tempTripList);
}); });
return tripList; return tripList;
@ -179,12 +184,14 @@ public interface IRunPlanStrategyNew {
* 处理站台 stationName -> stationVO * 处理站台 stationName -> stationVO
* 处理时间 到发时间处理偏移 * 处理时间 到发时间处理偏移
* 服务号按到站时间排序 * 服务号按到站时间排序
*
* @param stationMap * @param stationMap
* @param arrivalList * @param runPlanImport
*/ */
default void handleStationAndTime(Map<String, MapStationNewVO> stationMap, List<RunPlanArrivalTime> arrivalList) { default void handleStationAndTime(Map<String, MapStationNewVO> stationMap, RunPlanImport runPlanImport) {
arrivalList.forEach(runPlanArrivalTime -> { List<RunPlanArrivalTime> arrivalList = runPlanImport.getArrivalList();
List<RunPlanArrivalTime> removes = new ArrayList<>();
for (int i = 0; i < arrivalList.size(); i++) {
RunPlanArrivalTime runPlanArrivalTime = arrivalList.get(i);
// 站名查找车站对象 // 站名查找车站对象
String stationName = runPlanArrivalTime.getStationName().replaceAll("\r\n", ""); String stationName = runPlanArrivalTime.getStationName().replaceAll("\r\n", "");
MapStationNewVO mapStationVO = stationMap.get(stationName); MapStationNewVO mapStationVO = stationMap.get(stationName);
@ -192,8 +199,19 @@ public interface IRunPlanStrategyNew {
String.format("真实运行图车站名称'%s'没有找到对应车站数据", stationName)); String.format("真实运行图车站名称'%s'没有找到对应车站数据", stationName));
runPlanArrivalTime.setStationNewVO(mapStationVO); runPlanArrivalTime.setStationNewVO(mapStationVO);
// 到发时间处理 // 到发时间处理
if (i != arrivalList.size() - 1) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(Objects.isNull(runPlanArrivalTime.getArriveTime()) && Objects.isNull(runPlanArrivalTime.getDepartureTime()), BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(Objects.isNull(runPlanArrivalTime.getArriveTime()) && Objects.isNull(runPlanArrivalTime.getDepartureTime()),
String.format("数据异常:‘%s到发时间都为空", stationName)); String.format("数据异常:‘%s到发时间都为空", stationName));
} else {
// 折返
if (StringUtils.hasText(runPlanArrivalTime.getTrackName()) &&
Objects.isNull(runPlanArrivalTime.getArriveTime()) &&
Objects.isNull(runPlanArrivalTime.getDepartureTime())) {
runPlanImport.setTbTrackName(runPlanArrivalTime.getTrackName());
removes.add(runPlanArrivalTime);
continue;
}
}
if (Objects.nonNull(runPlanArrivalTime.getArriveTime())) { if (Objects.nonNull(runPlanArrivalTime.getArriveTime())) {
runPlanArrivalTime.setArriveTime(runPlanArrivalTime.getArriveTime().minusHours(OFFSET_TIME_HOURS)); runPlanArrivalTime.setArriveTime(runPlanArrivalTime.getArriveTime().minusHours(OFFSET_TIME_HOURS));
} }
@ -207,7 +225,8 @@ public interface IRunPlanStrategyNew {
} }
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(runPlanArrivalTime.getDepartureTime().isBefore(runPlanArrivalTime.getArriveTime()), BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(runPlanArrivalTime.getDepartureTime().isBefore(runPlanArrivalTime.getArriveTime()),
String.format("数据异常:‘%s到发时间异常,到达时间%s-发车时间%s", stationName,runPlanArrivalTime.getArriveTime(),runPlanArrivalTime.getDepartureTime())); String.format("数据异常:‘%s到发时间异常,到达时间%s-发车时间%s", stationName,runPlanArrivalTime.getArriveTime(),runPlanArrivalTime.getDepartureTime()));
}); }
arrivalList.removeAll(removes);
// 按到达时间增序排序 // 按到达时间增序排序
arrivalList.sort(Comparator.comparing(RunPlanArrivalTime::getArriveTime)); arrivalList.sort(Comparator.comparing(RunPlanArrivalTime::getArriveTime));
} }

View File

@ -39,7 +39,7 @@ public class NingBoLine1RunPlanNew implements IRunPlanStrategyNew {
runPlanImportList.forEach(runPlanImport -> { runPlanImportList.forEach(runPlanImport -> {
this.analyzeAndConvertCode(runPlanImport, upDirection); this.analyzeAndConvertCode(runPlanImport, upDirection);
List<RunPlanArrivalTime> arrivalList = runPlanImport.getArrivalList(); List<RunPlanArrivalTime> arrivalList = runPlanImport.getArrivalList();
handleStationAndTime(stationMap, arrivalList); handleStationAndTime(stationMap, runPlanImport);
if(OUT2REENTRY_TRIP_CODES.contains(runPlanImport.getCode())){ if(OUT2REENTRY_TRIP_CODES.contains(runPlanImport.getCode())){
runPlanImport.setBackup(true); runPlanImport.setBackup(true);
} }

View File

@ -55,7 +55,7 @@ public class NingBoLine3RunPlanNew implements IRunPlanStrategyNew {
if(runPlanImport.getCode().equals("36301")){ if(runPlanImport.getCode().equals("36301")){
arrivalList.remove(0); arrivalList.remove(0);
} }
handleStationAndTime(stationMap, arrivalList); handleStationAndTime(stationMap, runPlanImport);
if(Arrays.asList("36102", "36203","36401","36301").contains(runPlanImport.getCode())){ if(Arrays.asList("36102", "36203","36401","36301").contains(runPlanImport.getCode())){
runPlanImport.setBackup(true); runPlanImport.setBackup(true);
} }

View File

@ -31,7 +31,7 @@ public class XianLine1RunPlanNew implements IRunPlanStrategyNew {
runPlanImportList.forEach(runPlanImport -> { runPlanImportList.forEach(runPlanImport -> {
this.analyzeAndConvertCode(runPlanImport, upDirection); this.analyzeAndConvertCode(runPlanImport, upDirection);
List<RunPlanArrivalTime> arrivalList = runPlanImport.getArrivalList(); List<RunPlanArrivalTime> arrivalList = runPlanImport.getArrivalList();
handleStationAndTime(stationMap, arrivalList); handleStationAndTime(stationMap, runPlanImport);
}); });
} }

View File

@ -33,7 +33,7 @@ public class XianLine2RunPlanNew implements IRunPlanStrategyNew {
runPlanImportList.forEach(runPlanImport -> { runPlanImportList.forEach(runPlanImport -> {
this.analyzeAndConvertCode(runPlanImport, upDirection); this.analyzeAndConvertCode(runPlanImport, upDirection);
List<RunPlanArrivalTime> arrivalList = runPlanImport.getArrivalList(); List<RunPlanArrivalTime> arrivalList = runPlanImport.getArrivalList();
handleStationAndTime(stationMap, arrivalList); handleStationAndTime(stationMap, runPlanImport);
}); });
} }

View File

@ -2,17 +2,13 @@ package club.joylink.rtss.services.runplan.importReal;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO; import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
import club.joylink.rtss.vo.client.runplan.RunPlanArrivalTime;
import club.joylink.rtss.vo.client.runplan.RunPlanImport; import club.joylink.rtss.vo.client.runplan.RunPlanImport;
import club.joylink.rtss.vo.client.runplan.RunPlanTripTimeVO; import club.joylink.rtss.vo.client.runplan.RunPlanTripTimeVO;
import club.joylink.rtss.vo.client.runplan.RunPlanTripVO; import club.joylink.rtss.vo.client.runplan.RunPlanTripVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.util.Arrays; import java.util.*;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -36,6 +32,17 @@ public class XianLine3RunPlanNew implements IRunPlanStrategyNew {
/**保税区ZF11折返*/ /**保税区ZF11折返*/
private static final List<String> BAOSHUIQU_ZF11 = Collections.unmodifiableList(Arrays.asList("022001","021019","062002","061023")); private static final List<String> BAOSHUIQU_ZF11 = Collections.unmodifiableList(Arrays.asList("022001","021019","062002","061023"));
public static final Map<String, List<String>> sectionReflectMap = new HashMap<>();
static {
sectionReflectMap.putIfAbsent("ZF19", Arrays.asList("T10", "017")); // 鱼化寨
sectionReflectMap.putIfAbsent("ZF20", Arrays.asList("T5", "014")); // 鱼化寨
sectionReflectMap.putIfAbsent("ZF10", Arrays.asList("T270", "262")); // 保税区
sectionReflectMap.putIfAbsent("ZF11", Arrays.asList("T271", "263")); // 保税区
sectionReflectMap.putIfAbsent("ZF13", Arrays.asList("T209", "213")); // 香湖湾
sectionReflectMap.putIfAbsent("ZF14", Arrays.asList("T208", "212")); // 香湖湾
}
/** /**
* 导入数据检查和预处理 * 导入数据检查和预处理
* *
@ -50,9 +57,7 @@ public class XianLine3RunPlanNew implements IRunPlanStrategyNew {
//处理导入运行图数据信息 //处理导入运行图数据信息
runPlanImportList.forEach(runPlanImport -> { runPlanImportList.forEach(runPlanImport -> {
this.analyzeAndConvertCode(runPlanImport, upDirection); this.analyzeAndConvertCode(runPlanImport, upDirection);
List<RunPlanArrivalTime> arrivalList = runPlanImport.getArrivalList(); handleStationAndTime(stationMap, runPlanImport);
handleStationAndTime(stationMap, arrivalList);
}); });
} }
@ -90,7 +95,29 @@ public class XianLine3RunPlanNew implements IRunPlanStrategyNew {
*/ */
@Override @Override
public void handleTrip(RunPlanImport runPlanImport, RunPlanTripVO tripVO, String startStationName, String endStationName, boolean isFirst, boolean isLast, String firstStationName, String finalStationName) { public void handleTrip(RunPlanImport runPlanImport, RunPlanTripVO tripVO, String startStationName, String endStationName, boolean isFirst, boolean isLast, String firstStationName, String finalStationName) {
switch (startStationName) {
case "鱼化寨停车场":
tripVO.setStartSectionCode("T7");//G0113
break;
case "港务区车辆段":
tripVO.setStartSectionCode("T275"); //G2620
break;
}
switch (endStationName) {
case "鱼化寨停车场":
tripVO.setEndSectionCode("T2");//G0114
tripVO.setDestinationCode("012");
break;
case "港务区车辆段":
tripVO.setEndSectionCode("T281"); //G2621
tripVO.setDestinationCode("267");
break;
}
if (Objects.nonNull(runPlanImport.getTbTrackName())) {
List<String> strings = sectionReflectMap.get(runPlanImport.getTbTrackName());
tripVO.setEndSectionCode(strings.get(0));
tripVO.setDestinationCode(strings.get(1));
} else {
switch (startStationName) { switch (startStationName) {
case "鱼化寨停车场": case "鱼化寨停车场":
tripVO.setStartSectionCode("T7");//G0113 tripVO.setStartSectionCode("T7");//G0113
@ -166,6 +193,7 @@ public class XianLine3RunPlanNew implements IRunPlanStrategyNew {
break; break;
} }
} }
}
/** /**
* 处理一个车次的时刻信息 * 处理一个车次的时刻信息

View File

@ -18,6 +18,11 @@ public class RunPlanArrivalTime {
@NotBlank(message = "车站名称不能为空") @NotBlank(message = "车站名称不能为空")
private String stationName; private String stationName;
/**
* 停车轨名称
*/
private String trackName;
@ApiModelProperty(hidden = true) @ApiModelProperty(hidden = true)
private MapStationVO stationVO; private MapStationVO stationVO;
@ -28,6 +33,8 @@ public class RunPlanArrivalTime {
private LocalTime departureTime; private LocalTime departureTime;
private boolean tb;// 折返
@ApiModelProperty(value = "是否进入/离开线路") @ApiModelProperty(value = "是否进入/离开线路")
private boolean flag; private boolean flag;

View File

@ -2,7 +2,6 @@ package club.joylink.rtss.vo.client.runplan;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -28,6 +27,11 @@ public class RunPlanImport {
@Valid @Valid
private List<RunPlanArrivalTime> arrivalList; private List<RunPlanArrivalTime> arrivalList;
/**
* 折返轨名称
*/
private String tbTrackName;
@ApiModelProperty(hidden = true) @ApiModelProperty(hidden = true)
private String serviceNumber; private String serviceNumber;