qirong
2023-07-05 21ff1b4f2ef67975eef303bff66ef60388243cf1
src/main/java/com/mindskip/xzs/service/impl/ExamPaperAnswerServiceImpl.java
@@ -220,13 +220,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);
@@ -275,4 +279,14 @@
        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);
    }
}