feat(接口自动化): 修复部分缺陷
This commit is contained in:
parent
86b19b68fc
commit
a1eac0996f
|
@ -24,7 +24,7 @@ import org.apache.ibatis.session.SqlSession;
|
|||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
@ -214,22 +214,21 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
|||
request.setUpdateTime(System.currentTimeMillis());
|
||||
checkApiModuleExist(request);
|
||||
List<ApiDefinitionResult> apiDefinitionResults = queryByModuleIds(request.getNodeIds());
|
||||
|
||||
apiDefinitionResults.forEach(apiDefinition -> {
|
||||
if (StringUtils.isNotBlank(apiDefinition.getModulePath())) {
|
||||
StringBuilder path = new StringBuilder(apiDefinition.getModulePath());
|
||||
List<String> pathLists = Arrays.asList(path.toString().split("/"));
|
||||
pathLists.set(request.getLevel(), request.getName());
|
||||
path.delete(0, path.length());
|
||||
for (int i = 1; i < pathLists.size(); i++) {
|
||||
path = path.append("/").append(pathLists.get(i));
|
||||
if (CollectionUtils.isNotEmpty(apiDefinitionResults)) {
|
||||
apiDefinitionResults.forEach(apiDefinition -> {
|
||||
if (apiDefinition != null && StringUtils.isNotBlank(apiDefinition.getModulePath())) {
|
||||
StringBuilder path = new StringBuilder(apiDefinition.getModulePath());
|
||||
List<String> pathLists = Arrays.asList(path.toString().split("/"));
|
||||
pathLists.set(request.getLevel(), request.getName());
|
||||
path.delete(0, path.length());
|
||||
for (int i = 1; i < pathLists.size(); i++) {
|
||||
path = path.append("/").append(pathLists.get(i));
|
||||
}
|
||||
apiDefinition.setModulePath(path.toString());
|
||||
}
|
||||
apiDefinition.setModulePath(path.toString());
|
||||
}
|
||||
});
|
||||
|
||||
batchUpdateApiDefinition(apiDefinitionResults);
|
||||
|
||||
});
|
||||
batchUpdateApiDefinition(apiDefinitionResults);
|
||||
}
|
||||
return apiModuleMapper.updateByPrimaryKeySelective(request);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,68 +29,70 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import MsBasisApi from "./BasisApi";
|
||||
import MsBasisParameters from "../request/dubbo/BasisParameters";
|
||||
import MsBasisApi from "./BasisApi";
|
||||
import MsBasisParameters from "../request/dubbo/BasisParameters";
|
||||
|
||||
export default {
|
||||
name: "MsApiDubboRequestForm",
|
||||
components: {
|
||||
MsBasisApi, MsBasisParameters
|
||||
},
|
||||
props: {
|
||||
request: {},
|
||||
basisData: {},
|
||||
moduleOptions: Array,
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {validated: false}
|
||||
},
|
||||
methods: {
|
||||
callback() {
|
||||
this.validated = true;
|
||||
export default {
|
||||
name: "MsApiDubboRequestForm",
|
||||
components: {
|
||||
MsBasisApi, MsBasisParameters
|
||||
},
|
||||
validateApi() {
|
||||
this.validated = false;
|
||||
this.basisData.method = this.request.protocol;
|
||||
this.$refs['basicForm'].validate();
|
||||
props: {
|
||||
request: {},
|
||||
basisData: {},
|
||||
moduleOptions: Array,
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
saveApi() {
|
||||
this.validateApi();
|
||||
if (this.validated) {
|
||||
this.basisData.request = this.request;
|
||||
console.log(this.basisData)
|
||||
if (this.basisData.tags instanceof Array) {
|
||||
this.basisData.tags = JSON.stringify(this.basisData.tags);
|
||||
data() {
|
||||
return {validated: false}
|
||||
},
|
||||
methods: {
|
||||
callback() {
|
||||
this.validated = true;
|
||||
},
|
||||
validateApi() {
|
||||
this.validated = false;
|
||||
this.basisData.method = this.request.protocol;
|
||||
this.$refs['basicForm'].validate();
|
||||
},
|
||||
saveApi() {
|
||||
this.validateApi();
|
||||
if (this.validated) {
|
||||
this.basisData.request = this.request;
|
||||
if (this.basisData.tags instanceof Array) {
|
||||
this.basisData.tags = JSON.stringify(this.basisData.tags);
|
||||
}
|
||||
this.$emit('saveApi', this.basisData);
|
||||
}
|
||||
this.$emit('saveApi', this.basisData);
|
||||
}
|
||||
},
|
||||
runTest() {
|
||||
this.validateApi();
|
||||
if (this.validated) {
|
||||
this.basisData.request = this.request;
|
||||
if (this.basisData.tags instanceof Array) {
|
||||
this.basisData.tags = JSON.stringify(this.basisData.tags);
|
||||
}
|
||||
this.$emit('runTest', this.basisData);
|
||||
}
|
||||
},
|
||||
createRootModelInTree() {
|
||||
this.$emit("createRootModelInTree");
|
||||
},
|
||||
},
|
||||
runTest() {
|
||||
this.validateApi();
|
||||
if (this.validated) {
|
||||
this.basisData.request = this.request;
|
||||
this.$emit('runTest', this.basisData);
|
||||
}
|
||||
},
|
||||
createRootModelInTree() {
|
||||
this.$emit("createRootModelInTree");
|
||||
},
|
||||
},
|
||||
|
||||
computed: {}
|
||||
}
|
||||
computed: {}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.tip {
|
||||
padding: 3px 5px;
|
||||
font-size: 16px;
|
||||
border-radius: 4px;
|
||||
border-left: 4px solid #783887;
|
||||
margin: 0px 20px 0px;
|
||||
}
|
||||
.tip {
|
||||
padding: 3px 5px;
|
||||
font-size: 16px;
|
||||
border-radius: 4px;
|
||||
border-left: 4px solid #783887;
|
||||
margin: 0px 20px 0px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -71,6 +71,10 @@ export default {
|
|||
this.validateApi();
|
||||
if (this.validated) {
|
||||
this.basisData.request = this.request;
|
||||
this.basisData.method = this.basisData.protocol;
|
||||
if (this.basisData.tags instanceof Array) {
|
||||
this.basisData.tags = JSON.stringify(this.basisData.tags);
|
||||
}
|
||||
this.$emit('runTest', this.basisData);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<el-row>
|
||||
<el-col :span="21" style="padding-bottom: 20px">
|
||||
<div style="border:1px #DCDFE6 solid; height: 100%;border-radius: 4px ;width: 100% ;margin: 10px">
|
||||
<el-form class="tcp" :model="request" :rules="rules" ref="request" label-width="auto" :disabled="isReadOnly" style="margin: 20px">
|
||||
<el-form class="tcp" :model="request" :rules="rules" ref="request" :disabled="isReadOnly" style="margin: 20px">
|
||||
|
||||
<el-tabs v-model="activeName" class="request-tabs">
|
||||
|
||||
|
|
Loading…
Reference in New Issue