导入试题提示修改
This commit is contained in:
parent
dbfd391799
commit
f2a137379b
@ -1,5 +1,9 @@
|
||||
package club.joylink.rtss.exception;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class BaseException extends RuntimeException {
|
||||
|
||||
private IExceptionMessage exceptionMessage;
|
||||
@ -29,6 +33,9 @@ public class BaseException extends RuntimeException {
|
||||
}
|
||||
|
||||
public String getVoMessage() {
|
||||
if (!StringUtils.isEmpty(super.getMessage())) {
|
||||
return super.getMessage();
|
||||
}
|
||||
return this.exceptionMessage.getMessage();
|
||||
}
|
||||
}
|
||||
|
@ -180,21 +180,21 @@ public class QuestionBankService implements IQuestionBankService {
|
||||
if (questionVO.isSelect() || questionVO.isJudge()) {
|
||||
long answerCount = questionVO.getOptionList().stream().filter(QuestionOptionVO::getCorrect).count();
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(answerCount == 1,
|
||||
String.format("单选或判断题[%s]正确答案应当有且只有一个!", topic));
|
||||
String.format("题序[%s]:单选或判断题[%s]正确答案应当有且只有一个!", questionVO.getId(),topic));
|
||||
}
|
||||
if (questionVO.isFill() || questionVO.isAnswer()) {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(
|
||||
questionVO.getOptionList().stream().allMatch(QuestionOptionVO::getCorrect),
|
||||
String.format("填空或问答题[%s]不能有错误选项!", topic));
|
||||
String.format("题序[%s]:填空或问答题[%s]不能有错误选项!", questionVO.getId(),topic));
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(
|
||||
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()))) {
|
||||
questionVO.getOptionList().sort(Comparator.comparing(QuestionOptionVO::getOrder));
|
||||
AtomicInteger i = new AtomicInteger(1);
|
||||
questionVO.getOptionList().forEach(o -> {
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertEquals(o.getOrder(), i.getAndIncrement(),
|
||||
String.format("填空或问答题[%s]选项序号不对!", topic));
|
||||
String.format("题序[%s]:填空或问答题[%s]选项序号不对!", questionVO.getId(), topic));
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -33,6 +33,12 @@ public class UserQueryVO extends PageQueryVO {
|
||||
@ApiModelProperty(value = "手机号")
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
* 单位名称
|
||||
*/
|
||||
@ApiModelProperty(value = "单位名称")
|
||||
private String companyId;
|
||||
|
||||
/**
|
||||
* 角色
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user