From 0e5e319d7c245a2f929742db74a3f9b0f322c3fd Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期二, 09 七月 2024 15:55:42 +0800
Subject: [PATCH] 系统配置代码
---
src/main/java/com/ycl/jxkg/listener/CalculateExamPaperAnswerListener.java | 44 ++++++++++++++++++++++++--------------------
1 files changed, 24 insertions(+), 20 deletions(-)
diff --git a/src/main/java/com/ycl/jxkg/listener/CalculateExamPaperAnswerListener.java b/src/main/java/com/ycl/jxkg/listener/CalculateExamPaperAnswerListener.java
index 4759dc6..c005a31 100644
--- a/src/main/java/com/ycl/jxkg/listener/CalculateExamPaperAnswerListener.java
+++ b/src/main/java/com/ycl/jxkg/listener/CalculateExamPaperAnswerListener.java
@@ -1,11 +1,15 @@
package com.ycl.jxkg.listener;
import com.ycl.jxkg.domain.*;
-import com.ycl.jxkg.domain.enums.ExamPaperTypeEnum;
-import com.ycl.jxkg.domain.enums.QuestionTypeEnum;
+import com.ycl.jxkg.domain.entity.ExamPaper;
+import com.ycl.jxkg.domain.entity.ExamPaperScore;
+import com.ycl.jxkg.domain.entity.ExamPaperScoreDetail;
+import com.ycl.jxkg.domain.entity.TextContent;
+import com.ycl.jxkg.enums.ExamPaperTypeEnum;
+import com.ycl.jxkg.enums.QuestionTypeEnum;
import com.ycl.jxkg.event.CalculateExamPaperAnswerCompleteEvent;
-import com.ycl.jxkg.service.ExamPaperAnswerService;
-import com.ycl.jxkg.service.ExamPaperQuestionCustomerAnswerService;
+import com.ycl.jxkg.service.ExamPaperScoreService;
+import com.ycl.jxkg.service.ExamPaperScoreDetailService;
import com.ycl.jxkg.service.TaskExamCustomerAnswerService;
import com.ycl.jxkg.service.TextContentService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -26,23 +30,23 @@
@Component
public class CalculateExamPaperAnswerListener implements ApplicationListener<CalculateExamPaperAnswerCompleteEvent> {
- private final ExamPaperAnswerService examPaperAnswerService;
- private final ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService;
+ private final ExamPaperScoreService examPaperScoreService;
+ private final ExamPaperScoreDetailService examPaperScoreDetailService;
private final TextContentService textContentService;
private final TaskExamCustomerAnswerService examCustomerAnswerService;
/**
* Instantiates a new Calculate exam paper answer listener.
*
- * @param examPaperAnswerService the exam paper answer service
- * @param examPaperQuestionCustomerAnswerService the exam paper question customer answer service
+ * @param examPaperScoreService the exam paper answer service
+ * @param examPaperScoreDetailService the exam paper question customer answer service
* @param textContentService the text content service
* @param examCustomerAnswerService the exam customer answer service
*/
@Autowired
- public CalculateExamPaperAnswerListener(ExamPaperAnswerService examPaperAnswerService, ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService, TextContentService textContentService, TaskExamCustomerAnswerService examCustomerAnswerService) {
- this.examPaperAnswerService = examPaperAnswerService;
- this.examPaperQuestionCustomerAnswerService = examPaperQuestionCustomerAnswerService;
+ public CalculateExamPaperAnswerListener(ExamPaperScoreService examPaperScoreService, ExamPaperScoreDetailService examPaperScoreDetailService, TextContentService textContentService, TaskExamCustomerAnswerService examCustomerAnswerService) {
+ this.examPaperScoreService = examPaperScoreService;
+ this.examPaperScoreDetailService = examPaperScoreDetailService;
this.textContentService = textContentService;
this.examCustomerAnswerService = examCustomerAnswerService;
}
@@ -54,11 +58,11 @@
ExamPaperAnswerInfo examPaperAnswerInfo = (ExamPaperAnswerInfo) calculateExamPaperAnswerCompleteEvent.getSource();
ExamPaper examPaper = examPaperAnswerInfo.getExamPaper();
- ExamPaperAnswer examPaperAnswer = examPaperAnswerInfo.getExamPaperAnswer();
- List<ExamPaperQuestionCustomerAnswer> examPaperQuestionCustomerAnswers = examPaperAnswerInfo.getExamPaperQuestionCustomerAnswers();
+ ExamPaperScore examPaperScore = examPaperAnswerInfo.getExamPaperScore();
+ List<ExamPaperScoreDetail> examPaperScoreDetails = examPaperAnswerInfo.getExamPaperScoreDetails();
- examPaperAnswerService.save(examPaperAnswer);
- examPaperQuestionCustomerAnswers.stream().filter(a -> QuestionTypeEnum.needSaveTextContent(a.getQuestionType())).forEach(d -> {
+ examPaperScoreService.save(examPaperScore);
+ examPaperScoreDetails.stream().filter(a -> QuestionTypeEnum.needSaveTextContent(a.getQuestionType())).forEach(d -> {
TextContent textContent = new TextContent();
textContent.setContent(d.getAnswer());
textContent.setCreateTime(now);
@@ -66,14 +70,14 @@
d.setTextContentId(textContent.getId());
d.setAnswer(null);
});
- examPaperQuestionCustomerAnswers.forEach(d -> {
- d.setExamPaperAnswerId(examPaperAnswer.getId());
+ examPaperScoreDetails.forEach(d -> {
+ d.setExamPaperAnswerId(examPaperScore.getId());
});
- examPaperQuestionCustomerAnswerService.insertList(examPaperQuestionCustomerAnswers);
+ examPaperScoreDetailService.insertList(examPaperScoreDetails);
switch (ExamPaperTypeEnum.fromCode(examPaper.getPaperType())) {
- case Task: {
- examCustomerAnswerService.insertOrUpdate(examPaper, examPaperAnswer, now);
+ case RandomOrder: {
+ examCustomerAnswerService.insertOrUpdate(examPaper, examPaperScore, now);
break;
}
default:
--
Gitblit v1.8.0