| | |
| | | siteBooking.setPayMoney(BigDecimal.ZERO.doubleValue()); |
| | | siteBooking.setPayTime(new Date()); |
| | | siteBookingService.updateById(siteBooking); |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | consumeCouponAfterSuccessfulPayment(siteBooking); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("siteBooking", siteBooking.getId().toString()); |
| | | map.put("paySuccess", true); |
| | | return ResultUtil.success(map); |
| | | } |
| | | if (reservationSite.getPayType() == 1 ) {//微信支付 |
| | |
| | | // 平台 |
| | | ResultUtil weixinpay = payMoneyUtil.weixinpay("预约场地", id.toString(), code, paymentPrice.toString(), |
| | | "/base/site/weChatPaymentSiteCallback", "APP", ""); |
| | | return weixinpay; |
| | | return appendPaySuccess(weixinpay, false); |
| | | } else { |
| | | String smidVx = operatorUserService.getmerchantNumberByOperatorId(store.getOperatorId()); |
| | | if (!StringUtils.hasLength(smidVx)) { |
| | | return ResultUtil.error("运营商未配置微信商户号,获取支付失败!"); |
| | | } |
| | | return payMoneyUtil.weixinpayV3(smidVx, "预约场地" |
| | | return appendPaySuccess(payMoneyUtil.weixinpayV3(smidVx, "预约场地" |
| | | , code, "/base/site/weChatPaymentSiteCallback1", |
| | | paymentPrice.toString(), id.toString()); |
| | | paymentPrice.toString(), id.toString()), false); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | ResultUtil alipay = payMoneyUtil.alipay(smid1, "预约场地", "预约场地", id.toString(), code, paymentPrice.toString(), "/base/site/aliPaymentSiteCallback"); |
| | | System.out.println("预约场地----" + alipay.getCode()); |
| | | return alipay; |
| | | return appendPaySuccess(alipay, false); |
| | | } |
| | | |
| | | private void extracted(Integer operatorId, BigDecimal coursePackageOrder1, String tradeNo) throws Exception { |
| | |
| | | siteBooking.setPayTime(new Date()); |
| | | siteBooking.setStatus(1); |
| | | siteBookingService.updateById(siteBooking); |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | consumeCouponAfterSuccessfulPayment(siteBooking); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("siteBooking", siteBooking.getId().toString()); |
| | | map.put("paySuccess", true); |
| | | return ResultUtil.success(map); |
| | | } |
| | | |
| | | /** 支付参数生成成功不等于已支付,前端仍需拉起微信或支付宝。 */ |
| | | private ResultUtil appendPaySuccess(ResultUtil paymentResult, boolean paySuccess) { |
| | | JSONObject data = paymentResult.getData() == null ? new JSONObject() |
| | | : JSON.parseObject(JSON.toJSONString(paymentResult.getData())); |
| | | if (data == null) { |
| | | data = new JSONObject(); |
| | | } |
| | | data.put("paySuccess", paySuccess); |
| | | return ResultUtil.getResult(paymentResult.getCode(), paymentResult.getMsg(), data); |
| | | } |
| | | |
| | | /** |
| | | * 场地订单实际支付成功后才核销所选优惠券;避免仅创建待支付订单就提前消耗优惠券。 |
| | | */ |
| | | private void consumeCouponAfterSuccessfulPayment(SiteBooking siteBooking) { |
| | | if (siteBooking.getUserCouponId() == null || siteBooking.getUserCouponId() == 0) { |
| | | return; |
| | | } |
| | | UserCoupon userCoupon = userCouponClient.queryUserCouponById( |
| | | new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(), siteBooking.getAppUserId())); |
| | | if (userCoupon != null && Integer.valueOf(1).equals(userCoupon.getStatus())) { |
| | | userCoupon.setStatus(2); |
| | | userCouponClient.updateUserCoupon(userCoupon); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | userCoupon.setStatus(2); |
| | | userCouponClient.updateUserCoupon(userCoupon); |
| | | } |
| | | if (null != couponId && payType == 3) { |
| | | UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(), appUser.getId())); |
| | | userCoupon.setStatus(1); |
| | | userCouponClient.updateUserCoupon(userCoupon); |
| | | } |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | siteBooking.setOrderNo(sdf.format(new Date()) + UUIDUtil.getNumberRandom(3)); |
| | | |
| | |
| | | siteBooking.setPayMoney(playCoin.doubleValue()); |
| | | } else { |
| | | siteBooking.setPayMoney(money.doubleValue()); |
| | | } |
| | | if (payType == 3) { |
| | | siteBooking.setUserCouponId(null); |
| | | } |
| | | siteBookingService.updateById(siteBooking); |
| | | if (payType == 1) {//微信支付 |