From 1d53dd8f501a98ddcce8146443b51b357ef5f9b1 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期四, 29 十二月 2022 16:55:46 +0800 Subject: [PATCH] 1 --- src/main/java/com/lf/server/service/all/BaseUploadService.java | 23 +++++++++++++++-------- 1 files changed, 15 insertions(+), 8 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 0e98187..6edd901 100644 --- a/src/main/java/com/lf/server/service/all/BaseUploadService.java +++ b/src/main/java/com/lf/server/service/all/BaseUploadService.java @@ -31,16 +31,9 @@ public final Log log = LogFactory.getLog(getClass()); /** - * 鏌ヨ鐩綍 - */ - public String selectPath() { - return pathHelper.getTempPathName(); - } - - /** * 鏌ヨ鏂囦欢 */ - public List<MetaFileEntity> selectFiles(String subPath) throws IOException { + public List<MetaFileEntity> selectFiles(String subPath, List<String> extList) throws IOException { String root = pathHelper.getConfig().getTempPath() + File.separator + subPath; File file = new File(root); @@ -55,6 +48,13 @@ List<MetaFileEntity> list = new ArrayList<MetaFileEntity>(); for (File f : files) { String fileName = FileHelper.getFileName(f.getPath()); + if (null != extList) { + String extName = FileHelper.getExtension(fileName); + if (!extList.contains(extName)) { + continue; + } + } + double sizes = FileHelper.sizeToMb(f.length()); String filePath = subPath + File.separator + fileName; @@ -71,6 +71,13 @@ } /** + * 鏌ヨ鐩綍 + */ + public String selectPath() { + return pathHelper.getTempPathName(); + } + + /** * 涓婁紶鏂囦欢 */ public <T> List<MetaFileEntity> uploadData(T t, String path, HttpServletRequest req, HttpServletResponse res) throws Exception { -- Gitblit v1.9.3