From 9bdf6b013df7c5a19690b52117a053a2fa5bb06b Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Thu, 15 Aug 2024 18:25:28 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B):=20?= =?UTF-8?q?=E5=AF=BC=E5=87=BAExcel=E7=94=A8=E4=BE=8B=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E6=9C=89=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1045164 --user=宋昌昌 【测试用例】用例导出为excel-点击用例名称-用户无项目权限-可越权进入项目管理页面-操作项目下数据 https://www.tapd.cn/55049933/s/1563674 --- .../functional/service/FunctionalCaseFileService.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseFileService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseFileService.java index bed1842fa3..6bf3265832 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseFileService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseFileService.java @@ -589,6 +589,8 @@ public class FunctionalCaseFileService { Map> executeCommentMap = getExecuteComment(ids); //评审评论 Map> reviewCommentMap = getReviewComment(ids); + // 项目信息 + Project project = projectMapper.selectByPrimaryKey(request.getProjectId()); ids.forEach(id -> { List textDescriptionList = new ArrayList<>(); @@ -598,7 +600,7 @@ public class FunctionalCaseFileService { FunctionalCase functionalCase = functionalCaseMap.get(id); FunctionalCaseBlob functionalCaseBlob = functionalCaseBlobMap.get(id); //构建基本参数 - buildBaseField(data, functionalCase, functionalCaseBlob, moduleMap, textDescriptionList, expectedResultList, url); + buildBaseField(data, functionalCase, functionalCaseBlob, moduleMap, textDescriptionList, expectedResultList, url, project); //构建自定义字段 buildExportCustomField(customFields, customFieldMap.get(id), data, request); //构建其他字段 @@ -622,7 +624,8 @@ public class FunctionalCaseFileService { * @param functionalCase * @param functionalCaseBlob */ - private void buildBaseField(FunctionalCaseExcelData data, FunctionalCase functionalCase, FunctionalCaseBlob functionalCaseBlob, Map moduleMap, List textDescriptionList, List expectedResultList, String url) { + private void buildBaseField(FunctionalCaseExcelData data, FunctionalCase functionalCase, FunctionalCaseBlob functionalCaseBlob, Map moduleMap, + List textDescriptionList, List expectedResultList, String url, Project project) { data.setNum(functionalCase.getNum().toString()); data.setModule(moduleMap.get(functionalCase.getModuleId())); //构建步骤 @@ -644,8 +647,8 @@ public class FunctionalCaseFileService { WriteCellStyle writeCellStyle = new WriteCellStyle(); writeCellStyle.setWriteFont(writeFont); hyperlink.setWriteCellStyle(writeCellStyle); - - hyperlinkData.setAddress(url + "/functional/case/detail/" + functionalCase.getId()); + hyperlinkData.setAddress(url + "#/case-management/featureCase?id=" + functionalCase.getId() + + "&pId=" + functionalCase.getProjectId() + "&orgId=" + project.getOrganizationId()); hyperlinkData.setHyperlinkType(HyperlinkData.HyperlinkType.URL); }