fix(测试跟踪): 修复功能用例回收站批量恢复的问题

--bug=1015435 --user=宋昌昌 [测试跟踪]github#16367回收站选择所有数据,批量恢复用例,每次只恢复10条 https://www.tapd.cn/55049933/s/1213602
This commit is contained in:
song-cc-rock 2022-07-27 15:38:35 +08:00 committed by jianxing
parent dea49feebd
commit 1dcb1cfe5c
2 changed files with 27 additions and 16 deletions

View File

@ -128,6 +128,7 @@ public class IssuesService {
attachmentService.copyAttachment(attachmentRequest);
} else {
// 新增, 需保存并同步所有待上传的附件
if (CollectionUtils.isNotEmpty(files)) {
final String issueId = issues.getId();
files.forEach(file -> {
AttachmentRequest attachmentRequest = new AttachmentRequest();
@ -136,6 +137,7 @@ public class IssuesService {
attachmentService.uploadAttachment(attachmentRequest, file);
});
}
}
return issues;
}

View File

@ -1968,6 +1968,7 @@ public class TestCaseService {
attachmentService.copyAttachment(attachmentRequest);
} else {
// 新增需上传用例所有待上传的附件
if (CollectionUtils.isNotEmpty(files)) {
files.forEach(file -> {
AttachmentRequest attachmentRequest = new AttachmentRequest();
attachmentRequest.setBelongId(testCaseWithBLOBs.getId());
@ -1975,6 +1976,7 @@ public class TestCaseService {
attachmentService.uploadAttachment(attachmentRequest, file);
});
}
}
return testCaseWithBLOBs;
}
@ -2267,13 +2269,20 @@ public class TestCaseService {
}
public void reduction(TestCaseBatchRequest request) {
if (CollectionUtils.isNotEmpty(request.getIds())) {
extTestCaseMapper.checkOriginalStatusByIds(request.getIds());
List<String> ids = new ArrayList<>();
if (request.getCondition().isSelectAll()) {
List<TestCaseDTO> allReductionTestCases = listTestCase(request.getCondition());
ids = allReductionTestCases.stream().map(TestCaseDTO::getId).collect(Collectors.toList());
} else {
ids = request.getIds();
}
if (CollectionUtils.isNotEmpty(ids)) {
extTestCaseMapper.checkOriginalStatusByIds(ids);
//检查原来模块是否还在
TestCaseExample example = new TestCaseExample();
// 关联版本之后必须查询每一个数据的所有版本依次还原
example.createCriteria().andIdIn(request.getIds());
example.createCriteria().andIdIn(ids);
List<TestCase> reductionCaseList = testCaseMapper.selectByExample(example);
List<String> refIds = reductionCaseList.stream().map(TestCase::getRefId).collect(Collectors.toList());
example.clear();