1、修改log4j日志的设置;2、增加ddos配置

This commit is contained in:
zhangwei
2018-06-29 15:39:11 +08:00
parent f0e78ce833
commit 720e78a72b
10 changed files with 1235 additions and 9 deletions

View File

@@ -0,0 +1,27 @@
/**
*@Title: DnsIpConfig.java
*@Package com.nis.domain.restful
*@Description 欺骗IP实体类
*@author dell
*@date 2018年2月5日 下午2:57:17
*@version 版本号
*/
package com.nis.domain.configuration;
/**
* @ClassName: DnsIpConfig.java
* @author (dell)
* @date 2018年2月5日 下午2:57:17
* @version V1.0
*/
public class DdosIpCfg extends BaseIpCfg {
/**
*
*/
private static final long serialVersionUID = -5446903784736960824L;
}

View File

@@ -61,6 +61,7 @@ import com.nis.web.service.configuration.AvContentCfgService;
import com.nis.web.service.configuration.BgpCfgService;
import com.nis.web.service.configuration.ComplexStringCfgService;
import com.nis.web.service.configuration.ControlPolicyService;
import com.nis.web.service.configuration.DdosCfgService;
import com.nis.web.service.configuration.DnsIpCfgService;
import com.nis.web.service.configuration.DnsResStrategyService;
import com.nis.web.service.configuration.FileTransferCfgService;
@@ -162,6 +163,8 @@ public class BaseController {
protected DnsResStrategyService dnsResStrategyService;
@Autowired
protected HttpRedirectCfgService httpRedirectCfgService;
@Autowired
protected DdosCfgService ddosCfgService;
/**
* 管理基础路径
*/

View File

@@ -0,0 +1,96 @@
package com.nis.web.controller.configuration.manipulation;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.cxf.common.util.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.Page;
import com.nis.domain.basics.ServiceDictInfo;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.DdosIpCfg;
import com.nis.domain.configuration.DnsResStrategy;
import com.nis.domain.configuration.DdosIpCfg;
import com.nis.domain.configuration.RequestInfo;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@Controller
@RequestMapping("${adminPath}/manipulation/ddos")
public class DdosCfgController extends BaseController {
@RequestMapping(value = {"/list"})
public String list(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")DdosIpCfg entity){
Page<DdosIpCfg> page = ddosCfgService.findPage(new Page<DdosIpCfg>(request, response,"r"), entity);
model.addAttribute("page", page);
initPageCondition(model);
return "/cfg/ddosIpCfgList";
}
@RequestMapping(value = {"/form"})
@RequiresPermissions(value={"ddos:ip:config"})
public String form(Model model,HttpServletRequest request,HttpServletResponse response,String ids,@ModelAttribute("cfg")DdosIpCfg cfg){
if(!StringUtil.isEmpty(ids)){
cfg = ddosCfgService.getDdosIpCfg(Long.parseLong(ids));
initUpdateFormCondition(model, cfg);
}else{
initFormCondition(model,cfg);
}
model.addAttribute("_cfg", cfg);
return "/cfg/ddosIpCfgForm";
}
@RequestMapping(value = {"/saveOrUpdate"})
@RequiresPermissions(value={"ddos:ip:config"})
public String saveOrUpdate(Model model,HttpServletRequest request,HttpServletResponse response,
@ModelAttribute("cfg")DdosIpCfg cfg){
try{
ddosCfgService.saveOrUpdate(cfg);
addMessage(model,"save_success");
}catch(Exception e){
logger.error("信息保存失败",e);
e.printStackTrace();
addMessage(model,"save_failed");
}
return "redirect:" + adminPath +"/manipulation/ddos/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = {"/delete"})
@RequiresPermissions(value={"ddos:ip:config"})
public String delete(Integer isAudit,Integer isValid,String ids,Integer functionId){
ddosCfgService.delete(isAudit,isValid,ids,functionId);
return "redirect:" + adminPath +"/manipulation/ddos/list?functionId="+functionId;
}
@RequestMapping(value = {"/audit"})
//@RequiresPermissions(value={"ddos:ip:audit"})
public String audit(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
if(!StringUtil.isEmpty(ids)){
String[] idArray = ids.split(",");
Date auditTime=new Date();
for(String id :idArray){
try {
ddosCfgService.audit(isAudit,isValid,functionId,id,auditTime);
} catch (MaatConvertException e) {
e.printStackTrace();
logger.info("dns fake ip配置下发失败"+e.getMessage());
addMessage(redirectAttributes, e.getMessage());
}
}
}
return "redirect:" + adminPath +"/manipulation/ddos/list?functionId="+functionId;
}
}

View File

@@ -0,0 +1,16 @@
package com.nis.web.dao.configuration;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.configuration.DdosIpCfg;
import com.nis.domain.configuration.DnsIpCfg;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
@MyBatisDao
public interface DdosCfgDao extends CrudDao<DdosIpCfg> {
List<DdosIpCfg> findPage(DdosIpCfg cfg);
DdosIpCfg getDdosIpCfg(Long cfgId);
}

View File

@@ -0,0 +1,350 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.configuration.DdosCfgDao">
<resultMap id="ddosIpCfgMap" type="com.nis.domain.configuration.DdosIpCfg">
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="ip_pattern" property="ipPattern" jdbcType="INTEGER" />
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
<result column="dest_port" property="destPort" jdbcType="VARCHAR" />
<result column="src_port" property="srcPort" jdbcType="VARCHAR" />
<result column="port_pattern" property="portPattern" jdbcType="INTEGER" />
<result column="direction" property="direction" jdbcType="INTEGER" />
<result column="protocol" property="protocol" jdbcType="INTEGER" />
<result column="protocol_id" property="protocolId" jdbcType="INTEGER" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
</resultMap>
<sql id="columns">
r.cfg_id,r.cfg_desc,r.ip_type,r.src_ip_address,r.ip_pattern,r.port_pattern,r.src_port
,r.protocol,r.protocol_id,r.direction,r.cfg_type,r.action,r.dest_port,r.dest_ip_address
,r.is_valid,r.is_audit,r.creator_id,r.create_time,r.editor_id
,r.edit_time,r.auditor_id,r.audit_time,r.service_id,r.request_id,
r.compile_id,r.is_area_effective,r.classify,r.attribute,r.lable
,r.area_effective_ids,r.function_id,r.cfg_region_code
</sql>
<select id="findPage" resultMap="ddosIpCfgMap">
select
<include refid="columns"></include>
<trim prefix="," prefixOverrides=",">
,s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName
</trim>
from ddos_ip_cfg r
left join sys_user s on r.creator_id=s.id
left join sys_user e on r.editor_id=e.id
left join sys_user u on r.auditor_id=u.id
left join request_info ri on r.request_id=ri.id
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="cfgRegionCode != null">
AND r.CFG_REGION_CODE=#{cfgRegionCode,jdbcType=INTEGER}
</if>
<if test="cfgType != null and cfgType != ''">
AND r.CFG_TYPE like concat(concat('%',#{CFG_TYPE,jdbcType=VARCHAR}),'%')
</if>
<if test="ipType != null">
AND r.IP_TYPE=#{ipType,jdbcType=INTEGER}
</if>
<if test="ipPattern != null">
AND r.IP_PATTERN=#{ipPattern,jdbcType=INTEGER}
</if>
<if test="srcIpAddress != null and srcIpAddress != ''">
AND r.SRC_IP_ADDRESS=#{srcIpAddress,jdbcType=VARCHAR}
</if>
<if test="destIpAddress != null and destIpAddress != ''">
AND r.DEST_IP_ADDRESS=#{destIpAddress,jdbcType=VARCHAR}
</if>
<if test="portPattern != null">
AND r.PORT_PATTERN=#{portPattern,jdbcType=INTEGER}
</if>
<if test="srcPort != null and srcPort !=''">
AND r.SRC_PORT=#{srcPort,jdbcType=VARCHAR}
</if>
<if test="destPort != null and destPort !=''">
AND r.DEST_PORT=#{destPort,jdbcType=VARCHAR}
</if>
<if test="direction != null">
AND r.DIRECTION=#{direction,jdbcType=INTEGER}
</if>
<if test="protocol != null">
AND r.PROTOCOL=#{protocol,jdbcType=INTEGER}
</if>
<if test="protocolId != null">
AND r.PROTOCOL_ID=#{protocolId,jdbcType=INTEGER}
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND r.IS_VALID != -1
</if>
<if test="isAudit != null">
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="creatorName != null and creatorName !=''">
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="createTime != null and createTime !=''">
AND r.CREATE_TIME=#{createTime,jdbcType=TIMESTAMP}
</if>
<if test="editorName != null and editorName !=''">
AND EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editTime != null and editTime !='' ">
AND r.EDIT_TIME=#{editTime,jdbcType=TIMESTAMP}
</if>
<if test="auditorName != null and auditorName !=''">
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditTime != null and auditTime !=''">
AND r.AUDIT_TIME=#{auditTime,jdbcType=TIMESTAMP}
</if>
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="compileId != null">
AND r.COMPILE_ID=#{compileId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify !=''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute !=''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable !=''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds !=''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.FUNCTION_ID=#{functionId,jdbcType=INTEGER}
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY r.CFG_ID desc
</otherwise>
</choose>
</select>
<select id="getDdosIpCfg" resultMap="ddosIpCfgMap">
select
<include refid="columns"></include>
from ddos_ip_cfg r
where r.cfg_id=#{cfgId}
</select>
<insert id="insert" parameterType="com.nis.domain.configuration.DdosIpCfg" >
insert into ddos_ip_cfg (
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,
function_id,
ip_type,
src_ip_address,
ip_pattern,
port_pattern,
src_port,
protocol,
protocol_id,
direction,
dest_port,
dest_ip_address,
cfg_type,
cfg_region_code
)values (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
0,
0,
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{editorId,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},
#{auditTime,jdbcType=TIMESTAMP},
#{serviceId,jdbcType=INTEGER},
#{requestId,jdbcType=INTEGER},
#{compileId,jdbcType=INTEGER},
#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{attribute,jdbcType=VARCHAR},
#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{ipPattern,jdbcType=INTEGER},
#{portPattern,jdbcType=INTEGER},
#{srcPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{protocolId,jdbcType=INTEGER},
#{direction,jdbcType=INTEGER},
#{destPort,jdbcType=VARCHAR},
#{destIpAddress,jdbcType=VARCHAR},
#{cfgType,jdbcType=VARCHAR},
#{cfgRegionCode,jdbcType=INTEGER}
)
</insert>
<update id="update" parameterType="com.nis.domain.configuration.DdosIpCfg" >
update ddos_ip_cfg
<set >
<trim suffixOverrides=",">
<if test="cfgDesc != null and cfgDesc != ''" >
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
</if>
<if test="action != null" >
action = #{action,jdbcType=INTEGER},
</if>
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null" >
is_audit = #{isAudit,jdbcType=INTEGER},
</if>
<if test="editorId != null" >
editor_id = #{editorId,jdbcType=INTEGER},
</if>
<if test="editTime != null and editTime != ''" >
edit_time = #{editTime,jdbcType=TIMESTAMP},
</if>
<if test="auditorId != null" >
AUDITOR_ID = #{auditorId,jdbcType=INTEGER},
</if>
<if test="auditTime != null and auditTime != ''" >
AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP},
</if>
<if test="compileId != null" >
COMPILE_ID = #{compileId,jdbcType=TIMESTAMP},
</if>
<if test="requestId != null" >
request_id = #{requestId,jdbcType=INTEGER},
</if>
<if test="isAreaEffective != null" >
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
</if>
<if test="classify != null and classify != ''" >
classify = #{classify,jdbcType=VARCHAR},
</if>
<if test="attribute != null and attribute != ''" >
attribute = #{attribute,jdbcType=VARCHAR},
</if>
<if test="lable != null and lable != ''" >
lable = #{lable,jdbcType=VARCHAR},
</if>
<if test="areaEffectiveIds != null" >
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
</if>
<if test="functionId != null" >
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="serviceId != null" >
service_id = #{serviceId,jdbcType=INTEGER},
</if>
<if test="ipType != null" >
ip_type = #{ipType,jdbcType=INTEGER},
</if>
<if test="srcIpAddress != null and srcIpAddress != ''" >
src_ip_address = #{srcIpAddress,jdbcType=VARCHAR},
</if>
<if test="ipPattern != null" >
ip_pattern = #{ipPattern,jdbcType=INTEGER},
</if>
<if test="portPattern != null" >
port_pattern = #{portPattern,jdbcType=INTEGER},
</if>
<if test="srcPort != null and srcPort != ''" >
src_port = #{srcPort,jdbcType=VARCHAR},
</if>
<if test="protocol != null" >
protocol = #{protocol,jdbcType=INTEGER},
</if>
<if test="protocolId != null" >
protocol_id = #{protocolId,jdbcType=INTEGER},
</if>
<if test="direction != null" >
direction = #{direction,jdbcType=INTEGER},
</if>
<if test="destPort != null and destPort != ''" >
dest_port = #{destPort,jdbcType=VARCHAR},
</if>
<if test="destIpAddress != null and destIpAddress != ''" >
dest_ip_address = #{destIpAddress,jdbcType=VARCHAR},
</if>
<if test="cfgType != null and cfgType != ''" >
cfg_type = #{cfgType,jdbcType=VARCHAR},
</if>
<if test="cfgRegionCode != null " >
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
</if>
</trim>
</set>
<where>
and cfg_id = #{cfgId,jdbcType=INTEGER}
</where>
</update>
</mapper>

View File

@@ -0,0 +1,164 @@
package com.nis.web.service.configuration;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.nis.domain.Page;
import com.nis.domain.callback.InlineIp;
import com.nis.domain.configuration.DdosIpCfg;
import com.nis.domain.maat.ToMaatResult;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.web.dao.configuration.DdosCfgDao;
import com.nis.web.security.UserUtils;
import com.nis.web.service.BaseService;
/**
* ddos配置业务
* @author dell
*
*/
@Service
public class DdosCfgService extends BaseService{
@Autowired
protected DdosCfgDao ddosCfgDao;
public Page<DdosIpCfg> findPage(Page page, DdosIpCfg entity) {
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
entity.setPage(page);
List<DdosIpCfg> list=ddosCfgDao.findPage(entity);
page.setList(list);
return page;
}
public DdosIpCfg getDdosIpCfg(Long cfgId) {
return ddosCfgDao.getDdosIpCfg(cfgId);
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void saveOrUpdate(DdosIpCfg entity){
Date createTime=new Date();
//设置区域运营商信息
setAreaEffectiveIds(entity);
//新增
if(entity.getCfgId()==null){
entity.setCreatorId(UserUtils.getUser().getId());
entity.setCreateTime(createTime);
entity.setIsValid(0);
entity.setIsAudit(0);
//调用服务接口获取compileId
List<Integer> compileIds = new ArrayList<Integer>();
try {
compileIds = ConfigServiceUtil.getId(1,1);
} catch (Exception e) {
e.printStackTrace();
logger.info("获取编译ID出错");
throw new MaatConvertException(e.getMessage());
}
if(compileIds != null && compileIds.size() >0 && compileIds.get(0) != 0){
entity.setCompileId(compileIds.get(0));
ddosCfgDao.insert(entity);
}else{
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
}
//修改
}else{
Date editTime=new Date();
entity.setIsValid(0);
entity.setIsAudit(0);
entity.setEditorId(UserUtils.getUser().getId());
entity.setEditTime(editTime);
ddosCfgDao.update(entity);
}
}
/**
*
* @param isAudit
* @param isValid
* @param ids compileIds
*/
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void delete(Integer isAudit,Integer isValid,String ids,Integer functionId){
DdosIpCfg entity = new DdosIpCfg();
String[] idArray = ids.split(",");
for(String id :idArray){
entity.setCfgId(Long.valueOf(id));
entity.setFunctionId(functionId);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setEditorId(UserUtils.getUser().getId());
entity.setEditTime(new Date());
ddosCfgDao.update(entity);
}
}
/**
*
* @param isAudit
* @param isValid
* @param ids cfgId
* @param functionId
*/
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void audit(Integer isAudit,Integer isValid,Integer functionId,String id,Date auditTime){
DdosIpCfg entity = new DdosIpCfg();
List<DdosIpCfg> list = new ArrayList();
entity.setCfgId(Long.valueOf(id));
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(auditTime);
ddosCfgDao.update(entity);
entity=ddosCfgDao.getDdosIpCfg(Long.valueOf(id));
String json="";
if(entity.getIsAudit()==1){
List<InlineIp> ipList=new ArrayList<InlineIp>();
InlineIp resStrategy=convertCallBackIp(entity,null);
ipList.add(resStrategy);
//调用服务接口下发配置数据
json=gsonToJson(ipList);
logger.info("DDOS IP配置下发配置参数"+json);
//调用服务接口下发配置
try {
ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json);
if(result!=null){
logger.info("DDOS IP配置下发响应信息"+result.getMsg());
}
} catch (Exception e) {
logger.error("DDOS IP配置下发失败",e);
throw e;
}
}else if(entity.getIsAudit()==3){
List<InlineIp> resStrategyList=new ArrayList<>();
InlineIp resStrategy=convertCallBackIp(entity,entity.getDnsStrategyId());
resStrategyList.add(resStrategy);
//调用服务接口取消配置
json=gsonToJson(resStrategyList);
logger.info("DDOS IP配置参数"+json);
//调用服务接口取消配置
try {
ToMaatResult result = ConfigServiceUtil.put(json, 2);
logger.info("DDOS IP配置响应信息"+result.getMsg());
} catch (Exception e) {
e.printStackTrace();
logger.info("DDOS IP配置配置失败");
throw e;
}
}
}
}