From 4adc3c3355a4ee27f549d39616deafb305399d39 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Tue, 19 Mar 2024 19:43:22 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=94=A8=E4=BE=8B=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E7=9B=B8=E5=85=B3=E6=9D=83=E9=99=90=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E8=AF=84=E5=AE=A1=E8=AF=84=E8=AE=BA=E8=AF=A6=E6=83=85=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E7=94=A8=E4=BE=8B=E7=AD=89=E7=BA=A7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1037142 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001037142 --bug=1036754 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001036754 --bug=1036044 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001036044 --- .../FunctionalCaseCommentController.java | 2 +- .../dto/ReviewFunctionalCaseDTO.java | 3 + .../ExtCaseReviewFunctionalCaseMapper.xml | 6 ++ .../CaseReviewFunctionalCaseService.java | 33 ++++++- .../business/ms-comment/comment-item.vue | 7 +- .../src/components/pure/ms-drawer/index.vue | 2 +- .../components/management/case/caseTable.vue | 2 +- .../tabContent/tabBug/tabDefect.vue | 3 + .../tabContent/tabCase/tabCaseTable.vue | 8 +- .../tabContent/tabComment/tabCommentIndex.vue | 34 ++++--- .../tabDemand/associatedDemandTable.vue | 45 ++++++++-- .../tabContent/tabDemand/demand.vue | 4 +- .../tabDependency/tabDependency.vue | 8 +- .../components/detail/caseTable.vue | 89 +++++++++++++++++-- .../caseReview/locale/zh-CN.ts | 2 +- 15 files changed, 207 insertions(+), 41 deletions(-) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseCommentController.java b/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseCommentController.java index c582459630..ee6c95edcc 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseCommentController.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseCommentController.java @@ -51,7 +51,7 @@ public class FunctionalCaseCommentController { @GetMapping("/get/list/{caseId}") @Operation(summary = "用例管理-功能用例-用例评论-获取用例评论") - @RequiresPermissions(PermissionConstants.FUNCTIONAL_CASE_READ_COMMENT) + @RequiresPermissions(PermissionConstants.FUNCTIONAL_CASE_READ) @CheckOwner(resourceId = "#caseId", resourceType = "functional_case") public List getCommentList(@PathVariable String caseId) { return functionalCaseCommentService.getCommentList(caseId); diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/ReviewFunctionalCaseDTO.java b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/ReviewFunctionalCaseDTO.java index 107f98c9cf..d0433e0320 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/ReviewFunctionalCaseDTO.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/ReviewFunctionalCaseDTO.java @@ -61,4 +61,7 @@ public class ReviewFunctionalCaseDTO implements Serializable { @Schema(description = "只看我的评审状态") private String myStatus; + @Schema(description = "自定义字段集合") + private List customFields; + } diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewFunctionalCaseMapper.xml b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewFunctionalCaseMapper.xml index a16ce0b74f..0fbb754067 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewFunctionalCaseMapper.xml +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewFunctionalCaseMapper.xml @@ -111,6 +111,12 @@ and functional_case.version_id in + + and functional_case.id in ( + select case_id from functional_case_custom_field where `value` in + + ) + and functional_case.id in ( select resource_id from custom_field_test_case where concat('custom_single-',field_id) = diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewFunctionalCaseService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewFunctionalCaseService.java index 7d0c965262..768dd23f76 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewFunctionalCaseService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewFunctionalCaseService.java @@ -26,12 +26,16 @@ import io.metersphere.sdk.exception.MSException; import io.metersphere.sdk.util.BeanUtils; import io.metersphere.sdk.util.LogUtils; import io.metersphere.sdk.util.Translator; +import io.metersphere.system.domain.CustomFieldOption; import io.metersphere.system.domain.UserRoleRelation; import io.metersphere.system.domain.UserRoleRelationExample; import io.metersphere.system.dto.sdk.BaseTreeNode; import io.metersphere.system.dto.sdk.OptionDTO; import io.metersphere.system.mapper.UserRoleRelationMapper; import io.metersphere.system.notice.constants.NoticeConstants; +import io.metersphere.system.service.BaseCustomFieldOptionService; +import io.metersphere.system.service.BaseCustomFieldService; +import io.metersphere.system.service.UserLoginService; import io.metersphere.system.uid.IDGenerator; import io.metersphere.system.utils.ServiceUtils; import jakarta.annotation.Resource; @@ -101,6 +105,14 @@ public class CaseReviewFunctionalCaseService { private PermissionCheckService permissionCheckService; @Resource private CaseReviewMapper caseReviewMapper; + @Resource + private FunctionalCaseCustomFieldService functionalCaseCustomFieldService; + @Resource + private BaseCustomFieldService baseCustomFieldService; + @Resource + private BaseCustomFieldOptionService baseCustomFieldOptionService; + @Resource + private UserLoginService userLoginService; private static final String CASE_MODULE_COUNT_ALL = "all"; @@ -150,12 +162,14 @@ public class CaseReviewFunctionalCaseService { caseStatusMap = new LinkedHashMap<>(); } + Map> collect = getCaseCustomFiledMap(caseIds); + list.forEach(item -> { item.setModuleName(moduleMap.get(item.getModuleId())); item.setVersionName(versionMap.get(item.getVersionId())); item.setReviewers(Collections.singletonList(userIdMap.get(item.getCaseId()))); item.setReviewNames(Collections.singletonList(userNameMap.get(item.getCaseId()))); - + item.setCustomFields(collect.get(item.getCaseId())); if (request.isViewStatusFlag()) { List histories = caseStatusMap.get(item.getCaseId()); if (CollectionUtils.isNotEmpty(histories)) { @@ -170,6 +184,23 @@ public class CaseReviewFunctionalCaseService { return list; } + public Map> getCaseCustomFiledMap(List ids) { + List customFields = functionalCaseCustomFieldService.getCustomFieldsByCaseIds(ids); + customFields.forEach(customField -> { + if (customField.getInternal()) { + customField.setFieldName(baseCustomFieldService.translateInternalField(customField.getFieldName())); + } + }); + List fieldIds = customFields.stream().map(FunctionalCaseCustomFieldDTO::getFieldId).toList(); + List fieldOptions = baseCustomFieldOptionService.getByFieldIds(fieldIds); + Map> customOptions = fieldOptions.stream().collect(Collectors.groupingBy(CustomFieldOption::getFieldId)); + customFields.forEach(customField -> { + customField.setOptions(customOptions.get(customField.getFieldId())); + }); + return customFields.stream().collect(Collectors.groupingBy(FunctionalCaseCustomFieldDTO::getCaseId)); + } + + private String getMyStatus(List histories, String viewStatusUserId) { List list = histories.stream().filter(history -> StringUtils.equalsIgnoreCase(history.getCreateUser(), viewStatusUserId)).toList(); if (CollectionUtils.isNotEmpty(list)) { diff --git a/frontend/src/components/business/ms-comment/comment-item.vue b/frontend/src/components/business/ms-comment/comment-item.vue index f9d20791bb..e134489c70 100644 --- a/frontend/src/components/business/ms-comment/comment-item.vue +++ b/frontend/src/components/business/ms-comment/comment-item.vue @@ -23,6 +23,7 @@ ({{ element.childComments?.length }})
{ - return props.element.createUser === userStore.id; + return ( + props.element.createUser === userStore.id && + hasAnyPermission(['PROJECT_BUG:READ+COMMENT', 'FUNCTIONAL_CASE:READ+COMMENT']) + ); }); const status = defineModel<'normal' | 'edit' | 'reply' | 'delete'>('status', { default: 'normal' }); diff --git a/frontend/src/components/pure/ms-drawer/index.vue b/frontend/src/components/pure/ms-drawer/index.vue index 7e0fd5fd4b..174fab9d3f 100644 --- a/frontend/src/components/pure/ms-drawer/index.vue +++ b/frontend/src/components/pure/ms-drawer/index.vue @@ -318,7 +318,7 @@ .ms-drawer-no-mask { left: auto; .arco-drawer { - box-shadow: -1px 0 4px 0 rgb(2 2 2 / 10%); + box-shadow: 0 4px 10px -1px rgb(100 100 102 / 15%); } } .ms-drawer-no-content-padding { diff --git a/frontend/src/views/api-test/management/components/management/case/caseTable.vue b/frontend/src/views/api-test/management/components/management/case/caseTable.vue index 652eca51e1..71f71a42f5 100644 --- a/frontend/src/views/api-test/management/components/management/case/caseTable.vue +++ b/frontend/src/views/api-test/management/components/management/case/caseTable.vue @@ -952,7 +952,7 @@ versionId: '', refId: '', }); - Message.success(t('common.updateSuccess')); + Message.success(t('case.detail.execute.success')); cancelBatchExecute(); loadCaseListAndResetSelector(); } catch (error) { diff --git a/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabBug/tabDefect.vue b/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabBug/tabDefect.vue index 83fd3de4a9..c04e70a143 100644 --- a/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabBug/tabDefect.vue +++ b/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabBug/tabDefect.vue @@ -519,6 +519,9 @@ // ); const total = ref(0); async function initBugList() { + if (!hasAnyPermission(['PROJECT_BUG:READ'])) { + return; + } const res = await getBugList({ current: 1, pageSize: 10, diff --git a/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabCase/tabCaseTable.vue b/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabCase/tabCaseTable.vue index 8ebe589a53..706a732748 100644 --- a/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabCase/tabCaseTable.vue +++ b/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabCase/tabCaseTable.vue @@ -32,10 +32,13 @@