From 7c70417d4c1041bdae9e3f415b2416166de92c58 Mon Sep 17 00:00:00 2001 From: wangxin Date: Tue, 3 Jul 2018 17:16:54 +0800 Subject: [PATCH 1/2] =?UTF-8?q?(1)=E5=9F=9F=E5=90=8D=E9=80=9A=E7=94=A8?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E9=A1=B5=E9=9D=A2=E6=A0=87=E9=A2=98=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=20(2)Ip=E9=85=8D=E7=BD=AE=E5=AF=BC=E5=85=A5=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=9D=A5=E5=87=BD=EF=BC=8C=E5=88=86=E7=B1=BB=E6=80=A7?= =?UTF-8?q?=E8=B4=A8=E6=A0=87=E7=AD=BE=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nis/web/controller/BaseController.java | 79 ++++++++++++++++++- .../resources/messages/message_en.properties | 2 + .../resources/messages/message_ru.properties | 2 + .../messages/message_zh_CN.properties | 3 + .../WEB-INF/views/cfg/common/domainForm.jsp | 9 +-- .../WEB-INF/views/cfg/common/ipForm.jsp | 2 +- 6 files changed, 88 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/nis/web/controller/BaseController.java b/src/main/java/com/nis/web/controller/BaseController.java index faaffc7df..60915cc9a 100644 --- a/src/main/java/com/nis/web/controller/BaseController.java +++ b/src/main/java/com/nis/web/controller/BaseController.java @@ -661,15 +661,88 @@ public class BaseController { errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("direction"))+";"); } //protocol check end + // requestId check start + Integer requestId=value.getRequestId(); + if(requestId==null){ + errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("letter"))+";"); + }else{//查询数据库是否存在ID + RequestInfo info=requestInfoService.getRequestInfoById((long)requestId.intValue()); + if(info==null){ + errInfo.append(String.format(prop.getProperty("id_not_exists"),requestId, prop.getProperty("letter"))+";"); + }else if(info.getIsValid()==Constants.VALID_NO||info.getIsValid()==Constants.VALID_DEL){ + errInfo.append(String.format(prop.getProperty("id_not_valid"),requestId, prop.getProperty("letter"))+";"); + } + } + // requestId check end + //classification check start + String classification=value.getClassify(); + if(StringUtils.isNotBlank(classification)){ + try{ + for(String classify:classification.split(",")){ + if(StringUtils.isNotBlank(classify)){ + int c=Integer.parseInt(classify); + ServiceDictInfo dict=serviceDictInfoService.getDictById(c); + if(dict==null){ + errInfo.append(String.format(prop.getProperty("id_not_exists"),classify, prop.getProperty("classification"))+";"); + }else if(dict.getIsValid()==Constants.VALID_NO||dict.getIsValid()==Constants.VALID_DEL){ + errInfo.append(String.format(prop.getProperty("id_not_valid"),classify, prop.getProperty("classification"))+";"); + } + } + } + }catch (Exception e) { + // TODO: handle exception + errInfo.append(String.format(prop.getProperty("num_split_by_comma"), prop.getProperty("classification"))+";"); + } + } + //classification check end + //attribute check start + String attributes=value.getAttribute(); + if(StringUtils.isNotBlank(attributes)){ + try{ + for(String attribute:attributes.split(",")){ + if(StringUtils.isNotBlank(attribute)){ + int c=Integer.parseInt(attribute); + ServiceDictInfo dict=serviceDictInfoService.getDictById(c); + if(dict==null){ + errInfo.append(String.format(prop.getProperty("id_not_exists"),attribute, prop.getProperty("attribute"))+";"); + }else if(dict.getIsValid()==Constants.VALID_NO||dict.getIsValid()==Constants.VALID_DEL){ + errInfo.append(String.format(prop.getProperty("id_not_valid"),attribute, prop.getProperty("attribute"))+";"); + } + } + } + }catch (Exception e) { + // TODO: handle exception + errInfo.append(String.format(prop.getProperty("num_split_by_comma"), prop.getProperty("attribute"))+";"); + } + } + //attribute check end + //attribute check start + String labels=value.getLable(); + if(StringUtils.isNotBlank(labels)){ + try{ + for(String label:labels.split(",")){ + if(StringUtils.isNotBlank(label)){ + int c=Integer.parseInt(label); + ServiceDictInfo dict=serviceDictInfoService.getDictById(c); + if(dict==null){ + errInfo.append(String.format(prop.getProperty("id_not_exists"),label, prop.getProperty("label"))+";"); + }else if(dict.getIsValid()==Constants.VALID_NO||dict.getIsValid()==Constants.VALID_DEL){ + errInfo.append(String.format(prop.getProperty("id_not_valid"),label, prop.getProperty("label"))+";"); + } + } + } + }catch (Exception e) { + // TODO: handle exception + errInfo.append(String.format(prop.getProperty("num_split_by_comma"), prop.getProperty("label"))+";"); + } + } + //attribute check end if(StringUtils.isNotBlank(errInfo.toString())){ msg.append(lineStart).append(errInfo); if(line"); } } - // requestId check start - Integer requestId=value.getRequestId(); - // requestId check end line++; } if(StringUtils.isNotBlank(msg.toString())){ diff --git a/src/main/resources/messages/message_en.properties b/src/main/resources/messages/message_en.properties index 35dbc9547..e88335176 100644 --- a/src/main/resources/messages/message_en.properties +++ b/src/main/resources/messages/message_en.properties @@ -716,4 +716,6 @@ are_the_same=%s and %s are the same is_in_wrong_format=%s is in wrong format must_between=must between %s and %s not_number=%s is not a number +id_not_exists=the id %s of %s is not valid +num_split_by_comma=%s must be numbers split by comma #=============some validation=========== \ No newline at end of file diff --git a/src/main/resources/messages/message_ru.properties b/src/main/resources/messages/message_ru.properties index b11afa7be..0593a42ca 100644 --- a/src/main/resources/messages/message_ru.properties +++ b/src/main/resources/messages/message_ru.properties @@ -700,4 +700,6 @@ are_the_same=%s and %s are the same is_in_wrong_format=%s is in wrong format must_between=must between %s and %s not_number=%s is not a number +id_not_exists=the id %s of %s is not valid +num_split_by_comma=%s must be numbers split by comma #=============some validation=========== \ No newline at end of file diff --git a/src/main/resources/messages/message_zh_CN.properties b/src/main/resources/messages/message_zh_CN.properties index ddfc9b9af..c6b27e148 100644 --- a/src/main/resources/messages/message_zh_CN.properties +++ b/src/main/resources/messages/message_zh_CN.properties @@ -808,4 +808,7 @@ NTC_MAIL_BODY=\u5185\u5BB9\u5173\u952E\u5B57\u914D\u7F6E NTC_FILE_DIGEST=\u6587\u4EF6\u6458\u8981\u914D\u7F6E NTC_FTP_URL=URL\u914D\u7F6E FTP_CONTENT=\u5185\u5BB9\u5173\u952E\u5B57\u914D\u7F6E +id_not_exists=id\u4E3A%s\u7684%s\u4E0D\u5B58\u5728 +id_not_valid=id\u4E3A%s\u7684%s\u65E0\u6548 +num_split_by_comma=%s\u4E3A\u9017\u53F7\u5206\u9694\u7684\u6570\u5B57 #=============region_value,config form title================= \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/common/domainForm.jsp b/src/main/webapp/WEB-INF/views/cfg/common/domainForm.jsp index b4f926c2c..6ab846d77 100644 --- a/src/main/webapp/WEB-INF/views/cfg/common/domainForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/common/domainForm.jsp @@ -2,7 +2,7 @@ <%@ include file="/WEB-INF/include/taglib.jsp"%> -<spring:message code="domain_intercept"></spring:message> +<spring:message code="${cfgName}"></spring:message> From 49f02f551298857d27205cc13aa490143b9bf8ec Mon Sep 17 00:00:00 2001 From: wangxin Date: Tue, 3 Jul 2018 17:30:23 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E4=B8=AD=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/messages/message_en.properties | 1 + src/main/resources/messages/message_ru.properties | 1 + src/main/resources/messages/message_zh_CN.properties | 1 + src/main/webapp/WEB-INF/views/cfg/common/domainForm.jsp | 2 +- src/main/webapp/WEB-INF/views/cfg/common/ipForm.jsp | 2 +- src/main/webapp/WEB-INF/views/cfg/whitelist/domainForm.jsp | 2 +- src/main/webapp/WEB-INF/views/cfg/whitelist/ipForm.jsp | 2 +- 7 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/resources/messages/message_en.properties b/src/main/resources/messages/message_en.properties index e88335176..89d4bf8b6 100644 --- a/src/main/resources/messages/message_en.properties +++ b/src/main/resources/messages/message_en.properties @@ -20,6 +20,7 @@ edit=edit hi=hi exit=exit choose=choose +onloading=onloading... #============menu begin====================== requestInfo=requestInfo configuration_manage=configuration manage diff --git a/src/main/resources/messages/message_ru.properties b/src/main/resources/messages/message_ru.properties index 0593a42ca..2d9f610b5 100644 --- a/src/main/resources/messages/message_ru.properties +++ b/src/main/resources/messages/message_ru.properties @@ -20,6 +20,7 @@ edit=edit hi=hi exit=exit choose=choose +onloading=onloading... #============menu begin====================== requestInfo=requestInfo configuration_manage=configuration manage diff --git a/src/main/resources/messages/message_zh_CN.properties b/src/main/resources/messages/message_zh_CN.properties index c6b27e148..3eac10dd2 100644 --- a/src/main/resources/messages/message_zh_CN.properties +++ b/src/main/resources/messages/message_zh_CN.properties @@ -20,6 +20,7 @@ edit=\u4FEE\u6539 hi=\u4F60\u597D exit=\u9000\u51FA choose=\u9009\u62E9 +onloading=\u52A0\u8F7D\u4E2D... #==========menu begin===================== requestInfo=\u6765\u51FD\u4FE1\u606F configuration_manage=\u914D\u7F6E\u7BA1\u7406 diff --git a/src/main/webapp/WEB-INF/views/cfg/common/domainForm.jsp b/src/main/webapp/WEB-INF/views/cfg/common/domainForm.jsp index 6ab846d77..333222b1a 100644 --- a/src/main/webapp/WEB-INF/views/cfg/common/domainForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/common/domainForm.jsp @@ -42,7 +42,7 @@ $(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error); }, submitHandler: function(form){ - loading('onloading...'); + loading(''); form.submit(); }, errorContainer: "#messageBox" diff --git a/src/main/webapp/WEB-INF/views/cfg/common/ipForm.jsp b/src/main/webapp/WEB-INF/views/cfg/common/ipForm.jsp index b6dd8ded1..3a7c1387b 100644 --- a/src/main/webapp/WEB-INF/views/cfg/common/ipForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/common/ipForm.jsp @@ -45,7 +45,7 @@ $(function(){ $("#cfgRegionCode").val($("#cfgRegionCodeMaat").val()); $("#cfgType").val($("#cfgTypeMaat").val()); } - loading('onloading...'); + loading(''); form.submit(); }, errorContainer: "#messageBox" diff --git a/src/main/webapp/WEB-INF/views/cfg/whitelist/domainForm.jsp b/src/main/webapp/WEB-INF/views/cfg/whitelist/domainForm.jsp index cb4bc2765..2b1a2039a 100644 --- a/src/main/webapp/WEB-INF/views/cfg/whitelist/domainForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/whitelist/domainForm.jsp @@ -45,7 +45,7 @@ $(function(){ $(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error); }, submitHandler: function(form){ - loading('onloading...'); + loading(''); form.submit(); }, errorContainer: "#messageBox", diff --git a/src/main/webapp/WEB-INF/views/cfg/whitelist/ipForm.jsp b/src/main/webapp/WEB-INF/views/cfg/whitelist/ipForm.jsp index ded18126e..9ba2db414 100644 --- a/src/main/webapp/WEB-INF/views/cfg/whitelist/ipForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/whitelist/ipForm.jsp @@ -56,7 +56,7 @@ $(function(){ $(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error); }, submitHandler: function(form){ - loading('onloading...'); + loading(''); form.submit(); }, errorContainer: "#messageBox",