Commit 813069abf4400631ea84d3cd545c933304d2aa6f
1 parent
34a7399a
优化文件配置,去掉 region 的配置,通过自动识别
Showing
21 changed files
with
28 additions
and
43 deletions
yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClientConfig.java
| @@ -41,12 +41,6 @@ public class S3FileClientConfig implements FileClientConfig { | @@ -41,12 +41,6 @@ public class S3FileClientConfig implements FileClientConfig { | ||
| 41 | @URL(message = "domain 必须是 URL 格式") | 41 | @URL(message = "domain 必须是 URL 格式") |
| 42 | private String domain; | 42 | private String domain; |
| 43 | /** | 43 | /** |
| 44 | - * 区域 | ||
| 45 | - */ | ||
| 46 | -// @NotNull(message = "region 不能为空") | ||
| 47 | - @Deprecated | ||
| 48 | - private String region; | ||
| 49 | - /** | ||
| 50 | * 存储 Bucket | 44 | * 存储 Bucket |
| 51 | */ | 45 | */ |
| 52 | @NotNull(message = "bucket 不能为空") | 46 | @NotNull(message = "bucket 不能为空") |
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 { | @@ -21,7 +21,6 @@ public class S3FileClientTest { | ||
| 21 | config.setDomain(null); | 21 | config.setDomain(null); |
| 22 | // 默认 9000 endpoint | 22 | // 默认 9000 endpoint |
| 23 | config.setEndpoint("http://127.0.0.1:9000"); | 23 | config.setEndpoint("http://127.0.0.1:9000"); |
| 24 | - config.setRegion("us-east-1"); | ||
| 25 | 24 | ||
| 26 | // 执行上传 | 25 | // 执行上传 |
| 27 | testExecuteUpload(config); | 26 | testExecuteUpload(config); |
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 { | @@ -15,7 +15,7 @@ public interface FileApi { | ||
| 15 | * @param content 文件内容 | 15 | * @param content 文件内容 |
| 16 | * @return 文件路径 | 16 | * @return 文件路径 |
| 17 | */ | 17 | */ |
| 18 | - default String createFile(byte[] content) { | 18 | + default String createFile(byte[] content) throws Exception { |
| 19 | return createFile(IdUtil.fastUUID(), content); | 19 | return createFile(IdUtil.fastUUID(), content); |
| 20 | } | 20 | } |
| 21 | 21 | ||
| @@ -26,6 +26,6 @@ public interface FileApi { | @@ -26,6 +26,6 @@ public interface FileApi { | ||
| 26 | * @param content 文件内容 | 26 | * @param content 文件内容 |
| 27 | * @return 文件路径 | 27 | * @return 文件路径 |
| 28 | */ | 28 | */ |
| 29 | - String createFile(String path, byte[] content); | 29 | + String createFile(String path, byte[] content) throws Exception; |
| 30 | 30 | ||
| 31 | } | 31 | } |
yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApiImpl.java
| 1 | package cn.iocoder.yudao.module.infra.api.file; | 1 | package cn.iocoder.yudao.module.infra.api.file; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.module.infra.api.file.FileApi; | ||
| 4 | import cn.iocoder.yudao.module.infra.service.file.FileService; | 3 | import cn.iocoder.yudao.module.infra.service.file.FileService; |
| 5 | import org.springframework.stereotype.Service; | 4 | import org.springframework.stereotype.Service; |
| 6 | import org.springframework.validation.annotation.Validated; | 5 | import org.springframework.validation.annotation.Validated; |
| @@ -20,7 +19,7 @@ public class FileApiImpl implements FileApi { | @@ -20,7 +19,7 @@ public class FileApiImpl implements FileApi { | ||
| 20 | private FileService fileService; | 19 | private FileService fileService; |
| 21 | 20 | ||
| 22 | @Override | 21 | @Override |
| 23 | - public String createFile(String path, byte[] content) { | 22 | + public String createFile(String path, byte[] content) throws Exception { |
| 24 | return fileService.createFile(path, content); | 23 | return fileService.createFile(path, content); |
| 25 | } | 24 | } |
| 26 | 25 |
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 { | @@ -82,7 +82,7 @@ public class FileConfigController { | ||
| 82 | @GetMapping("/test") | 82 | @GetMapping("/test") |
| 83 | @ApiOperation("测试文件配置是否正确") | 83 | @ApiOperation("测试文件配置是否正确") |
| 84 | @PreAuthorize("@ss.hasPermission('infra:file-config:query')") | 84 | @PreAuthorize("@ss.hasPermission('infra:file-config:query')") |
| 85 | - public CommonResult<String> testFileConfig(@RequestParam("id") Long id) { | 85 | + public CommonResult<String> testFileConfig(@RequestParam("id") Long id) throws Exception { |
| 86 | String url = fileConfigService.testFileConfig(id); | 86 | String url = fileConfigService.testFileConfig(id); |
| 87 | return success(url); | 87 | return success(url); |
| 88 | } | 88 | } |
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; | @@ -23,7 +23,6 @@ import org.springframework.web.multipart.MultipartFile; | ||
| 23 | import javax.annotation.Resource; | 23 | import javax.annotation.Resource; |
| 24 | import javax.servlet.http.HttpServletResponse; | 24 | import javax.servlet.http.HttpServletResponse; |
| 25 | import javax.validation.Valid; | 25 | import javax.validation.Valid; |
| 26 | -import java.io.IOException; | ||
| 27 | 26 | ||
| 28 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 27 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 29 | 28 | ||
| @@ -44,7 +43,7 @@ public class FileController { | @@ -44,7 +43,7 @@ public class FileController { | ||
| 44 | @ApiImplicitParam(name = "path", value = "文件路径", example = "yudaoyuanma.png", dataTypeClass = String.class) | 43 | @ApiImplicitParam(name = "path", value = "文件路径", example = "yudaoyuanma.png", dataTypeClass = String.class) |
| 45 | }) | 44 | }) |
| 46 | public CommonResult<String> uploadFile(@RequestParam("file") MultipartFile file, | 45 | public CommonResult<String> uploadFile(@RequestParam("file") MultipartFile file, |
| 47 | - @RequestParam("path") String path) throws IOException { | 46 | + @RequestParam("path") String path) throws Exception { |
| 48 | return success(fileService.createFile(path, IoUtil.readBytes(file.getInputStream()))); | 47 | return success(fileService.createFile(path, IoUtil.readBytes(file.getInputStream()))); |
| 49 | } | 48 | } |
| 50 | 49 | ||
| @@ -52,7 +51,7 @@ public class FileController { | @@ -52,7 +51,7 @@ public class FileController { | ||
| 52 | @ApiOperation("删除文件") | 51 | @ApiOperation("删除文件") |
| 53 | @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class) | 52 | @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class) |
| 54 | @PreAuthorize("@ss.hasPermission('infra:file:delete')") | 53 | @PreAuthorize("@ss.hasPermission('infra:file:delete')") |
| 55 | - public CommonResult<Boolean> deleteFile(@RequestParam("id") Long id) { | 54 | + public CommonResult<Boolean> deleteFile(@RequestParam("id") Long id) throws Exception { |
| 56 | fileService.deleteFile(id); | 55 | fileService.deleteFile(id); |
| 57 | return success(true); | 56 | return success(true); |
| 58 | } | 57 | } |
| @@ -65,7 +64,7 @@ public class FileController { | @@ -65,7 +64,7 @@ public class FileController { | ||
| 65 | }) | 64 | }) |
| 66 | public void getFileContent(HttpServletResponse response, | 65 | public void getFileContent(HttpServletResponse response, |
| 67 | @PathVariable("configId") Long configId, | 66 | @PathVariable("configId") Long configId, |
| 68 | - @PathVariable("path") String path) throws IOException { | 67 | + @PathVariable("path") String path) throws Exception { |
| 69 | byte[] content = fileService.getFileContent(configId, path); | 68 | byte[] content = fileService.getFileContent(configId, path); |
| 70 | if (content == null) { | 69 | if (content == null) { |
| 71 | log.warn("[getFileContent][configId({}) path({}) 文件不存在]", configId, path); | 70 | log.warn("[getFileContent][configId({}) path({}) 文件不存在]", configId, path); |
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 { | @@ -82,7 +82,7 @@ public interface FileConfigService { | ||
| 82 | * @param id 编号 | 82 | * @param id 编号 |
| 83 | * @return 文件 URL | 83 | * @return 文件 URL |
| 84 | */ | 84 | */ |
| 85 | - String testFileConfig(Long id); | 85 | + String testFileConfig(Long id) throws Exception; |
| 86 | 86 | ||
| 87 | /** | 87 | /** |
| 88 | * 获得指定编号的文件客户端 | 88 | * 获得指定编号的文件客户端 |
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 { | @@ -225,7 +225,7 @@ public class FileConfigServiceImpl implements FileConfigService { | ||
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | @Override | 227 | @Override |
| 228 | - public String testFileConfig(Long id) { | 228 | + public String testFileConfig(Long id) throws Exception { |
| 229 | // 校验存在 | 229 | // 校验存在 |
| 230 | this.validateFileConfigExists(id); | 230 | this.validateFileConfigExists(id); |
| 231 | // 上传文件 | 231 | // 上传文件 |
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 { | @@ -26,14 +26,14 @@ public interface FileService { | ||
| 26 | * @param content 文件内容 | 26 | * @param content 文件内容 |
| 27 | * @return 文件路径 | 27 | * @return 文件路径 |
| 28 | */ | 28 | */ |
| 29 | - String createFile(String path, byte[] content); | 29 | + String createFile(String path, byte[] content) throws Exception; |
| 30 | 30 | ||
| 31 | /** | 31 | /** |
| 32 | * 删除文件 | 32 | * 删除文件 |
| 33 | * | 33 | * |
| 34 | * @param id 编号 | 34 | * @param id 编号 |
| 35 | */ | 35 | */ |
| 36 | - void deleteFile(Long id); | 36 | + void deleteFile(Long id) throws Exception; |
| 37 | 37 | ||
| 38 | /** | 38 | /** |
| 39 | * 获得文件内容 | 39 | * 获得文件内容 |
| @@ -42,6 +42,6 @@ public interface FileService { | @@ -42,6 +42,6 @@ public interface FileService { | ||
| 42 | * @param path 文件路径 | 42 | * @param path 文件路径 |
| 43 | * @return 文件内容 | 43 | * @return 文件内容 |
| 44 | */ | 44 | */ |
| 45 | - byte[] getFileContent(Long configId, String path); | 45 | + byte[] getFileContent(Long configId, String path) throws Exception; |
| 46 | 46 | ||
| 47 | } | 47 | } |
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 { | @@ -35,7 +35,7 @@ public class FileServiceImpl implements FileService { | ||
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | @Override | 37 | @Override |
| 38 | - public String createFile(String path, byte[] content) { | 38 | + public String createFile(String path, byte[] content) throws Exception { |
| 39 | // 上传到文件存储器 | 39 | // 上传到文件存储器 |
| 40 | FileClient client = fileConfigService.getMasterFileClient(); | 40 | FileClient client = fileConfigService.getMasterFileClient(); |
| 41 | Assert.notNull(client, "客户端(master) 不能为空"); | 41 | Assert.notNull(client, "客户端(master) 不能为空"); |
| @@ -53,7 +53,7 @@ public class FileServiceImpl implements FileService { | @@ -53,7 +53,7 @@ public class FileServiceImpl implements FileService { | ||
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | @Override | 55 | @Override |
| 56 | - public void deleteFile(Long id) { | 56 | + public void deleteFile(Long id) throws Exception { |
| 57 | // 校验存在 | 57 | // 校验存在 |
| 58 | FileDO file = this.validateFileExists(id); | 58 | FileDO file = this.validateFileExists(id); |
| 59 | 59 | ||
| @@ -75,7 +75,7 @@ public class FileServiceImpl implements FileService { | @@ -75,7 +75,7 @@ public class FileServiceImpl implements FileService { | ||
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | @Override | 77 | @Override |
| 78 | - public byte[] getFileContent(Long configId, String path) { | 78 | + public byte[] getFileContent(Long configId, String path) throws Exception { |
| 79 | FileClient client = fileConfigService.getFileClient(configId); | 79 | FileClient client = fileConfigService.getFileClient(configId); |
| 80 | Assert.notNull(client, "客户端({}) 不能为空", configId); | 80 | Assert.notNull(client, "客户端({}) 不能为空", configId); |
| 81 | return client.getContent(path); | 81 | return client.getContent(path); |
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 { | @@ -228,7 +228,7 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest { | ||
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | @Test | 230 | @Test |
| 231 | - public void testFileConfig() { | 231 | + public void testFileConfig() throws Exception { |
| 232 | // mock 数据 | 232 | // mock 数据 |
| 233 | FileConfigDO dbFileConfig = randomFileConfigDO().setMaster(false); | 233 | FileConfigDO dbFileConfig = randomFileConfigDO().setMaster(false); |
| 234 | fileConfigMapper.insert(dbFileConfig);// @Sql: 先插入出一条存在的数据 | 234 | fileConfigMapper.insert(dbFileConfig);// @Sql: 先插入出一条存在的数据 |
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 { | @@ -70,7 +70,7 @@ public class FileServiceTest extends BaseDbUnitTest { | ||
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | @Test | 72 | @Test |
| 73 | - public void testCreateFile_success() { | 73 | + public void testCreateFile_success() throws Exception { |
| 74 | // 准备参数 | 74 | // 准备参数 |
| 75 | String path = randomString(); | 75 | String path = randomString(); |
| 76 | byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); | 76 | byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); |
| @@ -95,7 +95,7 @@ public class FileServiceTest extends BaseDbUnitTest { | @@ -95,7 +95,7 @@ public class FileServiceTest extends BaseDbUnitTest { | ||
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | @Test | 97 | @Test |
| 98 | - public void testDeleteFile_success() { | 98 | + public void testDeleteFile_success() throws Exception { |
| 99 | // mock 数据 | 99 | // mock 数据 |
| 100 | FileDO dbFile = randomPojo(FileDO.class, o -> o.setConfigId(10L).setPath("tudou.jpg")); | 100 | FileDO dbFile = randomPojo(FileDO.class, o -> o.setConfigId(10L).setPath("tudou.jpg")); |
| 101 | fileMapper.insert(dbFile);// @Sql: 先插入出一条存在的数据 | 101 | fileMapper.insert(dbFile);// @Sql: 先插入出一条存在的数据 |
| @@ -123,7 +123,7 @@ public class FileServiceTest extends BaseDbUnitTest { | @@ -123,7 +123,7 @@ public class FileServiceTest extends BaseDbUnitTest { | ||
| 123 | } | 123 | } |
| 124 | 124 | ||
| 125 | @Test | 125 | @Test |
| 126 | - public void testGetFileContent() { | 126 | + public void testGetFileContent() throws Exception { |
| 127 | // 准备参数 | 127 | // 准备参数 |
| 128 | Long configId = 10L; | 128 | Long configId = 10L; |
| 129 | String path = "tudou.jpg"; | 129 | String path = "tudou.jpg"; |
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; | @@ -16,9 +16,8 @@ import org.springframework.web.multipart.MultipartFile; | ||
| 16 | 16 | ||
| 17 | import javax.annotation.Resource; | 17 | import javax.annotation.Resource; |
| 18 | import javax.validation.Valid; | 18 | import javax.validation.Valid; |
| 19 | -import java.io.IOException; | ||
| 20 | 19 | ||
| 21 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.*; | 20 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 22 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 21 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 23 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | 22 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| 24 | import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_IS_EMPTY; | 23 | import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_IS_EMPTY; |
| @@ -44,7 +43,7 @@ public class AppUserController { | @@ -44,7 +43,7 @@ public class AppUserController { | ||
| 44 | @PutMapping("/update-avatar") | 43 | @PutMapping("/update-avatar") |
| 45 | @ApiOperation("修改用户头像") | 44 | @ApiOperation("修改用户头像") |
| 46 | @PreAuthenticated | 45 | @PreAuthenticated |
| 47 | - public CommonResult<String> updateUserAvatar(@RequestParam("avatarFile") MultipartFile file) throws IOException { | 46 | + public CommonResult<String> updateUserAvatar(@RequestParam("avatarFile") MultipartFile file) throws Exception { |
| 48 | if (file.isEmpty()) { | 47 | if (file.isEmpty()) { |
| 49 | throw exception(FILE_IS_EMPTY); | 48 | throw exception(FILE_IS_EMPTY); |
| 50 | } | 49 | } |
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 { | @@ -60,7 +60,7 @@ public interface MemberUserService { | ||
| 60 | * @param inputStream 头像文件 | 60 | * @param inputStream 头像文件 |
| 61 | * @return 头像url | 61 | * @return 头像url |
| 62 | */ | 62 | */ |
| 63 | - String updateUserAvatar(Long userId, InputStream inputStream); | 63 | + String updateUserAvatar(Long userId, InputStream inputStream) throws Exception; |
| 64 | 64 | ||
| 65 | /** | 65 | /** |
| 66 | * 修改手机 | 66 | * 修改手机 |
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 { | @@ -100,7 +100,7 @@ public class MemberUserServiceImpl implements MemberUserService { | ||
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | @Override | 102 | @Override |
| 103 | - public String updateUserAvatar(Long userId, InputStream avatarFile) { | 103 | + public String updateUserAvatar(Long userId, InputStream avatarFile) throws Exception { |
| 104 | this.checkUserExists(userId); | 104 | this.checkUserExists(userId); |
| 105 | // 创建文件 | 105 | // 创建文件 |
| 106 | String avatar = fileApi.createFile(IoUtil.readBytes(avatarFile)); | 106 | String avatar = fileApi.createFile(IoUtil.readBytes(avatarFile)); |
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 { | @@ -74,7 +74,7 @@ public class MemberUserServiceImplTest extends BaseDbAndRedisUnitTest { | ||
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | @Test | 76 | @Test |
| 77 | - public void testUpdateAvatar_success(){ | 77 | + public void testUpdateAvatar_success() throws Exception { |
| 78 | // mock 数据 | 78 | // mock 数据 |
| 79 | MemberUserDO dbUser = randomUserDO(); | 79 | MemberUserDO dbUser = randomUserDO(); |
| 80 | userMapper.insert(dbUser); | 80 | userMapper.insert(dbUser); |
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; | @@ -29,7 +29,6 @@ import org.springframework.web.multipart.MultipartFile; | ||
| 29 | 29 | ||
| 30 | import javax.annotation.Resource; | 30 | import javax.annotation.Resource; |
| 31 | import javax.validation.Valid; | 31 | import javax.validation.Valid; |
| 32 | -import java.io.IOException; | ||
| 33 | import java.util.List; | 32 | import java.util.List; |
| 34 | 33 | ||
| 35 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 34 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| @@ -99,7 +98,7 @@ public class UserProfileController { | @@ -99,7 +98,7 @@ public class UserProfileController { | ||
| 99 | 98 | ||
| 100 | @PutMapping("/update-avatar") | 99 | @PutMapping("/update-avatar") |
| 101 | @ApiOperation("上传用户个人头像") | 100 | @ApiOperation("上传用户个人头像") |
| 102 | - public CommonResult<String> updateUserAvatar(@RequestParam("avatarFile") MultipartFile file) throws IOException { | 101 | + public CommonResult<String> updateUserAvatar(@RequestParam("avatarFile") MultipartFile file) throws Exception { |
| 103 | if (file.isEmpty()) { | 102 | if (file.isEmpty()) { |
| 104 | throw ServiceExceptionUtil.exception(FILE_IS_EMPTY); | 103 | throw ServiceExceptionUtil.exception(FILE_IS_EMPTY); |
| 105 | } | 104 | } |
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 { | @@ -64,7 +64,7 @@ public interface AdminUserService { | ||
| 64 | * @param id 用户 id | 64 | * @param id 用户 id |
| 65 | * @param avatarFile 头像文件 | 65 | * @param avatarFile 头像文件 |
| 66 | */ | 66 | */ |
| 67 | - String updateUserAvatar(Long id, InputStream avatarFile); | 67 | + String updateUserAvatar(Long id, InputStream avatarFile) throws Exception; |
| 68 | 68 | ||
| 69 | /** | 69 | /** |
| 70 | * 修改密码 | 70 | * 修改密码 |
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 { | @@ -118,7 +118,7 @@ public class AdminUserServiceImpl implements AdminUserService { | ||
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | @Override | 120 | @Override |
| 121 | - public String updateUserAvatar(Long id, InputStream avatarFile) { | 121 | + public String updateUserAvatar(Long id, InputStream avatarFile) throws Exception { |
| 122 | this.checkUserExists(id); | 122 | this.checkUserExists(id); |
| 123 | // 存储文件 | 123 | // 存储文件 |
| 124 | String avatar = fileApi.createFile(IoUtil.readBytes(avatarFile)); | 124 | String avatar = fileApi.createFile(IoUtil.readBytes(avatarFile)); |
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 { | @@ -196,7 +196,7 @@ public class UserServiceImplTest extends BaseDbUnitTest { | ||
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | @Test | 198 | @Test |
| 199 | - public void testUpdateUserAvatar_success() { | 199 | + public void testUpdateUserAvatar_success() throws Exception { |
| 200 | // mock 数据 | 200 | // mock 数据 |
| 201 | AdminUserDO dbUser = randomAdminUserDO(); | 201 | AdminUserDO dbUser = randomAdminUserDO(); |
| 202 | userMapper.insert(dbUser); | 202 | userMapper.insert(dbUser); |
yudao-ui-admin/src/views/infra/fileConfig/index.vue
| @@ -109,9 +109,6 @@ | @@ -109,9 +109,6 @@ | ||
| 109 | <el-form-item v-if="form.storage === 20" label="节点地址" prop="config.endpoint"> | 109 | <el-form-item v-if="form.storage === 20" label="节点地址" prop="config.endpoint"> |
| 110 | <el-input v-model="form.config.endpoint" placeholder="请输入节点地址" /> | 110 | <el-input v-model="form.config.endpoint" placeholder="请输入节点地址" /> |
| 111 | </el-form-item> | 111 | </el-form-item> |
| 112 | - <el-form-item v-if="form.storage === 20" label="区域" prop="config.region"> | ||
| 113 | - <el-input v-model="form.config.region" placeholder="请输入区域" /> | ||
| 114 | - </el-form-item> | ||
| 115 | <el-form-item v-if="form.storage === 20" label="存储 bucket" prop="config.bucket"> | 112 | <el-form-item v-if="form.storage === 20" label="存储 bucket" prop="config.bucket"> |
| 116 | <el-input v-model="form.config.bucket" placeholder="请输入 bucket" /> | 113 | <el-input v-model="form.config.bucket" placeholder="请输入 bucket" /> |
| 117 | </el-form-item> | 114 | </el-form-item> |
| @@ -190,7 +187,6 @@ export default { | @@ -190,7 +187,6 @@ export default { | ||
| 190 | password: [{ required: true, message: "密码不能为空", trigger: "blur" }], | 187 | password: [{ required: true, message: "密码不能为空", trigger: "blur" }], |
| 191 | mode: [{ required: true, message: "连接模式不能为空", trigger: "change" }], | 188 | mode: [{ required: true, message: "连接模式不能为空", trigger: "change" }], |
| 192 | endpoint: [{ required: true, message: "节点地址不能为空", trigger: "blur" }], | 189 | endpoint: [{ required: true, message: "节点地址不能为空", trigger: "blur" }], |
| 193 | - region: [{ required: true, message: "区域名不能为空", trigger: "blur" }], | ||
| 194 | bucket: [{ required: true, message: "存储 bucket 不能为空", trigger: "blur" }], | 190 | bucket: [{ required: true, message: "存储 bucket 不能为空", trigger: "blur" }], |
| 195 | accessKey: [{ required: true, message: "accessKey 不能为空", trigger: "blur" }], | 191 | accessKey: [{ required: true, message: "accessKey 不能为空", trigger: "blur" }], |
| 196 | accessSecret: [{ required: true, message: "accessSecret 不能为空", trigger: "blur" }], | 192 | accessSecret: [{ required: true, message: "accessSecret 不能为空", trigger: "blur" }], |