diff --git a/jeelowcode-service/jeelowcode-service-infra-biz/pom.xml b/jeelowcode-service/jeelowcode-service-infra-biz/pom.xml index 08202fc..7238794 100644 --- a/jeelowcode-service/jeelowcode-service-infra-biz/pom.xml +++ b/jeelowcode-service/jeelowcode-service-infra-biz/pom.xml @@ -120,6 +120,10 @@ com.jeelowcode tool-spring-boot-starter-file + + com.jeelowcode + jeelowcode-utils + diff --git a/jeelowcode-service/jeelowcode-service-infra-biz/src/main/java/com/jeelowcode/service/infra/controller/FileController.java b/jeelowcode-service/jeelowcode-service-infra-biz/src/main/java/com/jeelowcode/service/infra/controller/FileController.java index 3a6078f..320949c 100644 --- a/jeelowcode-service/jeelowcode-service-infra-biz/src/main/java/com/jeelowcode/service/infra/controller/FileController.java +++ b/jeelowcode-service/jeelowcode-service-infra-biz/src/main/java/com/jeelowcode/service/infra/controller/FileController.java @@ -6,6 +6,7 @@ import cn.hutool.core.io.IoUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.URLUtil; +import com.jeelowcode.framework.utils.tool.StringUtil; import com.jeelowcode.service.infra.controller.vo.file.*; import com.jeelowcode.service.infra.entity.FileDO; import com.jeelowcode.service.infra.service.IFileService; @@ -23,6 +24,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.StringUtils; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -89,9 +91,10 @@ public class FileController { //根据天来分类 String today = DateUtil.today(); String publicPath = "upload/" + tenantId + "/" + today + "/" + userId + "/"; //upload/租户id/20240720/用户id/aa.jpg + + fileName = StringUtil.randomUUID()+"."+fileName.substring(fileName.lastIndexOf(".")+1);;////fileService.getUniqueFileName(fileName, path); String path = publicPath + fileName; - fileName = fileService.getUniqueFileName(fileName, path); // 解决信创环境下文件名中文乱码导致附件错乱的问题 path = publicPath + fileName;