| | |
| | | package com.dsh.course.controller; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.dsh.course.entity.*; |
| | | import com.dsh.course.entity.TAppUser; |
| | |
| | | import com.dsh.course.feignclient.account.model.Student; |
| | | import com.dsh.course.feignclient.account.model.TCourseInfoRecord; |
| | | import com.dsh.course.feignclient.account.model.TStudent; |
| | | import com.dsh.course.feignclient.activity.CouponClient; |
| | | import com.dsh.course.feignclient.activity.model.Coupon; |
| | | import com.dsh.course.feignclient.model.*; |
| | | import com.dsh.course.feignclient.other.StoreClient; |
| | | import com.dsh.course.feignclient.other.model.Store; |
| | |
| | | import com.dsh.course.model.vo.request.*; |
| | | import com.dsh.course.model.vo.response.*; |
| | | import com.dsh.course.service.*; |
| | | import com.dsh.course.service.impl.CoursePackageOrderStudentServiceImpl; |
| | | import com.dsh.course.util.*; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import net.bytebuddy.asm.Advice; |
| | | import org.aspectj.weaver.ast.Var; |
| | | import io.swagger.models.auth.In; |
| | | import org.checkerframework.checker.units.qual.C; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | |
| | | |
| | | private final SimpleDateFormat format = new SimpleDateFormat("MM-dd HH:mm"); |
| | | |
| | | @Autowired |
| | | private TOrderService orderService; |
| | | |
| | | |
| | | @Autowired |
| | | private ICoursePackageOrderStudentService coursePackageOrderStudentService; |
| | |
| | | return videoVos; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @PostMapping("/base/coursePack/allPaymentCourseList") |
| | | @ResponseBody |
| | | public List<CouponPaymentVo> getAppuserCourseList(@RequestBody Integer appUserId) { |
| | | List<CouponPaymentVo> paymentVos = new ArrayList<>(); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | List<TCoursePackagePayment> list = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("appUserId", appUserId) |
| | | .eq("payType", 3) |
| | | // List<TCoursePackagePayment> list = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>() |
| | | // .eq("appUserId", appUserId) |
| | | // .eq("payType", 3) |
| | | // .eq("payStatus", 2) |
| | | // .eq("state", 1)); |
| | | |
| | | |
| | | List<CoursePackageOrder> list = coursePackageOrderService.list(new QueryWrapper<CoursePackageOrder>().eq("appUserId", appUserId).eq("payType", 3) |
| | | .eq("payStatus", 2) |
| | | .eq("state", 1)); |
| | | |
| | | |
| | | if (list.size() > 0) { |
| | | for (TCoursePackagePayment tCoursePackagePayment : list) { |
| | | for (CoursePackageOrder tCoursePackagePayment : list) { |
| | | CouponPaymentVo couponPaymentVo = new CouponPaymentVo(); |
| | | couponPaymentVo.setTime(simpleDateFormat.format(tCoursePackagePayment.getInsertTime())); |
| | | couponPaymentVo.setAmount(tCoursePackagePayment.getPlayPaiCoin()); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 已报名课程详情 |
| | | */ |
| | |
| | | CourseDetailsResponse courseDetailsResponse = packagePaymentService.queryRegisteredCourseDetails(coursePayId, appUserId, lon, lat); |
| | | |
| | | |
| | | if (orderId != null) { |
| | | TOrder byId = orderService.getById(orderId); |
| | | courseDetailsResponse.setAmount(byId.getPrice()); |
| | | } |
| | | |
| | | |
| | | // if (orderId != null) { |
| | | // TOrder byId = orderService.getById(orderId); |
| | | // courseDetailsResponse.setAmount(byId.getPrice()); |
| | | // } |
| | | return ResultUtil.success(courseDetailsResponse); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | |
| | | |
| | | // @Autowired |
| | | // private ICoursePackageOrderStudentService orderStudentService; |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/coursePackagePayment/consumeCourse") |
| | | public ResultUtil consumeCourse(@RequestBody Integer coursePackagePaymentId) { |
| | | CoursePackageOrderStudent coursePackageOrderStudent = orderStudentService.getById(coursePackagePaymentId); |
| | | |
| | | TCoursePackage coursePackage = coursePackageService.getById(coursePackageOrderStudent.getCoursePackageId()); |
| | | |
| | | if (coursePackageOrderStudent.getLaveClassHours()<coursePackage.getNeedNum()){ |
| | | return ResultUtil.error("当前学员课时数不足"); |
| | | } |
| | | coursePackageOrderStudent.setLaveClassHours(coursePackageOrderStudent.getLaveClassHours()-coursePackage.getNeedNum()); |
| | | orderStudentService.updateById(coursePackageOrderStudent); |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(coursePackageOrderStudent.getId()); |
| | | courseCounsum.setChangeType(0); |
| | | courseCounsum.setNum(coursePackage.getNeedNum()); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("补课"); |
| | | courseCounsumService.save(courseCounsum); |
| | | return ResultUtil.success("补课成功"); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/coursePackagePayment/CountqueryByClassId") |
| | | public Integer CountqueryByClassId(@RequestBody Integer id) { |
| | |
| | | if (null == appUserId) { |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<TCoursePackagePayment> packagePayment = packagePaymentService.list(new LambdaQueryWrapper<TCoursePackagePayment>() |
| | | .eq(TCoursePackagePayment::getCoursePackageId, courseID) |
| | | .eq(TCoursePackagePayment::getAppUserId, appUserId) |
| | | .eq(TCoursePackagePayment::getStudentId, stuId) |
| | | List<CoursePackageOrderStudent> packagePayment = coursePackageOrderStudentService.list(new QueryWrapper<CoursePackageOrderStudent>() |
| | | .eq("coursePackageId", courseID) |
| | | .eq("appUserId", appUserId) |
| | | .eq("studentId", stuId) |
| | | ); |
| | | |
| | | if (ToolUtil.isEmpty(packagePayment) || packagePayment.size() == 0) { |
| | |
| | | ); |
| | | |
| | | List<CoursePackageStudent> coursePackageStudent = cspsService.list(new LambdaQueryWrapper<CoursePackageStudent>() |
| | | .in(CoursePackageStudent::getCoursePackagePaymentId, packagePayment.stream().map(TCoursePackagePayment::getId).collect(Collectors.toList())) |
| | | .in(CoursePackageStudent::getCoursePackagePaymentId, packagePayment.stream().map(CoursePackageOrderStudent::getId).collect(Collectors.toList())) |
| | | .in(CoursePackageStudent::getCoursePackageSchedulingId, coursePackageSchedulings.stream().map(CoursePackageScheduling::getId).collect(Collectors.toList())) |
| | | .eq(CoursePackageStudent::getCoursePackageId, courseID) |
| | | .eq(CoursePackageStudent::getStudentId, stuId) |
| | |
| | | map.put("name", store.getName()); |
| | | map.put("lon", lon); |
| | | map.put("lat", lat); |
| | | |
| | | |
| | | // 找出门店的所有课程 排出体验 |
| | | List<TCoursePackage> list = tcpService.list(new LambdaQueryWrapper<TCoursePackage>().eq(TCoursePackage::getStoreId, courseDetailReq.getStoreId()).ne(TCoursePackage::getType, 3).eq(TCoursePackage::getState, 1).like(TCoursePackage::getClassWeeks, week)); |
| | | List<Integer> collect = list.stream().map(TCoursePackage::getId).collect(Collectors.toList()); |
| | | if (collect.size() == 0) { |
| | | collect.add(-1); |
| | | } |
| | | |
| | | List<CoursePackageScheduling> list8 = coursePackageSchedulingMapper.selectList(new LambdaQueryWrapper<CoursePackageScheduling>() |
| | | .eq(CoursePackageScheduling::getAppUserId, courseDetailReq.getAppUserId()) |
| | | .eq(CoursePackageScheduling::getStudentId, courseDetailReq.getStuId()) |
| | | .in(CoursePackageScheduling::getCoursePackageId, collect) |
| | | ); |
| | | List<Integer> collect1 = list8.stream().map(CoursePackageScheduling::getCoursePackageId).collect(Collectors.toList()); |
| | | // 找出购买的课包 |
| | | List<CoursePackageOrderStudent> list1 = coursePackageOrderStudentService.list(new QueryWrapper<CoursePackageOrderStudent>() |
| | | .eq("appUserId", courseDetailReq.getAppUserId()) |
| | | .eq("studentId", courseDetailReq.getStuId()) |
| | | .in("coursePackageId", collect) |
| | | .in("coursePackageId", collect1) |
| | | .eq("status", 1) |
| | | .eq("state", 1) |
| | | ); |
| | | |
| | | List<Integer> collect1 = list1.stream().map(CoursePackageOrderStudent::getCoursePackageId).collect(Collectors.toList()); |
| | | List<Long> ids = list1.stream().map(CoursePackageOrderStudent::getId).collect(Collectors.toList()); |
| | | |
| | | |
| | | // List<Integer> collect1 = list1.stream().map(CoursePackageOrderStudent::getCoursePackageId).collect(Collectors.toList()); |
| | | // List<Long> ids = list1.stream().map(CoursePackageOrderStudent::getId).collect(Collectors.toList()); |
| | | |
| | | |
| | | for (TCoursePackage tCoursePackage : list) { |
| | |
| | | detailsListVo.setMoney(cashPayment); |
| | | } |
| | | detailsListVo.setNum(tCoursePackage.getNeedNum()); |
| | | |
| | | |
| | | |
| | | if (collect1.contains(tCoursePackage.getId())) { |
| | | // 找出排课记录 |
| | | List<CoursePackageScheduling> list3 = coursePackageSchedulingMapper.selectList(new LambdaQueryWrapper<CoursePackageScheduling>() |
| | |
| | | List<CoursePackageStudent> list4 = cspsService.list(new LambdaQueryWrapper<CoursePackageStudent>() |
| | | .eq(CoursePackageStudent::getAppUserId, courseDetailReq.getAppUserId()) |
| | | .eq(CoursePackageStudent::getCoursePackageId, tCoursePackage.getId()) |
| | | .in(CoursePackageStudent::getCoursePackageSchedulingId, collect2). |
| | | in(CoursePackageStudent::getCoursePackagePaymentId, ids) |
| | | .in(CoursePackageStudent::getCoursePackageSchedulingId, collect2) |
| | | ); |
| | | |
| | | List<CoursePackageStudent> list5 = cspsService.list(new QueryWrapper<CoursePackageStudent>().eq("studentId", courseDetailReq.getStuId()).eq("coursePackageId", tCoursePackage.getId())); |