From 777e78c1678cf8f87e9dfbc1c1304a81a7636554 Mon Sep 17 00:00:00 2001 From: wangxin Date: Fri, 19 Oct 2018 12:46:15 +0800 Subject: [PATCH 1/4] =?UTF-8?q?(1)=E4=BF=AE=E5=A4=8D=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=9F=9F=E5=AF=BC=E5=85=A5=E6=97=B6=E8=8E=B7=E5=8F=96=E5=AD=97?= =?UTF-8?q?=E5=85=B8=E5=80=BC=E5=A4=B1=E8=B4=A5=E5=8E=9F=E5=80=BC=E8=A2=AB?= =?UTF-8?q?=E6=9B=BF=E6=8D=A2=E4=B8=BA=E7=A9=BA=EF=BC=8C=E5=BD=B1=E5=93=8D?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E7=9A=84bug=20(2)packet=20ip=20ratelimit=20?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E9=AA=8C=E8=AF=81=20(3)packet=20ip=20?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E6=9D=A1=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/nis/util/excel/ImportExcel.java | 6 +++++- .../nis/web/controller/BaseController.java | 19 +++++++++++++++++-- .../WEB-INF/views/cfg/ipaddr/ipList.jsp | 5 ++--- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/nis/util/excel/ImportExcel.java b/src/main/java/com/nis/util/excel/ImportExcel.java index 05a939490..5256a4dbf 100644 --- a/src/main/java/com/nis/util/excel/ImportExcel.java +++ b/src/main/java/com/nis/util/excel/ImportExcel.java @@ -359,7 +359,11 @@ public class ImportExcel { ExcelField ef = (ExcelField)os[0]; // If is dict type, get dict value if (StringUtils.isNotBlank(ef.dictType())){ - val = DictUtils.getDictCode(ef.dictType(), val.toString(), ""); + Object val1 = DictUtils.getDictCode(ef.dictType(), val.toString(), ""); + //没有获取到字典值的话会影响验证判断 + if(val1!=null&&StringUtils.isNotBlank(val1.toString())) { + val=val1; + } //log.debug("Dictionary type value: ["+i+","+colunm+"] " + val); } // Get param type and type cast diff --git a/src/main/java/com/nis/web/controller/BaseController.java b/src/main/java/com/nis/web/controller/BaseController.java index 7d93f7b33..daa8bb747 100644 --- a/src/main/java/com/nis/web/controller/BaseController.java +++ b/src/main/java/com/nis/web/controller/BaseController.java @@ -825,6 +825,21 @@ public class BaseController { StringBuffer errInfo = new StringBuffer(); IpPortCfg baseIpCfg = new IpPortCfg(); BeanUtils.copyProperties(list.get(i), baseIpCfg); + //特殊字段验证 + //packet ip ratelimit + if(serviceDict.getFunctionId().intValue()==5&&serviceDict.getAction().intValue()==64) { + String userRegion1=baseIpCfg.getUserRegion1(); + try { + Double ratelimt= Double.parseDouble(userRegion1); + if(ratelimt>0.009||ratelimt<0.001) { + 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 (regionDict.getRegionType().equals(1)) { // 校验必填的IP,端口 for (String code : configIpPortShow.split(",")) { @@ -1205,7 +1220,7 @@ public class BaseController { } } if (!has) { - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("direction")) + "," + errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("direction")) + "." + String.format(prop.getProperty("alternative_values"), directionPattern) + ";"); } return has; @@ -1233,7 +1248,7 @@ public class BaseController { } } if (!has) { - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("protocol")) + "," + errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("protocol")) + "." + String.format(prop.getProperty("alternative_values"), protocolPattern) + ";"); } return has; diff --git a/src/main/webapp/WEB-INF/views/cfg/ipaddr/ipList.jsp b/src/main/webapp/WEB-INF/views/cfg/ipaddr/ipList.jsp index d17c98064..49dab435d 100644 --- a/src/main/webapp/WEB-INF/views/cfg/ipaddr/ipList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/ipaddr/ipList.jsp @@ -85,8 +85,6 @@
- - <%@include file="/WEB-INF/include/excel/importModal.jsp" %>
- + + <%@include file="/WEB-INF/include/excel/importModal.jsp" %> \ No newline at end of file From 674dc1ea06abcda1f083ddf5eb19356ab1a993b8 Mon Sep 17 00:00:00 2001 From: zhanghongqing Date: Fri, 19 Oct 2018 14:34:34 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=9F=9F=E5=90=8D=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=95=BF=E5=BA=A6=E9=99=90=E5=88=B61024=EF=BC=8C=E8=87=AA?= =?UTF-8?q?=E5=AE=9A=E4=B9=89district=E9=99=90=E5=88=B6=E9=95=BF=E5=BA=A66?= =?UTF-8?q?4=EF=BC=8Cwebsite=5Fdomain=5Ftopic=E8=A1=A8=E5=9F=9F=E5=90=8D?= =?UTF-8?q?=E9=95=BF=E5=BA=A6=E4=BF=AE=E6=94=B9=E4=B8=BA1024=20sql?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/sql/20181019/alert_table_website_domain_topic.sql | 2 ++ src/main/webapp/WEB-INF/include/form/complexInfo.jsp | 2 +- src/main/webapp/WEB-INF/views/cfg/app/appHeaderCfgForm.jsp | 2 +- src/main/webapp/WEB-INF/views/cfg/app/appHttpCfgForm.jsp | 2 +- src/main/webapp/WEB-INF/views/cfg/app/appSslCfgForm.jsp | 2 +- src/main/webapp/WEB-INF/views/cfg/complexCfgForm.jsp | 2 +- src/main/webapp/static/global/scripts/common.js | 1 + 7 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 src/main/resources/sql/20181019/alert_table_website_domain_topic.sql diff --git a/src/main/resources/sql/20181019/alert_table_website_domain_topic.sql b/src/main/resources/sql/20181019/alert_table_website_domain_topic.sql new file mode 100644 index 000000000..0387b18d8 --- /dev/null +++ b/src/main/resources/sql/20181019/alert_table_website_domain_topic.sql @@ -0,0 +1,2 @@ +#域名修改长度为1024 +ALTER TABLE website_domain_topic MODIFY domain VARCHAR(1024); \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/include/form/complexInfo.jsp b/src/main/webapp/WEB-INF/include/form/complexInfo.jsp index f0a4958dc..cd186bfc7 100644 --- a/src/main/webapp/WEB-INF/include/form/complexInfo.jsp +++ b/src/main/webapp/WEB-INF/include/form/complexInfo.jsp @@ -24,7 +24,7 @@ selected>${_district } - +
diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appHeaderCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appHeaderCfgForm.jsp index 68f83f8bf..4489d3715 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appHeaderCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appHeaderCfgForm.jsp @@ -165,7 +165,7 @@ $(function(){ selected>${_district } - +
diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appHttpCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appHttpCfgForm.jsp index a00ef0c6d..81ed43cc6 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appHttpCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appHttpCfgForm.jsp @@ -165,7 +165,7 @@ $(function(){ selected>${_district } - +
diff --git a/src/main/webapp/WEB-INF/views/cfg/app/appSslCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/app/appSslCfgForm.jsp index b472b80b8..10a2bf0d0 100644 --- a/src/main/webapp/WEB-INF/views/cfg/app/appSslCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/app/appSslCfgForm.jsp @@ -164,7 +164,7 @@ $(function(){ selected>${dict.itemValue } - +
diff --git a/src/main/webapp/WEB-INF/views/cfg/complexCfgForm.jsp b/src/main/webapp/WEB-INF/views/cfg/complexCfgForm.jsp index 6902e84a6..e3af30bb6 100644 --- a/src/main/webapp/WEB-INF/views/cfg/complexCfgForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/complexCfgForm.jsp @@ -41,7 +41,7 @@ selected>${_district } - +
diff --git a/src/main/webapp/static/global/scripts/common.js b/src/main/webapp/static/global/scripts/common.js index 0a1814252..8646b311a 100644 --- a/src/main/webapp/static/global/scripts/common.js +++ b/src/main/webapp/static/global/scripts/common.js @@ -2,6 +2,7 @@ $(function(){ //增加描述新增时的文字长度限制 $("form input[name='cfgDesc']").attr("maxlength","128"); $("form input[name$='cfgKeywords']").attr("maxlength","1024"); + $("form input[class~='domainCheck']").attr("maxlength","1024"); //截取过长的文字 使用id选择器;例如:tab对象->tr->td对象. 排除日志table .logTb $("#contentTable").not(".logTb").find("td").each(function(i){ //获取td当前对象的文本,如果长度大于25; From bd1e9b5fb9464c6825fe30cd50af572cbc838748 Mon Sep 17 00:00:00 2001 From: wangxin Date: Fri, 19 Oct 2018 15:28:17 +0800 Subject: [PATCH 3/4] =?UTF-8?q?(1)IP=20payload=E6=A8=A1=E6=9D=BF=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20(2)IP=E5=AF=BC=E5=85=A5=E6=96=B9=E6=B3=95=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=E5=8F=82=E6=95=B0path,functionId=20(3)IP=20payload?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../template/IpPayloadTemplate.java | 4 +-- .../nis/web/controller/BaseController.java | 35 +++++++++++++++++-- .../configuration/ntc/IpController.java | 24 +++++++------ .../resources/messages/message_en.properties | 2 +- .../WEB-INF/include/excel/importModal.jsp | 2 +- .../views/cfg/intercept/interceptList.jsp | 10 +++++- .../WEB-INF/views/cfg/ipaddr/ipList.jsp | 1 + 7 files changed, 60 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/nis/domain/configuration/template/IpPayloadTemplate.java b/src/main/java/com/nis/domain/configuration/template/IpPayloadTemplate.java index a9342e762..08f028394 100644 --- a/src/main/java/com/nis/domain/configuration/template/IpPayloadTemplate.java +++ b/src/main/java/com/nis/domain/configuration/template/IpPayloadTemplate.java @@ -23,14 +23,14 @@ public class IpPayloadTemplate extends IpAllTemplate { public String getUserRegion2() { return userRegion2; } - public void setUserRegion2(String userRegion1) { + public void setUserRegion2(String userRegion2) { this.userRegion2 = userRegion2; } @ExcelField(title="replace_content",align=2,sort=4) public String getUserRegion3() { return userRegion3; } - public void setUserRegion3(String userRegion1) { + public void setUserRegion3(String userRegion3) { this.userRegion3 = userRegion3; } } diff --git a/src/main/java/com/nis/web/controller/BaseController.java b/src/main/java/com/nis/web/controller/BaseController.java index daa8bb747..cc91baf74 100644 --- a/src/main/java/com/nis/web/controller/BaseController.java +++ b/src/main/java/com/nis/web/controller/BaseController.java @@ -50,6 +50,7 @@ import com.nis.domain.configuration.RequestInfo; import com.nis.domain.configuration.StringCfgTemplate; import com.nis.domain.configuration.template.IpAllTemplate; import com.nis.domain.configuration.template.IpCfgTemplate; +import com.nis.domain.configuration.template.IpPayloadTemplate; import com.nis.domain.configuration.template.IpRateLimitTemplate; import com.nis.domain.log.BaseLogEntity; import com.nis.domain.log.SearchReport; @@ -832,14 +833,37 @@ public class BaseController { try { Double ratelimt= Double.parseDouble(userRegion1); if(ratelimt>0.009||ratelimt<0.001) { - errInfo.append(prop.getProperty("ratelimit")+"."+String.format(prop.getProperty("must_between"),0.001,0.009)); + 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"))); + errInfo.append(String.format(prop.getProperty("not_number"), prop.getProperty("ratelimit"))+";"); + } + } + //payload ip + if(regionDict.getFunctionId().equals(212)) { + //replace_zone + String userRegion1=baseIpCfg.getUserRegion1(); + if(StringUtils.isNotBlank(userRegion1)) { + Object val = DictUtils.getDictLabel("INTERCEPT_REPLACE_ZONE", userRegion1); + if(StringUtils.isBlank(val.toString())) { + errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("replace_zone"))+";"); + } + }else { + errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("replace_zone"))+";"); + } + + //replaced_content + String userRegion2=baseIpCfg.getUserRegion2(); + if(StringUtils.isBlank(userRegion2)) { + errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("replaced_content"))+";"); + } + //replace_content + String userRegion3=baseIpCfg.getUserRegion3(); + if(StringUtils.isBlank(userRegion2)) { + errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("replace_content"))+";"); } } - if (regionDict.getRegionType().equals(1)) { // 校验必填的IP,端口 for (String code : configIpPortShow.split(",")) { @@ -2430,6 +2454,11 @@ public class BaseController { ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list); } } + }else if(regionDict.getFunctionId().equals(212)) { + if (regionDict.getRegionType().equals(1)) { + List list = ei.getDataList(IpPayloadTemplate.class); + ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list); + } } else if (regionDict.getRegionType().equals(1)) { List list = ei.getDataList(IpAllTemplate.class); ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list); diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java b/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java index 521e38303..b6fdd57a3 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java @@ -288,16 +288,20 @@ public class IpController extends BaseController{ } //ip配置导入 - @RequestMapping(value = "import", method=RequestMethod.POST) - public String importIp(RedirectAttributes redirectAttributes, - @RequestParam("files") MultipartFile[] files - ,Integer serviceDictId - ,Integer requestId - ,String regionDictIds) { - this._import(redirectAttributes, files,serviceDictId,regionDictIds,requestId); - - return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+5; - } + @RequestMapping(value = "import", method=RequestMethod.POST) + public String importIp(RedirectAttributes redirectAttributes, + @RequestParam("files") MultipartFile[] files + ,Integer serviceDictId + ,Integer requestId + ,String regionDictIds,String importPath,Integer functionId) { + this._import(redirectAttributes, files,serviceDictId,regionDictIds,requestId); + if(StringUtils.isNotBlank(importPath)) { + return "redirect:" + adminPath +importPath+"?functionId="+functionId; + }else { + return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+functionId; + } + + } //ip配置导出 @RequestMapping(value = "exportIpAddr") public void exportIp(Model model,HttpServletRequest request,HttpServletResponse response, diff --git a/src/main/resources/messages/message_en.properties b/src/main/resources/messages/message_en.properties index 966ed1d0e..baf7b777b 100644 --- a/src/main/resources/messages/message_en.properties +++ b/src/main/resources/messages/message_en.properties @@ -780,7 +780,7 @@ intra=Inbound #=============about Maintenance========= #=============some validation=========== line=line %s -can_not_null=%sCan't be empty +can_not_null=%s can't be empty is_incorrect=%s value is incorrect are_the_same=%s and %s can't be equal is_in_wrong_format=%s formatting error diff --git a/src/main/webapp/WEB-INF/include/excel/importModal.jsp b/src/main/webapp/WEB-INF/include/excel/importModal.jsp index c1250720e..7aaf22b2c 100644 --- a/src/main/webapp/WEB-INF/include/excel/importModal.jsp +++ b/src/main/webapp/WEB-INF/include/excel/importModal.jsp @@ -6,7 +6,7 @@ $(function(){ }); - + + + + <%@include file="/WEB-INF/include/excel/importModal.jsp" %> \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/ipaddr/ipList.jsp b/src/main/webapp/WEB-INF/views/cfg/ipaddr/ipList.jsp index 49dab435d..9cf31c821 100644 --- a/src/main/webapp/WEB-INF/views/cfg/ipaddr/ipList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/ipaddr/ipList.jsp @@ -471,6 +471,7 @@ + <%@include file="/WEB-INF/include/excel/importModal.jsp" %> From 02b7908116bdb5b91c4ae4dd5dd56ca8fb3be6c1 Mon Sep 17 00:00:00 2001 From: wangxin Date: Fri, 19 Oct 2018 15:47:42 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8DuserRegion3=E5=86=99?= =?UTF-8?q?=E6=88=90userRegion2=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/nis/web/controller/BaseController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/nis/web/controller/BaseController.java b/src/main/java/com/nis/web/controller/BaseController.java index cc91baf74..bee22fcd3 100644 --- a/src/main/java/com/nis/web/controller/BaseController.java +++ b/src/main/java/com/nis/web/controller/BaseController.java @@ -860,7 +860,7 @@ public class BaseController { } //replace_content String userRegion3=baseIpCfg.getUserRegion3(); - if(StringUtils.isBlank(userRegion2)) { + if(StringUtils.isBlank(userRegion3)) { errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("replace_content"))+";"); } }