fix(接口测试): 场景导入order为空

--user=郭雨琦
--bug=1014731
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001014731
This commit is contained in:
guoyuqi 2022-07-14 11:25:46 +08:00 committed by xiaomeinvG
parent 1f1c1a7d0c
commit 6ccca9dc28
1 changed files with 24 additions and 0 deletions

View File

@ -1248,6 +1248,12 @@ public class ApiAutomationService {
} }
checkReferenceCase(scenarioWithBLOBs, apiTestCaseMapper, apiDefinitionMapper); checkReferenceCase(scenarioWithBLOBs, apiTestCaseMapper, apiDefinitionMapper);
if (scenarioWithBLOBs.getOrder() == null) {
scenarioWithBLOBs.setOrder(getImportNextOrder(scenarioWithBLOBs.getProjectId()));
}
if (scenarioWithBLOBs.getNum() == null) {
scenarioWithBLOBs.setNum(getNextNum(scenarioWithBLOBs.getProjectId()));
}
batchMapper.insert(scenarioWithBLOBs); batchMapper.insert(scenarioWithBLOBs);
apiScenarioReferenceIdService.saveApiAndScenarioRelation(scenarioWithBLOBs); apiScenarioReferenceIdService.saveApiAndScenarioRelation(scenarioWithBLOBs);
extApiScenarioMapper.clearLatestVersion(scenarioWithBLOBs.getRefId()); extApiScenarioMapper.clearLatestVersion(scenarioWithBLOBs.getRefId());
@ -1272,6 +1278,12 @@ public class ApiAutomationService {
scenarioWithBLOBs.setNum(sameRequest.get(0).getNum()); // 使用第一个num当作本次的num scenarioWithBLOBs.setNum(sameRequest.get(0).getNum()); // 使用第一个num当作本次的num
scenarioWithBLOBs.setOrder(sameRequest.get(0).getOrder()); scenarioWithBLOBs.setOrder(sameRequest.get(0).getOrder());
} }
if (scenarioWithBLOBs.getOrder() == null) {
scenarioWithBLOBs.setOrder(getImportNextOrder(scenarioWithBLOBs.getProjectId()));
}
if (scenarioWithBLOBs.getNum() == null) {
scenarioWithBLOBs.setNum(getNextNum(scenarioWithBLOBs.getProjectId()));
}
batchMapper.insert(scenarioWithBLOBs); batchMapper.insert(scenarioWithBLOBs);
} else { } else {
ApiScenarioWithBLOBs existScenario = scenarioOp.get(); ApiScenarioWithBLOBs existScenario = scenarioOp.get();
@ -1280,6 +1292,12 @@ public class ApiAutomationService {
scenarioWithBLOBs.setVersionId(apiTestImportRequest.getUpdateVersionId()); scenarioWithBLOBs.setVersionId(apiTestImportRequest.getUpdateVersionId());
scenarioWithBLOBs.setOrder(existScenario.getOrder()); scenarioWithBLOBs.setOrder(existScenario.getOrder());
scenarioWithBLOBs.setNum(existScenario.getNum()); scenarioWithBLOBs.setNum(existScenario.getNum());
if (scenarioWithBLOBs.getOrder() == null) {
scenarioWithBLOBs.setOrder(getImportNextOrder(scenarioWithBLOBs.getProjectId()));
}
if (scenarioWithBLOBs.getNum() == null) {
scenarioWithBLOBs.setNum(getNextNum(scenarioWithBLOBs.getProjectId()));
}
batchMapper.updateByPrimaryKeyWithBLOBs(scenarioWithBLOBs); batchMapper.updateByPrimaryKeyWithBLOBs(scenarioWithBLOBs);
} }
checkReferenceCase(scenarioWithBLOBs, apiTestCaseMapper, apiDefinitionMapper); checkReferenceCase(scenarioWithBLOBs, apiTestCaseMapper, apiDefinitionMapper);
@ -1354,6 +1372,12 @@ public class ApiAutomationService {
scenarioWithBLOBs.setVersionId(apiTestImportRequest.getDefaultVersion()); scenarioWithBLOBs.setVersionId(apiTestImportRequest.getDefaultVersion());
} }
checkReferenceCase(scenarioWithBLOBs, apiTestCaseMapper, apiDefinitionMapper); checkReferenceCase(scenarioWithBLOBs, apiTestCaseMapper, apiDefinitionMapper);
if (scenarioWithBLOBs.getOrder() == null) {
scenarioWithBLOBs.setOrder(getImportNextOrder(request.getProjectId()));
}
if (scenarioWithBLOBs.getNum() == null) {
scenarioWithBLOBs.setNum(getNextNum(scenarioWithBLOBs.getProjectId()));
}
batchMapper.insert(scenarioWithBLOBs); batchMapper.insert(scenarioWithBLOBs);
// 存储依赖关系 // 存储依赖关系
ApiAutomationRelationshipEdgeService relationshipEdgeService = CommonBeanFactory.getBean(ApiAutomationRelationshipEdgeService.class); ApiAutomationRelationshipEdgeService relationshipEdgeService = CommonBeanFactory.getBean(ApiAutomationRelationshipEdgeService.class);