Merge remote-tracking branch 'origin/test-training2' into test-training2
This commit is contained in:
commit
68726b9939
@ -75,6 +75,15 @@ public class SimulationTrainingV2Controller {
|
||||
return training2Service.completionClientStep(group, stepId, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户端步骤完成后操作回调
|
||||
*/
|
||||
@PutMapping("/{group}/completion/step/{stepId}/operation/{id}")
|
||||
public Integer completionClientStepOperation(@PathVariable String group, @PathVariable Integer stepId
|
||||
, @PathVariable Integer id, @RequestAttribute AccountVO user) {
|
||||
return training2Service.completionClientStepOperation(group, stepId, id, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制剧本
|
||||
*/
|
||||
|
@ -22,9 +22,10 @@ import java.util.List;
|
||||
@RequestMapping("/api/v2/draft/training")
|
||||
public class TrainingDraftV2Controller {
|
||||
@Autowired
|
||||
private Training2DraftService training2DraftService;
|
||||
private Training2DraftService training2DraftService;
|
||||
@Autowired
|
||||
private ExpConditionMaterialCollector collector;
|
||||
|
||||
/**
|
||||
* 创建实训草稿
|
||||
*/
|
||||
@ -33,71 +34,81 @@ public class TrainingDraftV2Controller {
|
||||
log.debug("==>>创建实训草稿: mapId = {} , name = {} type = {} des = {}", req.getMapId(), req.getName(), req.getType(), req.getDescription());
|
||||
return this.training2DraftService.createTraining(req, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除当前用户的实训草稿
|
||||
* 删除当前用户的实训草稿
|
||||
*/
|
||||
@DeleteMapping
|
||||
public DeleteTraining2RspVo deleteTrainings(@RequestBody DeleteTraining2ReqVo req,@RequestAttribute AccountVO user) {
|
||||
return this.training2DraftService.deleteTrainings(req,user);
|
||||
public DeleteTraining2RspVo deleteTrainings(@RequestBody DeleteTraining2ReqVo req, @RequestAttribute AccountVO user) {
|
||||
return this.training2DraftService.deleteTrainings(req, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页获取当前用户实训草稿基础信息
|
||||
*/
|
||||
@PostMapping("/info/page")
|
||||
public PageVO<DraftTraining2InfoVo> findTrainingsInfoByPage(@RequestBody DraftTraining2InfoPageReqVo req, @RequestAttribute AccountVO user){
|
||||
return this.training2DraftService.findTrainingsInfoByPage(req,user.getId());
|
||||
public PageVO<DraftTraining2InfoVo> findTrainingsInfoByPage(@RequestBody DraftTraining2InfoPageReqVo req, @RequestAttribute AccountVO user) {
|
||||
return this.training2DraftService.findTrainingsInfoByPage(req, user.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新当前用户的某个实训草稿(大字段信息)
|
||||
*/
|
||||
@PostMapping("/update/content")
|
||||
public void updateTraining(@RequestBody UpdateDraftTraining2BlobReqVo req,@RequestAttribute AccountVO user) {
|
||||
this.training2DraftService.updateTrainingBlob(req, user.getId());
|
||||
public void updateTraining(@RequestBody UpdateDraftTraining2BlobReqVo req, @RequestAttribute AccountVO user) {
|
||||
this.training2DraftService.updateTrainingBlob(req, user.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 单独更新当前用户的某个实训草稿的初始背景
|
||||
* <p>
|
||||
* 背景内容由后端自己生成
|
||||
*/
|
||||
@PostMapping("/update/content/backgroud")
|
||||
public void updateTrainingBackgroud(@RequestBody UpdateTraining2BackgroudReqVo req,@RequestAttribute AccountVO user){
|
||||
this.training2DraftService.updateTrainingBackgroud(req,user.getId());
|
||||
public void updateTrainingBackgroud(@RequestBody UpdateTraining2BackgroudReqVo req, @RequestAttribute AccountVO user) {
|
||||
this.training2DraftService.updateTrainingBackgroud(req, user.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 单独重置当前用户的某个实训草稿的初始背景
|
||||
*/
|
||||
@PostMapping("/reset/content/backgroud")
|
||||
public void resetTrainingBackgroud(@RequestBody ResetTraining2BackgroudReqVo req,@RequestAttribute AccountVO user){
|
||||
this.training2DraftService.resetTrainingBackgroud(req,user.getId());
|
||||
public void resetTrainingBackgroud(@RequestBody ResetTraining2BackgroudReqVo req, @RequestAttribute AccountVO user) {
|
||||
this.training2DraftService.resetTrainingBackgroud(req, user.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新当前用户实训草稿定位
|
||||
*/
|
||||
@PostMapping("/update/content/maplocation")
|
||||
public void updateTrainingMapLocation(@RequestBody UpdateTraining2MapLocationReqVo req,@RequestAttribute AccountVO user){
|
||||
this.training2DraftService.updateTrainingMapLocation(req,user.getId());
|
||||
public void updateTrainingMapLocation(@RequestBody UpdateTraining2MapLocationReqVo req, @RequestAttribute AccountVO user) {
|
||||
this.training2DraftService.updateTrainingMapLocation(req, user.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取实训表达式条件素材
|
||||
*/
|
||||
@GetMapping("/expression/materials")
|
||||
public List<ExpConditionMaterialSrcVo> findTrainingExpressionMaterials(){
|
||||
return collector.doCollect();
|
||||
public List<ExpConditionMaterialSrcVo> findTrainingExpressionMaterials() {
|
||||
return collector.doCollect();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新当前用户的某个实训草稿的基础信息
|
||||
*/
|
||||
@PostMapping("/update/info")
|
||||
public void updateTrainingInfo(@RequestBody UpdateDraftTraining2InfoReqVo req,@RequestAttribute AccountVO user){
|
||||
public void updateTrainingInfo(@RequestBody UpdateDraftTraining2InfoReqVo req, @RequestAttribute AccountVO user) {
|
||||
this.training2DraftService.updateTrainingInfo(req, user.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户的某个实训草稿的所有信息
|
||||
*/
|
||||
@GetMapping("/all/{trainingId}")
|
||||
public DraftTraining2DetailRspVo findTrainingDetail(@NotNull(message = "实训草稿id不能为空") @PathVariable("trainingId") Long trainingDraftId, @RequestAttribute AccountVO user){
|
||||
return this.training2DraftService.findTrainingDetail(trainingDraftId,user.getId());
|
||||
public DraftTraining2DetailRspVo findTrainingDetail(@NotNull(message = "实训草稿id不能为空") @PathVariable("trainingId") Long trainingDraftId, @RequestAttribute AccountVO user) {
|
||||
return this.training2DraftService.findTrainingDetail(trainingDraftId, user.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询步骤列表
|
||||
*/
|
||||
@ -109,9 +120,10 @@ public class TrainingDraftV2Controller {
|
||||
/**
|
||||
* 修改实训所有步骤
|
||||
*/
|
||||
@PutMapping("/{trainingId}/step/update")
|
||||
public void updateSteps(@PathVariable("trainingId") Long trainingId, @RequestBody List<Step2VO> step2VOList) {
|
||||
training2DraftService.updateSteps(trainingId, step2VOList);
|
||||
@PutMapping("/{group}/{trainingId}/step/update")
|
||||
public void updateSteps(@PathVariable("group") String group, @PathVariable("trainingId") Long trainingId
|
||||
, @RequestBody List<Step2VO> step2VOList) {
|
||||
training2DraftService.updateSteps(group, trainingId, step2VOList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,44 +1,42 @@
|
||||
package club.joylink.rtss.dao;
|
||||
|
||||
import club.joylink.rtss.entity.training2.DraftTraining2;
|
||||
import club.joylink.rtss.entity.training2.DraftTraining2Example;
|
||||
import club.joylink.rtss.entity.training2.DraftTraining2WithBLOBs;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface DraftTraining2DAO {
|
||||
long countByExample(DraftTraining2Example example);
|
||||
|
||||
int deleteByExample(DraftTraining2Example example);
|
||||
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
int insert(DraftTraining2WithBLOBs record);
|
||||
|
||||
int insertSelective(DraftTraining2WithBLOBs record);
|
||||
|
||||
List<DraftTraining2WithBLOBs> selectByExampleWithBLOBs(DraftTraining2Example example);
|
||||
|
||||
List<DraftTraining2> selectByExample(DraftTraining2Example example);
|
||||
|
||||
DraftTraining2WithBLOBs selectByPrimaryKey(Long id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") DraftTraining2WithBLOBs record, @Param("example") DraftTraining2Example example);
|
||||
|
||||
int updateByExampleWithBLOBs(@Param("record") DraftTraining2WithBLOBs record, @Param("example") DraftTraining2Example example);
|
||||
|
||||
int updateByExample(@Param("record") DraftTraining2 record, @Param("example") DraftTraining2Example example);
|
||||
|
||||
int updateByPrimaryKeySelective(DraftTraining2WithBLOBs record);
|
||||
|
||||
int updateByPrimaryKeyWithBLOBs(DraftTraining2WithBLOBs record);
|
||||
|
||||
int updateByPrimaryKey(DraftTraining2 record);
|
||||
|
||||
int updateStepJson(@Param("id") Long id, @Param("stepJson") String stepJson, @Param("playerIdJson") String playerIdJson);
|
||||
}
|
||||
package club.joylink.rtss.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import club.joylink.rtss.entity.training2.DraftTraining2;
|
||||
import club.joylink.rtss.entity.training2.DraftTraining2Example;
|
||||
import club.joylink.rtss.entity.training2.DraftTraining2WithBLOBs;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface DraftTraining2DAO {
|
||||
long countByExample(DraftTraining2Example example);
|
||||
|
||||
int deleteByExample(DraftTraining2Example example);
|
||||
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
int insert(DraftTraining2WithBLOBs record);
|
||||
|
||||
int insertSelective(DraftTraining2WithBLOBs record);
|
||||
|
||||
List<DraftTraining2WithBLOBs> selectByExampleWithBLOBs(DraftTraining2Example example);
|
||||
|
||||
List<DraftTraining2> selectByExample(DraftTraining2Example example);
|
||||
|
||||
DraftTraining2WithBLOBs selectByPrimaryKey(Long id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") DraftTraining2WithBLOBs record, @Param("example") DraftTraining2Example example);
|
||||
|
||||
int updateByExampleWithBLOBs(@Param("record") DraftTraining2WithBLOBs record, @Param("example") DraftTraining2Example example);
|
||||
|
||||
int updateByExample(@Param("record") DraftTraining2 record, @Param("example") DraftTraining2Example example);
|
||||
|
||||
int updateByPrimaryKeySelective(DraftTraining2WithBLOBs record);
|
||||
|
||||
int updateByPrimaryKeyWithBLOBs(DraftTraining2WithBLOBs record);
|
||||
|
||||
int updateByPrimaryKey(DraftTraining2 record);
|
||||
}
|
||||
|
@ -1,9 +1,10 @@
|
||||
package club.joylink.rtss.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import club.joylink.rtss.entity.training2.PublishedTraining2;
|
||||
import club.joylink.rtss.entity.training2.PublishedTraining2Example;
|
||||
import club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
@ -38,4 +39,4 @@ public interface PublishedTraining2DAO {
|
||||
int updateByPrimaryKeyWithBLOBs(PublishedTraining2WithBLOBs record);
|
||||
|
||||
int updateByPrimaryKey(PublishedTraining2 record);
|
||||
}
|
||||
}
|
||||
|
@ -1,59 +1,62 @@
|
||||
package club.joylink.rtss.entity.training2;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
public class DraftTraining2 implements Serializable {
|
||||
private Long id;
|
||||
|
||||
private Long mapId;
|
||||
|
||||
/**
|
||||
* 实训名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 实训类型(单操 single;场景scene)
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 标签,用于检索
|
||||
*/
|
||||
private String labelJson;
|
||||
|
||||
/**
|
||||
* 地图定位json
|
||||
*/
|
||||
private String mapLocationJson;
|
||||
|
||||
/**
|
||||
* 运行图id
|
||||
*/
|
||||
private Long runPlanId;
|
||||
|
||||
/**
|
||||
* 实训失败判定条件
|
||||
*/
|
||||
private String failureConditionJson;
|
||||
|
||||
private Long creatorId;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
package club.joylink.rtss.entity.training2;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
public class DraftTraining2 implements Serializable {
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 实训名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 实训地图id
|
||||
*/
|
||||
private Long mapId;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 实训类型(单操 single;场景scene)
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 标签,用于检索
|
||||
*/
|
||||
private String labelJson;
|
||||
|
||||
/**
|
||||
* 地图定位json
|
||||
*/
|
||||
private String mapLocationJson;
|
||||
|
||||
/**
|
||||
* 运行图id
|
||||
*/
|
||||
private Long runPlanId;
|
||||
|
||||
/**
|
||||
* 实训失败判定条件
|
||||
*/
|
||||
private String failureConditionJson;
|
||||
|
||||
private Long creatorId;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
package club.joylink.rtss.entity.training2;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class DraftTraining2All {
|
||||
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;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,43 +1,48 @@
|
||||
package club.joylink.rtss.entity.training2;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
public class DraftTraining2WithBLOBs extends DraftTraining2 implements Serializable {
|
||||
/**
|
||||
* 初始背景
|
||||
*/
|
||||
private String bgSceneJson;
|
||||
|
||||
/**
|
||||
* 操作列表json(List<Operation2VO>)
|
||||
*/
|
||||
private String operaJson;
|
||||
|
||||
/**
|
||||
* 步骤列表json(List<Step2VO>的json)
|
||||
*/
|
||||
private String stepJson;
|
||||
|
||||
/**
|
||||
* 打分规则列表json(List<ScoringRuleVO>的json)
|
||||
*/
|
||||
private String scoringRuleJson;
|
||||
|
||||
/**
|
||||
* 仿真内所有成员
|
||||
*/
|
||||
private String memberJson;
|
||||
|
||||
/**
|
||||
* 参演的仿真成员id列表Json
|
||||
*/
|
||||
private String playerIdJson;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
package club.joylink.rtss.entity.training2;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
public class DraftTraining2WithBLOBs extends DraftTraining2 implements Serializable {
|
||||
/**
|
||||
* 初始背景
|
||||
*/
|
||||
private String bgSceneJson;
|
||||
|
||||
/**
|
||||
* 实训编制完保存为最终场景json数据
|
||||
*/
|
||||
private String finalScenesJson;
|
||||
|
||||
/**
|
||||
* 操作列表json(List<Operation2VO>)
|
||||
*/
|
||||
private String operaJson;
|
||||
|
||||
/**
|
||||
* 步骤列表json(List<Step2VO>的json)
|
||||
*/
|
||||
private String stepJson;
|
||||
|
||||
/**
|
||||
* 打分规则列表json(List<ScoringRuleVO>的json)
|
||||
*/
|
||||
private String scoringRuleJson;
|
||||
|
||||
/**
|
||||
* 仿真内所有成员
|
||||
*/
|
||||
private String memberJson;
|
||||
|
||||
/**
|
||||
* 参演的仿真成员id列表Json
|
||||
*/
|
||||
private String playerIdJson;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -70,4 +70,4 @@ public class PublishedTraining2 implements Serializable {
|
||||
private Integer state;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
}
|
@ -39,5 +39,10 @@ public class PublishedTraining2WithBLOBs extends PublishedTraining2 implements S
|
||||
*/
|
||||
private String playerIdJson;
|
||||
|
||||
/**
|
||||
* 实训编制后的最终场景json数据
|
||||
*/
|
||||
private String finalScenesJson;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -33,6 +33,7 @@ public class Training2Convertor {
|
||||
//
|
||||
pub.setMemberJson(from.getMemberJson());
|
||||
pub.setBgSceneJson(from.getBgSceneJson());
|
||||
pub.setFinalScenesJson(from.getFinalScenesJson());
|
||||
pub.setOperaJson(from.getOperaJson());
|
||||
pub.setDescription(from.getDescription());
|
||||
pub.setCreateTime(LocalDateTime.now());
|
||||
|
@ -18,7 +18,7 @@ import java.util.List;
|
||||
@Slf4j
|
||||
public class Training2DraftPublishService {
|
||||
@Autowired
|
||||
private DraftTraining2DAO trainingDao;
|
||||
private DraftTraining2DAO trainingDao;
|
||||
@Autowired
|
||||
private PublishedTraining2DAO publishedDao;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package club.joylink.rtss.services.training2;
|
||||
|
||||
import club.joylink.rtss.dao.DraftTraining2DAO;
|
||||
import club.joylink.rtss.entity.TrainingWithBLOBs;
|
||||
import club.joylink.rtss.entity.training2.DraftTraining2;
|
||||
import club.joylink.rtss.entity.training2.DraftTraining2Example;
|
||||
import club.joylink.rtss.entity.training2.DraftTraining2WithBLOBs;
|
||||
@ -23,8 +22,6 @@ 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.RequestAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
@ -42,6 +39,7 @@ public class Training2DraftService {
|
||||
private DraftTraining2DAO trainingDao;
|
||||
@Autowired
|
||||
private GroupSimulationService roupSimulationService;
|
||||
|
||||
/**
|
||||
* 根据基本信息创建实训
|
||||
*
|
||||
@ -123,10 +121,11 @@ public class Training2DraftService {
|
||||
//
|
||||
this.trainingDao.updateByExampleSelective(b, example);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置用户实训草稿的初始背景
|
||||
*/
|
||||
public void resetTrainingBackgroud(ResetTraining2BackgroudReqVo req, Long userId){
|
||||
public void resetTrainingBackgroud(ResetTraining2BackgroudReqVo req, Long userId) {
|
||||
DraftTraining2Example example = new DraftTraining2Example();
|
||||
example.createCriteria().andCreatorIdEqualTo(userId).andIdEqualTo(req.getId());
|
||||
List<DraftTraining2> find = this.trainingDao.selectByExample(example);
|
||||
@ -138,6 +137,7 @@ public class Training2DraftService {
|
||||
//
|
||||
this.trainingDao.updateByExampleSelective(b, example);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户实训草稿的地图定位信息
|
||||
*/
|
||||
@ -155,6 +155,7 @@ public class Training2DraftService {
|
||||
//
|
||||
this.trainingDao.updateByExampleSelective(b, example);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新当前用户的实训草稿基础信息
|
||||
*/
|
||||
@ -256,7 +257,7 @@ public class Training2DraftService {
|
||||
//
|
||||
DraftTraining2Example example = new DraftTraining2Example();
|
||||
DraftTraining2Example.Criteria c = example.createCriteria().andCreatorIdEqualTo(userId);
|
||||
if(null!=req.getMapId()){
|
||||
if (null != req.getMapId()) {
|
||||
c.andMapIdEqualTo(req.getMapId());
|
||||
}
|
||||
//
|
||||
@ -315,11 +316,14 @@ public class Training2DraftService {
|
||||
/**
|
||||
* 修改实训所有步骤
|
||||
*/
|
||||
public void updateSteps(Long trainingId, List<Step2VO> step2VOList) {
|
||||
public void updateSteps(String group, Long trainingId, List<Step2VO> step2VOList) {
|
||||
DraftTraining2WithBLOBs draftTraining2 = trainingDao.selectByPrimaryKey(trainingId);
|
||||
if (draftTraining2 == null) {
|
||||
throw new SimulationException(SimulationExceptionType.Data_Not_Exist, "实训不存在");
|
||||
}
|
||||
// 保存当前背景
|
||||
Simulation simulation = this.roupSimulationService.getSimulationByGroup(group);
|
||||
StorageSimulation scenesSaving = new StorageSimulation(simulation, false);
|
||||
String stepJson;
|
||||
if (CollectionUtils.isEmpty(step2VOList)) {
|
||||
stepJson = StringUtil.EMPTY_STRING;
|
||||
@ -333,7 +337,12 @@ public class Training2DraftService {
|
||||
if (CollectionUtils.isEmpty(playerList)) {
|
||||
throw new SimulationException(SimulationExceptionType.Data_Not_Exist, "错误数据:无扮演者");
|
||||
}
|
||||
trainingDao.updateStepJson(trainingId, stepJson, JsonUtils.writeValueAsString(playerList));
|
||||
DraftTraining2WithBLOBs updateObj = new DraftTraining2WithBLOBs();
|
||||
updateObj.setId(trainingId);
|
||||
updateObj.setStepJson(stepJson);
|
||||
updateObj.setPlayerIdJson(JsonUtils.writeValueAsString(playerList));
|
||||
updateObj.setFinalScenesJson(JsonUtils.writeValueAsString(scenesSaving));
|
||||
trainingDao.updateByPrimaryKeySelective(updateObj);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -344,6 +353,11 @@ public class Training2DraftService {
|
||||
if (draftTraining2 == null) {
|
||||
throw new SimulationException(SimulationExceptionType.Data_Not_Exist, "实训不存在");
|
||||
}
|
||||
trainingDao.updateStepJson(trainingId, StringUtil.EMPTY_STRING, StringUtil.EMPTY_STRING);
|
||||
DraftTraining2WithBLOBs updateObj = new DraftTraining2WithBLOBs();
|
||||
updateObj.setId(trainingId);
|
||||
updateObj.setStepJson(StringUtil.EMPTY_STRING);
|
||||
updateObj.setPlayerIdJson(StringUtil.EMPTY_STRING);
|
||||
updateObj.setFinalScenesJson(StringUtil.EMPTY_STRING);
|
||||
trainingDao.updateByPrimaryKeySelective(updateObj);
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
@ -77,7 +76,7 @@ public class Training2PublishService {
|
||||
final PutOnPublishedTraining2RspVo rsp =new PutOnPublishedTraining2RspVo();
|
||||
rsp.setIds(new ArrayList<>());
|
||||
req.getIds().forEach(id->{
|
||||
PublishedTraining2WithBLOBs pub =new PublishedTraining2WithBLOBs();
|
||||
PublishedTraining2WithBLOBs pub =new PublishedTraining2WithBLOBs();
|
||||
pub.setId(Long.valueOf(id));
|
||||
pub.setState(PublishedTraining2StateEnum.PutOn.getState());
|
||||
pub.setUpdateTime(LocalDateTime.now());
|
||||
@ -198,6 +197,7 @@ public class Training2PublishService {
|
||||
rsp.setRunPlanId(b.getRunPlanId());
|
||||
rsp.setScoringRuleJson(b.getScoringRuleJson());
|
||||
rsp.setState(b.getState());
|
||||
rsp.setFinalScenesJson(b.getFinalScenesJson());
|
||||
//
|
||||
return rsp;
|
||||
}
|
||||
|
@ -77,6 +77,8 @@ public class Training2Service {
|
||||
.filter(s -> !s.isCompletion()).findFirst().orElse(null);
|
||||
if (step == null) { // 步骤已经运行完毕
|
||||
training2.finish();
|
||||
// 发送实训完成消息
|
||||
sendTrainingFinish(training2, simulation);
|
||||
return;
|
||||
}
|
||||
// 步骤触发
|
||||
@ -274,6 +276,14 @@ public class Training2Service {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成步骤中操作
|
||||
*/
|
||||
public Integer completionClientStepOperation(String group, Integer stepId
|
||||
, Integer id, AccountVO user) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Async("trainingV2Executor")
|
||||
@EventListener
|
||||
public void handle(SimulationOperationEvent event) {
|
||||
@ -355,6 +365,17 @@ public class Training2Service {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 实训完成发送消息
|
||||
*/
|
||||
public void sendTrainingFinish(Training2 training2, Simulation simulation) {
|
||||
if (training2.isFinish()) {
|
||||
SocketMessageVO<String> message =
|
||||
SocketMessageFactory.build(WebSocketMessageType.Simulation_Training_Finish, simulation.getId(), "实训完成");
|
||||
stompMessageService.sendToUser(simulation.getSimulationUserIds(), message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制草稿时加载实训背景
|
||||
* TODO 后续看根据需求是否加载到最后一步
|
||||
|
@ -98,15 +98,15 @@ public class Training2 {
|
||||
this.playerIds = JsonUtils.readCollection(draftTraining2.getPlayerIdJson(), List.class, String.class);
|
||||
}
|
||||
labels = JsonUtils.readCollection(draftTraining2.getLabelJson(), List.class, String.class);
|
||||
if (StringUtils.isEmpty(draftTraining2.getOperaJson())) {
|
||||
if (!StringUtils.isEmpty(draftTraining2.getOperaJson())) {
|
||||
List<Operation2VO> operation2VOS = JsonUtils.readCollection(draftTraining2.getOperaJson(), List.class, Operation2VO.class);
|
||||
operations = operation2VOS.stream().map(vo -> vo.convert2BO(simulation)).collect(Collectors.toList());
|
||||
}
|
||||
if (StringUtils.isEmpty(draftTraining2.getStepJson())) {
|
||||
if (!StringUtils.isEmpty(draftTraining2.getStepJson())) {
|
||||
List<Step2VO> step2VOS = JsonUtils.readCollection(draftTraining2.getStepJson(), List.class, Step2VO.class);
|
||||
steps = step2VOS.stream().map(vo -> new Step2(vo, simulation)).collect(Collectors.toList());
|
||||
}
|
||||
if (StringUtils.isEmpty(draftTraining2.getScoringRuleJson())) {
|
||||
if (!StringUtils.isEmpty(draftTraining2.getScoringRuleJson())) {
|
||||
List<ScoringRuleVO> scoringRuleVOS = JsonUtils.readCollection(draftTraining2.getScoringRuleJson(), List.class, ScoringRuleVO.class);
|
||||
scoringRules = scoringRuleVOS.stream().map(vo -> vo.convert2BO(simulation, this)).collect(Collectors.toList());
|
||||
}
|
||||
@ -165,6 +165,7 @@ public class Training2 {
|
||||
|
||||
/**
|
||||
* 打分
|
||||
*
|
||||
* @return k-memberId v-分数
|
||||
*/
|
||||
public Map<String, Float> mark() {
|
||||
|
@ -409,6 +409,11 @@ public enum WebSocketMessageType {
|
||||
* 操作完成提示信息
|
||||
*/
|
||||
Simulation_Training_Operate_Finish,
|
||||
|
||||
/**
|
||||
* 实训完成
|
||||
*/
|
||||
Simulation_Training_Finish
|
||||
/** ------------ 新实训消息 ----------- */
|
||||
;
|
||||
}
|
||||
|
@ -145,7 +145,8 @@ public class SocketMessageFactory {
|
||||
case Simulation_Training_Step_Tip:
|
||||
case Simulation_Training_Step_Finish:
|
||||
case Simulation_Training_Operate_Error:
|
||||
case Simulation_Training_Operate_Finish: {
|
||||
case Simulation_Training_Operate_Finish:
|
||||
case Simulation_Training_Finish: {
|
||||
topicList.add(String.format(WebSocketSubscribeTopic.AssistantSimulation, group));
|
||||
topicList.add(String.format(WebSocketSubscribeTopic.Simulation, group));
|
||||
topicList.add(String.format(WebSocketSubscribeTopic.Sandbox3D, group));
|
||||
|
@ -48,6 +48,11 @@ public class PublishedTraining2DetailRspVo {
|
||||
*/
|
||||
private String bgSceneJson;
|
||||
|
||||
/**
|
||||
* 实训编制后的最终场景json数据
|
||||
*/
|
||||
private String finalScenesJson;
|
||||
|
||||
/**
|
||||
* 运行图id
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user