From f2a137379ba378e3335bee1837dcba1e62fd7f98 Mon Sep 17 00:00:00 2001 From: DU Date: Tue, 1 Dec 2020 18:36:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E8=AF=95=E9=A2=98=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/club/joylink/rtss/exception/BaseException.java | 7 +++++++ .../completition/question/QuestionBankService.java | 8 ++++---- src/main/java/club/joylink/rtss/vo/UserQueryVO.java | 6 ++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/main/java/club/joylink/rtss/exception/BaseException.java b/src/main/java/club/joylink/rtss/exception/BaseException.java index cead3a6eb..d53be11d4 100644 --- a/src/main/java/club/joylink/rtss/exception/BaseException.java +++ b/src/main/java/club/joylink/rtss/exception/BaseException.java @@ -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(); } } diff --git a/src/main/java/club/joylink/rtss/services/completition/question/QuestionBankService.java b/src/main/java/club/joylink/rtss/services/completition/question/QuestionBankService.java index 167b275dc..fa69935b0 100644 --- a/src/main/java/club/joylink/rtss/services/completition/question/QuestionBankService.java +++ b/src/main/java/club/joylink/rtss/services/completition/question/QuestionBankService.java @@ -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)); }); } diff --git a/src/main/java/club/joylink/rtss/vo/UserQueryVO.java b/src/main/java/club/joylink/rtss/vo/UserQueryVO.java index 30c8a66f2..75679d661 100644 --- a/src/main/java/club/joylink/rtss/vo/UserQueryVO.java +++ b/src/main/java/club/joylink/rtss/vo/UserQueryVO.java @@ -33,6 +33,12 @@ public class UserQueryVO extends PageQueryVO { @ApiModelProperty(value = "手机号") private String mobile; + /** + * 单位名称 + */ + @ApiModelProperty(value = "单位名称") + private String companyId; + /** * 角色 */