| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | private String smid = "2088330203191220";//平台支付宝商户号 |
| | | public ResultUtil alipay(VipPayment vipPayment) throws Exception { |
| | | String code = vipPayment.getCode(); |
| | | ResultUtil alipay = payMoneyUtil.alipay("购买年度会员", "购买年度会员", vipPayment.getAppUserId() + "", code, vipPayment.getAmount().toString(), |
| | | String amount = vipPayment.getAmount().toString(); |
| | | ResultUtil alipay = payMoneyUtil.alipay |
| | | (smid,"购买年度会员", "购买年度会员", |
| | | vipPayment.getAppUserId() + "", |
| | | code, vipPayment.getAmount().toString(), |
| | | "/base/appUser/addVipPaymentAliCallback"); |
| | | if (alipay.getCode() == 200) { |
| | | new Thread(new Runnable() { |
| | |
| | | AlipayTradeQueryResponse resultUtil = payMoneyUtil.queryALIOrder(code); |
| | | |
| | | if (resultUtil.getCode().equals("10000")) { |
| | | // Map<String, String> map = resultUtil.getData(); |
| | | // String tradeStatus = map.get("tradeStatus"); |
| | | // String tradeNo = map.get("tradeNo"); |
| | | |
| | | String tradeNo = resultUtil.getTradeNo(); |
| | | String tradeStatus = resultUtil.getTradeStatus(); |
| | | System.out.println("ssssss" + tradeStatus); |
| | | if ("TRADE_CLOSED".equals(tradeStatus) || "TRADE_FINISHED".equals(tradeStatus)) { |
| | | vipPayment1.setState(3); |
| | | VipPaymentServiceImpl.this.updateById(vipPayment1); |
| | | |
| | | return; |
| | | } |
| | | if ("TRADE_SUCCESS".equals(tradeStatus)) { |
| | |
| | | // 注册会员送券 先判断是否有注册送券类型的优惠券 判断优惠券状态 审核是否通过 是否删除 是否在有效期内 是否领取数量达上限 |
| | | List<Long> longs = userConponClient.queryCouponByUser(appUser.getId()); |
| | | redisUtil.setStrValue("VIP_P_" + vipPayment1.getAppUserId(), JSON.toJSONString(longs), 3600); |
| | | // 如果交易结束 将当前订单金额分配到商户 |
| | | payMoneyUtil.confirm(smid,vipPayment.getCode(),tradeNo,amount); |
| | | return; |
| | | } |
| | | if ("WAIT_BUYER_PAY".equals(tradeStatus)) { |
| | |
| | | VipPaymentServiceImpl.this.updateById(vipPayment1); |
| | | |
| | | TAppUser appUser = appUserService.getById(vipPayment1.getAppUserId()); |
| | | Date vipEndTime = appUser.getVipEndTime(); |
| | | if (null == vipEndTime) { |
| | | vipEndTime = new Date(); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(new Date()); |
| | | calendar.setTime(vipEndTime); |
| | | calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) + 1); |
| | | appUser.setIsVip(1); |
| | | appUser.setVipEndTime(calendar.getTime()); |
| | | appUserService.updateById(appUser); |
| | | // 注册会员送券 先判断是否有注册送券类型的优惠券 判断优惠券状态 审核是否通过 是否删除 是否在有效期内 是否领取数量达上限 |