From 7ddf64c525a8b4ed470c10e692db23b5dae083bf Mon Sep 17 00:00:00 2001 From: duandongmei Date: Mon, 22 Oct 2018 17:23:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E6=8F=90=E7=A4=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AFnull=E6=83=85=E5=86=B5=E5=A4=84=E7=90=86=20=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E7=95=8C=E9=9D=A2=E9=9D=9E=E7=A9=BA=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=EF=BC=8C=E4=BB=A5=E5=8F=8A=E7=95=8C=E9=9D=A2=E5=8D=95=E4=B8=AA?= =?UTF-8?q?service=E6=88=96region=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/nis/util/excel/ExportExcel.java | 16 +++++---- .../resources/messages/message_en.properties | 5 +-- .../resources/messages/message_ru.properties | 3 +- .../messages/message_zh_CN.properties | 3 +- .../WEB-INF/include/excel/importModal.jsp | 17 ++++++---- .../static/pages/scripts/importExcel.js | 34 ++++++++++++++++++- 6 files changed, 60 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/nis/util/excel/ExportExcel.java b/src/main/java/com/nis/util/excel/ExportExcel.java index 92d3252db..f4cd1c8c0 100644 --- a/src/main/java/com/nis/util/excel/ExportExcel.java +++ b/src/main/java/com/nis/util/excel/ExportExcel.java @@ -3,6 +3,7 @@ */ package com.nis.util.excel; +import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; @@ -40,6 +41,7 @@ import org.apache.poi.xssf.usermodel.XSSFClientAnchor; import org.apache.poi.xssf.usermodel.XSSFRichTextString; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.web.multipart.MultipartFile; import com.google.common.collect.Lists; import com.nis.domain.FunctionRegionDict; @@ -241,7 +243,7 @@ public class ExportExcel { index++; } if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){ - commentStr=commentStr+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+"("+msgProp.getProperty("ipv4_mask")+")"+"\n"; + commentStr=commentStr+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+"("+msgProp.getProperty("ipv4_subnet")+")"+"\n"; index++; } } @@ -255,7 +257,7 @@ public class ExportExcel { index++; } if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){ - commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+"("+msgProp.getProperty("ipv6_mask")+")"+"\n"; + commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+"("+msgProp.getProperty("ipv6_subnet")+")"+"\n"; index++; } } @@ -269,9 +271,12 @@ public class ExportExcel { }else{ commentStr=msgProp.getProperty("example")+":\n"+commentStr; index++; + /**TODO 规则: index++; + commentStr=msgProp.getProperty("example")+":\n"+commentStr; + index++; 1、源ip和目的ip不能相等 index++; 2、源ip和目的ip格式必须一致 @@ -313,7 +318,7 @@ public class ExportExcel { index++; } if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){ - commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+"("+msgProp.getProperty("ipv6_mask")+")"+"\n"; + commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+"("+msgProp.getProperty("ipv6_subnet")+")"+"\n"; index++; } } @@ -351,7 +356,7 @@ public class ExportExcel { index++; } if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){ - commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"(Port/"+msgProp.getProperty("port_mask")+")"+"\n"; + commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"(Port/"+msgProp.getProperty("port_subnet")+")"+"\n"; index++; } }else{ @@ -386,7 +391,7 @@ public class ExportExcel { index++; } if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){ - commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"(Port/"+msgProp.getProperty("port_mask")+")"+"\n"; + commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"(Port/"+msgProp.getProperty("port_subnet")+")"+"\n"; index++; } }else{ @@ -1761,7 +1766,6 @@ public class ExportExcel { }else{ fileName="export.xlsx"; } - final String userAgent = request.getHeader("USER-AGENT"); String finalFileName = null; if(StringUtils.contains(userAgent, "MSIE")){//IE浏览器 diff --git a/src/main/resources/messages/message_en.properties b/src/main/resources/messages/message_en.properties index f3b25237d..8ffdd5143 100644 --- a/src/main/resources/messages/message_en.properties +++ b/src/main/resources/messages/message_en.properties @@ -1269,6 +1269,7 @@ public_file_error=Wrong format of public key file private_file_error=Wrong format of private key file keyframe_pic_required=No keyframe pictures have been selected. ipv4_range=IPv4 Range -ipv4_subnet=IPv4/Subnet mask +ipv4_subnet=IPv4/Subnet Mask ipv6_range=IPv6 Range -ipv6_subnet=IPv6/Subnet mask \ No newline at end of file +ipv6_subnet=IPv6/Subnet Mask +example=For Example \ 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 0a2903974..72e58d2d8 100644 --- a/src/main/resources/messages/message_ru.properties +++ b/src/main/resources/messages/message_ru.properties @@ -1291,4 +1291,5 @@ keyframe_pic_required=No keyframe pictures have been selected. ipv4_range=IPv4 Range ipv4_subnet=IPv4/Subnet mask ipv6_range=IPv6 Range -ipv6_subnet=IPv6/Subnet mask \ No newline at end of file +ipv6_subnet=IPv6/Subnet mask +example=For Example \ 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 ad2f2c980..a43e0e008 100644 --- a/src/main/resources/messages/message_zh_CN.properties +++ b/src/main/resources/messages/message_zh_CN.properties @@ -1266,4 +1266,5 @@ keyframe_pic_required=\u5C1A\u672A\u9009\u62E9\u5173\u952E\u5E27\u56FE\u7247 ipv4_range=IPv4 Range ipv4_subnet=IPv4/Subnet mask ipv6_range=IPv6 Range -ipv6_subnet=IPv6/Subnet mask \ No newline at end of file +ipv6_subnet=IPv6/Subnet mask +example=\u4F8B\u5982 \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/include/excel/importModal.jsp b/src/main/webapp/WEB-INF/include/excel/importModal.jsp index b0cca3eb3..8ebaa3c89 100644 --- a/src/main/webapp/WEB-INF/include/excel/importModal.jsp +++ b/src/main/webapp/WEB-INF/include/excel/importModal.jsp @@ -22,7 +22,8 @@ -
+
+
@@ -54,7 +55,7 @@
-
+
@@ -109,16 +110,19 @@ + "> + "> + "> @@ -131,16 +135,15 @@ - - +
-
+

diff --git a/src/main/webapp/static/pages/scripts/importExcel.js b/src/main/webapp/static/pages/scripts/importExcel.js index 25ef29240..48e1c57b3 100644 --- a/src/main/webapp/static/pages/scripts/importExcel.js +++ b/src/main/webapp/static/pages/scripts/importExcel.js @@ -16,6 +16,7 @@ $(function(){ }); $("input[name='regionDictIds']").click(function(){ }); + }); /** * action动作切换 @@ -29,7 +30,25 @@ function switchService(){ $("input[name='regionDictIds'][cfgRegionCodeR!='"+cfgRegionCode+"']").parents(".radio-inline").addClass("hidden"); $("input[name='regionDictIds'][cfgRegionCodeR='"+cfgRegionCode+"']").prop("checked",true); $("input[name='regionDictIds'][cfgRegionCodeR='"+cfgRegionCode+"']").parents(".radio-inline").removeClass("hidden"); + if(cfgRegionCodeS.split(",").length==1){ + $(".region").addClass("hidden"); + }else{ + $(".region").removeClass("hidden"); + } + }else{ + if($("input[name='regionDictIds']").length==1){ + $(".region").addClass("hidden"); + }else{ + $(".region").removeClass("hidden"); + } } + + if($("input[name='serviceDictId']").length==1){ + $(".service").addClass("hidden"); + }else{ + $(".service").removeClass("hidden"); + } + } /** * 模板下载 @@ -94,10 +113,23 @@ var importCfg=function(){ alert("请选择action"); return ; } + var appFlag=true; + if(($("#functionId").val() == 63)||($("#functionId").val() == 408)||($("#functionId").val() == 407)){ + var appIdValue=$("#appIdName").val(); + if(appIdValue == null || appIdValue ==''){ + appFlag=false; + } + } var fileName = $(".fileupload-preview", $("#importForm1")).text(); var $error = $('.alert-error', $("#importForm1")); + if(!appFlag){ + $("span",$error).html($("#appError").val()); + $error.removeClass("hide"); + $error.addClass("show"); + return false; + } + if(fileName==""){ - $("span",$error).html("请选择xls或者xlsx格式文件进行导入..."); $error.removeClass("hide"); $error.addClass("show");