From 90c41d498c98ba872f20250c0025303a07bfa894 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期一, 05 七月 2021 14:54:09 +0800
Subject: [PATCH] 角色管理新增分配用户功能

---
 ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

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
index 183f918..94a5d43 100644
--- 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
@@ -15,7 +15,7 @@
 
 /**
  * 鏂囦欢涓婁紶宸ュ叿绫�
- * 
+ *
  * @author ruoyi
  */
 public class FileUploadUtils
@@ -89,7 +89,7 @@
      *
      * @param baseDir 鐩稿搴旂敤鐨勫熀鐩綍
      * @param file 涓婁紶鐨勬枃浠�
-     * @param extension 涓婁紶鏂囦欢绫诲瀷
+     * @param allowedExtension 涓婁紶鏂囦欢绫诲瀷
      * @return 杩斿洖涓婁紶鎴愬姛鐨勬枃浠跺悕
      * @throws FileSizeLimitExceededException 濡傛灉瓒呭嚭鏈�澶уぇ灏�
      * @throws FileNameLengthLimitExceededException 鏂囦欢鍚嶅お闀�
@@ -131,13 +131,12 @@
     {
         File desc = new File(uploadDir + File.separator + fileName);
 
-        if (!desc.getParentFile().exists())
-        {
-            desc.getParentFile().mkdirs();
-        }
         if (!desc.exists())
         {
-            desc.createNewFile();
+            if (!desc.getParentFile().exists())
+            {
+                desc.getParentFile().mkdirs();
+            }
         }
         return desc;
     }
@@ -186,6 +185,11 @@
                 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);
@@ -215,7 +219,7 @@
 
     /**
      * 鑾峰彇鏂囦欢鍚嶇殑鍚庣紑
-     * 
+     *
      * @param file 琛ㄥ崟鏂囦欢
      * @return 鍚庣紑鍚�
      */
@@ -228,4 +232,4 @@
         }
         return extension;
     }
-}
\ No newline at end of file
+}

--
Gitblit v1.9.3