Merge remote-tracking branch 'origin/test-training2' into test-training2
# Conflicts: # src/main/resources/application.yml
This commit is contained in:
commit
820ea94b26
3
sql/202201010-zhouyin.sql
Normal file
3
sql/202201010-zhouyin.sql
Normal file
@ -0,0 +1,3 @@
|
||||
-- 新实训标添加组织id
|
||||
alter table published_training2 add column org_id bigint;
|
||||
|
@ -24,6 +24,9 @@ public class MinioClientConfig {
|
||||
@Value("${minio.bucket}")
|
||||
private String bucket;
|
||||
|
||||
@Value("${minio.replaceHttps}")
|
||||
private Boolean replaceHttps;
|
||||
|
||||
private MinioClient minioClient;
|
||||
|
||||
@PostConstruct
|
||||
|
@ -18,6 +18,11 @@ public class MinioController {
|
||||
@Autowired
|
||||
private MinioService minioService;
|
||||
|
||||
@GetMapping("/checkIsExist")
|
||||
public boolean checkFileIsExist(String directory, String fileName) {
|
||||
return minioService.checkFileIsExist(directory, fileName);
|
||||
}
|
||||
|
||||
@GetMapping("/preSignedUrl")
|
||||
public String getPreSignedObjectUrl(String directory, String fileName, Method method) {
|
||||
return minioService.preSignedObjectUrl(directory, fileName, method);
|
||||
|
@ -41,7 +41,6 @@ public class PagerQuestionBankController {
|
||||
*/
|
||||
@GetMapping(path = "")
|
||||
public List<PaperQuestionVO> queryQuestions(@RequestAttribute LoginUserInfoVO loginInfo, QuestionQueryVO queryVO) {
|
||||
|
||||
queryVO.setOrgId(loginInfo.getTopOrgId());
|
||||
return questionBankService.queryQuestions(queryVO,false);
|
||||
}
|
||||
|
@ -2,11 +2,14 @@ package club.joylink.rtss.controller.training2;
|
||||
|
||||
import club.joylink.rtss.services.training2.Training2DraftPublishService;
|
||||
import club.joylink.rtss.vo.AccountVO;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.training2.draft.TrainingDraftPublishReqVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static club.joylink.rtss.controller.advice.AuthenticateInterceptor.LOGIN_INFO_KEY;
|
||||
|
||||
/**
|
||||
* 实训草稿发布管理接口
|
||||
*/
|
||||
@ -20,7 +23,7 @@ public class TrainingDraftV2PublishController {
|
||||
* 当前用户发布自己的实训草稿
|
||||
*/
|
||||
@PostMapping
|
||||
public void draftPublish(@RequestBody TrainingDraftPublishReqVo req, @RequestAttribute AccountVO user){
|
||||
this.publishService.draftPublish(req,user.getId());
|
||||
public void draftPublish(@RequestBody TrainingDraftPublishReqVo req, @RequestAttribute(name = LOGIN_INFO_KEY)LoginUserInfoVO userInfo){
|
||||
this.publishService.draftPublish(req,userInfo.getAccountVO().getId(),userInfo.getTopOrgId());
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package club.joylink.rtss.entity.training2;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@ -69,5 +70,7 @@ public class PublishedTraining2 implements Serializable {
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
private Long orgId;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package club.joylink.rtss.entity.training2;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class PublishedTraining2Example {
|
||||
@ -795,52 +795,52 @@ public class PublishedTraining2Example {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeEqualTo(LocalDateTime value) {
|
||||
public Criteria andCreateTimeEqualTo(Date value) {
|
||||
addCriterion("create_time =", value, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeNotEqualTo(LocalDateTime value) {
|
||||
public Criteria andCreateTimeNotEqualTo(Date value) {
|
||||
addCriterion("create_time <>", value, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeGreaterThan(LocalDateTime value) {
|
||||
public Criteria andCreateTimeGreaterThan(Date value) {
|
||||
addCriterion("create_time >", value, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeGreaterThanOrEqualTo(LocalDateTime value) {
|
||||
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
|
||||
addCriterion("create_time >=", value, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeLessThan(LocalDateTime value) {
|
||||
public Criteria andCreateTimeLessThan(Date value) {
|
||||
addCriterion("create_time <", value, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeLessThanOrEqualTo(LocalDateTime value) {
|
||||
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
|
||||
addCriterion("create_time <=", value, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeIn(List<LocalDateTime> values) {
|
||||
public Criteria andCreateTimeIn(List<Date> values) {
|
||||
addCriterion("create_time in", values, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeNotIn(List<LocalDateTime> values) {
|
||||
public Criteria andCreateTimeNotIn(List<Date> values) {
|
||||
addCriterion("create_time not in", values, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeBetween(LocalDateTime value1, LocalDateTime value2) {
|
||||
public Criteria andCreateTimeBetween(Date value1, Date value2) {
|
||||
addCriterion("create_time between", value1, value2, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeNotBetween(LocalDateTime value1, LocalDateTime value2) {
|
||||
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
|
||||
addCriterion("create_time not between", value1, value2, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
@ -855,52 +855,52 @@ public class PublishedTraining2Example {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeEqualTo(LocalDateTime value) {
|
||||
public Criteria andUpdateTimeEqualTo(Date value) {
|
||||
addCriterion("update_time =", value, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeNotEqualTo(LocalDateTime value) {
|
||||
public Criteria andUpdateTimeNotEqualTo(Date value) {
|
||||
addCriterion("update_time <>", value, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeGreaterThan(LocalDateTime value) {
|
||||
public Criteria andUpdateTimeGreaterThan(Date value) {
|
||||
addCriterion("update_time >", value, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeGreaterThanOrEqualTo(LocalDateTime value) {
|
||||
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
|
||||
addCriterion("update_time >=", value, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeLessThan(LocalDateTime value) {
|
||||
public Criteria andUpdateTimeLessThan(Date value) {
|
||||
addCriterion("update_time <", value, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeLessThanOrEqualTo(LocalDateTime value) {
|
||||
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
|
||||
addCriterion("update_time <=", value, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeIn(List<LocalDateTime> values) {
|
||||
public Criteria andUpdateTimeIn(List<Date> values) {
|
||||
addCriterion("update_time in", values, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeNotIn(List<LocalDateTime> values) {
|
||||
public Criteria andUpdateTimeNotIn(List<Date> values) {
|
||||
addCriterion("update_time not in", values, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeBetween(LocalDateTime value1, LocalDateTime value2) {
|
||||
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
|
||||
addCriterion("update_time between", value1, value2, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeNotBetween(LocalDateTime value1, LocalDateTime value2) {
|
||||
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
|
||||
addCriterion("update_time not between", value1, value2, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
@ -964,6 +964,66 @@ public class PublishedTraining2Example {
|
||||
addCriterion("`state` not between", value1, value2, "state");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdIsNull() {
|
||||
addCriterion("org_id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdIsNotNull() {
|
||||
addCriterion("org_id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdEqualTo(Long value) {
|
||||
addCriterion("org_id =", value, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdNotEqualTo(Long value) {
|
||||
addCriterion("org_id <>", value, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdGreaterThan(Long value) {
|
||||
addCriterion("org_id >", value, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("org_id >=", value, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdLessThan(Long value) {
|
||||
addCriterion("org_id <", value, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdLessThanOrEqualTo(Long value) {
|
||||
addCriterion("org_id <=", value, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdIn(List<Long> values) {
|
||||
addCriterion("org_id in", values, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdNotIn(List<Long> values) {
|
||||
addCriterion("org_id not in", values, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdBetween(Long value1, Long value2) {
|
||||
addCriterion("org_id between", value1, value2, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andOrgIdNotBetween(Long value1, Long value2) {
|
||||
addCriterion("org_id not between", value1, value2, "orgId");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -40,7 +40,7 @@ public class PublishedTraining2WithBLOBs extends PublishedTraining2 implements S
|
||||
private String playerIdJson;
|
||||
|
||||
/**
|
||||
* 实训编制后的最终场景json数据
|
||||
* 实训编制后的最终场景json数据(删掉)
|
||||
*/
|
||||
private String finalScenesJson;
|
||||
|
||||
|
@ -35,5 +35,13 @@ public interface MinioService {
|
||||
*/
|
||||
void update(MinioFileInfo fileInfo);
|
||||
|
||||
/**
|
||||
* 获取带有验证信息的下载路径
|
||||
*/
|
||||
String downloadObjectUrl(String directory, String fileName);
|
||||
|
||||
/**
|
||||
* 检查文件是否存在
|
||||
*/
|
||||
boolean checkFileIsExist(String directory, String fileName);
|
||||
}
|
||||
|
@ -86,4 +86,9 @@ public class MinioServiceImpl implements MinioService {
|
||||
MinioClientUtil minioClientUtil = createMinioClientUtil(directory);
|
||||
return minioClientUtil.getDownLoadPath(fileName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkFileIsExist(String directory, String fileName) {
|
||||
return createMinioClientUtil(directory).checkFileIsExist(fileName);
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +105,14 @@ public class OrgProjectService implements IOrgProjectService {
|
||||
if (CollectionUtils.isEmpty(orgUserList)) {
|
||||
throw new SimulationException(SimulationExceptionType.Illegal_Argument);
|
||||
}
|
||||
loginInfo.setOrgProjectVO(new OrgProjectVO(topOrg));
|
||||
// 是否是顶级组织的管理员
|
||||
OrgUser orgUser = orgUserList.stream().filter(o -> loginInfo.getAccountVO().getId().longValue() == o.getUserId().longValue()
|
||||
&& o.getOrgId().longValue() == orgId.longValue()).findFirst().orElse(null);
|
||||
OrgProjectVO orgProjectVO = new OrgProjectVO(topOrg);
|
||||
if (orgUser != null) {
|
||||
orgProjectVO.setRole(orgUser.getRole());
|
||||
}
|
||||
loginInfo.setOrgProjectVO(orgProjectVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -45,7 +45,7 @@ public class PagerQuestionService {
|
||||
*/
|
||||
private Object queryQuestions(QuestionQueryVO queryVO, boolean isPaging,boolean companyIdCanNull){
|
||||
if(Objects.equals(false,companyIdCanNull)){
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(queryVO.getOrgId()),"题目答案不能为空");
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(queryVO.getOrgId()),"用户组织信息不能为空");
|
||||
}
|
||||
if(isPaging){
|
||||
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
|
||||
@ -236,7 +236,7 @@ public class PagerQuestionService {
|
||||
public void importProjectQuestion(List<PaperQuestionVO> questions, Long companyId, AccountVO accountVO) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.isNull(companyId),"组织id不能为空");
|
||||
questions.forEach(questionVO -> {
|
||||
String topic = questionVO.getQuestion();
|
||||
String topic = questionVO.getTopic();
|
||||
this.checkQuestionType(questionVO,String.format("题库目前只支持单选,多选和判断,题序[%s]",questionVO.getId()));
|
||||
if (questionVO.isSelect() || questionVO.isJudge()) {
|
||||
this.checkQuestionTypeForSelectAndJudge(questionVO,String.format("题序[%s]:单选或判断题[%s]正确答案应当有且只有一个!", questionVO.getId(),topic));
|
||||
|
@ -6,8 +6,10 @@ import club.joylink.rtss.entity.training2.PublishedTraining2;
|
||||
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 java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
public class Training2Convertor {
|
||||
public static DraftTraining2InfoVo convertFrom(DraftTraining2 dt){
|
||||
@ -52,6 +54,13 @@ public class Training2Convertor {
|
||||
//
|
||||
return pub;
|
||||
}
|
||||
|
||||
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());
|
||||
|
@ -29,7 +29,7 @@ public class Training2DraftPublishService {
|
||||
* 草稿发布
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void draftPublish(TrainingDraftPublishReqVo req, Long userId) {
|
||||
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);
|
||||
@ -48,6 +48,7 @@ public class Training2DraftPublishService {
|
||||
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()){//同地图同名已发布实训不存在则直接存入
|
||||
//发布
|
||||
|
@ -6,15 +6,19 @@ import club.joylink.rtss.entity.training2.PublishedTraining2Example;
|
||||
import club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.training2.publish.*;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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.util.StringUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 已发布实训管理业务实现
|
||||
@ -38,12 +42,45 @@ public class Training2PublishService {
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public PageVO<PublishedTraining2InfoRspVo> publishedTrainingsPage(PublishedTraining2InfoPageReqVo req){
|
||||
PageVO<PublishedTraining2InfoRspVo> page = new PageVO<>();
|
||||
|
||||
PageHelper.startPage(req.getPageNum(),req.getPageSize());
|
||||
PublishedTraining2Example example = new PublishedTraining2Example();
|
||||
PublishedTraining2Example.Criteria c =example.createCriteria();
|
||||
if(null!=req.getState()){
|
||||
if(Objects.nonNull(req.getState())){
|
||||
c.andStateEqualTo(req.getState());
|
||||
}
|
||||
if(Objects.nonNull(req.getOrgId())){
|
||||
c.andOrgIdEqualTo(req.getOrgId());
|
||||
}
|
||||
if(Objects.nonNull(req.getMapId())){
|
||||
c.andMapIdEqualTo(req.getMapId());
|
||||
}
|
||||
if(Objects.nonNull(req.getType())){
|
||||
c.andTypeEqualTo(req.getType());
|
||||
}
|
||||
if(StringUtils.hasText(req.getName())){
|
||||
c.andNameLike(String.format("%%%s%%",req.getName()));
|
||||
}
|
||||
if(Objects.equals(false,CollectionUtils.isEmpty(req.getLabelLikes()))){
|
||||
for (String ll : req.getLabelLikes()) {
|
||||
c.andLabelJsonLike(String.format("%%%s%%",ll));
|
||||
}
|
||||
}
|
||||
String orderBy="create_time";
|
||||
switch(req.getOrderBy()){
|
||||
// case 1:orderBy="create_time";break;
|
||||
case 2:orderBy="update_time";break;
|
||||
case 3:orderBy="name";break;
|
||||
case 4:orderBy="state";break;
|
||||
}
|
||||
if(req.getDesc()){
|
||||
example.setOrderByClause(String.format(" %s desc",orderBy));
|
||||
}
|
||||
Page<PublishedTraining2> page = (Page<PublishedTraining2>)this.publishedDao.selectByExample(example);
|
||||
List<PublishedTraining2InfoRspVo> tmpList = Training2Convertor.convertFrom(page.getResult());
|
||||
|
||||
return PageVO.convert(page,tmpList);
|
||||
/* PageVO<PublishedTraining2InfoRspVo> page = new PageVO<>();
|
||||
long sum = this.publishedDao.countByExample(example);
|
||||
page.setTotal(sum);
|
||||
page.setPageNum(req.getPageNum());
|
||||
@ -75,7 +112,7 @@ public class Training2PublishService {
|
||||
}
|
||||
}
|
||||
//
|
||||
return page;
|
||||
return page;*/
|
||||
}
|
||||
/**
|
||||
* 已发布实训上架
|
||||
|
@ -5,6 +5,7 @@ import club.joylink.rtss.simulation.vo.SimulationFaultVO;
|
||||
import club.joylink.rtss.simulation.vo.SimulationInfoVO;
|
||||
import club.joylink.rtss.simulation.vo.SimulationMemberVO;
|
||||
import club.joylink.rtss.simulation.vo.SimulationUserVO;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.client.simulationv1.SimulationInfoQueryVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -13,9 +14,12 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static club.joylink.rtss.controller.advice.AuthenticateInterceptor.LOGIN_INFO_KEY;
|
||||
|
||||
/**
|
||||
* 仿真通用接口
|
||||
*/
|
||||
@ -28,6 +32,33 @@ public class SimulationCommonController {
|
||||
@Autowired
|
||||
private SimulationOperationDispatcher simulationOperationDispatcher;
|
||||
|
||||
/**
|
||||
* 监管仿真
|
||||
* @param loginUserInfoVO
|
||||
* @param queryVO
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/supervise")
|
||||
public List<SimulationInfoVO> superviseSimulation(@RequestAttribute(name=LOGIN_INFO_KEY) LoginUserInfoVO loginUserInfoVO, SimulationInfoQueryVO queryVO) {
|
||||
List<Simulation> simulationList = this.simulationManager.getSimulationList();
|
||||
Stream<Simulation> stream = simulationList.stream();
|
||||
|
||||
stream = stream.filter(simulation -> simulation instanceof club.joylink.rtss.simulation.cbtc.Simulation
|
||||
&& Objects.equals(loginUserInfoVO.getTopOrgId(),((club.joylink.rtss.simulation.cbtc.Simulation)simulation).getBuildParams().getLoginUserInfo().getTopOrgId()));
|
||||
|
||||
if (StringUtils.hasText(queryVO.getGroup())) {
|
||||
stream = stream.filter(simulation -> simulation.getId().contains(queryVO.getGroup()));
|
||||
}
|
||||
if (StringUtils.hasText(queryVO.getUserName())) {
|
||||
stream = stream.filter(simulation -> simulation.getSimulationUsers().stream().anyMatch(user -> ((SimulationUser) user).getName().contains(queryVO.getUserName())));
|
||||
}
|
||||
if (StringUtils.hasText(queryVO.getPrdType())) {
|
||||
stream = stream.filter(simulation -> simulation instanceof club.joylink.rtss.simulation.cbtc.Simulation
|
||||
&& queryVO.getPrdType().equals(((club.joylink.rtss.simulation.cbtc.Simulation) simulation).getBuildParams().getProdType().getCode()));
|
||||
}
|
||||
return stream.map(Simulation::convertToVO).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public List<SimulationInfoVO> queryInfo(SimulationInfoQueryVO queryVO) {
|
||||
List<Simulation> simulationList = this.simulationManager.getSimulationList();
|
||||
|
@ -20,12 +20,22 @@ import java.time.LocalDateTime;
|
||||
import java.util.Base64;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
public class MinioClientUtil {
|
||||
private final static String PATH_SEPARATOR = "/";
|
||||
|
||||
private final static String HTTP_PROTOCOL = "http:";
|
||||
|
||||
private final static String HTTPS_PROTOCOL = "https:";
|
||||
|
||||
/**
|
||||
* 用来判断生成链接是 http|https:// + IP + : + 端口
|
||||
*/
|
||||
private final static Pattern IP_PORT_PATTERN = Pattern.compile("(\\w+):\\/\\/([^/:]+)(:\\d*)");
|
||||
|
||||
private MinioClientConfig config;
|
||||
|
||||
/**
|
||||
@ -215,9 +225,10 @@ public class MinioClientUtil {
|
||||
|
||||
public String getDownLoadPathByPath(String path) {
|
||||
try {
|
||||
return config.getMinioClient().getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder()
|
||||
String downLoadPath = config.getMinioClient().getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder()
|
||||
.bucket(config.getBucket())
|
||||
.object(path).method(Method.GET).build());
|
||||
return pathProtocolReplace(downLoadPath);
|
||||
} catch (Exception e) {
|
||||
throw new SimulationException(SimulationExceptionType.System_Fault, e);
|
||||
}
|
||||
@ -230,13 +241,14 @@ public class MinioClientUtil {
|
||||
try {
|
||||
Map<String, String> reqParams = new HashMap<String, String>();
|
||||
reqParams.put("response-content-type", "application/json");
|
||||
return config.getMinioClient().getPresignedObjectUrl(
|
||||
String uploadPath = config.getMinioClient().getPresignedObjectUrl(
|
||||
GetPresignedObjectUrlArgs.builder().method(method)
|
||||
.bucket(config.getBucket()).object(getSavePath(fileName))
|
||||
.expiry(60 * 60 * 24)
|
||||
.extraQueryParams(reqParams)
|
||||
.build()
|
||||
);
|
||||
return pathProtocolReplace(uploadPath);
|
||||
} catch (Exception e) {
|
||||
throw new SimulationException(SimulationExceptionType.System_Fault, e);
|
||||
}
|
||||
@ -246,6 +258,21 @@ public class MinioClientUtil {
|
||||
return FileInfo.getStoragePath(directory, fileName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换访问协议
|
||||
*/
|
||||
private String pathProtocolReplace(String path) {
|
||||
String resultPath = path;
|
||||
// 判断是否是IP加端口模式,替换后会引起问题则不做处理
|
||||
if (IP_PORT_PATTERN.matcher(path).find()) {
|
||||
return path;
|
||||
}
|
||||
if (config.getReplaceHttps() != null && config.getReplaceHttps() && path.startsWith(HTTP_PROTOCOL)) {
|
||||
resultPath = path.replace(HTTP_PROTOCOL, HTTPS_PROTOCOL);
|
||||
}
|
||||
return resultPath;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class FileInfo {
|
||||
private String fileName;
|
||||
|
@ -13,6 +13,8 @@ public class OrgProjectVO {
|
||||
|
||||
private Long topOrgId;
|
||||
|
||||
private String role;
|
||||
|
||||
public OrgProjectVO(Org org) {
|
||||
this.orgId = org.getId();
|
||||
this.name = org.getName();
|
||||
|
@ -41,7 +41,7 @@ public class PaperQuestionVO implements Cloneable {
|
||||
*题目
|
||||
*/
|
||||
@NotBlank(message = "题目不能为空")
|
||||
private String question;
|
||||
private String topic;
|
||||
|
||||
/**
|
||||
*选项列表
|
||||
@ -67,7 +67,7 @@ public class PaperQuestionVO implements Cloneable {
|
||||
public PaperQuestionVO(PaperQuestionWithBLOBs question) {
|
||||
this.id = question.getId();
|
||||
this.type = question.getType();
|
||||
this.question = question.getQuestion();
|
||||
this.topic = question.getQuestion();
|
||||
// this.projectCode = question.getProjectCode();
|
||||
this.orgId = question.getOrgId();
|
||||
this.tags = question.getTags();
|
||||
@ -87,7 +87,7 @@ public class PaperQuestionVO implements Cloneable {
|
||||
PaperQuestionWithBLOBs question = new PaperQuestionWithBLOBs();
|
||||
question.setId(this.id);
|
||||
question.setType(type);
|
||||
question.setQuestion(this.question);
|
||||
question.setQuestion(this.topic);
|
||||
// question.setProjectCode(Project.isDefault(Project.valueOf(projectCode)) ? null : projectCode);
|
||||
question.setOrgId(this.orgId);
|
||||
this.setOptionId(question);
|
||||
|
@ -5,6 +5,8 @@ import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 分页获取实训基础信息的请求
|
||||
*/
|
||||
@ -34,4 +36,23 @@ public class PublishedTraining2InfoPageReqVo extends PageQueryVO {
|
||||
*/
|
||||
private Boolean desc = true;
|
||||
|
||||
/**
|
||||
* 实训名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 对应的组织id
|
||||
*/
|
||||
private Long orgId;
|
||||
/**
|
||||
* 地图id
|
||||
*/
|
||||
private Long mapId;
|
||||
|
||||
/**
|
||||
* 实训类型 (单操 single;场景scene)
|
||||
*/
|
||||
private String type;
|
||||
|
||||
private List<String> labelLikes;
|
||||
}
|
||||
|
@ -53,6 +53,8 @@ spring:
|
||||
# mybatis 设置
|
||||
mybatis:
|
||||
mapper-locations: classpath:mybatis/mapper/*.xml
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
pagehelper:
|
||||
helper-dialect: mysql
|
||||
reasonable: true
|
||||
@ -97,10 +99,11 @@ logging:
|
||||
club.joylink.rtss: DEBUG
|
||||
|
||||
minio:
|
||||
endpoint: https://192.168.3.233
|
||||
endpoint: http://192.168.3.233
|
||||
accessKey: jladmin
|
||||
secretKey: Joylink@0503
|
||||
bucket: oss-rtss
|
||||
replaceHttps: true
|
||||
|
||||
common:
|
||||
env: dev
|
||||
@ -124,10 +127,11 @@ logging:
|
||||
club.joylink.rtss: INFO
|
||||
|
||||
minio:
|
||||
endpoint: https://192.168.3.233
|
||||
endpoint: http://192.168.3.233
|
||||
accessKey: jladmin
|
||||
secretKey: Joylink@0503
|
||||
bucket: oss-rtss
|
||||
replaceHttps: true
|
||||
|
||||
common:
|
||||
env: test
|
||||
@ -151,10 +155,12 @@ logging:
|
||||
club.joylink.rtss: INFO
|
||||
|
||||
minio:
|
||||
endpoint: https://192.168.3.233
|
||||
endpoint: http://192.168.3.233
|
||||
accessKey: jladmin
|
||||
secretKey: Joylink@0503
|
||||
bucket: oss-rtss
|
||||
replaceHttps: true
|
||||
|
||||
|
||||
common:
|
||||
env: local
|
||||
@ -182,6 +188,7 @@ minio:
|
||||
accessKey: jladmin
|
||||
secretKey: Joylink@0503
|
||||
bucket: oss-rtss
|
||||
replaceHttps: false
|
||||
|
||||
common:
|
||||
env: test
|
||||
@ -208,6 +215,7 @@ minio:
|
||||
accessKey: jladmin
|
||||
secretKey: Joylink@0503
|
||||
bucket: oss-rtss
|
||||
replaceHttps: false
|
||||
|
||||
common:
|
||||
env: prd
|
||||
|
@ -15,9 +15,9 @@
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="state" jdbcType="INTEGER" property="state" />
|
||||
<result column="org_id" jdbcType="BIGINT" property="orgId" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs"
|
||||
type="club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs">
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs">
|
||||
<result column="bg_scene_json" jdbcType="LONGVARCHAR" property="bgSceneJson" />
|
||||
<result column="opera_json" jdbcType="LONGVARCHAR" property="operaJson" />
|
||||
<result column="step_json" jdbcType="LONGVARCHAR" property="stepJson" />
|
||||
@ -44,8 +44,7 @@
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="("
|
||||
separator=",">
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
@ -74,8 +73,7 @@
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="("
|
||||
separator=",">
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
@ -88,14 +86,13 @@
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, `name`, map_id, description, `type`, label_json, map_location_json, run_plan_id,
|
||||
failure_condition_json, creator_id, create_time, update_time, `state`
|
||||
failure_condition_json, creator_id, create_time, update_time, `state`, org_id
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
bg_scene_json, opera_json, step_json, scoring_rule_json, member_json, player_id_json,
|
||||
final_scenes_json
|
||||
</sql>
|
||||
<select id="selectByExampleWithBLOBs" parameterType="club.joylink.rtss.entity.training2.PublishedTraining2Example"
|
||||
resultMap="ResultMapWithBLOBs">
|
||||
<select id="selectByExampleWithBLOBs" parameterType="club.joylink.rtss.entity.training2.PublishedTraining2Example" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
@ -119,8 +116,7 @@
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByExample" parameterType="club.joylink.rtss.entity.training2.PublishedTraining2Example"
|
||||
resultMap="BaseResultMap">
|
||||
<select id="selectByExample" parameterType="club.joylink.rtss.entity.training2.PublishedTraining2Example" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
@ -165,16 +161,18 @@
|
||||
description, `type`, label_json,
|
||||
map_location_json, run_plan_id, failure_condition_json,
|
||||
creator_id, create_time, update_time,
|
||||
`state`, bg_scene_json, opera_json,
|
||||
step_json, scoring_rule_json, member_json,
|
||||
player_id_json, final_scenes_json)
|
||||
`state`, org_id, bg_scene_json,
|
||||
opera_json, step_json, scoring_rule_json,
|
||||
member_json, player_id_json, final_scenes_json
|
||||
)
|
||||
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{mapId,jdbcType=BIGINT},
|
||||
#{description,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{labelJson,jdbcType=VARCHAR},
|
||||
#{mapLocationJson,jdbcType=VARCHAR}, #{runPlanId,jdbcType=BIGINT}, #{failureConditionJson,jdbcType=VARCHAR},
|
||||
#{creatorId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
|
||||
#{state,jdbcType=INTEGER}, #{bgSceneJson,jdbcType=LONGVARCHAR}, #{operaJson,jdbcType=LONGVARCHAR},
|
||||
#{stepJson,jdbcType=LONGVARCHAR}, #{scoringRuleJson,jdbcType=LONGVARCHAR}, #{memberJson,jdbcType=LONGVARCHAR},
|
||||
#{playerIdJson,jdbcType=LONGVARCHAR}, #{finalScenesJson,jdbcType=LONGVARCHAR})
|
||||
#{state,jdbcType=INTEGER}, #{orgId,jdbcType=BIGINT}, #{bgSceneJson,jdbcType=LONGVARCHAR},
|
||||
#{operaJson,jdbcType=LONGVARCHAR}, #{stepJson,jdbcType=LONGVARCHAR}, #{scoringRuleJson,jdbcType=LONGVARCHAR},
|
||||
#{memberJson,jdbcType=LONGVARCHAR}, #{playerIdJson,jdbcType=LONGVARCHAR}, #{finalScenesJson,jdbcType=LONGVARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs">
|
||||
insert into published_training2
|
||||
@ -218,6 +216,9 @@
|
||||
<if test="state != null">
|
||||
`state`,
|
||||
</if>
|
||||
<if test="orgId != null">
|
||||
org_id,
|
||||
</if>
|
||||
<if test="bgSceneJson != null">
|
||||
bg_scene_json,
|
||||
</if>
|
||||
@ -280,6 +281,9 @@
|
||||
<if test="state != null">
|
||||
#{state,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="orgId != null">
|
||||
#{orgId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="bgSceneJson != null">
|
||||
#{bgSceneJson,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
@ -303,8 +307,7 @@
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="club.joylink.rtss.entity.training2.PublishedTraining2Example"
|
||||
resultType="java.lang.Long">
|
||||
<select id="countByExample" parameterType="club.joylink.rtss.entity.training2.PublishedTraining2Example" resultType="java.lang.Long">
|
||||
select count(*) from published_training2
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
@ -352,6 +355,9 @@
|
||||
<if test="record.state != null">
|
||||
`state` = #{record.state,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.orgId != null">
|
||||
org_id = #{record.orgId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.bgSceneJson != null">
|
||||
bg_scene_json = #{record.bgSceneJson,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
@ -393,6 +399,7 @@
|
||||
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
|
||||
`state` = #{record.state,jdbcType=INTEGER},
|
||||
org_id = #{record.orgId,jdbcType=BIGINT},
|
||||
bg_scene_json = #{record.bgSceneJson,jdbcType=LONGVARCHAR},
|
||||
opera_json = #{record.operaJson,jdbcType=LONGVARCHAR},
|
||||
step_json = #{record.stepJson,jdbcType=LONGVARCHAR},
|
||||
@ -418,13 +425,13 @@
|
||||
creator_id = #{record.creatorId,jdbcType=BIGINT},
|
||||
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
|
||||
`state` = #{record.state,jdbcType=INTEGER}
|
||||
`state` = #{record.state,jdbcType=INTEGER},
|
||||
org_id = #{record.orgId,jdbcType=BIGINT}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective"
|
||||
parameterType="club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs">
|
||||
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs">
|
||||
update published_training2
|
||||
<set>
|
||||
<if test="name != null">
|
||||
@ -463,6 +470,9 @@
|
||||
<if test="state != null">
|
||||
`state` = #{state,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="orgId != null">
|
||||
org_id = #{orgId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="bgSceneJson != null">
|
||||
bg_scene_json = #{bgSceneJson,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
@ -487,8 +497,7 @@
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKeyWithBLOBs"
|
||||
parameterType="club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs">
|
||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="club.joylink.rtss.entity.training2.PublishedTraining2WithBLOBs">
|
||||
update published_training2
|
||||
set `name` = #{name,jdbcType=VARCHAR},
|
||||
map_id = #{mapId,jdbcType=BIGINT},
|
||||
@ -502,6 +511,7 @@
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
`state` = #{state,jdbcType=INTEGER},
|
||||
org_id = #{orgId,jdbcType=BIGINT},
|
||||
bg_scene_json = #{bgSceneJson,jdbcType=LONGVARCHAR},
|
||||
opera_json = #{operaJson,jdbcType=LONGVARCHAR},
|
||||
step_json = #{stepJson,jdbcType=LONGVARCHAR},
|
||||
@ -524,7 +534,8 @@
|
||||
creator_id = #{creatorId,jdbcType=BIGINT},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
`state` = #{state,jdbcType=INTEGER}
|
||||
`state` = #{state,jdbcType=INTEGER},
|
||||
org_id = #{orgId,jdbcType=BIGINT}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user