From 586c90e5be3fdf6dfd416c3623c49aaca0864a6d Mon Sep 17 00:00:00 2001 From: wangxin Date: Tue, 30 Oct 2018 11:29:37 +0800 Subject: [PATCH] =?UTF-8?q?(1)=E4=BF=AE=E5=A4=8D=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E6=97=B6json=E6=9C=AA=E6=90=BA=E5=B8=A6tableName,userRegion?= =?UTF-8?q?=E7=9A=84bug=20(2)packet=20ip=20=E9=99=90=E9=80=9F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=AF=BC=E5=85=A5=E6=A8=A1=E6=9D=BF=20(3)packet=20ip?= =?UTF-8?q?=20=E9=99=90=E9=80=9F=E5=AF=BC=E5=85=A5=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20(4)IP=E7=99=BD=E5=90=8D=E5=8D=95=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../template/IpRateLimitTemplate.java | 12 ++--- .../nis/web/controller/BaseController.java | 51 +++++++++++++------ .../service/configuration/IpCfgService.java | 2 +- .../resources/sql/20181030/update_region.sql | 2 + .../WEB-INF/views/cfg/whitelist/ipList.jsp | 21 +++++++- 5 files changed, 64 insertions(+), 24 deletions(-) create mode 100644 src/main/resources/sql/20181030/update_region.sql diff --git a/src/main/java/com/nis/domain/configuration/template/IpRateLimitTemplate.java b/src/main/java/com/nis/domain/configuration/template/IpRateLimitTemplate.java index 67dfb1ea0..eef1ca2c9 100644 --- a/src/main/java/com/nis/domain/configuration/template/IpRateLimitTemplate.java +++ b/src/main/java/com/nis/domain/configuration/template/IpRateLimitTemplate.java @@ -7,13 +7,13 @@ import com.nis.util.excel.ExcelField; * */ public class IpRateLimitTemplate extends IpAllTemplate { - - private String userRegion1; + public static String userRegion1="0"; + private String userRegion2; @ExcelField(title="ratelimit",dictType="RATE_LIMIT",align=2,sort=2) - public String getUserRegion1() { - return userRegion1; + public String getUserRegion2() { + return userRegion2; } - public void setUserRegion1(String userRegion1) { - this.userRegion1 = userRegion1; + public void setUserRegion2(String userRegion2) { + this.userRegion2 = userRegion2; } } diff --git a/src/main/java/com/nis/web/controller/BaseController.java b/src/main/java/com/nis/web/controller/BaseController.java index 30654cadf..e2d9cf115 100644 --- a/src/main/java/com/nis/web/controller/BaseController.java +++ b/src/main/java/com/nis/web/controller/BaseController.java @@ -1311,25 +1311,44 @@ public class BaseController { // 特殊字段验证 // packet ip ratelimit if (serviceDict!=null&&serviceDict.getFunctionId().intValue() == 5 && serviceDict.getAction().intValue() == 64) { - String userRegion1 = baseIpCfg.getUserRegion1(); - try { - // Double ratelimt= Double.parseDouble(userRegion1); - List ratelimtList = DictUtils.getDictList("RATE_LIMIT"); - boolean has = false; - for (SysDataDictionaryItem ratelimit : ratelimtList) { - if (ratelimit.getItemCode().equals(userRegion1)) { - has = true; - break; + String userRegion1 = IpRateLimitTemplate.userRegion1; + baseIpCfg.setUserRegion1(userRegion1); + if("0".equals(userRegion1)) { + String userRegion2 = baseIpCfg.getUserRegion2(); + try { + // Double ratelimt= Double.parseDouble(userRegion2); + List ratelimtList = DictUtils.getDictList("RATE_LIMIT"); + boolean has = false; + for (SysDataDictionaryItem ratelimit : ratelimtList) { + if (ratelimit.getItemCode().equals(userRegion2)) { + has = true; + break; + } } + if (!has) { + errInfo.append(prop.getProperty("ratelimit") + "." + + String.format(prop.getProperty("must_between"), 0.001, 0.009) + ";"); + } + } catch (Exception e) { + // TODO: handle exception + errInfo.append(String.format(prop.getProperty("not_number"), prop.getProperty("ratelimit")) + ";"); } - if (!has) { - errInfo.append(prop.getProperty("ratelimit") + "." - + String.format(prop.getProperty("must_between"), 0.001, 0.009) + ";"); + }else if("1".equals(userRegion1)) { + String userRegion3 = baseIpCfg.getUserRegion3(); + if (StringUtils.isNotBlank(userRegion3)) { + try { + Integer ratelimt=Integer.parseInt(userRegion3); + } catch (Exception e) { + // TODO: handle exception + errInfo.append(String.format(prop.getProperty("not_number"), prop.getProperty("bandwith")) + ";"); + } + }else { + errInfo.append( + String.format(prop.getProperty("can_not_null"), prop.getProperty("bandwith")) + ";"); } - } catch (Exception e) { - // TODO: handle exception - errInfo.append(String.format(prop.getProperty("not_number"), prop.getProperty("ratelimit")) + ";"); + } + } // payload ip if (regionDict.getFunctionId().equals(212)) { @@ -3150,7 +3169,7 @@ public class BaseController { _cfg.setTableName(AsnIpCfg.getTablename()); _cfg.setAction(0); _cfg.setCfgRegionCode(regionDict.getConfigRegionCode()); - _cfg.setCfgRegionCode(regionDict.getConfigRegionCode()); +// _cfg.setCfgRegionCode(regionDict.getConfigRegionCode()); _cfg.setCfgType(regionDict.getConfigRegionValue()); _cfg.setCreateTime(date); _cfg.setCreatorId(UserUtils.getUser().getId()); diff --git a/src/main/java/com/nis/web/service/configuration/IpCfgService.java b/src/main/java/com/nis/web/service/configuration/IpCfgService.java index ab1ddb9c4..b8e830893 100644 --- a/src/main/java/com/nis/web/service/configuration/IpCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/IpCfgService.java @@ -556,7 +556,7 @@ public class IpCfgService extends CrudService { } } for(IpPortCfg cfg:entity.getIpPortList()) { - BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"}); + BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId","cfgType","userRegion1","userRegion2","userRegion3","userRegion4","userRegion5"}); cfg.setTableName(IpPortCfg.getTablename()); ipCfgDao.auditCfg(cfg); /*BeanUtils.copyProperties(entity, cfg, new String[]{"userRegion1","userRegion2","userRegion3","userRegion4","userRegion5","ipType","direction", diff --git a/src/main/resources/sql/20181030/update_region.sql b/src/main/resources/sql/20181030/update_region.sql new file mode 100644 index 000000000..c363a69bf --- /dev/null +++ b/src/main/resources/sql/20181030/update_region.sql @@ -0,0 +1,2 @@ +update function_region_dict set is_import=1 where function_id=3 and dict_id=7; +UPDATE function_service_dict SET is_import=1 WHERE function_id=3 AND dict_id=15; \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/whitelist/ipList.jsp b/src/main/webapp/WEB-INF/views/cfg/whitelist/ipList.jsp index e238d34e5..cfde277b0 100644 --- a/src/main/webapp/WEB-INF/views/cfg/whitelist/ipList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/whitelist/ipList.jsp @@ -91,6 +91,23 @@ onClick="javascript:window.location='${ctx}/ntc/whitelist/ip/form?functionId=${cfg.functionId}'"> + + + + + + + + + + + + + + + @@ -462,6 +479,8 @@ - + + +<%@include file="/WEB-INF/include/excel/importModal.jsp" %> \ No newline at end of file