diff --git a/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java b/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java index 8aa323c8..47deb781 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java @@ -10,6 +10,7 @@ import io.renren.common.utils.Result; import io.renren.common.validator.ValidatorUtils; import io.renren.common.validator.group.AddGroup; import io.renren.common.validator.group.DefaultGroup; +import io.renren.modules.processForm.service.ApiGatewayService; import io.renren.modules.resource.dataResource.AbstractDataResourceService; import io.renren.modules.resource.dataResource.DataResourceFactory; import io.renren.modules.resource.dto.GetDataResourceListDto; @@ -107,6 +108,9 @@ public class ResourceController { @Autowired private SysDeptService sysDeptService; + @Autowired + private ApiGatewayService apiGatewayService; + @Lazy @Autowired private JdbcTemplate jdbcTemplate; @@ -246,6 +250,16 @@ public class ResourceController { logger.info(dto.toString()); resourceService.insertWithAttrs(dto); + if (!"f".equals(source) && dto.getId() != null) {//后台挂架直接上架 + try { + apiGatewayService.registerApi2Gateway(dto.getId().toString()); + }catch (Exception exception){ + //注册失败忽略,简单记录一下 + logger.error("挂接网关注册失败", exception); + } + + } + return new Result().ok(dto.getId() == null ? "" : dto.getId()); }