| | |
| | | import com.ruoyi.other.service.TVipService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.payment.api.feignClient.AliPaymentClient; |
| | | import com.ruoyi.payment.api.feignClient.WxPaymentClient; |
| | | import com.ruoyi.payment.api.feignClient.IcbcPaymentClient; |
| | | import com.ruoyi.payment.api.vo.AliPaymentReq; |
| | | import com.ruoyi.payment.api.vo.AliPaymentResp; |
| | | import com.ruoyi.payment.api.vo.PaymentOrder; |
| | | import com.ruoyi.payment.api.vo.IcbcPaymentReq; |
| | | import com.ruoyi.payment.api.vo.IcbcPaymentResp; |
| | | import org.apache.poi.util.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Resource |
| | | private WxPaymentClient wxPaymentClient; |
| | | private IcbcPaymentClient icbcPaymentClient; |
| | | @Resource |
| | | private AliPaymentClient aliPaymentClient; |
| | | |
| | |
| | | shopOrder.setDiscountAmount(discountMoney); |
| | | shopOrder.setPaymentAmount(payMoney); |
| | | shopOrder.setPaymentStatus(1); |
| | | shopOrder.setPaymentType(payType); |
| | | shopOrder.setPaymentType(payType == 1 ? 3 : payType); |
| | | shopOrder.setPayTime(LocalDateTime.now()); |
| | | shopOrder.setDelFlag(false); |
| | | R<Long> longR = orderClient.addVipOrder(shopOrder); |
| | |
| | | } |
| | | |
| | | if (payType==1){ |
| | | //调起支付 |
| | | PaymentOrder paymentOrder = new PaymentOrder(); |
| | | paymentOrder.setCode(shopOrder.getCode()); |
| | | paymentOrder.setAmount(shopOrder.getPaymentAmount()); |
| | | paymentOrder.setOpenId(user.getWxOpenid()); |
| | | paymentOrder.setDescription("购买会员"); |
| | | return AjaxResult.success(wxPaymentClient.orderPay(paymentOrder).getData()); |
| | | IcbcPaymentReq paymentReq = new IcbcPaymentReq(); |
| | | paymentReq.setOutTradeNo(shopOrder.getCode()); |
| | | paymentReq.setAmount(shopOrder.getPaymentAmount()); |
| | | paymentReq.setOpenId(user.getWxOpenid()); |
| | | paymentReq.setPaymentType(1); |
| | | paymentReq.setSubject("购买会员"); |
| | | paymentReq.setBody(shopOrder.getTitle()); |
| | | R<IcbcPaymentResp> paymentResult = icbcPaymentClient.payment(paymentReq); |
| | | if (paymentResult == null || paymentResult.getCode() != 200 || paymentResult.getData() == null) { |
| | | return AjaxResult.error(paymentResult == null ? "工行支付无响应" : paymentResult.getMsg()); |
| | | } |
| | | IcbcPaymentResp paymentResp = paymentResult.getData(); |
| | | if (!"SUCCESS".equals(paymentResp.getStatus())) { |
| | | return AjaxResult.error(paymentResp.getRawResponse()); |
| | | } |
| | | return AjaxResult.success(paymentResp); |
| | | }else { |
| | | AliPaymentReq req = new AliPaymentReq(); |
| | | req.setOutTradeNo(shopOrder.getCode()); |