From fbdd6af3039a83cd4727a03cecb7c5914277371f Mon Sep 17 00:00:00 2001
From: qirong <2032486488@qq.com>
Date: 星期五, 28 七月 2023 14:44:08 +0800
Subject: [PATCH] 个人练习模板功能

---
 src/main/java/com/mindskip/xzs/service/impl/ExamPaperAnswerServiceImpl.java |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/mindskip/xzs/service/impl/ExamPaperAnswerServiceImpl.java b/src/main/java/com/mindskip/xzs/service/impl/ExamPaperAnswerServiceImpl.java
index 57637ed..40f3a87 100644
--- a/src/main/java/com/mindskip/xzs/service/impl/ExamPaperAnswerServiceImpl.java
+++ b/src/main/java/com/mindskip/xzs/service/impl/ExamPaperAnswerServiceImpl.java
@@ -21,6 +21,7 @@
 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;
@@ -220,13 +221,17 @@
         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);
@@ -280,4 +285,14 @@
     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);
+    }
 }

--
Gitblit v1.8.0