Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
joylink_zhangsai 2020-12-14 17:16:19 +08:00
commit f74d379ed9
7 changed files with 45 additions and 13 deletions

View File

@ -1,5 +1,7 @@
package club.joylink.rtss.constants;
import club.joylink.rtss.simulation.cbtc.data.map.Switch;
public interface BusinessConsts {
String Default_NationCode = "86";
@ -559,6 +561,17 @@ public interface BusinessConsts {
public String getRemarks() {
return remarks;
}
public static PrdInfo getBy(String prdType) {
switch (prdType) {
case "01":
return prdType01;
case "02":
return prdType02;
}
return null;
}
}
interface Version {

View File

@ -39,6 +39,8 @@ public interface ILessonService {
*/
LessonVO getLessonInfo(Long id);
LessonVO findByMapAndNameAndPrdType(Long mapId, String name, String prdType);
/**
* 查询课程列表
* @param lessonQueryVO

View File

@ -8,6 +8,7 @@ import club.joylink.rtss.entity.LsDraftLessonChapterExample.Criteria;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.*;
import club.joylink.rtss.vo.client.map.MapVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
@ -53,6 +54,9 @@ public class LessonDraftService implements ILessonDraftService {
@Autowired
private TrainingDAO trainingDAO;
@Autowired
private IMapService iMapService;
@Override
public PageVO<LessonVO> queryPagedDraftLesson(Long mapId, PageQueryVO queryVO, UserVO userVO) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
@ -290,6 +294,12 @@ public class LessonDraftService implements ILessonDraftService {
@Override
public void publishLesson(Long id, LessonPublishVO publishVO) {
MapVO mapVO = iMapService.findMapBaseInfoById(publishVO.getMapId());
BusinessConsts.Lesson.PrdInfo prdInf = BusinessConsts.Lesson.PrdInfo.getBy(publishVO.getPrdType());
if(Objects.nonNull(prdInf)){
String defaultLessonName = String.join("-", mapVO.getName(), prdInf.getName());
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(Objects.equals(publishVO.getName(),defaultLessonName),"与系统默认课程同名,请重新设置名称");
}
LessonVO lessonVo = this.getDraftLessonDetail(id);
this.iLessonService.publish(lessonVo, publishVO);
}

View File

@ -224,7 +224,8 @@ public class LessonService implements ILessonService {
return new LessonVO(lessonList.get(0));
}
private LessonVO findByMapAndNameAndPrdType(Long mapId, String name, String prdType) {
@Override
public LessonVO findByMapAndNameAndPrdType(Long mapId, String name, String prdType) {
LsLessonExample lessonExample = new LsLessonExample();
lessonExample.createCriteria().andMapIdEqualTo(mapId).andNameEqualTo(name).andPrdTypeEqualTo(prdType);
List<LsLesson> lessonList = this.lessonDAO.selectByExample(lessonExample);

View File

@ -1,9 +1,6 @@
package club.joylink.rtss.services;
import club.joylink.rtss.constants.MapPrdTypeEnum;
import club.joylink.rtss.constants.MapSystemType;
import club.joylink.rtss.constants.Project;
import club.joylink.rtss.constants.StatusEnum;
import club.joylink.rtss.constants.*;
import club.joylink.rtss.dao.MapSystemDAO;
import club.joylink.rtss.entity.MapSystem;
import club.joylink.rtss.entity.MapSystemExample;
@ -227,7 +224,16 @@ public class MapSystemService implements IMapSystemService {
if(!CollectionUtils.isEmpty(relLessonsByClass)){
lessonVOList = iLessonService.getValidLesson(relLessonsByClass.stream().map(StudentRelLessonClass::getLessonId).collect(Collectors.toList()), mapSystem.getPrdType());
}
//默认课程展示
MapVO mapVO = iMapService.findMapBaseInfoById(mapSystem.getMapId());
BusinessConsts.Lesson.PrdInfo prdInfo = BusinessConsts.Lesson.PrdInfo.getBy(mapSystem.getPrdType());
if (Objects.nonNull(prdInfo)) {
String defaultLessonName = String.join("-", mapVO.getName(), prdInfo.name());
LessonVO existedDefaultLesson = iLessonService.findByMapAndNameAndPrdType(mapSystem.getMapId(), defaultLessonName, mapSystem.getPrdType());
if (Objects.nonNull(existedDefaultLesson)) {
lessonVOList.add(existedDefaultLesson);
}
}
}else{
lessonVOList = iLessonService.getByMapIdAndPrdType(mapSystem.getMapId(), mapSystem.getPrdType());
}

View File

@ -448,13 +448,13 @@ public class RunPlanDraftService implements IRunPlanDraftService {
if (Objects.nonNull(endReentrySectionCode)) {
endReentrySection = mapVO.findSectionNew(endReentrySectionCode);
} else {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.exception("车站" + routingData.getEndStationCode() + "折返轨未设置");
throw BusinessExceptionAssertEnum.DATA_NOT_EXIST.exception("车站" + routingData.getEndStationCode() + "折返轨未设置");
}
MapSectionNewVO startReentrySection = null;
if (Objects.nonNull(startReentrySectionCode)) {
startReentrySection = mapVO.findSectionNew(startReentrySectionCode);
} else {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.exception("车站" + routingData.getStartStationCode() + "折返轨未设置");
throw BusinessExceptionAssertEnum.DATA_NOT_EXIST.exception("车站" + routingData.getStartStationCode() + "折返轨未设置");
}
RunPlanTripVO tripVO = new RunPlanTripVO(tripConfigVO, routingData, startReentrySection, endReentrySection);
if (mapVO.getConfigVO().getUpRight()) {
@ -698,13 +698,13 @@ public class RunPlanDraftService implements IRunPlanDraftService {
if (Objects.nonNull(endReentrySectionCode)) {
endReentrySection = mapVO.findSectionNew(endReentrySectionCode);
} else {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.exception("车站" + routingData.getEndStationCode() + "折返轨未设置");
throw BusinessExceptionAssertEnum.DATA_NOT_EXIST.exception("车站" + routingData.getEndStationCode() + "折返轨未设置");
}
MapSectionNewVO startReentrySection = null;
if (Objects.nonNull(startReentrySectionCode)) {
startReentrySection = mapVO.findSectionNew(startReentrySectionCode);
} else {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.exception("车站" + routingData.getStartStationCode() + "折返轨未设置");
throw BusinessExceptionAssertEnum.DATA_NOT_EXIST.exception("车站" + routingData.getStartStationCode() + "折返轨未设置");
}
tripVO = new RunPlanTripVO(tripConfig, routingData, startReentrySection, endReentrySection);
// 构建类车到站数据

View File

@ -72,7 +72,7 @@ public class RunPlanGenerator {
// 检测折返轨配置
if (Objects.isNull(userReentryData.get(running1Routing.getParkSectionCodeList().get(0).getStationCode()))
|| Objects.isNull(userReentryData.get(running1Routing.getParkSectionCodeList().get(running1Routing.getParkSectionCodeList().size() - 1).getStationCode()))) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception("折返轨未设置");
throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception("折返轨未设置");
}
//生成车次
@ -261,7 +261,7 @@ public class RunPlanGenerator {
outRef = running2Routing;
other = running1Routing;
} else {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception("出库交路 无法与环路交路相接");
throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception("出库交路 无法与环路交路相接");
}
//查站间运行等级
List<RunPlanRunlevelVO> levels = runPlanRunlevelService.queryUserRunLevels(userId, mapVO.getId());
@ -276,7 +276,7 @@ public class RunPlanGenerator {
// 检测折返轨配置
if (Objects.isNull(userReentryData.get(running1Routing.getParkSectionCodeList().get(0).getStationCode()))
|| Objects.isNull(userReentryData.get(running1Routing.getParkSectionCodeList().get(running1Routing.getParkSectionCodeList().size() - 1).getStationCode()))) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception("折返轨未设置");
throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception("折返轨未设置");
}
List<RunPlanTripVO> tripList = new ArrayList<>(100);