(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() {
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
*/

View File

@@ -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<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 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<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)) {
// 校验必填的IP端口
for (String code : configIpPortShow.split(",")) {