报错消除(未完)
This commit is contained in:
parent
4cc89f9c2d
commit
bb26bfeec9
@ -3,15 +3,13 @@ package club.joylink.rtss.controller;
|
||||
import club.joylink.rtss.constants.RoleEnum;
|
||||
import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
|
||||
import club.joylink.rtss.controller.advice.Role;
|
||||
import club.joylink.rtss.runplan.newdraw.RunPlanInput;
|
||||
import club.joylink.rtss.services.IRunPlanDraftService;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.map.MapRoutingSectionVO;
|
||||
import club.joylink.rtss.vo.client.map.MapRoutingVO;
|
||||
import club.joylink.rtss.vo.client.map.newmap.MapStationParkingTimeVO;
|
||||
import club.joylink.rtss.vo.client.map.newmap.MapStationRunLevelVO;
|
||||
import club.joylink.rtss.vo.client.runplan.*;
|
||||
import club.joylink.rtss.runplan.newdraw.RunPlanInput;
|
||||
import club.joylink.rtss.vo.client.validGroup.RunPlanCreateCheck;
|
||||
import club.joylink.rtss.vo.client.validGroup.RunPlanNameCheck;
|
||||
import club.joylink.rtss.vo.client.validGroup.ValidList;
|
||||
|
@ -3,7 +3,6 @@ package club.joylink.rtss.controller;
|
||||
import club.joylink.rtss.services.IScriptService;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptQueryVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -6,7 +6,6 @@ import club.joylink.rtss.services.IScriptDraftService;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptNewVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptVO;
|
||||
import club.joylink.rtss.vo.client.validGroup.ScriptCreateCheck;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -40,7 +39,7 @@ public class ScriptDraftController {
|
||||
|
||||
@ApiOperation(value = "通过id查询剧本基础信息")
|
||||
@GetMapping(path = "/{id}")
|
||||
public ScriptNewVO getBasicInfoById(@PathVariable Long id) {
|
||||
public ScriptVO getBasicInfoById(@PathVariable Long id) {
|
||||
return iScriptDraftService.getBasicInfo(id);
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ package club.joylink.rtss.controller.script;
|
||||
|
||||
import club.joylink.rtss.services.script.IScriptService2;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptNewVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptQueryVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@ -23,13 +23,13 @@ public class ScriptController2 {
|
||||
|
||||
@ApiOperation(value = "分页查询上线的剧本")
|
||||
@GetMapping(path = "/paging/online")
|
||||
public PageVO<ScriptNewVO> pagingQueryOnlineScript(ScriptQueryVO scriptQueryVO) {
|
||||
public PageVO<ScriptVO> pagingQueryOnlineScript(ScriptQueryVO scriptQueryVO) {
|
||||
return iScriptService2.pagingQueryOnlineScript(scriptQueryVO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过id查询剧本详细信息")
|
||||
@GetMapping(path = "/{id}/detail")
|
||||
public ScriptNewVO getDetailInfoById(@PathVariable @NotNull Long id) {
|
||||
public ScriptVO getDetailInfoById(@PathVariable @NotNull Long id) {
|
||||
return iScriptService2.getDetailForClientById(id);
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.script.MapLocationVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptActionNewUpdateVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptActionNewVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptNewVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptVO;
|
||||
import club.joylink.rtss.vo.client.simulationv1.SimulationMemberVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@ -156,7 +156,7 @@ public class ScriptSimulationController {
|
||||
|
||||
@ApiOperation(value = "获取仿真中加载的剧本详情")
|
||||
@GetMapping("/{group}/scriptDetail")
|
||||
public ScriptNewVO getScriptDetail(@PathVariable String group) {
|
||||
public ScriptVO getScriptDetail(@PathVariable String group) {
|
||||
return iScriptSimulationService.getScriptDetail(group);
|
||||
}
|
||||
|
||||
|
@ -7,9 +7,8 @@ import club.joylink.rtss.entity.ScriptDraftWithBLOBs;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptNewVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptQueryVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptQueryVO;
|
||||
|
||||
public interface IScriptDraftService {
|
||||
|
||||
@ -34,7 +33,7 @@ public interface IScriptDraftService {
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ScriptNewVO getBasicInfo(Long id);
|
||||
ScriptVO getBasicInfo(Long id);
|
||||
|
||||
/**
|
||||
* 更新剧本基本信息
|
||||
@ -60,13 +59,6 @@ public interface IScriptDraftService {
|
||||
|
||||
ScriptBO getScriptBO(Long id, Simulation simulation);
|
||||
|
||||
/**
|
||||
* 更新地图详细数据
|
||||
* @param id
|
||||
* @param scriptVO
|
||||
*/
|
||||
void updateScriptDetailData(Long id, ScriptVO scriptVO);
|
||||
|
||||
/**
|
||||
* 更新新版剧本详细数据
|
||||
*/
|
||||
|
@ -6,7 +6,6 @@ import club.joylink.rtss.entity.ScriptDraftWithBLOBs;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptQueryVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptVO;
|
||||
|
||||
public interface IScriptService {
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
package club.joylink.rtss.services;
|
||||
|
||||
import club.joylink.rtss.vo.client.script.ScriptVO;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import club.joylink.rtss.constants.BusinessConsts;
|
||||
import club.joylink.rtss.dao.*;
|
||||
import club.joylink.rtss.entity.*;
|
||||
import club.joylink.rtss.util.ConvertUtil;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.*;
|
||||
@ -13,7 +13,7 @@ import club.joylink.rtss.vo.client.map.MapVO;
|
||||
import club.joylink.rtss.vo.client.runplan.RunPlanQueryVO;
|
||||
import club.joylink.rtss.vo.client.runplan.RunPlanVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptQueryVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -23,7 +23,9 @@ import org.springframework.util.ObjectUtils;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ReleaseReviewService implements IReleaseReviewService {
|
||||
@Autowired
|
||||
@ -78,7 +80,7 @@ public class ReleaseReviewService implements IReleaseReviewService {
|
||||
LsDraftLessonExample example = new LsDraftLessonExample();
|
||||
LsDraftLessonExample.Criteria criteria = example.createCriteria().andStatusEqualTo(BusinessConsts.ReleaseReview.RELEASE_STATUS_02);
|
||||
if (!ObjectUtils.isEmpty(queryVO.getMapId())){
|
||||
MapVO mapVO = iMapService.getMapInfoById(ConvertUtil.str2Long(queryVO.getMapId()));
|
||||
MapVO mapVO = iMapService.getMapInfoById(queryVO.getMapId());
|
||||
criteria.andMapIdEqualTo(mapVO.getId());
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(queryVO.getLessonName())) {
|
||||
@ -99,7 +101,7 @@ public class ReleaseReviewService implements IReleaseReviewService {
|
||||
Page<LsDraftLesson> lessonPage = (Page<LsDraftLesson>) lsDraftLessonDAO.selectByExample(example);
|
||||
List<LessonVO> lessonVOList = LessonVO.convert2VO(lessonPage.getResult());
|
||||
for (LessonVO lessonVO : lessonVOList) {
|
||||
UserVO userVO = iSysUserService.findUserById(ConvertUtil.str2Long(lessonVO.getCreatorId()));
|
||||
UserVO userVO = iSysUserService.findUserById(lessonVO.getCreatorId());
|
||||
lessonVO.setUserName(userVO.getName());
|
||||
MapVO mapVO = iMapService.getMapInfoById(lessonVO.getMapId());
|
||||
lessonVO.setCityCode(mapVO.getCityCode());
|
||||
@ -171,10 +173,93 @@ public class ReleaseReviewService implements IReleaseReviewService {
|
||||
lessonVOS.add(new LessonVO(lsDraftLesson));
|
||||
List<LessonChapterVO> chapterVos = this.draftLessonChapterDAO.selectChapterTrainingByLessonId(id);
|
||||
// 构建课程树
|
||||
List<TreeNode> treeNodes = ConvertUtil.buildLessonTreeList(lessonVOS, chapterVos);
|
||||
List<TreeNode> treeNodes = buildLessonTreeList(lessonVOS, chapterVos);
|
||||
return treeNodes;
|
||||
}
|
||||
|
||||
private List<TreeNode> buildLessonTreeList(List<LessonVO> lessonVOS, List<LessonChapterVO> chapterVos) {
|
||||
List<TreeNode> tree = new ArrayList<>();
|
||||
List<LessonChapterVO> chapterTreeList = constructTree(chapterVos);
|
||||
// 构造树节点
|
||||
lessonVOS.forEach(lesson -> {
|
||||
for (LessonChapterVO lessonChapterVO : chapterTreeList) {
|
||||
if (lesson.getId().equals(lessonChapterVO.getLessonId())) {
|
||||
lesson.addChapter(lessonChapterVO);
|
||||
}
|
||||
}
|
||||
tree.add(buildTree(lesson));
|
||||
});
|
||||
sortTree(tree);
|
||||
return tree;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将章节列表构建成章节列表树
|
||||
*/
|
||||
private static List<LessonChapterVO> constructTree(List<LessonChapterVO> chapterVoList) {
|
||||
List<LessonChapterVO> tree = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(chapterVoList)) {
|
||||
chapterVoList.forEach(chapterVo -> {
|
||||
if (chapterVo.getParentId() == 0) {
|
||||
tree.add(chapterVo);
|
||||
} else {
|
||||
Optional<LessonChapterVO> first = chapterVoList.stream()
|
||||
.filter(chapterVO -> chapterVO.getId().equals(chapterVo.getParentId())).findFirst();
|
||||
if (first.isPresent()) {
|
||||
first.get().addChild(chapterVo);
|
||||
} else {
|
||||
log.warn(String.format("获取父级章节为null,父id为‘%s’", chapterVo.getParentId()));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造课程节点
|
||||
* @param lesson
|
||||
* @return
|
||||
*/
|
||||
private TreeNode buildTree(LessonVO lesson) {
|
||||
TreeNode node = TreeNode.buildLessonNode(lesson);
|
||||
if(!CollectionUtils.isEmpty(lesson.getChapters())) {
|
||||
lesson.getChapters().forEach(chapter -> node.addChild(buildTree(chapter)));
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造章节节点
|
||||
* @param chapter
|
||||
* @return
|
||||
*/
|
||||
private static TreeNode buildTree(LessonChapterVO chapter) {
|
||||
TreeNode node = TreeNode.buildChapterNode(chapter);
|
||||
if(!CollectionUtils.isEmpty(chapter.getTrainingVos())) {
|
||||
chapter.getTrainingVos().forEach(training -> node.addChild(TreeNode.buildTrainingNode(training)));
|
||||
}
|
||||
if(!CollectionUtils.isEmpty(chapter.getChildren())) {
|
||||
chapter.getChildren().forEach(child -> node.addChild(buildTree(child)));
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
/**
|
||||
* 树排序
|
||||
*/
|
||||
private void sortTree(List<TreeNode> list) {
|
||||
if(!CollectionUtils.isEmpty(list)) {
|
||||
list.sort((o1, o2) -> {
|
||||
if (null == o1.getOrder() || null == o2.getOrder()) {
|
||||
return 0;
|
||||
}
|
||||
return o1.getOrder().compareTo(o2.getOrder());
|
||||
});
|
||||
list.forEach(tree -> sortTree(tree.getChildren()));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------剧本发布审核----------------
|
||||
|
||||
/**
|
||||
|
@ -1,10 +1,8 @@
|
||||
package club.joylink.rtss.services;
|
||||
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
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.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
|
||||
import club.joylink.rtss.simulation.cbtc.script.ScriptUpdateVO;
|
||||
@ -13,13 +11,11 @@ import club.joylink.rtss.dao.ScriptDraftDAO;
|
||||
import club.joylink.rtss.entity.ScriptDraft;
|
||||
import club.joylink.rtss.entity.ScriptDraftExample;
|
||||
import club.joylink.rtss.entity.ScriptDraftWithBLOBs;
|
||||
import club.joylink.rtss.util.ConvertUtil;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.PageQueryVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptNewVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptQueryVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptQueryVO;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -55,113 +51,79 @@ public class ScriptDraftService implements IScriptDraftService {
|
||||
example.createCriteria().andMapIdEqualTo(mapId)
|
||||
.andCreatorIdEqualTo(user.getId());
|
||||
Page<ScriptDraft> page = (Page<ScriptDraft>) scriptDraftDAO.selectByExample(example);
|
||||
List<ScriptVO> scriptVOList = ScriptVO.convertDraft2VOList(page.getResult());
|
||||
List<ScriptVO> scriptVOList = ScriptVO.convertFromDraftList(page.getResult());
|
||||
return PageVO.convert(page, scriptVOList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createScript(ScriptVO scriptVO, UserVO user) {
|
||||
checkNameRepeat(null, scriptVO.getName(), scriptVO.getMapId(), user);
|
||||
ScriptDraftWithBLOBs scriptDraft = scriptVO.convert2Draft();
|
||||
ScriptDraftWithBLOBs scriptDraft = scriptVO.convert2CreateDraft();
|
||||
scriptDraft.setCreatorId(user.getId());
|
||||
scriptDraft.setCreateTime(LocalDateTime.now());
|
||||
scriptDraft.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_01);
|
||||
scriptDraftDAO.insert(scriptDraft);
|
||||
return ConvertUtil.long2Str(scriptDraft.getId());
|
||||
return scriptDraft.getId().toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScriptNewVO getBasicInfo(Long id) {
|
||||
ScriptDraft scriptDraft = scriptDraftDAO.selectByPrimaryKey(id);
|
||||
if (Objects.isNull(scriptDraft)) {
|
||||
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
}
|
||||
return new ScriptNewVO(scriptDraft);
|
||||
public ScriptVO getBasicInfo(Long id) {
|
||||
ScriptDraftWithBLOBs scriptDraftWithBLOBs = getEntityById(id);
|
||||
return new ScriptVO((ScriptDraft)scriptDraftWithBLOBs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScriptInfo(Long id, ScriptUpdateVO updateVO, UserVO user) {
|
||||
checkNameRepeat(id, updateVO.getName(), updateVO.getMapId(), user);
|
||||
ScriptDraft scriptDraft = scriptDraftDAO.selectByPrimaryKey(id);
|
||||
if (Objects.isNull(scriptDraft)) {
|
||||
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
}
|
||||
ScriptDraftWithBLOBs scriptDraftWithBLOBs = getEntityById(id);
|
||||
boolean change = false;
|
||||
if (!Objects.equals(scriptDraft.getName(), updateVO.getName())) {
|
||||
scriptDraft.setName(updateVO.getName());
|
||||
if (!Objects.equals(scriptDraftWithBLOBs.getName(), updateVO.getName())) {
|
||||
scriptDraftWithBLOBs.setName(updateVO.getName());
|
||||
change = true;
|
||||
}
|
||||
if (!Objects.equals(scriptDraft.getDescription(), updateVO.getDescription())) {
|
||||
scriptDraft.setDescription(updateVO.getDescription());
|
||||
if (!Objects.equals(scriptDraftWithBLOBs.getDescription(), updateVO.getDescription())) {
|
||||
scriptDraftWithBLOBs.setDescription(updateVO.getDescription());
|
||||
change = true;
|
||||
}
|
||||
if (!Objects.equals(scriptDraft.getFullMarksDuration(), updateVO.getFullMarksDuration())) {
|
||||
scriptDraft.setFullMarksDuration(updateVO.getFullMarksDuration());
|
||||
if (!Objects.equals(scriptDraftWithBLOBs.getFullMarksDuration(), updateVO.getFullMarksDuration())) {
|
||||
scriptDraftWithBLOBs.setFullMarksDuration(updateVO.getFullMarksDuration());
|
||||
change = true;
|
||||
}
|
||||
if (!Objects.equals(scriptDraft.getPassingGradeDuration(), updateVO.getPassingGradeDuration())) {
|
||||
scriptDraft.setPassingGradeDuration(updateVO.getPassingGradeDuration());
|
||||
if (!Objects.equals(scriptDraftWithBLOBs.getPassingGradeDuration(), updateVO.getPassingGradeDuration())) {
|
||||
scriptDraftWithBLOBs.setPassingGradeDuration(updateVO.getPassingGradeDuration());
|
||||
change = true;
|
||||
}
|
||||
if (!Objects.equals(scriptDraft.getZeroDuration(), updateVO.getZeroDuration())) {
|
||||
scriptDraft.setZeroDuration(updateVO.getZeroDuration());
|
||||
if (!Objects.equals(scriptDraftWithBLOBs.getZeroDuration(), updateVO.getZeroDuration())) {
|
||||
scriptDraftWithBLOBs.setZeroDuration(updateVO.getZeroDuration());
|
||||
change = true;
|
||||
}
|
||||
if (change) {
|
||||
scriptDraft.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_01);
|
||||
scriptDraftDAO.updateByPrimaryKey(scriptDraft);
|
||||
scriptDraftWithBLOBs.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_01);
|
||||
scriptDraftDAO.updateByPrimaryKey(scriptDraftWithBLOBs);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteScript(Long id, UserVO user) {
|
||||
ScriptDraft scriptDraft = scriptDraftDAO.selectByPrimaryKey(id);
|
||||
if (!scriptDraft.getCreatorId().equals(user.getId())) {
|
||||
throw new BusinessException(ExceptionMapping.ILLEGAL_OPERATION);
|
||||
}
|
||||
ScriptDraftWithBLOBs entity = getEntityById(id);
|
||||
BusinessExceptionAssertEnum.INVALID_OPERATION.assertTrue(entity.getCreatorId().equals(user.getId()),
|
||||
String.format("用户[%s]尝试删除用户[%s]的剧本[%s]", user.getId(), entity.getCreatorId(), id));
|
||||
scriptDraftDAO.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScriptVO getScriptDetail(Long id) {
|
||||
ScriptDraftWithBLOBs scriptDraftWithBLOBs = scriptDraftDAO.selectByPrimaryKey(id);
|
||||
if (Objects.isNull(scriptDraftWithBLOBs)) {
|
||||
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
}
|
||||
return new ScriptVO(scriptDraftWithBLOBs);
|
||||
return new ScriptVO(getEntityById(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScriptBO getScriptBO(Long id, Simulation simulation) {
|
||||
ScriptDraftWithBLOBs scriptDraftWithBLOBs = scriptDraftDAO.selectByPrimaryKey(id);
|
||||
if (Objects.isNull(scriptDraftWithBLOBs)) {
|
||||
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
}
|
||||
return new ScriptBO(scriptDraftWithBLOBs, simulation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScriptDetailData(Long id, ScriptVO scriptVO) {
|
||||
ScriptDraftWithBLOBs scriptDraftWithBLOBs = scriptDraftDAO.selectByPrimaryKey(id);
|
||||
if (Objects.isNull(scriptDraftWithBLOBs)) {
|
||||
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
}
|
||||
scriptDraftWithBLOBs.setBgScenesJson(scriptVO.getBgScenesJson());
|
||||
scriptDraftWithBLOBs.setFinalScenesJson(scriptVO.getFinalScenesJson());
|
||||
scriptDraftWithBLOBs.setMapLocationJson(scriptVO.getMapLocationJson());
|
||||
scriptDraftWithBLOBs.setMembersJson(scriptVO.getMembersJson());
|
||||
scriptDraftWithBLOBs.setPlayersJson(scriptVO.getPlayersJson());
|
||||
scriptDraftWithBLOBs.setActionsJson(scriptVO.getActionsJson());
|
||||
scriptDraftWithBLOBs.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_01);
|
||||
scriptDraftDAO.updateByPrimaryKeyWithBLOBs(scriptDraftWithBLOBs);
|
||||
return new ScriptBO(getEntityById(id), simulation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScriptDetailData(Long id, ScriptBO scriptBO) {
|
||||
ScriptDraftWithBLOBs script = scriptDraftDAO.selectByPrimaryKey(id);
|
||||
if (Objects.isNull(script)) {
|
||||
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
}
|
||||
ScriptDraftWithBLOBs script = getEntityById(id);
|
||||
script.setBgScenesJson(scriptBO.getBgScenesJson());
|
||||
script.setFinalScenesJson(scriptBO.getFinalScenesJson());
|
||||
script.setMapLocationJson(scriptBO.getMapLocationJson());
|
||||
@ -174,17 +136,14 @@ public class ScriptDraftService implements IScriptDraftService {
|
||||
|
||||
@Override
|
||||
public void publish(Long id, String name, UserVO user) {
|
||||
ScriptDraftWithBLOBs scriptDraftWithBLOBs = scriptDraftDAO.selectByPrimaryKey(id);
|
||||
if (Objects.isNull(scriptDraftWithBLOBs)) {
|
||||
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
}
|
||||
ScriptDraftWithBLOBs entity = getEntityById(id);
|
||||
if (iSysUserService.isAdmin(user)) {
|
||||
iScriptService.publish(scriptDraftWithBLOBs, user);
|
||||
scriptDraftWithBLOBs.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_03);
|
||||
iScriptService.publish(entity, user);
|
||||
entity.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_03);
|
||||
} else {
|
||||
scriptDraftWithBLOBs.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_02);
|
||||
entity.setStatus(BusinessConsts.ReleaseReview.RELEASE_STATUS_02);
|
||||
}
|
||||
scriptDraftDAO.updateByPrimaryKey(scriptDraftWithBLOBs);
|
||||
scriptDraftDAO.updateByPrimaryKey(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -247,9 +206,8 @@ public class ScriptDraftService implements IScriptDraftService {
|
||||
@Override
|
||||
public ScriptDraftWithBLOBs getEntityById(Long scriptId) {
|
||||
ScriptDraftWithBLOBs scriptDraftWithBLOBs = scriptDraftDAO.selectByPrimaryKey(scriptId);
|
||||
if (Objects.isNull(scriptDraftWithBLOBs)) {
|
||||
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(scriptDraftWithBLOBs,
|
||||
String.format("id为[%s]的草稿剧本不存在", scriptId));
|
||||
return scriptDraftWithBLOBs;
|
||||
}
|
||||
|
||||
@ -279,8 +237,7 @@ public class ScriptDraftService implements IScriptDraftService {
|
||||
criteria.andMapIdEqualTo(mapId)
|
||||
.andNameEqualTo(name)
|
||||
.andCreatorIdEqualTo(userVO.getId());
|
||||
if (scriptDraftDAO.countByExample(draftExample) > 0) {
|
||||
throw new DBException(ExceptionMapping.NAME_REPEAT);
|
||||
}
|
||||
BusinessExceptionAssertEnum.DATA_UNIQUE_PROPERTY_REPEAT.assertTrue(scriptDraftDAO.countByExample(draftExample) == 0,
|
||||
String.format("剧本名称[%s]重复", name));
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ import club.joylink.rtss.entity.ScriptWithBLOBs;
|
||||
import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptQueryVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -27,10 +27,9 @@ import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.competition.*;
|
||||
import club.joylink.rtss.vo.client.script.ScriptActionNewVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptNewVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptVO;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import lombok.extern.log4j.Log4j;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -129,7 +128,7 @@ public class CompetitionPracticalService implements ICompetitionPracticalService
|
||||
* 检查数据是否正确
|
||||
*/
|
||||
private void checkData(CompetitionVO competitionVO) {
|
||||
ScriptNewVO scriptDetail = iScriptService2.getDetailById(competitionVO.getScriptId());
|
||||
ScriptVO scriptDetail = iScriptService2.getDetailById(competitionVO.getScriptId());
|
||||
Map<String, ScriptActionNewVO> actionMap = scriptDetail.getActionList()
|
||||
.stream().collect(Collectors.toMap(ScriptActionNewVO::getId, Function.identity()));
|
||||
for (CommandPublishStatisticVO rule : competitionVO.getCommandEvaluationRuleVOs()) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package club.joylink.rtss.services.script;
|
||||
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptNewVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptQueryVO;
|
||||
|
||||
public interface IScriptService2 {
|
||||
@ -11,15 +11,15 @@ public interface IScriptService2 {
|
||||
* @return
|
||||
* @param queryVO
|
||||
*/
|
||||
PageVO<ScriptNewVO> pagingQueryOnlineScript(ScriptQueryVO queryVO);
|
||||
PageVO<ScriptVO> pagingQueryOnlineScript(ScriptQueryVO queryVO);
|
||||
|
||||
/**
|
||||
* 根据id查询剧本详细信息
|
||||
*/
|
||||
ScriptNewVO getDetailForClientById(Long id);
|
||||
ScriptVO getDetailForClientById(Long id);
|
||||
|
||||
/**
|
||||
* 根据id获取剧本基础BO对象
|
||||
*/
|
||||
ScriptNewVO getDetailById(Long id);
|
||||
ScriptVO getDetailById(Long id);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import club.joylink.rtss.entity.Script;
|
||||
import club.joylink.rtss.entity.ScriptExample;
|
||||
import club.joylink.rtss.entity.ScriptWithBLOBs;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptNewVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptQueryVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -25,7 +25,7 @@ public class ScriptService2 implements IScriptService2 {
|
||||
private ScriptDAO scriptDAO;
|
||||
|
||||
@Override
|
||||
public PageVO<ScriptNewVO> pagingQueryOnlineScript(ScriptQueryVO queryVO) {
|
||||
public PageVO<ScriptVO> pagingQueryOnlineScript(ScriptQueryVO queryVO) {
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
ScriptExample example = new ScriptExample();
|
||||
example.setOrderByClause("id desc");
|
||||
@ -35,13 +35,13 @@ public class ScriptService2 implements IScriptService2 {
|
||||
criteria.andMapIdEqualTo(queryVO.getMapId());
|
||||
}
|
||||
Page<Script> dbList = (Page<Script>) scriptDAO.selectByExample(example);
|
||||
List<ScriptNewVO> scriptVOList = ScriptNewVO.convertFromPOList(dbList.getResult());
|
||||
List<ScriptVO> scriptVOList = ScriptVO.convertFromPOList(dbList.getResult());
|
||||
return PageVO.convert(dbList, scriptVOList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScriptNewVO getDetailForClientById(Long id) {
|
||||
ScriptNewVO vo = getDetailById(id);
|
||||
public ScriptVO getDetailForClientById(Long id) {
|
||||
ScriptVO vo = getDetailById(id);
|
||||
vo.setBgScenesJson(null);
|
||||
vo.setFinalScenesJson(null);
|
||||
return vo;
|
||||
@ -51,11 +51,11 @@ public class ScriptService2 implements IScriptService2 {
|
||||
* 查询剧本详情
|
||||
*/
|
||||
@Override
|
||||
public ScriptNewVO getDetailById(Long id) {
|
||||
public ScriptVO getDetailById(Long id) {
|
||||
ScriptWithBLOBs script = scriptDAO.selectByPrimaryKey(id);
|
||||
if (Objects.isNull(script)) {
|
||||
throw new DBException(ExceptionMapping.DATA_NOT_EXIST);
|
||||
}
|
||||
return new ScriptNewVO(script);
|
||||
return new ScriptVO(script);
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import club.joylink.rtss.vo.UserVO;
|
||||
import club.joylink.rtss.vo.client.script.MapLocationVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptActionNewUpdateVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptActionNewVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptNewVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptVO;
|
||||
import club.joylink.rtss.vo.client.simulationv1.SimulationMemberVO;
|
||||
|
||||
import java.util.List;
|
||||
@ -63,7 +63,7 @@ public interface IScriptSimulationService {
|
||||
/**
|
||||
* 获取仿真中加载的剧本的详情
|
||||
*/
|
||||
ScriptNewVO getScriptDetail(String group);
|
||||
ScriptVO getScriptDetail(String group);
|
||||
|
||||
/**
|
||||
* 重新预览剧本
|
||||
|
@ -29,7 +29,7 @@ import club.joylink.rtss.vo.client.factory.SocketMessageFactory;
|
||||
import club.joylink.rtss.vo.client.script.MapLocationVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptActionNewUpdateVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptActionNewVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptNewVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptVO;
|
||||
import club.joylink.rtss.vo.client.simulationv1.SimulationMemberVO;
|
||||
import club.joylink.rtss.websocket.StompMessageService;
|
||||
import org.springframework.util.StringUtils;
|
||||
@ -215,9 +215,9 @@ public class ScriptSimulationService implements IScriptSimulationService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScriptNewVO getScriptDetail(String group) {
|
||||
public ScriptVO getScriptDetail(String group) {
|
||||
Simulation simulation = groupSimulationCache.getSimulationByGroup(group);
|
||||
return new ScriptNewVO(simulation.getScript());
|
||||
return new ScriptVO(simulation.getScript());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -374,7 +374,7 @@ public class ScriptSimulationService implements IScriptSimulationService {
|
||||
@Override
|
||||
public void loadScript(String group, Long scriptId) {
|
||||
Simulation simulation = groupSimulationCache.getSimulationByGroup(group);
|
||||
ScriptNewVO detailById = iScriptService2.getDetailById(scriptId);
|
||||
ScriptVO detailById = iScriptService2.getDetailById(scriptId);
|
||||
groupSimulationService.loadScenes(simulation.getGroup(), detailById.getBgScenesJson());
|
||||
ScriptBO scriptBO = iScriptService.getScriptBOById(scriptId, simulation);
|
||||
this.scriptCoverSimulation(simulation, scriptBO);
|
||||
|
@ -13,7 +13,7 @@ import club.joylink.rtss.simulation.cbtc.data.support.TrainStopMessage;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||
import club.joylink.rtss.simulation.cbtc.onboard.ATP.NewATPService;
|
||||
import club.joylink.rtss.simulation.cbtc.onboard.ATP.ATPService;
|
||||
import club.joylink.rtss.simulation.cbtc.onboard.ATP.OnboardAtpApiService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -36,7 +36,7 @@ public class ZCLogicLoop {
|
||||
private OnboardAtpApiService onboardAtpApiService;
|
||||
|
||||
@Autowired
|
||||
private NewATPService newATPService;
|
||||
private ATPService ATPService;
|
||||
|
||||
@Autowired
|
||||
private AtsApiService atsApiService;
|
||||
@ -66,7 +66,7 @@ public class ZCLogicLoop {
|
||||
}
|
||||
|
||||
private void checkTrainStationParkingAndSend2Ats(Simulation simulation, VirtualRealityTrain train) {
|
||||
if (!train.isParking() && this.newATPService.isStopOnTargetPosition(train)) {
|
||||
if (!train.isParking() && this.ATPService.isStopOnTargetPosition(train)) {
|
||||
String stationName = null;
|
||||
if (train.getNextStation() != null) {
|
||||
stationName = train.getNextStation().getName();
|
||||
|
@ -12,8 +12,8 @@ import club.joylink.rtss.simulation.cbtc.data.map.Stand;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||
import club.joylink.rtss.simulation.cbtc.onboard.ATO.service.NewATOService;
|
||||
import club.joylink.rtss.simulation.cbtc.onboard.ATP.NewATPService;
|
||||
import club.joylink.rtss.simulation.cbtc.onboard.ATO.service.ATOService;
|
||||
import club.joylink.rtss.simulation.cbtc.onboard.ATP.ATPService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@ -28,10 +28,10 @@ import java.util.Objects;
|
||||
public class DriverOperateHandler {
|
||||
|
||||
@Autowired
|
||||
private NewATOService newATOService;
|
||||
private ATOService ATOService;
|
||||
|
||||
@Autowired
|
||||
private NewATPService newATPService;
|
||||
private ATPService ATPService;
|
||||
|
||||
@Autowired
|
||||
private CiApiService ciApiService;
|
||||
@ -60,7 +60,7 @@ public class DriverOperateHandler {
|
||||
String.format("列车牵引/制动力可调整比例范围应该在[-1, 1]之间,或为紧急制动-2"));
|
||||
}
|
||||
if (train.isAtoOn()) {
|
||||
this.newATOService.closeATO(train);
|
||||
this.ATOService.closeATO(train);
|
||||
}
|
||||
train.setLeverPosition(percent);
|
||||
}
|
||||
@ -69,9 +69,9 @@ public class DriverOperateHandler {
|
||||
public void trainEB(Simulation simulation, String groupNumber) {
|
||||
VirtualRealityTrain train = simulation.getRepository().getOnlineTrainBy(groupNumber);
|
||||
if (train.isCircuitEB()) {
|
||||
this.newATPService.cancelCircuitEB(train);
|
||||
this.ATPService.cancelCircuitEB(train);
|
||||
} else {
|
||||
this.newATPService.triggerCircuitEB(train);
|
||||
this.ATPService.triggerCircuitEB(train);
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,16 +145,16 @@ public class DriverOperateHandler {
|
||||
driveMode));
|
||||
}
|
||||
}
|
||||
this.newATOService.openATO(train);
|
||||
this.ATOService.openATO(train);
|
||||
}
|
||||
|
||||
@OperateHandlerMapping(type = Operation.Type.Driver_ATP_Change)
|
||||
public void changeAtpStatus(Simulation simulation, String groupNumber, boolean cutOff) {
|
||||
VirtualRealityTrain train = simulation.getRepository().getOnlineTrainBy(groupNumber);
|
||||
if (cutOff) {
|
||||
this.newATPService.cutOffAtp(train);
|
||||
this.ATPService.cutOffAtp(train);
|
||||
} else {
|
||||
this.newATPService.openAtp(train);
|
||||
this.ATPService.openAtp(train);
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,7 +163,7 @@ public class DriverOperateHandler {
|
||||
VirtualRealityTrain train = simulation.getRepository().getOnlineTrainBy(groupNumber);
|
||||
if (train.isStop()) {
|
||||
train.setAtoOn(false);
|
||||
this.newATPService.turnDirectionImmediately(train);
|
||||
this.ATPService.turnDirectionImmediately(train);
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,14 +187,14 @@ public class DriverOperateHandler {
|
||||
}
|
||||
if (door.isCloseAndLock()) {
|
||||
train.setDeparture(false);
|
||||
newATOService.openTrainDoor(simulation, train, door);
|
||||
ATOService.openTrainDoor(simulation, train, door);
|
||||
}
|
||||
} else {
|
||||
for (Stand stand : standList) {
|
||||
this.ciApiService.closeScreenDoor(simulation, stand.getCode());
|
||||
}
|
||||
if (!door.isCloseAndLock()) {
|
||||
newATOService.closeTrainDoor(simulation, train, door);
|
||||
ATOService.closeTrainDoor(simulation, train, door);
|
||||
train.setDeparture(true);
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ import club.joylink.rtss.vo.client.map.newmap.MapStationNewVO;
|
||||
import club.joylink.rtss.vo.client.project.ProjectDeviceVO;
|
||||
import club.joylink.rtss.vo.client.runplan.*;
|
||||
import club.joylink.rtss.vo.client.schedulingNew.SchedulingPlanNewVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptNewVO;
|
||||
import club.joylink.rtss.vo.client.script.ScriptVO;
|
||||
import club.joylink.rtss.vo.client.simulationv1.SimulationMemberVO;
|
||||
import club.joylink.rtss.vo.client.simulationv1.*;
|
||||
import club.joylink.rtss.vo.client.training.TrainingNewVO;
|
||||
@ -621,7 +621,7 @@ public class GroupSimulationServiceImpl implements GroupSimulationService {
|
||||
|
||||
@Override
|
||||
public void loadScript(Simulation simulation, Long scriptId) {
|
||||
ScriptNewVO detailById = iScriptService2.getDetailById(scriptId);
|
||||
ScriptVO detailById = iScriptService2.getDetailById(scriptId);
|
||||
this.loadScenes(simulation.getGroup(), detailById.getBgScenesJson());
|
||||
ScriptBO scriptBO = scriptService.getScriptBOById(scriptId, simulation);
|
||||
iScriptSimulationService.scriptCoverSimulation(simulation, scriptBO);
|
||||
|
@ -40,7 +40,7 @@ public class ConversationManagerService {
|
||||
private IVoiceService iVoiceService;
|
||||
|
||||
@Autowired
|
||||
private NewSimulationVoiceHandler newSimulationVoiceHandler;
|
||||
private SimulationVoiceHandler simulationVoiceHandler;
|
||||
|
||||
@Autowired
|
||||
private ScriptExecuteService scriptExecuteService;
|
||||
@ -253,7 +253,7 @@ public class ConversationManagerService {
|
||||
SimulationMember member = simulation.getSimulationMemberByUserId(userVO.getId());
|
||||
VoiceRecognitionResult recognitionResult = this.iVoiceService.voiceRecognition(file, "");
|
||||
String upperCaseResult = recognitionResult.getResult().toUpperCase();
|
||||
String handledContent = this.newSimulationVoiceHandler.handle(upperCaseResult);
|
||||
String handledContent = this.simulationVoiceHandler.handle(upperCaseResult);
|
||||
this.chat(simulation, conversation, member, handledContent, recognitionResult.getFilePath());
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class NewSimulationVoiceHandler {
|
||||
public class SimulationVoiceHandler {
|
||||
|
||||
static List<Replacement> replacementList;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package club.joylink.rtss.simulation.cbtc.onboard.ATO;
|
||||
|
||||
import club.joylink.rtss.simulation.cbtc.onboard.ATO.service.NewATOService;
|
||||
import club.joylink.rtss.simulation.cbtc.onboard.ATO.service.ATOService;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -14,7 +14,7 @@ import java.util.List;
|
||||
@Slf4j
|
||||
public class ATOLogicLoop {
|
||||
@Autowired
|
||||
private NewATOService newATOService;
|
||||
private ATOService ATOService;
|
||||
|
||||
public void run(Simulation simulation) {
|
||||
// long start = System.currentTimeMillis();
|
||||
@ -22,7 +22,7 @@ public class ATOLogicLoop {
|
||||
if (!CollectionUtils.isEmpty(onlineTrain)) {
|
||||
onlineTrain.forEach(train -> {
|
||||
if (train.isAtoOn()) {
|
||||
newATOService.ATO(train);
|
||||
ATOService.ATO(train);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ import java.util.Objects;
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class NewATOService {
|
||||
public class ATOService {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
@ -19,7 +19,7 @@ import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||
import club.joylink.rtss.simulation.cbtc.event.SimulationATPAutoCancelEBEvent;
|
||||
import club.joylink.rtss.simulation.cbtc.event.SimulationTrainIsAbout2ArriveEvent;
|
||||
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
||||
import club.joylink.rtss.simulation.cbtc.onboard.ATO.service.NewATOService;
|
||||
import club.joylink.rtss.simulation.cbtc.onboard.ATO.service.ATOService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
@ -34,7 +34,7 @@ import java.util.Objects;
|
||||
public class ATPLogicLoop {
|
||||
|
||||
@Autowired
|
||||
private NewATPService newATPService;
|
||||
private ATPService ATPService;
|
||||
|
||||
@Autowired
|
||||
private AtsApiService atsApiService;
|
||||
@ -43,7 +43,7 @@ public class ATPLogicLoop {
|
||||
private GroundAtpApiService groundAtpApiService;
|
||||
|
||||
@Autowired
|
||||
private NewATOService newATOService;
|
||||
private ATOService ATOService;
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
@ -55,9 +55,9 @@ public class ATPLogicLoop {
|
||||
for (VirtualRealityTrain train : onlineTrain) {
|
||||
if (!train.isPowerOn()) { //如果列车断电
|
||||
if (!train.isStop() && !train.isEB()) {
|
||||
newATPService.triggerSignalEB(train);
|
||||
ATPService.triggerSignalEB(train);
|
||||
}
|
||||
this.newATOService.closeATO(train);
|
||||
this.ATOService.closeATO(train);
|
||||
continue;
|
||||
}
|
||||
this.onboardLogicRun2(simulation, train);
|
||||
@ -79,7 +79,7 @@ public class ATPLogicLoop {
|
||||
if (train.isCbtcMaMiss()) { //cbtc级别ma丢失
|
||||
if (train.isCBTC()) { //并且列车处于CBTC级别
|
||||
train.setRunLevel(RunLevel.IL);
|
||||
newATPService.triggerSignalEB(train);
|
||||
ATPService.triggerSignalEB(train);
|
||||
train.setMa(null);
|
||||
}
|
||||
} else {
|
||||
@ -100,7 +100,7 @@ public class ATPLogicLoop {
|
||||
private void driveLogicRun(Simulation simulation, VirtualRealityTrain train) {
|
||||
if (train.isChangeEnds() && train.isStop()) {
|
||||
// 列车换端中
|
||||
this.newATPService.changeEndsProgress(train);
|
||||
this.ATPService.changeEndsProgress(train);
|
||||
return;
|
||||
}
|
||||
if (!train.isAtoOn()) {
|
||||
@ -125,7 +125,7 @@ public class ATPLogicLoop {
|
||||
this.checkOnTransferAndSend2Ats(simulation, train, headPosition, tailPosition);
|
||||
if (!train.isBreaking()) { // 制动状态
|
||||
// 施加常规制动,防止倒溜
|
||||
this.newATOService.openBreaking(train);
|
||||
this.ATOService.openBreaking(train);
|
||||
}
|
||||
if (!train.isParkingAt()) {
|
||||
this.checkParkingAndSend2Ats(simulation, train);
|
||||
@ -138,7 +138,7 @@ public class ATPLogicLoop {
|
||||
if (train.getLeverPosition() == 0 && train.getMa() != null) {
|
||||
Float distance = CalculateService.calculateDistance(headPosition, train.getMa().getEnd().getEndPosition(), right);
|
||||
if (distance != null && distance > 100) {
|
||||
newATPService.cancelSignalEB(train);
|
||||
ATPService.cancelSignalEB(train);
|
||||
applicationContext.publishEvent(new SimulationATPAutoCancelEBEvent(this, simulation, train));
|
||||
log.info(String.format("列车[%s]移动授权距离超过100m,EB自动缓解", train.getGroupNumber()));
|
||||
}
|
||||
@ -148,7 +148,7 @@ public class ATPLogicLoop {
|
||||
}
|
||||
|
||||
if (this.checkConditionToMove2(simulation, train)) { // 可以启动
|
||||
this.newATOService.closeBreaking(train);
|
||||
this.ATOService.closeBreaking(train);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
@ -160,7 +160,7 @@ public class ATPLogicLoop {
|
||||
// 判断列车是否跳站
|
||||
this.checkTrainJumpAndSend2Ats(simulation, train, headPosition, tailPosition, right);
|
||||
if (train.isAtpOn()) {
|
||||
this.newATPService.speedProtect(simulation, train);
|
||||
this.ATPService.speedProtect(simulation, train);
|
||||
}
|
||||
if (train.isEB()) {
|
||||
return;
|
||||
@ -168,11 +168,11 @@ public class ATPLogicLoop {
|
||||
}
|
||||
|
||||
// 列车ATO自动驾驶逻辑运行
|
||||
this.newATOService.ATO(train);
|
||||
this.ATOService.ATO(train);
|
||||
}
|
||||
|
||||
private void checkParkingAndSend2Ats(Simulation simulation, VirtualRealityTrain train) {
|
||||
if (!train.isParkingAt() && this.newATPService.isStopOnTargetPosition(train)) {
|
||||
if (!train.isParkingAt() && this.ATPService.isStopOnTargetPosition(train)) {
|
||||
String stationName = null;
|
||||
if (train.getNextStation() != null) {
|
||||
stationName = train.getNextStation().getName();
|
||||
@ -197,7 +197,7 @@ public class ATPLogicLoop {
|
||||
if (train.isJump()) { // 列车跳停,跳过开门
|
||||
train.earlyDeparture();
|
||||
} else {
|
||||
this.newATOService.syncOpenDoor(simulation, train);
|
||||
this.ATOService.syncOpenDoor(simulation, train);
|
||||
if (this.isAllDoorOpen(simulation, train)) {
|
||||
train.nextParkedTrainActivity();
|
||||
}
|
||||
@ -218,7 +218,7 @@ public class ATPLogicLoop {
|
||||
if ((Objects.nonNull(signal) && signal.isNormalOpen()) ||
|
||||
(train.isRMMode() || train.isNRMMode())) { // 进路信号机正常开放 或 列车为RM/NRM
|
||||
// 可以关门
|
||||
this.newATOService.syncCloseDoor(simulation, train);
|
||||
this.ATOService.syncCloseDoor(simulation, train);
|
||||
if (this.isAllDoorClose(simulation, train)) {
|
||||
train.nextParkedTrainActivity();
|
||||
}
|
||||
@ -346,7 +346,7 @@ public class ATPLogicLoop {
|
||||
if (train.isParking()) {
|
||||
train.setParking(false);
|
||||
}
|
||||
this.newATPService.speedProtect(simulation, train);
|
||||
this.ATPService.speedProtect(simulation, train);
|
||||
if (train.isEB()) {
|
||||
return;
|
||||
}
|
||||
@ -364,7 +364,7 @@ public class ATPLogicLoop {
|
||||
Float distance = CalculateService.calculateDistance(headPosition, train.getMa().getEnd().getEndPosition(), right);
|
||||
if (distance != null) {
|
||||
if (distance > 100) {
|
||||
newATPService.cancelSignalEB(train);
|
||||
ATPService.cancelSignalEB(train);
|
||||
applicationContext.publishEvent(new SimulationATPAutoCancelEBEvent(this, simulation, train));
|
||||
log.info(String.format("列车[%s]移动授权距离超过200m,EB自动缓解", train.getGroupNumber()));
|
||||
}
|
||||
@ -375,7 +375,7 @@ public class ATPLogicLoop {
|
||||
// 列车已经停车
|
||||
if (!train.isBreaking()) {
|
||||
// 施加常规制动,防止倒溜
|
||||
this.newATOService.openBreaking(train);
|
||||
this.ATOService.openBreaking(train);
|
||||
}
|
||||
if (!train.isParking()) {
|
||||
// 检查列车是否站台停靠
|
||||
@ -395,7 +395,7 @@ public class ATPLogicLoop {
|
||||
// log.debug(String.format("列车[%s]发车条件不满足", train.getGroupNumber()));
|
||||
return;
|
||||
} else {
|
||||
this.newATOService.closeBreaking(train);
|
||||
this.ATOService.closeBreaking(train);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -411,7 +411,7 @@ public class ATPLogicLoop {
|
||||
if (train.isParking()) {
|
||||
train.setParking(false);
|
||||
}
|
||||
this.newATPService.speedProtect(simulation, train);
|
||||
this.ATPService.speedProtect(simulation, train);
|
||||
if (train.isEB()) {
|
||||
return;
|
||||
}
|
||||
@ -485,7 +485,7 @@ public class ATPLogicLoop {
|
||||
// 检查列车是否在转换轨
|
||||
this.checkOnTransferAndSend2Ats(simulation, train, headPosition, tailPosition);
|
||||
// 列车ATO自动驾驶逻辑运行
|
||||
this.newATOService.ATO(train);
|
||||
this.ATOService.ATO(train);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -584,11 +584,11 @@ public class ATPLogicLoop {
|
||||
if (train.isDoorClosing()) {
|
||||
return;
|
||||
}
|
||||
this.newATOService.syncCloseDoor(simulation, train);
|
||||
this.ATOService.syncCloseDoor(simulation, train);
|
||||
}
|
||||
|
||||
private void checkTrainStationParkingAndSend2Ats(Simulation simulation, VirtualRealityTrain train) {
|
||||
if (!train.isParking() && this.newATPService.isStopOnTargetPosition(train)) {
|
||||
if (!train.isParking() && this.ATPService.isStopOnTargetPosition(train)) {
|
||||
String stationName = null;
|
||||
if (train.getNextStation() != null) {
|
||||
stationName = train.getNextStation().getName();
|
||||
|
@ -10,7 +10,7 @@ import club.joylink.rtss.simulation.cbtc.data.support.MovementAuthority;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||
import club.joylink.rtss.simulation.cbtc.onboard.ATO.SpeedCurve;
|
||||
import club.joylink.rtss.simulation.cbtc.onboard.ATO.service.NewATOService;
|
||||
import club.joylink.rtss.simulation.cbtc.onboard.ATO.service.ATOService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -22,10 +22,10 @@ import java.util.Objects;
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class NewATPService {
|
||||
public class ATPService {
|
||||
|
||||
@Autowired
|
||||
private NewATOService newATOService;
|
||||
private ATOService ATOService;
|
||||
|
||||
/**
|
||||
* 更新列车移动授权
|
||||
@ -171,7 +171,7 @@ public class NewATPService {
|
||||
* 触发电路紧急停车
|
||||
*/
|
||||
public void triggerCircuitEB(VirtualRealityTrain train) {
|
||||
newATOService.closeATO(train);
|
||||
ATOService.closeATO(train);
|
||||
train.setCircuitEB(true);
|
||||
train.emergencyBreak();
|
||||
}
|
||||
@ -195,7 +195,7 @@ public class NewATPService {
|
||||
*/
|
||||
public void cutOffAtp(VirtualRealityTrain train) {
|
||||
if (train.isAtoOn()) {
|
||||
newATOService.closeATO(train);
|
||||
ATOService.closeATO(train);
|
||||
}
|
||||
train.setAtpOn(false);
|
||||
if (!DriveMode.NRM.equals(train.getDriveMode())) {
|
@ -11,7 +11,7 @@ import club.joylink.rtss.simulation.cbtc.data.plan.TripPlan;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.MovementAuthority;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.RoutePath;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||
import club.joylink.rtss.simulation.cbtc.onboard.ATO.service.NewATOService;
|
||||
import club.joylink.rtss.simulation.cbtc.onboard.ATO.service.ATOService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -25,10 +25,10 @@ import java.util.Objects;
|
||||
public class OnboardAtpApiServiceImpl implements OnboardAtpApiService {
|
||||
|
||||
@Autowired
|
||||
private NewATPService newATPService;
|
||||
private ATPService ATPService;
|
||||
|
||||
@Autowired
|
||||
private NewATOService newATOService;
|
||||
private ATOService ATOService;
|
||||
|
||||
@Override
|
||||
public void updateMA4CBTC(VirtualRealityTrain train, MovementAuthority ma) {
|
||||
@ -39,7 +39,7 @@ public class OnboardAtpApiServiceImpl implements OnboardAtpApiService {
|
||||
return;
|
||||
}
|
||||
if (train.isCBTC()) {
|
||||
this.newATPService.updateMA(train, ma);
|
||||
this.ATPService.updateMA(train, ma);
|
||||
}
|
||||
train.setCbtcMaMissDuration(0);
|
||||
}
|
||||
@ -50,7 +50,7 @@ public class OnboardAtpApiServiceImpl implements OnboardAtpApiService {
|
||||
return;
|
||||
}
|
||||
if (!train.isCBTC()) {
|
||||
this.newATPService.updateMA(train, ma);
|
||||
this.ATPService.updateMA(train, ma);
|
||||
train.setItcMaMissDuration(0);
|
||||
}
|
||||
}
|
||||
@ -82,7 +82,7 @@ public class OnboardAtpApiServiceImpl implements OnboardAtpApiService {
|
||||
train.getGroupNumber(), parkTime));
|
||||
if (parkTime > 0) {
|
||||
// 开屏蔽门
|
||||
this.newATOService.syncOpenDoor(simulation, train);
|
||||
this.ATOService.syncOpenDoor(simulation, train);
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ public class OnboardAtpApiServiceImpl implements OnboardAtpApiService {
|
||||
} else if (CalculateService.isTargetSectionOnDirectionExist(headSection, !right, targetSection)) {
|
||||
if (train.isAtoOn()) { //如果开启了ato
|
||||
// 如果反向,调头
|
||||
this.newATPService.turnDirectionStart(train);
|
||||
this.ATPService.turnDirectionStart(train);
|
||||
}
|
||||
} else {
|
||||
log.debug(String.format("列车[%s]无法到达目标轨道,根据路径判断是否调头", train.getGroupNumber()));
|
||||
@ -217,7 +217,7 @@ public class OnboardAtpApiServiceImpl implements OnboardAtpApiService {
|
||||
boolean pathRight = routePaths.get(0).isRight();
|
||||
if (!Objects.equals(right, pathRight) && train.isAtoOn()) {
|
||||
// 和计划方向不同并且开启了ATO,调头
|
||||
this.newATPService.turnDirectionStart(train);
|
||||
this.ATPService.turnDirectionStart(train);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import club.joylink.rtss.simulation.cbtc.event.SimulationConversationChatEvent;
|
||||
import club.joylink.rtss.simulation.cbtc.event.SimulationConversationExitEvent;
|
||||
import club.joylink.rtss.simulation.cbtc.event.SimulationOperationMessageEvent;
|
||||
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
||||
import club.joylink.rtss.simulation.cbtc.onboard.ATO.service.NewATOService;
|
||||
import club.joylink.rtss.simulation.cbtc.onboard.ATO.service.ATOService;
|
||||
import club.joylink.rtss.services.IVoiceService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -41,7 +41,7 @@ public class RobotListenerHandler {
|
||||
private ConversationManagerService conversationManagerService;
|
||||
|
||||
@Autowired
|
||||
private NewATOService newATOService;
|
||||
private ATOService ATOService;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("baiDuVoiceService")
|
||||
|
@ -31,7 +31,7 @@ public class ReleaseReviewQueryVO extends PageQueryVO {
|
||||
/**
|
||||
* 地图id
|
||||
*/
|
||||
private String mapId;
|
||||
private Long mapId;
|
||||
/**
|
||||
* 驳回原因
|
||||
*/
|
||||
|
@ -1,208 +0,0 @@
|
||||
package club.joylink.rtss.vo.client.script;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import club.joylink.rtss.simulation.cbtc.member.SimulationMemberPO;
|
||||
import club.joylink.rtss.simulation.cbtc.script.ScriptActionPO;
|
||||
import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
|
||||
import club.joylink.rtss.entity.Script;
|
||||
import club.joylink.rtss.entity.ScriptDraft;
|
||||
import club.joylink.rtss.entity.ScriptDraftWithBLOBs;
|
||||
import club.joylink.rtss.entity.ScriptWithBLOBs;
|
||||
import club.joylink.rtss.util.ConvertUtil;
|
||||
import club.joylink.rtss.util.JsonUtils;
|
||||
import club.joylink.rtss.vo.client.simulationv1.SimulationMemberVO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class ScriptNewVO {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 所属地图id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@ApiModelProperty(value = "所属地图id")
|
||||
private Long mapId;
|
||||
|
||||
/**
|
||||
* 剧本名称
|
||||
*/
|
||||
@ApiModelProperty(value = "剧本名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 语言类型
|
||||
*/
|
||||
private String lang;
|
||||
|
||||
/**
|
||||
* 剧本描述
|
||||
*/
|
||||
@ApiModelProperty(value = "剧本描述")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 地图定位
|
||||
*/
|
||||
private MapLocationVO mapLocation;
|
||||
|
||||
/**
|
||||
* 剧本场景
|
||||
*/
|
||||
private String bgScenesJson;
|
||||
|
||||
/**
|
||||
* 剧本编制最终场景(用于剧本编制可以从上次编制到的地方继续)
|
||||
*/
|
||||
private String finalScenesJson;
|
||||
|
||||
@ApiModelProperty(value = "背景场景是否已经设置")
|
||||
private boolean bgSet;
|
||||
|
||||
/**
|
||||
* 剧本成员列表
|
||||
*/
|
||||
private List<SimulationMemberVO> memberList;
|
||||
|
||||
/**
|
||||
* 剧本演出成员列表
|
||||
*/
|
||||
private List<SimulationMemberVO> playerList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 剧本动作
|
||||
*/
|
||||
private List<ScriptActionNewVO> actionList = new ArrayList<>();
|
||||
|
||||
private Integer fullMarksDuration;
|
||||
|
||||
private Integer passingGradeDuration;
|
||||
|
||||
private Integer zeroDuration;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@ApiModelProperty(value = "状态")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
private String creatorId;
|
||||
|
||||
private String creatorName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private String explanation;
|
||||
|
||||
/**
|
||||
* 上传发布审核时间
|
||||
*/
|
||||
private LocalDateTime uploadTime;
|
||||
|
||||
public ScriptNewVO(ScriptBO script) {
|
||||
this.id = script.getId();
|
||||
this.mapId = script.getMapId();
|
||||
this.name = script.getName();
|
||||
this.lang = script.getLang();
|
||||
this.description = script.getDescription();
|
||||
this.mapLocation = script.getMapLocation();
|
||||
this.bgSet = Objects.nonNull(script.getBgScenesJson());
|
||||
this.memberList = SimulationMemberVO.convert2VOList(script.getMemberList());
|
||||
this.actionList = ScriptActionNewVO.convertFromBOList(script.getActionList());
|
||||
this.fullMarksDuration = script.getFullMarksDuration();
|
||||
this.passingGradeDuration = script.getPassingGradeDuration();
|
||||
this.zeroDuration = script.getZeroDuration();
|
||||
this.status = script.getStatus();
|
||||
this.creatorId = script.getCreatorId();
|
||||
this.creatorName = script.getCreatorName();
|
||||
this.createTime = script.getCreateTime();
|
||||
this.explanation = script.getExplanation();
|
||||
this.uploadTime = script.getUploadTime();
|
||||
}
|
||||
|
||||
public ScriptNewVO(ScriptDraft script) {
|
||||
this.id = script.getId();
|
||||
this.mapId = script.getMapId();
|
||||
this.name = script.getName();
|
||||
this.lang = script.getLang();
|
||||
this.description = script.getDescription();
|
||||
if (!org.springframework.util.StringUtils.isEmpty(script.getMapLocationJson())) {
|
||||
this.mapLocation = JsonUtils.read(script.getMapLocationJson(), MapLocationVO.class);
|
||||
}
|
||||
this.fullMarksDuration = script.getFullMarksDuration();
|
||||
this.passingGradeDuration = script.getPassingGradeDuration();
|
||||
this.zeroDuration = script.getZeroDuration();
|
||||
this.status = script.getStatus();
|
||||
this.creatorId = ConvertUtil.long2Str(script.getCreatorId());
|
||||
this.createTime = script.getCreateTime();
|
||||
this.uploadTime = script.getCreateTime();
|
||||
}
|
||||
|
||||
public ScriptNewVO(ScriptDraftWithBLOBs script) {
|
||||
this((ScriptDraft) script);
|
||||
|
||||
}
|
||||
|
||||
public ScriptNewVO(Script script) {
|
||||
this.id = script.getId();
|
||||
this.mapId = script.getMapId();
|
||||
this.name = script.getName();
|
||||
this.lang = script.getLang();
|
||||
this.description = script.getDescription();
|
||||
if (!org.springframework.util.StringUtils.isEmpty(script.getMapLocationJson())) {
|
||||
this.mapLocation = JsonUtils.read(script.getMapLocationJson(), MapLocationVO.class);
|
||||
}
|
||||
this.fullMarksDuration = script.getFullMarksDuration();
|
||||
this.passingGradeDuration = script.getPassingGradeDuration();
|
||||
this.zeroDuration = script.getZeroDuration();
|
||||
this.status = script.getStatus();
|
||||
this.creatorId = ConvertUtil.long2Str(script.getCreatorId());
|
||||
this.createTime = script.getCreateTime();
|
||||
this.uploadTime = script.getCreateTime();
|
||||
}
|
||||
|
||||
public ScriptNewVO(ScriptWithBLOBs script) {
|
||||
this((Script) script);
|
||||
if (StringUtils.hasText(script.getMapLocationJson())) {
|
||||
this.mapLocation = JsonUtils.read(script.getMapLocationJson(), MapLocationVO.class);
|
||||
}
|
||||
if (StringUtils.hasText(script.getMembersJson())) {
|
||||
List<SimulationMemberPO> simulationMemberPOList =
|
||||
JsonUtils.read(script.getMembersJson(), JsonUtils.getCollectionType(ArrayList.class, SimulationMemberPO.class));
|
||||
this.memberList = SimulationMemberVO.convertFromPOList(simulationMemberPOList);
|
||||
}
|
||||
if (Objects.nonNull(script.getActionsJson())) {
|
||||
List<ScriptActionPO> actionPOList = JsonUtils.read(script.getActionsJson(), JsonUtils.getCollectionType(ArrayList.class, ScriptActionPO.class));
|
||||
this.actionList = ScriptActionNewVO.convertFromPOList(actionPOList);
|
||||
}
|
||||
this.bgScenesJson = script.getBgScenesJson();
|
||||
this.finalScenesJson = script.getFinalScenesJson();
|
||||
this.bgSet = Objects.nonNull(script.getBgScenesJson());
|
||||
}
|
||||
|
||||
public static List<ScriptNewVO> convertFromPOList(List<Script> scripts) {
|
||||
return scripts.stream().map(ScriptNewVO::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
@ -1,39 +1,31 @@
|
||||
package club.joylink.rtss.vo.client.script;
|
||||
|
||||
import club.joylink.rtss.constants.BusinessConsts;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import club.joylink.rtss.simulation.cbtc.member.SimulationMemberPO;
|
||||
import club.joylink.rtss.simulation.cbtc.script.ScriptActionPO;
|
||||
import club.joylink.rtss.simulation.cbtc.script.ScriptBO;
|
||||
import club.joylink.rtss.entity.Script;
|
||||
import club.joylink.rtss.entity.ScriptDraft;
|
||||
import club.joylink.rtss.entity.ScriptDraftWithBLOBs;
|
||||
import club.joylink.rtss.entity.ScriptWithBLOBs;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.util.JsonUtils;
|
||||
import club.joylink.rtss.vo.client.validGroup.ScriptCreateCheck;
|
||||
import club.joylink.rtss.vo.client.validGroup.ScriptUpdateCheck;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import club.joylink.rtss.vo.client.simulationv1.SimulationMemberVO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@ApiModel(value = "仿真剧本")
|
||||
public class ScriptVO {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@ -44,27 +36,23 @@ public class ScriptVO {
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@ApiModelProperty(value = "所属地图id")
|
||||
@NotNull(groups = {ScriptCreateCheck.class})
|
||||
private Long mapId;
|
||||
|
||||
/**
|
||||
* 剧本名称
|
||||
*/
|
||||
@ApiModelProperty(value = "剧本名称")
|
||||
@NotBlank(groups = {ScriptCreateCheck.class, ScriptUpdateCheck.class})
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 语言类型
|
||||
*/
|
||||
@NotBlank(groups = {ScriptCreateCheck.class})
|
||||
private String lang;
|
||||
|
||||
/**
|
||||
* 剧本描述
|
||||
*/
|
||||
@ApiModelProperty(value = "剧本描述")
|
||||
@NotBlank(groups = {ScriptCreateCheck.class, ScriptUpdateCheck.class})
|
||||
private String description;
|
||||
|
||||
/**
|
||||
@ -88,17 +76,23 @@ public class ScriptVO {
|
||||
/**
|
||||
* 剧本成员列表
|
||||
*/
|
||||
private List<ScriptMemberVO> memberVOList;
|
||||
private List<SimulationMemberVO> memberList;
|
||||
|
||||
/**
|
||||
* 剧本演出成员列表
|
||||
*/
|
||||
private List<ScriptMemberVO> playerVOList;
|
||||
private List<SimulationMemberVO> playerList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 剧本内容
|
||||
* 剧本动作
|
||||
*/
|
||||
private List<ScriptActionVO> actionVOList;
|
||||
private List<ScriptActionNewVO> actionList = new ArrayList<>();
|
||||
|
||||
private Integer fullMarksDuration;
|
||||
|
||||
private Integer passingGradeDuration;
|
||||
|
||||
private Integer zeroDuration;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
@ -126,39 +120,45 @@ public class ScriptVO {
|
||||
*/
|
||||
private LocalDateTime uploadTime;
|
||||
|
||||
public ScriptVO(ScriptBO script) {
|
||||
this.id = script.getId();
|
||||
this.mapId = script.getMapId();
|
||||
this.name = script.getName();
|
||||
this.lang = script.getLang();
|
||||
this.description = script.getDescription();
|
||||
this.mapLocation = script.getMapLocation();
|
||||
this.bgSet = Objects.nonNull(script.getBgScenesJson());
|
||||
this.memberList = SimulationMemberVO.convert2VOList(script.getMemberList());
|
||||
this.actionList = ScriptActionNewVO.convertFromBOList(script.getActionList());
|
||||
this.fullMarksDuration = script.getFullMarksDuration();
|
||||
this.passingGradeDuration = script.getPassingGradeDuration();
|
||||
this.zeroDuration = script.getZeroDuration();
|
||||
this.status = script.getStatus();
|
||||
this.creatorId = script.getCreatorId();
|
||||
this.creatorName = script.getCreatorName();
|
||||
this.createTime = script.getCreateTime();
|
||||
this.explanation = script.getExplanation();
|
||||
this.uploadTime = script.getUploadTime();
|
||||
}
|
||||
|
||||
public ScriptVO(ScriptDraft script) {
|
||||
this.id = script.getId();
|
||||
this.mapId = script.getMapId();
|
||||
this.name = script.getName();
|
||||
this.lang = script.getLang();
|
||||
this.description = script.getDescription();
|
||||
this.fullMarksDuration = script.getFullMarksDuration();
|
||||
this.passingGradeDuration = script.getPassingGradeDuration();
|
||||
this.zeroDuration = script.getZeroDuration();
|
||||
this.status = script.getStatus();
|
||||
this.creatorId = script.getCreatorId();
|
||||
this.createTime = script.getCreateTime();
|
||||
this.uploadTime = script.getCreateTime();
|
||||
if (!StringUtils.isEmpty(script.getExplanation())) {
|
||||
this.explanation = script.getExplanation();
|
||||
}
|
||||
}
|
||||
|
||||
public ScriptVO(ScriptDraftWithBLOBs script) {
|
||||
// 基础数据
|
||||
this((ScriptDraft) script);
|
||||
// 剧本内容数据
|
||||
if (!StringUtils.isEmpty(script.getMapLocationJson())) {
|
||||
this.mapLocation = JsonUtils.read(script.getMapLocationJson(), MapLocationVO.class);
|
||||
}
|
||||
this.bgScenesJson = script.getBgScenesJson();
|
||||
this.finalScenesJson = script.getFinalScenesJson();
|
||||
if (!StringUtils.isEmpty(script.getMembersJson())) {
|
||||
this.memberVOList = JsonUtils.read(script.getMembersJson(), JsonUtils.getCollectionType(ArrayList.class, ScriptMemberVO.class));
|
||||
}
|
||||
if (!StringUtils.isEmpty(script.getPlayersJson())) {
|
||||
this.playerVOList = JsonUtils.read(script.getPlayersJson(), JsonUtils.getCollectionType(ArrayList.class, ScriptMemberVO.class));
|
||||
}
|
||||
if (!StringUtils.isEmpty(script.getActionsJson())) {
|
||||
this.actionVOList = JsonUtils.read(script.getActionsJson(), JsonUtils.getCollectionType(ArrayList.class, ScriptActionVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ScriptVO(Script script) {
|
||||
@ -167,122 +167,54 @@ public class ScriptVO {
|
||||
this.name = script.getName();
|
||||
this.lang = script.getLang();
|
||||
this.description = script.getDescription();
|
||||
if (!org.springframework.util.StringUtils.isEmpty(script.getMapLocationJson())) {
|
||||
this.mapLocation = JsonUtils.read(script.getMapLocationJson(), MapLocationVO.class);
|
||||
}
|
||||
this.fullMarksDuration = script.getFullMarksDuration();
|
||||
this.passingGradeDuration = script.getPassingGradeDuration();
|
||||
this.zeroDuration = script.getZeroDuration();
|
||||
this.status = script.getStatus();
|
||||
this.creatorId = script.getCreatorId();
|
||||
this.createTime = script.getCreateTime();
|
||||
this.uploadTime = script.getCreateTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* 正式发布的剧本转换
|
||||
*
|
||||
* @param script
|
||||
*/
|
||||
public ScriptVO(ScriptWithBLOBs script) {
|
||||
// 基础数据
|
||||
this((Script) script);
|
||||
// 剧本内容数据
|
||||
if (!StringUtils.isEmpty(script.getMapLocationJson())) {
|
||||
if (StringUtils.hasText(script.getMapLocationJson())) {
|
||||
this.mapLocation = JsonUtils.read(script.getMapLocationJson(), MapLocationVO.class);
|
||||
}
|
||||
if (StringUtils.hasText(script.getMembersJson())) {
|
||||
List<SimulationMemberPO> simulationMemberPOList =
|
||||
JsonUtils.read(script.getMembersJson(), JsonUtils.getCollectionType(ArrayList.class, SimulationMemberPO.class));
|
||||
this.memberList = SimulationMemberVO.convertFromPOList(simulationMemberPOList);
|
||||
}
|
||||
if (Objects.nonNull(script.getActionsJson())) {
|
||||
List<ScriptActionPO> actionPOList = JsonUtils.read(script.getActionsJson(), JsonUtils.getCollectionType(ArrayList.class, ScriptActionPO.class));
|
||||
this.actionList = ScriptActionNewVO.convertFromPOList(actionPOList);
|
||||
}
|
||||
this.bgScenesJson = script.getBgScenesJson();
|
||||
this.finalScenesJson = script.getFinalScenesJson();
|
||||
if (!StringUtils.isEmpty(script.getMembersJson())) {
|
||||
this.memberVOList = JsonUtils.read(script.getMembersJson(), JsonUtils.getCollectionType(ArrayList.class, ScriptMemberVO.class));
|
||||
}
|
||||
if (!StringUtils.isEmpty(script.getPlayersJson())) {
|
||||
this.playerVOList = JsonUtils.read(script.getPlayersJson(), JsonUtils.getCollectionType(ArrayList.class, ScriptMemberVO.class));
|
||||
}
|
||||
if (!StringUtils.isEmpty(script.getActionsJson())) {
|
||||
this.actionVOList = JsonUtils.read(script.getActionsJson(), JsonUtils.getCollectionType(ArrayList.class, ScriptActionVO.class));
|
||||
}
|
||||
this.bgSet = Objects.nonNull(script.getBgScenesJson());
|
||||
}
|
||||
|
||||
public static List<ScriptVO> convertDraft2VOList(List<ScriptDraft> dbList) {
|
||||
List<ScriptVO> voList = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(dbList)) {
|
||||
dbList.forEach(script -> voList.add(new ScriptVO(script)));
|
||||
}
|
||||
return voList;
|
||||
public static List<ScriptVO> convertFromPOList(List<Script> scripts) {
|
||||
return scripts.stream().map(ScriptVO::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static List<ScriptVO> convert2VOList(List<Script> dbList) {
|
||||
List<ScriptVO> voList = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(dbList)) {
|
||||
dbList.forEach(script -> voList.add(new ScriptVO(script)));
|
||||
}
|
||||
return voList;
|
||||
}
|
||||
|
||||
public ScriptDraftWithBLOBs convert2Draft() {
|
||||
ScriptDraftWithBLOBs script = new ScriptDraftWithBLOBs();
|
||||
script.setId(getId());
|
||||
script.setMapId(getMapId());
|
||||
script.setName(getName());
|
||||
script.setLang(getLang());
|
||||
script.setDescription(getDescription());
|
||||
return script;
|
||||
}
|
||||
|
||||
public ScriptWithBLOBs convert2DB() {
|
||||
ScriptWithBLOBs scriptPostWithBLOBs = new ScriptWithBLOBs();
|
||||
scriptPostWithBLOBs.setMapId(getMapId());
|
||||
scriptPostWithBLOBs.setName(getName());
|
||||
scriptPostWithBLOBs.setLang(getLang());
|
||||
scriptPostWithBLOBs.setDescription(getDescription());
|
||||
scriptPostWithBLOBs.setMapLocationJson(getMapLocationJson());
|
||||
scriptPostWithBLOBs.setBgScenesJson(getBgScenesJson());
|
||||
scriptPostWithBLOBs.setFinalScenesJson(getFinalScenesJson());
|
||||
scriptPostWithBLOBs.setMembersJson(getMembersJson());
|
||||
scriptPostWithBLOBs.setPlayersJson(getPlayersJson());
|
||||
scriptPostWithBLOBs.setActionsJson(getActionsJson());
|
||||
scriptPostWithBLOBs.setStatus(BusinessConsts.STATUS_USE);
|
||||
scriptPostWithBLOBs.setCreateTime(LocalDateTime.now());
|
||||
return scriptPostWithBLOBs;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getMapLocationJson() {
|
||||
return Objects.nonNull(this.mapLocation) ? JsonUtils.writeValueAsString(this.mapLocation) : null;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getActionsJson() {
|
||||
return !CollectionUtils.isEmpty(this.actionVOList) ? JsonUtils.writeValueAsString(this.actionVOList) : null;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getMembersJson() {
|
||||
return !CollectionUtils.isEmpty(this.memberVOList) ? JsonUtils.writeValueAsString(this.memberVOList) : null;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String getPlayersJson() {
|
||||
return !CollectionUtils.isEmpty(this.playerVOList) ? JsonUtils.writeValueAsString(this.playerVOList) : null;
|
||||
public static List<ScriptVO> convertFromDraftList(List<ScriptDraft> scripts) {
|
||||
return scripts.stream().map(ScriptVO::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据客户端需要过滤数据
|
||||
* 转换为做创建草稿剧本用的的DB对象
|
||||
*/
|
||||
public void filterDetailForClient() {
|
||||
// 处理有剧情成员的信息
|
||||
List<ScriptMemberVO> memberVOList = this.getPlayerVOList();
|
||||
if (!CollectionUtils.isEmpty(memberVOList)) {
|
||||
List<ScriptActionVO> actionVOList = this.getActionVOList();
|
||||
if (!CollectionUtils.isEmpty(actionVOList)) {
|
||||
Map<String, ScriptMemberVO> memberVOMap =
|
||||
memberVOList.stream()
|
||||
.collect(Collectors.toMap(ScriptMemberVO::getId, Function.identity()));
|
||||
for (ScriptActionVO actionVO : actionVOList) {
|
||||
ScriptMemberVO member = memberVOMap.get(actionVO.getMemberId());
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertNotNull(member,
|
||||
"剧本数据异常:动作成员角色不存在");
|
||||
member.setHasPlay(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 删除不需要的数据
|
||||
this.setBgScenesJson(null);
|
||||
this.setFinalScenesJson(null);
|
||||
public ScriptDraftWithBLOBs convert2CreateDraft() {
|
||||
ScriptDraftWithBLOBs script = new ScriptDraftWithBLOBs();
|
||||
script.setMapId(mapId);
|
||||
script.setName(name);
|
||||
script.setLang(lang);
|
||||
script.setDescription(description);
|
||||
return script;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user