Commit b100d41da16512e9328fffba330f4c953bf3cb8e
Merge remote-tracking branch 'origin/master' into feature/vue3
Showing
16 changed files
with
29 additions
and
21 deletions
yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/FileClient.java
| @@ -22,7 +22,7 @@ public interface FileClient { | @@ -22,7 +22,7 @@ public interface FileClient { | ||
| 22 | * @return 完整路径,即 HTTP 访问地址 | 22 | * @return 完整路径,即 HTTP 访问地址 |
| 23 | * @throws Exception 上传文件时,抛出 Exception 异常 | 23 | * @throws Exception 上传文件时,抛出 Exception 异常 |
| 24 | */ | 24 | */ |
| 25 | - String upload(byte[] content, String path) throws Exception; | 25 | + String upload(byte[] content, String path, String type) throws Exception; |
| 26 | 26 | ||
| 27 | /** | 27 | /** |
| 28 | * 删除文件 | 28 | * 删除文件 |
yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/db/DBFileClient.java
| @@ -21,7 +21,7 @@ public class DBFileClient extends AbstractFileClient<DBFileClientConfig> { | @@ -21,7 +21,7 @@ public class DBFileClient extends AbstractFileClient<DBFileClientConfig> { | ||
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | @Override | 23 | @Override |
| 24 | - public String upload(byte[] content, String path) { | 24 | + public String upload(byte[] content, String path, String type) { |
| 25 | getDao().insert(getId(), path, content); | 25 | getDao().insert(getId(), path, content); |
| 26 | // 拼接返回路径 | 26 | // 拼接返回路径 |
| 27 | return super.formatFileUrl(config.getDomain(), path); | 27 | return super.formatFileUrl(config.getDomain(), path); |
yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/ftp/FtpFileClient.java
| @@ -38,7 +38,7 @@ public class FtpFileClient extends AbstractFileClient<FtpFileClientConfig> { | @@ -38,7 +38,7 @@ public class FtpFileClient extends AbstractFileClient<FtpFileClientConfig> { | ||
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | @Override | 40 | @Override |
| 41 | - public String upload(byte[] content, String path) { | 41 | + public String upload(byte[] content, String path, String type) { |
| 42 | // 执行写入 | 42 | // 执行写入 |
| 43 | String filePath = getFilePath(path); | 43 | String filePath = getFilePath(path); |
| 44 | String fileName = FileUtil.getName(filePath); | 44 | String fileName = FileUtil.getName(filePath); |
yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/local/LocalFileClient.java
| @@ -25,7 +25,7 @@ public class LocalFileClient extends AbstractFileClient<LocalFileClientConfig> { | @@ -25,7 +25,7 @@ public class LocalFileClient extends AbstractFileClient<LocalFileClientConfig> { | ||
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | @Override | 27 | @Override |
| 28 | - public String upload(byte[] content, String path) { | 28 | + public String upload(byte[] content, String path, String type) { |
| 29 | // 执行写入 | 29 | // 执行写入 |
| 30 | String filePath = getFilePath(path); | 30 | String filePath = getFilePath(path); |
| 31 | FileUtil.writeBytes(content, filePath); | 31 | FileUtil.writeBytes(content, filePath); |
yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClient.java
| @@ -82,10 +82,11 @@ public class S3FileClient extends AbstractFileClient<S3FileClientConfig> { | @@ -82,10 +82,11 @@ public class S3FileClient extends AbstractFileClient<S3FileClientConfig> { | ||
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | @Override | 84 | @Override |
| 85 | - public String upload(byte[] content, String path) throws Exception { | 85 | + public String upload(byte[] content, String path, String type) throws Exception { |
| 86 | // 执行上传 | 86 | // 执行上传 |
| 87 | client.putObject(PutObjectArgs.builder() | 87 | client.putObject(PutObjectArgs.builder() |
| 88 | .bucket(config.getBucket()) // bucket 必须传递 | 88 | .bucket(config.getBucket()) // bucket 必须传递 |
| 89 | + .contentType(type) | ||
| 89 | .object(path) // 相对路径作为 key | 90 | .object(path) // 相对路径作为 key |
| 90 | .stream(new ByteArrayInputStream(content), content.length, -1) // 文件内容 | 91 | .stream(new ByteArrayInputStream(content), content.length, -1) // 文件内容 |
| 91 | .build()); | 92 | .build()); |
yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/sftp/SftpFileClient.java
| @@ -31,7 +31,7 @@ public class SftpFileClient extends AbstractFileClient<SftpFileClientConfig> { | @@ -31,7 +31,7 @@ public class SftpFileClient extends AbstractFileClient<SftpFileClientConfig> { | ||
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | @Override | 33 | @Override |
| 34 | - public String upload(byte[] content, String path) { | 34 | + public String upload(byte[] content, String path, String type) { |
| 35 | // 执行写入 | 35 | // 执行写入 |
| 36 | String filePath = getFilePath(path); | 36 | String filePath = getFilePath(path); |
| 37 | File file = FileUtils.createTempFile(content); | 37 | File file = FileUtils.createTempFile(content); |
yudao-framework/yudao-spring-boot-starter-file/src/test/java/cn/iocoder/yudao/framework/file/core/client/ftp/FtpFileClientTest.java
| @@ -25,7 +25,7 @@ public class FtpFileClientTest { | @@ -25,7 +25,7 @@ public class FtpFileClientTest { | ||
| 25 | // 上传文件 | 25 | // 上传文件 |
| 26 | String path = IdUtil.fastSimpleUUID() + ".jpg"; | 26 | String path = IdUtil.fastSimpleUUID() + ".jpg"; |
| 27 | byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); | 27 | byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); |
| 28 | - String fullPath = client.upload(content, path); | 28 | + String fullPath = client.upload(content, path, "image/jpeg"); |
| 29 | System.out.println("访问地址:" + fullPath); | 29 | System.out.println("访问地址:" + fullPath); |
| 30 | if (false) { | 30 | if (false) { |
| 31 | byte[] bytes = client.getContent(path); | 31 | byte[] bytes = client.getContent(path); |
yudao-framework/yudao-spring-boot-starter-file/src/test/java/cn/iocoder/yudao/framework/file/core/client/local/LocalFileClientTest.java
| @@ -19,7 +19,7 @@ public class LocalFileClientTest { | @@ -19,7 +19,7 @@ public class LocalFileClientTest { | ||
| 19 | // 上传文件 | 19 | // 上传文件 |
| 20 | String path = IdUtil.fastSimpleUUID() + ".jpg"; | 20 | String path = IdUtil.fastSimpleUUID() + ".jpg"; |
| 21 | byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); | 21 | byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); |
| 22 | - String fullPath = client.upload(content, path); | 22 | + String fullPath = client.upload(content, path, "image/jpeg"); |
| 23 | System.out.println("访问地址:" + fullPath); | 23 | System.out.println("访问地址:" + fullPath); |
| 24 | client.delete(path); | 24 | client.delete(path); |
| 25 | } | 25 | } |
yudao-framework/yudao-spring-boot-starter-file/src/test/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClientTest.java
| @@ -101,7 +101,7 @@ public class S3FileClientTest { | @@ -101,7 +101,7 @@ public class S3FileClientTest { | ||
| 101 | // 上传文件 | 101 | // 上传文件 |
| 102 | String path = IdUtil.fastSimpleUUID() + ".jpg"; | 102 | String path = IdUtil.fastSimpleUUID() + ".jpg"; |
| 103 | byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); | 103 | byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); |
| 104 | - String fullPath = client.upload(content, path); | 104 | + String fullPath = client.upload(content, path, "image/jpeg"); |
| 105 | System.out.println("访问地址:" + fullPath); | 105 | System.out.println("访问地址:" + fullPath); |
| 106 | // 读取文件 | 106 | // 读取文件 |
| 107 | if (true) { | 107 | if (true) { |
yudao-framework/yudao-spring-boot-starter-file/src/test/java/cn/iocoder/yudao/framework/file/core/client/sftp/SftpFileClientTest.java
| @@ -23,7 +23,7 @@ public class SftpFileClientTest { | @@ -23,7 +23,7 @@ public class SftpFileClientTest { | ||
| 23 | // 上传文件 | 23 | // 上传文件 |
| 24 | String path = IdUtil.fastSimpleUUID() + ".jpg"; | 24 | String path = IdUtil.fastSimpleUUID() + ".jpg"; |
| 25 | byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); | 25 | byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); |
| 26 | - String fullPath = client.upload(content, path); | 26 | + String fullPath = client.upload(content, path, "image/jpeg"); |
| 27 | System.out.println("访问地址:" + fullPath); | 27 | System.out.println("访问地址:" + fullPath); |
| 28 | if (false) { | 28 | if (false) { |
| 29 | byte[] bytes = client.getContent(path); | 29 | byte[] bytes = client.getContent(path); |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmTaskConvert.java
| @@ -77,6 +77,8 @@ public interface BpmTaskConvert { | @@ -77,6 +77,8 @@ public interface BpmTaskConvert { | ||
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | @Mapping(source = "suspended", target = "suspensionState", qualifiedByName = "convertSuspendedToSuspensionState") | 79 | @Mapping(source = "suspended", target = "suspensionState", qualifiedByName = "convertSuspendedToSuspensionState") |
| 80 | + @Mapping(target = "claimTime", expression = "java(bean.getClaimTime()==null?null: LocalDateTime.ofInstant(bean.getClaimTime().toInstant(),ZoneId.systemDefault()))") | ||
| 81 | + @Mapping(target = "createTime", expression = "java(bean.getCreateTime()==null?null:LocalDateTime.ofInstant(bean.getCreateTime().toInstant(),ZoneId.systemDefault()))") | ||
| 80 | BpmTaskTodoPageItemRespVO convert1(Task bean); | 82 | BpmTaskTodoPageItemRespVO convert1(Task bean); |
| 81 | 83 | ||
| 82 | @Named("convertSuspendedToSuspensionState") | 84 | @Named("convertSuspendedToSuspensionState") |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImpl.java
| @@ -230,7 +230,7 @@ public class FileConfigServiceImpl implements FileConfigService { | @@ -230,7 +230,7 @@ public class FileConfigServiceImpl implements FileConfigService { | ||
| 230 | this.validateFileConfigExists(id); | 230 | this.validateFileConfigExists(id); |
| 231 | // 上传文件 | 231 | // 上传文件 |
| 232 | byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); | 232 | byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); |
| 233 | - return fileClientFactory.getFileClient(id).upload(content, IdUtil.fastSimpleUUID() + ".jpg"); | 233 | + return fileClientFactory.getFileClient(id).upload(content, IdUtil.fastSimpleUUID() + ".jpg", "image/jpeg"); |
| 234 | } | 234 | } |
| 235 | 235 | ||
| 236 | @Override | 236 | @Override |
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileServiceImpl.java
| @@ -52,7 +52,7 @@ public class FileServiceImpl implements FileService { | @@ -52,7 +52,7 @@ public class FileServiceImpl implements FileService { | ||
| 52 | // 上传到文件存储器 | 52 | // 上传到文件存储器 |
| 53 | FileClient client = fileConfigService.getMasterFileClient(); | 53 | FileClient client = fileConfigService.getMasterFileClient(); |
| 54 | Assert.notNull(client, "客户端(master) 不能为空"); | 54 | Assert.notNull(client, "客户端(master) 不能为空"); |
| 55 | - String url = client.upload(content, path); | 55 | + String url = client.upload(content, path, type); |
| 56 | 56 | ||
| 57 | // 保存到数据库 | 57 | // 保存到数据库 |
| 58 | FileDO file = new FileDO(); | 58 | FileDO file = new FileDO(); |
yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImplTest.java
| @@ -240,7 +240,7 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest { | @@ -240,7 +240,7 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest { | ||
| 240 | // mock 获得 Client | 240 | // mock 获得 Client |
| 241 | FileClient fileClient = mock(FileClient.class); | 241 | FileClient fileClient = mock(FileClient.class); |
| 242 | when(fileClientFactory.getFileClient(eq(id))).thenReturn(fileClient); | 242 | when(fileClientFactory.getFileClient(eq(id))).thenReturn(fileClient); |
| 243 | - when(fileClient.upload(any(), any())).thenReturn("https://www.iocoder.cn"); | 243 | + when(fileClient.upload(any(), any(), any())).thenReturn("https://www.iocoder.cn"); |
| 244 | 244 | ||
| 245 | // 调用,并断言 | 245 | // 调用,并断言 |
| 246 | assertEquals("https://www.iocoder.cn", fileConfigService.testFileConfig(id)); | 246 | assertEquals("https://www.iocoder.cn", fileConfigService.testFileConfig(id)); |
yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileServiceTest.java
| @@ -79,7 +79,7 @@ public class FileServiceTest extends BaseDbUnitTest { | @@ -79,7 +79,7 @@ public class FileServiceTest extends BaseDbUnitTest { | ||
| 79 | FileClient client = mock(FileClient.class); | 79 | FileClient client = mock(FileClient.class); |
| 80 | when(fileConfigService.getMasterFileClient()).thenReturn(client); | 80 | when(fileConfigService.getMasterFileClient()).thenReturn(client); |
| 81 | String url = randomString(); | 81 | String url = randomString(); |
| 82 | - when(client.upload(same(content), same(path))).thenReturn(url); | 82 | + when(client.upload(same(content), same(path), same("image/jpeg"))).thenReturn(url); |
| 83 | when(client.getId()).thenReturn(10L); | 83 | when(client.getId()).thenReturn(10L); |
| 84 | String name = "单测文件名"; | 84 | String name = "单测文件名"; |
| 85 | // 调用 | 85 | // 调用 |
yudao-ui-admin/src/store/modules/permission.js
| 1 | -import { constantRoutes } from '@/router' | ||
| 2 | -import { getRouters } from '@/api/menu' | 1 | +import {constantRoutes} from '@/router' |
| 2 | +import {getRouters} from '@/api/menu' | ||
| 3 | import Layout from '@/layout/index' | 3 | import Layout from '@/layout/index' |
| 4 | import ParentView from '@/components/ParentView'; | 4 | import ParentView from '@/components/ParentView'; |
| 5 | -import { toCamelCase } from "@/utils"; | 5 | +import {toCamelCase} from "@/utils"; |
| 6 | 6 | ||
| 7 | const permission = { | 7 | const permission = { |
| 8 | state: { | 8 | state: { |
| @@ -28,7 +28,7 @@ const permission = { | @@ -28,7 +28,7 @@ const permission = { | ||
| 28 | }, | 28 | }, |
| 29 | actions: { | 29 | actions: { |
| 30 | // 生成路由 | 30 | // 生成路由 |
| 31 | - GenerateRoutes({ commit }) { | 31 | + GenerateRoutes({commit}) { |
| 32 | return new Promise(resolve => { | 32 | return new Promise(resolve => { |
| 33 | // 向后端请求路由数据(菜单) | 33 | // 向后端请求路由数据(菜单) |
| 34 | getRouters().then(res => { | 34 | getRouters().then(res => { |
| @@ -36,7 +36,7 @@ const permission = { | @@ -36,7 +36,7 @@ const permission = { | ||
| 36 | const rdata = JSON.parse(JSON.stringify(res.data)) // 用于最后添加到 Router 中的数据 | 36 | const rdata = JSON.parse(JSON.stringify(res.data)) // 用于最后添加到 Router 中的数据 |
| 37 | const sidebarRoutes = filterAsyncRouter(sdata) | 37 | const sidebarRoutes = filterAsyncRouter(sdata) |
| 38 | const rewriteRoutes = filterAsyncRouter(rdata, false, true) | 38 | const rewriteRoutes = filterAsyncRouter(rdata, false, true) |
| 39 | - rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true }) | 39 | + rewriteRoutes.push({path: '*', redirect: '/404', hidden: true}) |
| 40 | commit('SET_ROUTES', rewriteRoutes) | 40 | commit('SET_ROUTES', rewriteRoutes) |
| 41 | commit('SET_SIDEBAR_ROUTERS', constantRoutes.concat(sidebarRoutes)) | 41 | commit('SET_SIDEBAR_ROUTERS', constantRoutes.concat(sidebarRoutes)) |
| 42 | commit('SET_DEFAULT_ROUTES', sidebarRoutes) | 42 | commit('SET_DEFAULT_ROUTES', sidebarRoutes) |
| @@ -60,6 +60,11 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) { | @@ -60,6 +60,11 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) { | ||
| 60 | } | 60 | } |
| 61 | // 路由地址转首字母大写驼峰,作为路由名称,适配 keepAlive | 61 | // 路由地址转首字母大写驼峰,作为路由名称,适配 keepAlive |
| 62 | route.name = toCamelCase(route.path, true) | 62 | route.name = toCamelCase(route.path, true) |
| 63 | + // 处理三级及以上菜单路由缓存问题,将path名字赋值给name | ||
| 64 | + if (route.path.indexOf("/") !== -1) { | ||
| 65 | + var pathArr = route.path.split("/") | ||
| 66 | + route.name = toCamelCase(pathArr[pathArr.length - 1], true) | ||
| 67 | + } | ||
| 63 | route.hidden = !route.visible | 68 | route.hidden = !route.visible |
| 64 | // 处理 component 属性 | 69 | // 处理 component 属性 |
| 65 | if (route.children) { // 父节点 | 70 | if (route.children) { // 父节点 |
| @@ -86,10 +91,10 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) { | @@ -86,10 +91,10 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) { | ||
| 86 | } | 91 | } |
| 87 | 92 | ||
| 88 | function filterChildren(childrenMap, lastRouter = false) { | 93 | function filterChildren(childrenMap, lastRouter = false) { |
| 89 | - let children = [] | 94 | + var children = [] |
| 90 | childrenMap.forEach((el, index) => { | 95 | childrenMap.forEach((el, index) => { |
| 91 | if (el.children && el.children.length) { | 96 | if (el.children && el.children.length) { |
| 92 | - if (el.component === 'ParentView' && !lastRouter) { | 97 | + if (!el.component && !lastRouter) { |
| 93 | el.children.forEach(c => { | 98 | el.children.forEach(c => { |
| 94 | c.path = el.path + '/' + c.path | 99 | c.path = el.path + '/' + c.path |
| 95 | if (c.children && c.children.length) { | 100 | if (c.children && c.children.length) { |