From 0b357d525c83203162eb053aed9c87604156f94a Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期二, 09 七月 2024 10:58:20 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_dept'
---
src/main/java/com/mindskip/xzs/controller/student/ExamPaperAnswerController.java | 30 +++++++++++++++++++-----------
1 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/src/main/java/com/mindskip/xzs/controller/student/ExamPaperAnswerController.java b/src/main/java/com/mindskip/xzs/controller/student/ExamPaperAnswerController.java
index 9331d13..d08fe72 100644
--- a/src/main/java/com/mindskip/xzs/controller/student/ExamPaperAnswerController.java
+++ b/src/main/java/com/mindskip/xzs/controller/student/ExamPaperAnswerController.java
@@ -1,24 +1,21 @@
package com.mindskip.xzs.controller.student;
+import com.github.pagehelper.PageInfo;
import com.mindskip.xzs.base.BaseApiController;
import com.mindskip.xzs.base.RestResponse;
import com.mindskip.xzs.domain.*;
import com.mindskip.xzs.domain.enums.ExamPaperAnswerStatusEnum;
import com.mindskip.xzs.event.CalculateExamPaperAnswerCompleteEvent;
import com.mindskip.xzs.event.UserEvent;
-import com.mindskip.xzs.service.ExamPaperAnswerService;
-import com.mindskip.xzs.service.ExamPaperService;
-import com.mindskip.xzs.service.ExamPaperSubjectService;
-import com.mindskip.xzs.service.SubjectService;
+import com.mindskip.xzs.service.*;
import com.mindskip.xzs.utility.DateTimeUtil;
import com.mindskip.xzs.utility.ExamUtil;
import com.mindskip.xzs.utility.PageInfoHelper;
-import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperEditRequestVM;
-import com.mindskip.xzs.viewmodel.student.exam.ExamPaperReadVM;
+import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperEditRequestVO;
+import com.mindskip.xzs.viewmodel.student.exam.ExamPaperReadVO;
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.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.web.bind.annotation.*;
@@ -36,14 +33,16 @@
private final SubjectService subjectService;
private final ApplicationEventPublisher eventPublisher;
private final ExamPaperSubjectService examPaperSubjectService;
+ private final ExamTemplatesUserCountService examTemplatesUserCountService;
@Autowired
- public ExamPaperAnswerController(ExamPaperAnswerService examPaperAnswerService, ExamPaperService examPaperService, SubjectService subjectService, ApplicationEventPublisher eventPublisher, ExamPaperSubjectService examPaperSubjectService) {
+ public ExamPaperAnswerController(ExamPaperAnswerService examPaperAnswerService, ExamPaperService examPaperService, SubjectService subjectService, ApplicationEventPublisher eventPublisher, ExamPaperSubjectService examPaperSubjectService, ExamTemplatesUserCountService examTemplatesUserCountService) {
this.examPaperAnswerService = examPaperAnswerService;
this.examPaperService = examPaperService;
this.subjectService = subjectService;
this.eventPublisher = eventPublisher;
this.examPaperSubjectService = examPaperSubjectService;
+ this.examTemplatesUserCountService = examTemplatesUserCountService;
}
@@ -90,6 +89,15 @@
userEventLog.setContent(content);
eventPublisher.publishEvent(new CalculateExamPaperAnswerCompleteEvent(examPaperAnswerInfo));
eventPublisher.publishEvent(new UserEvent(userEventLog));
+ //棣栭〉闅忔満璇曞嵎鎿嶄綔
+ if(examPaperSubmitVM.getTemplatesId() != null){
+ ExamTemplatesUserCount examTemplatesUserCount = new ExamTemplatesUserCount();
+ examTemplatesUserCount.setUserId(user.getId());
+ examTemplatesUserCount.setExamPaperId(examPaperSubmitVM.getId());
+ examTemplatesUserCount.setExamTemplatesId(examPaperSubmitVM.getTemplatesId());
+ examTemplatesUserCountService.add(examTemplatesUserCount);
+ }
+
return RestResponse.ok(scoreVm);
}
@@ -116,10 +124,10 @@
}
@RequestMapping(value = "/read/{id}", method = RequestMethod.POST)
- public RestResponse<ExamPaperReadVM> read(@PathVariable Integer id) {
+ public RestResponse<ExamPaperReadVO> read(@PathVariable Integer id) {
ExamPaperAnswer examPaperAnswer = examPaperAnswerService.selectById(id);
- ExamPaperReadVM vm = new ExamPaperReadVM();
- ExamPaperEditRequestVM paper = examPaperService.examPaperToVM(examPaperAnswer.getExamPaperId());
+ ExamPaperReadVO vm = new ExamPaperReadVO();
+ ExamPaperEditRequestVO paper = examPaperService.examPaperToVM(examPaperAnswer.getExamPaperId());
ExamPaperSubmitVM answer = examPaperAnswerService.examPaperAnswerToVM(examPaperAnswer.getId());
vm.setPaper(paper);
vm.setAnswer(answer);
--
Gitblit v1.8.0