From d9fc47589cbd6ff886552f85b1bed1cd795f939c Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Mon, 20 Feb 2023 17:28:26 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E5=85=B3=E8=81=94=E9=99=84=E4=BB=B6=E5=85=B3=E8=81=94=E4=BA=BA?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=9C=89=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1022825 --user=宋昌昌 【测试跟踪】功能用例关联附件,附件信息显示错误,并且有错位 https://www.tapd.cn/55049933/s/1338666 --- .../main/java/io/metersphere/service/AttachmentService.java | 6 +++--- .../main/java/io/metersphere/service/TestCaseService.java | 2 +- .../case/components/case/CaseAttachmentComponent.vue | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test-track/backend/src/main/java/io/metersphere/service/AttachmentService.java b/test-track/backend/src/main/java/io/metersphere/service/AttachmentService.java index 1d5b93dbd2..6ec3b86bb9 100644 --- a/test-track/backend/src/main/java/io/metersphere/service/AttachmentService.java +++ b/test-track/backend/src/main/java/io/metersphere/service/AttachmentService.java @@ -246,11 +246,11 @@ public class AttachmentService { file.setIsRelatedDeleted(Boolean.FALSE); file.setName(fileMetadata.getName()); file.setSize(fileMetadata.getSize()); - List users = userMap.get(fileMetadata.getCreateUser()); + List users = userMap.get(file.getCreator()); if (CollectionUtils.isNotEmpty(users)) { file.setCreator(users.get(0).getName()); } else { - file.setCreator(fileMetadata.getCreateUser()); + file.setCreator(file.getCreator()); } file.setCreateTime(fileMetadata.getCreateTime()); } else { @@ -294,7 +294,7 @@ public class AttachmentService { FileAttachmentMetadata fileAttachmentMetadata = new FileAttachmentMetadata(); BeanUtils.copyBean(fileAttachmentMetadata, fileMetadata); fileAttachmentMetadata.setId(record.getAttachmentId()); - fileAttachmentMetadata.setCreator(fileMetadata.getCreateUser() == null ? StringUtils.EMPTY : fileMetadata.getCreateUser()); + fileAttachmentMetadata.setCreator(SessionUtils.getUserId()); fileAttachmentMetadata.setFilePath(fileMetadata.getPath() == null ? StringUtils.EMPTY : fileMetadata.getPath()); fileAttachmentMetadataBatchMapper.insert(fileAttachmentMetadata); // 缺陷类型的附件, 关联时需单独同步第三方平台 diff --git a/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java b/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java index 5d6ddacafd..70ecc396c8 100644 --- a/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java +++ b/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java @@ -2213,7 +2213,7 @@ public class TestCaseService { FileAttachmentMetadata fileAttachmentMetadata = new FileAttachmentMetadata(); BeanUtils.copyBean(fileAttachmentMetadata, fileMetadata); fileAttachmentMetadata.setId(record.getAttachmentId()); - fileAttachmentMetadata.setCreator(fileMetadata.getCreateUser() == null ? StringUtils.EMPTY : fileMetadata.getCreateUser()); + fileAttachmentMetadata.setCreator(SessionUtils.getUserId()); fileAttachmentMetadata.setFilePath(fileMetadata.getPath() == null ? StringUtils.EMPTY : fileMetadata.getPath()); fileAttachmentMetadataBatchMapper.insert(fileAttachmentMetadata); }); diff --git a/test-track/frontend/src/business/case/components/case/CaseAttachmentComponent.vue b/test-track/frontend/src/business/case/components/case/CaseAttachmentComponent.vue index 69734baf45..d05ffe94cc 100644 --- a/test-track/frontend/src/business/case/components/case/CaseAttachmentComponent.vue +++ b/test-track/frontend/src/business/case/components/case/CaseAttachmentComponent.vue @@ -449,7 +449,7 @@ export default { updateTime: row.createTime, progress: 100, status: "toRelate", - creator: row.createUser, + creator: getCurrentUser().id, type: row.type, isLocal: false, });