From 79bf332c53b5723ddc086e4033d1f6ae168436dd Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期三, 04 八月 2021 19:11:39 +0800
Subject: [PATCH] remove 移除通用上传下载接口与配置

---
 /dev/null                                                                     |   59 --------------
 ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java |    6 -
 ruoyi-ui/src/main.js                                                          |    3 
 ruoyi-ui/src/utils/ruoyi.js                                                   |    5 -
 ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java         |   74 ------------------
 ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java  |    2 
 ruoyi-admin/src/main/resources/application.yml                                |    2 
 ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java           |   34 --------
 8 files changed, 3 insertions(+), 182 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
deleted file mode 100644
index 3e57de8..0000000
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package com.ruoyi.web.controller.common;
-
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.common.config.RuoYiConfig;
-import com.ruoyi.common.constant.Constants;
-import com.ruoyi.common.utils.file.FileUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.File;
-
-/**
- * 閫氱敤璇锋眰澶勭悊
- *
- * @author ruoyi
- */
-@RestController
-public class CommonController
-{
-    private static final Logger log = LoggerFactory.getLogger(CommonController.class);
-
-    /**
-     * 閫氱敤涓嬭浇璇锋眰
-     *
-     * @param fileName 鏂囦欢鍚嶇О
-     * @param delete 鏄惁鍒犻櫎
-     */
-    @GetMapping("common/download")
-    public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
-    {
-        try
-        {
-            if (!FileUtils.checkAllowDownload(fileName))
-            {
-                throw new Exception(StringUtils.format("鏂囦欢鍚嶇О({})闈炴硶锛屼笉鍏佽涓嬭浇銆� ", fileName));
-            }
-            String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
-            String filePath = RuoYiConfig.getDownloadPath() + fileName;
-			File file = new File(filePath);
-            response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
-            FileUtils.setAttachmentResponseHeader(response, realFileName);
-			FileUtils.writeToStream(file, response.getOutputStream());
-            if (delete)
-            {
-				FileUtils.del(file);
-            }
-        }
-        catch (Exception e)
-        {
-            log.error("涓嬭浇鏂囦欢澶辫触", e);
-        }
-    }
-
-    /**
-     * 鏈湴璧勬簮閫氱敤涓嬭浇
-     */
-    @GetMapping("/common/download/resource")
-    public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
-            throws Exception
-    {
-        try
-        {
-            if (!FileUtils.checkAllowDownload(resource))
-            {
-                throw new Exception(StringUtils.format("璧勬簮鏂囦欢({})闈炴硶锛屼笉鍏佽涓嬭浇銆� ", resource));
-            }
-            // 鏈湴璧勬簮璺緞
-            String localPath = RuoYiConfig.getProfile();
-            // 鏁版嵁搴撹祫婧愬湴鍧�
-            String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
-            // 涓嬭浇鍚嶇О
-            String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
-            response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
-			File file = new File(downloadPath);
-            FileUtils.setAttachmentResponseHeader(response, downloadName);
-            FileUtils.writeToStream(file, response.getOutputStream());
-        }
-        catch (Exception e)
-        {
-            log.error("涓嬭浇鏂囦欢澶辫触", e);
-        }
-    }
-}
diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml
index ad20f9a..9b75fb6 100644
--- a/ruoyi-admin/src/main/resources/application.yml
+++ b/ruoyi-admin/src/main/resources/application.yml
@@ -8,8 +8,6 @@
   copyrightYear: 2021
   # 瀹炰緥婕旂ず寮�鍏�
   demoEnabled: true
-  # 鏂囦欢璺緞
-  profile: ./ruoyi/uploadPath
   # 鑾峰彇ip鍦板潃寮�鍏�
   addressEnabled: true
 
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java
index 682bebd..408295a 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/RuoYiConfig.java
@@ -9,7 +9,7 @@
 
 /**
  * 璇诲彇椤圭洰鐩稿叧閰嶇疆
- * 
+ *
  * @author ruoyi
  */
 
@@ -32,45 +32,13 @@
     /** 瀹炰緥婕旂ず寮�鍏� */
     private boolean demoEnabled;
 
-    /** 涓婁紶璺緞 */
-    @Getter
-    private static String profile;
-
     /** 鑾峰彇鍦板潃寮�鍏� */
     @Getter
     private static boolean addressEnabled;
-
-    public void setProfile(String profile)
-    {
-        RuoYiConfig.profile = profile;
-    }
 
     public void setAddressEnabled(boolean addressEnabled)
     {
         RuoYiConfig.addressEnabled = addressEnabled;
     }
 
-    /**
-     * 鑾峰彇澶村儚涓婁紶璺緞
-     */
-    public static String getAvatarPath()
-    {
-        return getProfile() + "/avatar";
-    }
-
-    /**
-     * 鑾峰彇涓嬭浇璺緞
-     */
-    public static String getDownloadPath()
-    {
-        return getProfile() + "/download/";
-    }
-
-    /**
-     * 鑾峰彇涓婁紶璺緞
-     */
-    public static String getUploadPath()
-    {
-        return getProfile() + "/upload";
-    }
 }
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileTypeUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileTypeUtils.java
deleted file mode 100644
index 25f5306..0000000
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileTypeUtils.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.ruoyi.common.utils.file;
-
-import java.io.File;
-import org.apache.commons.lang3.StringUtils;
-
-/**
- * 鏂囦欢绫诲瀷宸ュ叿绫�
- *
- * @author ruoyi
- */
-public class FileTypeUtils
-{
-    /**
-     * 鑾峰彇鏂囦欢绫诲瀷
-     * <p>
-     * 渚嬪: ruoyi.txt, 杩斿洖: txt
-     * 
-     * @param file 鏂囦欢鍚�
-     * @return 鍚庣紑锛堜笉鍚�".")
-     */
-    public static String getFileType(File file)
-    {
-        if (null == file)
-        {
-            return StringUtils.EMPTY;
-        }
-        return getFileType(file.getName());
-    }
-
-    /**
-     * 鑾峰彇鏂囦欢绫诲瀷
-     * <p>
-     * 渚嬪: ruoyi.txt, 杩斿洖: txt
-     *
-     * @param fileName 鏂囦欢鍚�
-     * @return 鍚庣紑锛堜笉鍚�".")
-     */
-    public static String getFileType(String fileName)
-    {
-        int separatorIndex = fileName.lastIndexOf(".");
-        if (separatorIndex < 0)
-        {
-            return "";
-        }
-        return fileName.substring(separatorIndex + 1).toLowerCase();
-    }
-
-    /**
-     * 鑾峰彇鏂囦欢绫诲瀷
-     * 
-     * @param photoByte 鏂囦欢瀛楄妭鐮�
-     * @return 鍚庣紑锛堜笉鍚�".")
-     */
-    public static String getFileExtendName(byte[] photoByte)
-    {
-        String strFileExtendName = "JPG";
-        if ((photoByte[0] == 71) && (photoByte[1] == 73) && (photoByte[2] == 70) && (photoByte[3] == 56)
-                && ((photoByte[4] == 55) || (photoByte[4] == 57)) && (photoByte[5] == 97))
-        {
-            strFileExtendName = "GIF";
-        }
-        else if ((photoByte[6] == 74) && (photoByte[7] == 70) && (photoByte[8] == 73) && (photoByte[9] == 70))
-        {
-            strFileExtendName = "JPG";
-        }
-        else if ((photoByte[0] == 66) && (photoByte[1] == 77))
-        {
-            strFileExtendName = "BMP";
-        }
-        else if ((photoByte[1] == 80) && (photoByte[2] == 78) && (photoByte[3] == 71))
-        {
-            strFileExtendName = "PNG";
-        }
-        return strFileExtendName;
-    }
-}
\ No newline at end of file
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java
deleted file mode 100644
index c8ce6ec..0000000
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java
+++ /dev/null
@@ -1,238 +0,0 @@
-package com.ruoyi.common.utils.file;
-
-import cn.hutool.core.io.FileUtil;
-import cn.hutool.core.util.IdUtil;
-import com.ruoyi.common.config.RuoYiConfig;
-import com.ruoyi.common.constant.Constants;
-import com.ruoyi.common.exception.file.FileNameLengthLimitExceededException;
-import com.ruoyi.common.exception.file.FileSizeLimitExceededException;
-import com.ruoyi.common.exception.file.InvalidExtensionException;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.common.utils.StringUtils;
-import org.apache.commons.io.FilenameUtils;
-import org.springframework.web.multipart.MultipartFile;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * 鏂囦欢涓婁紶宸ュ叿绫�
- *
- * @author ruoyi
- */
-public class FileUploadUtils
-{
-    /**
-     * 榛樿澶у皬 50M
-     */
-    public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024;
-
-    /**
-     * 榛樿鐨勬枃浠跺悕鏈�澶ч暱搴� 100
-     */
-    public static final int DEFAULT_FILE_NAME_LENGTH = 100;
-
-    /**
-     * 榛樿涓婁紶鐨勫湴鍧�
-     */
-    private static String defaultBaseDir = RuoYiConfig.getProfile();
-
-    public static void setDefaultBaseDir(String defaultBaseDir)
-    {
-        FileUploadUtils.defaultBaseDir = defaultBaseDir;
-    }
-
-    public static String getDefaultBaseDir()
-    {
-        return defaultBaseDir;
-    }
-
-    /**
-     * 浠ラ粯璁ら厤缃繘琛屾枃浠朵笂浼�
-     *
-     * @param file 涓婁紶鐨勬枃浠�
-     * @return 鏂囦欢鍚嶇О
-     * @throws Exception
-     */
-    public static final String upload(MultipartFile file) throws IOException
-    {
-        try
-        {
-            return upload(getDefaultBaseDir(), file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
-        }
-        catch (Exception e)
-        {
-            throw new IOException(e.getMessage(), e);
-        }
-    }
-
-    /**
-     * 鏍规嵁鏂囦欢璺緞涓婁紶
-     *
-     * @param baseDir 鐩稿搴旂敤鐨勫熀鐩綍
-     * @param file 涓婁紶鐨勬枃浠�
-     * @return 鏂囦欢鍚嶇О
-     * @throws IOException
-     */
-    public static final String upload(String baseDir, MultipartFile file) throws IOException
-    {
-        try
-        {
-            return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
-        }
-        catch (Exception e)
-        {
-            throw new IOException(e.getMessage(), e);
-        }
-    }
-
-    /**
-     * 鏂囦欢涓婁紶
-     *
-     * @param baseDir 鐩稿搴旂敤鐨勫熀鐩綍
-     * @param file 涓婁紶鐨勬枃浠�
-     * @param allowedExtension 涓婁紶鏂囦欢绫诲瀷
-     * @return 杩斿洖涓婁紶鎴愬姛鐨勬枃浠跺悕
-     * @throws FileSizeLimitExceededException 濡傛灉瓒呭嚭鏈�澶уぇ灏�
-     * @throws FileNameLengthLimitExceededException 鏂囦欢鍚嶅お闀�
-     * @throws IOException 姣斿璇诲啓鏂囦欢鍑洪敊鏃�
-     * @throws InvalidExtensionException 鏂囦欢鏍¢獙寮傚父
-     */
-    public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension)
-            throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException,
-            InvalidExtensionException
-    {
-        int fileNamelength = file.getOriginalFilename().length();
-        if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH)
-        {
-            throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
-        }
-
-        assertAllowed(file, allowedExtension);
-
-        String fileName = extractFilename(file);
-
-        File desc = getAbsoluteFile(baseDir, fileName);
-		desc = FileUtil.touch(desc);
-		FileUtil.writeFromStream(file.getInputStream(), desc);
-        String pathFileName = getPathFileName(baseDir, fileName);
-        return pathFileName;
-    }
-
-    /**
-     * 缂栫爜鏂囦欢鍚�
-     */
-    public static final String extractFilename(MultipartFile file)
-    {
-        String fileName = file.getOriginalFilename();
-        String extension = getExtension(file);
-        fileName = DateUtils.datePath() + "/" + IdUtil.fastUUID() + "." + extension;
-        return fileName;
-    }
-
-    private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException
-    {
-        File desc = new File(uploadDir + File.separator + fileName);
-
-        if (!desc.exists())
-        {
-            if (!desc.getParentFile().exists())
-            {
-                desc.getParentFile().mkdirs();
-            }
-        }
-        return desc;
-    }
-
-    private static final String getPathFileName(String uploadDir, String fileName) throws IOException
-    {
-        int dirLastIndex = RuoYiConfig.getProfile().length() + 1;
-        String currentDir = StringUtils.substring(uploadDir, dirLastIndex);
-        String pathFileName = Constants.RESOURCE_PREFIX + "/" + currentDir + "/" + fileName;
-        return pathFileName;
-    }
-
-    /**
-     * 鏂囦欢澶у皬鏍¢獙
-     *
-     * @param file 涓婁紶鐨勬枃浠�
-     * @return
-     * @throws FileSizeLimitExceededException 濡傛灉瓒呭嚭鏈�澶уぇ灏�
-     * @throws InvalidExtensionException
-     */
-    public static final void assertAllowed(MultipartFile file, String[] allowedExtension)
-            throws FileSizeLimitExceededException, InvalidExtensionException
-    {
-        long size = file.getSize();
-        if (DEFAULT_MAX_SIZE != -1 && size > DEFAULT_MAX_SIZE)
-        {
-            throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024);
-        }
-
-        String fileName = file.getOriginalFilename();
-        String extension = getExtension(file);
-        if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension))
-        {
-            if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION)
-            {
-                throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension,
-                        fileName);
-            }
-            else if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION)
-            {
-                throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension,
-                        fileName);
-            }
-            else if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION)
-            {
-                throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension,
-                        fileName);
-            }
-            else if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION)
-            {
-                throw new InvalidExtensionException.InvalidVideoExtensionException(allowedExtension, extension,
-                        fileName);
-            }
-            else
-            {
-                throw new InvalidExtensionException(allowedExtension, extension, fileName);
-            }
-        }
-
-    }
-
-    /**
-     * 鍒ゆ柇MIME绫诲瀷鏄惁鏄厑璁哥殑MIME绫诲瀷
-     *
-     * @param extension
-     * @param allowedExtension
-     * @return
-     */
-    public static final boolean isAllowedExtension(String extension, String[] allowedExtension)
-    {
-        for (String str : allowedExtension)
-        {
-            if (str.equalsIgnoreCase(extension))
-            {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * 鑾峰彇鏂囦欢鍚嶇殑鍚庣紑
-     *
-     * @param file 琛ㄥ崟鏂囦欢
-     * @return 鍚庣紑鍚�
-     */
-    public static final String getExtension(MultipartFile file)
-    {
-        String extension = FilenameUtils.getExtension(file.getOriginalFilename());
-        if (StringUtils.isEmpty(extension))
-        {
-            extension = MimeTypeUtils.getExtension(file.getContentType());
-        }
-        return extension;
-    }
-}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java
index d30ac51..dc3aea2 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUtils.java
@@ -1,10 +1,7 @@
 package com.ruoyi.common.utils.file;
 
 import cn.hutool.core.io.FileUtil;
-import cn.hutool.core.util.ArrayUtil;
-import com.ruoyi.common.utils.StringUtils;
 
-import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
@@ -17,77 +14,6 @@
  */
 public class FileUtils extends FileUtil
 {
-    public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+";
-
-    /**
-     * 鏂囦欢鍚嶇О楠岃瘉
-     *
-     * @param filename 鏂囦欢鍚嶇О
-     * @return true 姝e父 false 闈炴硶
-     */
-    public static boolean isValidFilename(String filename)
-    {
-        return filename.matches(FILENAME_PATTERN);
-    }
-
-    /**
-     * 妫�鏌ユ枃浠舵槸鍚﹀彲涓嬭浇
-     *
-     * @param resource 闇�瑕佷笅杞界殑鏂囦欢
-     * @return true 姝e父 false 闈炴硶
-     */
-    public static boolean checkAllowDownload(String resource)
-    {
-        // 绂佹鐩綍涓婅烦绾у埆
-        if (StringUtils.contains(resource, ".."))
-        {
-            return false;
-        }
-
-        // 妫�鏌ュ厑璁镐笅杞界殑鏂囦欢瑙勫垯
-        if (ArrayUtil.contains(MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION, FileTypeUtils.getFileType(resource)))
-        {
-            return true;
-        }
-
-        // 涓嶅湪鍏佽涓嬭浇鐨勬枃浠惰鍒�
-        return false;
-    }
-
-    /**
-     * 涓嬭浇鏂囦欢鍚嶉噸鏂扮紪鐮�
-     *
-     * @param request 璇锋眰瀵硅薄
-     * @param fileName 鏂囦欢鍚�
-     * @return 缂栫爜鍚庣殑鏂囦欢鍚�
-     */
-    public static String setFileDownloadHeader(HttpServletRequest request, String fileName) throws UnsupportedEncodingException
-    {
-        final String agent = request.getHeader("USER-AGENT");
-        String filename = fileName;
-        if (agent.contains("MSIE"))
-        {
-            // IE娴忚鍣�
-            filename = URLEncoder.encode(filename, StandardCharsets.UTF_8.toString());
-            filename = filename.replace("+", " ");
-        }
-        else if (agent.contains("Firefox"))
-        {
-            // 鐏嫄娴忚鍣�
-            filename = new String(fileName.getBytes(), "ISO8859-1");
-        }
-        else if (agent.contains("Chrome"))
-        {
-            // google娴忚鍣�
-            filename = URLEncoder.encode(filename, StandardCharsets.UTF_8.toString());
-        }
-        else
-        {
-            // 鍏跺畠娴忚鍣�
-            filename = URLEncoder.encode(filename, StandardCharsets.UTF_8.toString());
-        }
-        return filename;
-    }
 
     /**
      * 涓嬭浇鏂囦欢鍚嶉噸鏂扮紪鐮�
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/ImageUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/ImageUtils.java
deleted file mode 100644
index 0d26ef1..0000000
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/ImageUtils.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package com.ruoyi.common.utils.file;
-
-import com.ruoyi.common.config.RuoYiConfig;
-import com.ruoyi.common.constant.Constants;
-import com.ruoyi.common.utils.StringUtils;
-import org.apache.poi.util.IOUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Arrays;
-
-/**
- * 鍥剧墖澶勭悊宸ュ叿绫�
- *
- * @author ruoyi
- */
-public class ImageUtils
-{
-    private static final Logger log = LoggerFactory.getLogger(ImageUtils.class);
-
-    public static byte[] getImage(String imagePath)
-    {
-        InputStream is = getFile(imagePath);
-        try
-        {
-            return IOUtils.toByteArray(is);
-        }
-        catch (Exception e)
-        {
-            log.error("鍥剧墖鍔犺浇寮傚父 {}", e);
-            return null;
-        }
-        finally
-        {
-            IOUtils.closeQuietly(is);
-        }
-    }
-
-    public static InputStream getFile(String imagePath)
-    {
-        try
-        {
-            byte[] result = readFile(imagePath);
-            result = Arrays.copyOf(result, result.length);
-            return new ByteArrayInputStream(result);
-        }
-        catch (Exception e)
-        {
-            log.error("鑾峰彇鍥剧墖寮傚父 {}", e);
-        }
-        return null;
-    }
-
-    /**
-     * 璇诲彇鏂囦欢涓哄瓧鑺傛暟鎹�
-     *
-     * @param key 鍦板潃
-     * @return 瀛楄妭鏁版嵁
-     */
-    public static byte[] readFile(String url)
-    {
-        InputStream in = null;
-        ByteArrayOutputStream baos = null;
-        try
-        {
-            if (url.startsWith("http"))
-            {
-                // 缃戠粶鍦板潃
-                URL urlObj = new URL(url);
-                URLConnection urlConnection = urlObj.openConnection();
-                urlConnection.setConnectTimeout(30 * 1000);
-                urlConnection.setReadTimeout(60 * 1000);
-                urlConnection.setDoInput(true);
-                in = urlConnection.getInputStream();
-            }
-            else
-            {
-                // 鏈満鍦板潃
-                String localPath = RuoYiConfig.getProfile();
-                String downloadPath = localPath + StringUtils.substringAfter(url, Constants.RESOURCE_PREFIX);
-                in = new FileInputStream(downloadPath);
-            }
-            return IOUtils.toByteArray(in);
-        }
-        catch (Exception e)
-        {
-            log.error("鑾峰彇鏂囦欢璺緞寮傚父 {}", e);
-            return null;
-        }
-        finally
-        {
-            IOUtils.closeQuietly(in);
-            IOUtils.closeQuietly(baos);
-        }
-    }
-}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java
deleted file mode 100644
index f968f1a..0000000
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.ruoyi.common.utils.file;
-
-/**
- * 濯掍綋绫诲瀷宸ュ叿绫�
- * 
- * @author ruoyi
- */
-public class MimeTypeUtils
-{
-    public static final String IMAGE_PNG = "image/png";
-
-    public static final String IMAGE_JPG = "image/jpg";
-
-    public static final String IMAGE_JPEG = "image/jpeg";
-
-    public static final String IMAGE_BMP = "image/bmp";
-
-    public static final String IMAGE_GIF = "image/gif";
-    
-    public static final String[] IMAGE_EXTENSION = { "bmp", "gif", "jpg", "jpeg", "png" };
-
-    public static final String[] FLASH_EXTENSION = { "swf", "flv" };
-
-    public static final String[] MEDIA_EXTENSION = { "swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg",
-            "asf", "rm", "rmvb" };
-
-    public static final String[] VIDEO_EXTENSION = { "mp4", "avi", "rmvb" };
-
-    public static final String[] DEFAULT_ALLOWED_EXTENSION = {
-            // 鍥剧墖
-            "bmp", "gif", "jpg", "jpeg", "png",
-            // word excel powerpoint
-            "doc", "docx", "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt",
-            // 鍘嬬缉鏂囦欢
-            "rar", "zip", "gz", "bz2",
-            // 瑙嗛鏍煎紡
-            "mp4", "avi", "rmvb",
-            // pdf
-            "pdf" };
-
-    public static String getExtension(String prefix)
-    {
-        switch (prefix)
-        {
-            case IMAGE_PNG:
-                return "png";
-            case IMAGE_JPG:
-                return "jpg";
-            case IMAGE_JPEG:
-                return "jpeg";
-            case IMAGE_BMP:
-                return "bmp";
-            case IMAGE_GIF:
-                return "gif";
-            default:
-                return "";
-        }
-    }
-}
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java
index c3cdc94..870af3f 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/ResourcesConfig.java
@@ -1,5 +1,6 @@
 package com.ruoyi.framework.config;
 
+import com.ruoyi.framework.interceptor.RepeatSubmitInterceptor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -9,9 +10,6 @@
 import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
 import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-import com.ruoyi.common.config.RuoYiConfig;
-import com.ruoyi.common.constant.Constants;
-import com.ruoyi.framework.interceptor.RepeatSubmitInterceptor;
 
 /**
  * 閫氱敤閰嶇疆
@@ -27,8 +25,6 @@
     @Override
     public void addResourceHandlers(ResourceHandlerRegistry registry)
     {
-        /** 鏈湴鏂囦欢涓婁紶璺緞 */
-        registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**").addResourceLocations("file:" + RuoYiConfig.getProfile() + "/");
     }
 
     /**
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
index 6715a18..373c9e9 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
@@ -107,8 +107,6 @@
                         "/**/*.js",
                         "/profile/**"
                 ).permitAll()
-                .antMatchers("/common/download**").anonymous()
-                .antMatchers("/common/download/resource**").anonymous()
                 .antMatchers("/doc.html").anonymous()
                 .antMatchers("/swagger-resources/**").anonymous()
                 .antMatchers("/webjars/**").anonymous()
diff --git a/ruoyi-ui/src/main.js b/ruoyi-ui/src/main.js
index d07dead..5bc2b6c 100644
--- a/ruoyi-ui/src/main.js
+++ b/ruoyi-ui/src/main.js
@@ -16,7 +16,7 @@
 import './permission' // permission control
 import { getDicts } from "@/api/system/dict/data";
 import { getConfigKey } from "@/api/system/config";
-import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree } from "@/utils/ruoyi";
+import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
 import Pagination from "@/components/Pagination";
 // 鑷畾涔夎〃鏍煎伐鍏风粍浠�
 import RightToolbar from "@/components/RightToolbar"
@@ -39,7 +39,6 @@
 Vue.prototype.addDateRange = addDateRange
 Vue.prototype.selectDictLabel = selectDictLabel
 Vue.prototype.selectDictLabels = selectDictLabels
-Vue.prototype.download = download
 Vue.prototype.handleTree = handleTree
 
 Vue.prototype.msgSuccess = function (msg) {
diff --git a/ruoyi-ui/src/utils/ruoyi.js b/ruoyi-ui/src/utils/ruoyi.js
index ac390f5..fbe20fc 100644
--- a/ruoyi-ui/src/utils/ruoyi.js
+++ b/ruoyi-ui/src/utils/ruoyi.js
@@ -96,11 +96,6 @@
 	return actions.join('').substring(0, actions.join('').length - 1);
 }
 
-// 閫氱敤涓嬭浇鏂规硶
-export function download(fileName) {
-	window.location.href = baseURL + "/common/download?fileName=" + encodeURI(fileName) + "&delete=" + true;
-}
-
 // 瀛楃涓叉牸寮忓寲(%s )
 export function sprintf(str) {
 	var args = arguments, flag = true, i = 1;

--
Gitblit v1.9.3