fix(测试跟踪): 脑图删除模块报错

--bug=1013880 --user=陈建星 【测试跟踪】脑图 模块 删除后保存 报错 https://www.tapd.cn/55049933/s/1176300
This commit is contained in:
chenjianxing 2022-06-08 15:18:21 +08:00 committed by jianxing
parent cd2f04387a
commit 26b1046347
1 changed files with 16 additions and 6 deletions

View File

@ -247,13 +247,19 @@ public class TestCaseService {
} }
} }
public void addDemandHyperLinkBatch(List<String> testcaseIds) { public void addDemandHyperLinkBatch(List<String> testcaseIds, String projectId) {
if (CollectionUtils.isEmpty(testcaseIds)) { if (CollectionUtils.isEmpty(testcaseIds)) {
return; return;
} }
Project project;
if (StringUtils.isNotBlank(projectId)) {
project = projectService.getProjectById(projectId);
} else {
TestCaseWithBLOBs testCase = testCaseMapper.selectByPrimaryKey(testcaseIds.get(0)); TestCaseWithBLOBs testCase = testCaseMapper.selectByPrimaryKey(testcaseIds.get(0));
// 同步删除用例与需求的关联关系 // 同步删除用例与需求的关联关系
Project project = projectService.getProjectById(testCase.getProjectId()); project = projectService.getProjectById(testCase.getProjectId());
}
// AzureDevops 才处理 // AzureDevops 才处理
if (StringUtils.equals(project.getPlatform(), IssuesManagePlatform.AzureDevops.name())) { if (StringUtils.equals(project.getPlatform(), IssuesManagePlatform.AzureDevops.name())) {
@ -649,6 +655,10 @@ public class TestCaseService {
} }
public int deleteToGcBatch(List<String> ids) { public int deleteToGcBatch(List<String> ids) {
return deleteToGcBatch(ids, null);
}
public int deleteToGcBatch(List<String> ids, String projectId) {
if (CollectionUtils.isEmpty(ids)) { if (CollectionUtils.isEmpty(ids)) {
return 0; return 0;
} }
@ -656,7 +666,7 @@ public class TestCaseService {
testCase.setDeleteUserId(SessionUtils.getUserId()); testCase.setDeleteUserId(SessionUtils.getUserId());
testCase.setDeleteTime(System.currentTimeMillis()); testCase.setDeleteTime(System.currentTimeMillis());
addDemandHyperLinkBatch(ids); addDemandHyperLinkBatch(ids, projectId);
DeleteTestCaseRequest request = new DeleteTestCaseRequest(); DeleteTestCaseRequest request = new DeleteTestCaseRequest();
BeanUtils.copyBean(request, testCase); BeanUtils.copyBean(request, testCase);
@ -1995,7 +2005,7 @@ public class TestCaseService {
public void minderEdit(TestCaseMinderEditRequest request) { public void minderEdit(TestCaseMinderEditRequest request) {
deleteToGcBatch(request.getIds()); deleteToGcBatch(request.getIds(), request.getProjectId());
testCaseNodeService.minderEdit(request); testCaseNodeService.minderEdit(request);