| | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | .eq("status", 1) |
| | | .orderByDesc("insertTime")); |
| | | |
| | | List<Integer> ids = new ArrayList<>(); |
| | | for (CoursePackageOrderStudent tCoursePackagePayment : tCoursePackagePayments) { |
| | | ids.add(tCoursePackagePayment.getCoursePackageId()); |
| | | } |
| | | |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(new Date()); |
| | | calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), 23, 59, 59); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | 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 (tCoursePackagePayments.size() > 0) { |
| | | 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>() |
| | | .in("coursePackageId", ids) |
| | | .eq("studentId", stuId) |
| | | .eq("appUserId", appUserId) |
| | | .in("coursePackageSchedulingId", ids) |
| | | .eq("reservationStatus", 1)); |
| | | List<CoursePackageStudent> coursePackageStudent1 = coursePackageStudentPage.getRecords(); |
| | | |
| | |
| | | if (byId == null) { |
| | | continue; |
| | | } |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String dateString1 = sdf.format(byId.getClassDate()); |
| | | String dateString2 = sdf.format(byId.getEndDate()); |
| | | |
| | |
| | | String[] split = classWeeks.split(";"); |
| | | List<String> integerList = Arrays.asList(split); |
| | | String weekOfDate = DateTimeHelper.getWeekOfDate(new Date()); |
| | | if (integerList.contains(weekOfDate)) { |
| | | // if (integerList.contains(weekOfDate)) { |
| | | String dat = simpleDateFormat.format(byId.getClassDate()) + " " + dateString1.substring(11); |
| | | String ed = simpleDateFormat.format(byId.getEndDate()) + " " + dateString2.substring(11); |
| | | |
| | | Date start = null; |
| | | Date end = null; |
| | | try { |
| | | start = format.parse(dat); |
| | | end = format.parse(ed); |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | CancelledClasses cancelledClasses = cacMapper.selectOne(new QueryWrapper<CancelledClasses>() |
| | | .eq("coursePackageSchedulingId", byId.getId()).last("limit 1")); |
| | | // else { |
| | | // Date now = new Date(); |
| | | // if (now.after(byId.getClassDate()) && now.before(byId.getEndDate())) { |
| | | // recordVo.setStatus(2); |
| | | // } else { |
| | | // recordVo.setStatus(3); |
| | | // |
| | | // } |
| | | // } |
| | | |
| | | //已取消 |
| | | if (byId.getStatus() == 4) { |
| | | recordVo.setStatus(4); |
| | | } else if (coursePackageStudent.getSignInOrNot() == 2) { |
| | | //已请假 |
| | | recordVo.setStatus(5); |
| | | } else if (start.after(new Date())) { |
| | | }else if (ToolUtil.isNotEmpty(cancelledClasses)) { |
| | | recordVo.setStatus(3); |
| | | // 消课 到课状态0 旷课 |
| | | if (coursePackageStudent.getSignInOrNot() == 0) { |
| | | recordVo.setStatus(6); |
| | | } |
| | | |
| | | }else if (new Date().after(start)&&new Date().before(end)){ |
| | | recordVo.setStatus(2); |
| | | }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); |
| | | } |
| | | |
| | | } 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", byId.getId()).last("limit 1")); |
| | | // if (ToolUtil.isNotEmpty(cancelledClasses)) { |
| | | // recordVo.setStatus(3); |
| | | // // 消课 到课状态0 旷课 |
| | | // if (coursePackageStudent.getSignInOrNot() == 0) { |
| | | // recordVo.setStatus(6); |
| | | // } |
| | | // |
| | | // } else { |
| | | // Date now = new Date(); |
| | | // if (now.after(byId.getClassDate()) && now.before(byId.getEndDate())) { |
| | | // recordVo.setStatus(2); |
| | | // } else { |
| | | // recordVo.setStatus(3); |
| | | // |
| | | // } |
| | | // } |
| | | } |
| | | } else { |
| | | recordVo.setStatus(1); |
| | | } |
| | | // } else { |
| | | // recordVo.setStatus(1); |
| | | // } |
| | | recordVoList.add(recordVo); |
| | | } |
| | | |