| | |
| | | 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 lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.ApplicationEventPublisher; |
| | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | @RequiredArgsConstructor |
| | | @Controller("WXStudentExamPaperAnswerController") |
| | | @RequestMapping(value = "/api/wx/student/exampaper/answer") |
| | | @ResponseBody |
| | |
| | | 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()); |
| | |
| | | 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())); |
| | |
| | | @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); |