From cf1fc0bcd00d62c0eed7934a21949edcab8849fb Mon Sep 17 00:00:00 2001 From: “djh” <“3298565835@qq.com”> Date: 星期二, 22 七月 2025 10:15:01 +0800 Subject: [PATCH] 修改 --- multi-system/src/main/java/com/gkhy/exam/system/service/impl/ExExamPaperServiceImpl.java | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/ExExamPaperServiceImpl.java b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/ExExamPaperServiceImpl.java index 0b7b717..efc95ee 100644 --- a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/ExExamPaperServiceImpl.java +++ b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/ExExamPaperServiceImpl.java @@ -212,7 +212,7 @@ }else{//顺序分配 int totalPage=totalQuestionCount/questionCount;//不能整除,忽略最后一页 Random random=new Random(); - int startIndex=random.nextInt(totalPage)+1; + int startIndex=random.nextInt(totalPage); questions=questionMapper.selectQuestionWithLimit(currentUser.getCompanyId(), bankId,questionTypeEnum.getCode(),startIndex, questionCount); } List<ExPaperQuestion> paperQuestionList=questions.stream().map(item -> { @@ -249,19 +249,19 @@ throw new ApiException("更新试卷失败"); } //重新分配题 - if(examPaper.getSingleRebuild()==1){ + if(examPaper.getSingleNum()!=null && examPaper.getSingleRebuild()==1 && examPaper.getSingleNum()>0 ){ deletePaperQuestion(examPaper.getId(),QuestionTypeEnum.SINGLE); assignSingleQuestion(examPaper); } - if(examPaper.getMultiRebuild()==1) { + if( examPaper.getMultiNum()!=null && examPaper.getMultiRebuild()==1 && examPaper.getMultiNum()>0) { deletePaperQuestion(examPaper.getId(),QuestionTypeEnum.MULTI); assignMultiQuestion(examPaper); } - if(examPaper.getJudgeRebuild()==1) { + if(examPaper.getJudgeNum()!=null && examPaper.getJudgeRebuild()==1 && examPaper.getJudgeNum()>0) { deletePaperQuestion(examPaper.getId(),QuestionTypeEnum.JUDGE); assignJudgeQuestion(examPaper); } - if(examPaper.getEasyRebuild()==1) { + if(examPaper.getEasyNum()!=null && examPaper.getEasyRebuild()==1 && examPaper.getEasyNum()>0) { deletePaperQuestion(examPaper.getId(),QuestionTypeEnum.EASY); assignEasyQuestion(examPaper); } -- Gitblit v1.9.2