(1)修复回调类IP转换提示不能为range的bug
(2)DDOS IP模板提交 (3)DDOS IP导入提交 (4)修复DDOS IP REGION CONFIG_IP_PORT_SHOW的值为3,4
This commit is contained in:
@@ -25,7 +25,31 @@ public class IpPortCfg extends BaseIpCfg {
|
||||
*/
|
||||
|
||||
private static final long serialVersionUID = 4664942095843594575L;
|
||||
//仅用作导入时copy属性
|
||||
private String antiddosProtocol;
|
||||
//仅用作导入时copy属性
|
||||
private Long bpsThreadshold;
|
||||
//仅用作导入时copy属性
|
||||
private Long ppsThreadshold;
|
||||
|
||||
public String getAntiddosProtocol() {
|
||||
return antiddosProtocol;
|
||||
}
|
||||
public void setAntiddosProtocol(String antiddosProtocol) {
|
||||
this.antiddosProtocol = antiddosProtocol;
|
||||
}
|
||||
public Long getBpsThreadshold() {
|
||||
return bpsThreadshold;
|
||||
}
|
||||
public void setBpsThreadshold(Long bpsThreadshold) {
|
||||
this.bpsThreadshold = bpsThreadshold;
|
||||
}
|
||||
public Long getPpsThreadshold() {
|
||||
return ppsThreadshold;
|
||||
}
|
||||
public void setPpsThreadshold(Long ppsThreadshold) {
|
||||
this.ppsThreadshold = ppsThreadshold;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see com.nis.domain.configuration.BaseIpCfg#initDefaultValue()
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class DdosIpTemplate extends IpAllTemplate {
|
||||
private String antiddosProtocol;
|
||||
private Long bpsThreadshold;
|
||||
private Long ppsThreadshold;
|
||||
@ExcelField(title="antiddos_protocol",align=2,sort=2)
|
||||
public String getAntiddosProtocol() {
|
||||
return antiddosProtocol;
|
||||
}
|
||||
public void setAntiddosProtocol(String antiddosProtocol) {
|
||||
this.antiddosProtocol = antiddosProtocol;
|
||||
}
|
||||
@ExcelField(title="bps_threadshold",align=2,sort=3)
|
||||
public Long getBpsThreadshold() {
|
||||
return bpsThreadshold;
|
||||
}
|
||||
public void setBpsThreadshold(Long bpsThreadshold) {
|
||||
this.bpsThreadshold = bpsThreadshold;
|
||||
}
|
||||
@ExcelField(title="pps_threadshold",align=2,sort=4)
|
||||
public Long getPpsThreadshold() {
|
||||
return ppsThreadshold;
|
||||
}
|
||||
public void setPpsThreadshold(Long ppsThreadshold) {
|
||||
this.ppsThreadshold = ppsThreadshold;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ package com.nis.domain.configuration.template;
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public class IpAddrTemplate extends IpCfgTemplate {
|
||||
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.nis.util.excel.ExcelField;
|
||||
/**
|
||||
* @Description: excel导入IP类配置
|
||||
*/
|
||||
@Deprecated
|
||||
public class IpCfgTemplate {
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.nis.util.excel.ExcelField;
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public class IpMultiplexPolicyTemplate extends IpCfgTemplate {
|
||||
@Override
|
||||
@ExcelField(title="IP",align=2,sort=3)
|
||||
|
||||
@@ -6,6 +6,7 @@ package com.nis.domain.configuration.template;
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public class IpsecTemplate extends IpCfgTemplate {
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ package com.nis.domain.configuration.template;
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public class TunnelIpTemplate extends IpCfgTemplate {
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ package com.nis.domain.configuration.template;
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public class WhiteListIpTemplate extends IpCfgTemplate {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -247,6 +247,31 @@ public class ExportExcel {
|
||||
index++;
|
||||
}
|
||||
}
|
||||
if("antiddos_protocol".equals(headerStr)) {
|
||||
commentStr="";
|
||||
List<SysDataDictionaryItem> antiddosProtocol=DictUtils.getDictList("ANTIDDOS_PROTOCOL");
|
||||
if(antiddosProtocol !=null && antiddosProtocol.size()>0){
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : antiddosProtocol) {
|
||||
if(StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+sysDataDictionaryItem.getItemValue()+")\n";
|
||||
index++;
|
||||
}else{
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+")\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||
index++;
|
||||
}
|
||||
if("bps_threadshold".equals(headerStr)){
|
||||
commentStr=msgProp.getProperty("input_integer")+":\n"+commentStr;
|
||||
index++;
|
||||
}
|
||||
if("pps_threadshold".equals(headerStr)){
|
||||
commentStr=msgProp.getProperty("input_integer")+":\n"+commentStr;
|
||||
index++;
|
||||
}
|
||||
if(region.getRegionType().equals(1)){//IP配置
|
||||
//ip配置需要导入的信息:srcIp srcPort destIp destPort Protocol Direction
|
||||
//确定需要导入的srcIp srcPort destIp destPort信息
|
||||
|
||||
@@ -57,6 +57,7 @@ import com.nis.domain.configuration.RequestInfo;
|
||||
import com.nis.domain.configuration.StringCfgTemplate;
|
||||
import com.nis.domain.configuration.template.AsnIpTemplate;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
|
||||
import com.nis.domain.configuration.template.DdosIpTemplate;
|
||||
import com.nis.domain.configuration.template.DnsComplexStringTemplate;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.IpCfgTemplate;
|
||||
@@ -1423,6 +1424,7 @@ public class BaseController {
|
||||
}
|
||||
}
|
||||
}
|
||||
//p2p ip
|
||||
if (regionDict.getFunctionId().equals(510) && "p2p_ip".equals(regionDict.getConfigServiceType())) { // P2p
|
||||
// IP
|
||||
String userRegion1 = baseIpCfg.getUserRegion1();
|
||||
@@ -1469,6 +1471,36 @@ public class BaseController {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (regionDict.getFunctionId().equals(301)) {
|
||||
String antiddosProtocol=baseIpCfg.getAntiddosProtocol();
|
||||
Long bpsThreadshold= baseIpCfg.getBpsThreadshold();
|
||||
Long ppsThreadshold= baseIpCfg.getPpsThreadshold();
|
||||
if(StringUtils.isNotBlank(antiddosProtocol)) {
|
||||
List<SysDataDictionaryItem> antiddosProtocolDicts=DictUtils.getDictList("ANTIDDOS_PROTOCOL");
|
||||
boolean has=false;
|
||||
for(SysDataDictionaryItem ditc:antiddosProtocolDicts) {
|
||||
if(ditc.getItemCode().equals(antiddosProtocol)) {
|
||||
has=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has) {
|
||||
errInfo.append(
|
||||
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"))
|
||||
+ ";");
|
||||
}
|
||||
if(ppsThreadshold==null) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("pps_threadshold"))
|
||||
+ ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (regionDict.getRegionType().equals(1)) {
|
||||
// 校验必填的IP,端口
|
||||
/*
|
||||
@@ -3167,6 +3199,9 @@ public class BaseController {
|
||||
} else if (regionDict.getFunctionId().equals(600)) {// ANS IP
|
||||
List<AsnIpTemplate> list = ei.getDataList(AsnIpTemplate.class, this.getMsgProp(),regionDict);
|
||||
ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list);
|
||||
} else if (regionDict.getFunctionId().equals(301)) {// ANS IP
|
||||
List<DdosIpTemplate> list = ei.getDataList(DdosIpTemplate.class, this.getMsgProp(),regionDict);
|
||||
ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list);
|
||||
} else {
|
||||
List<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class, this.getMsgProp(),regionDict);
|
||||
ipPortCfgs = this.checkIpCfg(serviceDict, regionDict, list);
|
||||
@@ -3297,7 +3332,12 @@ public class BaseController {
|
||||
}
|
||||
|
||||
if(ipPortCfgs!=null&&ipPortCfgs.size()>0) {
|
||||
ipCfgService.saveBatch(ipPortCfgs, IpCfgDao.class);
|
||||
if (regionDict.getFunctionId().equals(301)) {
|
||||
ddosCfgService.saveDdosIpCfg(ipPortCfgs);
|
||||
}else {
|
||||
ipCfgService.saveBatch(ipPortCfgs, IpCfgDao.class);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.template.AsnIpTemplate;
|
||||
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
|
||||
import com.nis.domain.configuration.template.DdosIpTemplate;
|
||||
import com.nis.domain.configuration.template.DnsComplexStringTemplate;
|
||||
import com.nis.domain.configuration.template.DnsIpTemplate;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
@@ -282,6 +283,11 @@ public class IpController extends BaseController{
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, IpWhitelistTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(regionDict.getFunctionId().equals(301)){ //ddos ip
|
||||
List<DdosIpTemplate> classList=new ArrayList<DdosIpTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, DdosIpTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else{
|
||||
List<IpAllTemplate> classList=new ArrayList<IpAllTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, IpAllTemplate.class, 2);
|
||||
|
||||
@@ -980,7 +980,7 @@ public abstract class BaseService {
|
||||
//ip转换为callback用ip
|
||||
public InlineIp convertCallBackIp(BaseIpCfg cfg,Integer policyGroup){
|
||||
List<IpCfg> cfgs = ipConvert(new IpCfg(),cfg);
|
||||
if(cfgs.size()>0) {
|
||||
if(cfgs.size()>1) {
|
||||
throw new RuntimeException("CallBack IP did not support IP range!");
|
||||
}
|
||||
IpCfg c=cfgs.get(0);
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -14,7 +15,9 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import com.google.gson.Gson;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.callback.InlineIp;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.DdosIpCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
@@ -47,6 +50,13 @@ public class DdosCfgService extends BaseService{
|
||||
public DdosIpCfg getDdosIpCfg(Long cfgId) {
|
||||
return ddosCfgDao.getDdosIpCfg(cfgId);
|
||||
}
|
||||
public void saveDdosIpCfg(List<BaseIpCfg> ipPortCfgs) {
|
||||
for(BaseIpCfg cfg:ipPortCfgs) {
|
||||
DdosIpCfg ddosIpCfg=new DdosIpCfg();
|
||||
BeanUtils.copyProperties(cfg, ddosIpCfg);
|
||||
saveOrUpdate(ddosIpCfg);
|
||||
}
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveOrUpdate(DdosIpCfg entity){
|
||||
Date createTime=new Date();
|
||||
|
||||
Reference in New Issue
Block a user