fix(测试跟踪): 脑图编辑用户会清空关联的需求

--bug=1027802 --user=陈建星 【测试跟踪】github#25598,功能用例关联三方平台需求后,在脑图模式修改用例名称或内容并保存,会丢失需求关联关系 https://www.tapd.cn/55049933/s/1393239
This commit is contained in:
jianxing 2023-07-13 18:05:31 +08:00 committed by jianxing
parent 530c3b498e
commit fd16fab6ed

View File

@ -415,27 +415,30 @@ public class TestCaseService {
return testCaseDTO;
}
public TestCaseWithBLOBs editTestCase(EditTestCaseRequest testCase) {
public TestCaseWithBLOBs editTestCase(EditTestCaseRequest testCase, boolean handleDemand) {
checkTestCustomNum(testCase);
testCase.setUpdateTime(System.currentTimeMillis());
TestCaseWithBLOBs originCase = testCaseMapper.selectByPrimaryKey(testCase.getId());
try {
// 同步缺陷与需求的关联关系
updateThirdPartyIssuesLink(testCase);
if (handleDemand) {
try {
// 同步缺陷与需求的关联关系
updateThirdPartyIssuesLink(testCase);
// 同步用例与需求的关联关系
addDemandHyperLink(testCase, "edit");
// 同步用例与需求的关联关系
addDemandHyperLink(testCase, "edit");
handleDemandUpdate(testCase, DemandUpdateRequest.OperateType.EDIT,
projectMapper.selectByPrimaryKey(testCase.getProjectId()), originCase.getDemandId());
} catch (Exception e) {
LogUtil.error(e);
handleDemandUpdate(testCase, DemandUpdateRequest.OperateType.EDIT,
projectMapper.selectByPrimaryKey(testCase.getProjectId()), originCase.getDemandId());
} catch (Exception e) {
LogUtil.error(e);
}
if (StringUtils.isEmpty(testCase.getDemandId())) {
testCase.setDemandId(StringUtils.EMPTY);
}
}
if (StringUtils.isEmpty(testCase.getDemandId())) {
testCase.setDemandId(StringUtils.EMPTY);
}
createNewVersionOrNot(testCase);
if (StringUtils.isNotBlank(testCase.getCustomNum()) && StringUtils.isNotBlank(testCase.getId())) {
@ -465,6 +468,10 @@ public class TestCaseService {
return testCaseWithBLOBs;
}
public TestCaseWithBLOBs editTestCase(EditTestCaseRequest testCase) {
return editTestCase(testCase, true);
}
/**
* 如果启用重新提审并且前置条件或步骤发生变化则触发重新提审
*/
@ -2456,7 +2463,7 @@ public class TestCaseService {
BeanUtils.copyBean(editRequest, item);
editRequest.setCustomFields(null);
editRequest.setTags(null);
editTestCase(editRequest);
editTestCase(editRequest, false);
changeOrder(item, request.getProjectId());
lastAddId = null;
} else {