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
1 changed files with 21 additions and 14 deletions

View File

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