(1)app domain导入提交

(2)asn no字段扩展为long类型,数据库对应字段扩展为bigint
This commit is contained in:
wangxin
2018-11-05 16:26:02 +08:00
parent 97eb005a6d
commit 29b6ff8207
20 changed files with 247 additions and 61 deletions

View File

@@ -55,6 +55,7 @@ import com.nis.domain.configuration.DnsResStrategy;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.RequestInfo;
import com.nis.domain.configuration.StringCfgTemplate;
import com.nis.domain.configuration.template.AppDomainTemplate;
import com.nis.domain.configuration.template.AsnIpTemplate;
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
import com.nis.domain.configuration.template.DdosIpTemplate;
@@ -857,6 +858,7 @@ public class BaseController {
}
StringBuffer errTip = new StringBuffer();
Pattern pattern = Pattern.compile("\t|\r|\n|\b|\f");
Pattern domainPattern = Pattern.compile(Constants.DOMAIN_REGEXP);
for (int i = 0; i < list.size(); i++) {
StringBuffer errInfo = new StringBuffer();
BaseStringCfg baseStringCfg = new BaseStringCfg();
@@ -880,47 +882,71 @@ public class BaseController {
}
}
String keyword = baseStringCfg.getCfgKeywords();
if (StringUtils.isBlank(keyword)) {
errInfo.append(
String.format(prop.getProperty("can_not_null"), prop.getProperty("key_word") + " ") + ";");
}
if (mulityKeywordsP.equals("0")) {
if (keyword.indexOf("\n") > -1) {
if (!regionDict.getFunctionId().equals(403)) {
if (StringUtils.isBlank(keyword)) {
errInfo.append(
String.format(prop.getProperty("not_multiple"), prop.getProperty("key_word")) + ";");
String.format(prop.getProperty("can_not_null"), prop.getProperty("key_word") + " ") + ";");
}
Matcher m = pattern.matcher(keyword);
if (m.find()) {
errInfo.append(String.format(prop.getProperty("has_invisible_char"),
prop.getProperty("key_word") + " '" + keyword + "'") + ";");
}
} else {
boolean has = false;
Set<String> keywordSet=Sets.newHashSet();
for (String key : keyword.split("\n")) {
Matcher m = pattern.matcher(key);
if (mulityKeywordsP.equals("0")) {
if (keyword.indexOf("\n") > -1) {
errInfo.append(
String.format(prop.getProperty("not_multiple"), prop.getProperty("key_word")) + ";");
}
Matcher m = pattern.matcher(keyword);
if (m.find()) {
has = true;
errInfo.append(String.format(prop.getProperty("has_invisible_char"),
prop.getProperty("key_word") + " '" + key + "'") + ";");
break;
prop.getProperty("key_word") + " '" + keyword + "'") + ";");
}
if(!keywordSet.contains(key)) {
keywordSet.add(key);
}else {
errInfo.append(prop.getProperty("key_word") + " '" + key + "'"+" "+prop.getProperty("repeat") + ";");
} else {
boolean has = false;
Set<String> keywordSet=Sets.newHashSet();
for (String key : keyword.split("\n")) {
Matcher m = pattern.matcher(key);
if (m.find()) {
has = true;
errInfo.append(String.format(prop.getProperty("has_invisible_char"),
prop.getProperty("key_word") + " '" + key + "'") + ";");
break;
}
if(!keywordSet.contains(key)) {
keywordSet.add(key);
}else {
errInfo.append(prop.getProperty("key_word") + " '" + key + "'"+" "+prop.getProperty("repeat") + ";");
}
}
if (!has) {
if(keyword.replaceAll("\n","").length()>1024) {
errInfo.append(String.format(prop.getProperty("most_keywords"),
prop.getProperty("key_word")) + ";");
}else {
String reWord = keyword.replaceAll("\n", Constants.KEYWORD_EXPR);
baseStringCfg.setCfgKeywords(reWord);
}
}
}
if (!has) {
if(keyword.replaceAll("\n","").length()>1024) {
errInfo.append(String.format(prop.getProperty("most_keywords"),
prop.getProperty("key_word")) + ";");
}else {
if (StringUtils.isBlank(keyword)) {
errInfo.append(
String.format(prop.getProperty("can_not_null"), prop.getProperty("domain_name") + " ") + ";");
}else {
Matcher m = pattern.matcher(keyword);
if (m.find()) {
errInfo.append(String.format(prop.getProperty("has_invisible_char"),
prop.getProperty("domain_name") + " '" + keyword + "'") + ";");
}else {
String reWord = keyword.replaceAll("\n", Constants.KEYWORD_EXPR);
baseStringCfg.setCfgKeywords(reWord);
m = domainPattern.matcher(keyword);
if(!m.matches()) {
errInfo.append(String.format(prop.getProperty("not_valid_domain"),
prop.getProperty("domain_name") + " '" + keyword + "'") + ";");
}else {
baseStringCfg.setDomain(keyword);
}
}
}
}
Integer exprType = baseStringCfg.getExprType();
boolean has = false;
if (exprType == null) {
@@ -1474,7 +1500,7 @@ public class BaseController {
+ ";");
}else {
try {
Integer.parseInt(userRegion1);
Long asnNo=Long.parseLong(userRegion1);
/*ConfigGroupInfo configGroupInfo=asnIpCfgService.getConfigGroupInfoByAsnNo(asnNo);
if(configGroupInfo==null) {//不存在则新增
PolicyGroupInfo info=new PolicyGroupInfo();
@@ -1486,6 +1512,11 @@ public class BaseController {
configGroupInfo=asnIpCfgService.getConfigGroupInfoByAsnNo(asnNo);
}
baseIpCfg.setAsnIpGroup(configGroupInfo.getGroupId());*/
if(asnNo.longValue()>4294967295l||asnNo.longValue()<1) {
errInfo.append(prop.getProperty("asn_no")+" "+
String.format(prop.getProperty("must_between"),"1","4294967295" )
+ ";");
}
}catch (Exception e) {
// TODO: handle exception
errInfo.append(
@@ -3272,6 +3303,10 @@ public class BaseController {
List<P2pHashStringTemplate> list = ei.getDataList(P2pHashStringTemplate.class,
this.getMsgProp(),regionDict,serviceDict);
stringCfgs = this.checkStringCfg(serviceDict, regionDict, list);
}else if (regionDict.getFunctionId().equals(403)) {
List<AppDomainTemplate> list = ei.getDataList(AppDomainTemplate.class,
this.getMsgProp(),regionDict,serviceDict);
stringCfgs = this.checkStringCfg(serviceDict, regionDict, list);
} else {
List<StringAllTemplate> list = ei.getDataList(StringAllTemplate.class, this.getMsgProp(),regionDict,serviceDict);
stringCfgs = this.checkStringCfg(serviceDict, regionDict, list);
@@ -3307,6 +3342,7 @@ public class BaseController {
|| serviceDict.getServiceId().intValue() == 148
|| serviceDict.getServiceId().intValue() == 1028// app ip
|| serviceDict.getServiceId().intValue() == 1024//app http
|| serviceDict.getServiceId().intValue() == 1026//app domain
)) {
if (StringUtils.isNotBlank(specServiceId)) {
specificServiceCfg = specificServiceCfgService
@@ -3507,9 +3543,12 @@ public class BaseController {
appPolicyCfgs.add(appPolicyCfg);
}
} else {
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
BeanUtils.copyProperties(cfg, cfgIndexInfo, new String[] {"cfgId"});
cfgIndexInfos.add(cfgIndexInfo);
if(!regionDict.getFunctionId().equals(403)) {
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
BeanUtils.copyProperties(cfg, cfgIndexInfo, new String[] {"cfgId"});
cfgIndexInfos.add(cfgIndexInfo);
}
}
ind++;
}
@@ -3547,6 +3586,9 @@ public class BaseController {
if(regionDict.getDictId().intValue()==16){
avContentCfgService.saveVoIpAccountCfg(stringCfgs);
}
if(regionDict.getDictId().intValue()==64){
appCfgService.saveAppDomainCfg(stringCfgs);
}
} else if (regionDict.getRegionType().equals(3)) {
List<Integer> compileIds=Lists.newArrayList();
try {