diff --git a/src/main/java/com/gxwebsoft/common/core/config/CertificateProperties.java b/src/main/java/com/gxwebsoft/common/core/config/CertificateProperties.java index d8cbb5e..a13c9d3 100644 --- a/src/main/java/com/gxwebsoft/common/core/config/CertificateProperties.java +++ b/src/main/java/com/gxwebsoft/common/core/config/CertificateProperties.java @@ -66,7 +66,7 @@ public class CertificateProperties { /** * 生产环境基础路径 */ - private String prodBasePath = "/file"; + private String prodBasePath = "/"; /** * 微信支付证书目录名 @@ -155,19 +155,23 @@ public class CertificateProperties { * @return 完整路径 */ public String getWechatPayCertPath(String fileName) { - // 生产环境特殊处理:数据库中存储的路径需要拼接到 /file/ 目录下 + // 生产环境特殊处理:数据库中存储的路径直接拼接到根路径 if (loadMode == LoadMode.VOLUME) { - // 修复路径拼接逻辑:数据库中存储的路径如果已经包含 /file,则直接拼接 + // 生产环境已经没有/file目录,所有路径都直接拼接到根路径 + // 处理数据库中可能存在的历史路径格式 + String cleanFileName = fileName; if (fileName.startsWith("/file/")) { - // 路径已经包含 /file/ 前缀,直接拼接到根路径 - return certRootPath + fileName; + // 去掉历史的 /file/ 前缀 + cleanFileName = fileName.substring(6); } else if (fileName.startsWith("file/")) { - // 路径包含 file/ 前缀,添加根路径和斜杠 - return certRootPath + "/" + fileName; - } else { - // 路径不包含 file 前缀,添加完整的 /file/ 前缀 - return certRootPath + "/file/" + fileName; + // 去掉历史的 file/ 前缀 + cleanFileName = fileName.substring(5); } + // 确保路径以 / 开头 + if (!cleanFileName.startsWith("/")) { + cleanFileName = "/" + cleanFileName; + } + return certRootPath + cleanFileName; } else { // 开发环境和文件系统模式使用原有逻辑 return getCertificatePath(wechatPay.getCertDir(), fileName); diff --git a/src/main/java/com/gxwebsoft/common/core/utils/MyQrCodeUtil.java b/src/main/java/com/gxwebsoft/common/core/utils/MyQrCodeUtil.java index 933deac..87d95b9 100644 --- a/src/main/java/com/gxwebsoft/common/core/utils/MyQrCodeUtil.java +++ b/src/main/java/com/gxwebsoft/common/core/utils/MyQrCodeUtil.java @@ -64,7 +64,7 @@ public class MyQrCodeUtil { * @return 二维码图片地址 */ public static String createQrCode(String type,Integer id, String content) throws IOException { - String filePath = uploadPath + "/file/qrcode/".concat(type).concat("/"); + String filePath = uploadPath + "/qrcode/".concat(type).concat("/"); String qrcodeUrl = "https://file.websoft.top/qrcode/".concat(type).concat("/"); // 将URL转为BufferedImage BufferedImage bufferedImage = ImageIO.read(new URL(logoUrl)); diff --git a/src/main/java/com/gxwebsoft/common/system/controller/FileController.java b/src/main/java/com/gxwebsoft/common/system/controller/FileController.java index 5d800b5..e61068d 100644 --- a/src/main/java/com/gxwebsoft/common/system/controller/FileController.java +++ b/src/main/java/com/gxwebsoft/common/system/controller/FileController.java @@ -265,14 +265,14 @@ public class FileController extends BaseController { * 文件上传基目录 */ private String getUploadBaseDir() { - return config.getUploadPath() + "file/"; + return config.getUploadPath(); } /** * 文件上传位置(服务器) */ private String getUploadDir() { - return config.getUploadPath() + "file/"; + return config.getUploadPath(); } /** diff --git a/src/main/java/com/gxwebsoft/common/system/controller/WxLoginController.java b/src/main/java/com/gxwebsoft/common/system/controller/WxLoginController.java index 1fa9e7b..1e40d16 100644 --- a/src/main/java/com/gxwebsoft/common/system/controller/WxLoginController.java +++ b/src/main/java/com/gxwebsoft/common/system/controller/WxLoginController.java @@ -574,7 +574,7 @@ public class WxLoginController extends BaseController { * 文件上传位置(服务器) */ private String getUploadDir() { - return config.getUploadPath() + "file/"; + return config.getUploadPath(); } @Operation(summary = "调试:检查微信小程序配置") diff --git a/src/main/java/com/gxwebsoft/house/service/impl/HouseInfoServiceImpl.java b/src/main/java/com/gxwebsoft/house/service/impl/HouseInfoServiceImpl.java index 9167777..5d3357e 100644 --- a/src/main/java/com/gxwebsoft/house/service/impl/HouseInfoServiceImpl.java +++ b/src/main/java/com/gxwebsoft/house/service/impl/HouseInfoServiceImpl.java @@ -191,7 +191,7 @@ public class HouseInfoServiceImpl extends ServiceImpl map = new HashMap<>(); map.put("appId", d.getAppId()); - final String build = UrlBuilder.of(configProperties.getServerUrl() + "/file/page").setQuery(new UrlQuery(map)).build(); + final String build = UrlBuilder.of(configProperties.getServerUrl() + "/page").setQuery(new UrlQuery(map)).build(); String response = HttpRequest.get(build) .header("Authorization", param.getToken()) .header("Tenantid", d.getTenantId().toString()) diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopGiftController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopGiftController.java index bd90024..66f5023 100644 --- a/src/main/java/com/gxwebsoft/shop/controller/ShopGiftController.java +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopGiftController.java @@ -207,9 +207,9 @@ public class ShopGiftController extends BaseController { @Operation(summary = "导出礼品卡") @PostMapping("/export") public ApiResult export(@RequestBody(required = false) List ids) throws IOException { - String filename = "file/excel/礼品卡.xlsx"; - if (!FileUtil.exist(uploadPath + "file/excel")) { - FileUtil.mkdir(uploadPath + "file/excel"); + String filename = "excel/礼品卡.xlsx"; + if (!FileUtil.exist(uploadPath + "excel")) { + FileUtil.mkdir(uploadPath + "excel"); } List list; if (ids != null && !ids.isEmpty()) { diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopOrderController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopOrderController.java index 3d425ce..6556204 100644 --- a/src/main/java/com/gxwebsoft/shop/controller/ShopOrderController.java +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopOrderController.java @@ -373,18 +373,22 @@ public class ShopOrderController extends BaseController { String privateKeyRelativePath = payment.getApiclientKey(); logger.info("数据库中的私钥相对路径: {}", privateKeyRelativePath); - // 修复路径拼接逻辑:数据库中存储的路径如果已经包含 /file,则直接拼接 + // 生产环境已经没有/file目录,所有路径都直接拼接到根路径 String privateKeyFullPath; + // 处理数据库中可能存在的历史路径格式 + String cleanPath = privateKeyRelativePath; if (privateKeyRelativePath.startsWith("/file/")) { - // 路径已经包含 /file/ 前缀,直接拼接到根路径 - privateKeyFullPath = certRootPath + privateKeyRelativePath; + // 去掉历史的 /file/ 前缀 + cleanPath = privateKeyRelativePath.substring(6); } else if (privateKeyRelativePath.startsWith("file/")) { - // 路径包含 file/ 前缀,添加根路径和斜杠 - privateKeyFullPath = certRootPath + "/" + privateKeyRelativePath; - } else { - // 路径不包含 file 前缀,添加完整的 /file/ 前缀 - privateKeyFullPath = certRootPath + "/file/" + privateKeyRelativePath; + // 去掉历史的 file/ 前缀 + cleanPath = privateKeyRelativePath.substring(5); } + // 确保路径以 / 开头 + if (!cleanPath.startsWith("/")) { + cleanPath = "/" + cleanPath; + } + privateKeyFullPath = certRootPath + cleanPath; logger.info("生产环境私钥完整路径: {}", privateKeyFullPath); String privateKey = certificateLoader.loadCertificatePath(privateKeyFullPath); 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 dd89b55..d1d3445 100644 --- a/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderServiceImpl.java +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderServiceImpl.java @@ -774,18 +774,22 @@ public class ShopOrderServiceImpl extends ServiceImpl