西安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())) {
emptyDirection.add(runPlanImport.getServiceNumber());
}
handleStationAndTime(stationMap, runPlanImport.getArrivalList());
handleStationAndTime(stationMap, runPlanImport);
});
// 筛选存在 只有服务号的数据
Map<String, List<RunPlanImport>> onlyServNumMap = runPlanImportList.stream().filter(runPlanImport ->

View File

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

View File

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

View File

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

View File

@ -170,6 +170,11 @@ public interface IRunPlanStrategyNew {
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);
});
return tripList;
@ -179,12 +184,14 @@ public interface IRunPlanStrategyNew {
* 处理站台 stationName -> stationVO
* 处理时间 到发时间处理偏移
* 服务号按到站时间排序
*
* @param stationMap
* @param arrivalList
* @param stationMap
* @param runPlanImport
*/
default void handleStationAndTime(Map<String, MapStationNewVO> stationMap, List<RunPlanArrivalTime> arrivalList) {
arrivalList.forEach(runPlanArrivalTime -> {
default void handleStationAndTime(Map<String, MapStationNewVO> stationMap, RunPlanImport runPlanImport) {
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", "");
MapStationNewVO mapStationVO = stationMap.get(stationName);
@ -192,8 +199,19 @@ public interface IRunPlanStrategyNew {
String.format("真实运行图车站名称'%s'没有找到对应车站数据", stationName));
runPlanArrivalTime.setStationNewVO(mapStationVO);
// 到发时间处理
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(Objects.isNull(runPlanArrivalTime.getArriveTime()) && Objects.isNull(runPlanArrivalTime.getDepartureTime()),
String.format("数据异常:‘%s到发时间都为空", stationName));
if (i != arrivalList.size() - 1) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(Objects.isNull(runPlanArrivalTime.getArriveTime()) && Objects.isNull(runPlanArrivalTime.getDepartureTime()),
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())) {
runPlanArrivalTime.setArriveTime(runPlanArrivalTime.getArriveTime().minusHours(OFFSET_TIME_HOURS));
}
@ -207,7 +225,8 @@ public interface IRunPlanStrategyNew {
}
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(runPlanArrivalTime.getDepartureTime().isBefore(runPlanArrivalTime.getArriveTime()),
String.format("数据异常:‘%s到发时间异常,到达时间%s-发车时间%s", stationName,runPlanArrivalTime.getArriveTime(),runPlanArrivalTime.getDepartureTime()));
});
}
arrivalList.removeAll(removes);
// 按到达时间增序排序
arrivalList.sort(Comparator.comparing(RunPlanArrivalTime::getArriveTime));
}

View File

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

View File

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

View File

@ -31,7 +31,7 @@ public class XianLine1RunPlanNew implements IRunPlanStrategyNew {
runPlanImportList.forEach(runPlanImport -> {
this.analyzeAndConvertCode(runPlanImport, upDirection);
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 -> {
this.analyzeAndConvertCode(runPlanImport, upDirection);
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.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.RunPlanTripTimeVO;
import club.joylink.rtss.vo.client.runplan.RunPlanTripVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.StringUtils;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -36,6 +32,17 @@ public class XianLine3RunPlanNew implements IRunPlanStrategyNew {
/**保税区ZF11折返*/
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 -> {
this.analyzeAndConvertCode(runPlanImport, upDirection);
List<RunPlanArrivalTime> arrivalList = runPlanImport.getArrivalList();
handleStationAndTime(stationMap, arrivalList);
handleStationAndTime(stationMap, runPlanImport);
});
}
@ -90,42 +95,12 @@ public class XianLine3RunPlanNew implements IRunPlanStrategyNew {
*/
@Override
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
// tripVO.setDestinationCode("015");
break;
case "港务区车辆段":
tripVO.setStartSectionCode("T275"); //G2620
// tripVO.setDestinationCode("266");
break;
case "鱼化寨":
if (YUHUAZHAI_ZF20.contains(runPlanImport.getCode())) {
tripVO.setStartSectionCode("T5"); //G0120
// tripVO.setDestinationCode("014");
} else {
tripVO.setStartSectionCode("T10"); //G0119
// tripVO.setDestinationCode("017");
}
break;
case "香湖湾":
if (XIANGHUWAN_ZF13.contains(runPlanImport.getCode())) {
tripVO.setStartSectionCode("T209"); //G2113
// tripVO.setDestinationCode("213");
} else {
tripVO.setStartSectionCode("T208"); //G2114
// tripVO.setDestinationCode("212");
}
break;
case "保税区":
if (BAOSHUIQU_ZF11.contains(runPlanImport.getCode())) {
tripVO.setStartSectionCode("T271"); //G2611
// tripVO.setDestinationCode("263");
} else {
tripVO.setStartSectionCode("T270"); //G2610
// tripVO.setDestinationCode("262");
}
break;
}
switch (endStationName) {
@ -137,33 +112,86 @@ public class XianLine3RunPlanNew implements IRunPlanStrategyNew {
tripVO.setEndSectionCode("T281"); //G2621
tripVO.setDestinationCode("267");
break;
case "鱼化寨":
if (YUHUAZHAI_ZF20.contains(runPlanImport.getCode())) {
tripVO.setEndSectionCode("T5"); //G0120
tripVO.setDestinationCode("014");
} else {
tripVO.setEndSectionCode("T10"); //G0119
tripVO.setDestinationCode("017");
}
break;
case "香湖湾":
if (XIANGHUWAN_ZF13.contains(runPlanImport.getCode())) {
tripVO.setEndSectionCode("T209"); //G2113
tripVO.setDestinationCode("213");
} else {
tripVO.setEndSectionCode("T208"); //G2114
tripVO.setDestinationCode("212");
}
break;
case "保税区":
if (BAOSHUIQU_ZF11.contains(runPlanImport.getCode())) {
tripVO.setEndSectionCode("T271"); //G2611
tripVO.setDestinationCode("263");
} else {
tripVO.setEndSectionCode("T270"); //G2610
tripVO.setDestinationCode("262");
}
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) {
case "鱼化寨停车场":
tripVO.setStartSectionCode("T7");//G0113
// tripVO.setDestinationCode("015");
break;
case "港务区车辆段":
tripVO.setStartSectionCode("T275"); //G2620
// tripVO.setDestinationCode("266");
break;
case "鱼化寨":
if (YUHUAZHAI_ZF20.contains(runPlanImport.getCode())) {
tripVO.setStartSectionCode("T5"); //G0120
// tripVO.setDestinationCode("014");
} else {
tripVO.setStartSectionCode("T10"); //G0119
// tripVO.setDestinationCode("017");
}
break;
case "香湖湾":
if (XIANGHUWAN_ZF13.contains(runPlanImport.getCode())) {
tripVO.setStartSectionCode("T209"); //G2113
// tripVO.setDestinationCode("213");
} else {
tripVO.setStartSectionCode("T208"); //G2114
// tripVO.setDestinationCode("212");
}
break;
case "保税区":
if (BAOSHUIQU_ZF11.contains(runPlanImport.getCode())) {
tripVO.setStartSectionCode("T271"); //G2611
// tripVO.setDestinationCode("263");
} else {
tripVO.setStartSectionCode("T270"); //G2610
// tripVO.setDestinationCode("262");
}
break;
}
switch (endStationName) {
case "鱼化寨停车场":
tripVO.setEndSectionCode("T2");//G0114
tripVO.setDestinationCode("012");
break;
case "港务区车辆段":
tripVO.setEndSectionCode("T281"); //G2621
tripVO.setDestinationCode("267");
break;
case "鱼化寨":
if (YUHUAZHAI_ZF20.contains(runPlanImport.getCode())) {
tripVO.setEndSectionCode("T5"); //G0120
tripVO.setDestinationCode("014");
} else {
tripVO.setEndSectionCode("T10"); //G0119
tripVO.setDestinationCode("017");
}
break;
case "香湖湾":
if (XIANGHUWAN_ZF13.contains(runPlanImport.getCode())) {
tripVO.setEndSectionCode("T209"); //G2113
tripVO.setDestinationCode("213");
} else {
tripVO.setEndSectionCode("T208"); //G2114
tripVO.setDestinationCode("212");
}
break;
case "保税区":
if (BAOSHUIQU_ZF11.contains(runPlanImport.getCode())) {
tripVO.setEndSectionCode("T271"); //G2611
tripVO.setDestinationCode("263");
} else {
tripVO.setEndSectionCode("T270"); //G2610
tripVO.setDestinationCode("262");
}
break;
}
}
}

View File

@ -18,6 +18,11 @@ public class RunPlanArrivalTime {
@NotBlank(message = "车站名称不能为空")
private String stationName;
/**
* 停车轨名称
*/
private String trackName;
@ApiModelProperty(hidden = true)
private MapStationVO stationVO;
@ -28,6 +33,8 @@ public class RunPlanArrivalTime {
private LocalTime departureTime;
private boolean tb;// 折返
@ApiModelProperty(value = "是否进入/离开线路")
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.ApiModelProperty;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
@ -28,6 +27,11 @@ public class RunPlanImport {
@Valid
private List<RunPlanArrivalTime> arrivalList;
/**
* 折返轨名称
*/
private String tbTrackName;
@ApiModelProperty(hidden = true)
private String serviceNumber;