fix: 接口导入模块名太长导入失败

This commit is contained in:
chenjianxing 2021-04-27 21:02:41 +08:00 committed by jianxing
parent ea328759e6
commit aade1c020d
2 changed files with 6 additions and 0 deletions

View File

@ -51,6 +51,9 @@ public class ApiScenarioImportUtil {
public static void createModule(ApiScenarioModule module) { public static void createModule(ApiScenarioModule module) {
ApiScenarioModuleService apiModuleService = CommonBeanFactory.getBean(ApiScenarioModuleService.class); ApiScenarioModuleService apiModuleService = CommonBeanFactory.getBean(ApiScenarioModuleService.class);
if (module.getName().length() > 64) {
module.setName(module.getName().substring(0, 64));
}
List<ApiScenarioModule> apiModules = apiModuleService.selectSameModule(module); List<ApiScenarioModule> apiModules = apiModuleService.selectSameModule(module);
if (CollectionUtils.isEmpty(apiModules)) { if (CollectionUtils.isEmpty(apiModules)) {
apiModuleService.addNode(module); apiModuleService.addNode(module);

View File

@ -60,6 +60,9 @@ public class ApiDefinitionImportUtil {
public static void createModule(ApiModule module) { public static void createModule(ApiModule module) {
ApiModuleService apiModuleService = CommonBeanFactory.getBean(ApiModuleService.class); ApiModuleService apiModuleService = CommonBeanFactory.getBean(ApiModuleService.class);
module.setProtocol(RequestType.HTTP); module.setProtocol(RequestType.HTTP);
if (module.getName().length() > 64) {
module.setName(module.getName().substring(0, 64));
}
List<ApiModule> apiModules = apiModuleService.selectSameModule(module); List<ApiModule> apiModules = apiModuleService.selectSameModule(module);
if (CollectionUtils.isEmpty(apiModules)) { if (CollectionUtils.isEmpty(apiModules)) {
apiModuleService.addNode(module); apiModuleService.addNode(module);