fuliqi
2024-06-18 c46f49af9e766aed0ba583fce0efab98ebcdf76c
src/main/java/com/ycl/jxkg/controller/wx/student/ExamPaperAnswerController.java
@@ -3,7 +3,11 @@
import com.ycl.jxkg.base.Result;
import com.ycl.jxkg.controller.wx.BaseWXApiController;
import com.ycl.jxkg.domain.*;
import com.ycl.jxkg.domain.enums.QuestionTypeEnum;
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.QuestionTypeEnum;
import com.ycl.jxkg.event.CalculateExamPaperAnswerCompleteEvent;
import com.ycl.jxkg.event.UserEvent;
import com.ycl.jxkg.service.ExamPaperAnswerService;
@@ -12,15 +16,15 @@
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.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.exampaper.ExamPaperAnswerPageResponseVO;
import com.ycl.jxkg.domain.vo.student.exampaper.ExamPaperAnswerPageVO;
import com.github.pagehelper.PageInfo;
import com.ycl.jxkg.vo.student.exam.ExamPaperReadVO;
import com.ycl.jxkg.vo.student.exam.ExamPaperSubmitItemVO;
import com.ycl.jxkg.vo.student.exam.ExamPaperSubmitVO;
import com.ycl.jxkg.domain.vo.student.exam.ExamPaperReadVO;
import com.ycl.jxkg.domain.vo.student.exam.ExamPaperSubmitItemVO;
import com.ycl.jxkg.domain.vo.student.exam.ExamPaperSubmitVO;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@@ -30,7 +34,7 @@
import java.util.*;
import java.util.stream.Collectors;
@RequiredArgsConstructor
@Controller("WXStudentExamPaperAnswerController")
@RequestMapping(value = "/api/wx/student/exampaper/answer")
@ResponseBody
@@ -41,14 +45,6 @@
    private final ApplicationEventPublisher eventPublisher;
    private final ExamPaperService examPaperService;
    @Autowired
    public ExamPaperAnswerController(ExamPaperAnswerService examPaperAnswerService, SubjectService subjectService, ApplicationEventPublisher eventPublisher, ExamPaperService examPaperService) {
        this.examPaperAnswerService = examPaperAnswerService;
        this.subjectService = subjectService;
        this.eventPublisher = eventPublisher;
        this.examPaperService = examPaperService;
    }
    @RequestMapping(value = "/pageList", method = RequestMethod.POST)
    public Result<PageInfo<ExamPaperAnswerPageResponseVO>> pageList(@Valid ExamPaperAnswerPageVO model) {
        model.setCreateUser(getCurrentUser().getId());
@@ -56,7 +52,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()));
@@ -127,7 +123,7 @@
    @PostMapping(value = "/read/{id}")
    public Result<ExamPaperReadVO> read(@PathVariable Integer id) {
        ExamPaperReadVO vm = new ExamPaperReadVO();
        ExamPaperAnswer examPaperAnswer = examPaperAnswerService.selectById(id);
        ExamPaperAnswer examPaperAnswer = examPaperAnswerService.getById(id);
        ExamPaperEditRequestVO paper = examPaperService.examPaperToVM(examPaperAnswer.getExamPaperId());
        ExamPaperSubmitVO answer = examPaperAnswerService.examPaperAnswerToVM(examPaperAnswer.getId());
        vm.setPaper(paper);