| | |
| | | |
| | | |
| | | 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.TCoursePackageType; |
| | | import com.dsh.course.entity.*; |
| | | import com.dsh.course.feignclient.account.StudentClient; |
| | | 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.model.vo.RegisterCourseVo; |
| | | import com.dsh.course.model.vo.request.ClasspaymentRequest; |
| | | import com.dsh.course.model.vo.request.CourseOfAfterRequest; |
| | | import com.dsh.course.model.vo.request.CourseWithDetailsRequest; |
| | | import com.dsh.course.model.vo.request.UpdateCourseVideoStatusRequest; |
| | | 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.DateUtil; |
| | | import com.dsh.course.util.ResultUtil; |
| | | import com.dsh.course.util.StrUtils; |
| | | import com.dsh.course.util.TokenUtil; |
| | | import com.dsh.course.util.*; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import io.swagger.annotations.Api; |
| | |
| | | @Autowired |
| | | private TCoursePackageDiscountService tcpdService; |
| | | |
| | | @Autowired |
| | | private PostCourseVideoService pcvService; |
| | | |
| | | @Autowired |
| | | private CoursePackageStudentService cpsService; |
| | | private ICoursePackagePaymentConfigService icppcService; |
| | | |
| | | @Autowired |
| | | private CancelledClassesService cacService; |
| | | private UserVideoDetailsService uvdsService; |
| | | |
| | | @Autowired |
| | | private TCourseService tcService; |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private TCoursePackageTypeService coursePackageTypeService; |
| | |
| | | |
| | | @Autowired |
| | | private CancelledClassesService cancelledClassesService; |
| | | |
| | | @Autowired |
| | | private AppUserClient appuClient; |
| | | |
| | | private final SimpleDateFormat format = new SimpleDateFormat("MM-dd HH:mm"); |
| | | |
| | |
| | | @PostMapping("/base/coursePack/afterCourseTwos") |
| | | public List<AfterVideoVo> getAfterCourseTwos(@RequestParam("appUserId") Integer appUserId){ |
| | | List<AfterVideoVo> videoVos = new ArrayList<>(); |
| | | List<TCoursePackagePayment> tCoursePackagePayments = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("appUserId", appUserId)); |
| | | List<Integer> coursePackageIds = tCoursePackagePayments.stream().map(TCoursePackagePayment::getCoursePackageId).collect(Collectors.toList()); |
| | | // List<PostCourseVideo> videoList = pcvService.queryAllVideoNoneShow(coursePackageIds); |
| | | // TODO: 2023/7/6 两个课后视频 |
| | | 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; |
| | | } |
| | | |
| | |
| | | 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)); |
| | | } |
| | |
| | | @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 coursePackageId){ |
| | | public ResultUtil<CourseDetailsResponse> getRegisteredData( Integer coursePayId){ |
| | | try { |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | if(null == appUserId){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return ResultUtil.success(packagePaymentService.queryRegisteredCourseDetails(coursePackageId,appUserId)); |
| | | return ResultUtil.success(packagePaymentService.queryRegisteredCourseDetails(coursePayId,appUserId)); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | |
| | | 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)); |
| | | } |
| | | |
| | | } |