| | |
| | | import com.mindskip.xzs.base.BaseApiController; |
| | | import com.mindskip.xzs.base.RestResponse; |
| | | import com.mindskip.xzs.domain.ExamPaperAnswer; |
| | | import com.mindskip.xzs.domain.ExamPaperSubject; |
| | | import com.mindskip.xzs.domain.Subject; |
| | | import com.mindskip.xzs.domain.User; |
| | | import com.mindskip.xzs.service.*; |
| | |
| | | private final ExamPaperAnswerService examPaperAnswerService; |
| | | private final SubjectService subjectService; |
| | | private final UserService userService; |
| | | private final ExamPaperSubjectService examPaperSubjectService; |
| | | |
| | | @Autowired |
| | | public ExamPaperAnswerController(ExamPaperAnswerService examPaperAnswerService, SubjectService subjectService, UserService userService) { |
| | | public ExamPaperAnswerController(ExamPaperAnswerService examPaperAnswerService, SubjectService subjectService, UserService userService, ExamPaperSubjectService examPaperSubjectService) { |
| | | this.examPaperAnswerService = examPaperAnswerService; |
| | | this.subjectService = subjectService; |
| | | this.userService = userService; |
| | | this.examPaperSubjectService = examPaperSubjectService; |
| | | } |
| | | |
| | | |
| | |
| | | if (user == null) { |
| | | return null; |
| | | } |
| | | Subject subject = subjectService.selectById(vm.getSubjectId()); |
| | | // Subject subject = subjectService.selectById(vm.getSubjectId()); |
| | | ExamPaperAnswer examPaperAnswer = examPaperAnswerService.getById(vm.getId()); |
| | | Integer[] ids = examPaperSubjectService.getByExamPaperId(examPaperAnswer.getExamPaperId()) |
| | | .stream().map(ExamPaperSubject::getSubjectId).toArray(Integer[]::new); |
| | | String name = ""; |
| | | if(ids.length>0){ |
| | | name = subjectService.selectByIds(ids) |
| | | .stream().map(Subject::getName).collect(Collectors.joining(",")); |
| | | } |
| | | vm.setDoTime(ExamUtil.secondToVM(e.getDoTime())); |
| | | vm.setSystemScore(ExamUtil.scoreToVM(e.getSystemScore())); |
| | | vm.setUserScore(ExamUtil.scoreToVM(e.getUserScore())); |
| | | vm.setPaperScore(ExamUtil.scoreToVM(e.getPaperScore())); |
| | | vm.setSubjectName(subject.getName()); |
| | | vm.setSubjectName(name); |
| | | vm.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime())); |
| | | |
| | | vm.setUserName(user.getUserName()); |