| | |
| | | if(appUser.getIsVip() == 1) { |
| | | if (coursePackagePaymentConfigVo.getVipPrice()<coursePackagePaymentConfigVo.getPaymentPrice()){ |
| | | coursePackagePaymentConfigVo.setPaymentPrice(coursePackagePaymentConfigVo.getVipPrice()); |
| | | coursePackagePaymentConfigVo.setOriginalPrice(coursePackagePaymentConfig.getCashPayment()); |
| | | } |
| | | |
| | | } |
| | |
| | | paymentPrice = new BigDecimal(students.length).multiply(new BigDecimal(paymentPrice)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | Double playPaiCoin = coursePackagePaymentConfigVo.getPlayPaiCoin().doubleValue();//支付币 |
| | | playPaiCoin = new BigDecimal(students.length).multiply(new BigDecimal(playPaiCoin)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); |
| | | if(paymentCourseVo.getPayType() != 3 && paymentPrice.compareTo(paymentCourseVo.getPrice()) != 0&&paymentCourseVo.getCouponId()!=null){ |
| | | return ResultUtil.error("支付金额异常,请刷新后重试"); |
| | | } |
| | | |
| | | // if(paymentCourseVo.getPayType() != 3 && paymentPrice.compareTo(paymentCourseVo.getPrice()) != 0&&paymentCourseVo.getCouponId()!=null){ |
| | | // return ResultUtil.error("支付金额异常,请刷新后重试"); |
| | | // } |
| | | if(paymentCourseVo.getPayType() == 3 && playPaiCoin.compareTo(paymentCourseVo.getPrice()) != 0){ |
| | | return ResultUtil.error("支付金额异常,请刷新后重试"); |
| | | } |
| | |
| | | return weixinpay; |
| | | } |
| | | |
| | | @Autowired |
| | | private TOrderService orderService; |
| | | |
| | | /** |
| | | * 课程支付宝支付 |
| | |
| | | String[] split = paymentCourseVo.getStudentIds().split(";"); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String code = sdf.format(new Date()) + UUIDUtil.getNumberRandom(5); |
| | | List<Long> pays = new ArrayList<>(); |
| | | |
| | | int isContinue = 0; |
| | | |
| | | for (String s : split) { |
| | | // TCoursePackagePayment coursePackagePayment = new TCoursePackagePayment(); |
| | | // coursePackagePayment.setCode(code); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | if (coursePackagePaymentServiceOne==null) { |
| | | isContinue = 1; |
| | | TCoursePackagePayment coursePackagePayment = new TCoursePackagePayment(); |
| | | coursePackagePayment.setCode(code); |
| | | coursePackagePayment.setAppUserId(uid); |
| | |
| | | sId = student.getId(); |
| | | } |
| | | |
| | | pays.add(coursePackagePayment.getId()); |
| | | |
| | | // coursePackagePaymentServiceOne.setPlayPaiCoin(coursePackagePaymentServiceOne.getPlayPaiCoin()+paymentPrice.intValue()); |
| | | |
| | | // addPackageStudent(paymentCourseVo.getId(), uid, Integer.valueOf(s), coursePackagePayment.getId()); |
| | |
| | | courseCounsum.setReason("购买课包"); |
| | | courseCounsumService.save(courseCounsum); |
| | | |
| | | |
| | | |
| | | |
| | | if (hour!=0){ |
| | | CourseCounsum courseCounsum1 = new CourseCounsum(); |
| | | courseCounsum1.setPaymentId(coursePackagePayment.getId()); |
| | |
| | | |
| | | } |
| | | |
| | | //保存订单 |
| | | |
| | | |
| | | |
| | | |
| | | }else { |
| | |
| | | // coursePackagePaymentServiceOne.setLaveClassHours(coursePackagePaymentServiceOne.getLaveClassHours()+coursePackagePaymentConfig.getClassHours()); |
| | | coursePackagePaymentServiceOne.setCode(code); |
| | | // |
| | | // coursePackagePaymentServiceOne.setPayStatus(2); |
| | | coursePackagePaymentServiceOne.setSalesName("续课"); |
| | | coursePackagePaymentServiceOne.setPayStatus(1); |
| | | // coursePackagePaymentServiceOne.setSalesName("续课"); |
| | | coursePackagePaymentServiceOne.setAppUserId(null); |
| | | // coursePackagePaymentServiceOne.setPayStatus(2); |
| | | coursePackagePaymentService.updateById(coursePackagePaymentServiceOne); |
| | | pays.add(coursePackagePaymentServiceOne.getId()); |
| | | |
| | | |
| | | // |
| | | // Integer sId = null; |
| | | // Student student = studentClient.queryDefaultStudent(uid); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | if (paymentCourseVo.getOrderId()==null) { |
| | | TOrder order = new TOrder(); |
| | | order.setIsPay(1); |
| | | order.setPayType(2); |
| | | order.setAppUserId(uid); |
| | | order.setPrice(paymentPrice); |
| | | order.setCode(code); |
| | | |
| | | String paysStr = pays.stream() |
| | | .map(String::valueOf) |
| | | .collect(Collectors.joining(",")); |
| | | order.setPaysId(paysStr); |
| | | |
| | | orderService.save(order); |
| | | |
| | | } |
| | | |
| | | Student student = studentClient.queryDefaultStudent(uid); |
| | | Integer sid=null; |
| | | if(student!=null){ |
| | |
| | | ResultUtil alipay = payMoneyUtil.alipay("购买课程", "购买课程", student.getId().toString(), code, paymentPrice.toString(), "/base/course/aliPaymentCourseCallback"); |
| | | if(alipay.getCode() == 200){ |
| | | Integer finalSid = sid; |
| | | int finalIsContinue = isContinue; |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | |
| | | String tradeNo = alipayTradeQueryResponse.getTradeNo(); |
| | | if("TRADE_CLOSED".equals(s) || "TRADE_FINISHED".equals(s) || num == 10){ |
| | | for (TCoursePackagePayment coursePackagePayment : list) { |
| | | if (coursePackagePayment.getStudentName()!=null){ |
| | | if (coursePackagePayment.getStudentName().equals("续课")){ |
| | | coursePackagePayment.setPayStatus(2); |
| | | } |
| | | } |
| | | |
| | | coursePackagePayment.setStatus(3); |
| | | } |
| | |
| | | coursePackagePayment.setAppUserId(null); |
| | | } |
| | | |
| | | coursePackagePaymentService.updateBatchById(list); |
| | | |
| | | |
| | | for (String s1 : split) { |
| | | TCoursePackagePayment coursePackagePaymentServiceOne = coursePackagePaymentService.getOne(new QueryWrapper<TCoursePackagePayment>().eq("studentId", s).eq("coursePackageId", paymentCourseVo.getId())); |
| | | if (coursePackagePaymentServiceOne!=null) { |
| | | TCoursePackagePayment coursePackagePaymentServiceOne = coursePackagePaymentService.getOne(new QueryWrapper<TCoursePackagePayment>().eq("studentId", s1).eq("coursePackageId", paymentCourseVo.getId())); |
| | | if (finalIsContinue !=1) { |
| | | |
| | | TCoursePackageDiscount discount = coursePackageDiscountService.getOne(new QueryWrapper<TCoursePackageDiscount>().eq("type",4).eq("coursePackageId", paymentCourseVo.getId()).last("limit 1")); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | coursePackagePaymentService.updateBatchById(list); |
| | | System.out.println("===========到达支付"); |
| | | // 2.0 |
| | | String[] coupons = coursePackagePaymentConfig.getCouponIds().split(","); |
| | |
| | | |
| | | for (TCoursePackagePayment coursePackagePayment : list) { |
| | | addPackageStudent(paymentCourseVo.getId(),uid, finalSid,coursePackagePayment.getId(),paymentCourseVo.getPrice()); |
| | | |
| | | |
| | | } |
| | | |
| | | moneyOut(tradeNo,tradeNo); |