fix(测试跟踪): 修复复制测试计划,有时会出现用例条数自动增加的缺陷

--bug=1020493 --user=王孝刚 【测试计划】GitHub#20356复制测试计划,有时会出现用例条数自动增加的情况
https://www.tapd.cn/55049933/s/1346372
This commit is contained in:
wxg0103 2023-03-07 18:22:02 +08:00 committed by fit2-zhao
parent 8713e2f572
commit 70c0c47889
1 changed files with 16 additions and 14 deletions

View File

@ -1156,20 +1156,22 @@ public class TestPlanService {
if (!CollectionUtils.isEmpty(testPlanTestCases)) {
Long nextTestCaseOrder = ServiceUtils.getNextOrder(targetPlanId, extTestPlanTestCaseMapper::getLastOrder);
for (TestPlanTestCase testCase : testPlanTestCases) {
TestPlanTestCaseWithBLOBs testPlanTestCase = new TestPlanTestCaseWithBLOBs();
testPlanTestCase.setId(UUID.randomUUID().toString());
testPlanTestCase.setPlanId(targetPlanId);
testPlanTestCase.setCaseId(testCase.getCaseId());
testPlanTestCase.setStatus("Prepare");
testPlanTestCase.setExecutor(testCase.getExecutor());
testPlanTestCase.setCreateTime(System.currentTimeMillis());
testPlanTestCase.setUpdateTime(System.currentTimeMillis());
testPlanTestCase.setCreateUser(SessionUtils.getUserId());
testPlanTestCase.setRemark(testCase.getRemark());
testPlanTestCase.setOrder(nextTestCaseOrder);
testPlanTestCase.setIsDel(false);
nextTestCaseOrder += 5000;
testCaseMapper.insert(testPlanTestCase);
if (BooleanUtils.isNotTrue(testCase.getIsDel())) {
TestPlanTestCaseWithBLOBs testPlanTestCase = new TestPlanTestCaseWithBLOBs();
testPlanTestCase.setId(UUID.randomUUID().toString());
testPlanTestCase.setPlanId(targetPlanId);
testPlanTestCase.setCaseId(testCase.getCaseId());
testPlanTestCase.setStatus("Prepare");
testPlanTestCase.setExecutor(testCase.getExecutor());
testPlanTestCase.setCreateTime(System.currentTimeMillis());
testPlanTestCase.setUpdateTime(System.currentTimeMillis());
testPlanTestCase.setCreateUser(SessionUtils.getUserId());
testPlanTestCase.setRemark(testCase.getRemark());
testPlanTestCase.setOrder(nextTestCaseOrder);
testPlanTestCase.setIsDel(false);
nextTestCaseOrder += 5000;
testCaseMapper.insert(testPlanTestCase);
}
}
}
sqlSession.flushStatements();