|
|
|
|
@@ -44,15 +44,19 @@ import com.nis.domain.configuration.AreaBean;
|
|
|
|
|
import com.nis.domain.configuration.AreaIpCfg;
|
|
|
|
|
import com.nis.domain.configuration.BaseCfg;
|
|
|
|
|
import com.nis.domain.configuration.BaseIpCfg;
|
|
|
|
|
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.IpPortCfg;
|
|
|
|
|
import com.nis.domain.configuration.RequestInfo;
|
|
|
|
|
import com.nis.domain.configuration.StringCfgTemplate;
|
|
|
|
|
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
|
|
|
|
|
import com.nis.domain.configuration.template.IpAllTemplate;
|
|
|
|
|
import com.nis.domain.configuration.template.IpCfgTemplate;
|
|
|
|
|
import com.nis.domain.configuration.template.IpPayloadTemplate;
|
|
|
|
|
import com.nis.domain.configuration.template.IpRateLimitTemplate;
|
|
|
|
|
import com.nis.domain.configuration.template.StringAllTemplate;
|
|
|
|
|
import com.nis.domain.log.BaseLogEntity;
|
|
|
|
|
import com.nis.domain.log.SearchReport;
|
|
|
|
|
import com.nis.domain.specific.SpecificServiceCfg;
|
|
|
|
|
@@ -797,7 +801,218 @@ public class BaseController {
|
|
|
|
|
params.put("searchCfgId", entry.getCfgId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public List<BaseStringCfg<?>> checkStringCfg(FunctionServiceDict serviceDict, FunctionRegionDict regionDict, List<?> list)
|
|
|
|
|
throws ServiceException {
|
|
|
|
|
List<BaseStringCfg<?>> stringList = new ArrayList<BaseStringCfg<?>>();
|
|
|
|
|
Properties prop = this.getMsgProp();
|
|
|
|
|
String exprTypeP=regionDict.getConfigExprType();
|
|
|
|
|
if (StringUtil.isEmpty(exprTypeP)) {
|
|
|
|
|
throw new RuntimeException("Found String region,but exprType is Empty");
|
|
|
|
|
}
|
|
|
|
|
String matchMethodP=regionDict.getConfigMatchMethod();
|
|
|
|
|
if (StringUtil.isEmpty(matchMethodP)) {
|
|
|
|
|
throw new RuntimeException("Found String region,but matchMethod is Empty");
|
|
|
|
|
}
|
|
|
|
|
String hexP=regionDict.getConfigHex();
|
|
|
|
|
if (StringUtil.isEmpty(hexP)) {
|
|
|
|
|
throw new RuntimeException("Found String region,but hex is Empty");
|
|
|
|
|
}
|
|
|
|
|
String mulityKeywordsP=regionDict.getConfigMultiKeywords();
|
|
|
|
|
if (StringUtil.isEmpty(mulityKeywordsP)) {
|
|
|
|
|
throw new RuntimeException("Found String region,but mulityKeywords is Empty");
|
|
|
|
|
}
|
|
|
|
|
StringBuffer errTip = new StringBuffer();
|
|
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
|
|
StringBuffer errInfo = new StringBuffer();
|
|
|
|
|
BaseStringCfg baseStringCfg = new BaseStringCfg();
|
|
|
|
|
BeanUtils.copyProperties(list.get(i), baseStringCfg);
|
|
|
|
|
if (regionDict.getRegionType().equals(2)) {
|
|
|
|
|
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) {
|
|
|
|
|
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("key_word"))+";");
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
String reWord=keyword.replaceAll("\n", Constants.KEYWORD_EXPR);
|
|
|
|
|
baseStringCfg.setCfgKeywords(reWord);
|
|
|
|
|
}
|
|
|
|
|
Integer exprType=baseStringCfg.getExprType();
|
|
|
|
|
boolean has=false;
|
|
|
|
|
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;
|
|
|
|
|
Integer matchMethod=baseStringCfg.getMatchMethod();
|
|
|
|
|
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"))+";");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 (errInfo.toString().length() > 0) {//
|
|
|
|
|
errTip.append(String.format(prop.getProperty("line"), i + 2) + ",");
|
|
|
|
|
errTip.append(errInfo);
|
|
|
|
|
errTip.append("<br>");
|
|
|
|
|
}
|
|
|
|
|
stringList.add(baseStringCfg);
|
|
|
|
|
}
|
|
|
|
|
if (errTip.toString().length() > 0) {
|
|
|
|
|
throw new ServiceException(errTip.toString());
|
|
|
|
|
}
|
|
|
|
|
return stringList;
|
|
|
|
|
}
|
|
|
|
|
public List<ComplexkeywordCfg> checkComplexStringCfg(FunctionServiceDict serviceDict, FunctionRegionDict regionDict, List<?> list)
|
|
|
|
|
throws ServiceException {
|
|
|
|
|
List<ComplexkeywordCfg> stringList = new ArrayList<ComplexkeywordCfg>();
|
|
|
|
|
Properties prop = this.getMsgProp();
|
|
|
|
|
String exprTypeP=regionDict.getConfigExprType();
|
|
|
|
|
if (StringUtil.isEmpty(exprTypeP)) {
|
|
|
|
|
throw new RuntimeException("Found String region,but exprType is Empty");
|
|
|
|
|
}
|
|
|
|
|
String matchMethodP=regionDict.getConfigMatchMethod();
|
|
|
|
|
if (StringUtil.isEmpty(matchMethodP)) {
|
|
|
|
|
throw new RuntimeException("Found String region,but matchMethod is Empty");
|
|
|
|
|
}
|
|
|
|
|
String hexP=regionDict.getConfigHex();
|
|
|
|
|
if (StringUtil.isEmpty(hexP)) {
|
|
|
|
|
throw new RuntimeException("Found String region,but hex is Empty");
|
|
|
|
|
}
|
|
|
|
|
String mulityKeywordsP=regionDict.getConfigMultiKeywords();
|
|
|
|
|
if (StringUtil.isEmpty(mulityKeywordsP)) {
|
|
|
|
|
throw new RuntimeException("Found String region,but mulityKeywords is Empty");
|
|
|
|
|
}
|
|
|
|
|
String dirtrictP=regionDict.getConfigDistrict();
|
|
|
|
|
StringBuffer errTip = new StringBuffer();
|
|
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
|
|
StringBuffer errInfo = new StringBuffer();
|
|
|
|
|
ComplexkeywordCfg baseStringCfg = new ComplexkeywordCfg();
|
|
|
|
|
BeanUtils.copyProperties(list.get(i), baseStringCfg);
|
|
|
|
|
if (regionDict.getRegionType().equals(3)) {
|
|
|
|
|
String keyword=baseStringCfg.getCfgKeywords();
|
|
|
|
|
String district=baseStringCfg.getDistrict();
|
|
|
|
|
if(StringUtils.isBlank(keyword)) {
|
|
|
|
|
errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("key_word")+" ")+";");
|
|
|
|
|
}
|
|
|
|
|
if(StringUtils.isNotBlank(dirtrictP)) {
|
|
|
|
|
if(StringUtils.isBlank(district)) {
|
|
|
|
|
errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("district")+" ")+";");
|
|
|
|
|
}
|
|
|
|
|
if(dirtrictP.indexOf(district)==-1) {
|
|
|
|
|
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("district")+" ")+";");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(mulityKeywordsP.equals("0")) {
|
|
|
|
|
if(keyword.indexOf("\n")>-1) {
|
|
|
|
|
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("key_word"))+";");
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
String reWord=keyword.replaceAll("\n", Constants.KEYWORD_EXPR);
|
|
|
|
|
baseStringCfg.setCfgKeywords(reWord);
|
|
|
|
|
}
|
|
|
|
|
Integer exprType=baseStringCfg.getExprType();
|
|
|
|
|
boolean has=false;
|
|
|
|
|
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;
|
|
|
|
|
Integer matchMethod=baseStringCfg.getMatchMethod();
|
|
|
|
|
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"))+";");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 (errInfo.toString().length() > 0) {//
|
|
|
|
|
errTip.append(String.format(prop.getProperty("line"), i + 2) + ",");
|
|
|
|
|
errTip.append(errInfo);
|
|
|
|
|
errTip.append("<br>");
|
|
|
|
|
}
|
|
|
|
|
stringList.add(baseStringCfg);
|
|
|
|
|
}
|
|
|
|
|
if (errTip.toString().length() > 0) {
|
|
|
|
|
throw new ServiceException(errTip.toString());
|
|
|
|
|
}
|
|
|
|
|
return stringList;
|
|
|
|
|
}
|
|
|
|
|
public List<BaseIpCfg> checkIpCfg(FunctionServiceDict serviceDict, FunctionRegionDict regionDict, List<?> list)
|
|
|
|
|
throws ServiceException {
|
|
|
|
|
List<BaseIpCfg> ipList = new ArrayList<BaseIpCfg>();
|
|
|
|
|
@@ -2438,13 +2653,15 @@ public class BaseController {
|
|
|
|
|
FunctionServiceDict serviceDict = DictUtils.getFunctionServiceDict(serviceDictId);
|
|
|
|
|
String regionCode=serviceDict.getRegionCode();
|
|
|
|
|
List<BaseIpCfg> ipPortCfgs = new ArrayList<BaseIpCfg>();
|
|
|
|
|
List<BaseStringCfg<?>> stringCfgs = new ArrayList<BaseStringCfg<?>>();
|
|
|
|
|
List<ComplexkeywordCfg> complexkeywordCfgs = new ArrayList<ComplexkeywordCfg>();
|
|
|
|
|
List<CfgIndexInfo> cfgIndexInfos = new ArrayList<CfgIndexInfo>();
|
|
|
|
|
List<AppPolicyCfg> appPolicyCfgs = new ArrayList<AppPolicyCfg>();
|
|
|
|
|
FunctionRegionDict appRegion=null;
|
|
|
|
|
for(String code:regionCode.split(",")) {
|
|
|
|
|
if(StringUtils.isNotBlank(code)) {
|
|
|
|
|
FunctionRegionDict d=DictUtils.getFunctionRegionDictByRegionCode(serviceDict.getFunctionId(),Integer.parseInt(code));
|
|
|
|
|
if(d.getConfigServiceType().equals("app_policy")) {
|
|
|
|
|
if(d!=null&&d.getConfigServiceType()!=null&&d.getConfigServiceType().equals("app_policy")) {
|
|
|
|
|
appRegion=d;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
@@ -2458,27 +2675,29 @@ public class BaseController {
|
|
|
|
|
|
|
|
|
|
FunctionRegionDict regionDict = DictUtils
|
|
|
|
|
.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
|
|
|
|
|
if (regionDict.getRegionType().equals(1)) {//IP
|
|
|
|
|
if (regionDict.getFunctionId().equals(5)) {
|
|
|
|
|
if (serviceDict.getAction().equals(64)) {// ip
|
|
|
|
|
if (regionDict.getRegionType().equals(1)) {
|
|
|
|
|
if (serviceDict.getAction().equals(64)) {
|
|
|
|
|
List<IpRateLimitTemplate> list = ei.getDataList(IpRateLimitTemplate.class);
|
|
|
|
|
ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (regionDict.getRegionType().equals(1)) {
|
|
|
|
|
}else {
|
|
|
|
|
List<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class);
|
|
|
|
|
ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else if(regionDict.getFunctionId().equals(212)) {
|
|
|
|
|
if (regionDict.getRegionType().equals(1)) {
|
|
|
|
|
List<IpPayloadTemplate> list = ei.getDataList(IpPayloadTemplate.class);
|
|
|
|
|
ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list);
|
|
|
|
|
}
|
|
|
|
|
} else if (regionDict.getRegionType().equals(1)) {
|
|
|
|
|
}else {
|
|
|
|
|
List<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class);
|
|
|
|
|
ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list);
|
|
|
|
|
}
|
|
|
|
|
}else if(regionDict.getRegionType().equals(2)) {//字符串类
|
|
|
|
|
List<StringAllTemplate> list = ei.getDataList(StringAllTemplate.class);
|
|
|
|
|
stringCfgs=this.checkStringCfg(serviceDict, regionDict, list);
|
|
|
|
|
}else if(regionDict.getRegionType().equals(3)) {//增强字符串类
|
|
|
|
|
List<ComplexStringAllTemplate> list = ei.getDataList(ComplexStringAllTemplate.class);
|
|
|
|
|
complexkeywordCfgs=this.checkComplexStringCfg(serviceDict, regionDict, list);
|
|
|
|
|
}
|
|
|
|
|
Date date = new Date();
|
|
|
|
|
String specServiceId=request.getParameter("appId");
|
|
|
|
|
String behaviorId=request.getParameter("behaviorId");
|
|
|
|
|
@@ -2490,6 +2709,7 @@ public class BaseController {
|
|
|
|
|
specificServiceCfg=specificServiceCfgService.getBySpecServiceId(Integer.parseInt(specServiceId));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (regionDict.getRegionType().equals(1)) {//IP
|
|
|
|
|
for (BaseIpCfg cfg : ipPortCfgs) {
|
|
|
|
|
cfg.setAction(serviceDict.getAction());
|
|
|
|
|
cfg.setAuditorId(UserUtils.getUser().getId());
|
|
|
|
|
@@ -2518,13 +2738,15 @@ public class BaseController {
|
|
|
|
|
BeanUtils.copyProperties(cfg, appPolicyCfg);
|
|
|
|
|
appPolicyCfg.setSpecServiceId(specificServiceCfg.getSpecServiceId());
|
|
|
|
|
appPolicyCfg.setAppCode(specificServiceCfg.getSpecServiceCode());
|
|
|
|
|
appPolicyCfg.setExprType(0);
|
|
|
|
|
appPolicyCfg.setMatchMethod(0);
|
|
|
|
|
appPolicyCfg.setIsHexbin(0);
|
|
|
|
|
appPolicyCfg.setCfgType(appRegion.getConfigRegionValue());
|
|
|
|
|
appPolicyCfg.setCfgRegionCode(appRegion.getConfigRegionCode());
|
|
|
|
|
if(StringUtils.isNotBlank(behaviorId)) {
|
|
|
|
|
appPolicyCfg.setBehavCode(Integer.parseInt(behaviorId));
|
|
|
|
|
appPolicyCfg.setExprType(1);
|
|
|
|
|
}else {
|
|
|
|
|
appPolicyCfg.setExprType(0);
|
|
|
|
|
}
|
|
|
|
|
appPolicyCfgs.add(appPolicyCfg);
|
|
|
|
|
}
|
|
|
|
|
@@ -2536,6 +2758,115 @@ public class BaseController {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
ipCfgService.saveBatch(ipPortCfgs, IpCfgDao.class);
|
|
|
|
|
}else if (regionDict.getRegionType().equals(2)) {
|
|
|
|
|
for(BaseStringCfg cfg:stringCfgs) {
|
|
|
|
|
cfg.setAction(serviceDict.getAction());
|
|
|
|
|
cfg.setAuditorId(UserUtils.getUser().getId());
|
|
|
|
|
cfg.setAuditTime(date);
|
|
|
|
|
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
|
|
|
|
cfg.setCfgType(regionDict.getConfigRegionValue());
|
|
|
|
|
cfg.setCreateTime(date);
|
|
|
|
|
cfg.setCreatorId(UserUtils.getUser().getId());
|
|
|
|
|
cfg.setDoLog(1);
|
|
|
|
|
cfg.setFunctionId(regionDict.getFunctionId());
|
|
|
|
|
cfg.setIsAudit(0);
|
|
|
|
|
cfg.setIsValid(0);
|
|
|
|
|
cfg.setIsAreaEffective(0);
|
|
|
|
|
cfg.setAttribute("0");
|
|
|
|
|
cfg.setClassify("0");
|
|
|
|
|
cfg.setLable("0");
|
|
|
|
|
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
|
|
|
|
cfg.setServiceId(serviceDict.getServiceId());
|
|
|
|
|
cfg.setCompileId(ipCfgService.getCompileId());
|
|
|
|
|
if(serviceDict.getServiceId().intValue()==33||serviceDict.getServiceId().intValue()==145||
|
|
|
|
|
serviceDict.getServiceId().intValue()==35||serviceDict.getServiceId().intValue()==147||
|
|
|
|
|
serviceDict.getServiceId().intValue()==36||serviceDict.getServiceId().intValue()==148) {
|
|
|
|
|
if(specificServiceCfg!=null&&appRegion!=null) {
|
|
|
|
|
AppPolicyCfg appPolicyCfg=new AppPolicyCfg();
|
|
|
|
|
BeanUtils.copyProperties(cfg, appPolicyCfg);
|
|
|
|
|
appPolicyCfg.setSpecServiceId(specificServiceCfg.getSpecServiceId());
|
|
|
|
|
appPolicyCfg.setAppCode(specificServiceCfg.getSpecServiceCode());
|
|
|
|
|
appPolicyCfg.setMatchMethod(0);
|
|
|
|
|
appPolicyCfg.setIsHexbin(0);
|
|
|
|
|
appPolicyCfg.setCfgType(appRegion.getConfigRegionValue());
|
|
|
|
|
appPolicyCfg.setCfgRegionCode(appRegion.getConfigRegionCode());
|
|
|
|
|
if(StringUtils.isNotBlank(behaviorId)) {
|
|
|
|
|
appPolicyCfg.setBehavCode(Integer.parseInt(behaviorId));
|
|
|
|
|
appPolicyCfg.setExprType(1);
|
|
|
|
|
}else {
|
|
|
|
|
appPolicyCfg.setExprType(0);
|
|
|
|
|
}
|
|
|
|
|
appPolicyCfgs.add(appPolicyCfg);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
|
|
|
|
BeanUtils.copyProperties(cfg, cfgIndexInfo);
|
|
|
|
|
cfgIndexInfos.add(cfgIndexInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//调用对应配置的service
|
|
|
|
|
if(regionDict.getDictId().intValue()==167) {
|
|
|
|
|
interceptCfgService.saveInterceptCfg(stringCfgs);
|
|
|
|
|
}
|
|
|
|
|
if(regionDict.getDictId().intValue()==15||regionDict.getDictId().intValue()==596) {
|
|
|
|
|
websiteCfgService.saveHttpUrlCfg(stringCfgs);
|
|
|
|
|
}
|
|
|
|
|
if(regionDict.getDictId().intValue()==36) {
|
|
|
|
|
fileTransferCfgService.saveFtpCfg(stringCfgs);
|
|
|
|
|
}
|
|
|
|
|
}else if (regionDict.getRegionType().equals(3)) {
|
|
|
|
|
for(ComplexkeywordCfg cfg:complexkeywordCfgs) {
|
|
|
|
|
cfg.setAction(serviceDict.getAction());
|
|
|
|
|
cfg.setAuditorId(UserUtils.getUser().getId());
|
|
|
|
|
cfg.setAuditTime(date);
|
|
|
|
|
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
|
|
|
|
cfg.setCfgType(regionDict.getConfigRegionValue());
|
|
|
|
|
cfg.setCreateTime(date);
|
|
|
|
|
cfg.setCreatorId(UserUtils.getUser().getId());
|
|
|
|
|
cfg.setDoLog(1);
|
|
|
|
|
cfg.setFunctionId(regionDict.getFunctionId());
|
|
|
|
|
cfg.setIsAudit(0);
|
|
|
|
|
cfg.setIsValid(0);
|
|
|
|
|
cfg.setIsAreaEffective(0);
|
|
|
|
|
cfg.setAttribute("0");
|
|
|
|
|
cfg.setClassify("0");
|
|
|
|
|
cfg.setLable("0");
|
|
|
|
|
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
|
|
|
|
cfg.setServiceId(serviceDict.getServiceId());
|
|
|
|
|
cfg.setCompileId(ipCfgService.getCompileId());
|
|
|
|
|
if(serviceDict.getServiceId().intValue()==33||serviceDict.getServiceId().intValue()==145||
|
|
|
|
|
serviceDict.getServiceId().intValue()==35||serviceDict.getServiceId().intValue()==147||
|
|
|
|
|
serviceDict.getServiceId().intValue()==36||serviceDict.getServiceId().intValue()==148) {
|
|
|
|
|
if(specificServiceCfg!=null&&appRegion!=null) {
|
|
|
|
|
AppPolicyCfg appPolicyCfg=new AppPolicyCfg();
|
|
|
|
|
BeanUtils.copyProperties(cfg, appPolicyCfg);
|
|
|
|
|
appPolicyCfg.setSpecServiceId(specificServiceCfg.getSpecServiceId());
|
|
|
|
|
appPolicyCfg.setAppCode(specificServiceCfg.getSpecServiceCode());
|
|
|
|
|
appPolicyCfg.setMatchMethod(0);
|
|
|
|
|
appPolicyCfg.setIsHexbin(0);
|
|
|
|
|
appPolicyCfg.setCfgType(appRegion.getConfigRegionValue());
|
|
|
|
|
appPolicyCfg.setCfgRegionCode(appRegion.getConfigRegionCode());
|
|
|
|
|
if(StringUtils.isNotBlank(behaviorId)) {
|
|
|
|
|
appPolicyCfg.setBehavCode(Integer.parseInt(behaviorId));
|
|
|
|
|
appPolicyCfg.setExprType(1);
|
|
|
|
|
}else {
|
|
|
|
|
appPolicyCfg.setExprType(0);
|
|
|
|
|
}
|
|
|
|
|
appPolicyCfgs.add(appPolicyCfg);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
|
|
|
|
BeanUtils.copyProperties(cfg, cfgIndexInfo);
|
|
|
|
|
cfgIndexInfos.add(cfgIndexInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(regionDict.getDictId().intValue()==28) {
|
|
|
|
|
websiteCfgService.saveDnsCfg(complexkeywordCfgs);
|
|
|
|
|
}
|
|
|
|
|
if(regionDict.getDictId().intValue()==30||regionDict.getDictId().intValue()==31) {
|
|
|
|
|
mailCfgService.saveMailCfg(complexkeywordCfgs);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ipCfgService.saveCfgIndexOf(cfgIndexInfos);
|
|
|
|
|
appCfgService.savePolicyList(appPolicyCfgs);
|
|
|
|
|
}
|
|
|
|
|
|