Merge branch 'develop' of https://git.mesalab.cn/K18_NTCS_WEB/NTC.git into develop
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* 主题网站配置导入模板类
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
public class TopicWebsiteTemplate extends StringAllTemplate{
|
||||
|
||||
private Long topicId; // 主题
|
||||
private Long websiteServiceId; // 网站
|
||||
private String cfgKeywords; // 域名
|
||||
|
||||
@ExcelField(title="topic",dictType="TOPIC",sort=2)
|
||||
public Long getTopicId() {
|
||||
return topicId;
|
||||
}
|
||||
public void setTopicId(Long topicId) {
|
||||
this.topicId = topicId;
|
||||
}
|
||||
|
||||
@ExcelField(title="website_server",dictType="WEBSITE_SERVER",sort=3)
|
||||
public Long getWebsiteServiceId() {
|
||||
return websiteServiceId;
|
||||
}
|
||||
public void setWebsiteServiceId(Long websiteServiceId) {
|
||||
this.websiteServiceId = websiteServiceId;
|
||||
}
|
||||
|
||||
@ExcelField(title="domain_name",sort=4)
|
||||
public String getCfgKeywords() {
|
||||
return cfgKeywords;
|
||||
}
|
||||
public void setCfgKeywords(String cfgKeywords) {
|
||||
this.cfgKeywords = cfgKeywords;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -250,6 +250,13 @@ public class ExportExcel {
|
||||
index++;
|
||||
}
|
||||
}
|
||||
if("redirect_url".equals(headerStr)) {
|
||||
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
//1、非空
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("required")+"\n";
|
||||
index++;
|
||||
}
|
||||
/*** HTTP(s)阻断 应答码 ***/
|
||||
if("response_code".equals(headerStr)){
|
||||
commentStr="";
|
||||
@@ -448,6 +455,41 @@ public class ExportExcel {
|
||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||
index++;
|
||||
}
|
||||
/*** 主题网站 ***/
|
||||
if(("topic".equals(headerStr)) && (region.getFunctionId().equals(560))){
|
||||
commentStr="";
|
||||
List<SysDataDictionaryItem> dict=DictUtils.getDictList("TOPIC");
|
||||
if(dict !=null && dict.size()>0){
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : dict) {
|
||||
commentStr=commentStr+" "+msgProp.getProperty(sysDataDictionaryItem.getItemValue(),sysDataDictionaryItem.getItemValue())+"\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||
index++;
|
||||
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
//1、非空
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("required")+"\n";
|
||||
index++;
|
||||
index++;
|
||||
|
||||
}
|
||||
if(("website_server".equals(headerStr)) && (region.getFunctionId().equals(560))){
|
||||
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
//1、非空
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("required")+"\n";
|
||||
index++;
|
||||
}
|
||||
if(("domain_name".equals(headerStr)) && (region.getFunctionId().equals(560))){
|
||||
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
//1、非空
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("required")+"\n";
|
||||
index++;
|
||||
}
|
||||
|
||||
if(region.getRegionType().equals(1)){//IP配置
|
||||
//ip配置需要导入的信息:srcIp srcPort destIp destPort Protocol Direction
|
||||
//确定需要导入的srcIp srcPort destIp destPort信息
|
||||
@@ -1036,10 +1078,7 @@ public class ExportExcel {
|
||||
index++;
|
||||
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
//1、非空说明
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("required")+"\n";
|
||||
index++;
|
||||
//2、默认值说明
|
||||
//1、默认值说明
|
||||
if(!StringUtil.isEmpty(defaultValue)){
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
|
||||
index++;
|
||||
|
||||
@@ -217,14 +217,15 @@ public class CheckComplexStringFormatThread implements Callable<String>{
|
||||
}
|
||||
if (StringUtils.isNotBlank(dirtrictP)) {
|
||||
if (StringUtils.isBlank(district)) {
|
||||
if (dirtrictP.indexOf(",") == -1) {
|
||||
/*if (dirtrictP.indexOf(",") == -1) {
|
||||
baseStringCfg.setDistrict(dirtrictP);
|
||||
} else {
|
||||
// baseStringCfg.setDistrict(dirtrictP.split(",")[0]);
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("district") + " ")
|
||||
+ ";");
|
||||
}
|
||||
}*/
|
||||
baseStringCfg.setDistrict(dirtrictP.split(",")[0]);
|
||||
} else if (dirtrictP.indexOf(district) == -1) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("district") + " ")
|
||||
|
||||
@@ -0,0 +1,307 @@
|
||||
package com.nis.util.excel.thread;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jets3t.service.ServiceException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.configuration.AppTopicDomainCfg;
|
||||
import com.nis.domain.configuration.WebsiteDomainTopic;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.SpringContextHolder;
|
||||
import com.nis.web.service.configuration.AppCfgService;
|
||||
|
||||
public class CheckTopicWebsiteFormatThread implements Callable<String>{
|
||||
private Logger logger=Logger.getLogger(CheckTopicWebsiteFormatThread.class);
|
||||
private BlockingQueue<? extends Object> srcQueue;
|
||||
private BlockingQueue<AppTopicDomainCfg> destQueue;
|
||||
private Properties prop;
|
||||
private FunctionServiceDict serviceDict;
|
||||
private FunctionRegionDict regionDict;
|
||||
|
||||
public CheckTopicWebsiteFormatThread(FunctionServiceDict serviceDict,FunctionRegionDict regionDict,Properties prop,BlockingQueue<? extends Object> srcQueue,BlockingQueue<AppTopicDomainCfg> destQueue) {
|
||||
this.serviceDict=serviceDict;
|
||||
this.regionDict=regionDict;
|
||||
this.srcQueue=srcQueue;
|
||||
this.destQueue=destQueue;
|
||||
this.prop=prop;
|
||||
|
||||
}
|
||||
@Override
|
||||
public String call() throws Exception {
|
||||
List<Object> dataList=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
StringBuffer msg=new StringBuffer();
|
||||
while(!srcQueue.isEmpty()) {
|
||||
int size=srcQueue.drainTo(dataList,Constants.MAAT_JSON_SEND_SIZE);
|
||||
if(regionDict.getRegionType().intValue()==2) {
|
||||
try {
|
||||
List<AppTopicDomainCfg> cfgs=this.checkTopicWebsiteCfg(msg,dataList);
|
||||
destQueue.addAll(cfgs);
|
||||
}catch (Exception e) {
|
||||
logger.error("check topicDomainCfg error",e);
|
||||
// TODO: handle exception
|
||||
//msg=e.getMessage();
|
||||
//break;
|
||||
}
|
||||
}
|
||||
dataList.clear();
|
||||
}
|
||||
return msg.toString();
|
||||
}
|
||||
|
||||
public List<AppTopicDomainCfg> checkTopicWebsiteCfg(StringBuffer msg,List<?> list) throws ServiceException {
|
||||
logger.warn("start to validate topicDomainCfg data...");
|
||||
long start=System.currentTimeMillis();
|
||||
List<AppTopicDomainCfg> stringList = new ArrayList<AppTopicDomainCfg>();
|
||||
String exprTypeP = regionDict.getConfigExprType();
|
||||
if (StringUtils.isBlank(exprTypeP)) {
|
||||
throw new RuntimeException("Found String region,but exprType is Empty");
|
||||
}
|
||||
String matchMethodP = regionDict.getConfigMatchMethod();
|
||||
if (StringUtils.isBlank(matchMethodP)) {
|
||||
throw new RuntimeException("Found String region,but matchMethod is Empty");
|
||||
}
|
||||
String hexP = regionDict.getConfigHex();
|
||||
if (StringUtils.isBlank(hexP)) {
|
||||
throw new RuntimeException("Found String region,but hex is Empty");
|
||||
}
|
||||
String mulityKeywordsP = regionDict.getConfigMultiKeywords();
|
||||
if (StringUtils.isBlank(mulityKeywordsP)) {
|
||||
throw new RuntimeException("Found String region,but mulityKeywords is Empty");
|
||||
}
|
||||
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();
|
||||
AppTopicDomainCfg baseStringCfg = new AppTopicDomainCfg();
|
||||
BeanUtils.copyProperties(list.get(i), baseStringCfg);
|
||||
// 配置描述、关键字长度限制
|
||||
if(baseStringCfg.getCfgDesc().length() > 128) {
|
||||
errInfo.append(prop.getProperty("config_describe")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":128") + ";");
|
||||
}
|
||||
|
||||
if (regionDict.getRegionType().equals(2)) {
|
||||
// 主题、网站校验
|
||||
Long topicId = baseStringCfg.getTopicId();
|
||||
Long websiteServiceId = baseStringCfg.getWebsiteServiceId();
|
||||
|
||||
if (topicId == null) {
|
||||
errInfo.append(prop.getProperty("topic") +" "+ prop.getProperty("not_exist") + ";");
|
||||
}
|
||||
|
||||
if (websiteServiceId == null) {
|
||||
errInfo.append(prop.getProperty("website_server") +" "+ prop.getProperty("not_exist") + ";");
|
||||
}
|
||||
|
||||
String keyword = baseStringCfg.getCfgKeywords();
|
||||
if (StringUtils.isBlank(keyword)) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("domain_name") + " ") + ";");
|
||||
}else if(keyword.length() < 4 || keyword.length() > 1024){
|
||||
errInfo.append(prop.getProperty("domain_name")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("min_length")+":4,"+prop.getProperty("max_length")+":1024") + ";");
|
||||
}else {
|
||||
Matcher m = pattern.matcher(keyword);
|
||||
if (m.find()) {
|
||||
errInfo.append(String.format(prop.getProperty("has_invisible_char"),
|
||||
prop.getProperty("domain_name") + " '" + keyword + "'") + ";");
|
||||
}else {
|
||||
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) {
|
||||
if (exprTypeP.indexOf(",") == -1) {
|
||||
if (mulityKeywordsP.equals("0") && exprTypeP.equals("1")) {
|
||||
throw new RuntimeException("region dict config error,dict id is " + regionDict.getDictId());
|
||||
}
|
||||
baseStringCfg.setExprType(Integer.parseInt(exprTypeP));
|
||||
} else if (exprTypeP.indexOf("0") > -1 && mulityKeywordsP.equals("0")) {
|
||||
baseStringCfg.setExprType(0);
|
||||
} else if (exprTypeP.indexOf("1") > -1 && mulityKeywordsP.equals("1")
|
||||
&& keyword.indexOf("\n") > -1) {
|
||||
baseStringCfg.setExprType(1);
|
||||
} else if (exprTypeP.indexOf("0") > -1 && mulityKeywordsP.equals("1")
|
||||
&& keyword.indexOf("\n") == -1) {
|
||||
baseStringCfg.setExprType(0);
|
||||
} else {
|
||||
baseStringCfg.setExprType(Integer.parseInt(exprTypeP.split(",")[0]));
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
exprType = baseStringCfg.getExprType();
|
||||
Integer matchMethod = baseStringCfg.getMatchMethod();
|
||||
if (matchMethod == null) {
|
||||
if (matchMethodP.indexOf(",") == -1) {
|
||||
if (exprTypeP.equals("1") && !matchMethodP.equals("0")) {
|
||||
throw new RuntimeException("region dict config error,dict id is " + regionDict.getDictId());
|
||||
}
|
||||
baseStringCfg.setMatchMethod(Integer.parseInt(matchMethodP));
|
||||
} else if (exprType != null && exprType.intValue() == 1) {
|
||||
if (matchMethodP.indexOf("0") > -1) {
|
||||
baseStringCfg.setMatchMethod(0);
|
||||
} else {
|
||||
throw new RuntimeException("region dict config error,dict id is " + regionDict.getDictId());
|
||||
}
|
||||
|
||||
} else {
|
||||
baseStringCfg.setMatchMethod(Integer.parseInt(matchMethodP.split(",")[0]));
|
||||
}
|
||||
// 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"))
|
||||
+ ";");
|
||||
}
|
||||
}
|
||||
|
||||
Integer isHex = baseStringCfg.getIsHex();
|
||||
Integer isCaseInsenstive = baseStringCfg.getIsCaseInsenstive();
|
||||
if (isHex == null || isCaseInsenstive == null) {
|
||||
if (isHex == null) {
|
||||
if (hexP.indexOf("0")>-1 || hexP.indexOf("2")>-1) {
|
||||
baseStringCfg.setIsHex(0);
|
||||
} else if (hexP.indexOf("1")>-1) {
|
||||
baseStringCfg.setIsHex(1);
|
||||
} else {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("is_hex")) + ";");
|
||||
}
|
||||
}
|
||||
if (isCaseInsenstive == null) {
|
||||
if (hexP.indexOf("0")>-1 || hexP.indexOf("1")>-1) {
|
||||
baseStringCfg.setIsCaseInsenstive(0);
|
||||
} else if (hexP.indexOf("2")>-1) {
|
||||
baseStringCfg.setIsCaseInsenstive(1);
|
||||
} else {
|
||||
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 (hexP.indexOf("1") != -1 && isHex.intValue() == 1) {
|
||||
boolean bl = Pattern.compile("^([0-9|a-f|A-F]*)$").matcher(keyword).matches();
|
||||
if(!bl) {
|
||||
errInfo.append(
|
||||
prop.getProperty("key_word") + " '" + keyword + "' "+String.format(prop.getProperty("contains_non_hex_char")) + ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
isHex = baseStringCfg.getIsHex();
|
||||
isCaseInsenstive = baseStringCfg.getIsCaseInsenstive();
|
||||
if (isHex != null && isCaseInsenstive != null) {
|
||||
if (isHex.intValue() == 0 && isCaseInsenstive.intValue() == 0) {
|
||||
baseStringCfg.setIsHexbin(0);
|
||||
} else if (isHex.intValue() == 1 && isCaseInsenstive.intValue() == 0) {
|
||||
baseStringCfg.setIsHexbin(1);
|
||||
} else if (isHex.intValue() == 0 && isCaseInsenstive.intValue() == 1) {
|
||||
baseStringCfg.setIsHexbin(2);
|
||||
} else if (hexP.indexOf("1") != -1 && isHex.intValue() == 1 && isCaseInsenstive.intValue() == 1) {// 只有是十六进制且取值正确的时候, 才进行(十六进制)与(大小写敏感)的校验
|
||||
errInfo.append(prop.getProperty("hex_case_insensitive")+ ";");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (errInfo.toString().length() > 0) {
|
||||
errTip.append(String.format(prop.getProperty("line"), baseStringCfg.getIndex()) + ",");
|
||||
errTip.append(errInfo);
|
||||
errTip.append("<br>");
|
||||
}else {
|
||||
// 保存到域名关联表中
|
||||
AppCfgService appCfgService = SpringContextHolder.getBean(AppCfgService.class);
|
||||
WebsiteDomainTopic websiteDomainTopic = new WebsiteDomainTopic();
|
||||
websiteDomainTopic.setDomain(baseStringCfg.getCfgKeywords());
|
||||
|
||||
List<WebsiteDomainTopic> dictList = appCfgService.getDomainDict(websiteDomainTopic);
|
||||
if(dictList.size() == 0) {
|
||||
websiteDomainTopic.setWebsiteServiceId(baseStringCfg.getWebsiteServiceId());
|
||||
websiteDomainTopic.setTopicId(baseStringCfg.getTopicId());
|
||||
websiteDomainTopic.setCreateTime(new Date());
|
||||
websiteDomainTopic.setCreatorId(Integer.valueOf(UserUtils.getUser().getId().toString()));
|
||||
websiteDomainTopic.setIsValid(Constants.VALID_YES);
|
||||
appCfgService.saveDomainDict(websiteDomainTopic);
|
||||
}
|
||||
stringList.add(baseStringCfg);
|
||||
}
|
||||
|
||||
}
|
||||
if (errTip.toString().length() > 0) {
|
||||
msg.append(errTip);
|
||||
//throw new ServiceException(errTip.toString());
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("validate topicDomainCfg data finish,cost:"+(end-start));
|
||||
return stringList;
|
||||
}
|
||||
}
|
||||
@@ -105,6 +105,7 @@ import com.nis.domain.configuration.template.IpRateLimitTemplate;
|
||||
import com.nis.domain.configuration.template.P2pHashStringTemplate;
|
||||
import com.nis.domain.configuration.template.P2pIpTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllTemplate;
|
||||
import com.nis.domain.configuration.template.TopicWebsiteTemplate;
|
||||
import com.nis.domain.log.BaseLogEntity;
|
||||
import com.nis.domain.log.SearchReport;
|
||||
import com.nis.domain.maat.MaatCfg;
|
||||
@@ -135,6 +136,7 @@ import com.nis.util.excel.thread.CheckComplexStringFormatThread;
|
||||
import com.nis.util.excel.thread.CheckDnsResStrategyFormatThread;
|
||||
import com.nis.util.excel.thread.CheckIpFormatThread;
|
||||
import com.nis.util.excel.thread.CheckStringFormatThread;
|
||||
import com.nis.util.excel.thread.CheckTopicWebsiteFormatThread;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.ArchiveServcie;
|
||||
import com.nis.web.service.AreaService;
|
||||
@@ -1143,6 +1145,48 @@ public class BaseController {
|
||||
return queue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 多线程验证
|
||||
* @param serviceDict
|
||||
* @param regionDict
|
||||
* @param list
|
||||
* @return
|
||||
* @throws InterruptedException
|
||||
* @throws ExecutionException
|
||||
* @throws ServiceException
|
||||
*/
|
||||
public BlockingQueue<AppTopicDomainCfg> checkTopicWebsiteCfgMulity(StringBuffer _msg,FunctionServiceDict serviceDict, FunctionRegionDict regionDict, BlockingQueue<? extends Object> list) throws InterruptedException, ExecutionException, ServiceException{
|
||||
logger.warn("start checkTopicWebsiteCfgMulity ,size "+list.size());
|
||||
long start=System.currentTimeMillis();
|
||||
BlockingQueue<AppTopicDomainCfg> queue=new ArrayBlockingQueue<>(list.size());
|
||||
ExecutorService service=Executors.newFixedThreadPool(Constants.MULITY_THREAD_SIZE);
|
||||
List<Future<String>> futures=new ArrayList<>();
|
||||
for(int i=0;i<Constants.MULITY_THREAD_SIZE;i++) {
|
||||
CheckTopicWebsiteFormatThread t=new CheckTopicWebsiteFormatThread(serviceDict,regionDict, this.getMsgProp(), list, queue);
|
||||
futures.add(service.submit(t));
|
||||
|
||||
}
|
||||
service.shutdown();
|
||||
while(!service.isTerminated()) {
|
||||
try {
|
||||
Thread.sleep(10);
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
for(Future<String> future:futures) {
|
||||
String msg = future.get();
|
||||
if(StringUtils.isNotBlank(msg)) {
|
||||
//throw new ServiceException(msg);
|
||||
_msg.append(msg);
|
||||
}
|
||||
}
|
||||
long end=System.currentTimeMillis();
|
||||
logger.warn("checkTopicWebsiteCfgMulity finish,cost:"+(end-start)+",size:"+queue.size());
|
||||
return queue;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* setReportSearchTime(报表查询设置开始时间与结束时间) (这里描述这个方法适用条件 – 可选)
|
||||
@@ -1280,6 +1324,7 @@ public class BaseController {
|
||||
BlockingQueue<ComplexkeywordCfg> complexkeywordCfgs =null;
|
||||
BlockingQueue<DnsResStrategy> dnsResStrategies=null;
|
||||
BlockingQueue<AppComplexFeatureCfg> appComplexFeatureCfgs=null;
|
||||
BlockingQueue<AppTopicDomainCfg> appTopicDomainCfgs=null;// 主题网站
|
||||
List<CfgIndexInfo> cfgIndexInfos = new ArrayList<CfgIndexInfo>();
|
||||
List<AppPolicyCfg> appPolicyCfgs = new ArrayList<AppPolicyCfg>();
|
||||
List<AppFeatureIndex> appFeatureIndexs= new ArrayList<AppFeatureIndex>();
|
||||
@@ -1402,6 +1447,9 @@ public class BaseController {
|
||||
}else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
BlockingQueue<HttpsReplaceTemplate> list = ei.getDataList(HttpsReplaceTemplate.class);
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else if(regionDict.getFunctionId().equals(560)){// 主题网站
|
||||
BlockingQueue<TopicWebsiteTemplate> list = ei.getDataList(TopicWebsiteTemplate.class);
|
||||
appTopicDomainCfgs=this.checkTopicWebsiteCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
}else {
|
||||
BlockingQueue<StringAllTemplate> list = ei.getDataList(StringAllTemplate.class );
|
||||
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
|
||||
@@ -1720,103 +1768,159 @@ public class BaseController {
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
List<BaseStringCfg> _stringCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!stringCfgs.isEmpty()) {
|
||||
stringCfgs.drainTo(_stringCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_stringCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_stringCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_stringCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (BaseStringCfg cfg : _stringCfgs) {
|
||||
cfg.setAction(serviceDict.getAction());
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_stringCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_stringCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
if(!regionDict.getFunctionId().equals(560)) {
|
||||
List<BaseStringCfg> _stringCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!stringCfgs.isEmpty()) {
|
||||
stringCfgs.drainTo(_stringCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_stringCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_stringCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_stringCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_stringCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
if(specificServiceCfg!=null) {
|
||||
cfg.setAppCode(specificServiceCfg.getSpecServiceCode());
|
||||
cfg.setSpecServiceId(specificServiceCfg.getSpecServiceId());
|
||||
if(StringUtils.isNotBlank(behaviorId))
|
||||
cfg.setBehavCode(Integer.parseInt(behaviorId));
|
||||
}
|
||||
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 (appRegion != null) {
|
||||
AppPolicyCfg appPolicyCfg = new AppPolicyCfg();
|
||||
BeanUtils.copyProperties(cfg, appPolicyCfg,new String[] {"cfgId"});
|
||||
//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);
|
||||
int ind=0;
|
||||
for (BaseStringCfg cfg : _stringCfgs) {
|
||||
cfg.setAction(serviceDict.getAction());
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_stringCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
appPolicyCfgs.add(appPolicyCfg);
|
||||
}
|
||||
} else {
|
||||
if(!regionDict.getFunctionId().equals(403)) {
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
// 因域名阻断 -限速 -丢包率
|
||||
if(serviceDict.getFunctionId().equals(201) && serviceDict.getAction().equals(64)){
|
||||
cfg.setUserRegion1("0");
|
||||
if(regionIds!=null&®ionIds.size()==_stringCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo, new String[] {"cfgId"});
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_stringCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
if(specificServiceCfg!=null) {
|
||||
cfg.setAppCode(specificServiceCfg.getSpecServiceCode());
|
||||
cfg.setSpecServiceId(specificServiceCfg.getSpecServiceId());
|
||||
if(StringUtils.isNotBlank(behaviorId))
|
||||
cfg.setBehavCode(Integer.parseInt(behaviorId));
|
||||
}
|
||||
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 (appRegion != null) {
|
||||
AppPolicyCfg appPolicyCfg = new AppPolicyCfg();
|
||||
BeanUtils.copyProperties(cfg, appPolicyCfg,new String[] {"cfgId"});
|
||||
//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 {
|
||||
if(!regionDict.getFunctionId().equals(403)) {
|
||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo, new String[] {"cfgId"});
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
}
|
||||
|
||||
}
|
||||
ind++;
|
||||
}
|
||||
ind++;
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _stringCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,asnNoMaps,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.clear();
|
||||
_stringCfgs.clear();
|
||||
}
|
||||
}else {
|
||||
// 主题网站
|
||||
List<AppTopicDomainCfg> _topicDomainCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE);
|
||||
while(!appTopicDomainCfgs.isEmpty()) {
|
||||
appTopicDomainCfgs.drainTo(_topicDomainCfgs, Constants.MAAT_JSON_SEND_SIZE);
|
||||
List<Integer> compileIds=Lists.newArrayList();
|
||||
List<Integer> groupIds=Lists.newArrayList();
|
||||
List<Integer> regionIds=Lists.newArrayList();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,_topicDomainCfgs.size());
|
||||
if(isSend.equals("1")) {
|
||||
groupIds = ConfigServiceUtil.getId(2,_topicDomainCfgs.size());
|
||||
regionIds = ConfigServiceUtil.getId(3,_topicDomainCfgs.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
int ind=0;
|
||||
for (AppTopicDomainCfg cfg : _topicDomainCfgs) {
|
||||
cfg.setAction(serviceDict.getAction());
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
cfg.setDoLog(2);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
if(isSend.equals("1")) {
|
||||
cfg.setIsAudit(Constants.AUDIT_YES);
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
if(groupIds!=null&&groupIds.size()==_topicDomainCfgs.size()) {
|
||||
cfg.setGroupId(groupIds.get(ind));
|
||||
}
|
||||
if(regionIds!=null&®ionIds.size()==_topicDomainCfgs.size()) {
|
||||
cfg.setRegionId(regionIds.get(ind));
|
||||
}
|
||||
}else {
|
||||
cfg.setIsAudit(Constants.AUDIT_NOT_YET);
|
||||
cfg.setIsValid(Constants.VALID_NO);
|
||||
}
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0 : requestId);
|
||||
cfg.setAttribute(attribute);
|
||||
cfg.setClassify(classify);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
if(compileIds!=null&&compileIds.size()==_topicDomainCfgs.size()) {
|
||||
cfg.setCompileId(compileIds.get(ind));
|
||||
}
|
||||
ind++;
|
||||
}
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _topicDomainCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,asnNoMaps,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
_topicDomainCfgs.clear();
|
||||
}
|
||||
ipCfgService.saveAndSend(regionDict, serviceDict, specificServiceCfg, _stringCfgs, cfgIndexInfos, appPolicyCfgs,appFeatureIndexs,asnNoMaps,isSend.equals("1"));
|
||||
cfgIndexInfos.clear();
|
||||
appPolicyCfgs.clear();
|
||||
_stringCfgs.clear();
|
||||
}
|
||||
} else if (regionDict.getRegionType().equals(3)) {
|
||||
if(!regionDict.getFunctionId().equals(563)) {
|
||||
@@ -2178,6 +2282,8 @@ public class BaseController {
|
||||
ei.loadInitParams(HttpsRedirectTemplate.class, this.getMsgProp(), regionDict, serviceDict);
|
||||
}else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
|
||||
ei.loadInitParams(HttpsReplaceTemplate.class, this.getMsgProp(), regionDict, serviceDict);
|
||||
}else if(regionDict.getFunctionId().equals(560)){// 主题网站
|
||||
ei.loadInitParams(TopicWebsiteTemplate.class, this.getMsgProp(), regionDict, serviceDict);
|
||||
}else {
|
||||
ei.loadInitParams(StringAllTemplate.class, msgProp, regionDict, serviceDict);
|
||||
}
|
||||
@@ -2314,7 +2420,7 @@ public class BaseController {
|
||||
logTime+=" "+msgProp.getProperty("begin_date")+":"+log.getSearchFoundStartTime();
|
||||
}
|
||||
if(log.getSearchFoundEndTime()!=null){
|
||||
logTime+=" "+msgProp.getProperty("end_date")+":"+log.getSearchFoundStartTime();
|
||||
logTime+=" "+msgProp.getProperty("end_date")+":"+log.getSearchFoundEndTime();
|
||||
}
|
||||
return logTime;
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ import com.nis.domain.configuration.template.P2pHashStringTemplate;
|
||||
import com.nis.domain.configuration.template.P2pIpTemplate;
|
||||
import com.nis.domain.configuration.template.SnatTemplate;
|
||||
import com.nis.domain.configuration.template.StringAllTemplate;
|
||||
import com.nis.domain.configuration.template.TopicWebsiteTemplate;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
@@ -315,6 +316,9 @@ public class IpController extends BaseController{
|
||||
if(!menuName.equalsIgnoreCase(regionName)) {
|
||||
fileName = menuName +"_"+ fileName;
|
||||
}
|
||||
if(regionDict.getFunctionId().equals(560)) {
|
||||
fileName = menuName + "_Template.xlsx";
|
||||
}
|
||||
//ip类模板
|
||||
if(regionDict.getRegionType().equals(1)){
|
||||
if(regionDict.getFunctionId().equals(5)){// IP Address
|
||||
@@ -440,6 +444,11 @@ public class IpController extends BaseController{
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(560)) {// 主题网站
|
||||
List<TopicWebsiteTemplate> classList=new ArrayList<TopicWebsiteTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, TopicWebsiteTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else{
|
||||
List<StringAllTemplate> classList=new ArrayList<StringAllTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, StringAllTemplate.class, 2);
|
||||
|
||||
@@ -40,7 +40,7 @@ public class DictController extends BaseController {
|
||||
return "/sys/dictList";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/topicAndWebsiteList", ""})
|
||||
@RequestMapping(value = {"/topicAndWebsiteList"})
|
||||
public String topicList(SysDataDictionaryItem sysDictItem,HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||
if(sysDictItem ==null){
|
||||
sysDictItem=new SysDataDictionaryItem();
|
||||
|
||||
@@ -70,6 +70,7 @@ public interface AppCfgDao {
|
||||
public List<AppTopicDomainCfg> findAppTopicDomainList(AppTopicDomainCfg entity) ;
|
||||
public AppTopicDomainCfg getAppTopicDomainCfg(Long cfgId) ;
|
||||
public int insertAppTopicDomainCfg(AppTopicDomainCfg entity);
|
||||
public int insertAppTopicDomainCfgBatch(AppTopicDomainCfg entity);
|
||||
public int updateAppTopicDomainCfg(AppTopicDomainCfg entity);
|
||||
//app 字节特征增删改查
|
||||
public List<AppByteCfg> findAppByteList(AppByteCfg entity) ;
|
||||
|
||||
@@ -1855,6 +1855,20 @@
|
||||
#{isHexbin,jdbcType=INTEGER},#{doLog,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertAppTopicDomainCfgBatch" parameterType="com.nis.domain.configuration.AppTopicDomainCfg" >
|
||||
insert into app_topic_domain_cfg (
|
||||
TOPIC_ID,WEBSITE_SERVICE_ID,SPEC_SERVICE_ID,CFG_DESC,ACTION,IS_VALID,IS_AUDIT,
|
||||
CREATOR_ID,CREATE_TIME,EDITOR_ID,EDIT_TIME,AUDITOR_ID,AUDIT_TIME,
|
||||
SERVICE_ID,REQUEST_ID,COMPILE_ID,IS_AREA_EFFECTIVE,CLASSIFY,
|
||||
ATTRIBUTE,LABLE,AREA_EFFECTIVE_IDS,RATELIMIT,FUNCTION_ID,CFG_TYPE,CFG_REGION_CODE,
|
||||
DOMAIN,EXPR_TYPE,MATCH_METHOD,IS_HEXBIN,DO_LOG
|
||||
)values (
|
||||
<include refid="AppTopicCommonCfg_Value_List" />,
|
||||
#{cfgKeywords,jdbcType=VARCHAR},#{exprType,jdbcType=INTEGER},#{matchMethod,jdbcType=INTEGER},
|
||||
#{isHexbin,jdbcType=INTEGER},#{doLog,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertAppByteCfg" parameterType="com.nis.domain.configuration.AppByteCfg" >
|
||||
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
|
||||
SELECT LAST_INSERT_ID()
|
||||
|
||||
@@ -54,6 +54,7 @@ import com.nis.domain.configuration.AppFeatureIndex;
|
||||
import com.nis.domain.configuration.AppHttpCfg;
|
||||
import com.nis.domain.configuration.AppIpCfg;
|
||||
import com.nis.domain.configuration.AppPolicyCfg;
|
||||
import com.nis.domain.configuration.AppTopicDomainCfg;
|
||||
import com.nis.domain.configuration.AreaBean;
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
@@ -69,6 +70,7 @@ import com.nis.domain.configuration.IpReusePolicyCfg;
|
||||
import com.nis.domain.configuration.PxyObjKeyring;
|
||||
import com.nis.domain.configuration.PxyObjTrustedCaCert;
|
||||
import com.nis.domain.configuration.PxyObjTrustedCaCrl;
|
||||
import com.nis.domain.configuration.WebsiteDomainTopic;
|
||||
import com.nis.domain.maat.GroupReuseAddBean;
|
||||
import com.nis.domain.maat.GroupReuseCfg;
|
||||
import com.nis.domain.maat.MaatCfg;
|
||||
@@ -1621,6 +1623,8 @@ public abstract class BaseService {
|
||||
type="AsnIpCfg";
|
||||
}else if(list.get(0) instanceof AppComplexFeatureCfg) {
|
||||
type="AppComplexFeature";
|
||||
}else if(list.get(0) instanceof AppTopicDomainCfg) {
|
||||
type="AppTopicDomain";
|
||||
}
|
||||
if (cfgIndexInfos != null && cfgIndexInfos.size() > 0) {
|
||||
this.saveCfgIndexOf(cfgIndexInfos);
|
||||
@@ -1645,6 +1649,9 @@ public abstract class BaseService {
|
||||
}else if("AppComplexFeature".equals(type)) {// APP Payload
|
||||
List<AppComplexFeatureCfg> listPage = (List<AppComplexFeatureCfg>) list;
|
||||
this.saveAppComplexFeatureBatch(regionDict,serviceDict,listPage,send);
|
||||
}else if("AppTopicDomain".equals(type)) {// 主题网站
|
||||
List<AppTopicDomainCfg> listPage = (List<AppTopicDomainCfg>) list;
|
||||
this.saveTopicDomainCfgBatch(regionDict,serviceDict,listPage,send);
|
||||
}else if("BaseStringCfg".equals(type)) {
|
||||
List<BaseStringCfg<?>> listPage = (List<BaseStringCfg<?>>) list;
|
||||
// 调用对应配置的service
|
||||
@@ -1924,6 +1931,73 @@ public abstract class BaseService {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入配置时数据批量入库
|
||||
* @param serviceDict
|
||||
* @param regionDict
|
||||
* @param data
|
||||
* @param send
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveTopicDomainCfgBatch(FunctionRegionDict regionDict, FunctionServiceDict serviceDict, List<AppTopicDomainCfg> data, boolean send) {
|
||||
if (regionDict != null) {
|
||||
Integer regionType = regionDict.getRegionType();
|
||||
if (2 == regionType.intValue()) {
|
||||
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
|
||||
AppCfgDao appCfgDao = SpringContextHolder.getBean(AppCfgDao.class);
|
||||
List<MaatCfg> configCompileList = new ArrayList();
|
||||
SqlSession batchSqlSession = null;
|
||||
try{
|
||||
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
|
||||
for(int index = 0; index < data.size();index++){
|
||||
AppTopicDomainCfg cfg = data.get(index);
|
||||
((AppCfgDao) batchSqlSession.getMapper(AppCfgDao.class)).insertAppTopicDomainCfgBatch(cfg);
|
||||
if (send) {
|
||||
if(regionDict.getIsMaat().intValue()==1) {
|
||||
MaatCfg maatCfg=convertMaatCfg(cfg,2);
|
||||
//userRegion处理
|
||||
WebsiteDomainTopic websiteDomainTopic = new WebsiteDomainTopic();
|
||||
websiteDomainTopic.setDomain(cfg.getCfgKeywords());
|
||||
List<WebsiteDomainTopic> domainDict = appCfgDao.getDomainDict(websiteDomainTopic);
|
||||
Long domainId = domainDict.get(0).getId();
|
||||
maatCfg.setUserRegion("WEB_ID=" + domainId);
|
||||
configCompileList.add(maatCfg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (send && configCompileList.size() > 0) {
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(new Date());
|
||||
maatBean.setCreatorName(UserUtils.getUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
// 调用服务接口下发配置数据
|
||||
String json = BaseService.gsonToJson(maatBean);
|
||||
if(configCompileList.size()>10) {
|
||||
logger.info("APP主题网站配置下发配置参数:" + configCompileList.size());
|
||||
}else {
|
||||
logger.info("APP主题网站配置下发配置参数:" + json);
|
||||
}
|
||||
// 调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
logger.info("APP主题网站配置下发响应信息:" + result.getMsg());
|
||||
|
||||
}
|
||||
batchSqlSession.commit();
|
||||
|
||||
}finally {
|
||||
if(batchSqlSession != null){
|
||||
batchSqlSession.close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* APP Payload导入配置时数据批量入库
|
||||
* @param serviceDict
|
||||
|
||||
@@ -1463,4 +1463,5 @@ active_ip_statistics=Active IP Statistics
|
||||
protocol_statistics=Protocol Statistics
|
||||
app_statistics=App Statistics
|
||||
service_statistics=Service Statistics
|
||||
website_statistics=Website Statistics
|
||||
website_statistics=Website Statistics
|
||||
not_exist=not exist
|
||||
@@ -1467,4 +1467,5 @@ active_ip_statistics= \u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043A\u04
|
||||
protocol_statistics=\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043A\u0430 \u041F\u0440\u043E\u0442\u043E\u043A\u043E\u043B\u043E\u0432
|
||||
app_statistics=\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043A\u0430 \u041F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0439
|
||||
service_statistics=\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043A\u0430 \u0421\u0435\u0440\u0432\u0438\u0441\u043E\u0432
|
||||
website_statistics=\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043A\u0430 \u0412\u0435\u0431-\u0441\u0430\u0439\u0442\u043E\u0432
|
||||
website_statistics=\u0421\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043A\u0430 \u0412\u0435\u0431-\u0441\u0430\u0439\u0442\u043E\u0432
|
||||
not_exist=not exist
|
||||
@@ -1463,4 +1463,5 @@ active_ip_statistics=\u6D3B\u8DC3IP\u7EDF\u8BA1
|
||||
protocol_statistics=\u534F\u8BAE\u7EDF\u8BA1
|
||||
app_statistics=App\u7EDF\u8BA1
|
||||
service_statistics=\u670D\u52A1\u7EDF\u8BA1
|
||||
website_statistics=\u7F51\u7AD9\u7EDF\u8BA1
|
||||
website_statistics=\u7F51\u7AD9\u7EDF\u8BA1
|
||||
not_exist=\u4E0D\u5B58\u5728
|
||||
@@ -612,5 +612,5 @@ logServiceTopn=v1/logServiceTopn
|
||||
blockAndDropStat=v1/blockAndDropStat
|
||||
#\u914d\u7f6e\u542f\u505c\u63a5\u53e3
|
||||
configStartStop=v2/configStartStop
|
||||
trafficAppTrend=trafficAppTrend
|
||||
appConnRecordTop100=appConnRecordTop100
|
||||
trafficAppTrend=v1/trafficAppTrend
|
||||
appConnRecordTop100=v1/appConnRecordTop100
|
||||
@@ -0,0 +1,2 @@
|
||||
UPDATE function_region_dict SET is_import = 1 WHERE function_id = 560;
|
||||
UPDATE function_service_dict SET is_import = 1 WHERE function_id = 560;
|
||||
@@ -95,10 +95,12 @@
|
||||
<div for="action"></div>
|
||||
</div>
|
||||
<!-- 600 asn ip、 3:IP白名单、 405:APP协议IP、 403:APP域名特征、 563 APP Payload、 565 APP HTTP、 564 APP DNS、 566 APP SSL -->
|
||||
<c:if test="${(cfg.functionId eq 600) || (cfg.functionId eq 3) || (cfg.functionId eq 405) || (cfg.functionId eq 403) || (cfg.functionId eq 563) || (cfg.functionId eq 565) || (cfg.functionId eq 564) || (cfg.functionId eq 566) }">
|
||||
<c:if test="${(cfg.functionId eq 600) || (cfg.functionId eq 3) || (cfg.functionId eq 405) || (cfg.functionId eq 403) || (cfg.functionId eq 563) || (cfg.functionId eq 565) || (cfg.functionId eq 564) || (cfg.functionId eq 566) ||
|
||||
(cfg.functionId eq 560) }">
|
||||
<div class="row hidden requestIdSel">
|
||||
</c:if>
|
||||
<c:if test="${(cfg.functionId ne 600) && (cfg.functionId ne 3) && (cfg.functionId ne 405) && (cfg.functionId ne 403) && (cfg.functionId ne 563) && (cfg.functionId ne 565) && (cfg.functionId ne 564) && (cfg.functionId ne 566)}">
|
||||
<c:if test="${(cfg.functionId ne 600) && (cfg.functionId ne 3) && (cfg.functionId ne 405) && (cfg.functionId ne 403) && (cfg.functionId ne 563) && (cfg.functionId ne 565) && (cfg.functionId ne 564) && (cfg.functionId ne 566) &&
|
||||
(cfg.functionId ne 560) }">
|
||||
<div class="row requestIdSel">
|
||||
</c:if>
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="letter"/></label>
|
||||
|
||||
@@ -56,7 +56,25 @@
|
||||
<button type="button" class="btn btn-primary"
|
||||
onClick="javascript:window.location='${ctx}/app/topicDomainCfgForm?functionId=${cfg.functionId}'">
|
||||
<i class="fa fa-plus"></i>
|
||||
<spring:message code="add"></spring:message></button>
|
||||
<spring:message code="add"></spring:message></button>
|
||||
|
||||
<c:set var="serviceImport" value="false"></c:set>
|
||||
<c:set var="regionImport" value="false"></c:set>
|
||||
<c:forEach items="${serviceList}" var="service" >
|
||||
<c:if test="${(cfg.functionId eq service.functionId) && service.isImport eq 1}">
|
||||
<c:set var="serviceImport" value="true"></c:set>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
<c:forEach items="${regionList}" var="region" >
|
||||
<c:if test="${(cfg.functionId eq region.functionId) && region.isImport eq 1}">
|
||||
<c:set var="regionImport" value="true"></c:set>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
<c:if test="${serviceImport eq 'true' && regionImport eq 'true'}">
|
||||
<button type="button" class="btn btn-primary import" >
|
||||
<i class="fa fa-plus"></i>
|
||||
<spring:message code="import"></spring:message></button>
|
||||
</c:if>
|
||||
</shiro:hasPermission>
|
||||
</div>
|
||||
|
||||
@@ -476,7 +494,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<c:set var="importPath" value="/app/topicDomainCfgList?functionId=${cfg.functionId}"/>
|
||||
<!-- 模板导入,start -->
|
||||
<%@include file="/WEB-INF/include/excel/importModal.jsp" %>
|
||||
</body>
|
||||
</html>
|
||||
@@ -286,7 +286,7 @@
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label class="control-label"><spring:message code='Web'/>:</label>
|
||||
<label class="control-label"><spring:message code="domain_name"/>:</label>
|
||||
<select id="webSelect" name="webId" title="<spring:message code="select"/>" class="selectpicker form-control" data-max-options="10" data-selected-text-format="count > 3" multiple data-live-search="true" data-live-search-placeholder="<spring:message code="search"/>">
|
||||
<c:forEach items="${webList}" var="web" >
|
||||
<option value="${web.code}"><spring:message code="${web.item}"></spring:message></option>
|
||||
@@ -360,7 +360,7 @@
|
||||
|
||||
<th class="sort-column app_id" column="APP">APP</th>
|
||||
<th class="sort-column proto_id" column="application_layer_protocol"><spring:message code="application_layer_protocol"/></th>
|
||||
<th class="sort-column web_id" column="Web"><spring:message code="domain_name"/></th>
|
||||
<th class="sort-column web_id" column="domain_name"><spring:message code="domain_name"/></th>
|
||||
|
||||
<th class="sort-column cap_ip" column="clj_ip"><spring:message code="clj_ip"/></th>
|
||||
<th class="sort-column trans_proto" column="transport_layer_protocol" isVisible="false"><spring:message code="transport_layer_protocol"/></th>
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
config_sync_tip:"The system is being maintained and temporarily inaccessible.",
|
||||
ipMaskSole:"IP already exists.",
|
||||
noStrategyCheck:"No effective spoofing IP configuration",
|
||||
keywordLength:"Please enter a value between 4 and 1024 characters long."
|
||||
keywordLength:"Please enter a value between 4 and 1024 characters long.",
|
||||
arbitrary:"Arbitrarily"
|
||||
});
|
||||
}(jQuery));
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
config_sync_tip:"Система находится под техническим обслуживанием и временно недоступна.",
|
||||
ipMaskSole:"IP уже существует.",
|
||||
noStrategyCheck:"No effective spoofing IP configuration",
|
||||
keywordLength:"Введите между 4 и 1024 символов длинной."
|
||||
keywordLength:"Введите между 4 и 1024 символов длинной.",
|
||||
arbitrary:"Любой"
|
||||
});
|
||||
}(jQuery));
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
config_sync_tip:"系统正在维护中,暂时不可访问!",
|
||||
ipMaskSole:"IP已存在",
|
||||
noStrategyCheck:"策略组下无有效的欺骗IP配置",
|
||||
keywordLength:"请输入一个长度介于4 和1024 之间的字符串"
|
||||
keywordLength:"请输入一个长度介于4 和1024 之间的字符串",
|
||||
arbitrary:"任意"
|
||||
});
|
||||
}(jQuery));
|
||||
|
||||
Reference in New Issue
Block a user