| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alipay.api.AlipayClient; |
| | | import com.alipay.api.DefaultAlipayClient; |
| | | import com.alipay.api.request.AlipayTradeRefundRequest; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | |
| | | * @author mitao |
| | | * @since 2024-05-22 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class PaylogServiceImpl extends ServiceImpl<PaylogMapper, Paylog> implements IPaylogService { |
| | | |
| | |
| | | HttpServletRequest request) { |
| | | Member member = memberClient.getMembeOne(uid, SecurityConstants.INNER).getData(); |
| | | openId = member.getMiniOpenid(); |
| | | String zfbOpenid = member.getZfbOpenid(); |
| | | Double price = 0.0; |
| | | String subject; |
| | | String body; |
| | |
| | | subject = " 订单支付"; |
| | | if (type == 1) { |
| | | // 支付宝预下单 |
| | | return this.alipay(orderNO, subject, body, price, request); |
| | | return this.alipay(zfbOpenid, orderNO, subject, body, price, request); |
| | | } if (type == 2){ |
| | | // 微信预下单 |
| | | return this.wxpay(2 ,orderNO, body, openId, price, request); |
| | |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | if (type == 1) { |
| | | // 支付宝预下单 |
| | | return this.alipay(orderNO, subject, body, price, request); |
| | | return this.alipay(zfbOpenid, orderNO, subject, body, price, request); |
| | | } if (type == 2) { |
| | | // 微信预下单 |
| | | return this.wxpay(2, orderNO, body,openId, price, request); |
| | |
| | | * @param request |
| | | * @return |
| | | */ |
| | | public R<Map<String, Object>> alipay(String orderNo, String subject, String body, Double price, |
| | | public R<Map<String, Object>> alipay(String zfbOpenid, String orderNo, String subject, |
| | | String body, Double price, |
| | | HttpServletRequest request) { |
| | | try { |
| | | // 接口封装支付宝请求参数 |
| | | // Map<String, Object> mData = new HashMap<String, Object>(); |
| | | |
| | | // 构建请求支付签名参数 |
| | | Map<String, Object> pay = PayDemoActivity.appPay(subject, body, price, orderNo); |
| | | // Map<String, Object> pay = PayDemoActivity.appPay(subject, body, price, orderNo); |
| | | Map<String, Object> pay = PayDemoActivity.jsApiPay(subject, body, price, orderNo, |
| | | zfbOpenid); |
| | | /* |
| | | * Set<Entry<String, String>> entrySet = pay.entrySet(); |
| | | * Iterator<Entry<String, String>> iterator = entrySet.iterator(); |
| | | * while (iterator.hasNext()) { Entry<String, String> next = |
| | | * iterator.next(); mData.put(next.getKey(), next.getValue()); } |
| | | */ |
| | | log.info("支付宝预支付信息:{}", JSON.toJSONString(pay)); |
| | | return R.ok(pay); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |