From 5529873ccc11b9705cbb5fd0ddeab4d73892ca03 Mon Sep 17 00:00:00 2001 From: jsonwan Date: Wed, 28 Jul 2021 17:41:59 +0800 Subject: [PATCH] =?UTF-8?q?feature:=20=E7=99=BD=E5=90=8D=E5=8D=95IP?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=97=B6=E5=A2=9E=E5=8A=A0=E5=AF=B9=E2=80=9C?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E6=96=B9=E5=BC=8F=E2=80=9D=E7=9A=84=E5=88=A4?= =?UTF-8?q?=E6=96=AD=EF=BC=8C=E5=A6=82=E4=BB=85=E5=BC=80=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=88=86=E5=8F=91=E5=88=99=E5=9C=A8=E8=84=9A=E6=9C=AC=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E4=B8=AD=E4=B8=8D=E5=8F=AF=E9=80=89=E4=B8=AD=20#115?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/service/impl/WhiteIPServiceImpl.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/WhiteIPServiceImpl.java b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/WhiteIPServiceImpl.java index 0cd310a014..d3d028f5f1 100644 --- a/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/WhiteIPServiceImpl.java +++ b/src/backend/job-manage/service-job-manage/src/main/java/com/tencent/bk/job/manage/service/impl/WhiteIPServiceImpl.java @@ -198,10 +198,7 @@ public List listWhiteIP(Long appId, ActionScopeEnum actionScope) { ); } - @Override - public Long saveWhiteIP(String username, WhiteIPRecordCreateUpdateReq createUpdateReq) { - LOG.infoWithRequestId("Input(" + username + "," + createUpdateReq.toString() + ")"); - //1.参数校验、预处理 + private List checkReqAndGetIpList(WhiteIPRecordCreateUpdateReq createUpdateReq) { String appIdStr = createUpdateReq.getAppIdStr(); if (null == appIdStr || appIdStr.isEmpty()) { throw new InvalidParamException("appIdStr", "appIdStr cannot be null or empty"); @@ -235,6 +232,16 @@ public Long saveWhiteIP(String username, WhiteIPRecordCreateUpdateReq createUpda throw new InvalidParamException("ipStr", "not a valid ip format"); }); } + return ipList; + } + + @Override + public Long saveWhiteIP(String username, WhiteIPRecordCreateUpdateReq createUpdateReq) { + LOG.infoWithRequestId("Input(" + username + "," + createUpdateReq.toString() + ")"); + //1.参数校验、预处理 + List ipList = checkReqAndGetIpList(createUpdateReq); + List appIdList = Arrays.stream(createUpdateReq.getAppIdStr().split(",")) + .map(Long::parseLong).collect(Collectors.toList()); List actionScopeIdList = createUpdateReq.getActionScopeIdList(); val ipDtoList = ipList.stream().map(ip -> new WhiteIPIPDTO( null,