diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderServiceImpl.java index 01571e0..f5ad890 100644 --- a/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderServiceImpl.java +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderServiceImpl.java @@ -751,11 +751,25 @@ public class ShopOrderServiceImpl extends ServiceImpl " + 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 { - 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); config = new RSAPublicKeyConfig.Builder() @@ -931,17 +952,25 @@ public class ShopOrderServiceImpl extends ServiceImpl