导入试题提示修改

This commit is contained in:
DU 2020-12-01 18:36:04 +08:00
parent dbfd391799
commit f2a137379b
3 changed files with 17 additions and 4 deletions

View File

@ -1,5 +1,9 @@
package club.joylink.rtss.exception; package club.joylink.rtss.exception;
import org.springframework.util.StringUtils;
import java.util.Objects;
public class BaseException extends RuntimeException { public class BaseException extends RuntimeException {
private IExceptionMessage exceptionMessage; private IExceptionMessage exceptionMessage;
@ -29,6 +33,9 @@ public class BaseException extends RuntimeException {
} }
public String getVoMessage() { public String getVoMessage() {
if (!StringUtils.isEmpty(super.getMessage())) {
return super.getMessage();
}
return this.exceptionMessage.getMessage(); return this.exceptionMessage.getMessage();
} }
} }

View File

@ -180,21 +180,21 @@ public class QuestionBankService implements IQuestionBankService {
if (questionVO.isSelect() || questionVO.isJudge()) { if (questionVO.isSelect() || questionVO.isJudge()) {
long answerCount = questionVO.getOptionList().stream().filter(QuestionOptionVO::getCorrect).count(); long answerCount = questionVO.getOptionList().stream().filter(QuestionOptionVO::getCorrect).count();
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(answerCount == 1, BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(answerCount == 1,
String.format("单选或判断题[%s]正确答案应当有且只有一个!", topic)); String.format("题序[%s]:单选或判断题[%s]正确答案应当有且只有一个!", questionVO.getId(),topic));
} }
if (questionVO.isFill() || questionVO.isAnswer()) { if (questionVO.isFill() || questionVO.isAnswer()) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue( BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(
questionVO.getOptionList().stream().allMatch(QuestionOptionVO::getCorrect), questionVO.getOptionList().stream().allMatch(QuestionOptionVO::getCorrect),
String.format("填空或问答题[%s]不能有错误选项!", topic)); String.format("题序[%s]:填空或问答题[%s]不能有错误选项!", questionVO.getId(),topic));
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue( BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(
questionVO.getOptionList().stream().noneMatch(op -> Objects.isNull(op.getOrder())), questionVO.getOptionList().stream().noneMatch(op -> Objects.isNull(op.getOrder())),
String.format("填空或问答题[%s]选项缺少序号!", topic)); String.format("题序[%s]:填空或问答题[%s]选项缺少序号!", questionVO.getId(),topic));
if (questionVO.getOptionList().stream().anyMatch(op -> Objects.isNull(op.getOrder()))) { if (questionVO.getOptionList().stream().anyMatch(op -> Objects.isNull(op.getOrder()))) {
questionVO.getOptionList().sort(Comparator.comparing(QuestionOptionVO::getOrder)); questionVO.getOptionList().sort(Comparator.comparing(QuestionOptionVO::getOrder));
AtomicInteger i = new AtomicInteger(1); AtomicInteger i = new AtomicInteger(1);
questionVO.getOptionList().forEach(o -> { questionVO.getOptionList().forEach(o -> {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertEquals(o.getOrder(), i.getAndIncrement(), BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertEquals(o.getOrder(), i.getAndIncrement(),
String.format("填空或问答题[%s]选项序号不对!", topic)); String.format("题序[%s]:填空或问答题[%s]选项序号不对!", questionVO.getId(), topic));
}); });
} }

View File

@ -33,6 +33,12 @@ public class UserQueryVO extends PageQueryVO {
@ApiModelProperty(value = "手机号") @ApiModelProperty(value = "手机号")
private String mobile; private String mobile;
/**
* 单位名称
*/
@ApiModelProperty(value = "单位名称")
private String companyId;
/** /**
* 角色 * 角色
*/ */