(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,6 +842,9 @@ public class BaseController {
}
Integer exprType=baseStringCfg.getExprType();
boolean has=false;
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;
@@ -851,7 +855,12 @@ public class BaseController {
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("expression_type"))+";");
}
has=false;
}
Integer matchMethod=baseStringCfg.getMatchMethod();
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;
@@ -861,9 +870,19 @@ public class BaseController {
if(!has) {
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("match_method"))+";");
}
}
Integer isHex=baseStringCfg.getIsHex();
Integer isCaseInsenstive=baseStringCfg.getIsCaseInsenstive();
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"))+";");
}
@@ -890,6 +909,7 @@ public class BaseController {
baseStringCfg.setIsHexbin(2);
}
}
}
if (errInfo.toString().length() > 0) {//
errTip.append(String.format(prop.getProperty("line"), i + 2) + ",");
errTip.append(errInfo);
@@ -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,6 +981,9 @@ public class BaseController {
}
Integer exprType=baseStringCfg.getExprType();
boolean has=false;
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;
@@ -962,7 +994,11 @@ public class BaseController {
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("expression_type"))+";");
}
has=false;
}
Integer matchMethod=baseStringCfg.getMatchMethod();
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;
@@ -972,9 +1008,17 @@ public class BaseController {
if(!has) {
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("match_method"))+";");
}
}
Integer isHex=baseStringCfg.getIsHex();
Integer isCaseInsenstive=baseStringCfg.getIsCaseInsenstive();
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"))+";");
}
@@ -1001,6 +1045,8 @@ public class BaseController {
baseStringCfg.setIsHexbin(2);
}
}
}
if (errInfo.toString().length() > 0) {//
errTip.append(String.format(prop.getProperty("line"), i + 2) + ",");
errTip.append(errInfo);
@@ -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(",")) {