Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
package com.czg.service.order.service;
|
||||
|
||||
import com.czg.entity.resp.CzgBaseResp;
|
||||
import com.czg.enums.CzgPayEnum;
|
||||
import com.czg.order.dto.LtPayOtherDTO;
|
||||
import com.czg.order.entity.OrderPayment;
|
||||
import com.czg.pay.CzgPayBaseReq;
|
||||
import com.czg.pay.CzgRefundReq;
|
||||
import com.czg.pay.QueryOrderRespDTO;
|
||||
import com.czg.pay.RefundRespDTO;
|
||||
import com.czg.resp.CzgResult;
|
||||
import lombok.NonNull;
|
||||
@@ -67,7 +67,7 @@ public interface PayService {
|
||||
* @param payOrderId 平台订单号
|
||||
* @param mchOrderNo 商户订单号
|
||||
*/
|
||||
CzgResult<CzgBaseResp> queryPayOrder(Long shopId, String payOrderId, String mchOrderNo);
|
||||
CzgResult<QueryOrderRespDTO> queryPayOrder(Long shopId, String payOrderId, String mchOrderNo, String platform);
|
||||
|
||||
/**
|
||||
* 退款查询
|
||||
|
||||
@@ -1030,12 +1030,12 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void payCallBackOrder(@NotBlank String orderNo, @NotNull PayNotifyRespDTO notifyRespDTO, int retryCount) {
|
||||
public void payCallBackOrder(@NotBlank String orderNo, @NotNull PayNotifyRespDTO notifyRespDTO, String channel, int retryCount) {
|
||||
OrderPayment payment = paymentService.getOne(new QueryWrapper().eq(OrderPayment::getOrderNo, orderNo));
|
||||
if (payment == null) {
|
||||
if (retryCount < MAX_RETRIES) {
|
||||
log.info("支付记录不存在,第 {} 次重试,将在 {} 秒后进行", retryCount + 1, DELAY);
|
||||
executorService.schedule(() -> payCallBackOrder(orderNo, notifyRespDTO, retryCount + 1), DELAY, TimeUnit.SECONDS);
|
||||
executorService.schedule(() -> payCallBackOrder(orderNo, notifyRespDTO, channel, retryCount + 1), DELAY, TimeUnit.SECONDS);
|
||||
} else {
|
||||
log.error("订单支付回调失败, 达到最大重试次数, 支付记录不存在, orderNo: {}", orderNo);
|
||||
}
|
||||
@@ -1049,6 +1049,7 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
payment.setRespJson(notifyRespDTO.getOriginalData());
|
||||
payment.setPayStatus(PayTypeConstants.PayStatus.FAIL);
|
||||
payment.setPlatformType(notifyRespDTO.getPlatform());
|
||||
payment.setChannel(channel);
|
||||
if ("TRADE_SUCCESS".equals(notifyRespDTO.getStatus())) {
|
||||
payment.setPayStatus(PayTypeConstants.PayStatus.SUCCESS);
|
||||
if (PayTypeConstants.SourceType.ORDER.equals(payment.getSourceType())) {
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.czg.constant.PayChannelCst;
|
||||
import com.czg.constants.ParamCodeCst;
|
||||
import com.czg.constants.PayTypeConstants;
|
||||
import com.czg.constants.SystemConstants;
|
||||
import com.czg.entity.resp.CzgBaseResp;
|
||||
import com.czg.enums.CzgPayEnum;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.order.dto.LtPayOtherDTO;
|
||||
@@ -20,6 +19,7 @@ import com.czg.order.service.OrderPaymentService;
|
||||
import com.czg.order.service.ShopMerchantService;
|
||||
import com.czg.pay.CzgPayBaseReq;
|
||||
import com.czg.pay.CzgRefundReq;
|
||||
import com.czg.pay.QueryOrderRespDTO;
|
||||
import com.czg.pay.RefundRespDTO;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.service.order.mapper.OrderPaymentMapper;
|
||||
@@ -146,7 +146,7 @@ public class PayServiceImpl implements PayService {
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public CzgResult<CzgBaseResp> queryPayOrder(@NonNull Long shopId, String payOrderId, String mchOrderNo) {
|
||||
public CzgResult<QueryOrderRespDTO> queryPayOrder(@NonNull Long shopId, String payOrderId, String mchOrderNo, String platform) {
|
||||
ShopMerchant shopMerchant = getMerchant(shopId);
|
||||
PayAdapter adapter = PayAdapterFactory.getAdapter(shopMerchant.getChannel());
|
||||
String payData = null;
|
||||
@@ -155,7 +155,7 @@ public class PayServiceImpl implements PayService {
|
||||
} else if (shopMerchant.getChannel().equals(PayChannelCst.POLY)) {
|
||||
payData = shopMerchant.getPolyPayJson();
|
||||
}
|
||||
return adapter.queryPayOrder(getDomain(), payData, payOrderId, mchOrderNo);
|
||||
return adapter.queryPayOrder(getDomain(), payData, payOrderId, mchOrderNo, platform);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.czg;
|
||||
|
||||
import com.czg.entity.resp.CzgBaseResp;
|
||||
import com.czg.enums.CzgPayEnum;
|
||||
import com.czg.pay.*;
|
||||
import com.czg.resp.CzgResult;
|
||||
@@ -39,7 +38,7 @@ public interface PayAdapter {
|
||||
|
||||
CzgResult<RefundRespDTO> refund(@NotBlank String domain, @NotBlank String payData, String notifyUrl, CzgRefundReq bizData);
|
||||
|
||||
CzgResult<CzgBaseResp> queryPayOrder(@NotBlank String domain, @NotBlank String payData, String payOrderId, String mchOrderNo);
|
||||
CzgResult<QueryOrderRespDTO> queryPayOrder(@NotBlank String domain, @NotBlank String payData, String payOrderId, String mchOrderNo, String platform);
|
||||
|
||||
CzgResult<RefundRespDTO> queryRefund(@NotBlank String domain, @NotBlank String payData, String mchRefundNo, String refundOrderId);
|
||||
|
||||
|
||||
@@ -4,13 +4,9 @@ import com.alibaba.fastjson2.JSONObject;
|
||||
import com.czg.PayAdapter;
|
||||
import com.czg.PayManager;
|
||||
import com.czg.constant.PayChannelCst;
|
||||
import com.czg.entity.resp.CzgBaseResp;
|
||||
import com.czg.enums.CzgPayEnum;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.pay.CzgPayBaseReq;
|
||||
import com.czg.pay.CzgRefundReq;
|
||||
import com.czg.pay.NativeMerchantDTO;
|
||||
import com.czg.pay.RefundRespDTO;
|
||||
import com.czg.pay.*;
|
||||
import com.czg.resp.CzgResult;
|
||||
import lombok.NonNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -61,8 +57,10 @@ public class NativePayAdapter implements PayAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CzgResult<CzgBaseResp> queryPayOrder(String domain, String payData, String payOrderId, String mchOrderNo) {
|
||||
return null;
|
||||
public CzgResult<QueryOrderRespDTO> queryPayOrder(String domain, String payData, String payOrderId, String mchOrderNo, String platform) {
|
||||
NativeMerchantDTO merchantDTO = getMerchantDTO(payData);
|
||||
QueryOrderRespDTO respDTO = PayManager.queryOrderStatus(platform, mchOrderNo, merchantDTO);
|
||||
return CzgResult.success(respDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,10 +9,7 @@ import com.czg.entity.resp.CzgBaseResp;
|
||||
import com.czg.entity.resp.CzgRefundResp;
|
||||
import com.czg.enums.CzgPayEnum;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.pay.CzgPayBaseReq;
|
||||
import com.czg.pay.CzgRefundReq;
|
||||
import com.czg.pay.PolyMerchantDTO;
|
||||
import com.czg.pay.RefundRespDTO;
|
||||
import com.czg.pay.*;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.utils.AssertUtil;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
@@ -60,10 +57,19 @@ public class PolyPayAdapter implements PayAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CzgResult<CzgBaseResp> queryPayOrder(@NotBlank String payData, @NotBlank String domain, String payOrderId, String mchOrderNo) {
|
||||
public CzgResult<QueryOrderRespDTO> queryPayOrder(@NotBlank String payData, @NotBlank String domain, String payOrderId, String mchOrderNo, String platform) {
|
||||
PolyMerchantDTO shopMerchant = JSONObject.parseObject(payData, PolyMerchantDTO.class);
|
||||
PolyPayUtils.queryPayOrder(domain, shopMerchant.getAppId(), shopMerchant.getAppSecret(), payOrderId, mchOrderNo);
|
||||
return null;
|
||||
CzgResult<CzgBaseResp> result = PolyPayUtils.queryPayOrder(domain, shopMerchant.getAppId(), shopMerchant.getAppSecret(), payOrderId, mchOrderNo);
|
||||
if (result.isSuccess()) {
|
||||
QueryOrderRespDTO respDTO = new QueryOrderRespDTO()
|
||||
.setStatus(result.getData().getState())
|
||||
.setOrderNo(result.getData().getMchOrderNo())
|
||||
.setAmount(result.getData().getAmount())
|
||||
.setErrorMsg("")
|
||||
.setOriginResp(JSONObject.toJSONString(result.getData()));
|
||||
return CzgResult.success(respDTO);
|
||||
}
|
||||
return CzgResult.failure(result.getMsg());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user