|
|
@ -366,7 +366,7 @@ import com.gxwebsoft.common.core.service.PaymentCacheService; |
|
|
|
} |
|
|
|
|
|
|
|
// 构建微信支付配置
|
|
|
|
Config config; |
|
|
|
Config config = null; |
|
|
|
if (active.equals("dev")) { |
|
|
|
// 开发环境使用自动证书配置
|
|
|
|
// 检查数据库配置是否完整
|
|
|
@ -393,10 +393,6 @@ import com.gxwebsoft.common.core.service.PaymentCacheService; |
|
|
|
if (payment.getPubKey() != null && !payment.getPubKey().isEmpty() && |
|
|
|
payment.getPubKeyId() != null && !payment.getPubKeyId().isEmpty()) { |
|
|
|
|
|
|
|
System.out.println("=== 检测到公钥配置,使用RSA公钥模式 ==="); |
|
|
|
System.out.println("公钥文件: " + payment.getPubKey()); |
|
|
|
System.out.println("公钥ID: " + payment.getPubKeyId()); |
|
|
|
|
|
|
|
try { |
|
|
|
// 开发环境固定使用 wechatpay_public_key.pem
|
|
|
|
String tenantCertPath = "dev/wechat/" + order.getTenantId(); |
|
|
@ -404,7 +400,12 @@ import com.gxwebsoft.common.core.service.PaymentCacheService; |
|
|
|
|
|
|
|
System.out.println("开发环境公钥文件路径: " + pubKeyPath); |
|
|
|
|
|
|
|
// 检查公钥文件是否存在
|
|
|
|
if (certificateLoader.certificateExists(pubKeyPath)) { |
|
|
|
System.out.println("=== 检测到公钥配置,使用RSA公钥模式 ==="); |
|
|
|
System.out.println("公钥文件: " + payment.getPubKey()); |
|
|
|
System.out.println("公钥ID: " + payment.getPubKeyId()); |
|
|
|
|
|
|
|
String pubKeyFile = certificateLoader.loadCertificatePath(pubKeyPath); |
|
|
|
System.out.println("✅ 开发环境公钥文件加载成功: " + pubKeyFile); |
|
|
|
|
|
|
@ -418,15 +419,17 @@ import com.gxwebsoft.common.core.service.PaymentCacheService; |
|
|
|
.build(); |
|
|
|
System.out.println("✅ 开发环境RSA公钥配置成功"); |
|
|
|
} else { |
|
|
|
System.err.println("❌ 公钥文件不存在: " + pubKeyPath); |
|
|
|
throw new RuntimeException("公钥文件不存在: " + pubKeyPath); |
|
|
|
System.out.println("⚠️ 开发环境公钥文件不存在,跳过公钥模式: " + pubKeyPath); |
|
|
|
// 跳过公钥配置,继续后续的自动证书配置
|
|
|
|
} |
|
|
|
} catch (Exception pubKeyException) { |
|
|
|
System.err.println("❌ RSA公钥配置失败: " + pubKeyException.getMessage()); |
|
|
|
pubKeyException.printStackTrace(); |
|
|
|
throw new RuntimeException("RSA公钥配置失败: " + pubKeyException.getMessage(), pubKeyException); |
|
|
|
} catch (Exception e) { |
|
|
|
System.err.println("❌ 开发环境公钥配置检查失败: " + e.getMessage()); |
|
|
|
// 跳过公钥配置,继续后续的自动证书配置
|
|
|
|
} |
|
|
|
} else { |
|
|
|
} |
|
|
|
|
|
|
|
// 如果没有公钥配置或公钥文件不存在,尝试自动证书配置
|
|
|
|
if (config == null) { |
|
|
|
// 没有公钥配置,尝试自动证书配置
|
|
|
|
try { |
|
|
|
System.out.println("=== 尝试创建自动证书配置 ==="); |
|
|
|