| | |
| | | private final UserMapper userMapper; |
| | | private final ExamPaperScoreMapper examPaperScoreMapper; |
| | | private final ExamPaperScoreService examPaperScoreService; |
| | | private final QuestionAnswerRecordMapper questionAnswerRecordMapper; |
| | | |
| | | private final Producer producer; |
| | | |
| | |
| | | examPaperScore.setTotalScore(new BigDecimal(examPaperMark.getTotalScore())); |
| | | examPaperScore.setJudgeUser(userId); |
| | | examPaperScore.setJudgeTime(new Date()); |
| | | if (!StringUtils.isEmpty(examPaperMark.getTitleItems())) { |
| | | if (!org.springframework.util.CollectionUtils.isEmpty(examPaperMark.getTitleItems())) { |
| | | examPaperScore.setPaperContent(JSON.toJSONString(examPaperMark.getTitleItems())); |
| | | // 保存答题记录 |
| | | this.saveQuestionAnswerRecord(examPaperMark.getUserId(), examPaperMark.getTitleItems()); |
| | | } |
| | | if (!StringUtils.isEmpty(examPaperMark.getNavbar())) { |
| | | if (!org.springframework.util.CollectionUtils.isEmpty(examPaperMark.getNavbar())) { |
| | | examPaperScore.setNavbar(JSON.toJSONString(examPaperMark.getNavbar())); |
| | | } |
| | | long questionCorrect = 0; |
| | |
| | | return Result.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 保存答题记录 |
| | | * |
| | | * @param titleItems |
| | | */ |
| | | private void saveQuestionAnswerRecord(Integer studentUserId, List<PaperFixQuestionVO> titleItems) { |
| | | for (PaperFixQuestionVO titleItem : titleItems) { |
| | | for (DoQuestionVO question : titleItem.getQuestionList()) { |
| | | QuestionAnswerRecord record = new QuestionAnswerRecord(); |
| | | record.setQuestionType(titleItem.getQuestionType()); |
| | | record.setUserId(studentUserId); |
| | | record.setDoRight(question.getRight()); |
| | | record.setExamId(question.getExamId()); |
| | | record.setQuestionId(question.getId()); |
| | | record.setScore(question.getScore()); |
| | | record.setUserAnswer(StringUtils.hasText(question.getAnswer()) ? question.getAnswer() : question.getAnswerList().stream().collect(Collectors.joining("、"))); |
| | | questionAnswerRecordMapper.insert(record); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Result monitorList(ExamQuery query) { |