From d470757bba19143fd3fc441365fcbb2362dfd0f0 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期六, 11 五月 2024 18:04:39 +0800 Subject: [PATCH] 个人练习 --- src/main/java/com/mindskip/xzs/controller/student/ExamPaperAnswerController.java | 24 +++++++++++++++++------- 1 files changed, 17 insertions(+), 7 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 32717f9..155183d 100644 --- a/src/main/java/com/mindskip/xzs/controller/student/ExamPaperAnswerController.java +++ b/src/main/java/com/mindskip/xzs/controller/student/ExamPaperAnswerController.java @@ -1,5 +1,6 @@ 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.*; @@ -10,12 +11,11 @@ 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.*; @@ -34,15 +34,17 @@ private final ApplicationEventPublisher eventPublisher; private final ExamPaperSubjectService examPaperSubjectService; private final ExamTemplatesUserCountService examTemplatesUserCountService; + private final ExamMissService examMissService; @Autowired - public ExamPaperAnswerController(ExamPaperAnswerService examPaperAnswerService, ExamPaperService examPaperService, SubjectService subjectService, ApplicationEventPublisher eventPublisher, ExamPaperSubjectService examPaperSubjectService, ExamTemplatesUserCountService examTemplatesUserCountService) { + public ExamPaperAnswerController(ExamPaperAnswerService examPaperAnswerService, ExamPaperService examPaperService, SubjectService subjectService, ApplicationEventPublisher eventPublisher, ExamPaperSubjectService examPaperSubjectService, ExamTemplatesUserCountService examTemplatesUserCountService, ExamMissService examMissService) { this.examPaperAnswerService = examPaperAnswerService; this.examPaperService = examPaperService; this.subjectService = subjectService; this.eventPublisher = eventPublisher; this.examPaperSubjectService = examPaperSubjectService; this.examTemplatesUserCountService = examTemplatesUserCountService; + this.examMissService = examMissService; } @@ -97,6 +99,14 @@ examTemplatesUserCount.setExamTemplatesId(examPaperSubmitVM.getTemplatesId()); examTemplatesUserCountService.add(examTemplatesUserCount); } + + // 鑷姩鎻愪氦瀹氫箟涓虹己鑰� + if (examPaperSubmitVM.isAutoCommit()) { + ExamMiss examMiss = new ExamMiss(); + examMiss.setExamId(examPaperSubmitVM.getId()); + examMiss.setUserId(user.getId()); + examMissService.save(examMiss); + } return RestResponse.ok(scoreVm); } @@ -123,10 +133,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