xiangpei
2024-05-11 d470757bba19143fd3fc441365fcbb2362dfd0f0
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,14 +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.admin.exam.ExamPaperEditRequestVO;
import com.mindskip.xzs.viewmodel.student.exam.ExamPaperReadVM;
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,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;
    }
@@ -99,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);
    }