| | |
| | | |
| | | import com.mindskip.xzs.base.BaseApiController; |
| | | import com.mindskip.xzs.base.RestResponse; |
| | | import com.mindskip.xzs.domain.TaskExam; |
| | | import com.mindskip.xzs.domain.TaskExamCustomerAnswer; |
| | | import com.mindskip.xzs.domain.TextContent; |
| | | import com.mindskip.xzs.domain.User; |
| | | import com.mindskip.xzs.domain.*; |
| | | import com.mindskip.xzs.domain.enums.ExamPaperTypeEnum; |
| | | import com.mindskip.xzs.domain.task.TaskItemAnswerObject; |
| | | import com.mindskip.xzs.domain.task.TaskItemObject; |
| | |
| | | private final TaskExamService taskExamService; |
| | | private final TaskExamCustomerAnswerService taskExamCustomerAnswerService; |
| | | private final TextContentService textContentService; |
| | | private final ExamPaperUserService examPaperUserService; |
| | | |
| | | @Autowired |
| | | public DashboardController(UserService userService, ExamPaperService examPaperService, QuestionService questionService, TaskExamService taskExamService, TaskExamCustomerAnswerService taskExamCustomerAnswerService, TextContentService textContentService) { |
| | | public DashboardController(UserService userService, ExamPaperService examPaperService, QuestionService questionService, TaskExamService taskExamService, TaskExamCustomerAnswerService taskExamCustomerAnswerService, TextContentService textContentService, ExamPaperUserService examPaperUserService) { |
| | | this.userService = userService; |
| | | this.examPaperService = examPaperService; |
| | | this.questionService = questionService; |
| | | this.taskExamService = taskExamService; |
| | | this.taskExamCustomerAnswerService = taskExamCustomerAnswerService; |
| | | this.textContentService = textContentService; |
| | | this.examPaperUserService = examPaperUserService; |
| | | } |
| | | |
| | | @RequestMapping(value = "/index", method = RequestMethod.POST) |
| | |
| | | |
| | | PaperFilter fixedPaperFilter = new PaperFilter(); |
| | | fixedPaperFilter.setGradeLevel(user.getUserLevel()); |
| | | fixedPaperFilter.setExamPaperType(ExamPaperTypeEnum.Fixed.getCode()); |
| | | Integer[] type = {ExamPaperTypeEnum.Fixed.getCode(),ExamPaperTypeEnum.Random.getCode()}; |
| | | fixedPaperFilter.setExamPaperType(type); |
| | | fixedPaperFilter.setUserId(user.getId()); |
| | | indexVM.setFixedPaper(examPaperService.indexPaper(fixedPaperFilter)); |
| | | |
| | | PaperFilter timeLimitPaperFilter = new PaperFilter(); |
| | | timeLimitPaperFilter.setDateTime(new Date()); |
| | | timeLimitPaperFilter.setGradeLevel(user.getUserLevel()); |
| | | timeLimitPaperFilter.setExamPaperType(ExamPaperTypeEnum.TimeLimit.getCode()); |
| | | Integer[] time = {ExamPaperTypeEnum.TimeLimit.getCode()}; |
| | | timeLimitPaperFilter.setExamPaperType(time); |
| | | timeLimitPaperFilter.setUserId(user.getId()); |
| | | |
| | | List<PaperInfo> limitPaper = examPaperService.indexPaper(timeLimitPaperFilter); |
| | | List<PaperInfoVM> paperInfoVMS = limitPaper.stream().map(d -> { |
| | |
| | | @RequestMapping(value = "/task", method = RequestMethod.POST) |
| | | public RestResponse<List<TaskItemVm>> task() { |
| | | User user = getCurrentUser(); |
| | | List<TaskExam> taskExams = taskExamService.getByGradeLevel(user.getUserLevel()); |
| | | Integer[] ids = examPaperUserService.getByUserId(user.getId()) |
| | | .stream().map(ExamPaperUser::getExamPaperId).toArray(Integer[]::new); |
| | | List<TaskExam> taskExams = new ArrayList<>(); |
| | | if(ids.length!=0){ |
| | | List<ExamPaper> list = examPaperService.gets(ids).stream() |
| | | .filter(e -> e.getPaperType() == 6).collect(Collectors.toList()); |
| | | if(list.size() != 0){ |
| | | Integer[] taskIds = list.stream().map(ExamPaper::getTaskExamId).toArray(Integer[]::new); |
| | | taskExams = taskExamService.gets(taskIds); |
| | | } |
| | | |
| | | } |
| | | |
| | | // List<TaskExam> taskExams = taskExamService.getByGradeLevel(user.getUserLevel()); |
| | | if (taskExams.size() == 0) { |
| | | return RestResponse.ok(new ArrayList<>()); |
| | | } |