From 3e506b27efac1eb45b48b36f521ba2fd45a293fd Mon Sep 17 00:00:00 2001 From: tanghc Date: Sun, 29 Sep 2019 11:23:53 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8Deureka?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sop/adminserver/api/service/RouteApi.java | 33 ++++++++----------- .../service/ConfigPushService.java | 1 + 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/RouteApi.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/RouteApi.java index d56a62b3..6ed6ce59 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/RouteApi.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/service/RouteApi.java @@ -127,24 +127,20 @@ public class RouteApi { private void updateRouteConfig(RouteUpdateParam routeUpdateParam) { - try { - String routeId = routeUpdateParam.getId(); - ConfigRouteBase configRouteBase = configRouteBaseMapper.getByColumn("route_id", routeId); - boolean doSave = configRouteBase == null; - if (doSave) { - configRouteBase = new ConfigRouteBase(); - configRouteBase.setRouteId(routeId); - } - configRouteBase.setStatus(routeUpdateParam.getStatus().byteValue()); - - int i = doSave ? configRouteBaseMapper.save(configRouteBase) - : configRouteBaseMapper.update(configRouteBase); - - if (i > 0) { - this.sendMsg(configRouteBase); - } - } catch (Exception e) { - log.error("发送msg失败", e); + String routeId = routeUpdateParam.getId(); + ConfigRouteBase configRouteBase = configRouteBaseMapper.getByColumn("route_id", routeId); + boolean doSave = configRouteBase == null; + if (doSave) { + configRouteBase = new ConfigRouteBase(); + configRouteBase.setRouteId(routeId); + } + configRouteBase.setStatus(routeUpdateParam.getStatus().byteValue()); + + int i = doSave ? configRouteBaseMapper.save(configRouteBase) + : configRouteBaseMapper.update(configRouteBase); + + if (i > 0) { + this.sendMsg(configRouteBase); } } @@ -178,7 +174,6 @@ public class RouteApi { Collectors.mapping(PermRolePermission::getRoleCode, Collectors.toList()))); - return permRolePermissionMapper.list(new Query().in("route_id", routeIdList)) .stream() .map(permRolePermission -> { diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/service/ConfigPushService.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/service/ConfigPushService.java index c6d76fac..efd8604c 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/service/ConfigPushService.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/service/ConfigPushService.java @@ -50,6 +50,7 @@ public class ConfigPushService { List serviceInstanceList = serverService.listService(serviceSearchParam); Collection hostList = serviceInstanceList .stream() + .filter(serviceInstanceVO -> StringUtils.isNotBlank(serviceInstanceVO.getInstanceId())) .map(ServiceInstanceVO::getIpPort) .collect(Collectors.toList()); this.pushByHost(hostList, gatewayPushDTO);