| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.course.entity.TCoursePackage; |
| | | import com.dsh.course.entity.TCoursePackageDiscount; |
| | | import com.dsh.course.entity.TCoursePackagePayment; |
| | | import com.dsh.course.entity.*; |
| | | import com.dsh.course.feignclient.account.AppUserClient; |
| | | import com.dsh.course.feignclient.account.model.AppUser; |
| | | import com.dsh.course.feignclient.model.*; |
| | | import com.dsh.course.model.BaseVo; |
| | | import com.dsh.course.model.dto.DiscountJsonDto; |
| | | import com.dsh.course.model.vo.CourseDetailRequest; |
| | | import com.dsh.course.service.PostCourseVideoService; |
| | | import com.dsh.course.service.TCoursePackageDiscountService; |
| | | import com.dsh.course.service.TCoursePackagePaymentService; |
| | | import com.dsh.course.service.TCoursePackageService; |
| | | import com.dsh.course.util.DateUtil; |
| | | import com.dsh.course.util.StrUtils; |
| | | import com.dsh.course.model.vo.RegisterCourseVo; |
| | | import com.dsh.course.model.vo.request.*; |
| | | import com.dsh.course.model.vo.response.AppUserVideoResponse; |
| | | import com.dsh.course.model.vo.response.CourseDetailsResponse; |
| | | import com.dsh.course.model.vo.response.CourseOfVideoResponse; |
| | | import com.dsh.course.service.*; |
| | | import com.dsh.course.util.*; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | @Autowired |
| | | private TCoursePackageDiscountService tcpdService; |
| | | |
| | | |
| | | @Autowired |
| | | private PostCourseVideoService pcvService; |
| | | private ICoursePackagePaymentConfigService icppcService; |
| | | |
| | | @Autowired |
| | | private UserVideoDetailsService uvdsService; |
| | | |
| | | @Autowired |
| | | private TCourseService tcService; |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private TCoursePackageTypeService coursePackageTypeService; |
| | | |
| | | @Autowired |
| | | private TokenUtil tokenUtil; |
| | | |
| | | @Autowired |
| | | private CancelledClassesService cancelledClassesService; |
| | | |
| | | @Autowired |
| | | private AppUserClient appuClient; |
| | | |
| | | private final SimpleDateFormat format = new SimpleDateFormat("MM-dd HH:mm"); |
| | | |
| | |
| | | @PostMapping("/base/coursePack/queryPayment") |
| | | public List<StuCourseResp> getStuCoursePackagePayment(@RequestParam("stuId") Integer stuId,@RequestParam("appUserId") Integer appUserId){ |
| | | List<StuCourseResp> resps = new ArrayList<>(); |
| | | List<TCoursePackagePayment> byUserId = packagePaymentService.queryAllCoursePackage(null,null,null,stuId,appUserId); |
| | | List<TCoursePackagePayment> byUserId = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("appUserId",appUserId) |
| | | .eq("studentId",stuId)); |
| | | |
| | | if (byUserId.size() > 0 ){ |
| | | for (TCoursePackagePayment tCoursePackagePayment : byUserId) { |
| | | TCoursePackage tCoursePackage = tcpService.getById(tCoursePackagePayment.getCoursePackageId()); |
| | |
| | | @PostMapping("/base/coursePack/sessionNames") |
| | | public List<StuSessionDetailsVo> getStuSessionList(@RequestBody CourseDetailRequest request){ |
| | | List<StuSessionDetailsVo> detailsVos = new ArrayList<>(); |
| | | List<TCoursePackagePayment> byUserId = packagePaymentService.queryAllCoursePackage(request.getStartTime(),request.getEndTime(),null,request.getStuId(),request.getAppUserId()); |
| | | List<TCoursePackagePayment> byUserId = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>() |
| | | .between("insertTime", request.getStartTime(),request.getEndTime()) |
| | | .eq("appUserId",request.getAppUserId()) |
| | | .eq("studentId",request.getStuId())); |
| | | if (byUserId.size() > 0){ |
| | | List<Integer> collect = byUserId.stream().map(TCoursePackagePayment::getCoursePackageId).collect(Collectors.toList()); |
| | | List<TCoursePackage> list = tcpService.list(new QueryWrapper<TCoursePackage>() |
| | |
| | | @PostMapping("/base/coursePack/paymentCourse") |
| | | public List<PurchaseRecordVo> queryCourseDetails(@RequestParam("startTime") Date startTime, @RequestParam("endTime") Date endTime,@RequestParam("stuId") Integer stuId, @RequestParam("appUserId") Integer appUserId) { |
| | | List<PurchaseRecordVo> purchaseRecordVos = new ArrayList<>(); |
| | | List<TCoursePackagePayment> coursePackage = packagePaymentService.queryAllCoursePackage(startTime,endTime,null,stuId, appUserId); |
| | | |
| | | List<TCoursePackagePayment> coursePackage = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>() |
| | | .between("insertTime", startTime,endTime) |
| | | .eq("appUserId",appUserId) |
| | | .eq("studentId",stuId)); |
| | | if (coursePackage.size() > 0 ){ |
| | | coursePackage.forEach( cspackage -> { |
| | | PurchaseRecordVo recordVo = new PurchaseRecordVo(); |
| | |
| | | Integer totalNu = 0; |
| | | Integer dedutNu = 0; |
| | | Integer remainNu = 0; |
| | | List<TCoursePackagePayment> byUserId = packagePaymentService.queryAllCoursePackage(null,null,null,getStuOfCoursesDetails.getStuId(),getStuOfCoursesDetails.getAppUserId()); |
| | | List<TCoursePackagePayment> byUserId = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("appUserId",getStuOfCoursesDetails.getAppUserId()) |
| | | .eq("studentId",getStuOfCoursesDetails.getStuId())); |
| | | if (byUserId.size() > 0 ){ |
| | | for (TCoursePackagePayment tCoursePackagePayment : byUserId) { |
| | | totalNu = totalNu + tCoursePackagePayment.getTotalClassHours(); |
| | |
| | | @PostMapping("/base/coursePack/continuingCourse") |
| | | public StudentOfCourseVo getStudentCourse(@RequestBody GetStudentCourse getStudentCourse){ |
| | | StudentOfCourseVo courseVo = new StudentOfCourseVo(); |
| | | List<TCoursePackagePayment> tCoursePackagePayments = packagePaymentService.queryAllCoursePackage(null,null,getStudentCourse.getCourseId(),getStudentCourse.getStuId(),getStudentCourse.getAppUserId()); |
| | | List<TCoursePackagePayment> tCoursePackagePayments = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("appUserId", getStudentCourse.getAppUserId()) |
| | | .eq("coursePackageId", getStudentCourse.getCourseId()) |
| | | .eq("studentId", getStudentCourse.getStuId())); |
| | | if (tCoursePackagePayments.size() > 0 ){ |
| | | |
| | | List<CourseHoursType> typeList = new ArrayList<>(); |
| | |
| | | } |
| | | |
| | | courseVo.setCourseTime(coursePackage.getClassStartTime()+"-"+coursePackage.getClassEndTime()); |
| | | String payType = tCoursePackagePayment.getPayType(); |
| | | Integer payType = tCoursePackagePayment.getPayType(); |
| | | BigDecimal cashPayment = tCoursePackagePayment.getCashPayment(); |
| | | double cashPaymentValue = cashPayment.doubleValue(); |
| | | Integer playPaiCoin = tCoursePackagePayment.getPlayPaiCoin(); |
| | |
| | | throw new RuntimeException(e); |
| | | } |
| | | switch (payType) { |
| | | case "1;2": |
| | | courseVo.setAmount(cashPaymentValue); |
| | | courseVo.setVipAmount(discountMember); |
| | | courseVo.setWpGold(playPaiCoin); |
| | | break; |
| | | case "1": |
| | | case 1: |
| | | case 2: |
| | | courseVo.setAmount(cashPaymentValue); |
| | | courseVo.setVipAmount(discountMember); |
| | | break; |
| | | case "2": |
| | | case 3: |
| | | courseVo.setWpGold(playPaiCoin); |
| | | break; |
| | | } |
| | |
| | | @PostMapping("/base/coursePack/afterCourseTwos") |
| | | public List<AfterVideoVo> getAfterCourseTwos(@RequestParam("appUserId") Integer appUserId){ |
| | | List<AfterVideoVo> videoVos = new ArrayList<>(); |
| | | List<TCoursePackagePayment> tCoursePackagePayments = packagePaymentService.queryAllCoursePackage(null,null,null,null,appUserId); |
| | | List<Integer> coursePackageIds = tCoursePackagePayments.stream().map(TCoursePackagePayment::getCoursePackageId).collect(Collectors.toList()); |
| | | // List<PostCourseVideo> videoList = pcvService.queryAllVideoNoneShow(coursePackageIds); |
| | | List<UserVideoDetails> list = uvdsService.list(new QueryWrapper<UserVideoDetails>() |
| | | .eq("appUserId",appUserId) |
| | | .eq("state",1)); |
| | | if (list.size() > 0 ){ |
| | | List<Integer> courseIds = list.stream().map(UserVideoDetails::getCourseId).collect(Collectors.toList()); |
| | | List<TCourse> courseList = tcService.list(new QueryWrapper<TCourse>() |
| | | .in("id",courseIds) |
| | | .eq("type",1) |
| | | .eq("state",1) |
| | | .last("ORDER BY insertTime desc LIMIT 2")); |
| | | for (TCourse tCourse : courseList) { |
| | | AfterVideoVo videoVo = new AfterVideoVo(); |
| | | videoVo.setCourseId(tCourse.getId()); |
| | | videoVo.setCourseUrl(tCourse.getCourseVideo()); |
| | | videoVos.add(videoVo); |
| | | } |
| | | } |
| | | return videoVos; |
| | | } |
| | | |
| | | @PostMapping("/base/coursePack/allPaymentCourseList") |
| | | public List<TCoursePackagePayment> getAppuserCourseList(@RequestBody Integer appUserId){ |
| | | return packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("appUserId",appUserId) |
| | | .eq("payType",3) |
| | | .eq("payStatus",2) |
| | | .eq("state",1)); |
| | | } |
| | | |
| | | @PostMapping("/base/coursePack/allAmountPayRecordOfUser") |
| | | public List<TCoursePackagePayment> getAmountPayRecord(@RequestBody Integer appUserId){ |
| | | return packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("appUserId",appUserId) |
| | | .notIn("payType",3) |
| | | .eq("payStatus",2) |
| | | .eq("state",1)); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/course/queryArrangeCourseList") |
| | | @ApiOperation(value = "获取布置课程列表", tags = {"APP-课程列表"}) |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResultUtil<List<BaseVo>> queryArrangePackageType(){ |
| | | try { |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | if(null == appUserId){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<TCoursePackagePayment> tCoursePackagePayments = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("appUserId",appUserId)); |
| | | List<BaseVo> list = new ArrayList<>(); |
| | | tCoursePackagePayments.forEach(c -> { |
| | | BaseVo baseVo = new BaseVo(); |
| | | baseVo.setId(c.getCoursePackageId()); |
| | | TCoursePackage coursePackage = tcpService.getById(c.getCoursePackageId()); |
| | | baseVo.setName(coursePackage.getName()); |
| | | list.add(baseVo); |
| | | }); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 课后视频课表 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/startCource/afterSourceList") |
| | | @ApiOperation(value = "课后视频课表", tags = {"APP-开始上课"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | }) |
| | | public ResultUtil<List<AppUserVideoResponse>> queryAfterSourceList( CourseOfAfterRequest search){ |
| | | try { |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | |
| | | if(null == appUserId){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<Integer> courseIds = new ArrayList<>(); |
| | | List<TCoursePackagePayment> tCoursePackagePayments = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("coursePackageId",search.getCourseTypeId()) |
| | | .eq("appUserId",appUserId)); |
| | | if (tCoursePackagePayments.size() > 0 ){ |
| | | courseIds = tCoursePackagePayments.stream().map(TCoursePackagePayment::getCoursePackageId).collect(Collectors.toList()); |
| | | } |
| | | return ResultUtil.success(packagePaymentService.queryAfterVideo(search,courseIds)); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 课后视频详情 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/startCource/afterSourceDetail") |
| | | @ApiOperation(value = "课后视频详情", tags = {"APP-开始上课"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | }) |
| | | public ResultUtil<CourseOfVideoResponse> queryAfterSourceDetails( CourseWithDetailsRequest detailsRequest){ |
| | | try { |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | if(null == appUserId){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return ResultUtil.success(packagePaymentService.queryVideoDetails(detailsRequest,appUserId)); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 更新课后视频学习状态 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/startCource/updateVideoStatus") |
| | | @ApiOperation(value = "更新课后视频学习状态", tags = {"APP-开始上课"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | }) |
| | | public ResultUtil updateVideoStatus( UpdateCourseVideoStatusRequest detailsRequest){ |
| | | try { |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | if(null == appUserId){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return ResultUtil.success(packagePaymentService.updateVideoStatus(detailsRequest,appUserId)); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/course/getCourseAppUserDetails") |
| | | @ApiOperation(value = "已报名课程-获取课程类型列表", tags = {"APP-课程列表"}) |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResultUtil<List<BaseVo>> queryCoursePackageType(){ |
| | | try { |
| | | List<TCoursePackageType> coursePackageTypes = coursePackageTypeService.list(new QueryWrapper<TCoursePackageType>().eq("state", 1)); |
| | | List<BaseVo> list = new ArrayList<>(); |
| | | coursePackageTypes.forEach(c -> { |
| | | BaseVo baseVo = new BaseVo(); |
| | | BeanUtils.copyProperties(c, baseVo); |
| | | list.add(baseVo); |
| | | }); |
| | | return ResultUtil.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 已报名课程列表 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/startCource/registeredCourses") |
| | | @ApiOperation(value = "已报名课程-课程列表", tags = {"APP-开始上课"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | }) |
| | | public ResultUtil<List<RegisterCourseVo>> queryRegisteredCoursesDetails( CourseOfAfterRequest courseTypeId){ |
| | | try { |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | if(null == appUserId){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return ResultUtil.success(packagePaymentService.queryRegisteredCourseList(courseTypeId,appUserId)); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 已报名课程详情 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/startCource/RegisteredData") |
| | | @ApiOperation(value = "已报名课程详情", tags = {"APP-开始上课"}) |
| | | @ApiImplicitParams({ |
| | | @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){ |
| | | try { |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | if(null == appUserId){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return ResultUtil.success(packagePaymentService.queryRegisteredCourseDetails(coursePayId,appUserId)); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 已报名课程-支付 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/api/startCource/payment") |
| | | @ApiOperation(value = "已报名课程-支付", tags = {"APP-开始上课"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | }) |
| | | public ResultUtil continuationOperation(ClasspaymentRequest request){ |
| | | try { |
| | | Integer userIdFormRedis = tokenUtil.getUserIdFormRedis(); |
| | | if(null == userIdFormRedis){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return packagePaymentService.ContinuationOrpaymentCourse(userIdFormRedis,request); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取学员剩余课时 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/coursePackagePayment/queryResidueClassHour") |
| | | public Integer queryResidueClassHour(@RequestBody Integer id){ |
| | | try { |
| | | List<TCoursePackagePayment> list = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>().eq("studentId", id).eq("payStatus", 2) |
| | | .eq("status", 1).eq("state", 1).gt("laveClassHours", 0)); |
| | | Integer total = 0; |
| | | for (TCoursePackagePayment coursePackagePayment : list) { |
| | | total += coursePackagePayment.getLaveClassHours(); |
| | | } |
| | | return total; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 课程用于支付进行扣减 |
| | | * @param paymentDeductionClassHour |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/coursePackagePayment/paymentDeductionClassHour") |
| | | public void paymentDeductionClassHour(@RequestBody PaymentDeductionClassHour paymentDeductionClassHour){ |
| | | try { |
| | | List<TCoursePackagePayment> list = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>().eq("studentId", paymentDeductionClassHour.getId()).eq("payStatus", 2) |
| | | .eq("status", 1).eq("state", 1).gt("laveClassHours", 0)); |
| | | Integer classHour = paymentDeductionClassHour.getClassHour(); |
| | | for (TCoursePackagePayment coursePackagePayment : list) { |
| | | if(coursePackagePayment.getLaveClassHours().compareTo(classHour) >= 0){ |
| | | coursePackagePayment.setLaveClassHours(coursePackagePayment.getLaveClassHours() - classHour); |
| | | packagePaymentService.updateById(coursePackagePayment); |
| | | |
| | | CancelledClasses cancelledClasses = new CancelledClasses(); |
| | | cancelledClasses.setType(2); |
| | | cancelledClasses.setVoucher(paymentDeductionClassHour.getCode()); |
| | | cancelledClasses.setCoursePackageId(coursePackagePayment.getCoursePackageId()); |
| | | cancelledClasses.setCoursePackagePaymentId(coursePackagePayment.getId()); |
| | | cancelledClasses.setCancelledClassesNumber(classHour); |
| | | cancelledClasses.setInsertTime(new Date()); |
| | | cancelledClassesService.save(cancelledClasses); |
| | | break; |
| | | }else{ |
| | | CancelledClasses cancelledClasses = new CancelledClasses(); |
| | | cancelledClasses.setType(2); |
| | | cancelledClasses.setVoucher(paymentDeductionClassHour.getCode()); |
| | | cancelledClasses.setCoursePackageId(coursePackagePayment.getCoursePackageId()); |
| | | cancelledClasses.setCoursePackagePaymentId(coursePackagePayment.getId()); |
| | | cancelledClasses.setCancelledClassesNumber(coursePackagePayment.getLaveClassHours()); |
| | | cancelledClasses.setInsertTime(new Date()); |
| | | cancelledClassesService.save(cancelledClasses); |
| | | |
| | | coursePackagePayment.setLaveClassHours(0); |
| | | packagePaymentService.updateById(coursePackagePayment); |
| | | |
| | | classHour -= cancelledClasses.getCancelledClassesNumber(); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 取消赛事回退支付课时 |
| | | * @param paymentDeductionClassHour |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/coursePackagePayment/rollbackPaymentDeductionClassHour") |
| | | public void rollbackPaymentDeductionClassHour(@RequestBody PaymentDeductionClassHour paymentDeductionClassHour){ |
| | | try { |
| | | List<CancelledClasses> voucher = cancelledClassesService.list(new QueryWrapper<CancelledClasses>().eq("voucher", paymentDeductionClassHour.getCode())); |
| | | for (CancelledClasses cancelledClasses : voucher) { |
| | | TCoursePackagePayment coursePackagePayment = packagePaymentService.getById(cancelledClasses.getCoursePackagePaymentId()); |
| | | coursePackagePayment.setLaveClassHours(coursePackagePayment.getLaveClassHours() + cancelledClasses.getCancelledClassesNumber()); |
| | | packagePaymentService.updateById(coursePackagePayment); |
| | | |
| | | cancelledClassesService.removeById(cancelledClasses.getId()); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 课包续费玩湃币支付 |
| | | * @param |
| | | */ |
| | | @PostMapping("/coursePackagePayment/courseRenewPlayPaiPay") |
| | | public int paymentWanpaiRenewCourse(@RequestBody PlayPaiGoldCoursePackage coursePackage){ |
| | | try { |
| | | Integer userIdFormRedis = tokenUtil.getUserIdFormRedis(); |
| | | if (null == userIdFormRedis){ |
| | | return 2; |
| | | } |
| | | CoursePackagePaymentConfig paymentConfig = icppcService.getById(coursePackage.getCoursePayConfigId()); |
| | | AppUser appUser = appuClient.queryAppUser(userIdFormRedis); |
| | | if (appUser.getPlayPaiCoins() < paymentConfig.getPlayPaiCoin()){ |
| | | return 3; |
| | | } |
| | | TCoursePackagePayment packagePayment = packagePaymentService.getOne(new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("code",coursePackage.getCode() )); |
| | | packagePayment.setPayStatus(2); |
| | | packagePayment.setPayUserId(userIdFormRedis); |
| | | packagePayment.setClassHours(paymentConfig.getClassHours()); |
| | | packagePayment.setPlayPaiCoin(paymentConfig.getPlayPaiCoin()); |
| | | packagePayment.setTotalClassHours(paymentConfig.getClassHours()); |
| | | packagePayment.setLaveClassHours(paymentConfig.getClassHours()); |
| | | packagePaymentService.updateById(packagePayment); |
| | | |
| | | appUser.setPlayPaiCoins(appUser.getPlayPaiCoins()-paymentConfig.getPlayPaiCoin()); |
| | | appuClient.updateAppUser(appUser); |
| | | } catch (Exception e) { |
| | | return 4; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | @PostMapping("/base/coursePack/getPaymentCoursePackage") |
| | | public TCoursePackagePayment getCoursePackagePaymentByCode(@RequestBody String code){ |
| | | return packagePaymentService.getOne(new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("code",code)); |
| | | } |
| | | |
| | | @PostMapping("/base/coursePack/delPaymentCoursePackage") |
| | | public boolean delPaymentCoursePackage(@RequestBody Integer payId){ |
| | | return packagePaymentService.removeById(payId); |
| | | } |
| | | @PostMapping("/base/coursePack/updatePaymentCoursePackage") |
| | | public boolean updatePaymentCoursePackage(@RequestBody TCoursePackagePayment packagePayment){ |
| | | return packagePaymentService.update(packagePayment,new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("id",packagePayment.getId())); |
| | | } |
| | | |
| | | @PostMapping("/base/coursePack/savePaymentCoursePackage") |
| | | public boolean savePaymentCoursePackage(@RequestBody TCoursePackagePayment packagePayment){ |
| | | return packagePaymentService.save(packagePayment); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/base/coursePack/obtainStudentClassDetails") |
| | | public List<RecordAppoint> obtainStudentClassDetailsData(@RequestBody Integer stuId){ |
| | | try { |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | return packagePaymentService.obtainStuClassDetails(stuId,appUserId); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | throw new RuntimeException(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @PostMapping("/base/coursePack/getCoursePackageConfig") |
| | | public List<CoursePackagePaymentConfig> getCourseConfigList(@RequestBody Integer coursePackageId){ |
| | | return icppcService.list(new QueryWrapper<CoursePackagePaymentConfig>() |
| | | .eq("coursePackageId",coursePackageId)); |
| | | } |
| | | |
| | | } |