| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.course.entity.*; |
| | | import com.dsh.course.feignclient.account.AppUserClient; |
| | | import com.dsh.course.feignclient.account.StudentClient; |
| | | import com.dsh.course.feignclient.account.model.AppUser; |
| | | import com.dsh.course.feignclient.account.model.Student; |
| | | import com.dsh.course.feignclient.model.*; |
| | | import com.dsh.course.feignclient.other.StoreClient; |
| | | import com.dsh.course.feignclient.other.model.Store; |
| | |
| | | @Autowired |
| | | private TCourseService tcService; |
| | | |
| | | |
| | | @Resource |
| | | private StudentClient studentClient; |
| | | |
| | | @Autowired |
| | | private TCoursePackageTypeService coursePackageTypeService; |
| | |
| | | * @param stuId 学员id |
| | | * @return 课包列表 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/coursePack/queryPayment") |
| | | public List<StuCourseResp> getStuCoursePackagePayment(@RequestBody Integer stuId){ |
| | | Integer userIdFormRedis = null; |
| | | try { |
| | | userIdFormRedis = tokenUtil.getUserIdFormRedis(); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | List<StuCourseResp> resps = new ArrayList<>(); |
| | | Student student = studentClient.queryStudentById(stuId); |
| | | List<TCoursePackagePayment> byUserId = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("appUserId",userIdFormRedis) |
| | | .eq("appUserId",student.getAppUserId()) |
| | | .eq("studentId",stuId)); |
| | | |
| | | if (byUserId.size() > 0 ){ |
| | |
| | | * |
| | | * 获取发布的 课包列表 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/coursePack/storeOfCourse") |
| | | public List<CourseOfStoreVo> getStuCourseWithStores(@RequestBody WeeksOfCourseRest courseRest){ |
| | | List<CourseOfStoreVo> course = new ArrayList<>(); |
| | |
| | | .eq("classHours",tCoursePackagePayment.getClassHours())); |
| | | // 获取课程有效结束时间,判断 查询的日期parse 是否在有效期范围内 |
| | | Date expirationDate = DateTimeHelper.getExpirationDate(tCoursePackagePayment.getInsertTime(),tCoursePackage.getValidDays()); |
| | | System.out.println(expirationDate.after(parse)); |
| | | String classWeeks = tCoursePackage.getClassWeeks(); |
| | | System.out.println(StrUtils.dealStrToList(classWeeks).contains(DateTimeHelper.getDayOfWeek(parse))); |
| | | if (expirationDate.after(parse) && StrUtils.dealStrToList(classWeeks).contains(DateTimeHelper.getDayOfWeek(parse))){ |
| | | CourseOfStoreVo storeVo = new CourseOfStoreVo(); |
| | | storeVo.setCourseId(tCoursePackage.getId()); |
| | |
| | | } |
| | | } |
| | | } |
| | | System.out.println(course); |
| | | return course; |
| | | } catch (ParseException e) { |
| | | return null; |
| | |
| | | } |
| | | |
| | | @PostMapping("/base/coursePack/paymentCourse") |
| | | public List<PurchaseRecordVo> queryCourseDetails(@RequestParam("startTime") Date startTime, @RequestParam("endTime") Date endTime,@RequestParam("stuId") Integer stuId, @RequestParam("appUserId") Integer appUserId) { |
| | | public List<PurchaseRecordVo> queryCourseDetails(@RequestBody GetStuSessionList sessionList) { |
| | | List<PurchaseRecordVo> purchaseRecordVos = new ArrayList<>(); |
| | | |
| | | List<TCoursePackagePayment> coursePackage = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>() |
| | | .between("insertTime", startTime,endTime) |
| | | .eq("appUserId",appUserId) |
| | | .eq("studentId",stuId)); |
| | | .between("insertTime", sessionList.getStartTime(),sessionList.getEndTime()) |
| | | .eq("appUserId",sessionList.getAppUserId()) |
| | | .eq("studentId",sessionList.getStuId())); |
| | | if (coursePackage.size() > 0 ){ |
| | | coursePackage.forEach( cspackage -> { |
| | | PurchaseRecordVo recordVo = new PurchaseRecordVo(); |
| | |
| | | if (integers.size() > 0){ |
| | | StringBuilder courWeeks = new StringBuilder("每"); |
| | | for (Integer integer : integers) { |
| | | switch (integer){ |
| | | case 1: |
| | | courWeeks.append("周一、"); |
| | | break; |
| | | case 2: |
| | | courWeeks.append("周二、"); |
| | | break; |
| | | case 3: |
| | | courWeeks.append("周三、"); |
| | | break; |
| | | case 4: |
| | | courWeeks.append("周四、"); |
| | | break; |
| | | case 5: |
| | | courWeeks.append("周五、"); |
| | | break; |
| | | case 6: |
| | | courWeeks.append("周六、"); |
| | | break; |
| | | case 7: |
| | | courWeeks.append("周末、"); |
| | | break; |
| | | default: |
| | | break; |
| | | courWeeks.append(integer).append("、"); |
| | | } |
| | | } |
| | | if (courWeeks.length() > 0 && courWeeks.charAt(courWeeks.length() - 1) == ','){ |
| | | if (courWeeks.length() > 0 && courWeeks.charAt(courWeeks.length() - 1) == '、'){ |
| | | courWeeks.deleteCharAt(courWeeks.length() - 1); |
| | | } |
| | | courseVo.setCourseWeek(courWeeks.toString()); |
| | |
| | | } |
| | | |
| | | @PostMapping("/base/coursePack/allAmountPayRecordOfUser") |
| | | public List<TCoursePackagePayment> getAmountPayRecord(@RequestBody Integer appUserId){ |
| | | public List<TCoursePackagePayment> getAmountPayRecord(@RequestBody BillingDataRequestVo billingDataRequestVo){ |
| | | return packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("appUserId",appUserId) |
| | | .eq("appUserId",billingDataRequestVo.getAppUserId()) |
| | | .notIn("payType",3) |
| | | .eq("payStatus",2) |
| | | .eq("state",1)); |
| | | .eq("state",1) |
| | | .between("insertTime",billingDataRequestVo.getMonthStart(),billingDataRequestVo.getMonthEnd())); |
| | | } |
| | | |
| | | |
| | |
| | | baseVo.setName(coursePackage.getName()); |
| | | list.add(baseVo); |
| | | }); |
| | | return ResultUtil.success(); |
| | | return ResultUtil.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<Integer> courseIds = new ArrayList<>(); |
| | | List<TCoursePackagePayment> tCoursePackagePayments = packagePaymentService.list(new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("coursePackageId",search.getCourseTypeId()) |
| | | .eq("appUserId",appUserId)); |
| | | QueryWrapper<TCoursePackagePayment> queryWrapper = new QueryWrapper<TCoursePackagePayment>().eq("appUserId", appUserId) |
| | | .groupBy("coursePackageId"); |
| | | if (ToolUtil.isNotEmpty(search.getCourseTypeId())){ |
| | | queryWrapper.eq("coursePackageId",search.getCourseTypeId()); |
| | | } |
| | | List<TCoursePackagePayment> tCoursePackagePayments = packagePaymentService.list(queryWrapper); |
| | | if (tCoursePackagePayments.size() > 0 ){ |
| | | courseIds = tCoursePackagePayments.stream().map(TCoursePackagePayment::getCoursePackageId).collect(Collectors.toList()); |
| | | } |
| | |
| | | |
| | | |
| | | @PostMapping("/base/coursePack/obtainStudentClassDetails") |
| | | public List<RecordAppoint> obtainStudentClassDetailsData(@RequestBody Integer stuId){ |
| | | public List<RecordAppoint> obtainStudentClassDetailsData(@RequestBody WeeksOfCourseRest stuId){ |
| | | try { |
| | | Integer appUserId = tokenUtil.getUserIdFormRedis(); |
| | | return packagePaymentService.obtainStuClassDetails(stuId,appUserId); |
| | | return packagePaymentService.obtainStuClassDetails(stuId.getStuId(),stuId.getAppUserId()); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | throw new RuntimeException(); |