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 e37ccbe70f
commit bbd3138808
1 changed files with 16 additions and 6 deletions

View File

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