轨道交通项目迁出问题修改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;
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.entity.DraftMapRouteFlankProtection;
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.map.newmap.MapRouteFlankProtectionNewVO;
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 org.springframework.util.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Objects;
import org.springframework.util.StringUtils;
@Slf4j
@Service
@ -36,9 +33,9 @@ public class DraftMapFlankProtectionServiceImpl implements DraftMapFlankProtecti
.andMapIdEqualTo(flankProtectionNewVO.getMapId())
.andStationCodeEqualTo(flankProtectionNewVO.getStationCode())
.andNameEqualTo(flankProtectionNewVO.getName());
if (this.draftMapRouteFlankProtectionDAO.countByExample(example) > 0) {
throw new BusinessException(ExceptionMapping.DATA_EXISTS, "编号或名称重复");
}
BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertTrue(
this.draftMapRouteFlankProtectionDAO.countByExample(example) == 0,
"编号或名称重复");
DraftMapRouteFlankProtection entity = flankProtectionNewVO.toDB();
this.draftMapRouteFlankProtectionDAO.insert(entity);
}
@ -66,9 +63,7 @@ public class DraftMapFlankProtectionServiceImpl implements DraftMapFlankProtecti
@Override
public MapRouteFlankProtectionNewVO getById(Long id) {
DraftMapRouteFlankProtection fp = this.draftMapRouteFlankProtectionDAO.selectByPrimaryKey(id);
if (Objects.isNull(fp)) {
throw new BusinessException(ExceptionMapping.DATA_NOT_EXIST, String.format("id为[%s]的侧防数据不存在", id));
}
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(fp, String.format("id为[%s]的侧防数据不存在", id));
return MapRouteFlankProtectionNewVO.convert2VO(fp);
}

View File

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

View File

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

View File

@ -1,14 +1,14 @@
package club.joylink.rtss.vo.runplan.newrunplan;
import com.joylink.base.exception.BusinessException;
import com.joylink.base.exception.constant.ExceptionMapping;
import com.joylink.ms.vo.client.map.newmap.MapStationNewVO;
import com.joylink.ms.vo.client.runplan.RunPlanArrivalTime;
import com.joylink.ms.vo.client.runplan.RunPlanImport;
import com.joylink.ms.vo.client.runplan.RunPlanTripTimeVO;
import com.joylink.ms.vo.client.runplan.RunPlanTripVO;
import club.joylink.rtss.constants.BusinessConsts;
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.apache.commons.lang3.StringUtils;
import org.springframework.util.StringUtils;
import java.util.Arrays;
import java.util.List;
@ -16,8 +16,6 @@ import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.joylink.ms.constants.BusinessConsts.RunPlan.DirectionType;
@Slf4j
public class ChengDuLine1RunPlanNew implements IRunPlanStrategyNew {
@ -45,15 +43,15 @@ public class ChengDuLine1RunPlanNew implements IRunPlanStrategyNew {
@Override
public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) {
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.setDestinationCode(code.substring(3,5));
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);
} 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;
import com.joylink.base.exception.BusinessException;
import com.joylink.base.exception.constant.ExceptionMapping;
import com.joylink.ms.vo.client.map.newmap.MapStationNewVO;
import com.joylink.ms.vo.client.runplan.RunPlanArrivalTime;
import com.joylink.ms.vo.client.runplan.RunPlanImport;
import com.joylink.ms.vo.client.runplan.RunPlanTripTimeVO;
import com.joylink.ms.vo.client.runplan.RunPlanTripVO;
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.apache.commons.lang3.StringUtils;
import org.springframework.util.StringUtils;
import java.util.Arrays;
import java.util.List;
@ -40,7 +39,7 @@ public class ChengDuLine3RunPlanNew implements IRunPlanStrategyNew {
@Override
public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) {
String code = runPlanImport.getCode();
if(StringUtils.isNotBlank(code)) {
if(StringUtils.hasText(code)) {
String serviceNumber;
String directionCode;
String tripNumber;
@ -51,7 +50,7 @@ public class ChengDuLine3RunPlanNew implements IRunPlanStrategyNew {
tripNumber = code.substring(6, 8);
directionCode = Integer.parseInt(tripNumber) % 2 == 0 ? "2" : "1";
}else {
throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL);
throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception();
}
runPlanImport.setServiceNumber(serviceNumber);
runPlanImport.setDirectionCode(directionCode);
@ -59,7 +58,7 @@ public class ChengDuLine3RunPlanNew implements IRunPlanStrategyNew {
runPlanImport.setTripNumber(tripNumber);
runPlanImport.setDestinationCode(destinationCode);
} 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;
import com.joylink.ms.vo.client.map.newmap.MapStationNewVO;
import com.joylink.ms.vo.client.runplan.RunPlanImport;
import com.joylink.ms.vo.client.runplan.RunPlanTripTimeVO;
import com.joylink.ms.vo.client.runplan.RunPlanTripVO;
import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
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 java.util.List;

View File

@ -1,22 +1,20 @@
package club.joylink.rtss.vo.runplan.newrunplan;
import com.joylink.base.exception.BusinessException;
import com.joylink.base.exception.constant.ExceptionMapping;
import com.joylink.ms.vo.client.map.newmap.MapStationNewVO;
import com.joylink.ms.vo.client.runplan.RunPlanArrivalTime;
import com.joylink.ms.vo.client.runplan.RunPlanImport;
import com.joylink.ms.vo.client.runplan.RunPlanTripTimeVO;
import com.joylink.ms.vo.client.runplan.RunPlanTripVO;
import club.joylink.rtss.constants.BusinessConsts;
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.apache.commons.lang3.StringUtils;
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.joylink.ms.constants.BusinessConsts.RunPlan.DirectionType;
@Slf4j
public class FoshanTramRunPlanNew implements IRunPlanStrategyNew {
@ -46,14 +44,14 @@ public class FoshanTramRunPlanNew implements IRunPlanStrategyNew {
@Override
public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) {
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.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
setRunPlanDirec(runPlanImport, upDirection);
} 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;
import com.joylink.base.exception.BusinessException;
import com.joylink.base.exception.constant.ExceptionMapping;
import com.joylink.ms.vo.client.map.newmap.MapStationNewVO;
import com.joylink.ms.vo.client.runplan.RunPlanArrivalTime;
import com.joylink.ms.vo.client.runplan.RunPlanImport;
import com.joylink.ms.vo.client.runplan.RunPlanTripTimeVO;
import com.joylink.ms.vo.client.runplan.RunPlanTripVO;
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.apache.commons.lang3.StringUtils;
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.Map;
@ -61,14 +60,14 @@ public class FuZhouLine1RunPlanNew implements IRunPlanStrategyNew {
@Override
public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) {
String code = runPlanImport.getCode();
if (StringUtils.isNotBlank(code) && code.length() == 6) {
if (StringUtils.hasText(code) && code.length() == 6) {
runPlanImport.setServiceNumber(code.substring(0, 2));
String directionCode = code.substring(2, 3);
runPlanImport.setDirectionCode(directionCode);
setRunPlanDirec(runPlanImport, upDirection);
runPlanImport.setTripNumber(code.substring(2, 6));
} 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;
import com.joylink.base.exception.BusinessException;
import com.joylink.base.exception.constant.ExceptionMapping;
import com.joylink.ms.vo.client.map.newmap.MapStationNewVO;
import com.joylink.ms.vo.client.runplan.RunPlanArrivalTime;
import com.joylink.ms.vo.client.runplan.RunPlanImport;
import com.joylink.ms.vo.client.runplan.RunPlanTripTimeVO;
import com.joylink.ms.vo.client.runplan.RunPlanTripVO;
import club.joylink.rtss.constants.BusinessConsts;
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.apache.commons.lang3.StringUtils;
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.joylink.ms.constants.BusinessConsts.RunPlan.DirectionType;
@Slf4j
public class HarBinLine1RunPlanNew implements IRunPlanStrategyNew {
@ -46,14 +44,14 @@ public class HarBinLine1RunPlanNew implements IRunPlanStrategyNew {
@Override
public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) {
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.setServiceNumber(code.substring(3, 6));
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);
} 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;
import com.joylink.base.exception.BusinessException;
import com.joylink.base.exception.constant.ExceptionMapping;
import com.joylink.ms.vo.client.map.newmap.MapStationNewVO;
import com.joylink.ms.vo.client.runplan.RunPlanArrivalTime;
import com.joylink.ms.vo.client.runplan.RunPlanImport;
import com.joylink.ms.vo.client.runplan.RunPlanTripTimeVO;
import com.joylink.ms.vo.client.runplan.RunPlanTripVO;
import club.joylink.rtss.constants.BusinessConsts;
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.apache.commons.lang3.StringUtils;
import org.springframework.util.StringUtils;
import java.util.Arrays;
import java.util.Collections;
@ -17,7 +17,6 @@ import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.joylink.ms.constants.BusinessConsts.RunPlan.DirectionType;
@Slf4j
public class NingBoLine1RunPlanNew implements IRunPlanStrategyNew {
@ -54,19 +53,19 @@ public class NingBoLine1RunPlanNew implements IRunPlanStrategyNew {
public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) {
//宁波一导入自带 目的地码
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) {
runPlanImport.setServiceNumber(code.substring(0, 3));
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 {
runPlanImport.setServiceNumber(code.substring(0, 2));
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);
} 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.RunPlanTripVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.Map;

View File

@ -1,15 +1,14 @@
package club.joylink.rtss.vo.runplan.newrunplan;
import com.joylink.base.exception.BusinessException;
import com.joylink.base.exception.constant.ExceptionMapping;
import com.joylink.ms.constants.BusinessConsts;
import com.joylink.ms.vo.client.map.newmap.MapStationNewVO;
import com.joylink.ms.vo.client.runplan.RunPlanArrivalTime;
import com.joylink.ms.vo.client.runplan.RunPlanImport;
import com.joylink.ms.vo.client.runplan.RunPlanTripTimeVO;
import com.joylink.ms.vo.client.runplan.RunPlanTripVO;
import club.joylink.rtss.constants.BusinessConsts;
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.apache.commons.lang3.StringUtils;
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.Map;
@ -45,7 +44,7 @@ public class XianLine2RunPlanNew implements IRunPlanStrategyNew {
@Override
public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) {
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));
String importTripNumber = code.substring(3);
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");
setRunPlanDirec(runPlanImport, upDirection);
} 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;
import com.joylink.base.exception.BusinessException;
import com.joylink.base.exception.constant.ExceptionMapping;
import com.joylink.ms.vo.client.map.newmap.MapStationNewVO;
import com.joylink.ms.vo.client.runplan.RunPlanArrivalTime;
import com.joylink.ms.vo.client.runplan.RunPlanImport;
import com.joylink.ms.vo.client.runplan.RunPlanTripTimeVO;
import com.joylink.ms.vo.client.runplan.RunPlanTripVO;
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.apache.commons.lang3.StringUtils;
import org.springframework.util.StringUtils;
import java.util.Arrays;
import java.util.Collections;
@ -63,7 +62,7 @@ public class XianLine3RunPlanNew implements IRunPlanStrategyNew {
@Override
public void analyzeAndConvertCode(RunPlanImport runPlanImport, String upDirection) {
String code = runPlanImport.getCode();
if (StringUtils.isNotBlank(code)) {
if (StringUtils.hasText(code)) {
if (code.length() == 5) {
runPlanImport.setServiceNumber(String.format("0%s", code.substring(0, 1)));
runPlanImport.setTripNumber(code.substring(1));
@ -74,7 +73,7 @@ public class XianLine3RunPlanNew implements IRunPlanStrategyNew {
runPlanImport.setDirectionCode(code.substring(2, 3));
} else {
throw new BusinessException(ExceptionMapping.ARGUMENT_ILLEGAL, "Code is invalid.");
throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception("Code is invalid.");
}
//目的地号目前没有先设置为XXX
runPlanImport.setDestinationCode("XXX");
@ -82,7 +81,7 @@ public class XianLine3RunPlanNew implements IRunPlanStrategyNew {
//设置为真实运行图格式
runPlanImport.setCode(runPlanImport.getServiceNumber()+runPlanImport.getTripNumber());
}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;
import com.joylink.base.View;
import club.joylink.rtss.vo.View;
/**
* 竞赛运营统计接收答案

View File

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

View File

@ -1,6 +1,5 @@
package club.joylink.rtss.websocket;
import club.joylink.rtss.configuration.WebsocketConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
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;
import com.joylink.base.exception.BusinessException;
import com.joylink.base.exception.constant.ExceptionMapping;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.wechat.constant.CheckMediaType;
import club.joylink.rtss.wechat.vo.WxError;
import lombok.extern.slf4j.Slf4j;
@ -46,8 +45,8 @@ public class MiniProgramServiceImpl implements MiniProgramService {
String accessToken = this.miniProgramAccessTokenManager.getAccessToken();
return accessToken;
} catch (WxErrorException e) {
throw new BusinessException(ExceptionMapping.OPERATION_EXCEPTION,
String.format("获取微信小程序access_token异常"));
throw BusinessExceptionAssertEnum.THIRD_SERVICE_CALL_EXCEPTION
.exception(String.format("获取微信小程序access_token异常"), e);
}
}