| | |
| | | }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 -> { |
| | |
| | | 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); |
| | | } |