|
@ -751,11 +751,25 @@ public class ShopOrderServiceImpl extends ServiceImpl<ShopOrderMapper, ShopOrder |
|
|
} else { |
|
|
} else { |
|
|
// 生产环境 - 首先初始化私钥
|
|
|
// 生产环境 - 首先初始化私钥
|
|
|
final String certRootPath = certConfig.getCertRootPath(); |
|
|
final String certRootPath = certConfig.getCertRootPath(); |
|
|
final String certBasePath = certRootPath + "/file"; |
|
|
|
|
|
|
|
|
System.out.println("生产环境证书根路径: " + certRootPath); |
|
|
|
|
|
|
|
|
String privateKeyRelativePath = payment.getApiclientKey(); |
|
|
String privateKeyRelativePath = payment.getApiclientKey(); |
|
|
String privateKeyFullPath = privateKeyRelativePath.startsWith("/") |
|
|
|
|
|
? certBasePath + privateKeyRelativePath |
|
|
|
|
|
: certBasePath + "/" + privateKeyRelativePath; |
|
|
|
|
|
|
|
|
System.out.println("数据库中的私钥相对路径: " + privateKeyRelativePath); |
|
|
|
|
|
|
|
|
|
|
|
// 修复路径拼接逻辑:数据库中存储的路径如果已经包含 /file,则直接拼接
|
|
|
|
|
|
String privateKeyFullPath; |
|
|
|
|
|
if (privateKeyRelativePath.startsWith("/file/")) { |
|
|
|
|
|
// 路径已经包含 /file/ 前缀,直接拼接到根路径
|
|
|
|
|
|
privateKeyFullPath = certRootPath + privateKeyRelativePath; |
|
|
|
|
|
} else if (privateKeyRelativePath.startsWith("file/")) { |
|
|
|
|
|
// 路径包含 file/ 前缀,添加根路径和斜杠
|
|
|
|
|
|
privateKeyFullPath = certRootPath + "/" + privateKeyRelativePath; |
|
|
|
|
|
} else { |
|
|
|
|
|
// 路径不包含 file 前缀,添加完整的 /file/ 前缀
|
|
|
|
|
|
privateKeyFullPath = certRootPath + "/file/" + privateKeyRelativePath; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
System.out.println("生产环境私钥完整路径: " + privateKeyFullPath); |
|
|
privateKey = certificateLoader.loadCertificatePath(privateKeyFullPath); |
|
|
privateKey = certificateLoader.loadCertificatePath(privateKeyFullPath); |
|
|
System.out.println("✅ 生产环境私钥加载完成: " + privateKey); |
|
|
System.out.println("✅ 生产环境私钥加载完成: " + privateKey); |
|
|
|
|
|
|
|
@ -769,17 +783,24 @@ public class ShopOrderServiceImpl extends ServiceImpl<ShopOrderMapper, ShopOrder |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
// 生产环境处理公钥路径
|
|
|
// 生产环境处理公钥路径
|
|
|
pubKeyPath = payment.getPubKey(); |
|
|
|
|
|
|
|
|
|
|
|
// 如果路径不是以 /file 开头,需要添加 /file 前缀
|
|
|
|
|
|
if (!pubKeyPath.startsWith("/file/") && !pubKeyPath.startsWith("file/")) { |
|
|
|
|
|
pubKeyPath = "file/" + pubKeyPath; |
|
|
|
|
|
System.out.println("生产环境公钥路径修正: " + payment.getPubKey() + " -> " + pubKeyPath); |
|
|
|
|
|
|
|
|
String pubKeyRelativePath = payment.getPubKey(); |
|
|
|
|
|
System.out.println("数据库中的公钥相对路径: " + pubKeyRelativePath); |
|
|
|
|
|
|
|
|
|
|
|
// 修复公钥路径拼接逻辑,与私钥路径处理保持一致
|
|
|
|
|
|
String pubKeyFullPath; |
|
|
|
|
|
if (pubKeyRelativePath.startsWith("/file/")) { |
|
|
|
|
|
// 路径已经包含 /file/ 前缀,直接拼接到根路径
|
|
|
|
|
|
pubKeyFullPath = certRootPath + pubKeyRelativePath; |
|
|
|
|
|
} else if (pubKeyRelativePath.startsWith("file/")) { |
|
|
|
|
|
// 路径包含 file/ 前缀,添加根路径和斜杠
|
|
|
|
|
|
pubKeyFullPath = certRootPath + "/" + pubKeyRelativePath; |
|
|
} else { |
|
|
} else { |
|
|
System.out.println("生产环境公钥路径: " + pubKeyPath); |
|
|
|
|
|
|
|
|
// 路径不包含 file 前缀,添加完整的 /file/ 前缀
|
|
|
|
|
|
pubKeyFullPath = certRootPath + "/file/" + pubKeyRelativePath; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
pubKeyFile = certificateLoader.loadCertificatePath(pubKeyPath); |
|
|
|
|
|
|
|
|
System.out.println("生产环境公钥完整路径: " + pubKeyFullPath); |
|
|
|
|
|
pubKeyFile = certificateLoader.loadCertificatePath(pubKeyFullPath); |
|
|
System.out.println("✅ 生产环境公钥文件加载成功: " + pubKeyFile); |
|
|
System.out.println("✅ 生产环境公钥文件加载成功: " + pubKeyFile); |
|
|
|
|
|
|
|
|
config = new RSAPublicKeyConfig.Builder() |
|
|
config = new RSAPublicKeyConfig.Builder() |
|
@ -931,17 +952,25 @@ public class ShopOrderServiceImpl extends ServiceImpl<ShopOrderMapper, ShopOrder |
|
|
} else { |
|
|
} else { |
|
|
// 生产环境 - 从数据库配置的路径加载
|
|
|
// 生产环境 - 从数据库配置的路径加载
|
|
|
final String certRootPath = certConfig.getCertRootPath(); |
|
|
final String certRootPath = certConfig.getCertRootPath(); |
|
|
final String certBasePath = certRootPath + "/file"; |
|
|
|
|
|
|
|
|
|
|
|
System.out.println("生产环境证书路径 - 租户ID: " + order.getTenantId()); |
|
|
System.out.println("生产环境证书路径 - 租户ID: " + order.getTenantId()); |
|
|
System.out.println("生产环境证书根路径: " + certRootPath); |
|
|
System.out.println("生产环境证书根路径: " + certRootPath); |
|
|
System.out.println("生产环境证书基础路径: " + certBasePath); |
|
|
|
|
|
System.out.println("私钥文件名: " + payment.getApiclientKey()); |
|
|
System.out.println("私钥文件名: " + payment.getApiclientKey()); |
|
|
|
|
|
|
|
|
String privateKeyRelativePath = payment.getApiclientKey(); |
|
|
String privateKeyRelativePath = payment.getApiclientKey(); |
|
|
String privateKeyFullPath = privateKeyRelativePath.startsWith("/") |
|
|
|
|
|
? certBasePath + privateKeyRelativePath |
|
|
|
|
|
: certBasePath + "/" + privateKeyRelativePath; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 修复路径拼接逻辑:数据库中存储的路径如果已经包含 /file,则直接拼接
|
|
|
|
|
|
String privateKeyFullPath; |
|
|
|
|
|
if (privateKeyRelativePath.startsWith("/file/")) { |
|
|
|
|
|
// 路径已经包含 /file/ 前缀,直接拼接到根路径
|
|
|
|
|
|
privateKeyFullPath = certRootPath + privateKeyRelativePath; |
|
|
|
|
|
} else if (privateKeyRelativePath.startsWith("file/")) { |
|
|
|
|
|
// 路径包含 file/ 前缀,添加根路径和斜杠
|
|
|
|
|
|
privateKeyFullPath = certRootPath + "/" + privateKeyRelativePath; |
|
|
|
|
|
} else { |
|
|
|
|
|
// 路径不包含 file 前缀,添加完整的 /file/ 前缀
|
|
|
|
|
|
privateKeyFullPath = certRootPath + "/file/" + privateKeyRelativePath; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
System.out.println("私钥完整路径: " + privateKeyFullPath); |
|
|
System.out.println("私钥完整路径: " + privateKeyFullPath); |
|
|
privateKey = certificateLoader.loadCertificatePath(privateKeyFullPath); |
|
|
privateKey = certificateLoader.loadCertificatePath(privateKeyFullPath); |
|
@ -951,9 +980,22 @@ public class ShopOrderServiceImpl extends ServiceImpl<ShopOrderMapper, ShopOrder |
|
|
if (StrUtil.isNotBlank(payment.getPubKey()) && StrUtil.isNotBlank(payment.getPubKeyId())) { |
|
|
if (StrUtil.isNotBlank(payment.getPubKey()) && StrUtil.isNotBlank(payment.getPubKeyId())) { |
|
|
try { |
|
|
try { |
|
|
String pubKeyRelativePath = payment.getPubKey(); |
|
|
String pubKeyRelativePath = payment.getPubKey(); |
|
|
String pubKeyFullPath = pubKeyRelativePath.startsWith("/") |
|
|
|
|
|
? certBasePath + pubKeyRelativePath |
|
|
|
|
|
: certBasePath + "/" + pubKeyRelativePath; |
|
|
|
|
|
|
|
|
System.out.println("数据库中的公钥相对路径: " + pubKeyRelativePath); |
|
|
|
|
|
|
|
|
|
|
|
// 修复公钥路径拼接逻辑,与私钥路径处理保持一致
|
|
|
|
|
|
String pubKeyFullPath; |
|
|
|
|
|
if (pubKeyRelativePath.startsWith("/file/")) { |
|
|
|
|
|
// 路径已经包含 /file/ 前缀,直接拼接到根路径
|
|
|
|
|
|
pubKeyFullPath = certRootPath + pubKeyRelativePath; |
|
|
|
|
|
} else if (pubKeyRelativePath.startsWith("file/")) { |
|
|
|
|
|
// 路径包含 file/ 前缀,添加根路径和斜杠
|
|
|
|
|
|
pubKeyFullPath = certRootPath + "/" + pubKeyRelativePath; |
|
|
|
|
|
} else { |
|
|
|
|
|
// 路径不包含 file 前缀,添加完整的 /file/ 前缀
|
|
|
|
|
|
pubKeyFullPath = certRootPath + "/file/" + pubKeyRelativePath; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
System.out.println("生产环境公钥完整路径: " + pubKeyFullPath); |
|
|
pubKey = certificateLoader.loadCertificatePath(pubKeyFullPath); |
|
|
pubKey = certificateLoader.loadCertificatePath(pubKeyFullPath); |
|
|
System.out.println("✅ 生产环境公钥加载成功"); |
|
|
System.out.println("✅ 生产环境公钥加载成功"); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|