From 014639637a80b0549cc0aee00b9a9670fb57827c Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期五, 10 二月 2023 17:26:30 +0800 Subject: [PATCH] 1 --- src/main/java/com/lf/server/service/all/BaseUploadService.java | 24 +++++++++++++++++------- 1 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/lf/server/service/all/BaseUploadService.java b/src/main/java/com/lf/server/service/all/BaseUploadService.java index 17509af..d4d47c0 100644 --- a/src/main/java/com/lf/server/service/all/BaseUploadService.java +++ b/src/main/java/com/lf/server/service/all/BaseUploadService.java @@ -28,10 +28,10 @@ @Service public class BaseUploadService { @Autowired - private DirService dirService; + protected DirService dirService; @Autowired - private PathHelper pathHelper; + protected PathHelper pathHelper; public final Log log = LogFactory.getLog(getClass()); @@ -290,7 +290,7 @@ String fileName = FileHelper.getFileName(f.getPath()); String extName = FileHelper.getExtension(fileName); - if (!StaticData.ALL_EXTENSION.contains(extName)) { + if (!StaticData.ALL_EXTENSION.contains(extName) || fileName.startsWith("~")) { continue; } @@ -313,7 +313,7 @@ if (isShp) { List<String> shpFiles = getShpFiles(f.getPath()); - mf.setTab(fileName); + mf.setTab(fileName.replace(StaticData.SHP, "")); mf.setSizes(getFilesSize(shpFiles)); mf.setGuid(getFilesMd5(shpFiles)); } else { @@ -347,7 +347,7 @@ if (0 != dir.getPid() || null == dirs || dirs.isEmpty()) { return dir.getId(); } - if ("/".equals(File.separator)) { + if (StaticData.SLASH.equals(File.separator)) { filePath = filePath.replace("/", "\\"); } @@ -367,8 +367,8 @@ List<String> list = new ArrayList<>(); list.add(shpPath); - for (int i = 1, c = StaticData.SHP_EXTENSION.size(); i < c; i++) { - String path = shpPath.replace(".shp", StaticData.SHP_EXTENSION.get(i)); + for (int i = 0, c = StaticData.SHP_EXT.size(); i < c; i++) { + String path = shpPath.replace(".shp", StaticData.SHP_EXT.get(i)); File f = new File(path); if (f.exists() && !f.isDirectory()) { @@ -497,6 +497,16 @@ } /** + * 澶勭悊鐩綍 + */ + public void copePath(List<MetaFileEntity> list) { + String basePath = pathHelper.getConfig().getTempPath() + File.separator; + for (MetaFileEntity mf : list) { + mf.setPath(mf.getPath().replace(basePath, "")); + } + } + + /** * 鑾峰彇鍙傛暟 * * Enumeration<String> headers = req.getHeaderNames(); * Enumeration<String> attributes = req.getAttributeNames(); -- Gitblit v1.9.3