轨道交通项目迁出问题修改3

This commit is contained in:
walker-sheng 2020-11-19 17:28:47 +08:00
parent 4f0dd338dd
commit 3495375246
18 changed files with 164 additions and 223 deletions

View File

@ -1,21 +1,18 @@
package club.joylink.rtss.services.draftData; package club.joylink.rtss.services.draftData;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.joylink.base.exception.BusinessException;
import com.joylink.base.exception.constant.ExceptionMapping;
import club.joylink.rtss.dao.DraftMapRouteFlankProtectionDAO; import club.joylink.rtss.dao.DraftMapRouteFlankProtectionDAO;
import club.joylink.rtss.entity.DraftMapRouteFlankProtection; import club.joylink.rtss.entity.DraftMapRouteFlankProtection;
import club.joylink.rtss.entity.DraftMapRouteFlankProtectionExample; import club.joylink.rtss.entity.DraftMapRouteFlankProtectionExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.map.newmap.MapRouteFlankProtectionNewVO; import club.joylink.rtss.vo.client.map.newmap.MapRouteFlankProtectionNewVO;
import club.joylink.rtss.vo.client.map.newmap.MapRouteFlankProtectionQueryVO; import club.joylink.rtss.vo.client.map.newmap.MapRouteFlankProtectionQueryVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.util.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.Objects;
@Slf4j @Slf4j
@Service @Service
@ -36,9 +33,9 @@ public class DraftMapFlankProtectionServiceImpl implements DraftMapFlankProtecti
.andMapIdEqualTo(flankProtectionNewVO.getMapId()) .andMapIdEqualTo(flankProtectionNewVO.getMapId())
.andStationCodeEqualTo(flankProtectionNewVO.getStationCode()) .andStationCodeEqualTo(flankProtectionNewVO.getStationCode())
.andNameEqualTo(flankProtectionNewVO.getName()); .andNameEqualTo(flankProtectionNewVO.getName());
if (this.draftMapRouteFlankProtectionDAO.countByExample(example) > 0) { BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertTrue(
throw new BusinessException(ExceptionMapping.DATA_EXISTS, "编号或名称重复"); this.draftMapRouteFlankProtectionDAO.countByExample(example) == 0,
} "编号或名称重复");
DraftMapRouteFlankProtection entity = flankProtectionNewVO.toDB(); DraftMapRouteFlankProtection entity = flankProtectionNewVO.toDB();
this.draftMapRouteFlankProtectionDAO.insert(entity); this.draftMapRouteFlankProtectionDAO.insert(entity);
} }
@ -66,9 +63,7 @@ public class DraftMapFlankProtectionServiceImpl implements DraftMapFlankProtecti
@Override @Override
public MapRouteFlankProtectionNewVO getById(Long id) { public MapRouteFlankProtectionNewVO getById(Long id) {
DraftMapRouteFlankProtection fp = this.draftMapRouteFlankProtectionDAO.selectByPrimaryKey(id); DraftMapRouteFlankProtection fp = this.draftMapRouteFlankProtectionDAO.selectByPrimaryKey(id);
if (Objects.isNull(fp)) { BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(fp, String.format("id为[%s]的侧防数据不存在", id));
throw new BusinessException(ExceptionMapping.DATA_NOT_EXIST, String.format("id为[%s]的侧防数据不存在", id));
}
return MapRouteFlankProtectionNewVO.convert2VO(fp); return MapRouteFlankProtectionNewVO.convert2VO(fp);
} }

View File

@ -1,33 +1,29 @@
package club.joylink.rtss.services.draftData; package club.joylink.rtss.services.draftData;
import com.github.pagehelper.Page; import club.joylink.rtss.dao.DraftMapRunLevelDAO;
import com.github.pagehelper.PageHelper; import club.joylink.rtss.entity.DraftMapRunLevel;
import com.joylink.base.exception.BusinessException; import club.joylink.rtss.entity.DraftMapRunLevelExample;
import com.joylink.base.exception.DBException; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import com.joylink.base.exception.constant.ExceptionMapping; import club.joylink.rtss.services.IDraftMapService;
import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder; import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
import club.joylink.rtss.simulation.cbtc.data.CalculateService; 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.MapElement;
import club.joylink.rtss.simulation.cbtc.data.map.Section; import club.joylink.rtss.simulation.cbtc.data.map.Section;
import club.joylink.rtss.dao.DraftMapRunLevelDAO;
import club.joylink.rtss.entity.DraftMapRunLevel;
import club.joylink.rtss.entity.DraftMapRunLevelExample;
import club.joylink.rtss.services.IDraftMapService;
import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.map.MapDataVO; import club.joylink.rtss.vo.client.map.MapDataVO;
import club.joylink.rtss.vo.client.map.MapVO; 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.MapRoutingDataVO;
import club.joylink.rtss.vo.client.map.newmap.MapRunLevelQueryVO; import club.joylink.rtss.vo.client.map.newmap.MapRunLevelQueryVO;
import club.joylink.rtss.vo.client.map.newmap.MapStationRunLevelVO; import club.joylink.rtss.vo.client.map.newmap.MapStationRunLevelVO;
import org.springframework.util.StringUtils; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -44,26 +40,20 @@ public class DraftMapRunLevelServiceImpl implements DraftMapRunLevelService {
@Transactional @Transactional
public MapStationRunLevelVO generate(MapStationRunLevelVO runLevelVO) { public MapStationRunLevelVO generate(MapStationRunLevelVO runLevelVO) {
MapDataVO mapData = this.iDraftMapService.getMapData(runLevelVO.getMapId()); MapDataVO mapData = this.iDraftMapService.getMapData(runLevelVO.getMapId());
if (mapData.isDrawWay()) { MapVO map = new MapVO();
MapVO map = new MapVO(); map.setDrawWay(mapData.isDrawWay());
map.setDrawWay(mapData.isDrawWay()); map.setMapData(mapData);
map.setMapData(mapData); SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map); BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
if (!CollectionUtils.isEmpty(buildResult.getErrMsgList())) { String.format("地图基础数据校验不通过,不能生成"));
throw new BusinessException(ExceptionMapping.OPERATION_EXCEPTION, String.format("地图基础数据校验不通过,不能生成")); Section startSection = (Section) buildResult.getDeviceMap().get(runLevelVO.getStartSectionCode());
} Section endSection = (Section) buildResult.getDeviceMap().get(runLevelVO.getEndSectionCode());
Section startSection = (Section) buildResult.getDeviceMap().get(runLevelVO.getStartSectionCode()); BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(
Section endSection = (Section) buildResult.getDeviceMap().get(runLevelVO.getEndSectionCode()); null!=startSection && null!=endSection,
if (Objects.isNull(startSection) || Objects.isNull(endSection)) { "站间区段code[]不存在"
throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL, "站间区段code[]不存在"); );
} Float distance = CalculateService.calculateDistance(startSection, endSection, runLevelVO.getRight());
Float distance = CalculateService.calculateDistance(startSection, endSection, runLevelVO.getRight()); runLevelVO.setDistance(distance);
runLevelVO.setDistance(distance);
// CalculateService.findPassingStandTrack(startSection,endSection,runLevelVO.getRight());
} else {
throw new BusinessException(ExceptionMapping.OPERATION_EXCEPTION, String.format("旧地图数据不支持此功能"));
}
runLevelVO.generateDefaultRunLevel(); runLevelVO.generateDefaultRunLevel();
return runLevelVO; return runLevelVO;
} }
@ -75,26 +65,22 @@ public class DraftMapRunLevelServiceImpl implements DraftMapRunLevelService {
//地图基础数据校验为生成站间数据准备 //地图基础数据校验为生成站间数据准备
MapDataVO mapData = this.iDraftMapService.getMapData(routingData.getMapId()); MapDataVO mapData = this.iDraftMapService.getMapData(routingData.getMapId());
Map<String, MapElement> deviceMap; Map<String, MapElement> deviceMap;
if (mapData.isDrawWay()) { MapVO map = new MapVO();
MapVO map = new MapVO(); map.setDrawWay(mapData.isDrawWay());
map.setDrawWay(mapData.isDrawWay()); map.setMapData(mapData);
map.setMapData(mapData); SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map); BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
if (!CollectionUtils.isEmpty(buildResult.getErrMsgList())) { "地图基础数据校验不通过");
throw new BusinessException(ExceptionMapping.OPERATION_EXCEPTION, "地图基础数据校验不通过"); deviceMap = buildResult.getDeviceMap();
}
deviceMap = buildResult.getDeviceMap();
} else {
throw new BusinessException(ExceptionMapping.OPERATION_EXCEPTION,"旧地图数据不支持生成站间数据功能");
}
List<MapStationRunLevelVO> stationRunLevels = MapStationRunLevelVO.runLevelsFromRouting(routingData); List<MapStationRunLevelVO> stationRunLevels = MapStationRunLevelVO.runLevelsFromRouting(routingData);
stationRunLevels.forEach(runLevel -> { stationRunLevels.forEach(runLevel -> {
Section startSection = (Section)deviceMap.get(runLevel.getStartSectionCode()); Section startSection = (Section)deviceMap.get(runLevel.getStartSectionCode());
Section endSection = (Section) deviceMap.get(runLevel.getEndSectionCode()); Section endSection = (Section) deviceMap.get(runLevel.getEndSectionCode());
if(Objects.isNull(startSection) || Objects.isNull(endSection)){ BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(
throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL, String.format("站间区段 code[%s]->code[%s],其中一个区段不存在")); null!=startSection&&null!=endSection,
} String.format("站间区段 code[%s]->code[%s],其中一个区段不存在")
);
//存在不创建 //存在不创建
if (this.isExisted(runLevel)) { if (this.isExisted(runLevel)) {
return; return;
@ -113,18 +99,13 @@ public class DraftMapRunLevelServiceImpl implements DraftMapRunLevelService {
//地图基础数据校验为生成站间数据准备 //地图基础数据校验为生成站间数据准备
MapDataVO mapData = this.iDraftMapService.getMapData(mapId); MapDataVO mapData = this.iDraftMapService.getMapData(mapId);
Map<String, MapElement> deviceMap; Map<String, MapElement> deviceMap;
if (mapData.isDrawWay()) { MapVO map = new MapVO();
MapVO map = new MapVO(); map.setDrawWay(mapData.isDrawWay());
map.setDrawWay(mapData.isDrawWay()); map.setMapData(mapData);
map.setMapData(mapData); SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map);
SimulationBuilder.SimulationDeviceBuildResult buildResult = SimulationBuilder.checkAndBuildMapDeviceData(map); BusinessExceptionAssertEnum.DATA_ERROR.assertCollectionEmpty(buildResult.getErrMsgList(),
if (!CollectionUtils.isEmpty(buildResult.getErrMsgList())) { "地图基础数据校验不通过");
throw new BusinessException(ExceptionMapping.OPERATION_EXCEPTION, "地图基础数据校验不通过"); deviceMap = buildResult.getDeviceMap();
}
deviceMap = buildResult.getDeviceMap();
} else {
throw new BusinessException(ExceptionMapping.OPERATION_EXCEPTION,"旧地图数据不支持生成站间数据功能");
}
List<MapRoutingDataVO> routingDatas = this.iDraftMapService.getAllRoutingData(mapId); List<MapRoutingDataVO> routingDatas = this.iDraftMapService.getAllRoutingData(mapId);
Set<MapStationRunLevelVO> stationRunLevels = routingDatas.stream().flatMap(routingData -> MapStationRunLevelVO.runLevelsFromRouting(routingData).stream()).collect(Collectors.toSet()); Set<MapStationRunLevelVO> stationRunLevels = routingDatas.stream().flatMap(routingData -> MapStationRunLevelVO.runLevelsFromRouting(routingData).stream()).collect(Collectors.toSet());
@ -132,9 +113,10 @@ public class DraftMapRunLevelServiceImpl implements DraftMapRunLevelService {
Section startSection = (Section)deviceMap.get(runLevel.getStartSectionCode()); Section startSection = (Section)deviceMap.get(runLevel.getStartSectionCode());
Section endSection = (Section) deviceMap.get(runLevel.getEndSectionCode()); Section endSection = (Section) deviceMap.get(runLevel.getEndSectionCode());
if(Objects.isNull(startSection) || Objects.isNull(endSection)){ BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(
throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL, String.format("站间区段 code[%s]->code[%s],其中一个区段不存在",runLevel.getStartSectionCode(),runLevel.getEndSectionCode())); null!=startSection&&null!=endSection,
} String.format("站间区段 code[%s]->code[%s],其中一个区段不存在",runLevel.getStartSectionCode(),runLevel.getEndSectionCode())
);
//存在不创建 //存在不创建
if (this.isExisted(runLevel)) { if (this.isExisted(runLevel)) {
return; return;
@ -150,9 +132,7 @@ public class DraftMapRunLevelServiceImpl implements DraftMapRunLevelService {
@Override @Override
public void create(MapStationRunLevelVO runLevelVO) { public void create(MapStationRunLevelVO runLevelVO) {
// 开始区段结束区段校验 // 开始区段结束区段校验
if (isExisted(runLevelVO)) { BusinessExceptionAssertEnum.DATA_ALREADY_EXIST.assertNotTrue(isExisted(runLevelVO));
throw new DBException(ExceptionMapping.DATA_EXISTS);
}
// 保存运行等级数据 // 保存运行等级数据
DraftMapRunLevel runLevel = runLevelVO.convert2Draft(); DraftMapRunLevel runLevel = runLevelVO.convert2Draft();
this.draftMapRunLevelDAO.insert(runLevel); this.draftMapRunLevelDAO.insert(runLevel);
@ -188,10 +168,8 @@ public class DraftMapRunLevelServiceImpl implements DraftMapRunLevelService {
private DraftMapRunLevel getEntityById(Long id) { private DraftMapRunLevel getEntityById(Long id) {
DraftMapRunLevel runLevel = this.draftMapRunLevelDAO.selectByPrimaryKey(id); DraftMapRunLevel runLevel = this.draftMapRunLevelDAO.selectByPrimaryKey(id);
if (Objects.isNull(runLevel)) { BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(runLevel,
throw new DBException(ExceptionMapping.DATA_NOT_EXIST, String.format("id为[%s]的草稿运行等级数据不存在", id));
String.format("id为[%s]的草稿运行等级数据不存在", id));
}
return runLevel; return runLevel;
} }

View File

@ -1,13 +1,12 @@
package club.joylink.rtss.vo.runplan.newrunplan; package club.joylink.rtss.vo.runplan.newrunplan;
import com.joylink.base.exception.BusinessException; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import com.joylink.base.exception.constant.ExceptionMapping; import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
import com.joylink.ms.vo.client.map.newmap.MapStationNewVO; import club.joylink.rtss.vo.client.runplan.RunPlanImport;
import com.joylink.ms.vo.client.runplan.RunPlanImport; import club.joylink.rtss.vo.client.runplan.RunPlanTripTimeVO;
import com.joylink.ms.vo.client.runplan.RunPlanTripTimeVO; import club.joylink.rtss.vo.client.runplan.RunPlanTripVO;
import com.joylink.ms.vo.client.runplan.RunPlanTripVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.springframework.util.StringUtils;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
@ -28,7 +27,7 @@ public class BeiJingLine1RunPlanNew implements IRunPlanStrategyNew {
List<String> emptyDirection = new ArrayList<>(10); List<String> emptyDirection = new ArrayList<>(10);
runPlanImportList.forEach(runPlanImport -> { runPlanImportList.forEach(runPlanImport -> {
this.analyzeAndConvertCode(runPlanImport, upDirection); this.analyzeAndConvertCode(runPlanImport, upDirection);
if(StringUtils.isBlank(runPlanImport.getDirectionCode())) { if(!StringUtils.hasText(runPlanImport.getDirectionCode())) {
emptyDirection.add(runPlanImport.getServiceNumber()); emptyDirection.add(runPlanImport.getServiceNumber());
} }
handleStationAndTime(stationMap, runPlanImport.getArrivalList()); handleStationAndTime(stationMap, runPlanImport.getArrivalList());
@ -43,7 +42,7 @@ public class BeiJingLine1RunPlanNew implements IRunPlanStrategyNew {
for(int i = 0; i < importList.size(); i++) { for(int i = 0; i < importList.size(); i++) {
RunPlanImport runPlanImport = importList.get(i); RunPlanImport runPlanImport = importList.get(i);
//只有服务号的车次设置方向 //只有服务号的车次设置方向
if(StringUtils.isBlank(runPlanImport.getDirectionCode()) && importList.size() > 1) { if(!StringUtils.hasText(runPlanImport.getDirectionCode()) && importList.size() > 1) {
boolean right; boolean right;
if(importList.size() == i + 1) { if(importList.size() == i + 1) {
// 最后一条数据为前一条数据的反方向 // 最后一条数据为前一条数据的反方向
@ -62,10 +61,10 @@ public class BeiJingLine1RunPlanNew implements IRunPlanStrategyNew {
@Override @Override
public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) { public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) {
String code = runPlanImport.getCode(); String code = runPlanImport.getCode();
if(StringUtils.isNotBlank(code)) { if(StringUtils.hasText(code)) {
String serviceNumber = StringUtils.EMPTY; String serviceNumber = "";
String direction = StringUtils.EMPTY; String direction = "";
String tripNumber = StringUtils.EMPTY; String tripNumber = "";
if(code.length() == 6) { if(code.length() == 6) {
serviceNumber = code.substring(0, 2); serviceNumber = code.substring(0, 2);
direction = code.substring(2, 3); direction = code.substring(2, 3);
@ -76,14 +75,14 @@ public class BeiJingLine1RunPlanNew implements IRunPlanStrategyNew {
}else if(code.length() == 2) { }else if(code.length() == 2) {
serviceNumber = code; serviceNumber = code;
}else { }else {
throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL); throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception();
} }
runPlanImport.setServiceNumber(serviceNumber); runPlanImport.setServiceNumber(serviceNumber);
runPlanImport.setDirectionCode(direction); runPlanImport.setDirectionCode(direction);
runPlanImport.setTripNumber(tripNumber); runPlanImport.setTripNumber(tripNumber);
setRunPlanDirec(runPlanImport, upDirection); setRunPlanDirec(runPlanImport, upDirection);
} else { } else {
throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL); throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception();
} }
} }
@ -93,7 +92,7 @@ public class BeiJingLine1RunPlanNew implements IRunPlanStrategyNew {
if (startStationName.equals("洞口") || endStationName.equals("洞口")) { if (startStationName.equals("洞口") || endStationName.equals("洞口")) {
// 出库 // 出库
if (runPlanImport.isRight()) { // 古段/苹果园 -> 洞口 if (runPlanImport.isRight()) { // 古段/苹果园 -> 洞口
if (StringUtils.isBlank(runPlanImport.getTripNumber())) { if (!StringUtils.hasText(runPlanImport.getTripNumber())) {
tripVO.setDestinationCode("CJ"); // 洞口 15G tripVO.setDestinationCode("CJ"); // 洞口 15G
// tripVO.setStartSectionCode("Section_19_0.16177"); // 古段 ZHG1(SG&F3) // tripVO.setStartSectionCode("Section_19_0.16177"); // 古段 ZHG1(SG&F3)
// tripVO.setEndSectionCode("Section_58_0.75357"); // 洞口 15G // tripVO.setEndSectionCode("Section_58_0.75357"); // 洞口 15G
@ -103,7 +102,7 @@ public class BeiJingLine1RunPlanNew implements IRunPlanStrategyNew {
// tripVO.setEndSectionCode("Section_82_0.04794"); // 洞口 18G(F6) // tripVO.setEndSectionCode("Section_82_0.04794"); // 洞口 18G(F6)
} }
} else { // 入库 } else { // 入库
if (StringUtils.isBlank(runPlanImport.getTripNumber())) { // 洞口 -> 古段 if (!StringUtils.hasText(runPlanImport.getTripNumber())) { // 洞口 -> 古段
tripVO.setDestinationCode("CE"); // 古段 ZHG1(SG&F3) tripVO.setDestinationCode("CE"); // 古段 ZHG1(SG&F3)
// tripVO.setStartSectionCode("Section_82_0.04794"); // 洞口 18G(F6) // tripVO.setStartSectionCode("Section_82_0.04794"); // 洞口 18G(F6)
// tripVO.setEndSectionCode("Section_19_0.16177"); // 古段 ZHG1(SG&F3) // tripVO.setEndSectionCode("Section_19_0.16177"); // 古段 ZHG1(SG&F3)
@ -223,7 +222,7 @@ public class BeiJingLine1RunPlanNew implements IRunPlanStrategyNew {
@Override @Override
public void handleTripTime(RunPlanTripTimeVO timeVO, RunPlanImport runPlanImport, MapStationNewVO stationVO, String startStationName, String endStationName) { public void handleTripTime(RunPlanTripTimeVO timeVO, RunPlanImport runPlanImport, MapStationNewVO stationVO, String startStationName, String endStationName) {
if (StringUtils.isBlank(runPlanImport.getTripNumber()) && stationVO.getRunPlanName().equals("洞口")) { if (!StringUtils.hasText(runPlanImport.getTripNumber()) && stationVO.getRunPlanName().equals("洞口")) {
if (runPlanImport.isRight()) { // 古段 -> 洞口 if (runPlanImport.isRight()) { // 古段 -> 洞口
timeVO.setSectionCode("T141"); //15G timeVO.setSectionCode("T141"); //15G
} else { // 洞口 -> 古段 } else { // 洞口 -> 古段

View File

@ -1,14 +1,14 @@
package club.joylink.rtss.vo.runplan.newrunplan; package club.joylink.rtss.vo.runplan.newrunplan;
import com.joylink.base.exception.BusinessException; import club.joylink.rtss.constants.BusinessConsts;
import com.joylink.base.exception.constant.ExceptionMapping; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import com.joylink.ms.vo.client.map.newmap.MapStationNewVO; import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
import com.joylink.ms.vo.client.runplan.RunPlanArrivalTime; import club.joylink.rtss.vo.client.runplan.RunPlanArrivalTime;
import com.joylink.ms.vo.client.runplan.RunPlanImport; import club.joylink.rtss.vo.client.runplan.RunPlanImport;
import com.joylink.ms.vo.client.runplan.RunPlanTripTimeVO; import club.joylink.rtss.vo.client.runplan.RunPlanTripTimeVO;
import com.joylink.ms.vo.client.runplan.RunPlanTripVO; import club.joylink.rtss.vo.client.runplan.RunPlanTripVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.springframework.util.StringUtils;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -16,8 +16,6 @@ import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.joylink.ms.constants.BusinessConsts.RunPlan.DirectionType;
@Slf4j @Slf4j
public class ChengDuLine1RunPlanNew implements IRunPlanStrategyNew { public class ChengDuLine1RunPlanNew implements IRunPlanStrategyNew {
@ -45,15 +43,15 @@ public class ChengDuLine1RunPlanNew implements IRunPlanStrategyNew {
@Override @Override
public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) { public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) {
String code = runPlanImport.getCode(); String code = runPlanImport.getCode();
if (StringUtils.isNotBlank(code) && (code.length() == 7)) { if (StringUtils.hasText(code) && (code.length() == 7)) {
runPlanImport.setServiceNumber(code.substring(0, 3)); runPlanImport.setServiceNumber(code.substring(0, 3));
//成都一 中间两位为交路编号暂取出来 //成都一 中间两位为交路编号暂取出来
runPlanImport.setDestinationCode(code.substring(3,5)); runPlanImport.setDestinationCode(code.substring(3,5));
runPlanImport.setTripNumber(code.substring(5, 7)); runPlanImport.setTripNumber(code.substring(5, 7));
runPlanImport.setDirectionCode(Integer.parseInt(runPlanImport.getTripNumber()) % 2 == 0 ? DirectionType.Type02 : DirectionType.Type01); runPlanImport.setDirectionCode(Integer.parseInt(runPlanImport.getTripNumber()) % 2 == 0 ? BusinessConsts.RunPlan.DirectionType.Type02 : BusinessConsts.RunPlan.DirectionType.Type01);
setRunPlanDirec(runPlanImport, upDirection); setRunPlanDirec(runPlanImport, upDirection);
} else { } else {
throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL, "Code is invalid."); throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception("Code is invalid.");
} }
} }

View File

@ -1,14 +1,13 @@
package club.joylink.rtss.vo.runplan.newrunplan; package club.joylink.rtss.vo.runplan.newrunplan;
import com.joylink.base.exception.BusinessException; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import com.joylink.base.exception.constant.ExceptionMapping; import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
import com.joylink.ms.vo.client.map.newmap.MapStationNewVO; import club.joylink.rtss.vo.client.runplan.RunPlanArrivalTime;
import com.joylink.ms.vo.client.runplan.RunPlanArrivalTime; import club.joylink.rtss.vo.client.runplan.RunPlanImport;
import com.joylink.ms.vo.client.runplan.RunPlanImport; import club.joylink.rtss.vo.client.runplan.RunPlanTripTimeVO;
import com.joylink.ms.vo.client.runplan.RunPlanTripTimeVO; import club.joylink.rtss.vo.client.runplan.RunPlanTripVO;
import com.joylink.ms.vo.client.runplan.RunPlanTripVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.springframework.util.StringUtils;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -40,7 +39,7 @@ public class ChengDuLine3RunPlanNew implements IRunPlanStrategyNew {
@Override @Override
public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) { public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) {
String code = runPlanImport.getCode(); String code = runPlanImport.getCode();
if(StringUtils.isNotBlank(code)) { if(StringUtils.hasText(code)) {
String serviceNumber; String serviceNumber;
String directionCode; String directionCode;
String tripNumber; String tripNumber;
@ -51,7 +50,7 @@ public class ChengDuLine3RunPlanNew implements IRunPlanStrategyNew {
tripNumber = code.substring(6, 8); tripNumber = code.substring(6, 8);
directionCode = Integer.parseInt(tripNumber) % 2 == 0 ? "2" : "1"; directionCode = Integer.parseInt(tripNumber) % 2 == 0 ? "2" : "1";
}else { }else {
throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL); throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception();
} }
runPlanImport.setServiceNumber(serviceNumber); runPlanImport.setServiceNumber(serviceNumber);
runPlanImport.setDirectionCode(directionCode); runPlanImport.setDirectionCode(directionCode);
@ -59,7 +58,7 @@ public class ChengDuLine3RunPlanNew implements IRunPlanStrategyNew {
runPlanImport.setTripNumber(tripNumber); runPlanImport.setTripNumber(tripNumber);
runPlanImport.setDestinationCode(destinationCode); runPlanImport.setDestinationCode(destinationCode);
} else { } else {
throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL); throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception();
} }
} }

View File

@ -1,9 +1,9 @@
package club.joylink.rtss.vo.runplan.newrunplan; package club.joylink.rtss.vo.runplan.newrunplan;
import com.joylink.ms.vo.client.map.newmap.MapStationNewVO; import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
import com.joylink.ms.vo.client.runplan.RunPlanImport; import club.joylink.rtss.vo.client.runplan.RunPlanImport;
import com.joylink.ms.vo.client.runplan.RunPlanTripTimeVO; import club.joylink.rtss.vo.client.runplan.RunPlanTripTimeVO;
import com.joylink.ms.vo.client.runplan.RunPlanTripVO; import club.joylink.rtss.vo.client.runplan.RunPlanTripVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import java.util.List; import java.util.List;

View File

@ -1,22 +1,20 @@
package club.joylink.rtss.vo.runplan.newrunplan; package club.joylink.rtss.vo.runplan.newrunplan;
import com.joylink.base.exception.BusinessException; import club.joylink.rtss.constants.BusinessConsts;
import com.joylink.base.exception.constant.ExceptionMapping; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import com.joylink.ms.vo.client.map.newmap.MapStationNewVO; import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
import com.joylink.ms.vo.client.runplan.RunPlanArrivalTime; import club.joylink.rtss.vo.client.runplan.RunPlanArrivalTime;
import com.joylink.ms.vo.client.runplan.RunPlanImport; import club.joylink.rtss.vo.client.runplan.RunPlanImport;
import com.joylink.ms.vo.client.runplan.RunPlanTripTimeVO; import club.joylink.rtss.vo.client.runplan.RunPlanTripTimeVO;
import com.joylink.ms.vo.client.runplan.RunPlanTripVO; import club.joylink.rtss.vo.client.runplan.RunPlanTripVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.springframework.util.StringUtils;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.joylink.ms.constants.BusinessConsts.RunPlan.DirectionType;
@Slf4j @Slf4j
public class FoshanTramRunPlanNew implements IRunPlanStrategyNew { public class FoshanTramRunPlanNew implements IRunPlanStrategyNew {
@ -46,14 +44,14 @@ public class FoshanTramRunPlanNew implements IRunPlanStrategyNew {
@Override @Override
public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) { public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) {
String code = runPlanImport.getCode(); String code = runPlanImport.getCode();
if (StringUtils.isNotBlank(code) && (code.length() == 5)) { if (StringUtils.hasText(code) && (code.length() == 5)) {
runPlanImport.setServiceNumber(code.substring(0, 3)); runPlanImport.setServiceNumber(code.substring(0, 3));
runPlanImport.setTripNumber(code.substring(3, 5)); runPlanImport.setTripNumber(code.substring(3, 5));
runPlanImport.setDirectionCode(Integer.parseInt(runPlanImport.getTripNumber()) % 2 == 0 ? DirectionType.Type02 : DirectionType.Type01); runPlanImport.setDirectionCode(Integer.parseInt(runPlanImport.getTripNumber()) % 2 == 0 ? BusinessConsts.RunPlan.DirectionType.Type02 : BusinessConsts.RunPlan.DirectionType.Type01);
//目的地号目前没有先设置为XXX //目的地号目前没有先设置为XXX
setRunPlanDirec(runPlanImport, upDirection); setRunPlanDirec(runPlanImport, upDirection);
} else { } else {
throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL, "Code is invalid."); throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception("Code is invalid.");
} }
} }

View File

@ -1,14 +1,13 @@
package club.joylink.rtss.vo.runplan.newrunplan; package club.joylink.rtss.vo.runplan.newrunplan;
import com.joylink.base.exception.BusinessException; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import com.joylink.base.exception.constant.ExceptionMapping; import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
import com.joylink.ms.vo.client.map.newmap.MapStationNewVO; import club.joylink.rtss.vo.client.runplan.RunPlanArrivalTime;
import com.joylink.ms.vo.client.runplan.RunPlanArrivalTime; import club.joylink.rtss.vo.client.runplan.RunPlanImport;
import com.joylink.ms.vo.client.runplan.RunPlanImport; import club.joylink.rtss.vo.client.runplan.RunPlanTripTimeVO;
import com.joylink.ms.vo.client.runplan.RunPlanTripTimeVO; import club.joylink.rtss.vo.client.runplan.RunPlanTripVO;
import com.joylink.ms.vo.client.runplan.RunPlanTripVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.springframework.util.StringUtils;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -61,14 +60,14 @@ public class FuZhouLine1RunPlanNew implements IRunPlanStrategyNew {
@Override @Override
public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) { public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) {
String code = runPlanImport.getCode(); String code = runPlanImport.getCode();
if (StringUtils.isNotBlank(code) && code.length() == 6) { if (StringUtils.hasText(code) && code.length() == 6) {
runPlanImport.setServiceNumber(code.substring(0, 2)); runPlanImport.setServiceNumber(code.substring(0, 2));
String directionCode = code.substring(2, 3); String directionCode = code.substring(2, 3);
runPlanImport.setDirectionCode(directionCode); runPlanImport.setDirectionCode(directionCode);
setRunPlanDirec(runPlanImport, upDirection); setRunPlanDirec(runPlanImport, upDirection);
runPlanImport.setTripNumber(code.substring(2, 6)); runPlanImport.setTripNumber(code.substring(2, 6));
} else { } else {
throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL); throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception();
} }
} }

View File

@ -1,22 +1,20 @@
package club.joylink.rtss.vo.runplan.newrunplan; package club.joylink.rtss.vo.runplan.newrunplan;
import com.joylink.base.exception.BusinessException; import club.joylink.rtss.constants.BusinessConsts;
import com.joylink.base.exception.constant.ExceptionMapping; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import com.joylink.ms.vo.client.map.newmap.MapStationNewVO; import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
import com.joylink.ms.vo.client.runplan.RunPlanArrivalTime; import club.joylink.rtss.vo.client.runplan.RunPlanArrivalTime;
import com.joylink.ms.vo.client.runplan.RunPlanImport; import club.joylink.rtss.vo.client.runplan.RunPlanImport;
import com.joylink.ms.vo.client.runplan.RunPlanTripTimeVO; import club.joylink.rtss.vo.client.runplan.RunPlanTripTimeVO;
import com.joylink.ms.vo.client.runplan.RunPlanTripVO; import club.joylink.rtss.vo.client.runplan.RunPlanTripVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.springframework.util.StringUtils;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.joylink.ms.constants.BusinessConsts.RunPlan.DirectionType;
@Slf4j @Slf4j
public class HarBinLine1RunPlanNew implements IRunPlanStrategyNew { public class HarBinLine1RunPlanNew implements IRunPlanStrategyNew {
@ -46,14 +44,14 @@ public class HarBinLine1RunPlanNew implements IRunPlanStrategyNew {
@Override @Override
public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) { public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) {
String code = runPlanImport.getCode(); String code = runPlanImport.getCode();
if (StringUtils.isNotBlank(code) && (code.length() == 8)) { if (StringUtils.hasText(code) && (code.length() == 8)) {
runPlanImport.setDestinationCode(code.substring(0,3)); runPlanImport.setDestinationCode(code.substring(0,3));
runPlanImport.setServiceNumber(code.substring(3, 6)); runPlanImport.setServiceNumber(code.substring(3, 6));
runPlanImport.setTripNumber(code.substring(6, 8)); runPlanImport.setTripNumber(code.substring(6, 8));
runPlanImport.setDirectionCode(Integer.parseInt(runPlanImport.getTripNumber()) % 2 == 0 ? DirectionType.Type02 : DirectionType.Type01); runPlanImport.setDirectionCode(Integer.parseInt(runPlanImport.getTripNumber()) % 2 == 0 ? BusinessConsts.RunPlan.DirectionType.Type02 : BusinessConsts.RunPlan.DirectionType.Type01);
setRunPlanDirec(runPlanImport, upDirection); setRunPlanDirec(runPlanImport, upDirection);
} else { } else {
throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL, "Code is invalid."); throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception("Code is invalid.");
} }
} }

View File

@ -1,14 +1,14 @@
package club.joylink.rtss.vo.runplan.newrunplan; package club.joylink.rtss.vo.runplan.newrunplan;
import com.joylink.base.exception.BusinessException; import club.joylink.rtss.constants.BusinessConsts;
import com.joylink.base.exception.constant.ExceptionMapping; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import com.joylink.ms.vo.client.map.newmap.MapStationNewVO; import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
import com.joylink.ms.vo.client.runplan.RunPlanArrivalTime; import club.joylink.rtss.vo.client.runplan.RunPlanArrivalTime;
import com.joylink.ms.vo.client.runplan.RunPlanImport; import club.joylink.rtss.vo.client.runplan.RunPlanImport;
import com.joylink.ms.vo.client.runplan.RunPlanTripTimeVO; import club.joylink.rtss.vo.client.runplan.RunPlanTripTimeVO;
import com.joylink.ms.vo.client.runplan.RunPlanTripVO; import club.joylink.rtss.vo.client.runplan.RunPlanTripVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.springframework.util.StringUtils;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@ -17,7 +17,6 @@ import java.util.Map;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.joylink.ms.constants.BusinessConsts.RunPlan.DirectionType;
@Slf4j @Slf4j
public class NingBoLine1RunPlanNew implements IRunPlanStrategyNew { public class NingBoLine1RunPlanNew implements IRunPlanStrategyNew {
@ -54,19 +53,19 @@ public class NingBoLine1RunPlanNew implements IRunPlanStrategyNew {
public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) { public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) {
//宁波一导入自带 目的地码 //宁波一导入自带 目的地码
String code = runPlanImport.getCode(); String code = runPlanImport.getCode();
if (StringUtils.isNotBlank(code) && (code.length() == 5 || code.length() == 4)) { if (StringUtils.hasText(code) && (code.length() == 5 || code.length() == 4)) {
if (code.length() == 5) { if (code.length() == 5) {
runPlanImport.setServiceNumber(code.substring(0, 3)); runPlanImport.setServiceNumber(code.substring(0, 3));
runPlanImport.setTripNumber(code.substring(3, 5)); runPlanImport.setTripNumber(code.substring(3, 5));
runPlanImport.setDirectionCode(Integer.parseInt(runPlanImport.getTripNumber()) % 2 == 0 ? DirectionType.Type02 : DirectionType.Type01); runPlanImport.setDirectionCode(Integer.parseInt(runPlanImport.getTripNumber()) % 2 == 0 ? BusinessConsts.RunPlan.DirectionType.Type02 : BusinessConsts.RunPlan.DirectionType.Type01);
} else { } else {
runPlanImport.setServiceNumber(code.substring(0, 2)); runPlanImport.setServiceNumber(code.substring(0, 2));
runPlanImport.setTripNumber(code.substring(2, 4)); runPlanImport.setTripNumber(code.substring(2, 4));
runPlanImport.setDirectionCode(Integer.parseInt(runPlanImport.getTripNumber()) % 2 == 0 ? DirectionType.Type02 : DirectionType.Type01); runPlanImport.setDirectionCode(Integer.parseInt(runPlanImport.getTripNumber()) % 2 == 0 ? BusinessConsts.RunPlan.DirectionType.Type02 : BusinessConsts.RunPlan.DirectionType.Type01);
} }
setRunPlanDirec(runPlanImport, upDirection); setRunPlanDirec(runPlanImport, upDirection);
} else { } else {
throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL, "Code is invalid."); throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception("Code is invalid.");
} }
} }

View File

@ -7,7 +7,6 @@ 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 java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;

View File

@ -1,15 +1,14 @@
package club.joylink.rtss.vo.runplan.newrunplan; package club.joylink.rtss.vo.runplan.newrunplan;
import com.joylink.base.exception.BusinessException; import club.joylink.rtss.constants.BusinessConsts;
import com.joylink.base.exception.constant.ExceptionMapping; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import com.joylink.ms.constants.BusinessConsts; import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
import com.joylink.ms.vo.client.map.newmap.MapStationNewVO; import club.joylink.rtss.vo.client.runplan.RunPlanArrivalTime;
import com.joylink.ms.vo.client.runplan.RunPlanArrivalTime; import club.joylink.rtss.vo.client.runplan.RunPlanImport;
import com.joylink.ms.vo.client.runplan.RunPlanImport; import club.joylink.rtss.vo.client.runplan.RunPlanTripTimeVO;
import com.joylink.ms.vo.client.runplan.RunPlanTripTimeVO; import club.joylink.rtss.vo.client.runplan.RunPlanTripVO;
import com.joylink.ms.vo.client.runplan.RunPlanTripVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.springframework.util.StringUtils;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -45,7 +44,7 @@ public class XianLine2RunPlanNew implements IRunPlanStrategyNew {
@Override @Override
public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) { public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) {
String code = runPlanImport.getCode(); String code = runPlanImport.getCode();
if (StringUtils.isNotBlank(code) && ((code.length() == 4)||code.length() == 5)) { if (StringUtils.hasText(code) && ((code.length() == 4)||code.length() == 5)) {
runPlanImport.setServiceNumber(code.substring(0, 3)); runPlanImport.setServiceNumber(code.substring(0, 3));
String importTripNumber = code.substring(3); String importTripNumber = code.substring(3);
runPlanImport.setDirectionCode(Integer.parseInt(importTripNumber) % 2 == 0 ? BusinessConsts.RunPlan.DirectionType.Type02 : BusinessConsts.RunPlan.DirectionType.Type01); runPlanImport.setDirectionCode(Integer.parseInt(importTripNumber) % 2 == 0 ? BusinessConsts.RunPlan.DirectionType.Type02 : BusinessConsts.RunPlan.DirectionType.Type01);
@ -55,7 +54,7 @@ public class XianLine2RunPlanNew implements IRunPlanStrategyNew {
// runPlanImport.setDestinationCode("XXX"); // runPlanImport.setDestinationCode("XXX");
setRunPlanDirec(runPlanImport, upDirection); setRunPlanDirec(runPlanImport, upDirection);
} else { } else {
throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL, "Code is invalid."); throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception("Code is invalid.");
} }
} }

View File

@ -1,14 +1,13 @@
package club.joylink.rtss.vo.runplan.newrunplan; package club.joylink.rtss.vo.runplan.newrunplan;
import com.joylink.base.exception.BusinessException; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import com.joylink.base.exception.constant.ExceptionMapping; import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
import com.joylink.ms.vo.client.map.newmap.MapStationNewVO; import club.joylink.rtss.vo.client.runplan.RunPlanArrivalTime;
import com.joylink.ms.vo.client.runplan.RunPlanArrivalTime; import club.joylink.rtss.vo.client.runplan.RunPlanImport;
import com.joylink.ms.vo.client.runplan.RunPlanImport; import club.joylink.rtss.vo.client.runplan.RunPlanTripTimeVO;
import com.joylink.ms.vo.client.runplan.RunPlanTripTimeVO; import club.joylink.rtss.vo.client.runplan.RunPlanTripVO;
import com.joylink.ms.vo.client.runplan.RunPlanTripVO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.springframework.util.StringUtils;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@ -63,7 +62,7 @@ public class XianLine3RunPlanNew implements IRunPlanStrategyNew {
@Override @Override
public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) { public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) {
String code = runPlanImport.getCode(); String code = runPlanImport.getCode();
if (StringUtils.isNotBlank(code)) { if (StringUtils.hasText(code)) {
if (code.length() == 5) { if (code.length() == 5) {
runPlanImport.setServiceNumber(String.format("0%s", code.substring(0, 1))); runPlanImport.setServiceNumber(String.format("0%s", code.substring(0, 1)));
runPlanImport.setTripNumber(code.substring(1)); runPlanImport.setTripNumber(code.substring(1));
@ -74,7 +73,7 @@ public class XianLine3RunPlanNew implements IRunPlanStrategyNew {
runPlanImport.setDirectionCode(code.substring(2, 3)); runPlanImport.setDirectionCode(code.substring(2, 3));
} else { } else {
throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL, "Code is invalid."); throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception("Code is invalid.");
} }
//目的地号目前没有先设置为XXX //目的地号目前没有先设置为XXX
runPlanImport.setDestinationCode("XXX"); runPlanImport.setDestinationCode("XXX");
@ -82,7 +81,7 @@ public class XianLine3RunPlanNew implements IRunPlanStrategyNew {
//设置为真实运行图格式 //设置为真实运行图格式
runPlanImport.setCode(runPlanImport.getServiceNumber()+runPlanImport.getTripNumber()); runPlanImport.setCode(runPlanImport.getServiceNumber()+runPlanImport.getTripNumber());
}else { }else {
throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL, "Code is invalid."); throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception("Code is invalid.");
} }
} }

View File

@ -1,6 +1,6 @@
package club.joylink.rtss.vo.view; package club.joylink.rtss.vo.view;
import com.joylink.base.View; import club.joylink.rtss.vo.View;
/** /**
* 竞赛运营统计接收答案 * 竞赛运营统计接收答案

View File

@ -1,6 +1,5 @@
package club.joylink.rtss.websocket; package club.joylink.rtss.websocket;
import club.joylink.rtss.configuration.WebsocketConfig;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener; import org.springframework.context.ApplicationListener;
import org.springframework.messaging.simp.stomp.StompHeaderAccessor; import org.springframework.messaging.simp.stomp.StompHeaderAccessor;

View File

@ -1,6 +1,5 @@
package club.joylink.rtss.websocket; package club.joylink.rtss.websocket;
import club.joylink.rtss.configuration.WebsocketConfig;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener; import org.springframework.context.ApplicationListener;
import org.springframework.messaging.simp.stomp.StompHeaderAccessor; import org.springframework.messaging.simp.stomp.StompHeaderAccessor;

View File

@ -1,16 +0,0 @@
package club.joylink.rtss.websocket;
import club.joylink.rtss.simulation.event.SimulationEvent;
import lombok.Getter;
/**
* 仿真退出事件
*/
@Getter
public class SimulationExitEvent extends SimulationEvent<StompService> {
private String userId;
public SimulationExitEvent(String userId, String group, StompService source) {
super(group, source);
this.userId = userId;
}
}

View File

@ -1,7 +1,6 @@
package club.joylink.rtss.wechat; package club.joylink.rtss.wechat;
import com.joylink.base.exception.BusinessException; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import com.joylink.base.exception.constant.ExceptionMapping;
import club.joylink.rtss.wechat.constant.CheckMediaType; import club.joylink.rtss.wechat.constant.CheckMediaType;
import club.joylink.rtss.wechat.vo.WxError; import club.joylink.rtss.wechat.vo.WxError;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -46,8 +45,8 @@ public class MiniProgramServiceImpl implements MiniProgramService {
String accessToken = this.miniProgramAccessTokenManager.getAccessToken(); String accessToken = this.miniProgramAccessTokenManager.getAccessToken();
return accessToken; return accessToken;
} catch (WxErrorException e) { } catch (WxErrorException e) {
throw new BusinessException(ExceptionMapping.OPERATION_EXCEPTION, throw BusinessExceptionAssertEnum.THIRD_SERVICE_CALL_EXCEPTION
String.format("获取微信小程序access_token异常")); .exception(String.format("获取微信小程序access_token异常"), e);
} }
} }