From fcba9aedabcbcf3d04e521dcb39551b2abb4dc4c Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Mon, 31 Oct 2022 17:12:19 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8A=A5=E5=91=8A=E7=BB=9F=E8=AE=A1):=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B=E8=B6=8B=E5=8A=BF=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E6=9F=A5=E7=9C=8B=E9=A1=B9=E7=9B=AE=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E4=BB=A5=E5=B7=A5=E4=BD=9C=E7=A9=BA=E9=97=B4=E4=B8=BA=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1018948 --user=宋天阳 【报表统计】用户A在测试用例趋势的项目列表中可以看见所有项目 https://www.tapd.cn/55049933/s/1283953 --- .../service/TestAnalysisService.java | 22 ++++++--------- report-stat/frontend/src/api/project.js | 4 --- .../components/chart/ReportChart.vue | 4 +-- .../casecount/TestCaseCountContainer.vue | 5 ++-- .../track/TestAnalysisContainer.vue | 4 +-- .../track/filter/TestAnalysisFilter.vue | 27 ++++++------------- 6 files changed, 22 insertions(+), 44 deletions(-) diff --git a/report-stat/backend/src/main/java/io/metersphere/reportstatistics/service/TestAnalysisService.java b/report-stat/backend/src/main/java/io/metersphere/reportstatistics/service/TestAnalysisService.java index ad2090260a..1618952cdd 100644 --- a/report-stat/backend/src/main/java/io/metersphere/reportstatistics/service/TestAnalysisService.java +++ b/report-stat/backend/src/main/java/io/metersphere/reportstatistics/service/TestAnalysisService.java @@ -2,14 +2,12 @@ package io.metersphere.reportstatistics.service; import io.metersphere.commons.utils.DateUtils; import io.metersphere.commons.utils.SessionUtils; -import io.metersphere.dto.ProjectDTO; import io.metersphere.reportstatistics.dto.*; import io.metersphere.reportstatistics.dto.charts.Legend; import io.metersphere.reportstatistics.dto.charts.Series; import io.metersphere.reportstatistics.dto.charts.XAxis; import io.metersphere.reportstatistics.dto.charts.YAxis; import io.metersphere.reportstatistics.service.remote.track.TestCaseRemoteService; -import io.metersphere.request.ProjectRequest; import io.metersphere.service.BaseProjectService; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -39,17 +37,10 @@ public class TestAnalysisService { request.setStartTime(DateUtils.getDataStr(request.getTimes().get(0))); request.setEndTime(DateUtils.getDataStr(request.getTimes().get(1))); if (CollectionUtils.isEmpty(request.getProjects())) { - // 获取当前组织空间下所有项目 - String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId(); - - ProjectRequest projectRequest = new ProjectRequest(); - projectRequest.setWorkspaceId(currentWorkspaceId); - List projectDTOS = projectService.getProjectList(projectRequest); - if (CollectionUtils.isNotEmpty(projectDTOS)) { - request.setProjects(projectDTOS.stream().map(ProjectDTO::getId).collect(Collectors.toList())); - } else { - request.setProjects(new LinkedList() {{ - this.add(UUID.randomUUID().toString()); + String projectId = SessionUtils.getCurrentProjectId(); + if (StringUtils.isNotBlank(projectId)) { + request.setProjects(new ArrayList<>() {{ + this.add(projectId); }}); } } @@ -117,7 +108,10 @@ public class TestAnalysisService { List upCollect = dtos.stream().map(item -> Integer.valueOf(item.getUpdateCount())).collect(Collectors.toList()); // reduce求和 Optional updateCount = upCollect.stream().reduce(Integer::sum); - dtos.add(new TestAnalysisTableDTO("Count", createCount.get().toString(), updateCount.get().toString(), new LinkedList<>())); + dtos.add(new TestAnalysisTableDTO("Count", + createCount.isEmpty() ? "0" : createCount.get().toString(), + updateCount.isEmpty() ? "0" : updateCount.get().toString(), + new LinkedList<>())); TestAnalysisResult testAnalysisResult = new TestAnalysisResult(); testAnalysisResult.setChartDTO(dto); diff --git a/report-stat/frontend/src/api/project.js b/report-stat/frontend/src/api/project.js index 3f34b71f98..19f0a78382 100644 --- a/report-stat/frontend/src/api/project.js +++ b/report-stat/frontend/src/api/project.js @@ -1,9 +1,5 @@ import {get} from "metersphere-frontend/src/plugins/request" -export function listAllProject(workspaceId) { - return get(`/project/listAll/${workspaceId}`) -} - export function getProject(id) { return get(`/project/get/${id}`) } diff --git a/report-stat/frontend/src/business/enterprisereport/components/chart/ReportChart.vue b/report-stat/frontend/src/business/enterprisereport/components/chart/ReportChart.vue index 40df2d8cc0..24df618694 100644 --- a/report-stat/frontend/src/business/enterprisereport/components/chart/ReportChart.vue +++ b/report-stat/frontend/src/business/enterprisereport/components/chart/ReportChart.vue @@ -30,8 +30,8 @@ + :style="{width: '100%', height: (h-70) + 'px'}" class="chart-config" :autoresize="true" + id="picChart"/> diff --git a/report-stat/frontend/src/business/projectstatistics/casecount/TestCaseCountContainer.vue b/report-stat/frontend/src/business/projectstatistics/casecount/TestCaseCountContainer.vue index ea490eddd4..664fd53490 100644 --- a/report-stat/frontend/src/business/projectstatistics/casecount/TestCaseCountContainer.vue +++ b/report-stat/frontend/src/business/projectstatistics/casecount/TestCaseCountContainer.vue @@ -1,13 +1,12 @@