| | |
| | | import com.ycl.jxkg.domain.exam.PaperFixQuestionDTO; |
| | | import com.ycl.jxkg.domain.exam.PaperQuestion; |
| | | import com.ycl.jxkg.domain.exam.PaperQuestionSettingDTO; |
| | | import com.ycl.jxkg.domain.exam.PaperSettingItem; |
| | | import com.ycl.jxkg.domain.form.AddTimeForm; |
| | | import com.ycl.jxkg.domain.form.ExamForm; |
| | | import com.ycl.jxkg.domain.form.ForceSubmitForm; |
| | |
| | | PaperFixQuestionVO paperFixQuestionVO = new PaperFixQuestionVO(); |
| | | paperFixQuestionVO.setTitle(paperSetting.getTitle()); |
| | | paperFixQuestionVO.setQuestionType(paperSetting.getQuestionType()); |
| | | // 拿到课目下某类题型的x道随机题 |
| | | List<Question> questions = questionMapper.getRandomQuestion(examPaper.getSubjectId(), paperSetting.getQuestionType(), paperSetting.getNum()); |
| | | if (paperSetting.getNum() > questions.size()) { |
| | | //一个类型的题目list |
| | | List<DoQuestionVO> childQuestionList = new ArrayList<>(); |
| | | List<PaperSettingItem> settingList = paperSetting.getSettingList(); |
| | | for (PaperSettingItem settingItem : settingList) { |
| | | Integer num = settingItem.getNum(); |
| | | Integer difficult = settingItem.getDifficult(); |
| | | //需要配置的题目数量为0则跳过 |
| | | if (num == null || num == 0) continue; |
| | | List<Question> questions = questionMapper.getRandomQuestion(settingItem.getSubjectId(), paperSetting.getQuestionType(), difficult, settingItem.getNum()); |
| | | if (org.springframework.util.CollectionUtils.isEmpty(questions) || settingItem.getNum() > questions.size()) { |
| | | throw new RuntimeException("配置的题目数不足以生成试卷"); |
| | | } |
| | | |
| | | // 拿到题目后组装为可临时保存的题目结构 |
| | | List<DoQuestionVO> childQuestions = questions.stream().map(item -> { |
| | | DoQuestionVO doQuestionVO = new DoQuestionVO(); |
| | | doQuestionVO.setTitle(item.getTitle()); |
| | | doQuestionVO.setQuestionType(item.getQuestionType()); |
| | | //从配置里拿题目分数 |
| | | doQuestionVO.setQuestionScore(paperSetting.getScore()); |
| | | doQuestionVO.setQuestionScore(settingItem.getScore()); |
| | | if (StringUtils.hasText(item.getContent())) { |
| | | QuestionObject questionObject = JSON.parseObject(item.getContent(), QuestionObject.class); |
| | | doQuestionVO.setQuestionItemList(questionObject.getQuestionItemObjects()); |
| | | doQuestionVO.setTitle(questionObject.getTitleContent()); |
| | | } |
| | | doQuestionVO.setId(item.getId()); |
| | | doQuestionVO.setOriginalFile(item.getOriginalFile()); |
| | |
| | | |
| | | return doQuestionVO; |
| | | }).collect(Collectors.toList()); |
| | | paperFixQuestionVO.setQuestionList(childQuestions); |
| | | //添加到这个类型的list中 |
| | | childQuestionList.addAll(childQuestions); |
| | | } |
| | | paperFixQuestionVO.setQuestionList(childQuestionList); |
| | | examData.add(paperFixQuestionVO); |
| | | } |
| | | return Result.ok(startExamVO); |
| | | } |
| | | ExamSubmitTemp examSubmitTemp = new ExamSubmitTemp(); |
| | | examSubmitTemp.setExamId(id); |
| | |
| | | // 参考但未完成提交人数 |
| | | Integer joinButNotFinishedNum = Math.toIntExact(examSubmitTempList.stream().filter(item -> ExamSubmitTempStatusEnum.temp.equals(item.getStatus())).count()); |
| | | |
| | | List<StudentExamInfoVO> studentExamList = classesUserMapper.getClassesUserList(exam.getId(), exam.getClassesId()); |
| | | List<StudentExamInfoVO> studentExamList = classesUserMapper.getClassesUserList(exam.getClassesId()); |
| | | // 应考人数 |
| | | Integer shouldUserNum = studentExamList.size(); |
| | | |
| | | studentExamList.stream().forEach(item -> { |
| | | if (StringUtils.hasText(item.getExamSubmit())) { |
| | | item.setQuestionList(JSON.parseArray(item.getExamSubmit(), DoQuestionVO.class)); |
| | | for (StudentExamInfoVO studentExamInfoVO : studentExamList) { |
| | | Integer userId = studentExamInfoVO.getUserId(); |
| | | Optional<ExamSubmitTemp> first = examSubmitTempList.stream().filter(examSubmitTemp -> examSubmitTemp.getUserId().equals(userId)).findFirst(); |
| | | if(first.isPresent()){ |
| | | ExamSubmitTemp examSubmitTemp = first.get(); |
| | | studentExamInfoVO.setMarkPaperStatus(examSubmitTemp.getMarkPaperStatus()); |
| | | studentExamInfoVO.setStatus(examSubmitTemp.getStatus()); |
| | | studentExamInfoVO.setDoTime(examSubmitTemp.getDoTime()); |
| | | }else { |
| | | studentExamInfoVO.setMarkPaperStatus(ExamSubmitTempStatusEnum.temp); |
| | | studentExamInfoVO.setStatus(ExamSubmitTempStatusEnum.temp); |
| | | studentExamInfoVO.setDoTime(0); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | MarkPaperVO markPaperVO = new MarkPaperVO(); |
| | | markPaperVO.setExamName(exam.getExamName()); |