Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
d77e70c126
|
@ -121,6 +121,8 @@ public enum ProjectDeviceType {
|
|||
|
||||
PIS_STAND,
|
||||
PIS_TRAIN,
|
||||
PIS,
|
||||
TMS,
|
||||
/* -----------client device end---------- */
|
||||
/* -----------Other start---------- */
|
||||
/**
|
||||
|
|
|
@ -6,17 +6,33 @@ import club.joylink.rtss.controller.advice.AuthenticateInterceptor;
|
|||
import club.joylink.rtss.controller.advice.Role;
|
||||
import club.joylink.rtss.entity.training2.ExportTraining2;
|
||||
import club.joylink.rtss.entity.training2.PublishedTraining2;
|
||||
import club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs;
|
||||
import club.joylink.rtss.services.training2.Training2DraftPublishService;
|
||||
import club.joylink.rtss.services.training2.Training2PublishService;
|
||||
import club.joylink.rtss.services.training2.Training2TypeEnum;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.training2.publish.*;
|
||||
import club.joylink.rtss.vo.training2.publish.DeletePublishedTraining2ReqVo;
|
||||
import club.joylink.rtss.vo.training2.publish.DeletePublishedTraining2RspVo;
|
||||
import club.joylink.rtss.vo.training2.publish.PublishedTraining2DetailRspVo;
|
||||
import club.joylink.rtss.vo.training2.publish.PublishedTraining2InfoPageReqVo;
|
||||
import club.joylink.rtss.vo.training2.publish.PublishedTraining2InfoRspVo;
|
||||
import club.joylink.rtss.vo.training2.publish.PublishedTrainingListRspVo;
|
||||
import club.joylink.rtss.vo.training2.publish.PullOffPublishedTraining2ReqVo;
|
||||
import club.joylink.rtss.vo.training2.publish.PullOffPublishedTraining2RspVo;
|
||||
import club.joylink.rtss.vo.training2.publish.PutOnPublishedTraining2ReqVo;
|
||||
import club.joylink.rtss.vo.training2.publish.PutOnPublishedTraining2RspVo;
|
||||
import java.util.List;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 已发布实训管理接口
|
||||
|
@ -25,123 +41,172 @@ import java.util.List;
|
|||
@RestController
|
||||
@RequestMapping("/api/v2/training/published")
|
||||
public class TrainingV2PublishController {
|
||||
@Autowired
|
||||
private Training2PublishService publishService;
|
||||
|
||||
/**
|
||||
* 已发布实训分页列表
|
||||
*/
|
||||
@PostMapping("/page")
|
||||
public PageVO<PublishedTraining2InfoRspVo> publishedTrainingsPage(@RequestBody PublishedTraining2InfoPageReqVo req){
|
||||
return this.publishService.publishedTrainingsPage(req);
|
||||
}
|
||||
/**
|
||||
* 已发布实训上架
|
||||
*/
|
||||
@PostMapping("/put/on")
|
||||
public PutOnPublishedTraining2RspVo putOnPublishedTrainings(@RequestBody PutOnPublishedTraining2ReqVo req,@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO){
|
||||
return this.publishService.putOnPublishedTrainings(req,userInfoVO);
|
||||
}
|
||||
/**
|
||||
* 已发布实训下架
|
||||
*/
|
||||
@PostMapping("/pull/off")
|
||||
public PullOffPublishedTraining2RspVo pullOffPublishedTrainings(@RequestBody PullOffPublishedTraining2ReqVo req,@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO){
|
||||
return this.publishService.pullOffPublishedTrainings(req,userInfoVO);
|
||||
}
|
||||
@Autowired
|
||||
private Training2PublishService publishService;
|
||||
|
||||
/**
|
||||
* 变更共享状态
|
||||
* @param id
|
||||
* @param shared
|
||||
* @param userInfoVO
|
||||
*/
|
||||
@GetMapping("/{id}/{shared}")
|
||||
public void changeSharedStatus(@PathVariable(name="id") Long id,@PathVariable(name="shared") Integer shared,@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO){
|
||||
this.publishService.changeSharedStatus(id,shared,userInfoVO);
|
||||
}
|
||||
/**
|
||||
* 删除已发布实训
|
||||
*/
|
||||
@DeleteMapping
|
||||
public DeletePublishedTraining2RspVo deletePublishedTrainings(@RequestBody DeletePublishedTraining2ReqVo req,@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO){
|
||||
return this.publishService.deletePublishedTrainings(req,userInfoVO);
|
||||
}
|
||||
@Autowired
|
||||
private Training2DraftPublishService training2DraftPublishService;
|
||||
|
||||
/**
|
||||
* 已发布实训分页列表
|
||||
*/
|
||||
@PostMapping("/page")
|
||||
public PageVO<PublishedTraining2InfoRspVo> publishedTrainingsPage(
|
||||
@RequestBody PublishedTraining2InfoPageReqVo req) {
|
||||
return this.publishService.publishedTrainingsPage(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 已发布实训上架
|
||||
*/
|
||||
@PostMapping("/put/on")
|
||||
public PutOnPublishedTraining2RspVo putOnPublishedTrainings(
|
||||
@RequestBody PutOnPublishedTraining2ReqVo req,
|
||||
@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
|
||||
return this.publishService.putOnPublishedTrainings(req, userInfoVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 已发布实训下架
|
||||
*/
|
||||
@PostMapping("/pull/off")
|
||||
public PullOffPublishedTraining2RspVo pullOffPublishedTrainings(
|
||||
@RequestBody PullOffPublishedTraining2ReqVo req,
|
||||
@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
|
||||
return this.publishService.pullOffPublishedTrainings(req, userInfoVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 变更共享状态
|
||||
*
|
||||
* @param id
|
||||
* @param shared
|
||||
* @param userInfoVO
|
||||
*/
|
||||
@GetMapping("/{id}/{shared}")
|
||||
public void changeSharedStatus(@PathVariable(name = "id") Long id,
|
||||
@PathVariable(name = "shared") Integer shared,
|
||||
@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
|
||||
this.publishService.changeSharedStatus(id, shared, userInfoVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除已发布实训
|
||||
*/
|
||||
@DeleteMapping
|
||||
public DeletePublishedTraining2RspVo deletePublishedTrainings(
|
||||
@RequestBody DeletePublishedTraining2ReqVo req,
|
||||
@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
|
||||
return this.publishService.deletePublishedTrainings(req, userInfoVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 实训查询(用户)管理
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/manage/infos")
|
||||
public PageVO<PublishedTraining2InfoRspVo> findTrainingListManageInfosForPage(@RequestBody PublishedTrainingListRspVo vo,@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO){
|
||||
vo.setOrgId(userInfoVO.getTopOrgId());
|
||||
return this.publishService.findTrainingInfoForPage(vo,userInfoVO,true);
|
||||
}
|
||||
/**
|
||||
* 实训查询(用户)管理
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/manage/infos")
|
||||
public PageVO<PublishedTraining2InfoRspVo> findTrainingListManageInfosForPage(
|
||||
@RequestBody PublishedTrainingListRspVo vo,
|
||||
@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
|
||||
vo.setOrgId(userInfoVO.getTopOrgId());
|
||||
return this.publishService.findTrainingInfoForPage(vo, userInfoVO, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 实训查询
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/infos")
|
||||
public List<PublishedTraining2InfoRspVo> findTrainingListInfos(@RequestBody PublishedTrainingListRspVo vo
|
||||
,@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO loginUserInfoVO){
|
||||
//只查询以上架
|
||||
vo.setState(BusinessConsts.STATUS_USE_INT);
|
||||
vo.setOrgId(loginUserInfoVO.getTopOrgId());
|
||||
return this.publishService.findTrainingInfo(vo,loginUserInfoVO);
|
||||
}
|
||||
/**
|
||||
* 查所有的已发布场景实训的基础信息
|
||||
*/
|
||||
@Role(value = RoleEnum.SuperAdmin)
|
||||
@GetMapping("/list")
|
||||
public PageVO<PublishedTraining2InfoRspVo> findTrainingList(@ModelAttribute PublishedTrainingListRspVo vo,@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO){
|
||||
return this.publishService.findTrainingInfoForPage(vo,userInfoVO,false);
|
||||
}
|
||||
/**
|
||||
* 实训查询
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/infos")
|
||||
public List<PublishedTraining2InfoRspVo> findTrainingListInfos(
|
||||
@RequestBody PublishedTrainingListRspVo vo
|
||||
,
|
||||
@RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO loginUserInfoVO) {
|
||||
//只查询以上架
|
||||
vo.setState(BusinessConsts.STATUS_USE_INT);
|
||||
vo.setOrgId(loginUserInfoVO.getTopOrgId());
|
||||
return this.publishService.findTrainingInfo(vo, loginUserInfoVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据实训id查该已发布实训的所有信息
|
||||
*/
|
||||
@GetMapping("/{trainingId}")
|
||||
public PublishedTraining2DetailRspVo findTrainingAllInfo(@PathVariable("trainingId") Long trainingId){
|
||||
return this.publishService.findTrainingAllInfoById(trainingId);
|
||||
}
|
||||
/**
|
||||
* 查所有的已发布场景实训的基础信息
|
||||
*/
|
||||
@Role(value = RoleEnum.SuperAdmin)
|
||||
@GetMapping("/list")
|
||||
public PageVO<PublishedTraining2InfoRspVo> findTrainingList(
|
||||
@ModelAttribute PublishedTrainingListRspVo vo,
|
||||
@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
|
||||
return this.publishService.findTrainingInfoForPage(vo, userInfoVO, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新实训label
|
||||
*/
|
||||
@PutMapping("/update/label")
|
||||
public void updateTrainingLabel(@RequestBody PublishedTraining2 training2) {
|
||||
publishService.updateTrainingLabel(training2);
|
||||
}
|
||||
/**
|
||||
* 根据实训id查该已发布实训的所有信息
|
||||
*/
|
||||
@GetMapping("/{trainingId}")
|
||||
public PublishedTraining2DetailRspVo findTrainingAllInfo(
|
||||
@PathVariable("trainingId") Long trainingId) {
|
||||
return this.publishService.findTrainingAllInfoById(trainingId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新实训label
|
||||
*/
|
||||
@PutMapping("/update/batch/label")
|
||||
public void updateTrainingLabelList(@RequestBody List<PublishedTraining2> publishedTraining2List) {
|
||||
publishService.updateTrainingLabelList(publishedTraining2List);
|
||||
}
|
||||
/**
|
||||
* 更新实训label
|
||||
*/
|
||||
@PutMapping("/update/label")
|
||||
public void updateTrainingLabel(@RequestBody PublishedTraining2 training2) {
|
||||
publishService.updateTrainingLabel(training2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出所选实训
|
||||
* @param tidList 实训ID列表
|
||||
* @return 实训详情信息
|
||||
*/
|
||||
@PostMapping("/export")
|
||||
public List<ExportTraining2> exportTraining(@RequestBody List<Long> tidList) {
|
||||
return publishService.exportTraining(tidList);
|
||||
}
|
||||
/**
|
||||
* 更新发布实训信息
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public void updateTraining(@RequestBody PublishedTraining2 training2) {
|
||||
publishService.updateTrainingBaseInfo(training2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入实训信息
|
||||
* @return 导入结果
|
||||
*/
|
||||
@PostMapping("/import")
|
||||
public List<String> importTraining(@RequestBody List<ExportTraining2> trainingList, @RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
|
||||
return publishService.importTraining(trainingList, userInfoVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新实训label
|
||||
*/
|
||||
@PutMapping("/update/batch/label")
|
||||
public void updateTrainingLabelList(
|
||||
@RequestBody List<PublishedTraining2> publishedTraining2List) {
|
||||
publishService.updateTrainingLabelList(publishedTraining2List);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出所选实训
|
||||
*
|
||||
* @param tidList 实训ID列表
|
||||
* @return 实训详情信息
|
||||
*/
|
||||
@PostMapping("/export")
|
||||
public List<ExportTraining2> exportTraining(@RequestBody List<Long> tidList) {
|
||||
return publishService.exportTraining(tidList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入实训信息
|
||||
*
|
||||
* @return 导入结果
|
||||
*/
|
||||
@PostMapping("/import")
|
||||
public List<String> importTraining(@RequestBody List<ExportTraining2> trainingList,
|
||||
@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
|
||||
return publishService.importTraining(trainingList, userInfoVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存为草稿
|
||||
*/
|
||||
@PostMapping("/{trainingId}/saveAsDraft")
|
||||
public void saveAsDraft(@PathVariable("trainingId") Long trainingId,
|
||||
@RequestAttribute(AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO userInfoVO) {
|
||||
training2DraftPublishService.saveAsDraft(trainingId, userInfoVO);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -478,6 +478,8 @@ public class AuthenticateService implements IAuthenticateService {
|
|||
case ILW:
|
||||
case PIS_STAND:
|
||||
case PIS_TRAIN:
|
||||
case PIS:
|
||||
case TMS:
|
||||
case VR_IBP: {
|
||||
RelationLoginConfigVO config = deviceVO.buildRelationLoginConfig();
|
||||
if (Objects.nonNull(config) && Objects.nonNull(config.getDeviceCode())) {
|
||||
|
|
|
@ -7,82 +7,104 @@ import club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs;
|
|||
import club.joylink.rtss.vo.training2.draft.DraftTraining2InfoVo;
|
||||
import club.joylink.rtss.vo.training2.publish.PublishedTraining2InfoRspVo;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
public class Training2Convertor {
|
||||
public static DraftTraining2InfoVo convertFrom(DraftTraining2 dt) {
|
||||
DraftTraining2InfoVo ti = new DraftTraining2InfoVo();
|
||||
ti.setCreateTime(dt.getCreateTime());
|
||||
ti.setCreatorId(dt.getCreatorId());
|
||||
ti.setId(dt.getId());
|
||||
ti.setDescription(dt.getDescription());
|
||||
ti.setLabelJson(dt.getLabelJson());
|
||||
ti.setMapId(dt.getMapId());
|
||||
ti.setName(dt.getName());
|
||||
ti.setUpdateTime(dt.getUpdateTime());
|
||||
ti.setType(dt.getType());
|
||||
ti.setClient(dt.getClient());
|
||||
return ti;
|
||||
}
|
||||
|
||||
/**
|
||||
* 实训草稿转化为已发布实训,注意已发布实训的状态为上架且已发布实训的id为空(数据库自动生成)
|
||||
*/
|
||||
public static PublishedTraining2WithBLOBs convertFrom(DraftTraining2WithBLOBs from) {
|
||||
PublishedTraining2WithBLOBs pub = new PublishedTraining2WithBLOBs();
|
||||
//
|
||||
pub.setState(PublishedTraining2StateEnum.PutOn.getState());
|
||||
//
|
||||
pub.setMemberJson(null == from.getMemberJson() ? "" : from.getMemberJson());
|
||||
pub.setBgSceneJson(null == from.getBgSceneJson() ? "" : from.getBgSceneJson());
|
||||
pub.setOperaJson(null == from.getOperaJson() ? "" : from.getOperaJson());
|
||||
pub.setDescription(null == from.getDescription() ? "" : from.getDescription());
|
||||
pub.setCreateTime(LocalDateTime.now());
|
||||
pub.setUpdateTime(LocalDateTime.now());
|
||||
pub.setCreatorId(from.getCreatorId());
|
||||
pub.setName(null == from.getName() ? "" : from.getName());
|
||||
pub.setPlayerIdJson(null == from.getPlayerIdJson() ? "" : from.getPlayerIdJson());
|
||||
pub.setScoringRuleJson(null == from.getScoringRuleJson() ? "" : from.getScoringRuleJson());
|
||||
pub.setStepJson(null == from.getStepJson() ? "" : from.getStepJson());
|
||||
pub.setFailureConditionJson(null == from.getFailureConditionJson() ? "" : from.getFailureConditionJson());
|
||||
pub.setLabelJson(null == from.getLabelJson() ? "" : from.getLabelJson());
|
||||
pub.setMapId(from.getMapId());
|
||||
pub.setMapLocationJson(null == from.getMapLocationJson() ? "" : from.getMapLocationJson());
|
||||
pub.setType(null == from.getType() ? "" : from.getType());
|
||||
pub.setRunPlanId(from.getRunPlanId());
|
||||
pub.setClient(from.getClient());
|
||||
//
|
||||
return pub;
|
||||
}
|
||||
public static DraftTraining2InfoVo convertFrom(DraftTraining2 dt) {
|
||||
DraftTraining2InfoVo ti = new DraftTraining2InfoVo();
|
||||
ti.setCreateTime(dt.getCreateTime());
|
||||
ti.setCreatorId(dt.getCreatorId());
|
||||
ti.setId(dt.getId());
|
||||
ti.setDescription(dt.getDescription());
|
||||
ti.setLabelJson(dt.getLabelJson());
|
||||
ti.setMapId(dt.getMapId());
|
||||
ti.setName(dt.getName());
|
||||
ti.setUpdateTime(dt.getUpdateTime());
|
||||
ti.setType(dt.getType());
|
||||
ti.setClient(dt.getClient());
|
||||
return ti;
|
||||
}
|
||||
|
||||
public static List<PublishedTraining2InfoRspVo> convertFrom(List<PublishedTraining2> froms) {
|
||||
List<PublishedTraining2InfoRspVo> list = Lists.newArrayList();
|
||||
froms.forEach(d -> list.add(convertFrom(d)));
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* 实训草稿转化为已发布实训,注意已发布实训的状态为上架且已发布实训的id为空(数据库自动生成)
|
||||
*/
|
||||
public static PublishedTraining2WithBLOBs convertFrom(DraftTraining2WithBLOBs from) {
|
||||
PublishedTraining2WithBLOBs pub = new PublishedTraining2WithBLOBs();
|
||||
//
|
||||
pub.setState(PublishedTraining2StateEnum.PutOn.getState());
|
||||
//
|
||||
pub.setMemberJson(null == from.getMemberJson() ? "" : from.getMemberJson());
|
||||
pub.setBgSceneJson(null == from.getBgSceneJson() ? "" : from.getBgSceneJson());
|
||||
pub.setOperaJson(null == from.getOperaJson() ? "" : from.getOperaJson());
|
||||
pub.setDescription(null == from.getDescription() ? "" : from.getDescription());
|
||||
pub.setCreateTime(LocalDateTime.now());
|
||||
pub.setUpdateTime(LocalDateTime.now());
|
||||
pub.setCreatorId(from.getCreatorId());
|
||||
pub.setName(null == from.getName() ? "" : from.getName());
|
||||
pub.setPlayerIdJson(null == from.getPlayerIdJson() ? "" : from.getPlayerIdJson());
|
||||
pub.setScoringRuleJson(null == from.getScoringRuleJson() ? "" : from.getScoringRuleJson());
|
||||
pub.setStepJson(null == from.getStepJson() ? "" : from.getStepJson());
|
||||
pub.setFailureConditionJson(
|
||||
null == from.getFailureConditionJson() ? "" : from.getFailureConditionJson());
|
||||
pub.setLabelJson(null == from.getLabelJson() ? "" : from.getLabelJson());
|
||||
pub.setMapId(from.getMapId());
|
||||
pub.setMapLocationJson(null == from.getMapLocationJson() ? "" : from.getMapLocationJson());
|
||||
pub.setType(null == from.getType() ? "" : from.getType());
|
||||
pub.setRunPlanId(from.getRunPlanId());
|
||||
pub.setClient(from.getClient());
|
||||
//
|
||||
return pub;
|
||||
}
|
||||
|
||||
public static PublishedTraining2InfoRspVo convertFrom(PublishedTraining2 from) {
|
||||
PublishedTraining2InfoRspVo rsp = new PublishedTraining2InfoRspVo();
|
||||
rsp.setCreateTime(from.getCreateTime());
|
||||
rsp.setDescription(from.getDescription());
|
||||
rsp.setCreatorId(from.getCreatorId());
|
||||
rsp.setId(from.getId());
|
||||
rsp.setName(from.getName());
|
||||
rsp.setLabelJson(from.getLabelJson());
|
||||
rsp.setMapId(from.getMapId());
|
||||
rsp.setPlayerIdJson(from.getPlayerIdJson());
|
||||
rsp.setType(from.getType());
|
||||
rsp.setFailureConditionJson(from.getFailureConditionJson());
|
||||
rsp.setUpdateTime(from.getUpdateTime());
|
||||
rsp.setRunPlanId(from.getRunPlanId());
|
||||
rsp.setMapLocationJson(from.getMapLocationJson());
|
||||
rsp.setState(from.getState());
|
||||
rsp.setClient(from.getClient());
|
||||
rsp.setShared(from.getShared());
|
||||
rsp.setOrgId(from.getOrgId());
|
||||
return rsp;
|
||||
}
|
||||
public static List<PublishedTraining2InfoRspVo> convertFrom(List<PublishedTraining2> froms) {
|
||||
List<PublishedTraining2InfoRspVo> list = Lists.newArrayList();
|
||||
froms.forEach(d -> list.add(convertFrom(d)));
|
||||
return list;
|
||||
}
|
||||
|
||||
public static PublishedTraining2InfoRspVo convertFrom(PublishedTraining2 from) {
|
||||
PublishedTraining2InfoRspVo rsp = new PublishedTraining2InfoRspVo();
|
||||
rsp.setCreateTime(from.getCreateTime());
|
||||
rsp.setDescription(from.getDescription());
|
||||
rsp.setCreatorId(from.getCreatorId());
|
||||
rsp.setId(from.getId());
|
||||
rsp.setName(from.getName());
|
||||
rsp.setLabelJson(from.getLabelJson());
|
||||
rsp.setMapId(from.getMapId());
|
||||
rsp.setPlayerIdJson(from.getPlayerIdJson());
|
||||
rsp.setType(from.getType());
|
||||
rsp.setFailureConditionJson(from.getFailureConditionJson());
|
||||
rsp.setUpdateTime(from.getUpdateTime());
|
||||
rsp.setRunPlanId(from.getRunPlanId());
|
||||
rsp.setMapLocationJson(from.getMapLocationJson());
|
||||
rsp.setState(from.getState());
|
||||
rsp.setClient(from.getClient());
|
||||
rsp.setShared(from.getShared());
|
||||
rsp.setOrgId(from.getOrgId());
|
||||
return rsp;
|
||||
}
|
||||
|
||||
|
||||
public static DraftTraining2WithBLOBs convertFrom(PublishedTraining2WithBLOBs from) {
|
||||
DraftTraining2WithBLOBs dtb = new DraftTraining2WithBLOBs();
|
||||
dtb.setName(from.getName());
|
||||
dtb.setMapId(from.getMapId());
|
||||
// map_system、terminal
|
||||
dtb.setDescription(from.getDescription());
|
||||
dtb.setType(from.getType());
|
||||
dtb.setLabelJson(from.getLabelJson());
|
||||
dtb.setMapLocationJson(from.getMapLocationJson());
|
||||
dtb.setBgSceneJson(from.getBgSceneJson());
|
||||
dtb.setRunPlanId(from.getRunPlanId());
|
||||
dtb.setOperaJson(from.getOperaJson());
|
||||
dtb.setStepJson(from.getStepJson());
|
||||
dtb.setScoringRuleJson(from.getScoringRuleJson());
|
||||
dtb.setMemberJson(from.getMemberJson());
|
||||
dtb.setPlayerIdJson(from.getPlayerIdJson());
|
||||
dtb.setFailureConditionJson(from.getFailureConditionJson());
|
||||
dtb.setClient(from.getClient());
|
||||
return dtb;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,82 +3,110 @@ package club.joylink.rtss.services.training2;
|
|||
import club.joylink.rtss.constants.BusinessConsts;
|
||||
import club.joylink.rtss.dao.DraftTraining2DAO;
|
||||
import club.joylink.rtss.dao.PublishedTraining2DAO;
|
||||
import club.joylink.rtss.entity.training2.*;
|
||||
import club.joylink.rtss.entity.training2.DraftTraining2;
|
||||
import club.joylink.rtss.entity.training2.DraftTraining2Example;
|
||||
import club.joylink.rtss.entity.training2.DraftTraining2WithBLOBs;
|
||||
import club.joylink.rtss.entity.training2.PublishedTraining2;
|
||||
import club.joylink.rtss.entity.training2.PublishedTraining2Example;
|
||||
import club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs;
|
||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.training2.draft.TrainingDraftPublishReqVo;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 实训草稿发布业务实现
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class Training2DraftPublishService {
|
||||
@Autowired
|
||||
private DraftTraining2DAO trainingDao;
|
||||
@Autowired
|
||||
private PublishedTraining2DAO publishedDao;
|
||||
@Autowired
|
||||
private Training2TraceService training2TraceService;
|
||||
|
||||
/**
|
||||
* 草稿发布
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void draftPublish(TrainingDraftPublishReqVo req, Long userId,Long orgId) {
|
||||
Long draftId = Long.valueOf(req.getDraftId());
|
||||
DraftTraining2Example dtExample = new DraftTraining2Example();
|
||||
dtExample.createCriteria().andCreatorIdEqualTo(userId).andIdEqualTo(draftId);
|
||||
List<DraftTraining2WithBLOBs> dtFinds = this.trainingDao.selectByExampleWithBLOBs(dtExample);
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != dtFinds && !dtFinds.isEmpty(), "实训草稿不存在");
|
||||
DraftTraining2WithBLOBs draft = dtFinds.get(0);
|
||||
//
|
||||
PublishedTraining2WithBLOBs pub = Training2Convertor.convertFrom(draft);
|
||||
//加入共享,默认不共享
|
||||
pub.setShared(BusinessConsts.STATUS_NOT_USE_INT);
|
||||
if(null!=req.getReName()&&req.getReName().trim().length()>0){
|
||||
pub.setName(req.getReName());
|
||||
}
|
||||
//根据要发布的草稿名称来查找已发布的实训
|
||||
//如果以有同名的则会被覆盖
|
||||
PublishedTraining2Example ptExample = new PublishedTraining2Example();
|
||||
ptExample.createCriteria().andNameEqualTo(pub.getName()).andMapIdEqualTo(pub.getMapId());
|
||||
List<PublishedTraining2> ptFinds = this.publishedDao.selectByExample(ptExample);
|
||||
pub.setOrgId(orgId);
|
||||
//
|
||||
if(null==ptFinds||ptFinds.isEmpty()){//同地图同名已发布实训不存在则直接存入
|
||||
//发布
|
||||
this.publishedDao.insertSelective(pub);
|
||||
}else{//同地图同名已发布实训存在
|
||||
if(ptFinds.size()>1){//当有多个存在时,则全部删除再存入
|
||||
this.publishedDao.deleteByExample(ptExample);
|
||||
this.publishedDao.insertSelective(pub);
|
||||
}else{//当有且仅有一个时,直接更新
|
||||
PublishedTraining2 old = ptFinds.get(0);
|
||||
pub.setId(old.getId());
|
||||
this.publishedDao.updateByPrimaryKeySelective(pub);
|
||||
}
|
||||
}
|
||||
//记录发布轨迹
|
||||
final PublishedTraining2 tracePub = this.findByNameAndMapId(pub.getName(),pub.getMapId());
|
||||
final DraftTraining2 traceDraft = draft;
|
||||
this.training2TraceService.addTrace(traceDraft,tracePub,userId);
|
||||
@Autowired
|
||||
private DraftTraining2DAO trainingDao;
|
||||
@Autowired
|
||||
private PublishedTraining2DAO publishedDao;
|
||||
@Autowired
|
||||
private Training2TraceService training2TraceService;
|
||||
|
||||
/**
|
||||
* 草稿发布
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void draftPublish(TrainingDraftPublishReqVo req, Long userId, Long orgId) {
|
||||
Long draftId = Long.valueOf(req.getDraftId());
|
||||
DraftTraining2Example dtExample = new DraftTraining2Example();
|
||||
dtExample.createCriteria().andCreatorIdEqualTo(userId).andIdEqualTo(draftId);
|
||||
List<DraftTraining2WithBLOBs> dtFinds = this.trainingDao.selectByExampleWithBLOBs(dtExample);
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != dtFinds && !dtFinds.isEmpty(),
|
||||
"实训草稿不存在");
|
||||
DraftTraining2WithBLOBs draft = dtFinds.get(0);
|
||||
//
|
||||
PublishedTraining2WithBLOBs pub = Training2Convertor.convertFrom(draft);
|
||||
//加入共享,默认不共享
|
||||
pub.setShared(BusinessConsts.STATUS_NOT_USE_INT);
|
||||
if (null != req.getReName() && req.getReName().trim().length() > 0) {
|
||||
pub.setName(req.getReName());
|
||||
}
|
||||
@Transactional(readOnly = true)
|
||||
public PublishedTraining2 findByNameAndMapId(String name,Long mapId){
|
||||
PublishedTraining2Example ptExample = new PublishedTraining2Example();
|
||||
ptExample.createCriteria().andNameEqualTo(name).andMapIdEqualTo(mapId);
|
||||
List<PublishedTraining2> ptFinds = this.publishedDao.selectByExample(ptExample);
|
||||
//
|
||||
if(null!=ptFinds){
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(ptFinds.size()<=1, String.format("已发布实训[name=%s mapId=%s]不唯一!",name,mapId));
|
||||
return ptFinds.get(0);
|
||||
}
|
||||
return null;
|
||||
//根据要发布的草稿名称来查找已发布的实训
|
||||
//如果以有同名的则会被覆盖
|
||||
PublishedTraining2Example ptExample = new PublishedTraining2Example();
|
||||
ptExample.createCriteria().andNameEqualTo(pub.getName()).andMapIdEqualTo(pub.getMapId());
|
||||
List<PublishedTraining2> ptFinds = this.publishedDao.selectByExample(ptExample);
|
||||
pub.setOrgId(orgId);
|
||||
//
|
||||
if (null == ptFinds || ptFinds.isEmpty()) {//同地图同名已发布实训不存在则直接存入
|
||||
//发布
|
||||
this.publishedDao.insertSelective(pub);
|
||||
} else {//同地图同名已发布实训存在
|
||||
if (ptFinds.size() > 1) {//当有多个存在时,则全部删除再存入
|
||||
this.publishedDao.deleteByExample(ptExample);
|
||||
this.publishedDao.insertSelective(pub);
|
||||
} else {//当有且仅有一个时,直接更新
|
||||
PublishedTraining2 old = ptFinds.get(0);
|
||||
pub.setId(old.getId());
|
||||
this.publishedDao.updateByPrimaryKeySelective(pub);
|
||||
}
|
||||
}
|
||||
//记录发布轨迹
|
||||
final PublishedTraining2 tracePub = this.findByNameAndMapId(pub.getName(), pub.getMapId());
|
||||
final DraftTraining2 traceDraft = draft;
|
||||
this.training2TraceService.addTrace(traceDraft, tracePub, userId);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public PublishedTraining2 findByNameAndMapId(String name, Long mapId) {
|
||||
PublishedTraining2Example ptExample = new PublishedTraining2Example();
|
||||
ptExample.createCriteria().andNameEqualTo(name).andMapIdEqualTo(mapId);
|
||||
List<PublishedTraining2> ptFinds = this.publishedDao.selectByExample(ptExample);
|
||||
//
|
||||
if (null != ptFinds) {
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(ptFinds.size() <= 1,
|
||||
String.format("已发布实训[name=%s mapId=%s]不唯一!", name, mapId));
|
||||
return ptFinds.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发布信息保存为草稿
|
||||
*
|
||||
* @param trainingId 发布ID
|
||||
* @param userInfoVO 用户
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveAsDraft(Long trainingId, LoginUserInfoVO userInfoVO) {
|
||||
PublishedTraining2WithBLOBs b = this.publishedDao.selectByPrimaryKey(trainingId);
|
||||
DraftTraining2WithBLOBs dtb = Training2Convertor.convertFrom(b);
|
||||
dtb.setCreateTime(LocalDateTime.now());
|
||||
dtb.setUpdateTime(LocalDateTime.now());
|
||||
dtb.setCreatorId(userInfoVO.getAccountVO().getId());
|
||||
this.trainingDao.insert(dtb);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -15,9 +15,27 @@ import club.joylink.rtss.vo.client.PageVO;
|
|||
import club.joylink.rtss.vo.map.MapVO;
|
||||
import club.joylink.rtss.vo.paper.FindCountForQuestionReqVo;
|
||||
import club.joylink.rtss.vo.paper.PaperQType;
|
||||
import club.joylink.rtss.vo.training2.publish.*;
|
||||
import club.joylink.rtss.vo.training2.publish.DeletePublishedTraining2ReqVo;
|
||||
import club.joylink.rtss.vo.training2.publish.DeletePublishedTraining2RspVo;
|
||||
import club.joylink.rtss.vo.training2.publish.PublishedTraining2DetailRspVo;
|
||||
import club.joylink.rtss.vo.training2.publish.PublishedTraining2InfoPageReqVo;
|
||||
import club.joylink.rtss.vo.training2.publish.PublishedTraining2InfoRspVo;
|
||||
import club.joylink.rtss.vo.training2.publish.PublishedTrainingListRspVo;
|
||||
import club.joylink.rtss.vo.training2.publish.PullOffPublishedTraining2ReqVo;
|
||||
import club.joylink.rtss.vo.training2.publish.PullOffPublishedTraining2RspVo;
|
||||
import club.joylink.rtss.vo.training2.publish.PutOnPublishedTraining2ReqVo;
|
||||
import club.joylink.rtss.vo.training2.publish.PutOnPublishedTraining2RspVo;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -25,10 +43,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 已发布实训管理业务实现
|
||||
*/
|
||||
|
@ -58,7 +72,8 @@ public class Training2PublishService {
|
|||
return 0L;
|
||||
}
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
PublishedTraining2Example.Criteria c = this.basicQueryCriteria(example, reqVo.getMapId(), reqVo.getOrgId(), reqVo.getSubType().name().toUpperCase(), Arrays.asList(reqVo.getTags()),
|
||||
PublishedTraining2Example.Criteria c = this.basicQueryCriteria(example, reqVo.getMapId(),
|
||||
reqVo.getOrgId(), reqVo.getSubType().name().toUpperCase(), Arrays.asList(reqVo.getTags()),
|
||||
reqVo.getTrainingClient());
|
||||
return this.publishedDao.countByExample(example);
|
||||
}
|
||||
|
@ -66,23 +81,30 @@ public class Training2PublishService {
|
|||
/**
|
||||
* 根据 组织,类型(单操作,实操) 获取标签
|
||||
*/
|
||||
public Collection<String> findAllLabel(Long mapId, Long orgId, String type, PaperQType.TrainingClient client) {
|
||||
public Collection<String> findAllLabel(Long mapId, Long orgId, String type,
|
||||
PaperQType.TrainingClient client) {
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
PublishedTraining2Example.Criteria c = this.basicQueryCriteria(example, mapId, orgId, type, null, client);
|
||||
PublishedTraining2Example.Criteria c = this.basicQueryCriteria(example, mapId, orgId, type,
|
||||
null, client);
|
||||
List<PublishedTraining2> dataList = this.publishedDao.selectByExample(example);
|
||||
if (CollectionUtils.isEmpty(dataList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return dataList.stream().map(PublishedTraining2::getLabelJson).filter(StringUtils::hasText).map(d -> {
|
||||
List<String> l = JsonUtils.readCollection(d, List.class, String.class);
|
||||
return l;
|
||||
}).flatMap(Collection::stream).collect(Collectors.toSet());
|
||||
return dataList.stream().map(PublishedTraining2::getLabelJson).filter(StringUtils::hasText)
|
||||
.map(d -> {
|
||||
List<String> l = JsonUtils.readCollection(d, List.class, String.class);
|
||||
return l;
|
||||
}).flatMap(Collection::stream).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
public PublishedTraining2Example.Criteria basicQueryCriteria(PublishedTraining2Example example, Long mapId, Long orgId, String type, List<String> lables, PaperQType.TrainingClient client) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(mapId), "请关联对应的线路");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId), "组织信息不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(type), "查询类型信息不能为空");
|
||||
public PublishedTraining2Example.Criteria basicQueryCriteria(PublishedTraining2Example example,
|
||||
Long mapId, Long orgId, String type, List<String> lables, PaperQType.TrainingClient client) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(mapId),
|
||||
"请关联对应的线路");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId),
|
||||
"组织信息不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(type),
|
||||
"查询类型信息不能为空");
|
||||
|
||||
PublishedTraining2Example.Criteria criteria = example.createCriteria();
|
||||
|
||||
|
@ -118,7 +140,8 @@ public class Training2PublishService {
|
|||
* 已发布实训分页列表
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public PageVO<PublishedTraining2InfoRspVo> publishedTrainingsPage(PublishedTraining2InfoPageReqVo req) {
|
||||
public PageVO<PublishedTraining2InfoRspVo> publishedTrainingsPage(
|
||||
PublishedTraining2InfoPageReqVo req) {
|
||||
PageHelper.startPage(req.getPageNum(), req.getPageSize());
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
PublishedTraining2Example.Criteria c = example.createCriteria();
|
||||
|
@ -161,7 +184,8 @@ public class Training2PublishService {
|
|||
if (req.getDesc()) {
|
||||
example.setOrderByClause(String.format(" %s desc", orderBy));
|
||||
}
|
||||
Page<PublishedTraining2> page = (Page<PublishedTraining2>) this.publishedDao.selectByExample(example);
|
||||
Page<PublishedTraining2> page = (Page<PublishedTraining2>) this.publishedDao.selectByExample(
|
||||
example);
|
||||
List<PublishedTraining2InfoRspVo> tmpList = Training2Convertor.convertFrom(page.getResult());
|
||||
|
||||
return PageVO.convert(page, tmpList);
|
||||
|
@ -171,7 +195,8 @@ public class Training2PublishService {
|
|||
* 已发布实训上架
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public PutOnPublishedTraining2RspVo putOnPublishedTrainings(PutOnPublishedTraining2ReqVo req, LoginUserInfoVO userInfoVO) {
|
||||
public PutOnPublishedTraining2RspVo putOnPublishedTrainings(PutOnPublishedTraining2ReqVo req,
|
||||
LoginUserInfoVO userInfoVO) {
|
||||
final PutOnPublishedTraining2RspVo rsp = new PutOnPublishedTraining2RspVo();
|
||||
rsp.setIds(new ArrayList<>());
|
||||
if (CollectionUtils.isEmpty(req.getIds())) {
|
||||
|
@ -192,27 +217,16 @@ public class Training2PublishService {
|
|||
rsp.getIds().add(newId.toString());
|
||||
}
|
||||
}
|
||||
/* req.getIds().forEach(id -> {
|
||||
PublishedTraining2WithBLOBs pub = new PublishedTraining2WithBLOBs();
|
||||
pub.setId(Long.valueOf(id));
|
||||
pub.setState(PublishedTraining2StateEnum.PutOn.getState());
|
||||
pub.setUpdateTime(LocalDateTime.now());
|
||||
//
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
example.createCriteria().andIdEqualTo(pub.getId());
|
||||
//
|
||||
int urt = this.publishedDao.updateByExampleSelective(pub, example);
|
||||
if (urt > 0) {//记录更新成功的
|
||||
rsp.getIds().add(id);
|
||||
}
|
||||
});*/
|
||||
return rsp;
|
||||
}
|
||||
|
||||
public void changeSharedStatus(Long id, Integer shared, LoginUserInfoVO userInfoVO) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(id), "id信息不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(shared), "未知共享类型");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(shared == BusinessConsts.STATUS_USE_INT || shared == BusinessConsts.STATUS_NOT_USE_INT, "未知共享类型");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(shared),
|
||||
"未知共享类型");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(
|
||||
shared == BusinessConsts.STATUS_USE_INT || shared == BusinessConsts.STATUS_NOT_USE_INT,
|
||||
"未知共享类型");
|
||||
|
||||
}
|
||||
|
||||
|
@ -220,7 +234,8 @@ public class Training2PublishService {
|
|||
* 已发布实训下架
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public PullOffPublishedTraining2RspVo pullOffPublishedTrainings(PullOffPublishedTraining2ReqVo req, LoginUserInfoVO userInfoVO) {
|
||||
public PullOffPublishedTraining2RspVo pullOffPublishedTrainings(
|
||||
PullOffPublishedTraining2ReqVo req, LoginUserInfoVO userInfoVO) {
|
||||
final PullOffPublishedTraining2RspVo rsp = new PullOffPublishedTraining2RspVo();
|
||||
rsp.setIds(new ArrayList<>());
|
||||
if (CollectionUtils.isEmpty(req.getIds())) {
|
||||
|
@ -249,7 +264,8 @@ public class Training2PublishService {
|
|||
* 删除已发布实训
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public DeletePublishedTraining2RspVo deletePublishedTrainings(DeletePublishedTraining2ReqVo req, LoginUserInfoVO userInfoVO) {
|
||||
public DeletePublishedTraining2RspVo deletePublishedTrainings(DeletePublishedTraining2ReqVo req,
|
||||
LoginUserInfoVO userInfoVO) {
|
||||
DeletePublishedTraining2RspVo rsp = new DeletePublishedTraining2RspVo();
|
||||
rsp.setIds(new ArrayList<>());
|
||||
if (CollectionUtils.isEmpty(req.getIds())) {
|
||||
|
@ -262,13 +278,6 @@ public class Training2PublishService {
|
|||
rsp.getIds().add(newId.toString());
|
||||
}
|
||||
}
|
||||
/*req.getIds().forEach(id -> {
|
||||
int drt = this.publishedDao.deleteByPrimaryKey(Long.valueOf(id));
|
||||
if (drt > 0) {
|
||||
rsp.getIds().add(id);
|
||||
}
|
||||
});*/
|
||||
//
|
||||
return rsp;
|
||||
}
|
||||
|
||||
|
@ -278,11 +287,14 @@ public class Training2PublishService {
|
|||
List<Long> idLong = ids.stream().map(Long::valueOf).collect(Collectors.toList());
|
||||
criteria.andIdIn(idLong);
|
||||
List<PublishedTraining2> t2 = this.publishedDao.selectByExample(example);
|
||||
List<PublishedTraining2> notExeList = t2.stream().filter(d -> Objects.equals(d.getOrgId(), userInfoVO.getTopOrgId()) && !Objects.equals(d.getCreatorId(), userInfoVO.getAccountVO().getId()))
|
||||
List<PublishedTraining2> notExeList = t2.stream().filter(
|
||||
d -> Objects.equals(d.getOrgId(), userInfoVO.getTopOrgId()) && !Objects.equals(
|
||||
d.getCreatorId(), userInfoVO.getAccountVO().getId()))
|
||||
.collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(notExeList)) {
|
||||
String names = notExeList.stream().map(d -> d.getName()).collect(Collectors.joining(","));
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(false, String.format("共享数据[%s]不能删除", names));
|
||||
BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(false,
|
||||
String.format("共享数据[%s]不能删除", names));
|
||||
}
|
||||
List<Long> findIds = t2.stream()
|
||||
.filter(d -> Objects.equals(d.getOrgId(), userInfoVO.getTopOrgId()))
|
||||
|
@ -290,7 +302,8 @@ public class Training2PublishService {
|
|||
return findIds;
|
||||
}
|
||||
|
||||
private PublishedTraining2Example.Criteria createQueryOrExample(PublishedTraining2Example example, PublishedTrainingListRspVo reqVO, List<Long> mapIdList) {
|
||||
private PublishedTraining2Example.Criteria createQueryOrExample(PublishedTraining2Example example,
|
||||
PublishedTrainingListRspVo reqVO, List<Long> mapIdList) {
|
||||
|
||||
PublishedTraining2Example.Criteria criteria = example.createCriteria();
|
||||
// PublishedTraining2Example.Criteria or = example.or();
|
||||
|
@ -319,41 +332,19 @@ public class Training2PublishService {
|
|||
}
|
||||
return criteria;
|
||||
}
|
||||
/* private PublishedTraining2Example.Criteria createQueryExample(PublishedTraining2Example example ,PublishedTrainingListRspVo reqVO){
|
||||
|
||||
PublishedTraining2Example.Criteria criteria = example.createCriteria();
|
||||
if (reqVO.getMapId() != null) {
|
||||
criteria.andMapIdEqualTo(reqVO.getMapId());
|
||||
}
|
||||
if (reqVO.getType() != null) {
|
||||
criteria.andTypeEqualTo(reqVO.getType().value());
|
||||
}
|
||||
if(StringUtils.hasText(reqVO.getName())){
|
||||
criteria.andNameLike(String.format("%%%s%%", reqVO.getName()));
|
||||
}
|
||||
if(Objects.nonNull(reqVO.getState())){
|
||||
criteria.andStateEqualTo(reqVO.getState());
|
||||
}
|
||||
if(!CollectionUtils.isEmpty(reqVO.getLabels())){
|
||||
for (String label : reqVO.getLabels()) {
|
||||
criteria.andLabelJsonLike(String.format("%%%s%%", label));
|
||||
}
|
||||
}
|
||||
if (reqVO.getOrgId() != null) {
|
||||
criteria.andOrgIdEqualTo(reqVO.getOrgId());
|
||||
}
|
||||
return criteria;
|
||||
}*/
|
||||
|
||||
public PageVO<PublishedTraining2InfoRspVo> findTrainingInfoForPage(PublishedTrainingListRspVo reqVO, LoginUserInfoVO userInfoVO, boolean findSharedData) {
|
||||
public PageVO<PublishedTraining2InfoRspVo> findTrainingInfoForPage(
|
||||
PublishedTrainingListRspVo reqVO, LoginUserInfoVO userInfoVO, boolean findSharedData) {
|
||||
List<MapVO> mapVOS = this.mapService.listMapsOfUser(userInfoVO);
|
||||
List<Long> mapIdList = mapVOS.stream().map(d -> d.getId()).collect(Collectors.toList());
|
||||
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
PublishedTraining2Example.Criteria criteria = this.createQueryOrExample(example, reqVO, mapIdList);
|
||||
PublishedTraining2Example.Criteria criteria = this.createQueryOrExample(example, reqVO,
|
||||
mapIdList);
|
||||
if (findSharedData) {
|
||||
PublishedTraining2Example.Criteria or = example.or();
|
||||
or.andStateEqualTo(BusinessConsts.STATUS_USE_INT).andSharedEqualTo(BusinessConsts.STATUS_USE_INT);
|
||||
or.andStateEqualTo(BusinessConsts.STATUS_USE_INT)
|
||||
.andSharedEqualTo(BusinessConsts.STATUS_USE_INT);
|
||||
if (reqVO.getType() != null) {
|
||||
or.andTypeEqualTo(reqVO.getType().value());
|
||||
}
|
||||
|
@ -362,12 +353,10 @@ public class Training2PublishService {
|
|||
} else {
|
||||
or.andMapIdEqualTo(reqVO.getMapId());
|
||||
}
|
||||
// if(Objects.nonNull(reqVO.getOrgId())){
|
||||
// or.andOrgIdNotEqualTo(reqVO.getOrgId());
|
||||
// }
|
||||
}
|
||||
PageHelper.startPage(reqVO.getPageNum(), reqVO.getPageSize());
|
||||
Page<PublishedTraining2> page = (Page<PublishedTraining2>) this.publishedDao.selectByExample(example);
|
||||
Page<PublishedTraining2> page = (Page<PublishedTraining2>) this.publishedDao.selectByExample(
|
||||
example);
|
||||
if (page.isEmpty()) {
|
||||
return PageVO.convert(page, Collections.emptyList());
|
||||
}
|
||||
|
@ -377,14 +366,16 @@ public class Training2PublishService {
|
|||
/**
|
||||
* 根据地图ID和类型查询实训列表
|
||||
*/
|
||||
public List<PublishedTraining2InfoRspVo> findTrainingInfo(PublishedTrainingListRspVo reqVO, LoginUserInfoVO userInfoVO) {
|
||||
public List<PublishedTraining2InfoRspVo> findTrainingInfo(PublishedTrainingListRspVo reqVO,
|
||||
LoginUserInfoVO userInfoVO) {
|
||||
List<MapVO> mapVOS = this.mapService.listMapsOfUser(userInfoVO);
|
||||
List<Long> mapIdList = mapVOS.stream().map(d -> d.getId()).collect(Collectors.toList());
|
||||
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
this.createQueryOrExample(example, reqVO, mapIdList);
|
||||
PublishedTraining2Example.Criteria or = example.or();
|
||||
or.andStateEqualTo(BusinessConsts.STATUS_USE_INT).andSharedEqualTo(BusinessConsts.STATUS_USE_INT);
|
||||
or.andStateEqualTo(BusinessConsts.STATUS_USE_INT)
|
||||
.andSharedEqualTo(BusinessConsts.STATUS_USE_INT);
|
||||
or.andMapIdEqualTo(reqVO.getMapId());
|
||||
if (reqVO.getType() != null) {
|
||||
or.andTypeEqualTo(reqVO.getType().value());
|
||||
|
@ -448,7 +439,8 @@ public class Training2PublishService {
|
|||
* 批量更新实训label
|
||||
*/
|
||||
public void updateTrainingLabelList(List<PublishedTraining2> publishedTraining2List) {
|
||||
List<PublishedTraining2> training2List = publishedTraining2List.stream().filter(t -> t.getId() != null).collect(Collectors.toList());
|
||||
List<PublishedTraining2> training2List = publishedTraining2List.stream()
|
||||
.filter(t -> t.getId() != null).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(training2List)) {
|
||||
return;
|
||||
}
|
||||
|
@ -465,6 +457,20 @@ public class Training2PublishService {
|
|||
publishedDao.updateByPrimaryKeySelective(blobs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改发布实训的基本信息。名称、描述等
|
||||
*
|
||||
* @param training2
|
||||
*/
|
||||
public void updateTrainingBaseInfo(PublishedTraining2 training2) {
|
||||
PublishedTraining2WithBLOBs blobs = new PublishedTraining2WithBLOBs();
|
||||
blobs.setId(training2.getId());
|
||||
blobs.setName(training2.getName());
|
||||
blobs.setDescription(training2.getDescription());
|
||||
blobs.setLabelJson(training2.getLabelJson());
|
||||
publishedDao.updateByPrimaryKeySelective(blobs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出实训信息
|
||||
*
|
||||
|
@ -474,15 +480,19 @@ public class Training2PublishService {
|
|||
public List<ExportTraining2> exportTraining(List<Long> tidList) {
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
example.createCriteria().andIdIn(tidList);
|
||||
List<PublishedTraining2WithBLOBs> training2WithBLOBsList = publishedDao.selectByExampleWithBLOBs(example);
|
||||
Map<Long, List<PublishedTraining2WithBLOBs>> mapTrainingMap = training2WithBLOBsList.stream().peek(t -> {
|
||||
t.setId(null);
|
||||
t.setUpdateTime(null);
|
||||
t.setCreateTime(null);
|
||||
}).collect(Collectors.groupingBy(PublishedTraining2WithBLOBs::getMapId));
|
||||
List<PublishedTraining2WithBLOBs> training2WithBLOBsList = publishedDao.selectByExampleWithBLOBs(
|
||||
example);
|
||||
Map<Long, List<PublishedTraining2WithBLOBs>> mapTrainingMap = training2WithBLOBsList.stream()
|
||||
.peek(t -> {
|
||||
t.setId(null);
|
||||
t.setUpdateTime(null);
|
||||
t.setCreateTime(null);
|
||||
}).collect(Collectors.groupingBy(PublishedTraining2WithBLOBs::getMapId));
|
||||
// 地图基本信息列表
|
||||
List<MapInfo> mapInfoList = mapService.queryMapInfoList(new ArrayList<>(mapTrainingMap.keySet()));
|
||||
Map<Long, MapInfo> mapInfoMap = mapInfoList.stream().collect(Collectors.toMap(MapInfo::getId, m -> m, (o, n) -> n));
|
||||
List<MapInfo> mapInfoList = mapService.queryMapInfoList(
|
||||
new ArrayList<>(mapTrainingMap.keySet()));
|
||||
Map<Long, MapInfo> mapInfoMap = mapInfoList.stream()
|
||||
.collect(Collectors.toMap(MapInfo::getId, m -> m, (o, n) -> n));
|
||||
List<ExportTraining2> exportTraining2List = new ArrayList<>(mapTrainingMap.size());
|
||||
mapInfoMap.forEach((k, v) -> {
|
||||
ExportTraining2 exportData = new ExportTraining2();
|
||||
|
@ -499,7 +509,8 @@ public class Training2PublishService {
|
|||
*
|
||||
* @param trainingList 实训列表
|
||||
*/
|
||||
public List<String> importTraining(List<ExportTraining2> trainingList, LoginUserInfoVO userInfoVO) {
|
||||
public List<String> importTraining(List<ExportTraining2> trainingList,
|
||||
LoginUserInfoVO userInfoVO) {
|
||||
List<String> msgList = new ArrayList<>();
|
||||
trainingList.forEach(t -> {
|
||||
List<MapInfo> mapInfoList = mapService.queryMapInfo(t.getName(), t.getLineCode());
|
||||
|
@ -513,7 +524,8 @@ public class Training2PublishService {
|
|||
publishedDao.insertList(t.getList());
|
||||
msgList.add(String.format("地图【%s】实训信息导入成功", t.getName()));
|
||||
} else {
|
||||
msgList.add(String.format("地图【%s】实训信息导入失败", t.getName()));
|
||||
msgList.add(String.format("地图【%s】实训信息导入失败,线路【%s】地图【%s】未上线", t.getName(),
|
||||
t.getLineCode(), t.getName()));
|
||||
}
|
||||
});
|
||||
return msgList;
|
||||
|
|
|
@ -2,90 +2,95 @@ package club.joylink.rtss.vo.training2.draft;
|
|||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class DraftTraining2DetailRspVo {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long mapId;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long mapId;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 实训类型(单操 single;场景scene)
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 标签,用于检索
|
||||
*/
|
||||
private String labelJson;
|
||||
/**
|
||||
* 实训类型(单操 single;场景scene)
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 地图定位json
|
||||
*/
|
||||
private String mapLocationJson;
|
||||
/**
|
||||
* 标签,用于检索
|
||||
*/
|
||||
private String labelJson;
|
||||
|
||||
/**
|
||||
* 初始背景
|
||||
*/
|
||||
private String bgSceneJson;
|
||||
/**
|
||||
* 地图定位json
|
||||
*/
|
||||
private String mapLocationJson;
|
||||
|
||||
/**
|
||||
* 运行图id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long runPlanId;
|
||||
/**
|
||||
* 初始背景
|
||||
*/
|
||||
private String bgSceneJson;
|
||||
|
||||
/**
|
||||
* List<Operation2VO>的json
|
||||
*/
|
||||
private String operaJson;
|
||||
/**
|
||||
* 运行图id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long runPlanId;
|
||||
|
||||
/**
|
||||
* List<Step2VO>的json
|
||||
*/
|
||||
private String stepJson;
|
||||
/**
|
||||
* List<Operation2VO>的json
|
||||
*/
|
||||
private String operaJson;
|
||||
|
||||
/**
|
||||
* List<ScoringRuleVO>的json
|
||||
*/
|
||||
private String scoringRuleJson;
|
||||
/**
|
||||
* List<Step2VO>的json
|
||||
*/
|
||||
private String stepJson;
|
||||
|
||||
/**
|
||||
* 仿真内所有成员
|
||||
*/
|
||||
private String memberJson;
|
||||
/**
|
||||
* List<ScoringRuleVO>的json
|
||||
*/
|
||||
private String scoringRuleJson;
|
||||
|
||||
/**
|
||||
* 参演的仿真成员id列表Json
|
||||
*/
|
||||
private String playerIdJson;
|
||||
/**
|
||||
* 仿真内所有成员
|
||||
*/
|
||||
private String memberJson;
|
||||
|
||||
/**
|
||||
* 实训失败判定条件
|
||||
*/
|
||||
private String failureConditionJson;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long creatorId;
|
||||
/**
|
||||
* 参演的仿真成员id列表Json
|
||||
*/
|
||||
private String playerIdJson;
|
||||
|
||||
private String client;
|
||||
/**
|
||||
* 实训失败判定条件
|
||||
*/
|
||||
private String failureConditionJson;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long creatorId;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
private String client;
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 是否需要运行至最后一步
|
||||
*/
|
||||
private boolean needRunToFinalStep;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue