| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Api |
| | |
| | | * 获取发布的 课包列表 |
| | | */ |
| | | @PostMapping("/base/coursePack/storeOfCourse") |
| | | public List<CourseOfStoreVo> getStuCourseWithStores(){ |
| | | List<CourseOfStoreVo> courseOfStoreVos = tcpService.queryStoreOfCourse(); |
| | | if (courseOfStoreVos.size() > 0){ |
| | | for (CourseOfStoreVo courseOfStoreVo : courseOfStoreVos) { |
| | | String[] split = courseOfStoreVo.getClassWeeks().split(";"); |
| | | List<Integer> integers = new ArrayList<>(); |
| | | for (String s : split) { |
| | | int num = Integer.parseInt(s); |
| | | integers.add(num); |
| | | public List<CourseOfStoreVo> getStuCourseWithStores(@RequestBody WeeksOfCourseRest courseRest){ |
| | | List<CourseOfStoreVo> course = new ArrayList<>(); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | try { |
| | | Date parse = simpleDateFormat.parse(courseRest.getTime()); |
| | | List<TCoursePackagePayment> list = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("appUserId",courseRest.getAppUserId() ) |
| | | .eq("studentId",courseRest.getStuId()) |
| | | .eq("payStatus",2) |
| | | .eq("status",1) |
| | | .eq("state",1) |
| | | .groupBy("coursePackageId")); |
| | | if (list.size() > 0){ |
| | | for (TCoursePackagePayment tCoursePackagePayment : list) { |
| | | TCoursePackage tCoursePackage = tcpService.getById(tCoursePackagePayment.getCoursePackageId()); |
| | | // 获取课程有效结束时间,判断 查询的日期parse 是否在有效期范围内 |
| | | Date expirationDate = DateTimeHelper.getExpirationDate(tCoursePackagePayment.getInsertTime(),tCoursePackage.getValidDays()); |
| | | String classWeeks = tCoursePackage.getClassWeeks(); |
| | | if (expirationDate.after(parse) && StrUtils.dealStrToList(classWeeks).contains(DateTimeHelper.getDayOfWeek(parse))){ |
| | | CourseOfStoreVo storeVo = new CourseOfStoreVo(); |
| | | storeVo.setCourseId(tCoursePackage.getId()); |
| | | // TODO: 2023/7/20 查询课包对应门店信息 |
| | | // storeVo.setCourseName(); |
| | | // storeVo.setClassStartTime(); |
| | | // storeVo.setClassEndTime(); |
| | | // storeVo.setStoreId(); |
| | | // storeVo.setStoreName(); |
| | | // storeVo.setLat(); |
| | | // storeVo.setLon(); |
| | | course.add(storeVo); |
| | | } |
| | | } |
| | | courseOfStoreVo.setClassWeekList(integers); |
| | | } |
| | | return course; |
| | | } catch (ParseException e) { |
| | | return null; |
| | | } |
| | | return tcpService.queryStoreOfCourse(); |
| | | } |
| | | |
| | | |