修复支付证书的拼接规则。

This commit is contained in:
2025-08-10 02:51:38 +08:00
parent 93957ccf25
commit 3cfc32aae2
3 changed files with 12 additions and 8 deletions

View File

@@ -250,8 +250,9 @@ public class ShopOrderController extends BaseController {
NotificationConfig config; NotificationConfig config;
try { try {
if (active.equals("dev")) { if (active.equals("dev")) {
// 开发环境 - 构建包含租户号的私钥路径 // 开发环境 - 使用配置文件的upload-path构建证书路径
String tenantCertPath = "dev/wechat/" + tenantId; String uploadPath = conf.getUploadPath();
String tenantCertPath = uploadPath + "dev/wechat/" + tenantId;
String privateKeyPath = tenantCertPath + "/" + certConfig.getWechatPay().getDev().getPrivateKeyFile(); String privateKeyPath = tenantCertPath + "/" + certConfig.getWechatPay().getDev().getPrivateKeyFile();
logger.info("开发环境异步通知证书路径: {}", privateKeyPath); logger.info("开发环境异步通知证书路径: {}", privateKeyPath);

View File

@@ -304,8 +304,9 @@ import com.gxwebsoft.common.core.service.PaymentCacheService;
// 开发环境配置 - 使用自动证书配置 // 开发环境配置 - 使用自动证书配置
if (active.equals("dev")) { if (active.equals("dev")) {
// 构建包含租户号的证书路径: dev/wechat/{tenantId}/ // 开发环境 - 使用配置文件的upload-path构建证书路径
String tenantCertPath = "dev/wechat/" + order.getTenantId(); String uploadPath = config.getUploadPath();
String tenantCertPath = uploadPath + "dev/wechat/" + order.getTenantId();
String privateKeyPath = tenantCertPath + "/" + certConfig.getWechatPay().getDev().getPrivateKeyFile(); String privateKeyPath = tenantCertPath + "/" + certConfig.getWechatPay().getDev().getPrivateKeyFile();
System.out.println("开发环境证书路径 - 租户ID: " + order.getTenantId()); System.out.println("开发环境证书路径 - 租户ID: " + order.getTenantId());
@@ -395,8 +396,9 @@ import com.gxwebsoft.common.core.service.PaymentCacheService;
payment.getPubKeyId() != null && !payment.getPubKeyId().isEmpty()) { payment.getPubKeyId() != null && !payment.getPubKeyId().isEmpty()) {
try { try {
// 开发环境固定使用 wechatpay_public_key.pem // 开发环境使用配置文件的upload-path构建公钥路径
String tenantCertPath = "dev/wechat/" + order.getTenantId(); String uploadPath = config.getUploadPath();
String tenantCertPath = uploadPath + "dev/wechat/" + order.getTenantId();
String pubKeyPath = tenantCertPath + "/wechatpay_public_key.pem"; String pubKeyPath = tenantCertPath + "/wechatpay_public_key.pem";
System.out.println("开发环境公钥文件路径: " + pubKeyPath); System.out.println("开发环境公钥文件路径: " + pubKeyPath);
@@ -470,7 +472,8 @@ import com.gxwebsoft.common.core.service.PaymentCacheService;
System.err.println("⚠️ 开发环境回退到基础RSA配置..."); System.err.println("⚠️ 开发环境回退到基础RSA配置...");
try { try {
// 方案1尝试使用RSA证书配置需要商户证书文件 // 方案1尝试使用RSA证书配置需要商户证书文件
String tenantCertPath = "dev/wechat/" + order.getTenantId(); String uploadPath = config.getUploadPath();
String tenantCertPath = uploadPath + "dev/wechat/" + order.getTenantId();
String apiclientCertPath = tenantCertPath + "/" + certConfig.getWechatPay().getDev().getApiclientCertFile(); String apiclientCertPath = tenantCertPath + "/" + certConfig.getWechatPay().getDev().getApiclientCertFile();
if (certificateLoader.certificateExists(apiclientCertPath)) { if (certificateLoader.certificateExists(apiclientCertPath)) {

View File

@@ -46,7 +46,7 @@ mqtt:
config: config:
# 开发环境接口 # 开发环境接口
server-url: https://server.websoft.top/api server-url: https://server.websoft.top/api
upload-path: /Users/gxwebsoft/Documents/uploads/ # window(D:\Temp) upload-path: /Users/gxwebsoft/JAVA/mp-java/src/main/resources/ # window(D:\Temp)
# 开发环境证书配置 # 开发环境证书配置
certificate: certificate: