diff --git a/src/main/java/com/nis/domain/configuration/BaseStringCfg.java b/src/main/java/com/nis/domain/configuration/BaseStringCfg.java index acfc730a1..2528652fb 100644 --- a/src/main/java/com/nis/domain/configuration/BaseStringCfg.java +++ b/src/main/java/com/nis/domain/configuration/BaseStringCfg.java @@ -194,6 +194,8 @@ public class BaseStringCfg extends BaseCfg { public static List replaceBaseKeyList(List list){ for (int i = 0; i < list.size(); i++) { BaseStringCfg base=(BaseStringCfg)list.get(i); + base.setIsHex(base.getIsHexbin()); + base.setIsCaseInsenstive(base.getIsHexbin()); base.setCfgKeywords(Functions.replace(base.getCfgKeywords(), "***and***"," ")); } return list; diff --git a/src/main/java/com/nis/domain/configuration/ComplexkeywordCfg.java b/src/main/java/com/nis/domain/configuration/ComplexkeywordCfg.java index 75b9059bb..bdf0c8f5d 100644 --- a/src/main/java/com/nis/domain/configuration/ComplexkeywordCfg.java +++ b/src/main/java/com/nis/domain/configuration/ComplexkeywordCfg.java @@ -178,6 +178,8 @@ public class ComplexkeywordCfg extends BaseCfg{ public static List replaceComplexKeyList(List list){ for (int i = 0; i < list.size(); i++) { ComplexkeywordCfg base=(ComplexkeywordCfg)list.get(i); + base.setIsHex(base.getIsHexbin()); + base.setIsCaseInsenstive(base.getIsHexbin()); base.setCfgKeywords(Functions.replace(base.getCfgKeywords(), "***and***"," ")); } return list; diff --git a/src/main/java/com/nis/util/excel/ExportExcel.java b/src/main/java/com/nis/util/excel/ExportExcel.java index 44b898b80..cb8046e7b 100644 --- a/src/main/java/com/nis/util/excel/ExportExcel.java +++ b/src/main/java/com/nis/util/excel/ExportExcel.java @@ -47,6 +47,7 @@ import com.nis.domain.FunctionServiceDict; import com.nis.domain.SysDataDictionaryItem; import com.nis.domain.basics.ServiceDictInfo; import com.nis.domain.configuration.DnsResStrategy; +import com.nis.util.Constants; import com.nis.util.DictUtils; import com.nis.util.Encodes; import com.nis.util.Reflections; @@ -139,7 +140,8 @@ public class ExportExcel { } } public String[] validRegionFieldAndSetComment(String headerStr,String commentStr,FunctionRegionDict region,FunctionServiceDict service,Properties msgProp){ - String[] titleInfo=new String[2]; + int index=0; + String[] titleInfo=new String[3]; //ratelimit if("ratelimit".equals(headerStr)){ commentStr=""; @@ -147,15 +149,20 @@ public class ExportExcel { if(ratelimit !=null && ratelimit.size()>0){ for (SysDataDictionaryItem sysDataDictionaryItem : ratelimit) { if(StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){ - commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n"; + commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"\n"; + index++; }else{ - commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n"; + commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"\n"; + index++; } } } if(StringUtil.isEmpty(commentStr)){ headerStr=""; commentStr=""; + }else{ + commentStr=msgProp.getProperty("select")+":\n"+commentStr; + index++; } } //replace_zone @@ -166,14 +173,19 @@ public class ExportExcel { for (SysDataDictionaryItem sysDataDictionaryItem : interceptReplaceZone) { if(StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){ commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n"; + index++; }else{ commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n"; + index++; } } } if(StringUtil.isEmpty(commentStr)){ headerStr=""; commentStr=""; + }else{ + commentStr=msgProp.getProperty("select")+":\n"+commentStr; + index++; } } @@ -190,12 +202,16 @@ public class ExportExcel { }else{ for (DnsResStrategy dnsResStrategy : resStrategys) { commentStr=commentStr+dnsResStrategy.getCfgId()+":"+dnsResStrategy.getCfgDesc()+"\n"; + index++; } } } if(StringUtil.isEmpty(commentStr)){ headerStr=""; commentStr=""; + }else{ + commentStr=msgProp.getProperty("select")+":\n"+commentStr; + index++; } } @@ -217,88 +233,178 @@ public class ExportExcel { commentStr=""; if((","+region.getConfigIpType()+",").indexOf(",4,") > -1){ if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){ - commentStr=commentStr+"0.0.0.0"+"\n"; + commentStr=commentStr+Constants.IPV4_DEFAULT_IP_VALUE+"(IPv4)"+"\n"; + index++; } if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){ - commentStr=commentStr+"0.0.0.0-1"+"\n"; + commentStr=commentStr+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+"("+msgProp.getProperty("ipv4_range")+")"+"\n"; + index++; } if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){ - commentStr=commentStr+"0.0.0.0/16"+"\n"; + commentStr=commentStr+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+"("+msgProp.getProperty("ipv4_mask")+")"+"\n"; + index++; } } if((","+region.getConfigIpType()+",").indexOf(",6,") > -1){ if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){ - commentStr=commentStr+"::"+"\n"; + commentStr=commentStr+Constants.IPV6_DEFAULT_IP_VALUE+"(IPv6)"+"\n"; + index++; } if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){ - commentStr=commentStr+"::-::"+"\n"; + commentStr=commentStr+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+"("+msgProp.getProperty("ipv6_range")+")"+"\n"; + index++; } if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){ - commentStr=commentStr+"::/128"+"\n"; + commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+"("+msgProp.getProperty("ipv6_mask")+")"+"\n"; + index++; } } }else{ headerStr=""; commentStr=""; } + if(StringUtil.isEmpty(commentStr)){ + headerStr=""; + commentStr=""; + }else{ + commentStr=msgProp.getProperty("example")+":\n"+commentStr; + index++; + /**TODO + 规则: + index++; + 1、源ip和目的ip不能相等 + index++; + 2、源ip和目的ip格式必须一致 + index++; + 3、IPv4 Range 必须是C段IP + index++; + 4、IPv4 Mask 掩码范围16-32 + index++; + 5、IPv6 Mask 掩码范围2-128 + index++; + */ + } + } if("server_ip".equals(headerStr)){ if((","+region.getConfigIpPortShow()+",").indexOf(",3,") > -1){ commentStr=""; if((","+region.getConfigIpType()+",").indexOf(",4,") > -1){ if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){ - commentStr=commentStr+"0.0.0.0"+"\n"; + commentStr=commentStr+Constants.IPV4_DEFAULT_IP_VALUE+"(IPv4)"+"\n"; + index++; } if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){ - commentStr=commentStr+"0.0.0.0-1"+"\n"; + commentStr=commentStr+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+"("+msgProp.getProperty("ipv4_range")+")"+"\n"; + index++; } if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){ - commentStr=commentStr+"0.0.0.0/16"+"\n"; + commentStr=commentStr+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+"("+msgProp.getProperty("ipv4_mask")+")"+"\n"; + index++; } } if((","+region.getConfigIpType()+",").indexOf(",6,") > -1){ if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){ - commentStr=commentStr+"::"+"\n"; + commentStr=commentStr+Constants.IPV6_DEFAULT_IP_VALUE+"(IPv6)"+"\n"; + index++; } if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){ - commentStr=commentStr+"::-::"+"\n"; + commentStr=commentStr+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+"("+msgProp.getProperty("ipv6_range")+")"+"\n"; + index++; } if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){ - commentStr=commentStr+"::/128"+"\n"; + commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+"("+msgProp.getProperty("ipv6_mask")+")"+"\n"; + index++; } } }else{ headerStr=""; commentStr=""; } + if(StringUtil.isEmpty(commentStr)){ + headerStr=""; + commentStr=""; + }else{ + commentStr=msgProp.getProperty("example")+":\n"+commentStr; + index++; + /**TODO + 规则: + index++; + 1、源ip和目的ip不能相等 + index++; + 2、源ip和目的ip格式必须一致 + index++; + 3、IPv4 Range 必须是C段IP + index++; + 4、IPv4 Mask 掩码范围16-32 + index++; + 5、IPv6 Mask 掩码范围2-128 + index++; + */ + } } if("client_port".equals(headerStr)){ if(((","+region.getConfigIpPortShow()+",").indexOf(",2,") > -1)){ commentStr=""; if((","+region.getConfigPortPattern()+",").indexOf(",1,") > -1){ - commentStr=commentStr+"0["+msgProp.getProperty("val_src_port")+"]"+"\n"; + commentStr=commentStr+Constants.PORT_DEFAULT+"(Port)"+"\n"; + index++; } if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){ - commentStr=commentStr+"0/65535["+msgProp.getProperty("val_src_port_mask")+"]"+"\n"; + commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"(Port/"+msgProp.getProperty("port_mask")+")"+"\n"; + index++; } }else{ headerStr=""; commentStr=""; } + if(StringUtil.isEmpty(commentStr)){ + headerStr=""; + commentStr=""; + }else{ + commentStr=msgProp.getProperty("example")+":\n"+commentStr; + index++; + /**TODO + 规则: + index++; + 1、源端口和目的端口格式必须一致 + index++; + 2、端口范围0-65535 + index++; + 3、端口掩码范围0-65535 + index++; + 4、非TCP、UDP、ALL协议,端口必须为0 + index++; + */ + } } if("server_port".equals(headerStr)){ if((","+region.getConfigIpPortShow()+",").indexOf(",4,") > -1){ commentStr=""; if((","+region.getConfigPortPattern()+",").indexOf(",1,") > -1){ - commentStr=commentStr+"0["+msgProp.getProperty("val_src_port")+"]"+"\n"; + commentStr=commentStr+Constants.PORT_DEFAULT+"(Port)"+"\n"; + index++; } if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){ - commentStr=commentStr+"0/65535["+msgProp.getProperty("val_src_port_mask")+"]"+"\n"; + commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"(Port/"+msgProp.getProperty("port_mask")+")"+"\n"; + index++; } }else{ headerStr=""; commentStr=""; } + /**TODO + 规则: + index++; + 1、源端口和目的端口格式必须一致 + index++; + 2、端口范围0-65535 + index++; + 3、端口掩码范围0-65535 + index++; + 4、非TCP、UDP、ALL协议,端口必须为0 + index++; + */ } } //导入的Protocol @@ -311,7 +417,8 @@ public class ExportExcel { if(protocol !=null && protocol.size()>0){ for (SysDataDictionaryItem sysDataDictionaryItem : protocol) { if(sysDataDictionaryItem.getItemCode().equals(6)){ - commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n"; + commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+sysDataDictionaryItem.getItemValue()+")"+"\n"; + index++; } } } @@ -322,9 +429,11 @@ public class ExportExcel { for (SysDataDictionaryItem sysDataDictionaryItem : protocol) { if((","+region.getConfigProtocol()+",").indexOf(","+sysDataDictionaryItem.getItemCode()+",") >-1){ if(StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){ - commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n"; + commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+sysDataDictionaryItem.getItemValue()+")"+"\n"; + index++; }else{ - commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n"; + commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+")"+"\n"; + index++; } } @@ -342,20 +451,25 @@ public class ExportExcel { for (SysDataDictionaryItem sysDataDictionaryItem : protocol) { if((","+region.getConfigProtocol()+",").indexOf(","+sysDataDictionaryItem.getItemCode()+",") >-1){ if(StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){ - commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n"; + commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+sysDataDictionaryItem.getItemValue()+")"+"\n"; + index++; }else{ - commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n"; + commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+")"+"\n"; + index++; } } } - if(StringUtil.isEmpty(commentStr)){ - headerStr=""; - commentStr=""; - } } } } + if(StringUtil.isEmpty(commentStr)){ + headerStr=""; + commentStr=""; + }else{ + commentStr=msgProp.getProperty("select")+":\n"+commentStr; + index++; + } } //Direction @@ -370,9 +484,11 @@ public class ExportExcel { for (SysDataDictionaryItem sysDataDictionaryItem : direction) { if(((","+region.getConfigDirection()+",").indexOf(sysDataDictionaryItem.getItemCode()) >-1) && StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){ - commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n"; + commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+sysDataDictionaryItem.getItemValue()+")"+"\n"; + index++; }else if((","+region.getConfigDirection()+",").indexOf(sysDataDictionaryItem.getItemCode()) >-1){ - commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n"; + commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+")"+"\n"; + index++; } } if(StringUtil.isEmpty(commentStr)){ @@ -381,6 +497,13 @@ public class ExportExcel { } } } + if(StringUtil.isEmpty(commentStr)){ + headerStr=""; + commentStr=""; + }else{ + commentStr=msgProp.getProperty("select")+":\n"+commentStr; + index++; + } } //字符串或摘要字符串 @@ -392,9 +515,16 @@ public class ExportExcel { commentStr=""; }else{ commentStr=region.getConfigDistrict(); + index++; } } - + if(StringUtil.isEmpty(commentStr)){ + headerStr=""; + commentStr=""; + }else{ + commentStr=msgProp.getProperty("select")+":\n"+commentStr; + index++; + } } //expr type if("expression_type".equals(headerStr)){ @@ -408,17 +538,22 @@ public class ExportExcel { for (SysDataDictionaryItem sysDataDictionaryItem : exprType) { if(((","+region.getConfigExprType()+",").indexOf(sysDataDictionaryItem.getItemCode()) >-1) && StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){ - commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n"; + commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+sysDataDictionaryItem.getItemValue()+")"+"\n"; + index++; }else if((","+region.getConfigExprType()+",").indexOf(sysDataDictionaryItem.getItemCode()) >-1){ - commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n"; + commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+")"+"\n"; + index++; } } - if(StringUtil.isEmpty(commentStr)){ - headerStr=""; - commentStr=""; - } } } + if(StringUtil.isEmpty(commentStr)){ + headerStr=""; + commentStr=""; + }else{ + commentStr=msgProp.getProperty("select")+":\n"+commentStr; + index++; + } } //match method if("match_method".equals(headerStr)){ @@ -432,15 +567,20 @@ public class ExportExcel { for (SysDataDictionaryItem sysDataDictionaryItem : matchMethod) { if(((","+region.getConfigMatchMethod()+",").indexOf(sysDataDictionaryItem.getItemCode()) >-1) && StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){ - commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n"; + commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+sysDataDictionaryItem.getItemValue()+")"+"\n"; + index++; }else if((","+region.getConfigMatchMethod()+",").indexOf(sysDataDictionaryItem.getItemCode()) >-1){ - commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n"; + commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+")"+"\n"; + index++; } } - if(StringUtil.isEmpty(commentStr)){ - headerStr=""; - commentStr=""; - } + } + if(StringUtil.isEmpty(commentStr)){ + headerStr=""; + commentStr=""; + }else{ + commentStr=msgProp.getProperty("select")+":\n"+commentStr; + index++; } } } @@ -456,24 +596,29 @@ public class ExportExcel { if(((","+region.getConfigHex()+",").indexOf(",1,") >-1)){ for (SysDataDictionaryItem sysDataDictionaryItem : isHex) { if(sysDataDictionaryItem.getItemCode().equals("1")){ - commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n"; + commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+sysDataDictionaryItem.getItemValue()+")"+"\n"; + index++; } } } if(!((","+region.getConfigHex()+",").indexOf(",1,") >-1)){ for (SysDataDictionaryItem sysDataDictionaryItem : isHex) { if(sysDataDictionaryItem.getItemCode().equals("0")){ - commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n"; + commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+sysDataDictionaryItem.getItemValue()+")"+"\n"; + index++; } } } - if(StringUtil.isEmpty(commentStr)){ - headerStr=""; - commentStr=""; - } } } + if(StringUtil.isEmpty(commentStr)){ + headerStr=""; + commentStr=""; + }else{ + commentStr=msgProp.getProperty("select")+":\n"+commentStr; + index++; + } } if("is_case_insenstive".equals(headerStr)){ if(StringUtil.isEmpty(region.getConfigHex())){ @@ -486,28 +631,34 @@ public class ExportExcel { if(((","+region.getConfigHex()+",").indexOf(",2,") >-1)){ for (SysDataDictionaryItem sysDataDictionaryItem : isCaseSenstive) { if(sysDataDictionaryItem.getItemCode().equals("1")){ - commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n"; + commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+sysDataDictionaryItem.getItemValue()+")"+"\n"; + index++; } } } if(!((","+region.getConfigHex()+",").indexOf(",2,") >-1)){ for (SysDataDictionaryItem sysDataDictionaryItem : isCaseSenstive) { if(sysDataDictionaryItem.getItemCode().equals("0")){ - commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n"; + commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+sysDataDictionaryItem.getItemValue()+")"+"\n"; + index++; } } } - if(StringUtil.isEmpty(commentStr)){ - headerStr=""; - commentStr=""; - } } } + if(StringUtil.isEmpty(commentStr)){ + headerStr=""; + commentStr=""; + }else{ + commentStr=msgProp.getProperty("select")+":\n"+commentStr; + index++; + } } } titleInfo[0]=headerStr; titleInfo[1]=commentStr; + titleInfo[2]=index+""; return titleInfo; } /** @@ -635,7 +786,7 @@ public class ExportExcel { headerList.add(titleStr); commentList.add(commentStr); } - initialize(title, headerList,commentList); + initialize(title, headerList,commentList,null); } /** * 构造函数 @@ -714,9 +865,11 @@ public class ExportExcel { // Initialize List headerList = Lists.newArrayList(); List commentList = Lists.newArrayList(); + List commentRowList = Lists.newArrayList(); for (Object[] os : annotationList){ String titleStr = ((ExcelField)os[0]).title(); String commentStr = ((ExcelField)os[0]).comment(); + Integer commentRow = 0; // 如果是导出,则去掉注释 if (type==1){ @@ -726,14 +879,16 @@ public class ExportExcel { String[] titleInfo=validRegionFieldAndSetComment(titleStr,commentStr,region,service,msgProp); titleStr=titleInfo[0]; commentStr=titleInfo[1]; + commentRow=StringUtil.isEmpty(titleInfo[2]) ? 0:Integer.parseInt(titleInfo[2]); } if(!StringUtil.isEmpty(titleStr)){ headerList.add(msgProp.getProperty(titleStr)==null?titleStr:msgProp.getProperty(titleStr)); commentList.add(commentStr); + commentRowList.add(commentRow); } } - initialize(title, headerList,commentList); + initialize(title, headerList,commentList,commentRowList); } /** * 构造函数 @@ -825,7 +980,7 @@ public class ExportExcel { } } - initialize(title, headerList,commentList); + initialize(title, headerList,commentList,null); } /** * 构造函数 @@ -937,7 +1092,7 @@ public class ExportExcel { headerList.add(msgProp.getProperty(titleStr)==null?titleStr:msgProp.getProperty(titleStr)); commentList.add(commentStr); } - initialize(title, headerList,commentList); + initialize(title, headerList,commentList,null); } /** @@ -946,7 +1101,7 @@ public class ExportExcel { * @param headers 表头数组 */ public ExportExcel(String title, String[] headers, String[] comments) { - initialize(title, Lists.newArrayList(headers), Lists.newArrayList(comments)); + initialize(title, Lists.newArrayList(headers), Lists.newArrayList(comments),null); } /** @@ -955,8 +1110,8 @@ public class ExportExcel { * @param headerList 表头列表 * @param commentList 注释列表 */ - public ExportExcel(String title, List headerList, List commentList) { - initialize(title, headerList,commentList); + public ExportExcel(String title, List headerList, List commentList,List commentRowList) { + initialize(title, headerList,commentList,commentRowList); } @@ -965,7 +1120,7 @@ public class ExportExcel { * @param title 表格标题,传“空值”,表示无标题 * @param headerList 表头列表 */ - private void initialize(String title, List headerList, List commentList) { + private void initialize(String title, List headerList, List commentList,List commentRowList) { this.wb = new SXSSFWorkbook(500); this.sheet = wb.createSheet("Export"); this.styles = createStyles(wb); @@ -989,10 +1144,16 @@ public class ExportExcel { Cell cell = headerRow.createCell(i); cell.setCellStyle(styles.get("header")); String commentStr = commentList.get(i); + Integer commentRow =3; + if(!StringUtil.isEmpty(commentRowList) + && !StringUtil.isEmpty(commentRowList.get(i)) + && commentRowList.get(i) > 0){ + commentRow=commentRowList.get(i); + } if (!StringUtil.isEmpty(commentStr)){ cell.setCellValue(headerList.get(i)); Comment comment = this.sheet.createDrawingPatriarch().createCellComment( - new XSSFClientAnchor(0, 0, 0, 0, (short) i, 0, (short) i+4, i+5)); + new XSSFClientAnchor(0, 0, 0, 0, (short) i, 0, (short) i+3, commentRow)); comment.setString(new XSSFRichTextString(commentStr)); cell.setCellComment(comment); }else{ diff --git a/src/main/resources/messages/message_en.properties b/src/main/resources/messages/message_en.properties index a9fb2e9d7..f3b25237d 100644 --- a/src/main/resources/messages/message_en.properties +++ b/src/main/resources/messages/message_en.properties @@ -1267,4 +1267,8 @@ alternative_values= Alternative values can be %s certificate_error=Wrong format of public key file and private key file 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. \ No newline at end of file +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 diff --git a/src/main/resources/messages/message_ru.properties b/src/main/resources/messages/message_ru.properties index 05ee99750..0a2903974 100644 --- a/src/main/resources/messages/message_ru.properties +++ b/src/main/resources/messages/message_ru.properties @@ -1287,4 +1287,8 @@ alternative_values= Alternative values can be %s certificate_error=Wrong format of public key file and private key file 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. \ No newline at end of file +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 diff --git a/src/main/resources/messages/message_zh_CN.properties b/src/main/resources/messages/message_zh_CN.properties index 0a073f3fa..ad2f2c980 100644 --- a/src/main/resources/messages/message_zh_CN.properties +++ b/src/main/resources/messages/message_zh_CN.properties @@ -1262,4 +1262,8 @@ certificate_error=\u516C\u94A5\u3001\u79C1\u94A5\u6587\u4EF6\u683C\u5F0F\u9519\u public_file_error=\u516C\u94A5\u6587\u4EF6\u683C\u5F0F\u9519\u8BEF keyframe_pic_required=\u5C1A\u672A\u9009\u62E9\u5173\u952E\u5E27\u56FE\u7247 private_file_error=\u79C1\u94A5\u6587\u4EF6\u683C\u5F0F\u9519\u8BEF -keyframe_pic_required=\u5C1A\u672A\u9009\u62E9\u5173\u952E\u5E27\u56FE\u7247 \ No newline at end of file +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