From ab164d93f080f766b429ad5c9451bae9e0c1b787 Mon Sep 17 00:00:00 2001 From: zy <317328629@qq.com> Date: Mon, 21 Nov 2022 10:15:06 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix:=E6=B5=81=E7=A8=8B=E4=BB=A3=E5=8A=9E?= =?UTF-8?q?=EF=BC=8C=E6=97=A5=E6=9C=9F=E6=97=B6=E5=8C=BA=E8=BD=AC=E6=8D=A2?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/iocoder/yudao/module/bpm/convert/task/BpmTaskConvert.java | 1 + 1 file changed, 1 insertion(+) diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmTaskConvert.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmTaskConvert.java index a4ba5cc85..fb3064e22 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmTaskConvert.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmTaskConvert.java @@ -77,6 +77,7 @@ public interface BpmTaskConvert { } @Mapping(source = "suspended", target = "suspensionState", qualifiedByName = "convertSuspendedToSuspensionState") + @Mapping(target = "createTime", expression = "java(LocalDateTime.ofInstant(bean.getCreateTime().toInstant(),ZoneId.systemDefault()))") BpmTaskTodoPageItemRespVO convert1(Task bean); @Named("convertSuspendedToSuspensionState") From 65ba4b6ae097b4e12d2d168e0b54ca7185dc082e Mon Sep 17 00:00:00 2001 From: zy <317328629@qq.com> Date: Mon, 21 Nov 2022 13:34:22 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix:claimTime=20=E8=BD=AC=E6=8D=A2=E6=97=B6?= =?UTF-8?q?=E4=B9=9F=E5=8A=A0=E6=97=B6=E5=8C=BA=E8=AE=BE=E7=BD=AE=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E8=BF=9B=E8=A1=8C=E9=9D=9E=E7=A9=BA=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iocoder/yudao/module/bpm/convert/task/BpmTaskConvert.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmTaskConvert.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmTaskConvert.java index fb3064e22..578d11b03 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmTaskConvert.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmTaskConvert.java @@ -77,7 +77,8 @@ public interface BpmTaskConvert { } @Mapping(source = "suspended", target = "suspensionState", qualifiedByName = "convertSuspendedToSuspensionState") - @Mapping(target = "createTime", expression = "java(LocalDateTime.ofInstant(bean.getCreateTime().toInstant(),ZoneId.systemDefault()))") + @Mapping(target = "claimTime", expression = "java(bean.getClaimTime()==null?null: LocalDateTime.ofInstant(bean.getClaimTime().toInstant(),ZoneId.systemDefault()))") + @Mapping(target = "createTime", expression = "java(bean.getCreateTime()==null?null:LocalDateTime.ofInstant(bean.getCreateTime().toInstant(),ZoneId.systemDefault()))") BpmTaskTodoPageItemRespVO convert1(Task bean); @Named("convertSuspendedToSuspensionState") From 7f9fc41555cb83aa888dd560808807f7f5c156a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E6=BA=AA?= <2375768084@qq.com> Date: Sat, 26 Nov 2022 19:26:36 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E4=B8=83=E7=89=9B=E4=BA=91=E6=97=A0mime=20type=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iocoder/yudao/framework/file/core/client/FileClient.java | 2 +- .../yudao/framework/file/core/client/db/DBFileClient.java | 2 +- .../yudao/framework/file/core/client/ftp/FtpFileClient.java | 2 +- .../framework/file/core/client/local/LocalFileClient.java | 2 +- .../yudao/framework/file/core/client/s3/S3FileClient.java | 3 ++- .../yudao/framework/file/core/client/sftp/SftpFileClient.java | 2 +- .../framework/file/core/client/ftp/FtpFileClientTest.java | 2 +- .../framework/file/core/client/local/LocalFileClientTest.java | 2 +- .../yudao/framework/file/core/client/s3/S3FileClientTest.java | 2 +- .../framework/file/core/client/sftp/SftpFileClientTest.java | 2 +- .../yudao/module/infra/service/file/FileConfigServiceImpl.java | 2 +- .../yudao/module/infra/service/file/FileServiceImpl.java | 2 +- .../module/infra/service/file/FileConfigServiceImplTest.java | 2 +- .../yudao/module/infra/service/file/FileServiceTest.java | 2 +- 14 files changed, 15 insertions(+), 14 deletions(-) diff --git a/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/FileClient.java b/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/FileClient.java index 178c27d4c..fb576d508 100644 --- a/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/FileClient.java +++ b/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 { * @return 完整路径,即 HTTP 访问地址 * @throws Exception 上传文件时,抛出 Exception 异常 */ - String upload(byte[] content, String path) throws Exception; + String upload(byte[] content, String path, String type) throws Exception; /** * 删除文件 diff --git a/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/db/DBFileClient.java b/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/db/DBFileClient.java index a227cc314..1e2c082fe 100644 --- a/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/db/DBFileClient.java +++ b/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 { } @Override - public String upload(byte[] content, String path) { + public String upload(byte[] content, String path, String type) { getDao().insert(getId(), path, content); // 拼接返回路径 return super.formatFileUrl(config.getDomain(), path); diff --git a/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/ftp/FtpFileClient.java b/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/ftp/FtpFileClient.java index e9c837dfd..796044f3f 100644 --- a/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/ftp/FtpFileClient.java +++ b/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 { } @Override - public String upload(byte[] content, String path) { + public String upload(byte[] content, String path, String type) { // 执行写入 String filePath = getFilePath(path); String fileName = FileUtil.getName(filePath); diff --git a/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/local/LocalFileClient.java b/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/local/LocalFileClient.java index 1c79f8999..cac13f1fb 100644 --- a/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/local/LocalFileClient.java +++ b/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 { } @Override - public String upload(byte[] content, String path) { + public String upload(byte[] content, String path, String type) { // 执行写入 String filePath = getFilePath(path); FileUtil.writeBytes(content, filePath); diff --git a/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClient.java b/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClient.java index ab95d4bda..a2b11b1dc 100644 --- a/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClient.java +++ b/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 { } @Override - public String upload(byte[] content, String path) throws Exception { + public String upload(byte[] content, String path, String type) throws Exception { // 执行上传 client.putObject(PutObjectArgs.builder() .bucket(config.getBucket()) // bucket 必须传递 + .contentType(type) .object(path) // 相对路径作为 key .stream(new ByteArrayInputStream(content), content.length, -1) // 文件内容 .build()); diff --git a/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/sftp/SftpFileClient.java b/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/sftp/SftpFileClient.java index 3e18e888d..facddcea0 100644 --- a/yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/sftp/SftpFileClient.java +++ b/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 { } @Override - public String upload(byte[] content, String path) { + public String upload(byte[] content, String path, String type) { // 执行写入 String filePath = getFilePath(path); File file = FileUtils.createTempFile(content); diff --git a/yudao-framework/yudao-spring-boot-starter-file/src/test/java/cn/iocoder/yudao/framework/file/core/client/ftp/FtpFileClientTest.java b/yudao-framework/yudao-spring-boot-starter-file/src/test/java/cn/iocoder/yudao/framework/file/core/client/ftp/FtpFileClientTest.java index 00a3a268e..619e52db8 100644 --- a/yudao-framework/yudao-spring-boot-starter-file/src/test/java/cn/iocoder/yudao/framework/file/core/client/ftp/FtpFileClientTest.java +++ b/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 { // 上传文件 String path = IdUtil.fastSimpleUUID() + ".jpg"; byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); - String fullPath = client.upload(content, path); + String fullPath = client.upload(content, path, "image/jpeg"); System.out.println("访问地址:" + fullPath); if (false) { byte[] bytes = client.getContent(path); diff --git a/yudao-framework/yudao-spring-boot-starter-file/src/test/java/cn/iocoder/yudao/framework/file/core/client/local/LocalFileClientTest.java b/yudao-framework/yudao-spring-boot-starter-file/src/test/java/cn/iocoder/yudao/framework/file/core/client/local/LocalFileClientTest.java index 2062d63d7..d48609bc6 100644 --- a/yudao-framework/yudao-spring-boot-starter-file/src/test/java/cn/iocoder/yudao/framework/file/core/client/local/LocalFileClientTest.java +++ b/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 { // 上传文件 String path = IdUtil.fastSimpleUUID() + ".jpg"; byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); - String fullPath = client.upload(content, path); + String fullPath = client.upload(content, path, "image/jpeg"); System.out.println("访问地址:" + fullPath); client.delete(path); } 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 de77477cd..1d0ed2091 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 @@ -101,7 +101,7 @@ public class S3FileClientTest { // 上传文件 String path = IdUtil.fastSimpleUUID() + ".jpg"; byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); - String fullPath = client.upload(content, path); + String fullPath = client.upload(content, path, "image/jpeg"); System.out.println("访问地址:" + fullPath); // 读取文件 if (true) { diff --git a/yudao-framework/yudao-spring-boot-starter-file/src/test/java/cn/iocoder/yudao/framework/file/core/client/sftp/SftpFileClientTest.java b/yudao-framework/yudao-spring-boot-starter-file/src/test/java/cn/iocoder/yudao/framework/file/core/client/sftp/SftpFileClientTest.java index 412df1ea8..4785c0d89 100644 --- a/yudao-framework/yudao-spring-boot-starter-file/src/test/java/cn/iocoder/yudao/framework/file/core/client/sftp/SftpFileClientTest.java +++ b/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 { // 上传文件 String path = IdUtil.fastSimpleUUID() + ".jpg"; byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); - String fullPath = client.upload(content, path); + String fullPath = client.upload(content, path, "image/jpeg"); System.out.println("访问地址:" + fullPath); if (false) { byte[] bytes = client.getContent(path); diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImpl.java index 88a0ff59e..f68c09eb1 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImpl.java +++ b/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 { this.validateFileConfigExists(id); // 上传文件 byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); - return fileClientFactory.getFileClient(id).upload(content, IdUtil.fastSimpleUUID() + ".jpg"); + return fileClientFactory.getFileClient(id).upload(content, IdUtil.fastSimpleUUID() + ".jpg", "image/jpeg"); } @Override diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileServiceImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileServiceImpl.java index 493a9ed1f..2226e7bae 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileServiceImpl.java +++ b/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 { // 上传到文件存储器 FileClient client = fileConfigService.getMasterFileClient(); Assert.notNull(client, "客户端(master) 不能为空"); - String url = client.upload(content, path); + String url = client.upload(content, path, type); // 保存到数据库 FileDO file = new FileDO(); diff --git a/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImplTest.java b/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImplTest.java index 1b28b0e12..96581d744 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImplTest.java +++ b/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 { // mock 获得 Client FileClient fileClient = mock(FileClient.class); when(fileClientFactory.getFileClient(eq(id))).thenReturn(fileClient); - when(fileClient.upload(any(), any())).thenReturn("https://www.iocoder.cn"); + when(fileClient.upload(any(), any(), any())).thenReturn("https://www.iocoder.cn"); // 调用,并断言 assertEquals("https://www.iocoder.cn", fileConfigService.testFileConfig(id)); diff --git a/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileServiceTest.java b/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileServiceTest.java index 80fd90ece..03cf8314c 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileServiceTest.java +++ b/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 { FileClient client = mock(FileClient.class); when(fileConfigService.getMasterFileClient()).thenReturn(client); String url = randomString(); - when(client.upload(same(content), same(path))).thenReturn(url); + when(client.upload(same(content), same(path), same("image/jpeg"))).thenReturn(url); when(client.getId()).thenReturn(10L); String name = "单测文件名"; // 调用 From 53dbf8d82e9fb539c21fc9b6ad3bdd49ca822e42 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 29 Nov 2022 22:33:44 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=EF=BC=81290=20=E4=BF=AE=E5=A4=8D=E4=B8=89?= =?UTF-8?q?=E7=BA=A7=E5=8F=8A=E4=BB=A5=E4=B8=8A=E8=8F=9C=E5=8D=95=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E7=BC=93=E5=AD=98=E5=A4=B1=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/store/modules/permission.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/yudao-ui-admin/src/store/modules/permission.js b/yudao-ui-admin/src/store/modules/permission.js index 4b53f7d8d..3316e945f 100644 --- a/yudao-ui-admin/src/store/modules/permission.js +++ b/yudao-ui-admin/src/store/modules/permission.js @@ -1,8 +1,8 @@ -import { constantRoutes } from '@/router' -import { getRouters } from '@/api/menu' +import {constantRoutes} from '@/router' +import {getRouters} from '@/api/menu' import Layout from '@/layout/index' import ParentView from '@/components/ParentView'; -import { toCamelCase } from "@/utils"; +import {toCamelCase} from "@/utils"; const permission = { state: { @@ -28,7 +28,7 @@ const permission = { }, actions: { // 生成路由 - GenerateRoutes({ commit }) { + GenerateRoutes({commit}) { return new Promise(resolve => { // 向后端请求路由数据(菜单) getRouters().then(res => { @@ -36,7 +36,7 @@ const permission = { const rdata = JSON.parse(JSON.stringify(res.data)) // 用于最后添加到 Router 中的数据 const sidebarRoutes = filterAsyncRouter(sdata) const rewriteRoutes = filterAsyncRouter(rdata, false, true) - rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true }) + rewriteRoutes.push({path: '*', redirect: '/404', hidden: true}) commit('SET_ROUTES', rewriteRoutes) commit('SET_SIDEBAR_ROUTERS', constantRoutes.concat(sidebarRoutes)) commit('SET_DEFAULT_ROUTES', sidebarRoutes) @@ -60,6 +60,11 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) { } // 路由地址转首字母大写驼峰,作为路由名称,适配 keepAlive route.name = toCamelCase(route.path, true) + // 处理三级及以上菜单路由缓存问题,将path名字赋值给name + if (route.path.indexOf("/") !== -1) { + var pathArr = route.path.split("/") + route.name = toCamelCase(pathArr[pathArr.length - 1], true) + } route.hidden = !route.visible // 处理 component 属性 if (route.children) { // 父节点 @@ -86,10 +91,10 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) { } function filterChildren(childrenMap, lastRouter = false) { - let children = [] + var children = [] childrenMap.forEach((el, index) => { if (el.children && el.children.length) { - if (el.component === 'ParentView' && !lastRouter) { + if (!el.component && !lastRouter) { el.children.forEach(c => { c.path = el.path + '/' + c.path if (c.children && c.children.length) {