| | |
| | | package com.dsh.course.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.course.entity.*; |
| | | import com.dsh.course.feignclient.account.AppUserClient; |
| | |
| | | @Autowired |
| | | private CancelledClassesService cancelledClassesService; |
| | | |
| | | @Resource |
| | | private CoursePackageStudentService cspsService; |
| | | |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | @Resource |
| | |
| | | .groupBy("coursePackageId")); |
| | | if (list.size() > 0){ |
| | | for (TCoursePackagePayment tCoursePackagePayment : list) { |
| | | TCoursePackage tCoursePackage = tcpService.getById(tCoursePackagePayment.getCoursePackageId()); |
| | | CoursePackagePaymentConfig paymentConfig = icppcService.getOne(new QueryWrapper<CoursePackagePaymentConfig>() |
| | | .eq("coursePackageId",tCoursePackage.getId() ) |
| | | .eq("classHours",tCoursePackagePayment.getClassHours())); |
| | | CoursePackageStudent packageStudent = cspsService.getOne(new LambdaQueryWrapper<CoursePackageStudent>() |
| | | .eq(CoursePackageStudent::getAppUserId, courseRest.getAppUserId()) |
| | | .eq(CoursePackageStudent::getStudentId,courseRest.getStuId()) |
| | | .eq(CoursePackageStudent::getCoursePackagePaymentId,tCoursePackagePayment.getId()) |
| | | .eq(CoursePackageStudent::getCoursePackageId,tCoursePackagePayment.getCoursePackageId())); |
| | | if (ToolUtil.isEmpty(packageStudent) || (ToolUtil.isNotEmpty(packageStudent) && packageStudent.getReservationStatus() != 1)){ |
| | | // 没有预约过的/已经取消了的 |
| | | TCoursePackage tCoursePackage = tcpService.getById(tCoursePackagePayment.getCoursePackageId()); |
| | | CoursePackagePaymentConfig paymentConfig = icppcService.getOne(new QueryWrapper<CoursePackagePaymentConfig>() |
| | | .eq("coursePackageId",tCoursePackage.getId() ) |
| | | .eq("classHours",tCoursePackagePayment.getClassHours())); |
| | | // 获取课程有效结束时间,判断 查询的日期parse 是否在有效期范围内 |
| | | Date expirationDate = DateTimeHelper.getExpirationDate(tCoursePackagePayment.getInsertTime(),tCoursePackage.getValidDays()); |
| | | System.out.println(expirationDate.after(parse)); |
| | | String classWeeks = tCoursePackage.getClassWeeks(); |
| | | System.out.println(StrUtils.dealStrToList(classWeeks).contains(DateTimeHelper.getDayOfWeek(parse))); |
| | | if (expirationDate.after(parse) && StrUtils.dealStrToList(classWeeks).contains(DateTimeHelper.getDayOfWeek(parse))){ |
| | | CourseOfStoreVo storeVo = new CourseOfStoreVo(); |
| | | storeVo.setCourseId(tCoursePackage.getId()); |
| | | storeVo.setCourseName(tCoursePackage.getName()); |
| | | storeVo.setClassStartTime(tCoursePackage.getClassStartTime()); |
| | | storeVo.setClassEndTime(tCoursePackage.getClassEndTime()); |
| | | storeVo.setStoreId(tCoursePackage.getStoreId()); |
| | | Store store = sreClient.queryStoreById(tCoursePackage.getStoreId()); |
| | | storeVo.setStoreAddress(store.getAddress()); |
| | | storeVo.setLat(store.getLat()); |
| | | storeVo.setLon(store.getLon()); |
| | | storeVo.setCoursePrice(ToolUtil.isEmpty(paymentConfig.getCashPayment()) ? (double) paymentConfig.getPlayPaiCoin():paymentConfig.getCashPayment()); |
| | | course.add(storeVo); |
| | | Date expirationDate = DateTimeHelper.getExpirationDate(tCoursePackagePayment.getInsertTime(),tCoursePackage.getValidDays()); |
| | | System.out.println(expirationDate.after(parse)); |
| | | String classWeeks = tCoursePackage.getClassWeeks(); |
| | | System.out.println(StrUtils.dealStrToList(classWeeks).contains(DateTimeHelper.getDayOfWeek(parse))); |
| | | if (expirationDate.after(parse) && StrUtils.dealStrToList(classWeeks).contains(DateTimeHelper.getDayOfWeek(parse))){ |
| | | CourseOfStoreVo storeVo = new CourseOfStoreVo(); |
| | | storeVo.setCourseId(packageStudent.getId()); |
| | | storeVo.setCourseName(tCoursePackage.getName()); |
| | | storeVo.setClassStartTime(tCoursePackage.getClassStartTime()); |
| | | storeVo.setClassEndTime(tCoursePackage.getClassEndTime()); |
| | | storeVo.setStoreId(tCoursePackage.getStoreId()); |
| | | Store store = sreClient.queryStoreById(tCoursePackage.getStoreId()); |
| | | storeVo.setStoreAddress(store.getAddress()); |
| | | storeVo.setLat(store.getLat()); |
| | | storeVo.setLon(store.getLon()); |
| | | storeVo.setCoursePrice(ToolUtil.isEmpty(paymentConfig.getCashPayment()) ? (double) paymentConfig.getPlayPaiCoin():paymentConfig.getCashPayment()); |
| | | course.add(storeVo); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | baseVo.setName(coursePackage.getName()); |
| | | list.add(baseVo); |
| | | }); |
| | | return ResultUtil.success(); |
| | | return ResultUtil.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<Integer> courseIds = new ArrayList<>(); |
| | | List<TCoursePackagePayment> tCoursePackagePayments = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("coursePackageId",search.getCourseTypeId()) |
| | | .eq("appUserId",appUserId)); |
| | | QueryWrapper<TCoursePackagePayment> queryWrapper = new QueryWrapper<TCoursePackagePayment>().eq("appUserId", appUserId) |
| | | .groupBy("coursePackageId"); |
| | | if (ToolUtil.isNotEmpty(search.getCourseTypeId())){ |
| | | queryWrapper.eq("coursePackageId",search.getCourseTypeId()); |
| | | } |
| | | List<TCoursePackagePayment> tCoursePackagePayments = packagePaymentService.list(queryWrapper); |
| | | if (tCoursePackagePayments.size() > 0 ){ |
| | | courseIds = tCoursePackagePayments.stream().map(TCoursePackagePayment::getCoursePackageId).collect(Collectors.toList()); |
| | | } |
| | |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(name = "coursePayId" ,value = "课包记录id",dataType = "long"), |
| | | }) |
| | | public ResultUtil<CourseDetailsResponse> getRegisteredData( Integer coursePayId){ |
| | | public ResultUtil<CourseDetailsResponse> getRegisteredData(Long coursePayId){ |
| | | try { |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | if(null == appUserId){ |
| | |
| | | |
| | | |
| | | @PostMapping("/base/coursePack/obtainStudentClassDetails") |
| | | public List<RecordAppoint> obtainStudentClassDetailsData(@RequestBody Integer stuId){ |
| | | public List<RecordAppoint> obtainStudentClassDetailsData(@RequestBody WeeksOfCourseRest stuId){ |
| | | try { |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | return packagePaymentService.obtainStuClassDetails(stuId,appUserId); |
| | | return packagePaymentService.obtainStuClassDetails(stuId.getStuId(),stuId.getAppUserId()); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | throw new RuntimeException(); |
| | |
| | | .eq("code",code)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 上课主页-预约操作 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/startCource/reverse") |
| | | @ApiOperation(value = "上课主页-预约操作", tags = {"APP-开始上课"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "上课记录id", name = "coursePackId", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "时间 yyyy-MM-dd", name = "time", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "学员id", name = "time", required = true, dataType = "int"), |
| | | }) |
| | | public ResultUtil reverse(String courseID,String time,Integer stuId){ |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | try { |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | if(null == appUserId){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | CoursePackageStudent coursePackageStudent = cspsService.getOne(new LambdaQueryWrapper<CoursePackageStudent>() |
| | | .eq(CoursePackageStudent::getId,courseID) |
| | | .eq(CoursePackageStudent::getAppUserId,appUserId) |
| | | .eq(CoursePackageStudent::getStudentId,stuId)); |
| | | if (ToolUtil.isEmpty(coursePackageStudent)){ |
| | | ResultUtil.error("该用户未购买该课包"); |
| | | } |
| | | coursePackageStudent.setReservationStatus(1); |
| | | coursePackageStudent.setInsertTime(simpleDateFormat.parse(time)); |
| | | cspsService.updateById(coursePackageStudent); |
| | | |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | } |