(1)为处理dns字符串域的导入ComplexkeywordCfg增加一列dnsStrategyId

(2)加入表达式类型,匹配方式,是否十六进制是否大小写敏感的非空验证
This commit is contained in:
wangxin
2018-10-22 15:14:32 +08:00
parent a33e28a951
commit db8e8b2036
2 changed files with 146 additions and 79 deletions

View File

@@ -88,6 +88,17 @@ public class ComplexkeywordCfg extends BaseCfg<ComplexkeywordCfg>{
public String getDistrict() { public String getDistrict() {
return district; 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 * @param district the district to set
*/ */

View File

@@ -48,6 +48,7 @@ import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo; import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.ComplexStringCfgTemplate; import com.nis.domain.configuration.ComplexStringCfgTemplate;
import com.nis.domain.configuration.ComplexkeywordCfg; import com.nis.domain.configuration.ComplexkeywordCfg;
import com.nis.domain.configuration.DnsResStrategy;
import com.nis.domain.configuration.IpPortCfg; import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.RequestInfo; import com.nis.domain.configuration.RequestInfo;
import com.nis.domain.configuration.StringCfgTemplate; import com.nis.domain.configuration.StringCfgTemplate;
@@ -841,53 +842,72 @@ public class BaseController {
} }
Integer exprType=baseStringCfg.getExprType(); Integer exprType=baseStringCfg.getExprType();
boolean has=false; boolean has=false;
for(String exp:exprTypeP.split(",")) { if(exprType==null) {
if(exp.equals(exprType.toString())) { errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("expression_type"))+";");
has=true; }else {
break; 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(); Integer matchMethod=baseStringCfg.getMatchMethod();
for(String exp:matchMethodP.split(",")) { if(matchMethod==null) {
if(exp.equals(matchMethod.toString())) { errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("match_method"))+";");
has=true; }else {
break; 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 isHex=baseStringCfg.getIsHex();
Integer isCaseInsenstive=baseStringCfg.getIsCaseInsenstive(); Integer isCaseInsenstive=baseStringCfg.getIsCaseInsenstive();
if(isHex.intValue()!=0&&isHex.intValue()!=1) { if(isHex==null||isCaseInsenstive==null) {
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";"); if(isHex==null) {
} errInfo.append(String.format(prop.getProperty("can_not_null"), 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(isCaseInsenstive==null) {
} errInfo.append(String.format(prop.getProperty("can_not_null"), 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"))+";"); }else {
} if(isHex.intValue()!=0&&isHex.intValue()!=1) {
if(hexP.equals("1")&&isHex.intValue()==0){ errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";");
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";"); }
} if(isCaseInsenstive.intValue()!=0&&isCaseInsenstive.intValue()!=1) {
if(hexP.indexOf("2")==-1&&isCaseInsenstive.intValue()==1){ errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))+";");
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))+";"); }
} if(hexP.indexOf("1")==-1&&isHex.intValue()==1){
if(hexP.equals("2")&&isCaseInsenstive.intValue()==0){ errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";");
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))+";"); }
} if(hexP.equals("1")&&isHex.intValue()==0){
if(isHex==0&&isCaseInsenstive==0) { errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";");
baseStringCfg.setIsHexbin(0); }
}else if(isHex==1&&isCaseInsenstive==0) { if(hexP.indexOf("2")==-1&&isCaseInsenstive.intValue()==1){
baseStringCfg.setIsHexbin(1); errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))+";");
}else if(isHex==1&&isCaseInsenstive==1) { }
baseStringCfg.setIsHexbin(2); 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) {// if (errInfo.toString().length() > 0) {//
@@ -929,6 +949,15 @@ public class BaseController {
ComplexkeywordCfg baseStringCfg = new ComplexkeywordCfg(); ComplexkeywordCfg baseStringCfg = new ComplexkeywordCfg();
BeanUtils.copyProperties(list.get(i), baseStringCfg); BeanUtils.copyProperties(list.get(i), baseStringCfg);
if (regionDict.getRegionType().equals(3)) { if (regionDict.getRegionType().equals(3)) {
if(regionDict.getFunctionId().equals(7)) {
Integer dnsStrategyId=baseStringCfg.getDnsStrategyId();
if(dnsStrategyId!=null) {
List<DnsResStrategy> 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 keyword=baseStringCfg.getCfgKeywords();
String district=baseStringCfg.getDistrict(); String district=baseStringCfg.getDistrict();
if(StringUtils.isBlank(keyword)) { if(StringUtils.isBlank(keyword)) {
@@ -952,54 +981,71 @@ public class BaseController {
} }
Integer exprType=baseStringCfg.getExprType(); Integer exprType=baseStringCfg.getExprType();
boolean has=false; boolean has=false;
for(String exp:exprTypeP.split(",")) { if(exprType==null) {
if(exp.equals(exprType.toString())) { errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("expression_type"))+";");
has=true; }else {
break; 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(); Integer matchMethod=baseStringCfg.getMatchMethod();
for(String exp:matchMethodP.split(",")) { if(matchMethod==null) {
if(exp.equals(matchMethod.toString())) { errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("match_method"))+";");
has=true; }else {
break; 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 isHex=baseStringCfg.getIsHex();
Integer isCaseInsenstive=baseStringCfg.getIsCaseInsenstive(); Integer isCaseInsenstive=baseStringCfg.getIsCaseInsenstive();
if(isHex.intValue()!=0&&isHex.intValue()!=1) { if(isHex==null||isCaseInsenstive==null) {
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";"); if(isHex==null) {
} errInfo.append(String.format(prop.getProperty("can_not_null"), 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(isCaseInsenstive==null) {
} errInfo.append(String.format(prop.getProperty("can_not_null"), 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"))+";"); }else {
} if(isHex.intValue()!=0&&isHex.intValue()!=1) {
if(hexP.equals("1")&&isHex.intValue()==0){ errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";");
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";"); }
} if(isCaseInsenstive.intValue()!=0&&isCaseInsenstive.intValue()!=1) {
if(hexP.indexOf("2")==-1&&isCaseInsenstive.intValue()==1){ errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))+";");
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))+";"); }
} if(hexP.indexOf("1")==-1&&isHex.intValue()==1){
if(hexP.equals("2")&&isCaseInsenstive.intValue()==0){ errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";");
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))+";"); }
} if(hexP.equals("1")&&isHex.intValue()==0){
if(isHex==0&&isCaseInsenstive==0) { errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_hex"))+";");
baseStringCfg.setIsHexbin(0); }
}else if(isHex==1&&isCaseInsenstive==0) { if(hexP.indexOf("2")==-1&&isCaseInsenstive.intValue()==1){
baseStringCfg.setIsHexbin(1); errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("is_case_insenstive"))+";");
}else if(isHex==1&&isCaseInsenstive==1) { }
baseStringCfg.setIsHexbin(2); 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) {// if (errInfo.toString().length() > 0) {//
errTip.append(String.format(prop.getProperty("line"), i + 2) + ","); 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"))+";"); 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<DnsResStrategy> 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)) { if (regionDict.getRegionType().equals(1)) {
// 校验必填的IP端口 // 校验必填的IP端口
for (String code : configIpPortShow.split(",")) { for (String code : configIpPortShow.split(",")) {