From 2354b39c08f9cbe6c2878ee768abd9748c3c21b5 Mon Sep 17 00:00:00 2001 From: 龚焕茏 <2842157468@qq.com> Date: 星期四, 06 六月 2024 17:26:46 +0800 Subject: [PATCH] feat:成绩管理-试卷展示 --- src/main/java/com/ycl/jxkg/controller/student/ExamPaperAnswerController.java | 33 +++++++++++++++------------------ 1 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/ycl/jxkg/controller/student/ExamPaperAnswerController.java b/src/main/java/com/ycl/jxkg/controller/student/ExamPaperAnswerController.java index 80d7715..3cf880e 100644 --- a/src/main/java/com/ycl/jxkg/controller/student/ExamPaperAnswerController.java +++ b/src/main/java/com/ycl/jxkg/controller/student/ExamPaperAnswerController.java @@ -3,7 +3,11 @@ import com.ycl.jxkg.base.BaseApiController; import com.ycl.jxkg.base.Result; import com.ycl.jxkg.domain.*; -import com.ycl.jxkg.domain.enums.ExamPaperAnswerStatusEnum; +import com.ycl.jxkg.domain.entity.ExamPaperAnswer; +import com.ycl.jxkg.domain.entity.Subject; +import com.ycl.jxkg.domain.entity.User; +import com.ycl.jxkg.domain.entity.UserEventLog; +import com.ycl.jxkg.enums.ExamPaperAnswerStatusEnum; import com.ycl.jxkg.event.CalculateExamPaperAnswerCompleteEvent; import com.ycl.jxkg.event.UserEvent; import com.ycl.jxkg.service.ExamPaperAnswerService; @@ -12,20 +16,21 @@ import com.ycl.jxkg.utils.DateTimeUtil; import com.ycl.jxkg.utils.ExamUtil; import com.ycl.jxkg.utils.PageInfoHelper; -import com.ycl.jxkg.vo.admin.exam.ExamPaperEditRequestVO; -import com.ycl.jxkg.vo.student.exam.ExamPaperReadVO; -import com.ycl.jxkg.vo.student.exam.ExamPaperSubmitVO; -import com.ycl.jxkg.vo.student.exampaper.ExamPaperAnswerPageResponseVO; -import com.ycl.jxkg.vo.student.exampaper.ExamPaperAnswerPageVO; +import com.ycl.jxkg.domain.vo.admin.exam.ExamPaperEditRequestVO; +import com.ycl.jxkg.domain.vo.student.exam.ExamPaperReadVO; +import com.ycl.jxkg.domain.vo.student.exam.ExamPaperSubmitVO; +import com.ycl.jxkg.domain.vo.student.exampaper.ExamPaperAnswerPageResponseVO; +import com.ycl.jxkg.domain.vo.student.exampaper.ExamPaperAnswerPageVO; import com.github.pagehelper.PageInfo; +import lombok.RequiredArgsConstructor; import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationEventPublisher; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.Date; +@RequiredArgsConstructor @RestController("StudentExamPaperAnswerController") @RequestMapping(value = "/api/student/exampaper/answer") public class ExamPaperAnswerController extends BaseApiController { @@ -35,14 +40,6 @@ private final SubjectService subjectService; private final ApplicationEventPublisher eventPublisher; - @Autowired - public ExamPaperAnswerController(ExamPaperAnswerService examPaperAnswerService, ExamPaperService examPaperService, SubjectService subjectService, ApplicationEventPublisher eventPublisher) { - this.examPaperAnswerService = examPaperAnswerService; - this.examPaperService = examPaperService; - this.subjectService = subjectService; - this.eventPublisher = eventPublisher; - } - @RequestMapping(value = "/pageList", method = RequestMethod.POST) public Result<PageInfo<ExamPaperAnswerPageResponseVO>> pageList(@RequestBody @Valid ExamPaperAnswerPageVO model) { @@ -51,7 +48,7 @@ PageInfo<ExamPaperAnswerPageResponseVO> page = PageInfoHelper.copyMap(pageInfo, e -> { ExamPaperAnswerPageResponseVO vo = new ExamPaperAnswerPageResponseVO(); BeanUtils.copyProperties(e, vo); - Subject subject = subjectService.selectById(vo.getSubjectId()); + Subject subject = subjectService.getById(vo.getSubjectId()); vo.setDoTime(ExamUtil.secondToVM(e.getDoTime())); vo.setSystemScore(ExamUtil.scoreToVM(e.getSystemScore())); vo.setUserScore(ExamUtil.scoreToVM(e.getUserScore())); @@ -92,7 +89,7 @@ return Result.fail(2, "鏈夋湭鎵规敼棰樼洰"); } - ExamPaperAnswer examPaperAnswer = examPaperAnswerService.selectById(examPaperSubmitVO.getId()); + ExamPaperAnswer examPaperAnswer = examPaperAnswerService.getById(examPaperSubmitVO.getId()); ExamPaperAnswerStatusEnum examPaperAnswerStatusEnum = ExamPaperAnswerStatusEnum.fromCode(examPaperAnswer.getStatus()); if (examPaperAnswerStatusEnum == ExamPaperAnswerStatusEnum.Complete) { return Result.fail(3, "璇曞嵎宸插畬鎴�"); @@ -108,7 +105,7 @@ @RequestMapping(value = "/read/{id}", method = RequestMethod.POST) public Result<ExamPaperReadVO> read(@PathVariable Integer id) { - ExamPaperAnswer examPaperAnswer = examPaperAnswerService.selectById(id); + ExamPaperAnswer examPaperAnswer = examPaperAnswerService.getById(id); ExamPaperReadVO vm = new ExamPaperReadVO(); ExamPaperEditRequestVO paper = examPaperService.examPaperToVM(examPaperAnswer.getExamPaperId()); ExamPaperSubmitVO answer = examPaperAnswerService.examPaperAnswerToVM(examPaperAnswer.getId()); -- Gitblit v1.8.0