fix(测试用例): 导出Excel用例跳转链接有误

--bug=1045164 --user=宋昌昌 【测试用例】用例导出为excel-点击用例名称-用户无项目权限-可越权进入项目管理页面-操作项目下数据 https://www.tapd.cn/55049933/s/1563674
This commit is contained in:
song-cc-rock 2024-08-15 18:25:28 +08:00 committed by 刘瑞斌
parent f26372a899
commit 9bdf6b013d
1 changed files with 7 additions and 4 deletions

View File

@ -589,6 +589,8 @@ public class FunctionalCaseFileService {
Map<String, List<TestPlanCaseExecuteHistory>> executeCommentMap = getExecuteComment(ids); Map<String, List<TestPlanCaseExecuteHistory>> executeCommentMap = getExecuteComment(ids);
//评审评论 //评审评论
Map<String, List<CaseReviewHistory>> reviewCommentMap = getReviewComment(ids); Map<String, List<CaseReviewHistory>> reviewCommentMap = getReviewComment(ids);
// 项目信息
Project project = projectMapper.selectByPrimaryKey(request.getProjectId());
ids.forEach(id -> { ids.forEach(id -> {
List<String> textDescriptionList = new ArrayList<>(); List<String> textDescriptionList = new ArrayList<>();
@ -598,7 +600,7 @@ public class FunctionalCaseFileService {
FunctionalCase functionalCase = functionalCaseMap.get(id); FunctionalCase functionalCase = functionalCaseMap.get(id);
FunctionalCaseBlob functionalCaseBlob = functionalCaseBlobMap.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); buildExportCustomField(customFields, customFieldMap.get(id), data, request);
//构建其他字段 //构建其他字段
@ -622,7 +624,8 @@ public class FunctionalCaseFileService {
* @param functionalCase * @param functionalCase
* @param functionalCaseBlob * @param functionalCaseBlob
*/ */
private void buildBaseField(FunctionalCaseExcelData data, FunctionalCase functionalCase, FunctionalCaseBlob functionalCaseBlob, Map<String, String> moduleMap, List<String> textDescriptionList, List<String> expectedResultList, String url) { private void buildBaseField(FunctionalCaseExcelData data, FunctionalCase functionalCase, FunctionalCaseBlob functionalCaseBlob, Map<String, String> moduleMap,
List<String> textDescriptionList, List<String> expectedResultList, String url, Project project) {
data.setNum(functionalCase.getNum().toString()); data.setNum(functionalCase.getNum().toString());
data.setModule(moduleMap.get(functionalCase.getModuleId())); data.setModule(moduleMap.get(functionalCase.getModuleId()));
//构建步骤 //构建步骤
@ -644,8 +647,8 @@ public class FunctionalCaseFileService {
WriteCellStyle writeCellStyle = new WriteCellStyle(); WriteCellStyle writeCellStyle = new WriteCellStyle();
writeCellStyle.setWriteFont(writeFont); writeCellStyle.setWriteFont(writeFont);
hyperlink.setWriteCellStyle(writeCellStyle); hyperlink.setWriteCellStyle(writeCellStyle);
hyperlinkData.setAddress(url + "#/case-management/featureCase?id=" + functionalCase.getId() +
hyperlinkData.setAddress(url + "/functional/case/detail/" + functionalCase.getId()); "&pId=" + functionalCase.getProjectId() + "&orgId=" + project.getOrganizationId());
hyperlinkData.setHyperlinkType(HyperlinkData.HyperlinkType.URL); hyperlinkData.setHyperlinkType(HyperlinkData.HyperlinkType.URL);
} }