parent
2aadf5a4fb
commit
ab31ec2fe9
|
@ -116,9 +116,7 @@ public class ApiScenarioImportUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ApiDefinition getApiDefinitionResult(JSONObject object, ApiDefinitionService apiDefinitionService,Map<String,ApiDefinition>definitionMap) {
|
private static ApiDefinition getApiDefinitionResult(JSONObject object, ApiDefinitionService apiDefinitionService,Map<String,ApiDefinition>definitionMap,Set<String> userRelatedProjectIds) {
|
||||||
CheckPermissionService checkPermissionService = CommonBeanFactory.getBean(CheckPermissionService.class);
|
|
||||||
Set<String> userRelatedProjectIds = checkPermissionService.getUserRelatedProjectIds();
|
|
||||||
List<String> projectIds = new ArrayList<>(userRelatedProjectIds);
|
List<String> projectIds = new ArrayList<>(userRelatedProjectIds);
|
||||||
ApiDefinitionExample apiDefinitionExample = new ApiDefinitionExample();
|
ApiDefinitionExample apiDefinitionExample = new ApiDefinitionExample();
|
||||||
apiDefinitionExample.createCriteria()
|
apiDefinitionExample.createCriteria()
|
||||||
|
@ -147,8 +145,10 @@ public class ApiScenarioImportUtil {
|
||||||
ApiTestCaseService testCaseService = CommonBeanFactory.getBean(ApiTestCaseService.class);
|
ApiTestCaseService testCaseService = CommonBeanFactory.getBean(ApiTestCaseService.class);
|
||||||
ApiDefinitionService apiDefinitionService = CommonBeanFactory.getBean(ApiDefinitionService.class);
|
ApiDefinitionService apiDefinitionService = CommonBeanFactory.getBean(ApiDefinitionService.class);
|
||||||
ApiTestCaseWithBLOBs bloBs = testCaseService.get(object.getString("id"));
|
ApiTestCaseWithBLOBs bloBs = testCaseService.get(object.getString("id"));
|
||||||
if (bloBs == null) {
|
CheckPermissionService checkPermissionService = CommonBeanFactory.getBean(CheckPermissionService.class);
|
||||||
ApiDefinition apiDefinition = getApiDefinitionResult(object,apiDefinitionService,definitionMap);
|
Set<String> userRelatedProjectIds = checkPermissionService.getUserRelatedProjectIds();
|
||||||
|
if (bloBs == null||!userRelatedProjectIds.contains(bloBs.getProjectId())) {
|
||||||
|
ApiDefinition apiDefinition = getApiDefinitionResult(object,apiDefinitionService,definitionMap,userRelatedProjectIds);
|
||||||
if(apiDefinition!=null){
|
if(apiDefinition!=null){
|
||||||
if(MapUtils.isNotEmpty(definitionMap)||definitionMap.size()==0){
|
if(MapUtils.isNotEmpty(definitionMap)||definitionMap.size()==0){
|
||||||
structureCaseByJson(i,object,testCaseService, apiDefinition,apiTestCaseMapper);
|
structureCaseByJson(i,object,testCaseService, apiDefinition,apiTestCaseMapper);
|
||||||
|
|
|
@ -1299,6 +1299,9 @@ public class ApiAutomationService {
|
||||||
if (StringUtils.isBlank(item.getId())) {
|
if (StringUtils.isBlank(item.getId())) {
|
||||||
item.setId(UUID.randomUUID().toString());
|
item.setId(UUID.randomUUID().toString());
|
||||||
}
|
}
|
||||||
|
item.setCreateUser(SessionUtils.getUserId());
|
||||||
|
item.setUserId(SessionUtils.getUserId());
|
||||||
|
item.setPrincipal(SessionUtils.getUserId());
|
||||||
// 导入之后刷新latest
|
// 导入之后刷新latest
|
||||||
importCreate(item, batchMapper, extApiScenarioMapper, request,apiTestCaseMapper,apiDefinitionMapper);
|
importCreate(item, batchMapper, extApiScenarioMapper, request,apiTestCaseMapper,apiDefinitionMapper);
|
||||||
if (i % 300 == 0) {
|
if (i % 300 == 0) {
|
||||||
|
|
Loading…
Reference in New Issue