| | |
| | | package com.ycl.jxkg.listener; |
| | | |
| | | import com.ycl.jxkg.domain.*; |
| | | import com.ycl.jxkg.domain.entity.ExamPaper; |
| | | import com.ycl.jxkg.domain.entity.ExamPaperAnswer; |
| | | import com.ycl.jxkg.domain.entity.ExamPaperQuestionCustomerAnswer; |
| | | import com.ycl.jxkg.domain.entity.TextContent; |
| | | import com.ycl.jxkg.domain.enums.ExamPaperTypeEnum; |
| | | import com.ycl.jxkg.domain.enums.QuestionTypeEnum; |
| | | import com.ycl.jxkg.event.CalculateExamPaperAnswerCompleteEvent; |
| | |
| | | ExamPaperAnswer examPaperAnswer = examPaperAnswerInfo.getExamPaperAnswer(); |
| | | List<ExamPaperQuestionCustomerAnswer> examPaperQuestionCustomerAnswers = examPaperAnswerInfo.getExamPaperQuestionCustomerAnswers(); |
| | | |
| | | examPaperAnswerService.insertByFilter(examPaperAnswer); |
| | | examPaperAnswerService.save(examPaperAnswer); |
| | | examPaperQuestionCustomerAnswers.stream().filter(a -> QuestionTypeEnum.needSaveTextContent(a.getQuestionType())).forEach(d -> { |
| | | TextContent textContent = new TextContent(d.getAnswer(), now); |
| | | textContentService.insertByFilter(textContent); |
| | | TextContent textContent = new TextContent(); |
| | | textContent.setContent(d.getAnswer()); |
| | | textContent.setCreateTime(now); |
| | | textContentService.save(textContent); |
| | | d.setTextContentId(textContent.getId()); |
| | | d.setAnswer(null); |
| | | }); |
| | |
| | | examPaperQuestionCustomerAnswerService.insertList(examPaperQuestionCustomerAnswers); |
| | | |
| | | switch (ExamPaperTypeEnum.fromCode(examPaper.getPaperType())) { |
| | | case Task: { |
| | | case RandomOrder: { |
| | | examCustomerAnswerService.insertOrUpdate(examPaper, examPaperAnswer, now); |
| | | break; |
| | | } |