Merge branch 'test-training2' of https://git.code.tencent.com/lian-cbtc/rtss-server into test-training2-xzb1

This commit is contained in:
xzb 2022-10-14 17:51:41 +08:00
commit b3ecb6c1d2
2 changed files with 23 additions and 19 deletions

View File

@ -92,8 +92,8 @@ public class PagerQuestionBankController {
* *
*/ */
@GetMapping(path = "/org/lable") @GetMapping(path = "/org/lable")
public Collection<String> findAllLable(@RequestAttribute LoginUserInfoVO loginInfo) { public Collection<String> findAllLable(@RequestAttribute LoginUserInfoVO loginInfo,@RequestParam(name="type",required = false) String type) {
return this.questionBankService.findAllLable(loginInfo.getTopOrgId()); return this.questionBankService.findAllLable(loginInfo.getTopOrgId() ,type);
} }
/** /**

View File

@ -39,13 +39,13 @@ public class PagerQuestionService {
/** /**
* 创建对应的查询example * 创建对应的查询example
* @param queryVO * @param queryVO 查询对象
* @param isPaging * @param isPaging 是否分页
* @param companyIdCanNull * @param orgIdCanNull orgId是否可以为空
* @return * @return 查询example
*/ */
private PaperQuestionExample createQueryExample(QuestionQueryVO queryVO, boolean isPaging,boolean companyIdCanNull){ private PaperQuestionExample createQueryExample(QuestionQueryVO queryVO, boolean isPaging,boolean orgIdCanNull){
if(Objects.equals(false,companyIdCanNull)){ if(Objects.equals(false,orgIdCanNull)){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(queryVO.getOrgId()),"用户组织信息不能为空"); BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(queryVO.getOrgId()),"用户组织信息不能为空");
} }
if(isPaging){ if(isPaging){
@ -65,6 +65,7 @@ public class PagerQuestionService {
} }
if(Objects.nonNull(queryVO.getLabels())){ if(Objects.nonNull(queryVO.getLabels())){
List<String> tmpLableList = Splitter.on(",").omitEmptyStrings().splitToList(queryVO.getLabels()); List<String> tmpLableList = Splitter.on(",").omitEmptyStrings().splitToList(queryVO.getLabels());
if(Objects.equals(false,CollectionUtils.isEmpty(tmpLableList))){ if(Objects.equals(false,CollectionUtils.isEmpty(tmpLableList))){
StringBuilder sqlBuilder = new StringBuilder("("); StringBuilder sqlBuilder = new StringBuilder("(");
@ -83,7 +84,7 @@ public class PagerQuestionService {
addCriterion.setAccessible(true); addCriterion.setAccessible(true);
addCriterion.invoke(criteria, sqlBuilder.toString()); addCriterion.invoke(criteria, sqlBuilder.toString());
}catch (Exception e){ }catch (Exception e){
log.error("拼写查询标签错误 msg:" + e.getMessage(),e);
} }
} }
} }
@ -99,6 +100,7 @@ public class PagerQuestionService {
* @return * @return
*/ */
public long queryCount(Long orgId,BusinessConsts.TheoryType type,String labels){ public long queryCount(Long orgId,BusinessConsts.TheoryType type,String labels){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId),"组织信息不能为空");
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(type == BusinessConsts.TheoryType.select BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(type == BusinessConsts.TheoryType.select
|| type == BusinessConsts.TheoryType.multi || type == BusinessConsts.TheoryType.multi
|| type == BusinessConsts.TheoryType.judge ,"查询类型只支持单选,多选,选择"); || type == BusinessConsts.TheoryType.judge ,"查询类型只支持单选,多选,选择");
@ -146,9 +148,10 @@ public class PagerQuestionService {
*/ */
public PaperQuestionVO getQuestion(Long questionId,boolean doNotCheckDel,boolean random) { public PaperQuestionVO getQuestion(Long questionId,boolean doNotCheckDel,boolean random) {
PaperQuestionWithBLOBs question = questionDAO.selectByPrimaryKey(questionId); PaperQuestionWithBLOBs question = questionDAO.selectByPrimaryKey(questionId);
boolean isDel = Objects.nonNull(question) || question.getIsDel() == BusinessConsts.DBLogicDelete.NORMAL.ordinal(); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(Objects.nonNull(question),"没有找到对应的数据");
boolean isDel = question.getIsDel() == BusinessConsts.DBLogicDelete.NORMAL.ordinal();
if(doNotCheckDel){ if(doNotCheckDel){
isDel = Objects.nonNull(question); isDel = true;
} }
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(isDel); BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(isDel);
PaperQuestionVO questionVO = new PaperQuestionVO(question); PaperQuestionVO questionVO = new PaperQuestionVO(question);
@ -188,16 +191,17 @@ public class PagerQuestionService {
* 获取所有公司组织下的标签 * 获取所有公司组织下的标签
* *
*/ */
public Collection<String> findAllLable(Long companyId){ public Collection<String> findAllLable(Long orgId,String type){
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(companyId),"组织id不能为空"); BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.nonNull(orgId),"组织id不能为空");
PaperQuestionExample example = new PaperQuestionExample(); PaperQuestionExample example = new PaperQuestionExample();
PaperQuestionExample.Criteria criteria = example.createCriteria(); PaperQuestionExample.Criteria criteria = example.createCriteria();
/*boolean isDefault = Project.isDefault(projectCode); if(Objects.nonNull(type)){
if(Objects.equals(false,isDefault)){ BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(Objects.equals(type,BusinessConsts.TheoryType.select.name())
List<Long> ids = this.queryFromProjectCode(projectCode); ||Objects.equals(type,BusinessConsts.TheoryType.multi.name())
criteria.andCompanyIdIn(ids); ||Objects.equals(type,BusinessConsts.TheoryType.judge.name()),"查询类型只支持单选,多选,选择");
}*/ criteria.andTypeEqualTo(type);
criteria.andOrgIdEqualTo(companyId); }
criteria.andOrgIdEqualTo(orgId);
criteria.andIsDelEqualTo(BusinessConsts.DBLogicDelete.NORMAL.ordinal()); criteria.andIsDelEqualTo(BusinessConsts.DBLogicDelete.NORMAL.ordinal());
List<PaperQuestion> lableList = this.questionDAO.selectByExample(example); List<PaperQuestion> lableList = this.questionDAO.selectByExample(example);
if(CollectionUtils.isEmpty(lableList)){ if(CollectionUtils.isEmpty(lableList)){