Ver Fonte

功能提交: 对ip地址进行判断

杨六六 há 4 anos atrás
pai
commit
72c3284843

+ 12 - 10
modules/admin/src/main/java/com/fire/admin/service/impl/FlowAppInfoServiceImpl.java

@@ -121,15 +121,17 @@ public class FlowAppInfoServiceImpl extends ServiceImpl<FlowAppMapper, FlowAppIn
                 .channelId(flowAppInfoDto.getChannelId())
                 .secondCallback(flowAppInfoDto.getSecondCallback()).build();
         int count = baseMapper.updateById(appInfo);
-        List<IpWhiteList> list = Lists.newArrayList();
-        flowAppInfoDto.getIpWhiteListList().forEach(ip -> {
-            IpWhiteList whiteList = IpWhiteList.builder().ipId(jedisCluster.incr(GLOBAL_ID_INCR.key()))
-                    .des(ip.getDes())
-                    .ipAddr(ip.getIpAddr())
-                    .customerId(flowAppInfoDto.getCustomerId()).build();
-            list.add(whiteList);
-        });
-        ipWhiteListService.saveCustomerIpWhiteList(list, flowAppInfoDto.getCustomerId());
+        if(!flowAppInfoDto.getIpWhiteListList().isEmpty()){
+            List<IpWhiteList> list = Lists.newArrayList();
+            flowAppInfoDto.getIpWhiteListList().forEach(ip -> {
+                IpWhiteList whiteList = IpWhiteList.builder().ipId(jedisCluster.incr(GLOBAL_ID_INCR.key()))
+                        .des(ip.getDes())
+                        .ipAddr(ip.getIpAddr())
+                        .customerId(flowAppInfoDto.getCustomerId()).build();
+                list.add(whiteList);
+            });
+            ipWhiteListService.saveCustomerIpWhiteList(list, flowAppInfoDto.getCustomerId());
+        }
 
         if (count > 0) {
             log.info("客户接入信息修改,修改信息为:【{}】", appInfo.toString());
@@ -151,7 +153,7 @@ public class FlowAppInfoServiceImpl extends ServiceImpl<FlowAppMapper, FlowAppIn
         if(!list.isEmpty()){
             return list.stream().map(ipWhiteListDto -> ipWhiteListDto.getIpAddr().concat(";")).collect(Collectors.joining());
         }else {
-            throw new BaseException(Status.PARAM_LOSS.status(),Status.PARAM_LOSS.message());
+           return null;
         }
 
     }