获取当前用户的某个实训草稿的所有信息

This commit is contained in:
xzb 2022-08-17 10:29:36 +08:00
parent 39549dd426
commit cc2e07d24a
3 changed files with 137 additions and 17 deletions

View File

@ -1,5 +1,6 @@
package club.joylink.rtss.controller.training2;
import club.joylink.rtss.vo.training2.draft.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
@ -11,16 +12,11 @@ import org.springframework.web.bind.annotation.RestController;
import club.joylink.rtss.services.training2.Training2DraftService;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.training2.Step2VO;
import club.joylink.rtss.vo.training2.draft.CreateTraining2ReqVo;
import club.joylink.rtss.vo.training2.draft.CreateTraining2RspVo;
import club.joylink.rtss.vo.training2.draft.DeleteTraining2ReqVo;
import club.joylink.rtss.vo.training2.draft.DeleteTraining2RspVo;
import club.joylink.rtss.vo.training2.draft.FindAllTraining2InfoRspVo;
import club.joylink.rtss.vo.training2.draft.UpdateDraftTraining2ReqVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.websocket.server.PathParam;
import java.util.List;
/**
@ -49,7 +45,7 @@ public class TrainingDraftV2Controller {
return this.training2DraftService.deleteTrainings(req,user);
}
/**
* 获取当前用户的所有实训草稿
* 获取当前用户的所有实训草稿基础信息
*/
@GetMapping("/all")
public FindAllTraining2InfoRspVo findAllTrainings(@RequestAttribute AccountVO user) {
@ -62,7 +58,13 @@ public class TrainingDraftV2Controller {
public void updateTraining(@RequestBody UpdateDraftTraining2ReqVo req,@RequestAttribute AccountVO user) {
this.training2DraftService.updateTraining(req, user.getId());
}
/**
* 获取当前用户的某个实训草稿的所有信息
*/
@GetMapping("/all/{trainingId}")
public DraftTraining2DetailRspVo findTrainingDetail(@PathVariable("trainingId") Long trainingDraftId,@RequestAttribute AccountVO user){
return this.training2DraftService.findTrainingDetail(trainingDraftId,user.getId());
}
/**
* 查询步骤列表
*/

View File

@ -10,13 +10,7 @@ import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import club.joylink.rtss.util.JsonUtils;
import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.client.training2.Step2VO;
import club.joylink.rtss.vo.training2.draft.CreateTraining2ReqVo;
import club.joylink.rtss.vo.training2.draft.CreateTraining2RspVo;
import club.joylink.rtss.vo.training2.draft.DeleteTraining2ReqVo;
import club.joylink.rtss.vo.training2.draft.DeleteTraining2RspVo;
import club.joylink.rtss.vo.training2.draft.DraftTraining2InfoVo;
import club.joylink.rtss.vo.training2.draft.FindAllTraining2InfoRspVo;
import club.joylink.rtss.vo.training2.draft.UpdateDraftTraining2ReqVo;
import club.joylink.rtss.vo.training2.draft.*;
import io.netty.util.internal.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -24,6 +18,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PathVariable;
import java.time.LocalDateTime;
import java.util.ArrayList;
@ -158,7 +153,40 @@ public class Training2DraftService {
//
this.trainingDao.updateByExampleSelective(b, example);
}
/**
* 获取实训草稿的详细信息
*/
@Transactional(readOnly = true)
public DraftTraining2DetailRspVo findTrainingDetail(Long trainingDraftId,Long userId){
DraftTraining2Example example = new DraftTraining2Example();
example.createCriteria().andCreatorIdEqualTo(userId).andIdEqualTo(trainingDraftId);
List<DraftTraining2WithBLOBs> bs = this.trainingDao.selectByExampleWithBLOBs(example);
if(null!=bs&&!bs.isEmpty()){
DraftTraining2WithBLOBs b = bs.get(0);
DraftTraining2DetailRspVo rsp = new DraftTraining2DetailRspVo();
rsp.setDescription(b.getDescription());
rsp.setFailureConditionJson(b.getFailureConditionJson());
rsp.setCreateTime(b.getCreateTime());
rsp.setCreatorId(b.getCreatorId());
rsp.setLabelJson(b.getLabelJson());
rsp.setMapId(b.getMapId());
rsp.setName(b.getName());
rsp.setId(b.getId());
rsp.setType(b.getType());
rsp.setBgSceneJson(b.getBgSceneJson());
rsp.setMemberJson(b.getMemberJson());
rsp.setOperaJson(b.getOperaJson());
rsp.setStepJson(b.getStepJson());
rsp.setUpdateTime(b.getUpdateTime());
rsp.setPlayerIdJson(b.getPlayerIdJson());
rsp.setMapLocationJson(b.getMapLocationJson());
rsp.setRunPlanId(b.getRunPlanId());
rsp.setScoringRuleJson(b.getScoringRuleJson());
return rsp;
}else{
return null;
}
}
/**
* 实训步骤列表
*/

View File

@ -0,0 +1,90 @@
package club.joylink.rtss.vo.training2.draft;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
@Getter
@Setter
public class DraftTraining2DetailRspVo {
private Long id;
private Long mapId;
/**
* 名称
*/
private String name;
/**
* 描述
*/
private String description;
/**
* 实训类型单操场景
*/
private String type;
/**
* 标签用于检索
*/
private String labelJson;
/**
* 地图定位json
*/
private String mapLocationJson;
/**
* 初始背景
*/
private String bgSceneJson;
/**
* 运行图id
*/
private Long runPlanId;
/**
* List<Operation2VO>的json
*/
private String operaJson;
/**
* List<Step2VO>的json
*/
private String stepJson;
/**
* List<ScoringRuleVO>的json
*/
private String scoringRuleJson;
// /**
// * 保存数据时的背景
// */
// private String saveSceneJson;
/**
* 仿真内所有成员
*/
private String memberJson;
/**
* 参演的仿真成员id列表Json
*/
private String playerIdJson;
/**
* 实训失败判定条件
*/
private String failureConditionJson;
private Long creatorId;
private LocalDateTime createTime;
private LocalDateTime updateTime;
}