fix(测试跟踪): 新版本创建用例勾选附件后未同步

--bug=1018789 --user=宋昌昌 【测试跟踪】功能用例-创建新版本时同步勾选附件和评论后未成 https://www.tapd.cn/55049933/s/1276455
This commit is contained in:
song-cc-rock 2022-10-25 15:28:06 +08:00 committed by jianxing
parent 7408cb4462
commit 85a51391f2
1 changed files with 8 additions and 12 deletions

View File

@ -314,7 +314,7 @@ public class TestCaseService {
BeanUtils.copyBean(request, testCase);
EditTestCaseRequest.OtherInfoConfig otherInfoConfig = EditTestCaseRequest.OtherInfoConfig.createDefault();
request.setOtherInfoConfig(otherInfoConfig);
DealWithOtherInfo(request, oldTestCaseId);
dealWithOtherInfoOfNewVersion(request, oldTestCaseId);
}
public void saveFollows(String caseId, List<String> follows) {
@ -452,7 +452,7 @@ public class TestCaseService {
testCase.setOrder(oldTestCase.getOrder());
testCase.setRefId(oldTestCase.getRefId());
testCase.setLatest(false);
DealWithOtherInfo(testCase, oldTestCase.getId());
dealWithOtherInfoOfNewVersion(testCase, oldTestCase.getId());
testCaseMapper.insertSelective(testCase);
}
checkAndSetLatestVersion(testCase.getRefId());
@ -464,7 +464,7 @@ public class TestCaseService {
* @param testCase
* @param oldTestCaseId
*/
private void DealWithOtherInfo(EditTestCaseRequest testCase, String oldTestCaseId) {
private void dealWithOtherInfoOfNewVersion(EditTestCaseRequest testCase, String oldTestCaseId) {
EditTestCaseRequest.OtherInfoConfig otherInfoConfig = testCase.getOtherInfoConfig();
if (otherInfoConfig != null) {
if (!otherInfoConfig.isRemark()) {
@ -496,15 +496,11 @@ public class TestCaseService {
}
}
if (otherInfoConfig.isArchive()) {
List<FileMetadata> files = attachmentService.getFileMetadataByCaseId(oldTestCaseId);
if (CollectionUtils.isNotEmpty(files)) {
files.forEach(file -> {
TestCaseFile testCaseFile = new TestCaseFile();
testCaseFile.setCaseId(testCase.getId());
testCaseFile.setFileId(file.getId());
testCaseFileMapper.insertSelective(testCaseFile);
});
}
AttachmentRequest attachmentRequest = new AttachmentRequest();
attachmentRequest.setBelongId(testCase.getId());
attachmentRequest.setCopyBelongId(oldTestCaseId);
attachmentRequest.setBelongType(AttachmentType.TEST_CASE.type());
attachmentService.copyAttachment(attachmentRequest);
}
if (otherInfoConfig.isDependency()) {
List<RelationshipEdge> preRelations = relationshipEdgeService.getRelationshipEdgeByType(oldTestCaseId, "PRE");