diff --git a/ruoyi/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java b/ruoyi/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java index 6921fea77..5b356e294 100644 --- a/ruoyi/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java +++ b/ruoyi/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java @@ -9,8 +9,8 @@ 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.IdUtils; import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.common.utils.security.Md5Utils; import com.ruoyi.framework.config.RuoYiConfig; /** @@ -35,8 +35,6 @@ public class FileUploadUtils */ private static String defaultBaseDir = RuoYiConfig.getProfile(); - private static int counter = 0; - public static void setDefaultBaseDir(String defaultBaseDir) { FileUploadUtils.defaultBaseDir = defaultBaseDir; @@ -125,7 +123,7 @@ public class FileUploadUtils { String fileName = file.getOriginalFilename(); String extension = getExtension(file); - fileName = DateUtils.datePath() + "/" + encodingFilename(fileName) + "." + extension; + fileName = DateUtils.datePath() + "/" + IdUtils.fastUUID() + "." + extension; return fileName; } @@ -152,16 +150,6 @@ public class FileUploadUtils return pathFileName; } - /** - * 编码文件名 - */ - private static final String encodingFilename(String fileName) - { - fileName = fileName.replace("_", " "); - fileName = Md5Utils.hash(fileName + System.nanoTime() + counter++); - return fileName; - } - /** * 文件大小校验 * diff --git a/ruoyi/src/main/java/com/ruoyi/common/utils/security/Md5Utils.java b/ruoyi/src/main/java/com/ruoyi/common/utils/sign/Md5Utils.java similarity index 93% rename from ruoyi/src/main/java/com/ruoyi/common/utils/security/Md5Utils.java rename to ruoyi/src/main/java/com/ruoyi/common/utils/sign/Md5Utils.java index 40e80304a..df1e23f8d 100644 --- a/ruoyi/src/main/java/com/ruoyi/common/utils/security/Md5Utils.java +++ b/ruoyi/src/main/java/com/ruoyi/common/utils/sign/Md5Utils.java @@ -1,4 +1,4 @@ -package com.ruoyi.common.utils.security; +package com.ruoyi.common.utils.sign; import java.security.MessageDigest; import org.slf4j.Logger; diff --git a/ruoyi/src/main/java/com/ruoyi/project/system/service/impl/SysUserServiceImpl.java b/ruoyi/src/main/java/com/ruoyi/project/system/service/impl/SysUserServiceImpl.java index 28788e4df..b6842e9c3 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/system/service/impl/SysUserServiceImpl.java +++ b/ruoyi/src/main/java/com/ruoyi/project/system/service/impl/SysUserServiceImpl.java @@ -454,5 +454,4 @@ public class SysUserServiceImpl implements ISysUserService } return successMsg.toString(); } - }