| | |
| | | import com.ycl.jxkg.vo.student.exampaper.ExamPaperAnswerPageResponseVO; |
| | | import com.ycl.jxkg.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 javax.validation.Valid; |
| | | import java.util.Date; |
| | | |
| | | @RequiredArgsConstructor |
| | | @RestController("StudentExamPaperAnswerController") |
| | | @RequestMapping(value = "/api/student/exampaper/answer") |
| | | public class ExamPaperAnswerController extends BaseApiController { |
| | |
| | | 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) { |
| | |
| | | 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())); |
| | |
| | | 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, "试卷已完成"); |
| | |
| | | |
| | | @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()); |