fix(接口测试): 解决接口导入问题
--user=郭雨琦 --bug=1015712 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001015712 --bug=1015679 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001015679
This commit is contained in:
parent
0f067bfdd2
commit
627f75172b
|
@ -606,7 +606,7 @@ public class Swagger3Parser extends SwaggerAbstractParser {
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
//直接导出完整路径
|
//直接导出完整路径
|
||||||
if (apiDefinition.getModulePath() != null) {
|
if (StringUtils.isNotBlank(apiDefinition.getModulePath())) {
|
||||||
String[] split = new String[0];
|
String[] split = new String[0];
|
||||||
String modulePath = apiDefinition.getModulePath();
|
String modulePath = apiDefinition.getModulePath();
|
||||||
String substring = modulePath.substring(0, 1);
|
String substring = modulePath.substring(0, 1);
|
||||||
|
@ -620,6 +620,8 @@ public class Swagger3Parser extends SwaggerAbstractParser {
|
||||||
split = new String[]{modulePath};
|
split = new String[]{modulePath};
|
||||||
}
|
}
|
||||||
swaggerApiInfo.setTags(Arrays.asList(split));
|
swaggerApiInfo.setTags(Arrays.asList(split));
|
||||||
|
} else {
|
||||||
|
swaggerApiInfo.setTags(new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置请求体
|
// 设置请求体
|
||||||
|
@ -1018,6 +1020,9 @@ public class Swagger3Parser extends SwaggerAbstractParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getModulePath(List<String> tagTree, StringBuilder modulePath) {
|
private String getModulePath(List<String> tagTree, StringBuilder modulePath) {
|
||||||
|
if (CollectionUtils.isEmpty(tagTree)) {
|
||||||
|
return "/未规划接口";
|
||||||
|
}
|
||||||
for (String s : tagTree) {
|
for (String s : tagTree) {
|
||||||
if (s.contains("/")) {
|
if (s.contains("/")) {
|
||||||
String[] split = s.split("/");
|
String[] split = s.split("/");
|
||||||
|
|
|
@ -902,12 +902,15 @@ public class ApiScenarioModuleService extends NodeTreeService<ApiScenarioModuleD
|
||||||
int finalI = i;
|
int finalI = i;
|
||||||
//在选择的模块下建模块,查看选择的模块下有没有同名的模块
|
//在选择的模块下建模块,查看选择的模块下有没有同名的模块
|
||||||
List<ApiScenarioModule> moduleList = pidChildrenMap.get(parentModule.getId());
|
List<ApiScenarioModule> moduleList = pidChildrenMap.get(parentModule.getId());
|
||||||
List<ApiScenarioModule> collect1 = moduleList.stream().filter(t -> t.getName().equals(tagTree[finalI])).collect(Collectors.toList());
|
List<ApiScenarioModule> filterModuleList = null;
|
||||||
if (collect1.isEmpty()) {
|
if (!CollectionUtils.isEmpty(moduleList)) {
|
||||||
|
filterModuleList = moduleList.stream().filter(t -> t.getName().equals(tagTree[finalI])).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isEmpty(filterModuleList)) {
|
||||||
return createModule(tagTree, i, parentModule, moduleMap, pidChildrenMap, idPathMap);
|
return createModule(tagTree, i, parentModule, moduleMap, pidChildrenMap, idPathMap);
|
||||||
} else {
|
} else {
|
||||||
returnModule = collect1.get(0);
|
returnModule = filterModuleList.get(0);
|
||||||
parentModule = collect1.get(0);
|
parentModule = filterModuleList.get(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return returnModule;
|
return returnModule;
|
||||||
|
|
|
@ -655,7 +655,7 @@
|
||||||
inner join project on api_test_case.project_id = project.id
|
inner join project on api_test_case.project_id = project.id
|
||||||
inner JOIN api_definition a ON api_test_case.api_definition_id = a.id
|
inner JOIN api_definition a ON api_test_case.api_definition_id = a.id
|
||||||
<include refid="criCondition"/>
|
<include refid="criCondition"/>
|
||||||
and a.latest is not null
|
and a.latest = 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getRequest" resultType="io.metersphere.api.dto.definition.ApiTestCaseInfo">
|
<select id="getRequest" resultType="io.metersphere.api.dto.definition.ApiTestCaseInfo">
|
||||||
|
|
|
@ -238,6 +238,7 @@ export default {
|
||||||
this.$post("/api/automation/module/delete", nodeIds, () => {
|
this.$post("/api/automation/module/delete", nodeIds, () => {
|
||||||
this.list();
|
this.list();
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
this.removeModuleId(nodeIds);
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
this.list();
|
this.list();
|
||||||
});
|
});
|
||||||
|
@ -281,6 +282,11 @@ export default {
|
||||||
enableTrash() {
|
enableTrash() {
|
||||||
this.condition.trashEnable = true;
|
this.condition.trashEnable = true;
|
||||||
this.$emit('enableTrash', this.condition.trashEnable);
|
this.$emit('enableTrash', this.condition.trashEnable);
|
||||||
|
},
|
||||||
|
removeModuleId(nodeIds) {
|
||||||
|
if (localStorage.getItem('scenarioModule') && localStorage.getItem('scenarioModule') === nodeIds[0]) {
|
||||||
|
localStorage.setItem('scenarioModule', undefined);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -251,17 +251,18 @@ export default {
|
||||||
add(param) {
|
add(param) {
|
||||||
param.projectId = this.projectId;
|
param.projectId = this.projectId;
|
||||||
param.protocol = this.condition.protocol;
|
param.protocol = this.condition.protocol;
|
||||||
this.$post("/api/module/add", param, () => {
|
this.$post("/api/module/add", param, () => {
|
||||||
this.$success(this.$t('commons.save_success'));
|
this.$success(this.$t('commons.save_success'));
|
||||||
this.list();
|
this.list();
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
this.list();
|
this.list();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
remove(nodeIds) {
|
remove(nodeIds) {
|
||||||
this.$post("/api/module/delete", nodeIds, () => {
|
this.$post("/api/module/delete", nodeIds, () => {
|
||||||
this.list();
|
this.list();
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
this.removeModuleId(nodeIds);
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
this.list();
|
this.list();
|
||||||
});
|
});
|
||||||
|
@ -303,6 +304,27 @@ export default {
|
||||||
this.list();
|
this.list();
|
||||||
this.$emit('refreshTable');
|
this.$emit('refreshTable');
|
||||||
},
|
},
|
||||||
|
removeModuleId(nodeIds) {
|
||||||
|
if (localStorage.getItem('tcp') || localStorage.getItem('http') || localStorage.getItem('sql') || localStorage.getItem('dubbo')) {
|
||||||
|
if (this.condition.protocol === 'TCP') {
|
||||||
|
if (localStorage.getItem('tcp') === nodeIds[0]) {
|
||||||
|
localStorage.setItem('tcp', undefined);
|
||||||
|
}
|
||||||
|
} else if (this.condition.protocol === 'HTTP') {
|
||||||
|
if (localStorage.getItem('http') === nodeIds[0]) {
|
||||||
|
localStorage.setItem('http', undefined);
|
||||||
|
}
|
||||||
|
} else if (this.condition.protocol === 'SQL') {
|
||||||
|
if (localStorage.getItem('sql') === nodeIds[0]) {
|
||||||
|
localStorage.setItem('sql', undefined);
|
||||||
|
}
|
||||||
|
} else if (this.condition.protocol === 'DUBBO') {
|
||||||
|
if (localStorage.getItem('dubbo') === nodeIds[0]) {
|
||||||
|
localStorage.setItem('dubbo', undefined);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue