diff --git a/src/main/java/com/nis/domain/configuration/ComplexkeywordCfg.java b/src/main/java/com/nis/domain/configuration/ComplexkeywordCfg.java index bdf0c8f5d..924d83137 100644 --- a/src/main/java/com/nis/domain/configuration/ComplexkeywordCfg.java +++ b/src/main/java/com/nis/domain/configuration/ComplexkeywordCfg.java @@ -88,6 +88,17 @@ public class ComplexkeywordCfg extends BaseCfg{ public String getDistrict() { return district; } + /** + * copy属性使用 + */ + protected Integer dnsStrategyId; + + public Integer getDnsStrategyId() { + return dnsStrategyId; + } + public void setDnsStrategyId(Integer dnsStrategyId) { + this.dnsStrategyId = dnsStrategyId; + } /** * @param district the district to set */ diff --git a/src/main/java/com/nis/web/controller/BaseController.java b/src/main/java/com/nis/web/controller/BaseController.java index da3bfbcff..5bc77301e 100644 --- a/src/main/java/com/nis/web/controller/BaseController.java +++ b/src/main/java/com/nis/web/controller/BaseController.java @@ -48,6 +48,7 @@ import com.nis.domain.configuration.BaseStringCfg; import com.nis.domain.configuration.CfgIndexInfo; import com.nis.domain.configuration.ComplexStringCfgTemplate; import com.nis.domain.configuration.ComplexkeywordCfg; +import com.nis.domain.configuration.DnsResStrategy; import com.nis.domain.configuration.IpPortCfg; import com.nis.domain.configuration.RequestInfo; import com.nis.domain.configuration.StringCfgTemplate; @@ -841,53 +842,72 @@ public class BaseController { } Integer exprType=baseStringCfg.getExprType(); boolean has=false; - for(String exp:exprTypeP.split(",")) { - if(exp.equals(exprType.toString())) { - has=true; - break; + if(exprType==null) { + errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("expression_type"))+";"); + }else { + for(String exp:exprTypeP.split(",")) { + if(exp.equals(exprType.toString())) { + has=true; + break; + } } + if(!has) { + errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("expression_type"))+";"); + } + has=false; } - if(!has) { - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("expression_type"))+";"); - } - has=false; + Integer matchMethod=baseStringCfg.getMatchMethod(); - for(String exp:matchMethodP.split(",")) { - if(exp.equals(matchMethod.toString())) { - has=true; - break; + if(matchMethod==null) { + errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("match_method"))+";"); + }else { + for(String exp:matchMethodP.split(",")) { + if(exp.equals(matchMethod.toString())) { + has=true; + break; + } + } + if(!has) { + errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("match_method"))+";"); } } - if(!has) { - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("match_method"))+";"); - } + Integer isHex=baseStringCfg.getIsHex(); Integer isCaseInsenstive=baseStringCfg.getIsCaseInsenstive(); - if(isHex.intValue()!=0&&isHex.intValue()!=1) { - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";"); - } - if(isCaseInsenstive.intValue()!=0&&isCaseInsenstive.intValue()!=1) { - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))+";"); - } - if(hexP.indexOf("1")==-1&&isHex.intValue()==1){ - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";"); - } - if(hexP.equals("1")&&isHex.intValue()==0){ - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";"); - } - if(hexP.indexOf("2")==-1&&isCaseInsenstive.intValue()==1){ - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))+";"); - } - if(hexP.equals("2")&&isCaseInsenstive.intValue()==0){ - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))+";"); - } - if(isHex==0&&isCaseInsenstive==0) { - baseStringCfg.setIsHexbin(0); - }else if(isHex==1&&isCaseInsenstive==0) { - baseStringCfg.setIsHexbin(1); - }else if(isHex==1&&isCaseInsenstive==1) { - baseStringCfg.setIsHexbin(2); + if(isHex==null||isCaseInsenstive==null) { + if(isHex==null) { + errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("is_hex"))+";"); + } + if(isCaseInsenstive==null) { + errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("is_case_insenstive"))+";"); + } + }else { + if(isHex.intValue()!=0&&isHex.intValue()!=1) { + errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";"); + } + if(isCaseInsenstive.intValue()!=0&&isCaseInsenstive.intValue()!=1) { + errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))+";"); + } + if(hexP.indexOf("1")==-1&&isHex.intValue()==1){ + errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";"); + } + if(hexP.equals("1")&&isHex.intValue()==0){ + errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";"); + } + if(hexP.indexOf("2")==-1&&isCaseInsenstive.intValue()==1){ + errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))+";"); + } + if(hexP.equals("2")&&isCaseInsenstive.intValue()==0){ + errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))+";"); + } + if(isHex==0&&isCaseInsenstive==0) { + baseStringCfg.setIsHexbin(0); + }else if(isHex==1&&isCaseInsenstive==0) { + baseStringCfg.setIsHexbin(1); + }else if(isHex==1&&isCaseInsenstive==1) { + baseStringCfg.setIsHexbin(2); + } } } if (errInfo.toString().length() > 0) {// @@ -929,6 +949,15 @@ public class BaseController { ComplexkeywordCfg baseStringCfg = new ComplexkeywordCfg(); BeanUtils.copyProperties(list.get(i), baseStringCfg); if (regionDict.getRegionType().equals(3)) { + if(regionDict.getFunctionId().equals(7)) { + Integer dnsStrategyId=baseStringCfg.getDnsStrategyId(); + if(dnsStrategyId!=null) { + List dnsStrategys=dnsResStrategyService.findDnsResStrategys(Long.valueOf(dnsStrategyId), Constants.VALID_YES, Constants.AUDIT_YES); + if(dnsStrategys==null||dnsStrategys.size()==0) { + errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("dns_res_strategy"))+";"); + } + } + } String keyword=baseStringCfg.getCfgKeywords(); String district=baseStringCfg.getDistrict(); if(StringUtils.isBlank(keyword)) { @@ -952,54 +981,71 @@ public class BaseController { } Integer exprType=baseStringCfg.getExprType(); boolean has=false; - for(String exp:exprTypeP.split(",")) { - if(exp.equals(exprType.toString())) { - has=true; - break; + if(exprType==null) { + errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("expression_type"))+";"); + }else { + for(String exp:exprTypeP.split(",")) { + if(exp.equals(exprType.toString())) { + has=true; + break; + } } + if(!has) { + errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("expression_type"))+";"); + } + has=false; } - if(!has) { - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("expression_type"))+";"); - } - has=false; Integer matchMethod=baseStringCfg.getMatchMethod(); - for(String exp:matchMethodP.split(",")) { - if(exp.equals(matchMethod.toString())) { - has=true; - break; + if(matchMethod==null) { + errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("match_method"))+";"); + }else { + for(String exp:matchMethodP.split(",")) { + if(exp.equals(matchMethod.toString())) { + has=true; + break; + } + } + if(!has) { + errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("match_method"))+";"); } } - if(!has) { - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("match_method"))+";"); - } - Integer isHex=baseStringCfg.getIsHex(); Integer isCaseInsenstive=baseStringCfg.getIsCaseInsenstive(); - if(isHex.intValue()!=0&&isHex.intValue()!=1) { - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";"); - } - if(isCaseInsenstive.intValue()!=0&&isCaseInsenstive.intValue()!=1) { - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))+";"); - } - if(hexP.indexOf("1")==-1&&isHex.intValue()==1){ - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";"); - } - if(hexP.equals("1")&&isHex.intValue()==0){ - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";"); - } - if(hexP.indexOf("2")==-1&&isCaseInsenstive.intValue()==1){ - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))+";"); - } - if(hexP.equals("2")&&isCaseInsenstive.intValue()==0){ - errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))+";"); - } - if(isHex==0&&isCaseInsenstive==0) { - baseStringCfg.setIsHexbin(0); - }else if(isHex==1&&isCaseInsenstive==0) { - baseStringCfg.setIsHexbin(1); - }else if(isHex==1&&isCaseInsenstive==1) { - baseStringCfg.setIsHexbin(2); + if(isHex==null||isCaseInsenstive==null) { + if(isHex==null) { + errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("is_hex"))+";"); + } + if(isCaseInsenstive==null) { + errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("is_case_insenstive"))+";"); + } + }else { + if(isHex.intValue()!=0&&isHex.intValue()!=1) { + errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";"); + } + if(isCaseInsenstive.intValue()!=0&&isCaseInsenstive.intValue()!=1) { + errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))+";"); + } + if(hexP.indexOf("1")==-1&&isHex.intValue()==1){ + errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";"); + } + if(hexP.equals("1")&&isHex.intValue()==0){ + errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";"); + } + if(hexP.indexOf("2")==-1&&isCaseInsenstive.intValue()==1){ + errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))+";"); + } + if(hexP.equals("2")&&isCaseInsenstive.intValue()==0){ + errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))+";"); + } + if(isHex==0&&isCaseInsenstive==0) { + baseStringCfg.setIsHexbin(0); + }else if(isHex==1&&isCaseInsenstive==0) { + baseStringCfg.setIsHexbin(1); + }else if(isHex==1&&isCaseInsenstive==1) { + baseStringCfg.setIsHexbin(2); + } } + } if (errInfo.toString().length() > 0) {// errTip.append(String.format(prop.getProperty("line"), i + 2) + ","); @@ -1081,6 +1127,16 @@ public class BaseController { errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("replace_content"))+";"); } } + //dns ip + if(regionDict.getFunctionId().equals(7)) { + Integer dnsStrategyId=baseIpCfg.getDnsStrategyId(); + if(dnsStrategyId!=null) { + List dnsStrategys=dnsResStrategyService.findDnsResStrategys(Long.valueOf(dnsStrategyId), Constants.VALID_YES, Constants.AUDIT_YES); + if(dnsStrategys==null||dnsStrategys.size()==0) { + errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("dns_res_strategy"))+";"); + } + } + } if (regionDict.getRegionType().equals(1)) { // 校验必填的IP,端口 for (String code : configIpPortShow.split(",")) {