导入属性规则提示信息优化,并给出默认值

This commit is contained in:
duandongmei
2018-11-02 11:21:52 +08:00
parent c9d983f083
commit c69370aabe

View File

@@ -49,6 +49,7 @@ import com.nis.domain.FunctionServiceDict;
import com.nis.domain.SysDataDictionaryItem; import com.nis.domain.SysDataDictionaryItem;
import com.nis.domain.basics.PolicyGroupInfo; import com.nis.domain.basics.PolicyGroupInfo;
import com.nis.domain.basics.ServiceDictInfo; import com.nis.domain.basics.ServiceDictInfo;
import com.nis.domain.basics.SysDictInfo;
import com.nis.domain.configuration.DnsResStrategy; import com.nis.domain.configuration.DnsResStrategy;
import com.nis.util.Constants; import com.nis.util.Constants;
import com.nis.util.DictUtils; import com.nis.util.DictUtils;
@@ -57,6 +58,7 @@ import com.nis.util.Reflections;
import com.nis.util.StringUtil; import com.nis.util.StringUtil;
import com.nis.web.dao.FunctionServiceDictDao; import com.nis.web.dao.FunctionServiceDictDao;
import com.nis.web.dao.basics.PolicyGroupInfoDao; import com.nis.web.dao.basics.PolicyGroupInfoDao;
import com.nis.web.dao.basics.SysDictInfoDao;
import com.nis.web.dao.configuration.DnsResStrategyDao; import com.nis.web.dao.configuration.DnsResStrategyDao;
import com.nis.web.service.SpringContextHolder; import com.nis.web.service.SpringContextHolder;
import com.nis.web.service.configuration.DnsResStrategyService; import com.nis.web.service.configuration.DnsResStrategyService;
@@ -74,6 +76,8 @@ public class ExportExcel {
private static Logger log = LoggerFactory.getLogger(ExportExcel.class); private static Logger log = LoggerFactory.getLogger(ExportExcel.class);
private static DnsResStrategyDao dnsResStrategyDao = SpringContextHolder.getBean(DnsResStrategyDao.class); private static DnsResStrategyDao dnsResStrategyDao = SpringContextHolder.getBean(DnsResStrategyDao.class);
private static PolicyGroupInfoDao policyGroupInfoDao = SpringContextHolder.getBean(PolicyGroupInfoDao.class);
private static SysDictInfoDao sysDictInfoDao = SpringContextHolder.getBean(SysDictInfoDao.class);
/** /**
* 工作薄对象 * 工作薄对象
@@ -174,7 +178,7 @@ public class ExportExcel {
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+""+msgProp.getProperty(sysDataDictionaryItem.getItemValue(),sysDataDictionaryItem.getItemValue())+"\n"; commentStr=commentStr+sysDataDictionaryItem.getItemCode()+""+msgProp.getProperty(sysDataDictionaryItem.getItemValue(),sysDataDictionaryItem.getItemValue())+"\n";
index++; index++;
} }
defaultValue=p2pIpType.get(0).getItemCode()+""+msgProp.getProperty(p2pIpType.get(0).getItemValue(),p2pIpType.get(0).getItemValue())+""; defaultValue=p2pIpType.get(0).getItemCode();
} }
commentStr=msgProp.getProperty("select")+":\n"+commentStr; commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++; index++;
@@ -182,7 +186,7 @@ public class ExportExcel {
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n"; commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++; index++;
if(!StringUtil.isEmpty(defaultValue)){ if(!StringUtil.isEmpty(defaultValue)){
//2、默认值说明 //1、默认值说明
commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n"; commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
index++; index++;
} }
@@ -204,12 +208,28 @@ public class ExportExcel {
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n"; commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++; index++;
if(!StringUtil.isEmpty(defaultValue)){ if(!StringUtil.isEmpty(defaultValue)){
//2、默认值说明 //1、默认值说明
commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n"; commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
index++; index++;
index++; index++;
} }
} }
/***发现内容***/
if("replaced_content".equals(headerStr)){
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//1、非空
commentStr=commentStr+""+msgProp.getProperty("required")+"\n";
index++;
}
/***替换内容***/
if("replace_content".equals(headerStr)){
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//1、非空
commentStr=commentStr+""+msgProp.getProperty("required")+"\n";
index++;
}
//intercept replace replace_zone //intercept replace replace_zone
if("replace_zone".equals(headerStr)){ if("replace_zone".equals(headerStr)){
commentStr=""; commentStr="";
@@ -219,7 +239,7 @@ public class ExportExcel {
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+""+msgProp.getProperty(sysDataDictionaryItem.getItemValue(),sysDataDictionaryItem.getItemValue())+"\n"; commentStr=commentStr+sysDataDictionaryItem.getItemCode()+""+msgProp.getProperty(sysDataDictionaryItem.getItemValue(),sysDataDictionaryItem.getItemValue())+"\n";
index++; index++;
} }
defaultValue=interceptReplaceZone.get(0).getItemCode()+""+msgProp.getProperty(interceptReplaceZone.get(0).getItemValue(),interceptReplaceZone.get(0).getItemValue())+""; defaultValue=interceptReplaceZone.get(0).getItemCode();
} }
commentStr=msgProp.getProperty("select")+":\n"+commentStr; commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++; index++;
@@ -227,7 +247,7 @@ public class ExportExcel {
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n"; commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++; index++;
if(!StringUtil.isEmpty(defaultValue)){ if(!StringUtil.isEmpty(defaultValue)){
//2、默认值说明 //1、默认值说明
commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n"; commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
index++; index++;
index++; index++;
@@ -250,7 +270,7 @@ public class ExportExcel {
List<DnsResStrategy> resStrategys=dnsResStrategyDao.findList(null, 1,1); List<DnsResStrategy> resStrategys=dnsResStrategyDao.findList(null, 1,1);
commentStr=commentStr+"0"+""+msgProp.getProperty("no_strategy")+"\n"; commentStr=commentStr+"0"+""+msgProp.getProperty("no_strategy")+"\n";
index++; index++;
defaultValue="0"+""+msgProp.getProperty("no_strategy")+""; defaultValue="0";
if(!StringUtil.isEmpty(resStrategys)){ if(!StringUtil.isEmpty(resStrategys)){
for (DnsResStrategy dnsResStrategy : resStrategys) { for (DnsResStrategy dnsResStrategy : resStrategys) {
commentStr=commentStr+dnsResStrategy.getCfgId()+""+dnsResStrategy.getCfgDesc()+"\n"; commentStr=commentStr+dnsResStrategy.getCfgId()+""+dnsResStrategy.getCfgDesc()+"\n";
@@ -292,11 +312,44 @@ public class ExportExcel {
index++; index++;
} }
if("bps_threadshold".equals(headerStr)){ if("bps_threadshold".equals(headerStr)){
commentStr=msgProp.getProperty("input_integer")+":\n"+commentStr; commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
commentStr=commentStr+msgProp.getProperty("input_integer")+"\n";
index++; index++;
} }
if("pps_threadshold".equals(headerStr)){ if("pps_threadshold".equals(headerStr)){
commentStr=msgProp.getProperty("input_integer")+":\n"+commentStr; commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
commentStr=commentStr+msgProp.getProperty("input_integer")+"\n";
index++;
}
if("group".equals(headerStr)) {
commentStr="";
//查询ip复用地址池配置的policyGroup列表
List<PolicyGroupInfo> list=policyGroupInfoDao.findPolicyGroupInfosByType(2);
if(!StringUtil.isEmpty(list)){
for (PolicyGroupInfo policyGroupInfo : list) {
commentStr=commentStr+policyGroupInfo.getGroupId()+""+policyGroupInfo.getGroupName()+"\n";
index++;
}
}
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
}
if("isp".equals(headerStr)) {
commentStr="";
List<Integer> itTypeList = new ArrayList<Integer>();
itTypeList.add(Constants.ITEM_TYPE_ISP);
SysDictInfo sysDictInfo=new SysDictInfo();
sysDictInfo.setConditionType(itTypeList);
List<SysDictInfo> isps=sysDictInfoDao.findAllSysDictInfo(sysDictInfo,null);
if(!StringUtil.isEmpty(isps)){
for (SysDictInfo _sysDictInfo : isps) {
commentStr=commentStr+_sysDictInfo.getItemCode()+""+_sysDictInfo.getItemValue()+"\n";
index++;
}
}
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++; index++;
} }
if(region.getRegionType().equals(1)){//IP配置 if(region.getRegionType().equals(1)){//IP配置
@@ -318,28 +371,46 @@ public class ExportExcel {
if((","+region.getConfigIpType()+",").indexOf(",4,") > -1){ if((","+region.getConfigIpType()+",").indexOf(",4,") > -1){
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){ if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_VALUE+"IPv4"+"\n"; commentStr=commentStr+Constants.IPV4_DEFAULT_IP_VALUE+"IPv4"+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV4_DEFAULT_IP_VALUE;
}
index++; index++;
} }
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){ if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv4_range_tip")+""+"\n"; commentStr=commentStr+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv4_range_tip")+""+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV4_DEFAULT_IP_RANGE_VALUE;
}
index++; index++;
} }
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){ if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv4_subnet_tip")+""+"\n"; commentStr=commentStr+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv4_subnet_tip")+""+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV4_DEFAULT_IP_SUBNET_VALUE;
}
index++; index++;
} }
} }
if((","+region.getConfigIpType()+",").indexOf(",6,") > -1){ if((","+region.getConfigIpType()+",").indexOf(",6,") > -1){
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){ if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_VALUE+"IPv6"+"\n"; commentStr=commentStr+Constants.IPV6_DEFAULT_IP_VALUE+"IPv6"+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV6_DEFAULT_IP_VALUE;
}
index++; index++;
} }
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){ if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv6_range_tip")+""+"\n"; commentStr=commentStr+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv6_range_tip")+""+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV6_DEFAULT_IP_RANGE_VALUE;
}
index++; index++;
} }
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){ if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv6_subnet_tip")+""+"\n\n"; commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv6_subnet_tip")+""+"\n\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV6_DEFAULT_IP_SUBNET_VALUE;
}
index++; index++;
} }
} }
@@ -372,32 +443,46 @@ public class ExportExcel {
index++; index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n"; commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++; index++;
//1、源IP和目的IP不能相同 //1、默认值说明
commentStr=commentStr+""+String.format(msgProp.getProperty("are_the_same") if(!StringUtil.isEmpty(defaultValue)){
, msgProp.getProperty("clientip") commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
,msgProp.getProperty("serverip"))+"\n"; index++;
index++; }
index++; //2、源IP和目的IP不能相同
//2、源IP和目的IP IP类型和IP格式必须一致 if(((","+region.getConfigIpPortShow()+",").indexOf(",1,") > -1) && ((","+region.getConfigIpPortShow()+",").indexOf(",3,") > -1)){
commentStr=commentStr+""+String.format(msgProp.getProperty("the_same_ip_type_pattern"))+"\n"; commentStr=commentStr+""+String.format(msgProp.getProperty("are_the_same")
index++; , msgProp.getProperty("clientip")
index++; ,msgProp.getProperty("serverip"))+"\n";
//3、IP Range 开始IP和结束IP必须在同一网段 index++;
commentStr=commentStr+""+msgProp.getProperty("ip_range")+","+msgProp.getProperty("ip_range_bit_field")+"\n"; index++;
index++; commentStr=commentStr+""+String.format(msgProp.getProperty("the_same_ip_type_pattern"))+"\n";
index++; index++;
//4、IP Range 开始IP必须小于结束IP index++;
commentStr=commentStr+""+msgProp.getProperty("ip_range")+","+msgProp.getProperty("ip_range_smaller")+"\n"; }
index++; //4、IP Range 开始IP和结束IP必须在同一网段
index++; if(((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1)){
//5、IPv4 Mask 掩码范围16-32 commentStr=commentStr+""+msgProp.getProperty("ip_range")+","+msgProp.getProperty("ip_range_bit_field")+"\n";
commentStr=commentStr+""+msgProp.getProperty("ipv4_subnet_tip")+","+msgProp.getProperty("ipv4_mask_range_tip")+"\n"; index++;
index++; index++;
index++; //5、IP Range 开始IP必须小于结束IP
//6、IPv6 Mask 掩码范围2-128 commentStr=commentStr+""+msgProp.getProperty("ip_range")+","+msgProp.getProperty("ip_range_smaller")+"\n";
commentStr=commentStr+""+msgProp.getProperty("ipv6_subnet_tip")+","+msgProp.getProperty("ipv6_mask_range_tip")+"\n"; index++;
index++; index++;
index++; }
//6、IPv4 Mask 掩码范围16-32
if(((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1)){
if(((","+region.getConfigIpType()+",").indexOf(",4,") > -1)){
commentStr=commentStr+""+msgProp.getProperty("ipv4_subnet_tip")+","+msgProp.getProperty("ipv4_mask_range_tip")+"\n";
index++;
index++;
}
if(((","+region.getConfigIpType()+",").indexOf(",6,") > -1)){
commentStr=commentStr+""+msgProp.getProperty("ipv6_subnet_tip")+","+msgProp.getProperty("ipv6_mask_range_tip")+"\n";
index++;
index++;
}
}
} }
} }
@@ -407,28 +492,46 @@ public class ExportExcel {
if((","+region.getConfigIpType()+",").indexOf(",4,") > -1){ if((","+region.getConfigIpType()+",").indexOf(",4,") > -1){
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){ if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_VALUE+"IPv4"+"\n"; commentStr=commentStr+Constants.IPV4_DEFAULT_IP_VALUE+"IPv4"+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV4_DEFAULT_IP_VALUE+"IPv4";
}
index++; index++;
} }
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){ if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv4_range_tip")+""+"\n"; commentStr=commentStr+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv4_range_tip")+""+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV4_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv4_range_tip");
}
index++; index++;
} }
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){ if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv4_subnet_tip")+""+"\n"; commentStr=commentStr+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv4_subnet_tip")+""+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv4_subnet_tip")+"";
}
index++; index++;
} }
} }
if((","+region.getConfigIpType()+",").indexOf(",6,") > -1){ if((","+region.getConfigIpType()+",").indexOf(",6,") > -1){
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){ if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_VALUE+"IPv6"+"\n"; commentStr=commentStr+Constants.IPV6_DEFAULT_IP_VALUE+"IPv6"+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV6_DEFAULT_IP_VALUE+"IPv6";
}
index++; index++;
} }
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){ if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv6_range_tip")+""+"\n"; commentStr=commentStr+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv6_range_tip")+""+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV6_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv6_range_tip")+"";
}
index++; index++;
} }
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){ if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv6_subnet_tip")+""+"\n\n"; commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv6_subnet_tip")+""+"\n\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv6_subnet_tip")+"";
}
index++; index++;
} }
} }
@@ -445,43 +548,75 @@ public class ExportExcel {
index++; index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n"; commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++; index++;
//1、源IP和目的IP不能相同 //1、默认值说明
commentStr=commentStr+""+String.format(msgProp.getProperty("are_the_same") if(!StringUtil.isEmpty(defaultValue)){
, msgProp.getProperty("clientip") commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
,msgProp.getProperty("serverip"))+"\n"; index++;
index++; }
index++; //2、源IP和目的IP不能相同
//2、源IP和目的IP IP类型和IP格式必须一致 if(((","+region.getConfigIpPortShow()+",").indexOf(",1,") > -1) && ((","+region.getConfigIpPortShow()+",").indexOf(",3,") > -1)){
commentStr=commentStr+""+String.format(msgProp.getProperty("the_same_ip_type_pattern"))+"\n"; commentStr=commentStr+""+String.format(msgProp.getProperty("are_the_same")
index++; , msgProp.getProperty("clientip")
index++; ,msgProp.getProperty("serverip"))+"\n";
//3、IP Range 开始IP和结束IP必须在同一网段 index++;
commentStr=commentStr+""+msgProp.getProperty("ip_range")+","+msgProp.getProperty("ip_range_bit_field")+"\n"; index++;
index++; commentStr=commentStr+""+String.format(msgProp.getProperty("the_same_ip_type_pattern"))+"\n";
index++; index++;
//4、IP Range 开始IP必须小于结束IP index++;
commentStr=commentStr+""+msgProp.getProperty("ip_range")+","+msgProp.getProperty("ip_range_smaller")+"\n"; }
index++; //4、IP Range 开始IP和结束IP必须在同一网段
index++; if(((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1)){
//5、IPv4 Mask 掩码范围16-32 commentStr=commentStr+""+msgProp.getProperty("ip_range")+","+msgProp.getProperty("ip_range_bit_field")+"\n";
commentStr=commentStr+""+msgProp.getProperty("ipv4_subnet_tip")+","+msgProp.getProperty("ipv4_mask_range_tip")+"\n"; index++;
index++; index++;
index++; //5、IP Range 开始IP必须小于结束IP
//6、IPv6 Mask 掩码范围2-128 commentStr=commentStr+""+msgProp.getProperty("ip_range")+","+msgProp.getProperty("ip_range_smaller")+"\n";
commentStr=commentStr+""+msgProp.getProperty("ipv6_subnet_tip")+","+msgProp.getProperty("ipv6_mask_range_tip")+"\n"; index++;
index++; index++;
index++; }
//6、IPv4 Mask 掩码范围16-32
if(((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1)){
if(((","+region.getConfigIpType()+",").indexOf(",4,") > -1)){
commentStr=commentStr+""+msgProp.getProperty("ipv4_subnet_tip")+","+msgProp.getProperty("ipv4_mask_range_tip")+"\n";
index++;
index++;
}
if(((","+region.getConfigIpType()+",").indexOf(",6,") > -1)){
commentStr=commentStr+""+msgProp.getProperty("ipv6_subnet_tip")+","+msgProp.getProperty("ipv6_mask_range_tip")+"\n";
index++;
index++;
}
}
} }
} }
//4、协议
String protocol=region.getConfigProtocol();
if(region.getFunctionId().equals(5) ){
//ip block tcp
if(service.getAction().equals(16) ){
protocol="6";
}else{
protocol=region.getConfigProtocol();
}
}else{
protocol=region.getConfigProtocol();
}
if("client_port".equals(headerStr)){ if("client_port".equals(headerStr)){
if(((","+region.getConfigIpPortShow()+",").indexOf(",2,") > -1)){ if(((","+region.getConfigIpPortShow()+",").indexOf(",2,") > -1)){
commentStr=""; commentStr="";
if((","+region.getConfigPortPattern()+",").indexOf(",1,") > -1){ if((","+region.getConfigPortPattern()+",").indexOf(",1,") > -1){
commentStr=commentStr+Constants.PORT_DEFAULT+"Port)"+"\n"; commentStr=commentStr+Constants.PORT_DEFAULT+"Port"+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.PORT_DEFAULT;
}
index++; index++;
} }
if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){ if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"Port/"+msgProp.getProperty("port_mask")+""+"\n\n"; commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"Port/"+msgProp.getProperty("port_mask")+""+"\n\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.PORT_MASK_DEFAULT;
}
index++; index++;
} }
}else{ }else{
@@ -497,29 +632,65 @@ public class ExportExcel {
index++; index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n"; commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++; index++;
//1、源端口、目的端口格式必须一致 //1、默认值说明
commentStr=commentStr+""+msgProp.getProperty("the_same_port_pattern")+"\n"; if(!StringUtil.isEmpty(defaultValue)){
index++; commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
index++; index++;
//2、端口和端口掩码范围0-65535 }
//2、源端口、目的端口格式必须一致
if(((","+region.getConfigIpPortShow()+",").indexOf(",2,") > -1) && ((","+region.getConfigIpPortShow()+",").indexOf(",4,") > -1)){
commentStr=commentStr+""+msgProp.getProperty("the_same_port_pattern")+"\n";
index++;
index++;
}
//3、端口和端口掩码范围0-65535
commentStr=commentStr+""+msgProp.getProperty("port_mask_comment_tip")+"\n"; commentStr=commentStr+""+msgProp.getProperty("port_mask_comment_tip")+"\n";
index++; index++;
index++; index++;
//2、端口和端口掩码范围0-65535 //protocol 非tcp 和 udp必须为o
commentStr=commentStr+""+msgProp.getProperty("protocol_and_port")+"\n"; //协议大于1个excel不会隐藏需提示协议和端口的关系
index++; if(protocol.split(",").length > 1){
index++; if(((","+protocol+",").indexOf(",6,")>-1) ||((","+protocol+",").indexOf(",17,")>-1)){
commentStr=commentStr+""+msgProp.getProperty("port_comment_tip")+"\n";
index++;
index++;
commentStr=commentStr+""+msgProp.getProperty("protocol_and_port")+"\n";
index++;
index++;
}else{
commentStr=commentStr+""+msgProp.getProperty("no_tc_udp_port_comment_tip")+"\n";
index++;
index++;
}
}else{
if(((","+protocol+",").indexOf(",6,")>-1) ||((","+protocol+",").indexOf(",17,")>-1)){
commentStr=commentStr+""+msgProp.getProperty("port_comment_tip")+"\n";
index++;
index++;
}else{
commentStr=commentStr+""+msgProp.getProperty("no_tc_udp_port_comment_tip")+"\n";
index++;
index++;
}
}
} }
} }
if("server_port".equals(headerStr)){ if("server_port".equals(headerStr)){
if((","+region.getConfigIpPortShow()+",").indexOf(",4,") > -1){ if((","+region.getConfigIpPortShow()+",").indexOf(",4,") > -1){
commentStr=""; commentStr="";
if((","+region.getConfigPortPattern()+",").indexOf(",1,") > -1){ if((","+region.getConfigPortPattern()+",").indexOf(",1,") > -1){
commentStr=commentStr+Constants.PORT_DEFAULT+"Port)"+"\n"; commentStr=commentStr+Constants.PORT_DEFAULT+"Port"+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.PORT_DEFAULT;
}
index++; index++;
} }
if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){ if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"Port/"+msgProp.getProperty("port_mask")+""+"\n\n"; commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"Port/"+msgProp.getProperty("port_mask")+""+"\n\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.PORT_MASK_DEFAULT;
}
index++; index++;
} }
}else{ }else{
@@ -535,15 +706,47 @@ public class ExportExcel {
index++; index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n"; commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++; index++;
commentStr=commentStr+""+msgProp.getProperty("the_same_port_pattern")+"\n"; //1、默认值说明
index++; if(!StringUtil.isEmpty(defaultValue)){
index++; commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
index++;
}
//2、源端口、目的端口格式必须一致
if(((","+region.getConfigIpPortShow()+",").indexOf(",2,") > -1) && ((","+region.getConfigIpPortShow()+",").indexOf(",4,") > -1)){
commentStr=commentStr+""+msgProp.getProperty("the_same_port_pattern")+"\n";
index++;
index++;
}
//3、端口和端口掩码范围0-65535
commentStr=commentStr+""+msgProp.getProperty("port_mask_comment_tip")+"\n"; commentStr=commentStr+""+msgProp.getProperty("port_mask_comment_tip")+"\n";
index++; index++;
index++; index++;
commentStr=commentStr+""+msgProp.getProperty("protocol_and_port")+"\n"; //protocol 非tcp 和 udp必须为o
index++; //协议大于1个excel不会隐藏需提示协议和端口的关系
index++; if(protocol.split(",").length > 1){
if(((","+protocol+",").indexOf(",6,")>-1) ||((","+protocol+",").indexOf(",17,")>-1)){
commentStr=commentStr+""+msgProp.getProperty("port_comment_tip")+"\n";
index++;
index++;
commentStr=commentStr+""+msgProp.getProperty("protocol_and_port")+"\n";
index++;
index++;
}else{
commentStr=commentStr+""+msgProp.getProperty("no_tc_udp_port_comment_tip")+"\n";
index++;
index++;
}
}else{
if(((","+protocol+",").indexOf(",6,")>-1) ||((","+protocol+",").indexOf(",17,")>-1)){
commentStr=commentStr+""+msgProp.getProperty("port_comment_tip")+"\n";
index++;
index++;
}else{
commentStr=commentStr+""+msgProp.getProperty("no_tc_udp_port_comment_tip")+"\n";
index++;
index++;
}
}
} }
} }
} }
@@ -567,6 +770,9 @@ public class ExportExcel {
} }
} }
}*/ }*/
if(StringUtil.isEmpty(defaultValue)){
defaultValue="6";
}
}else{ }else{
commentStr=""; commentStr="";
List<SysDataDictionaryItem> protocol=DictUtils.getDictList("PROTOCOL"); List<SysDataDictionaryItem> protocol=DictUtils.getDictList("PROTOCOL");
@@ -583,6 +789,19 @@ public class ExportExcel {
} }
} }
if(StringUtil.isEmpty(defaultValue)){
if((","+region.getConfigProtocol()+",").indexOf("0") > -1){
defaultValue="0";
}else if((","+region.getConfigProtocol()+",").indexOf("6") > -1){
defaultValue="6";
}else if((","+region.getConfigProtocol()+",").indexOf("17") > -1){
defaultValue="17";
}else if((","+region.getConfigProtocol()+",").indexOf("17") > -1){
defaultValue=region.getConfigProtocol().split(",")[0];
}
}
} }
} }
}else{ }else{
@@ -606,6 +825,19 @@ public class ExportExcel {
} }
} }
} }
if(StringUtil.isEmpty(defaultValue)){
if((","+region.getConfigProtocol()+",").indexOf("0") > -1){
defaultValue="0";
}else if((","+region.getConfigProtocol()+",").indexOf("6") > -1){
defaultValue="6";
}else if((","+region.getConfigProtocol()+",").indexOf("17") > -1){
defaultValue="17";
}else if((","+region.getConfigProtocol()+",").indexOf("17") > -1){
defaultValue=region.getConfigProtocol().split(",")[0];
}
}
} }
} }
if(StringUtil.isEmpty(commentStr) if(StringUtil.isEmpty(commentStr)
@@ -615,6 +847,14 @@ public class ExportExcel {
}else{ }else{
commentStr=msgProp.getProperty("select")+":\n"+commentStr; commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++; index++;
index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//1、默认值说明
if(!StringUtil.isEmpty(defaultValue)){
commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
index++;
}
} }
} }
@@ -642,6 +882,9 @@ public class ExportExcel {
headerStr=""; headerStr="";
commentStr=""; commentStr="";
} }
if(StringUtil.isEmpty(defaultValue)){
defaultValue="0";
}
} }
} }
if(StringUtil.isEmpty(commentStr)){ if(StringUtil.isEmpty(commentStr)){
@@ -650,6 +893,14 @@ public class ExportExcel {
}else{ }else{
commentStr=msgProp.getProperty("select")+":\n"+commentStr; commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++; index++;
index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//1、默认值说明
if(!StringUtil.isEmpty(defaultValue)){
commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
index++;
}
} }
} }
@@ -666,7 +917,7 @@ public class ExportExcel {
commentStr=commentStr+districtStr+"\n"; commentStr=commentStr+districtStr+"\n";
index++; index++;
} }
defaultValue=region.getConfigDistrict().split(",")[0];
} }
if(StringUtil.isEmpty(commentStr)){ if(StringUtil.isEmpty(commentStr)){
headerStr=""; headerStr="";
@@ -674,6 +925,17 @@ public class ExportExcel {
}else{ }else{
commentStr=msgProp.getProperty("select")+":\n"+commentStr; commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++; index++;
index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//1、非空说明
commentStr=commentStr+""+msgProp.getProperty("required")+"\n";
index++;
//2、默认值说明
if(!StringUtil.isEmpty(defaultValue)){
commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
index++;
}
} }
} }
} }
@@ -708,7 +970,7 @@ public class ExportExcel {
} }
//expr type //expr type
if("expression_type".equals(headerStr)){ /*if("expression_type".equals(headerStr)){
if(StringUtil.isEmpty(region.getConfigExprType()) if(StringUtil.isEmpty(region.getConfigExprType())
||(region.getConfigExprType().split(",").length==1)){ ||(region.getConfigExprType().split(",").length==1)){
headerStr=""; headerStr="";
@@ -727,6 +989,7 @@ public class ExportExcel {
index++; index++;
} }
} }
defaultValue=region.getConfigExprType().split(",")[0];
} }
} }
if(StringUtil.isEmpty(commentStr)){ if(StringUtil.isEmpty(commentStr)){
@@ -735,8 +998,19 @@ public class ExportExcel {
}else{ }else{
commentStr=msgProp.getProperty("select")+":\n"+commentStr; commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++; index++;
index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//1、非空说明
commentStr=commentStr+"▶"+msgProp.getProperty("required")+"\n";
index++;
//2、默认值说明
if(!StringUtil.isEmpty(defaultValue)){
commentStr=commentStr+"▶"+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
index++;
}
} }
} }*/
//match method //match method
if("match_method".equals(headerStr)){ if("match_method".equals(headerStr)){
if(StringUtil.isEmpty(region.getConfigMatchMethod()) if(StringUtil.isEmpty(region.getConfigMatchMethod())
@@ -757,6 +1031,13 @@ public class ExportExcel {
index++; index++;
} }
} }
if(StringUtil.isEmpty(defaultValue)){
if((","+region.getConfigMatchMethod()+",").indexOf("0") > -1){
defaultValue="0";
}else{
defaultValue=region.getConfigMatchMethod().split(",")[0];
}
}
} }
if(StringUtil.isEmpty(commentStr)){ if(StringUtil.isEmpty(commentStr)){
headerStr=""; headerStr="";
@@ -764,6 +1045,14 @@ public class ExportExcel {
}else{ }else{
commentStr=msgProp.getProperty("select")+":\n"+commentStr; commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++; index++;
index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//2、默认值说明
if(!StringUtil.isEmpty(defaultValue)){
commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
index++;
}
} }
} }
} }
@@ -810,6 +1099,12 @@ public class ExportExcel {
}else{ }else{
commentStr=msgProp.getProperty("select")+":\n"+commentStr; commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++; index++;
index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//2、默认值说明
commentStr=commentStr+""+msgProp.getProperty("default_value")+":0\n";
index++;
} }
} }
if("is_case_insenstive".equals(headerStr)){ if("is_case_insenstive".equals(headerStr)){
@@ -854,6 +1149,12 @@ public class ExportExcel {
}else{ }else{
commentStr=msgProp.getProperty("select")+":\n"+commentStr; commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++; index++;
index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//2、默认值说明
commentStr=commentStr+""+msgProp.getProperty("default_value")+":0\n";
index++;
} }
} }
} }