From cc2e07d24aadc32a8f71431deed2242d68b9daf9 Mon Sep 17 00:00:00 2001 From: xzb <223@qq.com> Date: Wed, 17 Aug 2022 10:29:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=BD=93=E5=89=8D=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=9A=84=E6=9F=90=E4=B8=AA=E5=AE=9E=E8=AE=AD=E8=8D=89?= =?UTF-8?q?=E7=A8=BF=E7=9A=84=E6=89=80=E6=9C=89=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../training2/TrainingDraftV2Controller.java | 18 ++-- .../training2/Training2DraftService.java | 46 ++++++++-- .../draft/DraftTraining2DetailRspVo.java | 90 +++++++++++++++++++ 3 files changed, 137 insertions(+), 17 deletions(-) create mode 100644 src/main/java/club/joylink/rtss/vo/training2/draft/DraftTraining2DetailRspVo.java diff --git a/src/main/java/club/joylink/rtss/controller/training2/TrainingDraftV2Controller.java b/src/main/java/club/joylink/rtss/controller/training2/TrainingDraftV2Controller.java index f9a248132..ef69ad29f 100644 --- a/src/main/java/club/joylink/rtss/controller/training2/TrainingDraftV2Controller.java +++ b/src/main/java/club/joylink/rtss/controller/training2/TrainingDraftV2Controller.java @@ -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()); + } /** * 查询步骤列表 */ diff --git a/src/main/java/club/joylink/rtss/services/training2/Training2DraftService.java b/src/main/java/club/joylink/rtss/services/training2/Training2DraftService.java index 92e0cebf0..7912dede6 100644 --- a/src/main/java/club/joylink/rtss/services/training2/Training2DraftService.java +++ b/src/main/java/club/joylink/rtss/services/training2/Training2DraftService.java @@ -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; @@ -157,8 +152,41 @@ public class Training2DraftService { b.setPlayerIdJson(req.getPlayerIdJson()); // 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 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; + } + } /** * 实训步骤列表 */ diff --git a/src/main/java/club/joylink/rtss/vo/training2/draft/DraftTraining2DetailRspVo.java b/src/main/java/club/joylink/rtss/vo/training2/draft/DraftTraining2DetailRspVo.java new file mode 100644 index 000000000..bd4668358 --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/training2/draft/DraftTraining2DetailRspVo.java @@ -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的json + */ + private String operaJson; + + /** + * List的json + */ + private String stepJson; + + /** + * List的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; +}