fix(测试跟踪): 公共用例复制报错
--bug=1027593 --user=王旭 【测试跟踪】新建功能用例-添加到公共用例库-切换项目-复制该用例-报错该模块下已存在该测试用例 https://www.tapd.cn/55049933/s/1392526
This commit is contained in:
parent
73211d44a5
commit
4ce718eb9e
|
@ -2179,11 +2179,13 @@ public class TestCaseService {
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
TestCaseWithBLOBs batchCopy = new TestCaseWithBLOBs();
|
TestCaseWithBLOBs batchCopy = new TestCaseWithBLOBs();
|
||||||
BeanUtils.copyBean(batchCopy, list.get(i));
|
BeanUtils.copyBean(batchCopy, list.get(i));
|
||||||
|
batchCopy.setNodeId(request.getNodeId());
|
||||||
|
batchCopy.setName("copy_" + batchCopy.getName());
|
||||||
|
batchCopy.setProjectId(SessionUtils.getCurrentProjectId());
|
||||||
checkTestCaseExist(batchCopy, false);
|
checkTestCaseExist(batchCopy, false);
|
||||||
String oldTestCaseId = batchCopy.getId();
|
String oldTestCaseId = batchCopy.getId();
|
||||||
String id = UUID.randomUUID().toString();
|
String id = UUID.randomUUID().toString();
|
||||||
batchCopy.setId(id);
|
batchCopy.setId(id);
|
||||||
batchCopy.setName("copy_" + batchCopy.getName());
|
|
||||||
if (batchCopy.getName().length() > 255) {
|
if (batchCopy.getName().length() > 255) {
|
||||||
batchCopy.setName(batchCopy.getName().substring(0, 250) + batchCopy.getName().substring(batchCopy.getName().length() - 5));
|
batchCopy.setName(batchCopy.getName().substring(0, 250) + batchCopy.getName().substring(batchCopy.getName().length() - 5));
|
||||||
}
|
}
|
||||||
|
@ -2194,14 +2196,12 @@ public class TestCaseService {
|
||||||
batchCopy.setReviewStatus(TestCaseReviewStatus.Prepare.name());
|
batchCopy.setReviewStatus(TestCaseReviewStatus.Prepare.name());
|
||||||
batchCopy.setStatus(TestCaseReviewStatus.Prepare.name());
|
batchCopy.setStatus(TestCaseReviewStatus.Prepare.name());
|
||||||
batchCopy.setNodePath(StringUtils.EMPTY);
|
batchCopy.setNodePath(StringUtils.EMPTY);
|
||||||
batchCopy.setNodeId(request.getNodeId());
|
|
||||||
batchCopy.setCasePublic(false);
|
batchCopy.setCasePublic(false);
|
||||||
batchCopy.setRefId(id);
|
batchCopy.setRefId(id);
|
||||||
if (!(batchCopy.getProjectId()).equals(SessionUtils.getCurrentProjectId())) {
|
if (!(batchCopy.getProjectId()).equals(SessionUtils.getCurrentProjectId())) {
|
||||||
String versionId = baseProjectVersionMapper.getDefaultVersion(SessionUtils.getCurrentProjectId());
|
String versionId = baseProjectVersionMapper.getDefaultVersion(SessionUtils.getCurrentProjectId());
|
||||||
batchCopy.setVersionId(versionId);
|
batchCopy.setVersionId(versionId);
|
||||||
}
|
}
|
||||||
batchCopy.setProjectId(SessionUtils.getCurrentProjectId());
|
|
||||||
batchCopy.setOrder(nextOrder += ServiceUtils.ORDER_STEP);
|
batchCopy.setOrder(nextOrder += ServiceUtils.ORDER_STEP);
|
||||||
batchCopy.setCustomNum(String.valueOf(nextNum));
|
batchCopy.setCustomNum(String.valueOf(nextNum));
|
||||||
batchCopy.setNum(nextNum++);
|
batchCopy.setNum(nextNum++);
|
||||||
|
|
Loading…
Reference in New Issue