导入提示信息null情况处理

导入界面非空校验,以及界面单个service或region处理
This commit is contained in:
duandongmei
2018-10-22 17:23:40 +08:00
parent 434ef5da8e
commit 7ddf64c525
6 changed files with 60 additions and 18 deletions

View File

@@ -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浏览器