|
@@ -3,14 +3,21 @@ package com.cyksj.service.order.impl;
|
|
|
import cn.hutool.core.date.DateField;
|
|
import cn.hutool.core.date.DateField;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
-import com.alipay.api.*;
|
|
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
|
|
+import com.alipay.api.AlipayApiException;
|
|
|
|
|
+import com.alipay.api.AlipayClient;
|
|
|
|
|
+import com.alipay.api.AlipayRequest;
|
|
|
import com.alipay.api.domain.AlipayTradePagePayModel;
|
|
import com.alipay.api.domain.AlipayTradePagePayModel;
|
|
|
|
|
+import com.alipay.api.domain.AlipayTradeRefundModel;
|
|
|
import com.alipay.api.domain.AlipayTradeWapPayModel;
|
|
import com.alipay.api.domain.AlipayTradeWapPayModel;
|
|
|
import com.alipay.api.internal.util.AlipaySignature;
|
|
import com.alipay.api.internal.util.AlipaySignature;
|
|
|
import com.alipay.api.request.AlipayTradePagePayRequest;
|
|
import com.alipay.api.request.AlipayTradePagePayRequest;
|
|
|
|
|
+import com.alipay.api.request.AlipayTradeRefundRequest;
|
|
|
import com.alipay.api.request.AlipayTradeWapPayRequest;
|
|
import com.alipay.api.request.AlipayTradeWapPayRequest;
|
|
|
|
|
+import com.alipay.api.response.AlipayTradeRefundResponse;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
+import com.cyksj.common.AliPayCommon;
|
|
|
import com.cyksj.common.EnvCommonService;
|
|
import com.cyksj.common.EnvCommonService;
|
|
|
import com.cyksj.common.constant.TemplateEnum;
|
|
import com.cyksj.common.constant.TemplateEnum;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
@@ -18,11 +25,14 @@ import com.cyksj.common.snowflake.Sequence;
|
|
|
import com.cyksj.common.task.GlobalThreadPoolTaskExecutor;
|
|
import com.cyksj.common.task.GlobalThreadPoolTaskExecutor;
|
|
|
import com.cyksj.common.util.Codec;
|
|
import com.cyksj.common.util.Codec;
|
|
|
import com.cyksj.common.util.Jsons;
|
|
import com.cyksj.common.util.Jsons;
|
|
|
|
|
+import com.cyksj.common.util.Xmls;
|
|
|
import com.cyksj.config.WeChatConfig;
|
|
import com.cyksj.config.WeChatConfig;
|
|
|
import com.cyksj.config.zfb.BaseZfbConfig;
|
|
import com.cyksj.config.zfb.BaseZfbConfig;
|
|
|
import com.cyksj.config.zfb.ZfbConfig;
|
|
import com.cyksj.config.zfb.ZfbConfig;
|
|
|
import com.cyksj.config.zfb.ZfbProductCode;
|
|
import com.cyksj.config.zfb.ZfbProductCode;
|
|
|
import com.cyksj.dto.RedisKey;
|
|
import com.cyksj.dto.RedisKey;
|
|
|
|
|
+import com.cyksj.dto.Result;
|
|
|
|
|
+import com.cyksj.enums.GatewayResponse;
|
|
|
import com.cyksj.mapper.*;
|
|
import com.cyksj.mapper.*;
|
|
|
import com.cyksj.model.dto.AliPayParams;
|
|
import com.cyksj.model.dto.AliPayParams;
|
|
|
import com.cyksj.model.dto.H5JsPayParams;
|
|
import com.cyksj.model.dto.H5JsPayParams;
|
|
@@ -32,6 +42,9 @@ import com.cyksj.model.entity.*;
|
|
|
import com.cyksj.model.manage.views.OrderDonView;
|
|
import com.cyksj.model.manage.views.OrderDonView;
|
|
|
import com.cyksj.model.request.OrderAttach;
|
|
import com.cyksj.model.request.OrderAttach;
|
|
|
import com.cyksj.model.request.OrderPayRequest;
|
|
import com.cyksj.model.request.OrderPayRequest;
|
|
|
|
|
+import com.cyksj.model.request.WxOrderRefundReq;
|
|
|
|
|
+import com.cyksj.model.request.ZfbOrderRefundReq;
|
|
|
|
|
+import com.cyksj.model.response.AliPayRefundRep;
|
|
|
import com.cyksj.redis.RedisService;
|
|
import com.cyksj.redis.RedisService;
|
|
|
import com.cyksj.service.order.OrderDonService;
|
|
import com.cyksj.service.order.OrderDonService;
|
|
|
import com.cyksj.service.wechat.WeChatService;
|
|
import com.cyksj.service.wechat.WeChatService;
|
|
@@ -105,6 +118,8 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
|
|
|
|
|
private final CustomerServiceMapper customerServiceMapper;
|
|
private final CustomerServiceMapper customerServiceMapper;
|
|
|
|
|
|
|
|
|
|
+ private final RefundOrderDonMapper refundOrderDonMapper;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Throwable.class)
|
|
@Transactional(rollbackFor = Throwable.class)
|
|
|
@Override
|
|
@Override
|
|
@@ -447,7 +462,8 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
orderDon.setMoney(sku.getPrice().multiply(BigDecimal.valueOf(payRequest.getNum())));
|
|
orderDon.setMoney(sku.getPrice().multiply(BigDecimal.valueOf(payRequest.getNum())));
|
|
|
orderDon.setSkuId(payRequest.getSkuId());
|
|
orderDon.setSkuId(payRequest.getSkuId());
|
|
|
orderDon.setRelationId(relation.getId());
|
|
orderDon.setRelationId(relation.getId());
|
|
|
-
|
|
|
|
|
|
|
+ //续费订单
|
|
|
|
|
+ orderDon.setOrderType(2);
|
|
|
orderDon.setStatus(OrderDon.Status.noPayment);
|
|
orderDon.setStatus(OrderDon.Status.noPayment);
|
|
|
orderDon.setUserId(user.getId());
|
|
orderDon.setUserId(user.getId());
|
|
|
orderDon.setGoodsId(goodsDon.getId());
|
|
orderDon.setGoodsId(goodsDon.getId());
|
|
@@ -522,6 +538,215 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
this.updateById(orderDon);
|
|
this.updateById(orderDon);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional(rollbackFor = Throwable.class)
|
|
|
|
|
+ public Result<String> wxRefund(WxOrderRefundReq wxOrderRefundReq) throws Exception {
|
|
|
|
|
+ OrderDon orderDon = orderDonMapper.selectById(wxOrderRefundReq.getOrderId());
|
|
|
|
|
+ GoodsDonSku sku = goodsDonSkuMapper.selectById(orderDon.getSkuId());
|
|
|
|
|
+ GoodsDon goodsDon = goodsDonMapper.selectById(sku.getGoodsId());
|
|
|
|
|
+ if (orderDon.getType() != OrderDon.Type.WeChat) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("该订单不是微信支付的订单");
|
|
|
|
|
+ }
|
|
|
|
|
+ //校验订单是否符合退款
|
|
|
|
|
+ checkOrderRefund(orderDon, goodsDon);
|
|
|
|
|
+ if (wxOrderRefundReq.getRefundMoney().compareTo(orderDon.getMoney()) > 0) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("退款金额大于订单金额");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!redisService.setNx(String.format("%s", wxOrderRefundReq.getOrderId()), wxOrderRefundReq.getOrderId(), 10l)) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("请勿重复点击,正在退款中..");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ long time = System.currentTimeMillis();
|
|
|
|
|
+ //退款订单号
|
|
|
|
|
+ String outRefundNo = Codec.DoDigest.custom()
|
|
|
|
|
+ .setAlgorithm(Codec.DoDigest.Algorithm.MD5)
|
|
|
|
|
+ .setStringData(time + String.valueOf(orderDon.getId()))
|
|
|
|
|
+ .toHexString();
|
|
|
|
|
+ weChatService.refundWxOrder(weChatConfig.getAppid(),
|
|
|
|
|
+ orderDon.getTransactionId(),
|
|
|
|
|
+ outRefundNo,
|
|
|
|
|
+ orderDon.getMoney(),
|
|
|
|
|
+ wxOrderRefundReq.getRefundMoney(),
|
|
|
|
|
+ weChatConfig.getDomain() + "wx/refund/notify");
|
|
|
|
|
+ //修改订单状态
|
|
|
|
|
+ orderDon.setStatus(OrderDon.Status.refund);
|
|
|
|
|
+ orderDon.setRefundMoney(wxOrderRefundReq.getRefundMoney());
|
|
|
|
|
+ orderDonMapper.updateById(orderDon);
|
|
|
|
|
+ //记录退款信息
|
|
|
|
|
+ THREAD_POOL_TASK_EXECUTOR.execute(()->{
|
|
|
|
|
+ refundRecord(orderDon, goodsDon, sku, outRefundNo);
|
|
|
|
|
+ });
|
|
|
|
|
+ //虚物订单退款,清出车队,车票变为已过期
|
|
|
|
|
+ clearUnrealGoodsDetail(orderDon, goodsDon);
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult("退款成功");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional(rollbackFor = Throwable.class)
|
|
|
|
|
+ public Result<String> zfbRefund(ZfbOrderRefundReq zfbOrderRefundReq) throws Exception {
|
|
|
|
|
+ OrderDon orderDon = orderDonMapper.selectById(zfbOrderRefundReq.getOrderId());
|
|
|
|
|
+ GoodsDonSku sku = goodsDonSkuMapper.selectById(orderDon.getSkuId());
|
|
|
|
|
+ GoodsDon goodsDon = goodsDonMapper.selectById(sku.getGoodsId());
|
|
|
|
|
+ if (orderDon.getType() != OrderDon.Type.ALI_PAY) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("该订单不是支付宝支付的订单");
|
|
|
|
|
+ }
|
|
|
|
|
+ //校验订单是否符合退款
|
|
|
|
|
+ checkOrderRefund(orderDon, goodsDon);
|
|
|
|
|
+ if (zfbOrderRefundReq.getRefundMoney().compareTo(orderDon.getMoney()) > 0) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("退款金额大于订单金额");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!redisService.setNx(String.format("%s", zfbOrderRefundReq.getOrderId()), zfbOrderRefundReq.getOrderId(), 10l)) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("请勿重复点击,正在退款中..");
|
|
|
|
|
+ }
|
|
|
|
|
+ //支付宝退款
|
|
|
|
|
+ AlipayClient alipayClient = AliPayCommon.getAlipayClient(ZfbConfig.YHLX_ZfB);
|
|
|
|
|
+ AlipayTradeRefundRequest request = new AlipayTradeRefundRequest();
|
|
|
|
|
+ AlipayTradeRefundModel model = new AlipayTradeRefundModel();
|
|
|
|
|
+ //支付宝交易号
|
|
|
|
|
+ model.setTradeNo(orderDon.getTransactionId());
|
|
|
|
|
+ model.setRefundAmount(zfbOrderRefundReq.getRefundMoney().divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_EVEN).toString());
|
|
|
|
|
+ model.setQueryOptions(List.of("gmt_refund_pay"));
|
|
|
|
|
+ long time = System.currentTimeMillis();
|
|
|
|
|
+ //退款订单号
|
|
|
|
|
+ String outRefundNo = Codec.DoDigest.custom()
|
|
|
|
|
+ .setAlgorithm(Codec.DoDigest.Algorithm.MD5)
|
|
|
|
|
+ .setStringData(time + String.valueOf(orderDon.getId()))
|
|
|
|
|
+ .toHexString();
|
|
|
|
|
+ //退款请求号
|
|
|
|
|
+ model.setOutRequestNo(outRefundNo);
|
|
|
|
|
+ request.setBizModel(model);
|
|
|
|
|
+ AlipayTradeRefundResponse response = alipayClient.execute(request);
|
|
|
|
|
+ if (response.isSuccess()) {
|
|
|
|
|
+ AliPayRefundRep aliPayRefundRep = Jsons.parseObject(response.getBody(), AliPayRefundRep.class);
|
|
|
|
|
+ AliPayRefundRep.AlipayTradeRefundResponse res = aliPayRefundRep.getResponse();
|
|
|
|
|
+ //修改订单状态
|
|
|
|
|
+ orderDon.setStatus(OrderDon.Status.refund);
|
|
|
|
|
+ orderDon.setRefundMoney(res.getRefundFee().multiply(BigDecimal.valueOf(100)));
|
|
|
|
|
+ orderDonMapper.updateById(orderDon);
|
|
|
|
|
+ //记录退款信息
|
|
|
|
|
+ THREAD_POOL_TASK_EXECUTOR.execute(()->{
|
|
|
|
|
+ refundRecord(orderDon, goodsDon, sku, outRefundNo);
|
|
|
|
|
+ });
|
|
|
|
|
+ //虚物订单退款,清出车队,车票变为已过期
|
|
|
|
|
+ clearUnrealGoodsDetail(orderDon, goodsDon);
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult("退款成功");
|
|
|
|
|
+ }
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("退款失败,e:{0}", response.getBody());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 虚物订单退款,清出车队,车票变成已过期
|
|
|
|
|
+ * @param orderDon
|
|
|
|
|
+ * @param goodsDon
|
|
|
|
|
+ */
|
|
|
|
|
+ private void clearUnrealGoodsDetail(OrderDon orderDon, GoodsDon goodsDon) {
|
|
|
|
|
+ if (goodsDon != null && goodsDon.getType() == 1) {
|
|
|
|
|
+ //清出车队,车位变为已过期
|
|
|
|
|
+ Long relationId = orderDon.getRelationId();
|
|
|
|
|
+ GroupsRelation relation = groupsRelationMapper.selectById(relationId);
|
|
|
|
|
+ if (relation != null) {
|
|
|
|
|
+ relation.setUserId(0l);
|
|
|
|
|
+ relation.setStatus(GroupsRelation.Status.none);
|
|
|
|
|
+ groupsRelationMapper.updateById(relation);
|
|
|
|
|
+ delRelation(relation.getId());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 校验订单是否符合退款操作
|
|
|
|
|
+ * @param orderDon
|
|
|
|
|
+ */
|
|
|
|
|
+ private void checkOrderRefund(OrderDon orderDon, GoodsDon goodsDon) {
|
|
|
|
|
+ if (orderDon == null) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("订单不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (orderDon.getType() == OrderDon.Type.EX_CODE) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("兑换码订单不支持退款");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (OrderDon.Status.refund == orderDon.getStatus()) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("该订单已退款");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (OrderDon.Status.noPayment == orderDon.getStatus() || OrderDon.Status.close == orderDon.getStatus()) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("订单{0}状态不支持退款", orderDon.getStatus());
|
|
|
|
|
+ }
|
|
|
|
|
+ //续费订单
|
|
|
|
|
+ if (orderDon.getOrderType() == 2) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("续费订单不支持退款");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (goodsDon != null) {
|
|
|
|
|
+ //虚物订单 7天内可退款
|
|
|
|
|
+ if (goodsDon.getType() == 1 && DateTime.now().isAfter(DateUtil.offsetDay(orderDon.getPayTime(), 7))) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("该虚物订单已过退款时间");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 记录退款信息
|
|
|
|
|
+ */
|
|
|
|
|
+ private void refundRecord(OrderDon orderDon, GoodsDon goodsDon, GoodsDonSku sku, String outRefundNo) {
|
|
|
|
|
+ RefundOrderDon refundOrderDon = refundOrderDonMapper.selectOne(Wrappers.lambdaQuery(RefundOrderDon.class).eq(RefundOrderDon::getOrderId, orderDon.getId()).eq(RefundOrderDon::getOutRefundNo, outRefundNo).last("limit 1"));
|
|
|
|
|
+ if (refundOrderDon == null) {
|
|
|
|
|
+ RefundOrderDon refund = new RefundOrderDon();
|
|
|
|
|
+ refund.setOrderId(orderDon.getId());
|
|
|
|
|
+ refund.setOutRefundNo(outRefundNo);
|
|
|
|
|
+ refund.setTotalFee(orderDon.getMoney());
|
|
|
|
|
+ refund.setRefundDesc("订单退款");
|
|
|
|
|
+ //退款金额
|
|
|
|
|
+ refund.setRefundFee(orderDon.getRefundMoney());
|
|
|
|
|
+ refund.setUserId(orderDon.getUserId());
|
|
|
|
|
+ refund.setGoodsId(orderDon.getGoodsId());
|
|
|
|
|
+ refund.setGoodsTitle(goodsDon == null ? null : goodsDon.getTitle());
|
|
|
|
|
+ refund.setSkuId(orderDon.getSkuId());
|
|
|
|
|
+ refund.setSpecVal(sku == null ? null : String.format("%s%s", sku.getSpecVal(), sku.getPrice().divide(BigDecimal.valueOf(100))));
|
|
|
|
|
+ refund.setRefundMethod(orderDon.getType().name());
|
|
|
|
|
+ refund.setGoodsType(goodsDon == null ? 0 : goodsDon.getType());
|
|
|
|
|
+ refundOrderDonMapper.insert(refund);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void wxRefundNotify(Map<String, String> map) throws Exception {
|
|
|
|
|
+ boolean f = weChatService.checkSignWithMd5(map, weChatConfig.getShopKey());
|
|
|
|
|
+ if (!f) {
|
|
|
|
|
+ log.error("回调数据:{}", map);
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("支付成功回调, 校验签名失败.");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 对退款数据 解密
|
|
|
|
|
+ String md5Key = Codec.DoDigest.custom().setAlgorithm(Codec.DoDigest.Algorithm.MD5).setStringData(weChatConfig.getShopKey()).toHexString();
|
|
|
|
|
+ String reqInfoXml = Codec.DoCipher.custom().setAlgorithm(Codec.DoCipher.Trans.AES_ECB_PKCS7Padding).setBase64Data(map.get("req_info")).setStringKey(md5Key).ofDecrypt().toText();
|
|
|
|
|
+ log.info("=== 退款数据解密: \n {}", reqInfoXml);
|
|
|
|
|
+ Map<String, String> reqInfoMap = Xmls.toMap(reqInfoXml);
|
|
|
|
|
+ // 退款失败
|
|
|
|
|
+ if (StrUtil.equals("CHANGE", reqInfoMap.get("refund_status"))) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("退款异常.");
|
|
|
|
|
+ } else if (StrUtil.equals("REFUNDCLOSE", reqInfoMap.get("refund_status"))) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("退款关闭.");
|
|
|
|
|
+ }
|
|
|
|
|
+ /* 此处处理业务逻辑 */
|
|
|
|
|
+ String outRefundNo = reqInfoMap.get("out_refund_no");
|
|
|
|
|
+ String transactionId = reqInfoMap.get("transaction_id");
|
|
|
|
|
+ String refundFee = reqInfoMap.get("refund_fee");
|
|
|
|
|
+ OrderDon orderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class).eq(OrderDon::getTransactionId, transactionId).last("limit 1"));
|
|
|
|
|
+ if (orderDon == null) {
|
|
|
|
|
+ log.error("退款回调,transactionId:{}订单不存在", transactionId);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ BigDecimal refundMoney = new BigDecimal(refundFee);
|
|
|
|
|
+ if (orderDon.getStatus() == OrderDon.Status.refund) {
|
|
|
|
|
+ if (!orderDon.getRefundMoney().equals(refundMoney)) {
|
|
|
|
|
+ orderDon.setRefundMoney(refundMoney);
|
|
|
|
|
+ orderDonMapper.updateById(orderDon);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ orderDon.setStatus(OrderDon.Status.refund);
|
|
|
|
|
+ orderDon.setRefundMoney(refundMoney);
|
|
|
|
|
+ orderDonMapper.updateById(orderDon);
|
|
|
|
|
+ }
|
|
|
|
|
+ log.info("微信退款: 退款单号[{}] 退款成功.", outRefundNo);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public void setRelation(Long relationId, Long userId, Long goodsId) {
|
|
public void setRelation(Long relationId, Long userId, Long goodsId) {
|
|
|
int noPayCount = count(Wrappers.lambdaQuery(OrderDon.class).eq(OrderDon::getUserId, userId).eq(OrderDon::getGoodsId, goodsId).eq(OrderDon::getStatus, OrderDon.Status.noPayment.toString()));
|
|
int noPayCount = count(Wrappers.lambdaQuery(OrderDon.class).eq(OrderDon::getUserId, userId).eq(OrderDon::getGoodsId, goodsId).eq(OrderDon::getStatus, OrderDon.Status.noPayment.toString()));
|
|
|
|
|
|
|
@@ -572,16 +797,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public AliPayParams commonAliPay(Long orderId, String productCode, ZfbConfig zfbConfig) throws Exception {
|
|
public AliPayParams commonAliPay(Long orderId, String productCode, ZfbConfig zfbConfig) throws Exception {
|
|
|
- AlipayConfig alipayConfig = new AlipayConfig();
|
|
|
|
|
- //网关地址
|
|
|
|
|
- alipayConfig.setServerUrl(BaseZfbConfig.url);
|
|
|
|
|
- alipayConfig.setAppId(zfbConfig.getAppId());
|
|
|
|
|
- alipayConfig.setPrivateKey(zfbConfig.getPrivateKey());
|
|
|
|
|
- alipayConfig.setFormat(BaseZfbConfig.format);
|
|
|
|
|
- alipayConfig.setCharset(BaseZfbConfig.charset);
|
|
|
|
|
- alipayConfig.setSignType(BaseZfbConfig.signType);
|
|
|
|
|
- alipayConfig.setAlipayPublicKey(zfbConfig.getAlipayPublicKey());
|
|
|
|
|
- AlipayClient alipayClient = new DefaultAlipayClient(alipayConfig);
|
|
|
|
|
|
|
+ AlipayClient alipayClient = AliPayCommon.getAlipayClient(zfbConfig);
|
|
|
// 创建API对应的request
|
|
// 创建API对应的request
|
|
|
AlipayRequest alipayRequest = getAliAayRequest(orderId, productCode);
|
|
AlipayRequest alipayRequest = getAliAayRequest(orderId, productCode);
|
|
|
if (alipayRequest == null) {
|
|
if (alipayRequest == null) {
|