asn相关功能修改

This commit is contained in:
duandongmei
2019-01-16 13:55:12 +06:00
parent cc0b7dc86c
commit 616a80555d
8 changed files with 346 additions and 49 deletions

View File

@@ -61,6 +61,17 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
protected String exType;//导出类型
protected String hColumns;//导出隐藏列
private String commonGroupIds; //公共组织id(考虑一个compile存在多个asn组织的情况)
public String getCommonGroupIds() {
return commonGroupIds;
}
public void setCommonGroupIds(String commonGroupIds) {
this.commonGroupIds = commonGroupIds;
}
public String getExType() {
return exType;
}
@@ -119,13 +130,13 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
/**
* 有效标识
*/
@ExcelField(title="valid_identifier",dictType="VALID_IDENTIFIER",sort=90)
@ExcelField(title="valid_identifier",dictType="VALID_IDENTIFIER",sort=109)
@Expose
protected Integer isValid;
/**
* 是否审核
*/
@ExcelField(title="is_audit",dictType="AUDIT_STATUS",sort=25)
@ExcelField(title="is_audit",dictType="AUDIT_STATUS",sort=37)
protected Integer isAudit;
/**
* 创建人员
@@ -263,7 +274,6 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
protected Integer doLog = Constants.MAAT_CFG_DOLOG_DEFAULT;
@ExcelField(title="do_blacklist",dictType="DO_BLACKLIST",sort=31)
protected Integer doBlackList=Constants.MAAT_CFG_DOLOG_DOBLACKLIST_DEFAULT;
protected Integer groupId;//仅用于copy属性使用
protected Integer regionId;//仅用于copy属性使用
protected Integer numberRegionGroupId;//仅用于copy属性使用

View File

@@ -11,9 +11,11 @@ package com.nis.domain.configuration;
import java.util.List;
import java.util.Map;
import com.google.gson.annotations.Expose;
import com.nis.domain.basics.AsnGroupInfo;
import com.nis.domain.basics.AsnIpCfg;
import com.nis.domain.basics.IpReuseIpCfg;
import com.nis.util.Constants;
import com.nis.util.excel.ExcelField;
@@ -84,6 +86,12 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
private String country;
private String detail;
private List<AsnKeywordCfg> asnKeywords;
@ExcelField(title="log_total",sort=31)
private Long totalLogs;
@ExcelField(title="is_audit",dictType="AUDIT_STATUS",sort=20)
private Integer isAudit;
@ExcelField(title="do_log",dictType="DO_LOG",sort=27)
private Integer doLog = Constants.MAAT_CFG_DOLOG_DEFAULT;
/*private CachePolicyUserRegion cachePolicyUserRegion;//缓存策略用户自定义域参数
@@ -93,9 +101,18 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
}
}*/
public Integer getIsValid() {
return isValid;
}
public void setIsValid(Integer isValid) {
this.isValid = isValid;
}
public Integer getDoLog() {
return doLog;
}
public void setDoLog(Integer doLog) {
this.doLog = doLog;
}
public String getOrganization() {
return organization;
}
@@ -402,5 +419,11 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
this.complexCfg = complexCfg;
}
public Long getTotalLogs() {
return totalLogs;
}
public void setTotalLogs(Long totalLogs) {
this.totalLogs = totalLogs;
}
}

View File

@@ -356,7 +356,7 @@ public class ConfigServiceUtil {
}else if(type==2){
url = url+Constants.CALLBACK_CFG;
}else if(type==3) {
url = url+Constants.GROUP_REUSE_SOURCES;
url = url+Constants.DELETE_COMMON_REIGON;
}
//创建连接
WebTarget wt = ClientUtil.getWebTarger(url);
@@ -400,9 +400,9 @@ public class ConfigServiceUtil {
url = url+Constants.MAAT_CFG;
}else if(type==2){
url = url+Constants.CALLBACK_CFG;
}else if(type==3) {
}/*else if(type==3) {
url = url+Constants.GROUP_REUSE_SOURCES;
}
}*/
logger.info("put url:"+url);
//创建连接
try {
@@ -463,26 +463,43 @@ public class ConfigServiceUtil {
return bean;
}
/**
* 分组复用域配置新增
* 分组复用域配置新增,修改,删除
* @param params
* @return
* @throws MaatConvertException
*/
public static ToMaatResult postGroupReuseSources(String params) throws MaatConvertException{
public static ToMaatResult auditCommonGroupRegionSources(String params,Integer action) throws MaatConvertException{
ToMaatResult bean = null;
Response response=null;
try {
logger.warn("postGroupReuseSources start");
long start=System.currentTimeMillis();
String result = null;
String url = Constants.SERVICE_URL+Constants.GROUP_REUSE_SOURCES;
String url = "";
if(action.equals(Constants.OPACTION_POST)){
url=Constants.SERVICE_URL+Constants.ADD_COMMON_REGION;
}
if(action.equals(Constants.OPACTION_PUT)){
url=Constants.SERVICE_URL+Constants.UPDATE_COMMON_REIGON;
}
if(action.equals(Constants.OPACTION_DELETE)){
url=Constants.SERVICE_URL+Constants.DELETE_COMMON_REIGON;
}
//创建连接
WebTarget wt = ClientUtil.getWebTarger(url);
logger.info("postGroupReuseSources url:"+url);
logger.info("auditCommonGroupRegionSources url:"+url);
//获取响应结果
Builder header = wt.request(MediaType.APPLICATION_JSON).header("Content-Type", MediaType.APPLICATION_JSON);
try {
response= header.post(Entity.entity(params, MediaType.APPLICATION_JSON));
if(action.equals(Constants.OPACTION_POST)){
response= header.post(Entity.entity(params, MediaType.APPLICATION_JSON));
}
if(action.equals(Constants.OPACTION_PUT)){
response= header.put(Entity.entity(params, MediaType.APPLICATION_JSON));
}
if(action.equals(Constants.OPACTION_DELETE)){
response= header.put(Entity.entity(params, MediaType.APPLICATION_JSON));
}
if(response != null) {
result=response.readEntity(String.class);
}
@@ -498,7 +515,7 @@ public class ConfigServiceUtil {
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
}
long end=System.currentTimeMillis();
logger.warn("postGroupReuseSources end,cost:"+(end-start));
logger.warn("auditCommonGroupRegionSources end,cost:"+(end-start));
} catch (Exception e) {
throw e;
} finally {
@@ -508,6 +525,7 @@ public class ConfigServiceUtil {
}
return bean;
}
/**
*
* getReport(配置日志总量统计查询)
@@ -566,6 +584,64 @@ public class ConfigServiceUtil {
}
return result;
}
/**
*
* getReport(配置日志总量统计查询)
* (这里描述这个方法适用条件 可选)
* @param type 1- 配置命中总量业务2- 配置报表业务
* @param ids
* @param serviceIds
* @param searchReportStartTime
* @param searchReportEndTime
* @param connTimeOut httpclient 连接超时时间
* @param readTimeOut httpclient 读取超时时间
* @return
* @throws MaatConvertException
*/
public static String getReport(int type,String ids,String serviceIds,String searchReportStartTime,String searchReportEndTime,Integer connTimeOut,Integer readTimeOut) throws MaatConvertException{
String result = null;
Response response=null;
try {
if(StringUtils.isBlank(ids)||StringUtils.isBlank(serviceIds)){
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
}
UriBuilder builder=UriBuilder.fromPath(Constants.LOG_BASE_URL+Constants.NTC_PZ_REPORT);
builder.queryParam("searchBusinessType",type);
builder.queryParam("searchService",serviceIds);
builder.queryParam("searchCfgId",ids);
if(StringUtils.isNotBlank(searchReportStartTime)) {
builder.queryParam("searchReportStartTime",searchReportStartTime);
}
if(StringUtils.isNotBlank(searchReportEndTime)) {
builder.queryParam("searchReportEndTime",searchReportEndTime);
}
URI uri=builder.build();
//创建连接
ClientUtil.initClient(connTimeOut,readTimeOut);
Client client=ClientUtil.getClient();
WebTarget wt = client.target(uri);
logger.info("getReport url:"+uri.toString());
Builder header = wt.request();
try {
response= header.get();
} catch (Exception e) {
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
}
if(response !=null && response.getStatus() == 200){
result= response.readEntity(String.class);
}else{
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
}
} catch (Exception e) {
throw e;
} finally {
if (response != null) {
response.close();
}
}
return result;
}
public static String getReport(String reportUrl, SearchReport searchCondition) throws MaatConvertException{
// if(StringUtils.isBlank(searchCondition.getSearchService())){
// throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");

View File

@@ -13,7 +13,9 @@ public final class Constants {
*/
public static final int IMPORT_LIMIT=Configurations.getIntProperty("import_limit",10000);
public static final Object IMPORT_LOCK=new Object();
public static final String GROUP_REUSE_SOURCES=Configurations.getStringProperty("groupReuseSources","groupReuseSources");
public static final String ADD_COMMON_REGION=Configurations.getStringProperty("addRegionToCommonGroup","");
public static final String UPDATE_COMMON_REIGON=Configurations.getStringProperty("updateRegionToCommonGroup","");
public static final String DELETE_COMMON_REIGON=Configurations.getStringProperty("deleteRegionToCommonGroup","");
public static Integer APP_SPEC_SERVICE_CODE_MIN_VAL=Configurations.getIntProperty("app_spec_service_code_min_val", 300001);
public static Integer APP_SPEC_SERVICE_CODE_MAX_VAL=Configurations.getIntProperty("app_spec_service_code_max_val", 268435455);
public static String APP_CFG_USERREGION_SPLITOR=Configurations.getStringProperty("app_cfg_userregion_splitor", "&");
@@ -494,6 +496,7 @@ public final class Constants {
public static final String HTTP_URL_REGION = Configurations.getStringProperty("http_url_region","http_url");
public static final String VOIP_IP_REGION = Configurations.getStringProperty("voip_ip","av_voip_ip");
public static final String VOIP_ACCOUNT_REGION = Configurations.getStringProperty("voip_account","av_voip_account");
public static final String NTC_ASN_NUMBER = Configurations.getStringProperty("ntc_asn_number","NTC_ASN_NUMBER");
public static final String MAAT_VERSION = Configurations.getStringProperty("maat_version","1.0");
public static final Integer INSERT_ACTION = Configurations.getIntProperty("insert_action",1);
public static final Integer UPDATE_ACTION = Configurations.getIntProperty("update_action",2);
@@ -805,4 +808,9 @@ public final class Constants {
//配置启停服务接口方法
public static final String CONFIG_START_STOP_UPDATE=Configurations.getStringProperty("configStartStop", "configStartStop");
/**
* 流量日志的SSL泛收接口URL
*/
public static final String NTC_SSL_RECORD_LOG = Configurations.getStringProperty("ntcSslRecordLog","");
}

View File

@@ -106,12 +106,22 @@ public class CheckIpFormatThread implements Callable<String>{
BeanUtils.copyProperties(list.get(i), baseIpCfg);
String cfgDesc = baseIpCfg.getCfgDesc();
// 配置描述限制
if(StringUtils.isBlank(cfgDesc)) {
errInfo.append(
String.format(prop.getProperty("can_not_null"), prop.getProperty("config_describe")) + ";");
}else if(cfgDesc.length() > 128) {
errInfo.append(prop.getProperty("config_describe")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":128") + ";");
if(!regionDict.getFunctionId().equals(600)){
if(StringUtils.isBlank(cfgDesc)) {
errInfo.append(
String.format(prop.getProperty("can_not_null"), prop.getProperty("config_describe")) + ";");
}else if(cfgDesc.length() > 128) {
errInfo.append(prop.getProperty("config_describe")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":128") + ";");
}
}
if(regionDict.getFunctionId().equals(200)) {
if(!serviceDict.getAction().equals(1)) {
baseIpCfg.setDoLog(0);
}
}
// doLog属性检验
this.validDoLog(baseIpCfg,errInfo);
// 特殊字段验证
// packet ip ratelimit
@@ -158,16 +168,17 @@ public class CheckIpFormatThread implements Callable<String>{
// payload ip
if (regionDict.getFunctionId().equals(212)) {
// replace_zone
if (StringUtils.isBlank(baseIpCfg.getUserRegion1())) {
List<SysDataDictionaryItem> dict=DictUtils.getDictList("INTERCEPT_REPLACE_ZONE");
baseIpCfg.setUserRegion1(dict.get(0).getItemCode());
}
String userRegion1 = baseIpCfg.getUserRegion1();
if (StringUtils.isNotBlank(userRegion1)) {
Object val = DictUtils.getDictLabel("INTERCEPT_REPLACE_ZONE", userRegion1);
if (StringUtils.isBlank(val.toString())) {
if (StringUtils.isBlank(val.toString())||"默认".equals(val.toString())) {
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("replace_zone"))
+ ";");
}
} else {
errInfo.append(
String.format(prop.getProperty("can_not_null"), prop.getProperty("replace_zone")) + ";");
}
// replaced_content
@@ -369,16 +380,31 @@ public class CheckIpFormatThread implements Callable<String>{
String.format(prop.getProperty("is_incorrect"), prop.getProperty("antiddos_protocol"))
+ ";");
}
if(bpsThreadshold==null) {
errInfo.append(
String.format(prop.getProperty("can_not_null"), prop.getProperty("bps_threadshold"))
+ ";");
}else {
if(bpsThreadshold < 1000000) {
errInfo.append(prop.getProperty("bps_threadshold")+prop.getProperty("min_value")+"1000000;");
}else if(String.valueOf(bpsThreadshold).length() > 18) {
errInfo.append(prop.getProperty("bps_threadshold")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":18") + ";");
}
}
if(ppsThreadshold==null) {
errInfo.append(
String.format(prop.getProperty("can_not_null"), prop.getProperty("pps_threadshold"))
+ ";");
}else {
if(ppsThreadshold < 1000) {
errInfo.append(prop.getProperty("pps_threadshold")+prop.getProperty("min_value")+"1000;");
}else if(String.valueOf(ppsThreadshold).length() > 18) {
errInfo.append(prop.getProperty("pps_threadshold")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":18") + ";");
}
}
if("TCP_SYN".equals(antiddosProtocol)) {
baseIpCfg.setProtocol(6);
}else if("UDP_NTP".equals(antiddosProtocol)) {
@@ -512,6 +538,38 @@ public class CheckIpFormatThread implements Callable<String>{
}
}
// IpSpoofing
if (regionDict.getFunctionId().equals(214)) {
List<SysDataDictionaryItem> dicts = DictUtils.getDictList("SPOOFING_IP_TYPE");
if(StringUtils.isBlank(baseIpCfg.getUserRegion1())) {
baseIpCfg.setUserRegion1(dicts.get(0).getItemCode());
}
String userRegion1 = baseIpCfg.getUserRegion1(); // SpooFing
String userRegion2 = baseIpCfg.getUserRegion2(); // With
if (StringUtils.isNotBlank(userRegion1)) {
boolean has = false;
for (SysDataDictionaryItem dict : dicts) {
if (dict.getItemCode().equals(userRegion1)) {
has = true;
break;
}
}
if (!has) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),prop.getProperty("spoofing") + " ") + ";");
}
}
String errMsg = null == prop.getProperty("With")?"With ":prop.getProperty("With");
if(StringUtils.isBlank(userRegion2)) {
errInfo.append(
String.format(prop.getProperty("can_not_null"),errMsg + " ") + ";");
}else {
String regex = "^((25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(25[0-5]|2[0-4]\\d|[01]?\\d\\d?)$";
if(!userRegion2.matches(regex)) {
errInfo.append(String.format(prop.getProperty("is_in_wrong_format"),errMsg +" ") + ";");
}
}
}
if (regionDict.getRegionType().equals(1)) {
boolean srcIpEmpty = false;
boolean destIpEmpty = false;
@@ -1153,7 +1211,31 @@ public class CheckIpFormatThread implements Callable<String>{
errInfo.append(prop.get(ipName) + " " + prop.get("ip_range_smaller") + ";");
}
}
/**
* doLog属性校验
* @param baseIpCfg
* @param errInfo
*/
public void validDoLog(IpPortCfg baseIpCfg, StringBuffer errInfo) {
String configDoLog = serviceDict.getConfigDoLog();
if(StringUtils.isNotBlank(configDoLog)) {
String defaultValue = configDoLog.substring(configDoLog.lastIndexOf(";")+1);
String doLogOption = configDoLog.substring(configDoLog.indexOf(";")+1, configDoLog.lastIndexOf(";"));
if(baseIpCfg.getDoLog() == null) {
baseIpCfg.setDoLog(Integer.parseInt(defaultValue));
}
Integer doLog = baseIpCfg.getDoLog();
if(!doLogOption.contains(doLog+"")) {
errInfo.append(
String.format(prop.getProperty("is_incorrect"), prop.getProperty("do_log"))
+ ";");
}
}
}
/**
* 根据位运算把 byte[] -> int
*

View File

@@ -3,9 +3,11 @@ package com.nis.web.controller.configuration.ntc;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -25,6 +27,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.FunctionRegionDict;
import com.nis.domain.FunctionServiceDict;
import com.nis.domain.Page;
import com.nis.domain.configuration.AppPolicyCfg;
import com.nis.domain.configuration.AsnKeywordCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.IpPortCfg;
@@ -32,6 +35,7 @@ import com.nis.domain.configuration.NtcSubscribeIdCfg;
import com.nis.domain.configuration.template.AppDomainTemplate;
import com.nis.domain.configuration.template.AppPayloadTemplate;
import com.nis.domain.configuration.template.AsnIpTemplate;
import com.nis.domain.configuration.template.ComplexStringAllNotDoLogTemplate;
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
import com.nis.domain.configuration.template.DdosIpTemplate;
import com.nis.domain.configuration.template.DnsComplexStringTemplate;
@@ -50,15 +54,19 @@ import com.nis.domain.configuration.template.HttpsRejectTemplate;
import com.nis.domain.configuration.template.HttpsReplaceComplexTemplate;
import com.nis.domain.configuration.template.HttpsReplaceIpTemplate;
import com.nis.domain.configuration.template.HttpsReplaceTemplate;
import com.nis.domain.configuration.template.IpAllNotDoLogTemplate;
import com.nis.domain.configuration.template.IpAllTemplate;
import com.nis.domain.configuration.template.IpPayloadTemplate;
import com.nis.domain.configuration.template.IpRateLimitTemplate;
import com.nis.domain.configuration.template.IpSpoofingTemplate;
import com.nis.domain.configuration.template.IpWhitelistTemplate;
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.StringAllNotDoLogTemplate;
import com.nis.domain.configuration.template.StringAllTemplate;
import com.nis.domain.configuration.template.TopicWebsiteTemplate;
import com.nis.domain.specific.SpecificServiceCfg;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
@@ -327,7 +335,12 @@ public class IpController extends BaseController{
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpRateLimitTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else{
}else if(serviceDict.getAction().equals(32)){ // 丢弃
List<IpAllNotDoLogTemplate> classList=new ArrayList<IpAllNotDoLogTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpAllNotDoLogTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else {
List<IpAllTemplate> classList=new ArrayList<IpAllTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpAllTemplate.class, 2);
excel.setDataList(pro,classList,null).
@@ -376,21 +389,38 @@ public class IpController extends BaseController{
}else if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
List<HttpsRejectIpTemplate> classList=new ArrayList<HttpsRejectIpTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRejectIpTemplate.class, 2);
excel.setDataList(this.getMsgProp(),classList,null).
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
List<HttpsRedirectIpTemplate> classList=new ArrayList<HttpsRedirectIpTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRedirectIpTemplate.class, 2);
excel.setDataList(this.getMsgProp(),classList,null).
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
List<HttpsReplaceIpTemplate> classList=new ArrayList<HttpsReplaceIpTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceIpTemplate.class, 2);
excel.setDataList(this.getMsgProp(),classList,null).
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(200) && serviceDict.getAction().equals(64)) {// 拦截策略IP限速
List<IpRateLimitTemplate> classList=new ArrayList<IpRateLimitTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpRateLimitTemplate.class, 2);
}else if(regionDict.getFunctionId().equals(211)){// HTTP(s)白名单
List<IpAllNotDoLogTemplate> classList=new ArrayList<IpAllNotDoLogTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, IpAllNotDoLogTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(200)) {// 拦截策略IP
if(serviceDict.getAction().equals(64)) {
List<IpRateLimitTemplate> classList=new ArrayList<IpRateLimitTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpRateLimitTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else {
List<IpAllNotDoLogTemplate> classList=new ArrayList<IpAllNotDoLogTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpAllNotDoLogTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}
}else if(regionDict.getFunctionId().equals(214)){// IpSpoofing
List<IpSpoofingTemplate> classList=new ArrayList<IpSpoofingTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, IpSpoofingTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else{
@@ -432,22 +462,27 @@ public class IpController extends BaseController{
}else if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
List<HttpsRejectTemplate> classList=new ArrayList<HttpsRejectTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRejectTemplate.class, 2);
excel.setDataList(this.getMsgProp(),classList,null).
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
List<HttpsRedirectTemplate> classList=new ArrayList<HttpsRedirectTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRedirectTemplate.class, 2);
excel.setDataList(this.getMsgProp(),classList,null).
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
List<HttpsReplaceTemplate> classList=new ArrayList<HttpsReplaceTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceTemplate.class, 2);
excel.setDataList(this.getMsgProp(),classList,null).
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(211)){// HTTP(s)白名单
List<StringAllNotDoLogTemplate> classList=new ArrayList<StringAllNotDoLogTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, StringAllNotDoLogTemplate.class, 2);
excel.setDataList(pro,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).
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else{
List<StringAllTemplate> classList=new ArrayList<StringAllTemplate>();
@@ -467,22 +502,27 @@ public class IpController extends BaseController{
}else if(regionDict.getFunctionId().equals(207)){// HTTP(s)阻断
List<HttpsRejectComplexTemplate> classList=new ArrayList<HttpsRejectComplexTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRejectComplexTemplate.class, 2);
excel.setDataList(this.getMsgProp(),classList,null).
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(208)){// HTTP(s)重定向
List<HttpsRedirectComplexTemplate> classList=new ArrayList<HttpsRedirectComplexTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsRedirectComplexTemplate.class, 2);
excel.setDataList(this.getMsgProp(),classList,null).
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
List<HttpsReplaceComplexTemplate> classList=new ArrayList<HttpsReplaceComplexTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceComplexTemplate.class, 2);
excel.setDataList(this.getMsgProp(),classList,null).
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(211)){// HTTP(s)白名单
List<ComplexStringAllNotDoLogTemplate> classList=new ArrayList<ComplexStringAllNotDoLogTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, ComplexStringAllNotDoLogTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(563)) {// APP Payload
List<AppPayloadTemplate> classList=new ArrayList<AppPayloadTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, AppPayloadTemplate.class, 2);
excel.setDataList(this.getMsgProp(),classList,null).
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else{
List<ComplexStringAllTemplate> classList=new ArrayList<ComplexStringAllTemplate>();
@@ -514,7 +554,7 @@ public class IpController extends BaseController{
this._import(request,response,redirectAttributes, files,serviceDictId,regionDictIds,requestId,attribute,classify);
return "redirect:" + adminPath+ importPath;
}
//ip配置导出
//ip配置导出
@RequestMapping(value = "exportIpAddr")
public void exportIpAddr(Model model,HttpServletRequest request,HttpServletResponse response,
@ModelAttribute("cfg")CfgIndexInfo entity,String ids,RedirectAttributes redirectAttributes){
@@ -538,6 +578,35 @@ public class IpController extends BaseController{
Page<CfgIndexInfo> page = ipCfgService.getIpCfgList(pageInfo, entity);
ipLists=page.getList();
}
List<Map<String,Object>> logTotals=new ArrayList<Map<String,Object>>();
StringBuilder compileIds=new StringBuilder(",");//配置ids
Set<Integer> set=new HashSet<Integer>();//服务ids
for (CfgIndexInfo cfg : ipLists) {
if(cfg.getIsAudit()!=0){
set.add(cfg.getServiceId());
compileIds.append(cfg.getCompileId()+",");
}else{
Map<String,Object> logTotal=new HashMap<String,Object>();
logTotal.put("compileId", cfg.getCompileId()+"");
logTotal.put("sum",0L);
logTotals.add(logTotal);
}
}
StringBuilder serviceIds=new StringBuilder(",");
for (Integer id : set) {
serviceIds.append(id+",");
}
if(serviceIds.length()>1&&compileIds.length()>1){
String serviceIdsStr=serviceIds.toString().substring(1, serviceIds.length()-1);
String compileIdsStr=compileIds.toString().substring(1, compileIds.length()-1);
//获取日志总量
if(!StringUtils.isBlank(serviceIdsStr)&&!StringUtils.isBlank(compileIdsStr)){
List<Map<String,Object>> logs = getLogTotal( null,serviceIdsStr,compileIdsStr);
logTotals.addAll(logs);
}
}
titleList.add(entity.getMenuNameCode());
titleList.add("NTC_IP");
titleList.add("asn_policy");
@@ -569,6 +638,12 @@ public class IpController extends BaseController{
List<IpPortCfg> ipList=new ArrayList<IpPortCfg>();
List<AsnKeywordCfg> groupInfoList=new ArrayList<AsnKeywordCfg>();
for (CfgIndexInfo cfg : ipLists) {
for (Map<String,Object> logTotal : logTotals) {
if(cfg.getCompileId().equals(Integer.parseInt((String) logTotal.get("compileId")))){
cfg.setTotalLogs((Long)logTotal.get("sum"));
break;
}
}
CfgIndexInfo cfgIndexInfo=ipCfgService.exportIpInfo(cfg);
ipList.addAll(cfgIndexInfo.getIpPortList());
if(cfgIndexInfo.getAsnKeywords()!=null) {

View File

@@ -613,4 +613,8 @@ blockAndDropStat=v1/blockAndDropStat
#\u914d\u7f6e\u542f\u505c\u63a5\u53e3
configStartStop=v2/configStartStop
trafficAppTrend=v1/trafficAppTrend
appConnRecordTop100=v1/appConnRecordTop100
appConnRecordTop100=v1/appConnRecordTop100
ntc_asn_number=NTC_ASN_NUMBER
addRegionToCommonGroup=v1/addRegionToCommonGroup
updateRegionToCommonGroup=v1/updateCommonGroupRegion
deleteRegionToCommonGroup=v1/delCommonGroupRegion

View File

@@ -67,7 +67,7 @@ function del(url){
var checkboxes=$("#${id} ${value} tbody tr td input.i-checks:checkbox");
if($(checkboxes).filter(":checked").length>0){
if(validateAllNoAudit(checkboxes)){
if(validateIsDelete(checkboxes)){
top.$.jBox.tip("<spring:message code='has_prohibit_delete'/>", "<spring:message code='info'/>");
return;
}else{
@@ -111,12 +111,15 @@ function update(url){
var cked = $("tbody tr td input.i-checks:checkbox:checked");
if($(checkboxes).filter(":checked").length==1){
if(cked.val()==1){
top.$.jBox.tip("<spring:message code='has_approved'/>", "<spring:message code='info'/>");
return;
}else if(cked.val()==3){
//增加asn ip域配置判断如果是asn ip业务审核通过的也可以修改 functionId=600
if($("input[name='functionId']").val() != 600){
top.$.jBox.tip("<spring:message code='has_approved'/>", "<spring:message code='info'/>");
return;
}
}/* else if(cked.val()==3){
top.$.jBox.tip("<spring:message code='cancel_approved'/>", "<spring:message code='info'/>");
return;
}
} */
//处理asnIp,asn组下发过的ip配置不允许修改
if(cked.attr("asnGroup")&&cked.attr("isValid")){
var asnGroup=cked.attr("asnGroup");
@@ -377,6 +380,18 @@ function cancelPassOpt(url){
});
return flag;
}
//验证是否可删除
function validateIsDelete(checkboxes){
var flag = false;
$(checkboxes).filter(":checked").each(function(){
//alert($(this).val());
if($(this).val()!=0 && $(this).val()!=3){//状态为3的配置为取消审核的配置可删除
flag = true;
return;
}
});
return flag;
}
//验证选择的配置,是否有审核通过的
function validatePass(checkboxes){
var flag = false;
@@ -415,6 +430,10 @@ function cancelPassOpt(url){
url+="&"+$("#exportType").val()+"="+$("#exportValue").val();
}
}
if(column.toString()!="" && column.toString() =="<spring:message code='log'/>"){
top.$.jBox.tip("<spring:message code='all_columns_hidden'/>", "<spring:message code='info'/>");
return;
}
if(column.toString()!=""){
url+="&columns="+column.toString();
}else{