| | |
| | | List<CoursePackageScheduling> list = coursePackageSchedulingService.list(new QueryWrapper<CoursePackageScheduling>() |
| | | .eq("appUserId", appUserId) |
| | | .eq("studentId", stuId) |
| | | // .lt("classDate", sdf.format(calendar.getTime())) |
| | | .orderByAsc("classDate") |
| | | ); |
| | | List<Long> ids = list.stream().map(CoursePackageScheduling::getId).collect(Collectors.toList()); |
| | |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy.MM.dd"); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm"); |
| | | if (list.size() > 0) { |
| | | |
| | | // int pageNum = 1; // 页码 |
| | | int pageSize = 10; // 每页记录数 |
| | | Page<CoursePackageStudent> page = new Page<>(pageNum, pageSize); |
| | | IPage<CoursePackageStudent> coursePackageStudentPage = cpsMapper.selectPage(page, new QueryWrapper<CoursePackageStudent>() |
| | |
| | | } |
| | | |
| | | |
| | | CoursePackageScheduling byId = coursePackageSchedulingService.getById(coursePackageStudent.getCoursePackageSchedulingId()); |
| | | if (byId == null) { |
| | | CoursePackageScheduling coursePackageScheduling = coursePackageSchedulingService.getById(coursePackageStudent.getCoursePackageSchedulingId()); |
| | | if (coursePackageScheduling == null) { |
| | | continue; |
| | | } |
| | | String dateString1 = sdf.format(byId.getClassDate()); |
| | | String dateString2 = sdf.format(byId.getEndDate()); |
| | | String dateString1 = sdf.format(coursePackageScheduling.getClassDate()); |
| | | String dateString2 = sdf.format(coursePackageScheduling.getEndDate()); |
| | | |
| | | |
| | | recordVo.setTimeFrame(dateString1 + "-" + dateString2.substring(11)); |
| | |
| | | String[] split = classWeeks.split(";"); |
| | | List<String> integerList = Arrays.asList(split); |
| | | String weekOfDate = DateTimeHelper.getWeekOfDate(new Date()); |
| | | if (integerList.contains(weekOfDate)) { |
| | | String dat = simpleDateFormat.format(byId.getClassDate()) + " " + dateString1.substring(11); |
| | | String dat = simpleDateFormat.format(coursePackageScheduling.getClassDate()) + " " + dateString1.substring(11); |
| | | String ed = simpleDateFormat.format(coursePackageScheduling.getEndDate()) + " " + dateString2.substring(11); |
| | | |
| | | Date start = null; |
| | | try { |
| | | start = format.parse(dat); |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | //已取消 |
| | | if (byId.getStatus() == 4) { |
| | | recordVo.setStatus(4); |
| | | } else if (coursePackageStudent.getSignInOrNot() == 2) { |
| | | //已请假 |
| | | recordVo.setStatus(5); |
| | | } else if (start.after(new Date())) { |
| | | //待上课 |
| | | recordVo.setStatus(1); |
| | | } |
| | | else { |
| | | CancelledClasses cancelledClasses = cacMapper.selectOne(new QueryWrapper<CancelledClasses>() |
| | | .eq("coursePackageSchedulingId", byId.getId()).last("limit 1")); |
| | | if (ToolUtil.isNotEmpty(cancelledClasses)) { |
| | | recordVo.setStatus(3); |
| | | // 消课 到课状态0 旷课 |
| | | if (coursePackageStudent.getSignInOrNot() == 0) { |
| | | recordVo.setStatus(6); |
| | | } |
| | | Date start = null; |
| | | Date end = null; |
| | | try { |
| | | start = format.parse(dat); |
| | | end = format.parse(ed); |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | } else { |
| | | Date now = new Date(); |
| | | if (now.after(byId.getClassDate()) && now.before(byId.getEndDate())) { |
| | | recordVo.setStatus(2); |
| | | } else { |
| | | recordVo.setStatus(3); |
| | | CancelledClasses cancelledClasses = cacMapper.selectOne(new QueryWrapper<CancelledClasses>() |
| | | .eq("coursePackageSchedulingId", coursePackageScheduling.getId()).last("limit 1")); |
| | | |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | |
| | | if (new Date().after(start)&&new Date().before(end)){ |
| | | recordVo.setStatus(2); |
| | | } |
| | | //待上课 |
| | | if (start.after(new Date())) { |
| | | recordVo.setStatus(1); |
| | | } |
| | | //已取消 |
| | | if (coursePackageScheduling.getStatus() == 4) { |
| | | recordVo.setStatus(4); |
| | | } |
| | | //已请假 |
| | | if (coursePackageStudent.getSignInOrNot() == 2) { |
| | | recordVo.setStatus(5); |
| | | } |
| | | //已完成 |
| | | if (ToolUtil.isNotEmpty(cancelledClasses)) { |
| | | recordVo.setStatus(3); |
| | | // 消课 到课状态0 旷课 |
| | | if (coursePackageStudent.getSignInOrNot() == 0) { |
| | | recordVo.setStatus(6); |
| | | } |
| | | } |
| | | recordVoList.add(recordVo); |
| | | } |
| | | |