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 da9518dace
commit b03aff7979
1 changed files with 8 additions and 12 deletions

View File

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