From db8e8b2036233486f181ba88b7800fde231cc087 Mon Sep 17 00:00:00 2001 From: wangxin Date: Mon, 22 Oct 2018 15:14:32 +0800 Subject: [PATCH] =?UTF-8?q?(1)=E4=B8=BA=E5=A4=84=E7=90=86dns=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E4=B8=B2=E5=9F=9F=E7=9A=84=E5=AF=BC=E5=85=A5Complexke?= =?UTF-8?q?ywordCfg=E5=A2=9E=E5=8A=A0=E4=B8=80=E5=88=97dnsStrategyId=20(2)?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=A1=A8=E8=BE=BE=E5=BC=8F=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=EF=BC=8C=E5=8C=B9=E9=85=8D=E6=96=B9=E5=BC=8F=EF=BC=8C=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E5=8D=81=E5=85=AD=E8=BF=9B=E5=88=B6=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F=E5=86=99=E6=95=8F=E6=84=9F=E7=9A=84=E9=9D=9E?= =?UTF-8?q?=E7=A9=BA=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../configuration/ComplexkeywordCfg.java | 11 + .../nis/web/controller/BaseController.java | 214 +++++++++++------- 2 files changed, 146 insertions(+), 79 deletions(-) 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(",")) {