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