| | |
| | | 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.mapper.CoursePackageSchedulingMapper; |
| | | import com.dsh.course.mapper.TCoursePackageMapper; |
| | | import com.dsh.course.model.*; |
| | | import com.dsh.course.model.dto.DiscountJsonDto; |
| | | import com.dsh.course.model.vo.CourseDetailRequest; |
| | |
| | | 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; |
| | | |
| | |
| | | @RestController |
| | | @RequestMapping("") |
| | | public class CoursePackagePaymentController { |
| | | |
| | | private Logger logger = LoggerFactory.getLogger("business-log"); |
| | | |
| | | |
| | | @Autowired |
| | | private TCoursePackagePaymentService packagePaymentService; |
| | | |
| | | @Autowired |
| | | private ICoursePackageOrderService coursePackageOrderService; |
| | | |
| | | @Autowired |
| | | private TCoursePackageService tcpService; |
| | |
| | | @Resource |
| | | private CoursePackageStudentService cspsService; |
| | | |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | @Resource |
| | | private AppUserClient auClitn; |
| | | |
| | | @Resource |
| | | private StoreClient sreClient; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Autowired |
| | | private RestTemplate internalRestTemplate; |
| | | @Autowired |
| | | private CouponClient couponClient; |
| | | @Autowired |
| | | |
| | | @Resource |
| | | private StoreClient storeClient; |
| | | |
| | | @Autowired |
| | | private TCoursePackageDiscountService discountService; |
| | | |
| | | @Resource |
| | | private CoursePackageSchedulingMapper coursePackageSchedulingMapper; |
| | | |
| | | @Autowired |
| | | private ICoursePackageSchedulingService coursePackageSchedulingService; |
| | | |
| | | @Autowired |
| | | private CoursePackageStudentService coursePackageStudentService; |
| | | @Autowired |
| | |
| | | |
| | | private final SimpleDateFormat format = new SimpleDateFormat("MM-dd HH:mm"); |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private ICoursePackageOrderStudentService coursePackageOrderStudentService; |
| | | |
| | | |
| | | /** |
| | | * 查询学员入学时间 根据第一次购买课包的时间 |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping("/base/coursePackagePayment/getTime") |
| | |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 添加购课记录-后台 |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping("/base/coursePackagePayment/add") |
| | | public Object addCoursePackagePayment(@RequestBody TCoursePackagePayment packagePayment){ |
| | | |
| | | packagePayment.setInsertTime(new Date()); |
| | | packagePayment.setInsertTime(new Date()); |
| | | Integer studentId = packagePayment.getStudentId(); |
| | |
| | | |
| | | return coursePackageStudentService.save(coursePackageStudent); |
| | | } |
| | | |
| | | /** |
| | | * 手动支付 |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping("/base/coursePackagePayment/changeState") |
| | |
| | | |
| | | return packagePaymentService.changeState(dto); |
| | | } |
| | | |
| | | @GetMapping("/coursePackagePayment/courseStore/{appUserId}/{coursePackageId}") |
| | | public List<TCoursePackagePayment> getByUserIdAndCoursePackageId(@PathVariable("appUserId") Integer appUserId,@PathVariable("coursePackageId") Integer coursePackageId){ |
| | | List<TCoursePackagePayment> list = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>() |
| | |
| | | .eq("coursePackageId", coursePackageId)); |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 获取购课记录 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 获取 没有学员信息的图片配置 |
| | | * |
| | | * @param stuId 学员id |
| | | * @return 课包列表 |
| | | */ |
| | |
| | | public List<StuCourseResp> getStuCoursePackagePayment(@RequestBody Integer stuId){ |
| | | List<StuCourseResp> resps = new ArrayList<>(); |
| | | Student student = studentClient.queryStudentById(stuId); |
| | | List<TCoursePackagePayment> byUserId = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>() |
| | | List<CoursePackageOrderStudent> byUserId = coursePackageOrderStudentService.list(new QueryWrapper<CoursePackageOrderStudent>() |
| | | .eq("appUserId",student.getAppUserId()) |
| | | .eq("studentId",stuId).eq("payStatus",2)); |
| | | .eq("studentId", stuId)); |
| | | |
| | | Date date = new Date(); |
| | | |
| | | if (byUserId.size() > 0 ){ |
| | | for (TCoursePackagePayment tCoursePackagePayment : byUserId) { |
| | | for (CoursePackageOrderStudent tCoursePackagePayment : byUserId) { |
| | | TCoursePackage tCoursePackage = tcpService.getById(tCoursePackagePayment.getCoursePackageId()); |
| | | |
| | | if (tCoursePackagePayment.getUseTime()!=null) { |
| | |
| | | resp.setResidueNums(tCoursePackagePayment.getLaveClassHours()); |
| | | resp.setDeductionNums(tCoursePackagePayment.getTotalClassHours()-tCoursePackagePayment.getLaveClassHours()); |
| | | resp.setCourseType(tCoursePackage.getType()); |
| | | if (tCoursePackage.getType()!=1||tCoursePackage.getState()==2||tCoursePackagePayment.getPayStatus()==1){ |
| | | if (tCoursePackage.getType() != 1 || tCoursePackage.getState() == 2) { |
| | | resp.setIsAble(0); |
| | | }else { |
| | | resp.setIsAble(1); |
| | | } |
| | | |
| | | if (tCoursePackagePayment.getUseTime()!=null){ |
| | | // String afterDayDate = DateUtil.getAfterDayDate2(tCoursePackage.getInsertTime(),tCoursePackage.getValidDays() + ""); |
| | | // resp.setPeriodOfValidity(afterDayDate); |
| | | |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String str = sdf.format(tCoursePackagePayment.getUseTime()); |
| | | resp.setPeriodOfValidity(str); |
| | | } |
| | | |
| | | |
| | | |
| | | resps.add(resp); |
| | | } |
| | | } |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String str = sdf.format(date); |
| | | |
| | | for (StuCourseResp resp : resps) { |
| | | |
| | | |
| | | resp.setPeriodOfValidity(str); |
| | | } |
| | | |
| | | |
| | | return resps; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 获取发布的 课包列表 |
| | | */ |
| | | @ResponseBody |
| | |
| | | } |
| | | } |
| | | |
| | | @Autowired |
| | | private ICoursePackageOrderStudentService orderStudentService; |
| | | |
| | | /** |
| | | * |
| | | * 课程名称列表 |
| | | */ |
| | | @PostMapping("/base/coursePack/sessionNames") |
| | | public List<StuSessionDetailsVo> getStuSessionList(@RequestBody CourseDetailRequest request){ |
| | | List<StuSessionDetailsVo> detailsVos = new ArrayList<>(); |
| | | List<TCoursePackagePayment> byUserId = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>() |
| | | List<CoursePackageOrderStudent> byUserId = orderStudentService.list(new QueryWrapper<CoursePackageOrderStudent>() |
| | | .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<Integer> collect = byUserId.stream().map(CoursePackageOrderStudent::getCoursePackageId).collect(Collectors.toList()); |
| | | List<TCoursePackage> list = tcpService.list(new QueryWrapper<TCoursePackage>() |
| | | .in("id", collect)); |
| | | list.forEach(vo -> { |
| | | |
| | | byUserId.forEach(vo -> { |
| | | |
| | | StuSessionDetailsVo detVo = new StuSessionDetailsVo(); |
| | | if (vo.getType()!=2) { |
| | | detVo.setSessionid(vo.getId()); |
| | | detVo.setSessionName(vo.getName()); |
| | | String afterDayDate = DateUtil.getAfterDayDate2(vo.getInsertTime(), vo.getValidDays() + ""); |
| | | detVo.setPeriodOfValidity(afterDayDate); |
| | | detVo.setSessionid(vo.getCoursePackageId()); |
| | | TCoursePackage byId = coursePackageService.getById(vo.getCoursePackageId()); |
| | | detVo.setSessionName(byId.getName()); |
| | | // String afterDayDate = DateUtil.getAfterDayDate2(vo.getInsertTime(), vo.getValidDays() + ""); |
| | | |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | String format1 = simpleDateFormat.format(vo.getUseTime()); |
| | | detVo.setPeriodOfValidity(format1); |
| | | |
| | | detVo.setTotalNums(vo.getTotalClassHours()); |
| | | detVo.setDeductedNums(vo.getTotalClassHours() - vo.getLaveClassHours()); |
| | | detVo.setRemainingNums(vo.getLaveClassHours()); |
| | | |
| | | detailsVos.add(detVo); |
| | | } |
| | | |
| | | |
| | | }); |
| | | |
| | | // list.forEach(vo -> { |
| | | // StuSessionDetailsVo detVo = new StuSessionDetailsVo(); |
| | | // if (vo.getType()!=2) { |
| | | // detVo.setSessionid(vo.getId()); |
| | | // detVo.setSessionName(vo.getName()); |
| | | // String afterDayDate = DateUtil.getAfterDayDate2(vo.getInsertTime(), vo.getValidDays() + ""); |
| | | // detVo.setPeriodOfValidity(afterDayDate); |
| | | // |
| | | // detVo.setTotalNums(ToolUtil.isEmpty(tCoursePackagePayment.getTotalCourseNums()) ? 0 : tCoursePackagePayment.getTotalCourseNums()); |
| | | // detVo.setDeductedNums(ToolUtil.isEmpty(tCoursePackagePayment.getDeductionNums()) ? 0 : tCoursePackagePayment.getDeductionNums()); |
| | | // detVo.setRemainingNums(ToolUtil.isEmpty(tCoursePackagePayment.getResidueNums())? 0 : tCoursePackagePayment.getResidueNums()); |
| | | // |
| | | // detailsVos.add(detVo); |
| | | // } |
| | | // }); |
| | | } |
| | | return detailsVos; |
| | | } |
| | |
| | | |
| | | @PostMapping("/base/coursePack/getRecord") |
| | | public List<PurchaseRecordVo> getRecord(@RequestBody RecordTimeRequest recordTimeRequest) { |
| | | List<TCoursePackagePayment> list = new ArrayList<>(); |
| | | List<CoursePackageOrderStudent> list = new ArrayList<>(); |
| | | Integer [] changes = {1,0}; |
| | | if (recordTimeRequest.getType()==null) { |
| | | list = coursePackagePaymentService.list(new QueryWrapper<TCoursePackagePayment>().eq("studentId", recordTimeRequest.getStuId()).eq("coursePackageId", recordTimeRequest.getLessionId()).orderByDesc("insertTime")); |
| | | list = coursePackageOrderStudentService.list(new QueryWrapper<CoursePackageOrderStudent>().eq("studentId", recordTimeRequest.getStuId()).eq("coursePackageId", recordTimeRequest.getLessionId()).orderByDesc("insertTime")); |
| | | }else { |
| | | |
| | | list = coursePackagePaymentService.list(new QueryWrapper<TCoursePackagePayment>().eq("studentId", recordTimeRequest.getStuId()).eq("coursePackageId", recordTimeRequest.getLessionId()).orderByDesc("insertTime")); |
| | | |
| | | list = coursePackageOrderStudentService.list(new QueryWrapper<CoursePackageOrderStudent>().eq("studentId", recordTimeRequest.getStuId()).eq("coursePackageId", recordTimeRequest.getLessionId()).orderByDesc("insertTime")); |
| | | } |
| | | List<Long> ids = new ArrayList<>(); |
| | | for (TCoursePackagePayment coursePackagePayment : list) { |
| | | ids.add(coursePackagePayment.getId()); |
| | | } |
| | | List<Integer> appUserIds = list.stream().map(CoursePackageOrderStudent::getAppUserId).collect(Collectors.toList()); |
| | | List<CoursePackageOrderStudent> list1 = coursePackageOrderStudentService.list(new QueryWrapper<CoursePackageOrderStudent>() |
| | | .in("appUserId", appUserIds) |
| | | .eq("coursePackageId", recordTimeRequest.getLessionId()) |
| | | .eq("state", 1) |
| | | ); |
| | | List<Long> collect = list1.stream().map(CoursePackageOrderStudent::getId).collect(Collectors.toList()); |
| | | |
| | | |
| | | |
| | | QueryWrapper<CourseCounsum> in = new QueryWrapper<CourseCounsum>().in("paymentId", ids).in("changeType", changes); |
| | | QueryWrapper<CourseCounsum> in = new QueryWrapper<CourseCounsum>().in("paymentId", collect).in("changeType", changes); |
| | | |
| | | if (recordTimeRequest.getType()!=null){ |
| | | if (recordTimeRequest.getType()==2){ |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/base/coursePack/stuOfCourses") |
| | | public StuWithCoursesListVo getStuOfCoursesDetails(@RequestBody GetStuOfCoursesDetails getStuOfCoursesDetails){ |
| | | StuWithCoursesListVo lisco = new StuWithCoursesListVo(); |
| | |
| | | } |
| | | return lisco; |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/base/coursePack/continuingCourse") |
| | |
| | | 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()); |
| | |
| | | } |
| | | |
| | | return ResultUtil.success(coursePackageSchedulings1); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // }catch (Exception e){ |
| | |
| | | if(null == appUserId){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return ResultUtil.success(packagePaymentService.queryRegisteredCourseList(courseTypeId,appUserId)); |
| | | return ResultUtil.success(coursePackageOrderService.queryRegisteredCourseList(courseTypeId, appUserId)); |
| | | }catch (Exception e){ |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | if(null == appUserId){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return ResultUtil.success(packagePaymentService.queryRegisteredCourseDetails(coursePayId,appUserId)); |
| | | CourseDetailsResponse courseDetailsResponse = packagePaymentService.queryRegisteredCourseDetails(coursePayId, appUserId, lon, lat); |
| | | |
| | | |
| | | |
| | | |
| | | // if (orderId != null) { |
| | | // TOrder byId = orderService.getById(orderId); |
| | | // courseDetailsResponse.setAmount(byId.getPrice()); |
| | | // } |
| | | return ResultUtil.success(courseDetailsResponse); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | throw new RuntimeException(e.getMessage()); |
| | | // return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取学员剩余课时 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取学员剩余课时 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | |
| | | @PostMapping("/coursePackagePayment/queryResidueClassHourById") |
| | | public Integer queryResidueClassHourById(@RequestBody Long id){ |
| | | try { |
| | | TCoursePackagePayment list = packagePaymentService.getById(id); |
| | | return list.getLaveClassHours(); |
| | | CoursePackageOrderStudent coursePackageOrderStudent = coursePackageOrderStudentService.getById(id); |
| | | return coursePackageOrderStudent.getLaveClassHours(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return 0; |
| | |
| | | private TCoursePackageService packageService; |
| | | @Autowired |
| | | CoursePackageStudentService studentService ; |
| | | |
| | | /** |
| | | * 课程用于支付进行扣减 |
| | | * |
| | | * @param paymentDeductionClassHour |
| | | */ |
| | | @ResponseBody |
| | |
| | | public void paymentDeductionClassHour(@RequestBody PaymentDeductionClassHour paymentDeductionClassHour){ |
| | | try { |
| | | // 2.0 用id进行查询 |
| | | TCoursePackagePayment coursePackagePayment= packagePaymentService.getOne(new QueryWrapper<TCoursePackagePayment>().eq("id", paymentDeductionClassHour.getCourseId()).eq("payStatus", 2) |
| | | .eq("status", 1).eq("state", 1).gt("laveClassHours", 0)); |
| | | Integer classHour = paymentDeductionClassHour.getClassHour(); |
| | | // TCoursePackagePayment coursePackagePayment = packagePaymentService.getOne(new QueryWrapper<TCoursePackagePayment>().eq("id", paymentDeductionClassHour.getCourseId()).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); |
| | | coursePackagePayment.setAppUserId(null); |
| | | packagePaymentService.updateById(coursePackagePayment); |
| | | |
| | | CourseCounsum courseCounsum = new CourseCounsum(); |
| | | courseCounsum.setPaymentId(coursePackagePayment.getId()); |
| | | courseCounsum.setChangeType(0); |
| | | courseCounsum.setNum(classHour); |
| | | courseCounsum.setInsertTime(new Date()); |
| | | courseCounsum.setReason("报名赛事"); |
| | | courseCounsumService.save(courseCounsum); |
| | | |
| | | |
| | | |
| | | CoursePackageOrderStudent coursePackageOrderStudent = coursePackageOrderStudentService.getById(paymentDeductionClassHour.getCourseId()); |
| | | // if (paymentDeductionClassHour.getClassHour() > coursePackageOrderStudent.getLaveClassHours()) { |
| | | // return ResultUtil.error("当前课包课时数不足"); |
| | | // } |
| | | TCoursePackage coursePackage = coursePackageService.getById(coursePackageOrderStudent.getCoursePackageId()); |
| | | coursePackageOrderStudent.setLaveClassHours(coursePackageOrderStudent.getLaveClassHours() - paymentDeductionClassHour.getClassHour()); |
| | | coursePackageOrderStudentService.updateById(coursePackageOrderStudent); |
| | | //判断剩余课时是否已经全部进行排课,如果排课需要删除已经排好的记录 |
| | | List<CoursePackageScheduling> list1 = coursePackageSchedulingService.list(new QueryWrapper<CoursePackageScheduling>() |
| | | .eq("studentId", coursePackageOrderStudent.getStudentId()).eq("status", 1) |
| | | .eq("type", 1).orderByDesc("classDate")); |
| | | //已经排课但没有使用的课时数量 |
| | | int number = list1.size() * coursePackage.getNeedNum(); |
| | | Integer laveClassHours1 = coursePackageOrderStudent.getLaveClassHours(); |
| | | //需要删除多余的排课记录 |
| | | if(number > laveClassHours1){ |
| | | int n = number - laveClassHours1; |
| | | for (int i = 0; i < n; i++) { |
| | | CoursePackageScheduling coursePackageScheduling = list1.get(i); |
| | | coursePackageSchedulingService.getBaseMapper().deleteById(coursePackageScheduling.getId()); |
| | | |
| | | |
| | | |
| | | List<CoursePackageStudent> studentCourse = coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().eq("studentId", coursePackagePayment.getStudentId()).eq("coursePackageId", coursePackagePayment.getCoursePackageId())); |
| | | List<Long> collect = studentCourse.stream().map(CoursePackageStudent::getCoursePackageSchedulingId).collect(Collectors.toList()); |
| | | coursePackageSchedulingService.remove(new QueryWrapper<CoursePackageScheduling>().in("id",collect)); |
| | | coursePackageStudentService.remove(new QueryWrapper<CoursePackageStudent>().eq("studentId", paymentDeductionClassHour.getId()).eq("coursePackageId", coursePackagePayment.getCoursePackageId())); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | TCoursePackage tCoursePackage = packageService.getById(coursePackagePayment.getCoursePackageId()); |
| | | String classWeeks = tCoursePackage.getClassWeeks(); |
| | | List<Integer> week = week(classWeeks); |
| | | |
| | | TCoursePackagePayment pay = packagePaymentService.getOne(new QueryWrapper<TCoursePackagePayment>().eq("coursePackageId", coursePackagePayment.getCoursePackageId()).eq("studentId", coursePackagePayment.getStudentId())); |
| | | |
| | | Date today = new Date(); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.add(Calendar.DATE, -1); |
| | | today = calendar.getTime(); |
| | | |
| | | |
| | | Integer laveClassHours = pay.getLaveClassHours(); |
| | | Integer codeTime = tCoursePackage.getCodeTime(); |
| | | Integer can = laveClassHours/codeTime; |
| | | |
| | | int count = 0; |
| | | String[] split = tCoursePackage.getClassStartTime().split(","); |
| | | String[] split1 = tCoursePackage.getClassEndTime().split(","); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | |
| | | Date[] dates = generateDateArray(14,today); |
| | | for (Date date : dates) { |
| | | if (count==can){ |
| | | break; |
| | | } |
| | | int wei = cn.hutool.core.date.DateUtil.dayOfWeek(date); |
| | | if (week.contains(wei)){ |
| | | for (int i1 = 0; i1 < split.length; i1++) { |
| | | if (count==can){ |
| | | break; |
| | | } |
| | | CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); |
| | | coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); |
| | | Date parse = format1.parse(format.format(date) + " " + split[i1]); |
| | | Date parse1 = format1.parse(format.format(date) + " " + split1[i1]); |
| | | coursePackageScheduling.setClassDate(parse); |
| | | coursePackageScheduling.setEndDate(parse1); |
| | | coursePackageScheduling.setStatus(1); |
| | | coursePackageSchedulingService.save(coursePackageScheduling); |
| | | CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | student1.setAppUserId(pay.getAppUserId()); |
| | | student1.setStudentId(pay.getStudentId()); |
| | | student1.setCoursePackageId(pay.getCoursePackageId()); |
| | | student1.setCoursePackagePaymentId(pay.getId()); |
| | | student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); |
| | | student1.setSignInOrNot(1); |
| | | student1.setReservationStatus(1); |
| | | student1.setInsertTime(new Date()); |
| | | studentService.save(student1); |
| | | count++; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | // 2.0 少于3课时 推送 |
| | | if (coursePackagePayment.getLaveClassHours() <= 3) { |
| | | Integer appUserId = coursePackagePayment.getAppUserId(); |
| | | |
| | | //调用推送 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 以表单的方式提交 |
| | | headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | String s1 = appUserId + "_" + "Three"; |
| | | //定时修改排课状态 |
| | | String s = internalRestTemplate.getForObject("http://mb-cloud-gateway/netty/sendMsgToClient?id=" + s1, String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if (jsonObject1.getIntValue("code") != 200) { |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | coursePackageStudentService.getBaseMapper().delete(new QueryWrapper<CoursePackageStudent>() |
| | | .eq("coursePackageSchedulingId", coursePackageScheduling.getId())); |
| | | } |
| | | } |
| | | |
| | | 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); |
| | | |
| | | }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(); |
| | | } |
| | | |
| | | |
| | | // if (coursePackagePayment.getLaveClassHours().compareTo(classHour) >= 0) { |
| | | // coursePackagePayment.setLaveClassHours(coursePackagePayment.getLaveClassHours() - classHour); |
| | | // coursePackagePayment.setAppUserId(null); |
| | | // packagePaymentService.updateById(coursePackagePayment); |
| | | // |
| | | // CourseCounsum courseCounsum = new CourseCounsum(); |
| | | // courseCounsum.setPaymentId(coursePackagePayment.getId()); |
| | | // courseCounsum.setChangeType(0); |
| | | // courseCounsum.setNum(classHour); |
| | | // courseCounsum.setInsertTime(new Date()); |
| | | // courseCounsum.setReason("报名赛事"); |
| | | // courseCounsumService.save(courseCounsum); |
| | | // |
| | | // |
| | | // List<CoursePackageStudent> studentCourse = coursePackageStudentService.list(new QueryWrapper<CoursePackageStudent>().eq("studentId", coursePackagePayment.getStudentId()).eq("coursePackageId", coursePackagePayment.getCoursePackageId())); |
| | | // List<Long> collect = studentCourse.stream().map(CoursePackageStudent::getCoursePackageSchedulingId).collect(Collectors.toList()); |
| | | // coursePackageSchedulingService.remove(new QueryWrapper<CoursePackageScheduling>().in("id", collect)); |
| | | // coursePackageStudentService.remove(new QueryWrapper<CoursePackageStudent>().eq("studentId", paymentDeductionClassHour.getId()).eq("coursePackageId", coursePackagePayment.getCoursePackageId())); |
| | | // |
| | | // |
| | | // TCoursePackage tCoursePackage = packageService.getById(coursePackagePayment.getCoursePackageId()); |
| | | // String classWeeks = tCoursePackage.getClassWeeks(); |
| | | // List<Integer> week = week(classWeeks); |
| | | // |
| | | // TCoursePackagePayment pay = packagePaymentService.getOne(new QueryWrapper<TCoursePackagePayment>().eq("coursePackageId", coursePackagePayment.getCoursePackageId()).eq("studentId", coursePackagePayment.getStudentId())); |
| | | // |
| | | // Date today = new Date(); |
| | | // Calendar calendar = Calendar.getInstance(); |
| | | // calendar.add(Calendar.DATE, -1); |
| | | // today = calendar.getTime(); |
| | | // |
| | | // |
| | | // Integer laveClassHours = pay.getLaveClassHours(); |
| | | // Integer codeTime = tCoursePackage.getCodeTime(); |
| | | // Integer can = laveClassHours / codeTime; |
| | | // |
| | | // int count = 0; |
| | | // String[] split = tCoursePackage.getClassStartTime().split(","); |
| | | // String[] split1 = tCoursePackage.getClassEndTime().split(","); |
| | | // SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
| | | // SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | // |
| | | // Date[] dates = generateDateArray(14, today); |
| | | // for (Date date : dates) { |
| | | // if (count == can) { |
| | | // break; |
| | | // } |
| | | // int wei = cn.hutool.core.date.DateUtil.dayOfWeek(date); |
| | | // if (week.contains(wei)) { |
| | | // for (int i1 = 0; i1 < split.length; i1++) { |
| | | // if (count == can) { |
| | | // break; |
| | | // } |
| | | // CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling(); |
| | | // coursePackageScheduling.setCoursePackageId(tCoursePackage.getId()); |
| | | // Date parse = format1.parse(format.format(date) + " " + split[i1]); |
| | | // Date parse1 = format1.parse(format.format(date) + " " + split1[i1]); |
| | | // coursePackageScheduling.setClassDate(parse); |
| | | // coursePackageScheduling.setEndDate(parse1); |
| | | // coursePackageScheduling.setStatus(1); |
| | | // coursePackageSchedulingService.save(coursePackageScheduling); |
| | | // CoursePackageStudent student1 = new CoursePackageStudent(); |
| | | // student1.setAppUserId(pay.getAppUserId()); |
| | | // student1.setStudentId(pay.getStudentId()); |
| | | // student1.setCoursePackageId(pay.getCoursePackageId()); |
| | | // student1.setCoursePackagePaymentId(pay.getId()); |
| | | // student1.setCoursePackageSchedulingId(coursePackageScheduling.getId()); |
| | | // student1.setSignInOrNot(1); |
| | | // student1.setReservationStatus(1); |
| | | // student1.setInsertTime(new Date()); |
| | | // studentService.save(student1); |
| | | // count++; |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | // |
| | | // // 2.0 少于3课时 推送 |
| | | // if (coursePackagePayment.getLaveClassHours() <= 3) { |
| | | // Integer appUserId = coursePackagePayment.getAppUserId(); |
| | | // |
| | | // //调用推送 |
| | | // HttpHeaders headers = new HttpHeaders(); |
| | | // // 以表单的方式提交 |
| | | // headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); |
| | | // String s1 = appUserId + "_" + "Three"; |
| | | // //定时修改排课状态 |
| | | // String s = internalRestTemplate.getForObject("http://mb-cloud-gateway/netty/sendMsgToClient?id=" + s1, String.class); |
| | | // JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | // if (jsonObject1.getIntValue("code") != 200) { |
| | | // System.err.println(jsonObject1.getString("msg")); |
| | | // } |
| | | // } |
| | | // |
| | | // 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); |
| | | // |
| | | // } 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(); |
| | | // } |
| | | // } |
| | | |
| | | |
| | |
| | | } |
| | | return integers; |
| | | } |
| | | |
| | | /** |
| | | * 取消赛事回退支付课时 |
| | | * |
| | | * @param paymentDeductionClassHour |
| | | */ |
| | | @ResponseBody |
| | |
| | | } |
| | | |
| | | |
| | | @Resource |
| | | private TCoursePackageMapper tcpmapper; |
| | | /** |
| | | * 找出符合门店的课包 |
| | | * |
| | | * @param s |
| | | * @return |
| | | */ |
| | |
| | | for (String s2 : split1) { |
| | | storeIds.add(Integer.valueOf(s2)); |
| | | } |
| | | List<TCoursePackagePayment> list = packagePaymentService.list(new LambdaQueryWrapper<TCoursePackagePayment>().eq(TCoursePackagePayment::getAppUserId, integer).ge(TCoursePackagePayment::getLaveClassHours, 0).eq(TCoursePackagePayment::getStatus, 1).eq(TCoursePackagePayment::getState, 1)); |
| | | for (TCoursePackagePayment tCoursePackagePayment : list) { |
| | | Integer coursePackageId = tCoursePackagePayment.getCoursePackageId(); |
| | | TCoursePackage byId = tcpService.getById(coursePackageId); |
| | | if (byId.getType()==3){ |
| | | // List<TCoursePackagePayment> list = packagePaymentService.list(new LambdaQueryWrapper<TCoursePackagePayment>().eq(TCoursePackagePayment::getAppUserId, integer).ge(TCoursePackagePayment::getLaveClassHours, 0).eq(TCoursePackagePayment::getStatus, 1).eq(TCoursePackagePayment::getState, 1)); |
| | | // for (TCoursePackagePayment tCoursePackagePayment : list) { |
| | | // Integer coursePackageId = tCoursePackagePayment.getCoursePackageId(); |
| | | // TCoursePackage byId = tcpService.getById(coursePackageId); |
| | | // if (byId.getType() == 3) { |
| | | // continue; |
| | | // } |
| | | // if (storeIds.contains(byId.getStoreId())) { |
| | | // PayCourseRes payCourseRes = new PayCourseRes(); |
| | | // payCourseRes.setCourseNum(tCoursePackagePayment.getLaveClassHours()); |
| | | // payCourseRes.setId(tCoursePackagePayment.getId()); |
| | | // payCourseRes.setName(byId.getName()); |
| | | // objects.add(payCourseRes); |
| | | // } |
| | | // } |
| | | |
| | | |
| | | |
| | | List<CoursePackageOrderStudent> tCoursePackagePayments = coursePackageOrderStudentService.list(new LambdaQueryWrapper<CoursePackageOrderStudent>().eq(CoursePackageOrderStudent::getAppUserId, integer)); |
| | | // ArrayList<PayCourseRes> payCourseRes = new ArrayList<>(); |
| | | for (CoursePackageOrderStudent tCoursePackagePayment : tCoursePackagePayments) { |
| | | TCoursePackage tCoursePackage = tcpmapper.selectById(tCoursePackagePayment.getCoursePackageId()); |
| | | if (tCoursePackage.getType() != 1) { |
| | | continue; |
| | | } |
| | | if(storeIds.contains(byId.getStoreId())){ |
| | | if (storeIds.contains(tCoursePackage.getStoreId())) { |
| | | PayCourseRes payCourseRes = new PayCourseRes(); |
| | | payCourseRes.setCourseNum(tCoursePackagePayment.getLaveClassHours()); |
| | | payCourseRes.setId(tCoursePackagePayment.getId()); |
| | | payCourseRes.setName(byId.getName()); |
| | | payCourseRes.setName(tCoursePackage.getName()); |
| | | objects.add(payCourseRes); |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | return objects; |
| | | } |
| | | |
| | |
| | | |
| | | /** |
| | | * 课包续费玩湃币支付 |
| | | * |
| | | * @param |
| | | */ |
| | | @PostMapping("/coursePackagePayment/courseRenewPlayPaiPay") |
| | |
| | | public boolean delPaymentCoursePackage(@RequestBody Integer payId){ |
| | | return packagePaymentService.removeById(payId); |
| | | } |
| | | |
| | | @PostMapping("/base/coursePack/updatePaymentCoursePackage") |
| | | public boolean updatePaymentCoursePackage(@RequestBody TCoursePackagePayment packagePayment){ |
| | | boolean id = packagePaymentService.update(packagePayment, new QueryWrapper<TCoursePackagePayment>() |
| | |
| | | String[] split = orderDto.getStuIds().split(","); |
| | | for (String s : split) { |
| | | TCoursePackagePayment coursePackagePaymentServiceOne = coursePackagePaymentService.getOne(new QueryWrapper<TCoursePackagePayment>().eq("studentId", s).eq("coursePackageId",orderDto.getClassId())); |
| | | |
| | | |
| | | |
| | | if (coursePackagePaymentServiceOne==null) { |
| | |
| | | |
| | | @Autowired |
| | | private TCoursePackageService coursePackageService; |
| | | |
| | | private void addPackageStudent(Integer courseId, Integer userId, Integer sId,Long paymentId) throws ParseException { |
| | | // 课包 |
| | | TCoursePackage tCoursePackage = coursePackageService.getById(courseId); |
| | |
| | | @PostMapping("/base/coursePack/obtainStudentClassDetails") |
| | | public List<RecordAppoint> obtainStudentClassDetailsData(@RequestBody WeeksOfCourseRest stuId){ |
| | | // try { |
| | | return packagePaymentService.obtainStuClassDetails(stuId.getStuId(),stuId.getAppUserId(),stuId.getPageNum()); |
| | | return coursePackageOrderStudentService.obtainStuClassDetails(stuId.getStuId(), stuId.getAppUserId(), stuId.getPageNum()); |
| | | // }catch (Exception e){ |
| | | // e.printStackTrace(); |
| | | // throw new RuntimeException(); |
| | |
| | | return icppcService.list(new QueryWrapper<CoursePackagePaymentConfig>() |
| | | .eq("coursePackageId",coursePackageId)); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/base/coursePack/getCoursePackagePaymentOfCode") |
| | |
| | | List<Long> collect = studentCourse.stream().map(CoursePackageStudent::getCoursePackageSchedulingId).collect(Collectors.toList()); |
| | | coursePackageSchedulingService.remove(new QueryWrapper<CoursePackageScheduling>().in("id",collect)); |
| | | coursePackageStudentService.remove(new QueryWrapper<CoursePackageStudent>().eq("studentId", byId.getStudentId()).eq("coursePackageId", byId.getCoursePackageId())); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | TCoursePackage tCoursePackage = packageService.getById(byId.getCoursePackageId()); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | if(b){ |
| | | return 1; |
| | | }else { |
| | |
| | | |
| | | /** |
| | | * 查询课时 |
| | | * |
| | | * @param courseConfigId |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 获取课包报名信息列表 |
| | | * |
| | | * @param queryRegistrationRecord |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 获取未预约排课学员列表 |
| | | * |
| | | * @param queryWalkInStudentList |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据id获取数据 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | |
| | | @PostMapping("/coursePackagePayment/queryCoursePackagePaymentById") |
| | | public TCoursePackagePayment queryCoursePackagePaymentById(@RequestParam("id")Long id){ |
| | | return packagePaymentService.getById(id); |
| | | } |
| | | |
| | | |
| | | // @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("补课成功"); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | /** |
| | | * 修改数据 |
| | | * |
| | | * @param coursePackagePayment |
| | | */ |
| | | @ResponseBody |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 修改数据 |
| | | * |
| | | * @param coursePackagePayment |
| | | */ |
| | | @ResponseBody |
| | |
| | | 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) |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/coursePack/getConsumes") |
| | | List<CourseCounsum> getConsumes(@RequestBody BillingDataRequestVo requestVo) { |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/coursePack/weeksOfCourseDetailsList") |
| | | HashMap<String, Object> weeksOfCourseDetailsList(@RequestBody CourseDetailReq courseDetailReq){ |
| | | public HashMap<String, Object> weeksOfCourseDetailsList(@RequestBody CourseDetailReq courseDetailReq) { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | ArrayList<DetailsListVo> objects = new ArrayList<>(); |
| | | // try { |
| | | String time = courseDetailReq.getTime(); |
| | | Date parse = null; |
| | | try { |
| | |
| | | map.put("name",store.getName()); |
| | | map.put("lon",lon); |
| | | map.put("lat",lat); |
| | | |
| | | String time1 = courseDetailReq.getTime(); |
| | | |
| | | // 找出门店的所有课程 排出体验 |
| | | 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<TCoursePackagePayment> list1 = packagePaymentService.list(new LambdaQueryWrapper<TCoursePackagePayment>().eq(TCoursePackagePayment::getAppUserId, courseDetailReq.getAppUserId()).eq(TCoursePackagePayment::getStudentId, courseDetailReq.getStuId()).in(TCoursePackagePayment::getCoursePackageId, collect)); |
| | | List<Integer> collect1 = list1.stream().map(TCoursePackagePayment::getCoursePackageId).collect(Collectors.toList()); |
| | | List<Long> ids = list1.stream().map(TCoursePackagePayment::getId).collect(Collectors.toList()); |
| | | List<CoursePackageOrderStudent> list1 = coursePackageOrderStudentService.list(new QueryWrapper<CoursePackageOrderStudent>() |
| | | .eq("appUserId", courseDetailReq.getAppUserId()) |
| | | .eq("studentId", courseDetailReq.getStuId()) |
| | | .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()); |
| | | |
| | | |
| | | for (TCoursePackage tCoursePackage : list) { |
| | |
| | | detailsListVo.setMoney(cashPayment); |
| | | } |
| | | detailsListVo.setNum(tCoursePackage.getNeedNum()); |
| | | |
| | | |
| | | |
| | | if (collect1.contains(tCoursePackage.getId())) { |
| | | // 找出排课记录 |
| | | List<CoursePackageScheduling> list3 = coursePackageSchedulingMapper.selectList(new LambdaQueryWrapper<CoursePackageScheduling>() |
| | | .eq(CoursePackageScheduling::getCoursePackageId, tCoursePackage.getId()) |
| | | .like(CoursePackageScheduling::getClassDate, courseDetailReq.getTime()) |
| | | ); |
| | | if(list3.size()==0){ |
| | | if (list3.isEmpty()) { |
| | | detailsListVo.setType(2); |
| | | objects.add(detailsListVo); |
| | | continue; |
| | | } |
| | | //排课的ids |
| | | List<Long> collect2 = list3.stream().map(CoursePackageScheduling::getId).collect(Collectors.toList()); |
| | | if(collect2.size()==0){ |
| | | if (collect2.isEmpty()) { |
| | | collect2.add(-1l); |
| | | } |
| | | |
| | |
| | | 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())); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | }else { |
| | | detailsListVo.setType(2); |
| | | objects.add(detailsListVo); |
| | |
| | | objects.add(detailsListVo); |
| | | |
| | | } |
| | | // objects.add(detailsListVo); |
| | | } |
| | | map.put("data",objects); |
| | | |
| | | return map; |
| | | // } catch (ParseException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return map; |
| | | } |
| | | |
| | | private String week(int i){ |
| | |
| | | for (TCoursePackagePayment tCoursePackagePayment : list1) { |
| | | for (TCoursePackage tCoursePackage : list2) { |
| | | if(tCoursePackagePayment.getCoursePackageId().equals(tCoursePackage.getId())){ |
| | | tCoursePackagePayment.setType(tCoursePackage.getCoursePackageTypeId()); |
| | | tCoursePackagePayment.setType(tCoursePackage.getType()); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | return mapList; |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | map.put("yearData",years); |
| | | |
| | | |
| | | |
| | | ArrayList<Integer> months = new ArrayList<>(); |
| | | |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | |
| | | return map; |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/coursePackagePayment/courseYys") |
| | | HashMap<String, Object> courseYys(@RequestBody List<Integer> userPt){ |
| | |
| | | map.put("yearData",years); |
| | | |
| | | |
| | | |
| | | ArrayList<Integer> months = new ArrayList<>(); |
| | | |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | |
| | | return map; |
| | | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/coursePackagePayment/courseStore") |
| | | HashMap<String, Object> courseStore(@RequestBody List<Integer> userPt){ |
| | |
| | | } |
| | | |
| | | map.put("yearData",years); |
| | | |
| | | |
| | | |
| | | ArrayList<Integer> months = new ArrayList<>(); |