develop

Conflicts:
	src/main/resources/messages/message_en.properties
	src/main/resources/messages/message_ru.properties
	src/main/resources/messages/message_zh_CN.properties
	excel导入提示信息补全,单个字典数据不需要导入
	去掉是否表达式的导入,根据关键词单个和多个区分
This commit is contained in:
duandongmei
2018-10-23 14:14:08 +08:00
84 changed files with 908 additions and 1441 deletions

View File

@@ -174,10 +174,10 @@ public class ExportExcel {
if(interceptReplaceZone !=null && interceptReplaceZone.size()>0){
for (SysDataDictionaryItem sysDataDictionaryItem : interceptReplaceZone) {
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++;
}
}
@@ -203,7 +203,7 @@ public class ExportExcel {
commentStr="";
}else{
for (DnsResStrategy dnsResStrategy : resStrategys) {
commentStr=commentStr+dnsResStrategy.getCfgId()+":"+dnsResStrategy.getCfgDesc()+"\n";
commentStr=commentStr+dnsResStrategy.getCfgId()+""+dnsResStrategy.getCfgDesc()+"\n";
index++;
}
}
@@ -239,11 +239,11 @@ public class ExportExcel {
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv4_range")+""+"\n";
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv4_range_tip")+""+"\n";
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv4_subnet")+""+"\n";
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv4_subnet_tip")+""+"\n";
index++;
}
}
@@ -253,11 +253,11 @@ public class ExportExcel {
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv6_range")+""+"\n";
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv6_range_tip")+""+"\n";
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv6_subnet")+""+"\n";
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv6_subnet_tip")+""+"\n\n";
index++;
}
}
@@ -269,13 +269,10 @@ public class ExportExcel {
headerStr="";
commentStr="";
}else{
commentStr=msgProp.getProperty("example")+":\n"+commentStr;
index++;
/**TODO
规则:
index++;
commentStr=msgProp.getProperty("example")+":\n"+commentStr;
commentStr=msgProp.getProperty("example_tip")+":\n"+commentStr;
index++;
1、源ip和目的ip不能相等
index++;
@@ -288,6 +285,37 @@ public class ExportExcel {
5、IPv6 Mask 掩码范围2-128
index++;
*/
commentStr=msgProp.getProperty("example_tip")+":\n"+commentStr;
index++;
index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//1、源IP和目的IP不能相同
commentStr=commentStr+""+String.format(msgProp.getProperty("are_the_same")
, msgProp.getProperty("clientip")
,msgProp.getProperty("serverip"))+"\n";
index++;
index++;
//2、源IP和目的IP IP类型和IP格式必须一致
commentStr=commentStr+""+String.format(msgProp.getProperty("the_same_ip_type_pattern"))+"\n";
index++;
index++;
//3、IP Range 开始IP和结束IP必须在同一网段
commentStr=commentStr+""+msgProp.getProperty("ip_range")+","+msgProp.getProperty("ip_range_bit_field")+"\n";
index++;
index++;
//4、IP Range 开始IP必须小于结束IP
commentStr=commentStr+""+msgProp.getProperty("ip_range")+","+msgProp.getProperty("ip_range_smaller")+"\n";
index++;
index++;
//5、IPv4 Mask 掩码范围16-32
commentStr=commentStr+""+msgProp.getProperty("ipv4_subnet_tip")+","+msgProp.getProperty("ipv4_mask_range_tip")+"\n";
index++;
index++;
//6、IPv6 Mask 掩码范围2-128
commentStr=commentStr+""+msgProp.getProperty("ipv6_subnet_tip")+","+msgProp.getProperty("ipv6_mask_range_tip")+"\n";
index++;
index++;
}
}
@@ -300,11 +328,11 @@ public class ExportExcel {
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv4_range")+""+"\n";
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv4_range_tip")+""+"\n";
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_tip")+""+"\n";
index++;
}
}
@@ -314,11 +342,11 @@ public class ExportExcel {
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv6_range")+""+"\n";
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv6_range_tip")+""+"\n";
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv6_subnet")+""+"\n";
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv6_subnet_tip")+""+"\n\n";
index++;
}
}
@@ -330,22 +358,37 @@ public class ExportExcel {
headerStr="";
commentStr="";
}else{
commentStr=msgProp.getProperty("example")+":\n"+commentStr;
commentStr=msgProp.getProperty("example_tip")+":\n"+commentStr;
index++;
/**TODO
规则:
index++;
1、源ip和目的ip不能相等
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
2、源ip和目的ip格式必须一致
//1、源IP和目的IP不能相同
commentStr=commentStr+""+String.format(msgProp.getProperty("are_the_same")
, msgProp.getProperty("clientip")
,msgProp.getProperty("serverip"))+"\n";
index++;
3、IPv4 Range 必须是C段IP
index++;
4、IPv4 Mask 掩码范围16-32
//2、源IP和目的IP IP类型和IP格式必须一致
commentStr=commentStr+""+String.format(msgProp.getProperty("the_same_ip_type_pattern"))+"\n";
index++;
index++;
//3、IP Range 开始IP和结束IP必须在同一网段
commentStr=commentStr+""+msgProp.getProperty("ip_range")+","+msgProp.getProperty("ip_range_bit_field")+"\n";
index++;
index++;
//4、IP Range 开始IP必须小于结束IP
commentStr=commentStr+""+msgProp.getProperty("ip_range")+","+msgProp.getProperty("ip_range_smaller")+"\n";
index++;
index++;
//5、IPv4 Mask 掩码范围16-32
commentStr=commentStr+""+msgProp.getProperty("ipv4_subnet_tip")+","+msgProp.getProperty("ipv4_mask_range_tip")+"\n";
index++;
index++;
//6、IPv6 Mask 掩码范围2-128
commentStr=commentStr+""+msgProp.getProperty("ipv6_subnet_tip")+","+msgProp.getProperty("ipv6_mask_range_tip")+"\n";
index++;
5、IPv6 Mask 掩码范围2-128
index++;
*/
}
}
if("client_port".equals(headerStr)){
@@ -356,7 +399,7 @@ public class ExportExcel {
index++;
}
if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"Port/"+msgProp.getProperty("port_subnet")+""+"\n";
commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"Port/"+msgProp.getProperty("port_mask")+""+"\n\n";
index++;
}
}else{
@@ -367,20 +410,23 @@ public class ExportExcel {
headerStr="";
commentStr="";
}else{
commentStr=msgProp.getProperty("example")+":\n"+commentStr;
commentStr=msgProp.getProperty("example_tip")+":\n"+commentStr;
index++;
/**TODO
规则:
index++;
1、源端口和目的端口格式必须一致
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
2、端口范围0-65535
//1、源端口、目的端口格式必须一致
commentStr=commentStr+""+msgProp.getProperty("the_same_port_pattern")+"\n";
index++;
3、端口掩码范围0-65535
index++;
4、非TCP、UDP、ALL协议端口必须为0
//2、端口和端口掩码范围0-65535
commentStr=commentStr+""+msgProp.getProperty("port_mask_comment_tip")+"\n";
index++;
index++;
//2、端口和端口掩码范围0-65535
commentStr=commentStr+""+msgProp.getProperty("protocol_and_port")+"\n";
index++;
index++;
*/
}
}
if("server_port".equals(headerStr)){
@@ -391,25 +437,32 @@ public class ExportExcel {
index++;
}
if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"Port/"+msgProp.getProperty("port_subnet")+""+"\n";
commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"Port/"+msgProp.getProperty("port_mask")+""+"\n\n";
index++;
}
}else{
headerStr="";
commentStr="";
}
/**TODO
规则:
index++;
1、源端口和目的端口格式必须一致
index++;
2、端口范围0-65535
index++;
3、端口掩码范围0-65535
index++;
4、非TCP、UDP、ALL协议端口必须为0
index++;
*/
if(StringUtil.isEmpty(commentStr)){
headerStr="";
commentStr="";
}else{
commentStr=msgProp.getProperty("example_tip")+":\n"+commentStr;
index++;
index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
commentStr=commentStr+""+msgProp.getProperty("the_same_port_pattern")+"\n";
index++;
index++;
commentStr=commentStr+""+msgProp.getProperty("port_mask_comment_tip")+"\n";
index++;
index++;
commentStr=commentStr+""+msgProp.getProperty("protocol_and_port")+"\n";
index++;
index++;
}
}
}
//导入的Protocol
@@ -418,15 +471,20 @@ public class ExportExcel {
commentStr="";
//ip block tcp
if(service.getAction().equals(16) ){
List<SysDataDictionaryItem> protocol=DictUtils.getDictList("PROTOCOL");
/**
*block 只有TCP不需要导入
* */
headerStr="";
commentStr="";
/*List<SysDataDictionaryItem> protocol=DictUtils.getDictList("PROTOCOL");
if(protocol !=null && protocol.size()>0){
for (SysDataDictionaryItem sysDataDictionaryItem : protocol) {
if(sysDataDictionaryItem.getItemCode().equals(6)){
if(sysDataDictionaryItem.getItemCode().equals("6")){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+""+sysDataDictionaryItem.getItemValue()+""+"\n";
index++;
}
}
}
}*/
}else{
commentStr="";
List<SysDataDictionaryItem> protocol=DictUtils.getDictList("PROTOCOL");
@@ -468,7 +526,8 @@ public class ExportExcel {
}
}
}
if(StringUtil.isEmpty(commentStr)){
if(StringUtil.isEmpty(commentStr)
||(region.getConfigProtocol().split(",").length==1)){
headerStr="";
commentStr="";
}else{
@@ -479,7 +538,8 @@ public class ExportExcel {
//Direction
if("direction".equals(headerStr)){
if(StringUtil.isEmpty(region.getConfigDirection())){
if(StringUtil.isEmpty(region.getConfigDirection())
||(region.getConfigDirection().split(",").length==1)){
headerStr="";
commentStr="";
}else{
@@ -515,12 +575,16 @@ public class ExportExcel {
}else if(region.getRegionType().equals(2) || region.getRegionType().equals(3)){
if(region.getRegionType().equals(3)){
if("district".equals(headerStr)){
if(StringUtil.isEmpty(region.getConfigDistrict())){
if(StringUtil.isEmpty(region.getConfigDistrict())
||(region.getConfigDistrict().split(",").length==1)){
headerStr="";
commentStr="";
}else{
commentStr=region.getConfigDistrict();
index++;
for (String districtStr : region.getConfigDistrict().split(",")) {
commentStr=commentStr+districtStr+"\n";
index++;
}
}
if(StringUtil.isEmpty(commentStr)){
headerStr="";
@@ -532,8 +596,39 @@ public class ExportExcel {
}
}
//expr type
if("key_word".equals(headerStr)){
if(!StringUtil.isEmpty(region.getConfigMultiKeywords())){
if(region.getConfigMultiKeywords().equals(1)){//多关键字输入TODO
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//允许输入多关键字,多个关键字用换行表示
commentStr=commentStr+""+msgProp.getProperty("multi_keywords_tip")+"\n";
index++;
index++;
//单个关键字不允许输入不可见字符
commentStr=commentStr+""+msgProp.getProperty("visible_keyword_tip")+"\n";
index++;
index++;
}else{
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
index++;
//只允许输入单个关键字
commentStr=commentStr+""+msgProp.getProperty("single_keyword_tip")+"\n";
index++;
index++;
//单个关键字不允许输入不可见字符
commentStr=commentStr+""+msgProp.getProperty("visible_keyword_tip")+"\n";
index++;
}
}
}
//expr type
if("expression_type".equals(headerStr)){
if(StringUtil.isEmpty(region.getConfigExprType())){
if(StringUtil.isEmpty(region.getConfigExprType())
||(region.getConfigExprType().split(",").length==1)){
headerStr="";
commentStr="";
}else{
@@ -562,7 +657,8 @@ public class ExportExcel {
}
//match method
if("match_method".equals(headerStr)){
if(StringUtil.isEmpty(region.getConfigMatchMethod())){
if(StringUtil.isEmpty(region.getConfigMatchMethod())
||(region.getConfigMatchMethod().split(",").length==1)){
headerStr="";
commentStr="";
}else{
@@ -591,6 +687,7 @@ public class ExportExcel {
}
//ishex
if("is_hex".equals(headerStr)){
List<String> list=new ArrayList<String>();
if(StringUtil.isEmpty(region.getConfigHex())){
headerStr="";
commentStr="";
@@ -602,14 +699,22 @@ public class ExportExcel {
for (SysDataDictionaryItem sysDataDictionaryItem : isHex) {
if(sysDataDictionaryItem.getItemCode().equals("1")){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+""+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+""+"\n";
list.add(sysDataDictionaryItem.getItemCode());
index++;
}
if(region.getConfigHex().split(",").length>1){
if(sysDataDictionaryItem.getItemCode().equals("0")){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+""+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+""+"\n";
list.add(sysDataDictionaryItem.getItemCode());
index++;
}
}
}
}
if(!((","+region.getConfigHex()+",").indexOf(",1,") >-1)){
}else{
for (SysDataDictionaryItem sysDataDictionaryItem : isHex) {
if(sysDataDictionaryItem.getItemCode().equals("0")){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+""+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+""+"\n";
list.add(sysDataDictionaryItem.getItemCode());
index++;
}
}
@@ -617,7 +722,7 @@ public class ExportExcel {
}
}
if(StringUtil.isEmpty(commentStr)){
if(StringUtil.isEmpty(commentStr) || (!StringUtil.isEmpty(list) && list.size()==1)){
headerStr="";
commentStr="";
}else{
@@ -626,6 +731,7 @@ public class ExportExcel {
}
}
if("is_case_insenstive".equals(headerStr)){
List<String> list=new ArrayList<String>();
if(StringUtil.isEmpty(region.getConfigHex())){
headerStr="";
commentStr="";
@@ -633,17 +739,22 @@ public class ExportExcel {
commentStr="";
List<SysDataDictionaryItem> isCaseSenstive=DictUtils.getDictList("CASE_INSENSTIVE");
if(isCaseSenstive !=null && isCaseSenstive.size()>0){
if(((","+region.getConfigHex()+",").indexOf(",2,") >-1)){
if(((","+region.getConfigHex()+",").indexOf(",0,") >-1)){
for (SysDataDictionaryItem sysDataDictionaryItem : isCaseSenstive) {
if(sysDataDictionaryItem.getItemCode().equals("1")){
if(sysDataDictionaryItem.getItemCode().equals("0")){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+""+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+""+"\n";
index++;
}
if(region.getConfigHex().split(",").length>1){
if(sysDataDictionaryItem.getItemCode().equals("1")){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+""+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+""+"\n";
index++;
}
}
}
}
if(!((","+region.getConfigHex()+",").indexOf(",2,") >-1)){
}else{
for (SysDataDictionaryItem sysDataDictionaryItem : isCaseSenstive) {
if(sysDataDictionaryItem.getItemCode().equals("0")){
if(sysDataDictionaryItem.getItemCode().equals("1")){
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+""+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+""+"\n";
index++;
}
@@ -652,7 +763,7 @@ public class ExportExcel {
}
}
if(StringUtil.isEmpty(commentStr)){
if(StringUtil.isEmpty(commentStr) || (!StringUtil.isEmpty(list) && list.size()==1)){
headerStr="";
commentStr="";
}else{