| | |
| | | import com.mindskip.xzs.utility.JsonUtil; |
| | | import com.mindskip.xzs.viewmodel.student.exam.ExamPaperSubmitItemVM; |
| | | import com.mindskip.xzs.viewmodel.student.exam.ExamPaperSubmitVM; |
| | | import com.mindskip.xzs.viewmodel.student.exampaper.ExamPaperAnswerPageResponseVM; |
| | | import com.mindskip.xzs.viewmodel.student.exampaper.ExamPaperAnswerPageVM; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | |
| | | QuestionTypeEnum questionTypeEnum = QuestionTypeEnum.fromCode(examPaperQuestionCustomerAnswer.getQuestionType()); |
| | | switch (questionTypeEnum) { |
| | | case SingleChoice: |
| | | examPaperQuestionCustomerAnswer.setAnswer(customerQuestionAnswer.getContent()); |
| | | examPaperQuestionCustomerAnswer.setDoRight(question.getCorrect().equals(customerQuestionAnswer.getContent())); |
| | | examPaperQuestionCustomerAnswer.setCustomerScore(examPaperQuestionCustomerAnswer.getDoRight() ? question.getScore() : 0); |
| | | break; |
| | | case TrueFalse: |
| | | examPaperQuestionCustomerAnswer.setAnswer(customerQuestionAnswer.getContent()); |
| | | examPaperQuestionCustomerAnswer.setDoRight(question.getCorrect().equals(customerQuestionAnswer.getContent())); |
| | | examPaperQuestionCustomerAnswer.setCustomerScore(examPaperQuestionCustomerAnswer.getDoRight() ? question.getScore() : 0); |
| | | break; |
| | | case MultipleChoice: |
| | | String customerAnswer = ExamUtil.contentToString(customerQuestionAnswer.getContentArray()); |
| | | String customerAnswer = customerQuestionAnswer.getContent() ==null ? ExamUtil.contentToString(customerQuestionAnswer.getContentArray()) : customerQuestionAnswer.getContent(); |
| | | examPaperQuestionCustomerAnswer.setAnswer(customerAnswer); |
| | | examPaperQuestionCustomerAnswer.setDoRight(customerAnswer.equals(question.getCorrect())); |
| | | examPaperQuestionCustomerAnswer.setCustomerScore(examPaperQuestionCustomerAnswer.getDoRight() ? question.getScore() : 0); |
| | |
| | | return PageHelper.startPage(requestVM.getPageIndex(), requestVM.getPageSize(), "user_score desc").doSelectPageInfo(() -> |
| | | examPaperAnswerMapper.adminPage(requestVM)); |
| | | } |
| | | |
| | | @Override |
| | | public ExamPaperAnswer getById(Integer id) { |
| | | return examPaperAnswerMapper.getById(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<ExamPaperAnswer> selectByPaperName(String paperName) { |
| | | return examPaperAnswerMapper.selectByPaperName(paperName); |
| | | } |
| | | |
| | | @Override |
| | | public List<ExamPaperAnswer> getByExamPaperIdAndUserId(List<ExamTemplatesUserCount> examTemplatesUserCount) { |
| | | return examPaperAnswerMapper.getByExamPaperIdAndUserId(examTemplatesUserCount); |
| | | } |
| | | } |