From 15375a1d0d07c61c132906ff8da45f67bcd711f6 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期四, 17 十一月 2022 15:51:05 +0800 Subject: [PATCH] 1 --- src/main/java/com/lf/server/helper/PathHelper.java | 38 +++++++++++++++++++------------------- 1 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/lf/server/helper/PathHelper.java b/src/main/java/com/lf/server/helper/PathHelper.java index 88439b5..52bb793 100644 --- a/src/main/java/com/lf/server/helper/PathHelper.java +++ b/src/main/java/com/lf/server/helper/PathHelper.java @@ -21,8 +21,6 @@ private static int downloadPath = 1; - private static int exportPath = 1; - private static int uploadPath = 1; private static int sharePath = 1; @@ -39,10 +37,6 @@ return downloadPath; } - public static int getExportPath() { - return exportPath; - } - public static int getUploadPath() { return uploadPath; } @@ -56,7 +50,6 @@ */ public void init() { downloadPath = getSubPath(config.getDownloadPath(), downloadPath); - exportPath = getSubPath(config.getExportPath(), exportPath); uploadPath = getSubPath(config.getUploadPath(), uploadPath); sharePath = getSubPath(config.getSharePath(), sharePath); } @@ -90,15 +83,6 @@ } /** - * 鑾峰彇鍑哄浘瀹屾暣鐩綍 - */ - public String getExportFullPath() { - exportPath = getSubPath(config.getExportPath(), exportPath); - - return config.getExportPath() + File.separator + exportPath; - } - - /** * 鑾峰彇涓婁紶瀹屾暣鐩綍 */ public String getUploadFullPath() { @@ -119,10 +103,10 @@ /** * 鑾峰彇涓存椂璺緞 */ - public String getTempPath(int id) { - String tempName = StringHelper.YMD__FORMAT.format(new Date()); + public String getTempPath() { + String tempName = StringHelper.YMDHMS2_FORMAT.format(new Date()); String tempPath = config.getTempPath(); - String path = tempPath + File.separator + tempName + id; + String path = tempPath + File.separator + tempName; File file = new File(path); if (!file.exists() && !file.isDirectory()) { @@ -138,6 +122,22 @@ } /** + * 鑾峰彇涓存椂璺緞 + */ + public String getTempPath(String subPath) { + if (!StringHelper.isEmpty(subPath)) { + String path = config.getTempPath() + File.separator + subPath; + + File file = new File(path); + if (file.exists() && file.isDirectory()) { + return path; + } + } + + return getTempPath(); + } + + /** * 鍒犻櫎鏃ц矾寰� */ public void deleteOldPath(String tempPath) { -- Gitblit v1.9.3