diff --git a/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClientConfig.java b/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClientConfig.java index e337bd89db..bdc7ef2065 100644 --- a/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClientConfig.java +++ b/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClientConfig.java @@ -40,12 +40,6 @@ public class S3FileClientConfig implements FileClientConfig { */ @URL(message = "domain 必须是 URL 格式") private String domain; - /** - * 区域 - */ -// @NotNull(message = "region 不能为空") - @Deprecated - private String region; /** * 存储 Bucket */ diff --git a/yudao-framework/yudao-spring-boot-starter-file/src/test/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClientTest.java b/yudao-framework/yudao-spring-boot-starter-file/src/test/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClientTest.java index 636f146fa2..de77477cd4 100644 --- a/yudao-framework/yudao-spring-boot-starter-file/src/test/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClientTest.java +++ b/yudao-framework/yudao-spring-boot-starter-file/src/test/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClientTest.java @@ -21,7 +21,6 @@ public class S3FileClientTest { config.setDomain(null); // 默认 9000 endpoint config.setEndpoint("http://127.0.0.1:9000"); - config.setRegion("us-east-1"); // 执行上传 testExecuteUpload(config); diff --git a/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApi.java b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApi.java index 5d55c57316..fa3ec5c6ee 100644 --- a/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApi.java +++ b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApi.java @@ -15,7 +15,7 @@ public interface FileApi { * @param content 文件内容 * @return 文件路径 */ - default String createFile(byte[] content) { + default String createFile(byte[] content) throws Exception { return createFile(IdUtil.fastUUID(), content); } @@ -26,6 +26,6 @@ public interface FileApi { * @param content 文件内容 * @return 文件路径 */ - String createFile(String path, byte[] content); + String createFile(String path, byte[] content) throws Exception; } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApiImpl.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApiImpl.java index c5ce8db198..d43eac1d53 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApiImpl.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApiImpl.java @@ -1,6 +1,5 @@ package cn.iocoder.yudao.module.infra.api.file; -import cn.iocoder.yudao.module.infra.api.file.FileApi; import cn.iocoder.yudao.module.infra.service.file.FileService; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; @@ -20,7 +19,7 @@ public class FileApiImpl implements FileApi { private FileService fileService; @Override - public String createFile(String path, byte[] content) { + public String createFile(String path, byte[] content) throws Exception { return fileService.createFile(path, content); } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileConfigController.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileConfigController.java index 92ecd2bb9f..8c355d6275 100755 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileConfigController.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileConfigController.java @@ -82,7 +82,7 @@ public class FileConfigController { @GetMapping("/test") @ApiOperation("测试文件配置是否正确") @PreAuthorize("@ss.hasPermission('infra:file-config:query')") - public CommonResult testFileConfig(@RequestParam("id") Long id) { + public CommonResult testFileConfig(@RequestParam("id") Long id) throws Exception { String url = fileConfigService.testFileConfig(id); return success(url); } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java index e1cc6d0769..e3d810dec4 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java @@ -23,7 +23,6 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; -import java.io.IOException; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @@ -44,7 +43,7 @@ public class FileController { @ApiImplicitParam(name = "path", value = "文件路径", example = "yudaoyuanma.png", dataTypeClass = String.class) }) public CommonResult uploadFile(@RequestParam("file") MultipartFile file, - @RequestParam("path") String path) throws IOException { + @RequestParam("path") String path) throws Exception { return success(fileService.createFile(path, IoUtil.readBytes(file.getInputStream()))); } @@ -52,7 +51,7 @@ public class FileController { @ApiOperation("删除文件") @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class) @PreAuthorize("@ss.hasPermission('infra:file:delete')") - public CommonResult deleteFile(@RequestParam("id") Long id) { + public CommonResult deleteFile(@RequestParam("id") Long id) throws Exception { fileService.deleteFile(id); return success(true); } @@ -65,7 +64,7 @@ public class FileController { }) public void getFileContent(HttpServletResponse response, @PathVariable("configId") Long configId, - @PathVariable("path") String path) throws IOException { + @PathVariable("path") String path) throws Exception { byte[] content = fileService.getFileContent(configId, path); if (content == null) { log.warn("[getFileContent][configId({}) path({}) 文件不存在]", configId, path); diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigService.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigService.java index 3260526888..02197b98ee 100755 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigService.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigService.java @@ -82,7 +82,7 @@ public interface FileConfigService { * @param id 编号 * @return 文件 URL */ - String testFileConfig(Long id); + String testFileConfig(Long id) throws Exception; /** * 获得指定编号的文件客户端 diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImpl.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImpl.java index 3d79bdeef1..bd0ced564c 100755 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImpl.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImpl.java @@ -225,7 +225,7 @@ public class FileConfigServiceImpl implements FileConfigService { } @Override - public String testFileConfig(Long id) { + public String testFileConfig(Long id) throws Exception { // 校验存在 this.validateFileConfigExists(id); // 上传文件 diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileService.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileService.java index ea5f313908..2d893c0823 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileService.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileService.java @@ -26,14 +26,14 @@ public interface FileService { * @param content 文件内容 * @return 文件路径 */ - String createFile(String path, byte[] content); + String createFile(String path, byte[] content) throws Exception; /** * 删除文件 * * @param id 编号 */ - void deleteFile(Long id); + void deleteFile(Long id) throws Exception; /** * 获得文件内容 @@ -42,6 +42,6 @@ public interface FileService { * @param path 文件路径 * @return 文件内容 */ - byte[] getFileContent(Long configId, String path); + byte[] getFileContent(Long configId, String path) throws Exception; } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileServiceImpl.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileServiceImpl.java index 3a3c3c010c..66af402e0d 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileServiceImpl.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileServiceImpl.java @@ -35,7 +35,7 @@ public class FileServiceImpl implements FileService { } @Override - public String createFile(String path, byte[] content) { + public String createFile(String path, byte[] content) throws Exception { // 上传到文件存储器 FileClient client = fileConfigService.getMasterFileClient(); Assert.notNull(client, "客户端(master) 不能为空"); @@ -53,7 +53,7 @@ public class FileServiceImpl implements FileService { } @Override - public void deleteFile(Long id) { + public void deleteFile(Long id) throws Exception { // 校验存在 FileDO file = this.validateFileExists(id); @@ -75,7 +75,7 @@ public class FileServiceImpl implements FileService { } @Override - public byte[] getFileContent(Long configId, String path) { + public byte[] getFileContent(Long configId, String path) throws Exception { FileClient client = fileConfigService.getFileClient(configId); Assert.notNull(client, "客户端({}) 不能为空", configId); return client.getContent(path); diff --git a/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImplTest.java b/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImplTest.java index 457c0682ab..33e85f03bb 100755 --- a/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImplTest.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImplTest.java @@ -228,7 +228,7 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest { } @Test - public void testFileConfig() { + public void testFileConfig() throws Exception { // mock 数据 FileConfigDO dbFileConfig = randomFileConfigDO().setMaster(false); fileConfigMapper.insert(dbFileConfig);// @Sql: 先插入出一条存在的数据 diff --git a/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileServiceTest.java b/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileServiceTest.java index 6ff74a21f2..4682bfbd96 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileServiceTest.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileServiceTest.java @@ -70,7 +70,7 @@ public class FileServiceTest extends BaseDbUnitTest { } @Test - public void testCreateFile_success() { + public void testCreateFile_success() throws Exception { // 准备参数 String path = randomString(); byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); @@ -95,7 +95,7 @@ public class FileServiceTest extends BaseDbUnitTest { } @Test - public void testDeleteFile_success() { + public void testDeleteFile_success() throws Exception { // mock 数据 FileDO dbFile = randomPojo(FileDO.class, o -> o.setConfigId(10L).setPath("tudou.jpg")); fileMapper.insert(dbFile);// @Sql: 先插入出一条存在的数据 @@ -123,7 +123,7 @@ public class FileServiceTest extends BaseDbUnitTest { } @Test - public void testGetFileContent() { + public void testGetFileContent() throws Exception { // 准备参数 Long configId = 10L; String path = "tudou.jpg"; diff --git a/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/AppUserController.java b/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/AppUserController.java index 33505ea3a8..edefcdba06 100644 --- a/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/AppUserController.java +++ b/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/AppUserController.java @@ -16,9 +16,8 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.validation.Valid; -import java.io.IOException; -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.*; +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_IS_EMPTY; @@ -44,7 +43,7 @@ public class AppUserController { @PutMapping("/update-avatar") @ApiOperation("修改用户头像") @PreAuthenticated - public CommonResult updateUserAvatar(@RequestParam("avatarFile") MultipartFile file) throws IOException { + public CommonResult updateUserAvatar(@RequestParam("avatarFile") MultipartFile file) throws Exception { if (file.isEmpty()) { throw exception(FILE_IS_EMPTY); } diff --git a/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserService.java b/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserService.java index 1a38e61af1..3c0e62de83 100644 --- a/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserService.java +++ b/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserService.java @@ -60,7 +60,7 @@ public interface MemberUserService { * @param inputStream 头像文件 * @return 头像url */ - String updateUserAvatar(Long userId, InputStream inputStream); + String updateUserAvatar(Long userId, InputStream inputStream) throws Exception; /** * 修改手机 diff --git a/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java b/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java index fcfe3ae511..0522e8eda8 100644 --- a/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java +++ b/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java @@ -100,7 +100,7 @@ public class MemberUserServiceImpl implements MemberUserService { } @Override - public String updateUserAvatar(Long userId, InputStream avatarFile) { + public String updateUserAvatar(Long userId, InputStream avatarFile) throws Exception { this.checkUserExists(userId); // 创建文件 String avatar = fileApi.createFile(IoUtil.readBytes(avatarFile)); diff --git a/yudao-module-member/yudao-module-member-impl/src/test/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImplTest.java b/yudao-module-member/yudao-module-member-impl/src/test/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImplTest.java index 46d72091ce..dc642f9b4c 100644 --- a/yudao-module-member/yudao-module-member-impl/src/test/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImplTest.java +++ b/yudao-module-member/yudao-module-member-impl/src/test/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImplTest.java @@ -74,7 +74,7 @@ public class MemberUserServiceImplTest extends BaseDbAndRedisUnitTest { } @Test - public void testUpdateAvatar_success(){ + public void testUpdateAvatar_success() throws Exception { // mock 数据 MemberUserDO dbUser = randomUserDO(); userMapper.insert(dbUser); diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserProfileController.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserProfileController.java index d68fa96cc5..9c6c240928 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserProfileController.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserProfileController.java @@ -29,7 +29,6 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.validation.Valid; -import java.io.IOException; import java.util.List; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @@ -99,7 +98,7 @@ public class UserProfileController { @PutMapping("/update-avatar") @ApiOperation("上传用户个人头像") - public CommonResult updateUserAvatar(@RequestParam("avatarFile") MultipartFile file) throws IOException { + public CommonResult updateUserAvatar(@RequestParam("avatarFile") MultipartFile file) throws Exception { if (file.isEmpty()) { throw ServiceExceptionUtil.exception(FILE_IS_EMPTY); } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java index e9a6fdc967..78d6a88a95 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java @@ -64,7 +64,7 @@ public interface AdminUserService { * @param id 用户 id * @param avatarFile 头像文件 */ - String updateUserAvatar(Long id, InputStream avatarFile); + String updateUserAvatar(Long id, InputStream avatarFile) throws Exception; /** * 修改密码 diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java index 279be9d57d..5bf048aebc 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java @@ -118,7 +118,7 @@ public class AdminUserServiceImpl implements AdminUserService { } @Override - public String updateUserAvatar(Long id, InputStream avatarFile) { + public String updateUserAvatar(Long id, InputStream avatarFile) throws Exception { this.checkUserExists(id); // 存储文件 String avatar = fileApi.createFile(IoUtil.readBytes(avatarFile)); diff --git a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/user/UserServiceImplTest.java b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/user/UserServiceImplTest.java index 49d18dc069..5197d422b3 100644 --- a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/user/UserServiceImplTest.java +++ b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/user/UserServiceImplTest.java @@ -196,7 +196,7 @@ public class UserServiceImplTest extends BaseDbUnitTest { } @Test - public void testUpdateUserAvatar_success() { + public void testUpdateUserAvatar_success() throws Exception { // mock 数据 AdminUserDO dbUser = randomAdminUserDO(); userMapper.insert(dbUser); diff --git a/yudao-ui-admin/src/views/infra/fileConfig/index.vue b/yudao-ui-admin/src/views/infra/fileConfig/index.vue index 36d962e5ba..1257c5e300 100755 --- a/yudao-ui-admin/src/views/infra/fileConfig/index.vue +++ b/yudao-ui-admin/src/views/infra/fileConfig/index.vue @@ -109,9 +109,6 @@ - - - @@ -190,7 +187,6 @@ export default { password: [{ required: true, message: "密码不能为空", trigger: "blur" }], mode: [{ required: true, message: "连接模式不能为空", trigger: "change" }], endpoint: [{ required: true, message: "节点地址不能为空", trigger: "blur" }], - region: [{ required: true, message: "区域名不能为空", trigger: "blur" }], bucket: [{ required: true, message: "存储 bucket 不能为空", trigger: "blur" }], accessKey: [{ required: true, message: "accessKey 不能为空", trigger: "blur" }], accessSecret: [{ required: true, message: "accessSecret 不能为空", trigger: "blur" }],