fix(测试计划): 关联用例pos排序问题
This commit is contained in:
parent
237a6d096f
commit
02deeaf7c4
|
@ -572,6 +572,7 @@ public class TestPlanApiCaseService extends TestPlanResourceService {
|
|||
* @param testPlanApiCaseList
|
||||
*/
|
||||
private void buildTestPlanApiCase(TestPlan testPlan, List<ApiTestCase> apiTestCases, String collectionId, SessionUser user, List<TestPlanApiCase> testPlanApiCaseList, List<LogDTO> logDTOS) {
|
||||
AtomicLong nextOrder = new AtomicLong(getNextOrder(collectionId));
|
||||
apiTestCases.forEach(apiTestCase -> {
|
||||
TestPlanApiCase testPlanApiCase = new TestPlanApiCase();
|
||||
testPlanApiCase.setId(IDGenerator.nextStr());
|
||||
|
@ -581,7 +582,7 @@ public class TestPlanApiCaseService extends TestPlanResourceService {
|
|||
testPlanApiCase.setEnvironmentId(apiTestCase.getEnvironmentId());
|
||||
testPlanApiCase.setCreateTime(System.currentTimeMillis());
|
||||
testPlanApiCase.setCreateUser(user.getId());
|
||||
testPlanApiCase.setPos(getNextOrder(collectionId));
|
||||
testPlanApiCase.setPos(nextOrder.getAndAdd(DEFAULT_NODE_INTERVAL_POS));
|
||||
testPlanApiCase.setExecuteUser(apiTestCase.getCreateUser());
|
||||
testPlanApiCaseList.add(testPlanApiCase);
|
||||
buildLog(logDTOS, testPlan, user, apiTestCase);
|
||||
|
@ -741,9 +742,8 @@ public class TestPlanApiCaseService extends TestPlanResourceService {
|
|||
ids.forEach(id -> {
|
||||
TestPlanApiCase testPlanApiCase = new TestPlanApiCase();
|
||||
testPlanApiCase.setId(id);
|
||||
testPlanApiCase.setPos(nextOrder.get());
|
||||
testPlanApiCase.setPos(nextOrder.getAndAdd(DEFAULT_NODE_INTERVAL_POS));
|
||||
testPlanApiCase.setTestPlanCollectionId(targetCollectionId);
|
||||
nextOrder.addAndGet(DEFAULT_NODE_INTERVAL_POS);
|
||||
testPlanApiCaseMapper.updateByPrimaryKeySelective(testPlanApiCase);
|
||||
});
|
||||
sqlSession.flushStatements();
|
||||
|
|
|
@ -210,6 +210,7 @@ public class TestPlanApiScenarioService extends TestPlanResourceService {
|
|||
* @param testPlanApiScenarioList
|
||||
*/
|
||||
private void buildTestPlanApiScenario(TestPlan testPlan, List<ApiScenario> scenarios, String collectionId, SessionUser user, List<TestPlanApiScenario> testPlanApiScenarioList, List<LogDTO> logDTOS) {
|
||||
AtomicLong nextOrder = new AtomicLong(getNextOrder(collectionId));
|
||||
scenarios.forEach(scenario -> {
|
||||
TestPlanApiScenario testPlanApiScenario = new TestPlanApiScenario();
|
||||
testPlanApiScenario.setId(IDGenerator.nextStr());
|
||||
|
@ -220,7 +221,7 @@ public class TestPlanApiScenarioService extends TestPlanResourceService {
|
|||
testPlanApiScenario.setEnvironmentId(scenario.getEnvironmentId());
|
||||
testPlanApiScenario.setCreateTime(System.currentTimeMillis());
|
||||
testPlanApiScenario.setCreateUser(user.getId());
|
||||
testPlanApiScenario.setPos(getNextOrder(collectionId));
|
||||
testPlanApiScenario.setPos(nextOrder.getAndAdd(DEFAULT_NODE_INTERVAL_POS));
|
||||
testPlanApiScenario.setExecuteUser(scenario.getCreateUser());
|
||||
testPlanApiScenarioList.add(testPlanApiScenario);
|
||||
buildLog(logDTOS, testPlan, user, scenario);
|
||||
|
|
|
@ -163,7 +163,7 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
|||
public long getNextOrder(String collectionId) {
|
||||
Long maxPos = extTestPlanFunctionalCaseMapper.getMaxPosByCollectionId(collectionId);
|
||||
if (maxPos == null) {
|
||||
return 0;
|
||||
return DEFAULT_NODE_INTERVAL_POS;
|
||||
} else {
|
||||
return maxPos + DEFAULT_NODE_INTERVAL_POS;
|
||||
}
|
||||
|
@ -762,6 +762,7 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
|||
FunctionalCaseExample example = new FunctionalCaseExample();
|
||||
example.createCriteria().andIdIn(functionalIds);
|
||||
List<FunctionalCase> functionalCases = functionalCaseMapper.selectByExample(example);
|
||||
AtomicLong nextOrder = new AtomicLong(getNextOrder(functional.getCollectionId()));
|
||||
Map<String, FunctionalCase> collect = functionalCases.stream().collect(Collectors.toMap(FunctionalCase::getId, functionalCase -> functionalCase));
|
||||
functionalIds.forEach(functionalId -> {
|
||||
FunctionalCase functionalCase = collect.get(functionalId);
|
||||
|
@ -772,7 +773,7 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
|||
testPlanFunctionalCase.setFunctionalCaseId(functionalId);
|
||||
testPlanFunctionalCase.setCreateUser(user.getId());
|
||||
testPlanFunctionalCase.setCreateTime(System.currentTimeMillis());
|
||||
testPlanFunctionalCase.setPos(getNextOrder(functional.getCollectionId()));
|
||||
testPlanFunctionalCase.setPos(nextOrder.getAndAdd(DEFAULT_NODE_INTERVAL_POS));
|
||||
testPlanFunctionalCase.setExecuteUser(functionalCase.getCreateUser());
|
||||
testPlanFunctionalCase.setLastExecResult(ExecStatus.PENDING.name());
|
||||
testPlanFunctionalCaseList.add(testPlanFunctionalCase);
|
||||
|
@ -830,9 +831,8 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
|||
ids.forEach(id -> {
|
||||
TestPlanFunctionalCase testPlanFunctionalCase = new TestPlanFunctionalCase();
|
||||
testPlanFunctionalCase.setId(id);
|
||||
testPlanFunctionalCase.setPos(nextOrder.get());
|
||||
testPlanFunctionalCase.setPos(nextOrder.getAndAdd(DEFAULT_NODE_INTERVAL_POS));
|
||||
testPlanFunctionalCase.setTestPlanCollectionId(targetCollectionId);
|
||||
nextOrder.addAndGet(DEFAULT_NODE_INTERVAL_POS);
|
||||
functionalBatchMapper.updateByPrimaryKeySelective(testPlanFunctionalCase);
|
||||
});
|
||||
sqlSession.flushStatements();
|
||||
|
|
Loading…
Reference in New Issue