This commit is contained in:
鲨鱼
2024-12-21 00:21:28 +08:00
parent 10a5f1c903
commit 583fb29acc
15 changed files with 712 additions and 57 deletions

View File

@@ -17,7 +17,7 @@ public interface PayTrdConfigService extends IService<PayTrdConfig> {
JSONObject queryOrder(String orderNo, String trdPayType);
JSONObject resetOrder(String orderNo, String trdPayType);
JSONObject resetOrder(String orderNo, String trdPayType,boolean updateData);
void enableStatus(Long id, Integer enableStatus);
}

View File

@@ -1,6 +1,5 @@
package com.ruoyi.cai.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -9,21 +8,16 @@ import com.ruoyi.cai.mapper.PayTrdConfigMapper;
import com.ruoyi.cai.pay.PayManager;
import com.ruoyi.cai.pay.PayOrderInfoDTO;
import com.ruoyi.cai.pay.PayReturnResp;
import com.ruoyi.cai.pay.PayTypeEnum;
import com.ruoyi.cai.service.OrderLogsService;
import com.ruoyi.cai.service.PayTrdConfigService;
import com.ruoyi.cai.trdpay.TrdPayManager;
import com.ruoyi.cai.trdpay.TrdPayTypeEnum;
import com.ruoyi.common.exception.ServiceException;
import com.tencentcloudapi.gme.v20180711.models.AppStatisticsItem;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.Map;
/**
* 四方支付配置Service业务层处理
*
@@ -51,6 +45,9 @@ public class PayTrdConfigServiceImpl extends ServiceImpl<PayTrdConfigMapper, Pay
if(typeEnum == null){
throw new ServiceException("未开启支付,请联系客服");
}
PayReturnResp orderAliMerge = trdPayManager.createOrderAliMerge(dto, payTrdConfig, typeEnum);
return orderAliMerge;
/*
JSONObject jsonObject = trdPayManager.createOrderAli(dto, payTrdConfig, typeEnum);
if(jsonObject == null){
log.error("第三方支付失败 返回数据为空");
@@ -82,7 +79,7 @@ public class PayTrdConfigServiceImpl extends ServiceImpl<PayTrdConfigMapper, Pay
String payUrl = jsonObject.getJSONObject("payParams").getString("payUrl");
return PayReturnResp.createH5(payUrl);
}
return null;
return null;*/
}
@@ -118,7 +115,7 @@ public class PayTrdConfigServiceImpl extends ServiceImpl<PayTrdConfigMapper, Pay
}
@Override
public JSONObject resetOrder(String orderNo, String trdPayType){
public JSONObject resetOrder(String orderNo, String trdPayType,boolean updateData){
// PayOrderInfoDTO orderInfo = payManager.getOrderInfo(orderNo);
// if(orderInfo == null){
// throw new ServiceException("订单不存在");
@@ -132,7 +129,8 @@ public class PayTrdConfigServiceImpl extends ServiceImpl<PayTrdConfigMapper, Pay
if(typeEnum == null || payTrdConfig == null){
throw new ServiceException("配置数据为空");
}
JSONObject jsonObject = trdPayManager.queryOrder(orderNo,payTrdConfig,typeEnum);
return trdPayManager.resetQuery(orderNo,payTrdConfig,typeEnum,updateData);
/* JSONObject jsonObject = trdPayManager.queryOrder(orderNo,payTrdConfig,typeEnum);
if(typeEnum == TrdPayTypeEnum.V1){ // V1
if(!"SUCCESS".equals(jsonObject.getString("retCode"))){
log.info("第三方支付失败 V1统一支付失败失败 orderNo={}, payTrdConfig={}, typeEnum={}", orderNo, JSON.toJSONString(payTrdConfig),JSON.toJSONString(typeEnum));
@@ -185,7 +183,7 @@ public class PayTrdConfigServiceImpl extends ServiceImpl<PayTrdConfigMapper, Pay
}
return jsonObject;
}
return jsonObject;
return jsonObject;*/
}
@Override