ip类配置drop,loop action审核的时候走callback接口入INLINE_IP_CB表
This commit is contained in:
280
src/main/java/com/nis/domain/callback/InlineIp.java
Normal file
280
src/main/java/com/nis/domain/callback/InlineIp.java
Normal file
@@ -0,0 +1,280 @@
|
|||||||
|
/**
|
||||||
|
*@Title: InlineIp.java
|
||||||
|
*@Package com.nis.domain.callback
|
||||||
|
*@Description TODO
|
||||||
|
*@author dell
|
||||||
|
*@date 2018年6月5日 上午9:08:34
|
||||||
|
*@version 版本号
|
||||||
|
*/
|
||||||
|
package com.nis.domain.callback;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.Expose;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName: InlineIp.java
|
||||||
|
* @Description: TODO
|
||||||
|
* @author (dell)
|
||||||
|
* @date 2018年6月5日 上午9:08:34
|
||||||
|
* @version V1.0
|
||||||
|
*/
|
||||||
|
public class InlineIp {
|
||||||
|
@Expose
|
||||||
|
private Integer cfgId;
|
||||||
|
@Expose
|
||||||
|
private Integer action;
|
||||||
|
@Expose
|
||||||
|
private Integer service;
|
||||||
|
@Expose
|
||||||
|
private Integer addrType;
|
||||||
|
@Expose
|
||||||
|
private String srcIp;
|
||||||
|
@Expose
|
||||||
|
private String maskSrcIp;
|
||||||
|
@Expose
|
||||||
|
private String srcPort;
|
||||||
|
@Expose
|
||||||
|
private String maskSrcPort;
|
||||||
|
@Expose
|
||||||
|
private String dstIp;
|
||||||
|
@Expose
|
||||||
|
private String maskDstIp;
|
||||||
|
@Expose
|
||||||
|
private String dstPort;
|
||||||
|
@Expose
|
||||||
|
private String maskDstPort;
|
||||||
|
@Expose
|
||||||
|
private Integer protocol;
|
||||||
|
@Expose
|
||||||
|
private Integer direction;
|
||||||
|
@Expose
|
||||||
|
private Integer isValid;
|
||||||
|
@Expose
|
||||||
|
private Date opTime;
|
||||||
|
/**
|
||||||
|
* action
|
||||||
|
* @return action
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Integer getAction() {
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param action the action to set
|
||||||
|
*/
|
||||||
|
public void setAction(Integer action) {
|
||||||
|
this.action = action;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* addrType
|
||||||
|
* @return addrType
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Integer getAddrType() {
|
||||||
|
return addrType;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param addrType the addrType to set
|
||||||
|
*/
|
||||||
|
public void setAddrType(Integer addrType) {
|
||||||
|
this.addrType = addrType;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* srcIp
|
||||||
|
* @return srcIp
|
||||||
|
*/
|
||||||
|
|
||||||
|
public String getSrcIp() {
|
||||||
|
return srcIp;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param srcIp the srcIp to set
|
||||||
|
*/
|
||||||
|
public void setSrcIp(String srcIp) {
|
||||||
|
this.srcIp = srcIp;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* maskSrcIp
|
||||||
|
* @return maskSrcIp
|
||||||
|
*/
|
||||||
|
|
||||||
|
public String getMaskSrcIp() {
|
||||||
|
return maskSrcIp;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param maskSrcIp the maskSrcIp to set
|
||||||
|
*/
|
||||||
|
public void setMaskSrcIp(String maskSrcIp) {
|
||||||
|
this.maskSrcIp = maskSrcIp;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* srcPort
|
||||||
|
* @return srcPort
|
||||||
|
*/
|
||||||
|
|
||||||
|
public String getSrcPort() {
|
||||||
|
return srcPort;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param srcPort the srcPort to set
|
||||||
|
*/
|
||||||
|
public void setSrcPort(String srcPort) {
|
||||||
|
this.srcPort = srcPort;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* maskSrcPort
|
||||||
|
* @return maskSrcPort
|
||||||
|
*/
|
||||||
|
|
||||||
|
public String getMaskSrcPort() {
|
||||||
|
return maskSrcPort;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param maskSrcPort the maskSrcPort to set
|
||||||
|
*/
|
||||||
|
public void setMaskSrcPort(String maskSrcPort) {
|
||||||
|
this.maskSrcPort = maskSrcPort;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* dstIp
|
||||||
|
* @return dstIp
|
||||||
|
*/
|
||||||
|
|
||||||
|
public String getDstIp() {
|
||||||
|
return dstIp;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param dstIp the dstIp to set
|
||||||
|
*/
|
||||||
|
public void setDstIp(String dstIp) {
|
||||||
|
this.dstIp = dstIp;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* maskDstIp
|
||||||
|
* @return maskDstIp
|
||||||
|
*/
|
||||||
|
|
||||||
|
public String getMaskDstIp() {
|
||||||
|
return maskDstIp;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param maskDstIp the maskDstIp to set
|
||||||
|
*/
|
||||||
|
public void setMaskDstIp(String maskDstIp) {
|
||||||
|
this.maskDstIp = maskDstIp;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* dstPort
|
||||||
|
* @return dstPort
|
||||||
|
*/
|
||||||
|
|
||||||
|
public String getDstPort() {
|
||||||
|
return dstPort;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param dstPort the dstPort to set
|
||||||
|
*/
|
||||||
|
public void setDstPort(String dstPort) {
|
||||||
|
this.dstPort = dstPort;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* maskDstPort
|
||||||
|
* @return maskDstPort
|
||||||
|
*/
|
||||||
|
|
||||||
|
public String getMaskDstPort() {
|
||||||
|
return maskDstPort;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param maskDstPort the maskDstPort to set
|
||||||
|
*/
|
||||||
|
public void setMaskDstPort(String maskDstPort) {
|
||||||
|
this.maskDstPort = maskDstPort;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* protocol
|
||||||
|
* @return protocol
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Integer getProtocol() {
|
||||||
|
return protocol;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param protocol the protocol to set
|
||||||
|
*/
|
||||||
|
public void setProtocol(Integer protocol) {
|
||||||
|
this.protocol = protocol;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* direction
|
||||||
|
* @return direction
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Integer getDirection() {
|
||||||
|
return direction;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param direction the direction to set
|
||||||
|
*/
|
||||||
|
public void setDirection(Integer direction) {
|
||||||
|
this.direction = direction;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* isValid
|
||||||
|
* @return isValid
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Integer getIsValid() {
|
||||||
|
return isValid;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param isValid the isValid to set
|
||||||
|
*/
|
||||||
|
public void setIsValid(Integer isValid) {
|
||||||
|
this.isValid = isValid;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* opTime
|
||||||
|
* @return opTime
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Date getOpTime() {
|
||||||
|
return opTime;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param opTime the opTime to set
|
||||||
|
*/
|
||||||
|
public void setOpTime(Date opTime) {
|
||||||
|
this.opTime = opTime;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* cfgId
|
||||||
|
* @return cfgId
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Integer getCfgId() {
|
||||||
|
return cfgId;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param cfgId the cfgId to set
|
||||||
|
*/
|
||||||
|
public void setCfgId(Integer cfgId) {
|
||||||
|
this.cfgId = cfgId;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* service
|
||||||
|
* @return service
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Integer getService() {
|
||||||
|
return service;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param service the service to set
|
||||||
|
*/
|
||||||
|
public void setService(Integer service) {
|
||||||
|
this.service = service;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -23,6 +23,7 @@ import com.googlecode.ipv6.IPv6Address;
|
|||||||
import com.googlecode.ipv6.IPv6Network;
|
import com.googlecode.ipv6.IPv6Network;
|
||||||
import com.nis.domain.SysRole;
|
import com.nis.domain.SysRole;
|
||||||
import com.nis.domain.SysUser;
|
import com.nis.domain.SysUser;
|
||||||
|
import com.nis.domain.callback.InlineIp;
|
||||||
import com.nis.domain.configuration.AreaBean;
|
import com.nis.domain.configuration.AreaBean;
|
||||||
import com.nis.domain.configuration.AreaIpCfg;
|
import com.nis.domain.configuration.AreaIpCfg;
|
||||||
import com.nis.domain.configuration.BaseCfg;
|
import com.nis.domain.configuration.BaseCfg;
|
||||||
@@ -508,6 +509,28 @@ public abstract class BaseService {
|
|||||||
}
|
}
|
||||||
return dstIp;
|
return dstIp;
|
||||||
}
|
}
|
||||||
|
//ip转换为callback用ip
|
||||||
|
public InlineIp convertCallBackIp(BaseIpCfg cfg){
|
||||||
|
IpCfg c=ipConvert(new IpCfg(),cfg);
|
||||||
|
InlineIp ip=new InlineIp();
|
||||||
|
ip.setCfgId(cfg.getCompileId());
|
||||||
|
ip.setAction(cfg.getAction());
|
||||||
|
ip.setService(cfg.getServiceId());
|
||||||
|
ip.setAddrType(cfg.getIpType());
|
||||||
|
ip.setSrcIp(c.getSrcIp());
|
||||||
|
ip.setMaskSrcIp(c.getSrcIpMask());
|
||||||
|
ip.setDstIp(c.getDstIp());
|
||||||
|
ip.setMaskDstIp(c.getDstIpMask());
|
||||||
|
ip.setSrcPort(c.getSrcPort());
|
||||||
|
ip.setMaskSrcPort(c.getSrcPortMask());
|
||||||
|
ip.setDstPort(c.getDstPort());
|
||||||
|
ip.setMaskDstPort(c.getDstPortMask());
|
||||||
|
ip.setProtocol(cfg.getProtocol());
|
||||||
|
ip.setDirection(cfg.getDirection());
|
||||||
|
ip.setIsValid(cfg.getIsValid());
|
||||||
|
ip.setOpTime(cfg.getAuditTime());
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
//区域IPsetAreaEffectiveIds设置
|
//区域IPsetAreaEffectiveIds设置
|
||||||
public void setAreaEffectiveIds(BaseCfg<?> entity){
|
public void setAreaEffectiveIds(BaseCfg<?> entity){
|
||||||
List<AreaIpCfg> areaCfg=entity.getAreaCfg();
|
List<AreaIpCfg> areaCfg=entity.getAreaCfg();
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.nis.domain.FunctionServiceDict;
|
||||||
|
import com.nis.domain.callback.InlineIp;
|
||||||
import com.nis.domain.configuration.AreaBean;
|
import com.nis.domain.configuration.AreaBean;
|
||||||
import com.nis.domain.configuration.AreaIpCfg;
|
import com.nis.domain.configuration.AreaIpCfg;
|
||||||
import com.nis.domain.configuration.BaseIpCfg;
|
import com.nis.domain.configuration.BaseIpCfg;
|
||||||
@@ -27,6 +29,7 @@ import com.nis.domain.maat.MaatCfg.StringCfg;
|
|||||||
import com.nis.exceptions.MaatConvertException;
|
import com.nis.exceptions.MaatConvertException;
|
||||||
import com.nis.util.ConfigServiceUtil;
|
import com.nis.util.ConfigServiceUtil;
|
||||||
import com.nis.util.Constants;
|
import com.nis.util.Constants;
|
||||||
|
import com.nis.util.DictUtils;
|
||||||
import com.nis.util.StringUtil;
|
import com.nis.util.StringUtil;
|
||||||
import com.nis.web.dao.configuration.AreaIpCfgDao;
|
import com.nis.web.dao.configuration.AreaIpCfgDao;
|
||||||
import com.nis.web.dao.configuration.IpCfgDao;
|
import com.nis.web.dao.configuration.IpCfgDao;
|
||||||
@@ -168,10 +171,8 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
|||||||
beans1.add(area);
|
beans1.add(area);
|
||||||
}
|
}
|
||||||
this.auditIpBatch(beans1);
|
this.auditIpBatch(beans1);
|
||||||
|
|
||||||
List<MaatCfg> configCompileList = new ArrayList<>();
|
List<MaatCfg> configCompileList = new ArrayList<>();
|
||||||
List<GroupCfg> groupRelationList = new ArrayList<>();
|
List<GroupCfg> groupRelationList = new ArrayList<>();
|
||||||
// List<GroupCfg> areaGroupRelationList = new ArrayList<>();
|
|
||||||
List<IpCfg> ipRegionList = new ArrayList<>();
|
List<IpCfg> ipRegionList = new ArrayList<>();
|
||||||
List<StringCfg> strRegionList = new ArrayList<>();
|
List<StringCfg> strRegionList = new ArrayList<>();
|
||||||
List<NumBoundaryCfg> numRegionList = new ArrayList<>();
|
List<NumBoundaryCfg> numRegionList = new ArrayList<>();
|
||||||
@@ -184,8 +185,11 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
|||||||
String json="";
|
String json="";
|
||||||
if(cfg.getIsAudit()==1){
|
if(cfg.getIsAudit()==1){
|
||||||
if(Constants.DROP_ACTION==cfg.getAction()||Constants.LOOP_ACTION==cfg.getAction()){
|
if(Constants.DROP_ACTION==cfg.getAction()||Constants.LOOP_ACTION==cfg.getAction()){
|
||||||
|
List<InlineIp> ipList=new ArrayList<>();
|
||||||
|
InlineIp ip=convertCallBackIp(cfg);
|
||||||
|
ipList.add(ip);
|
||||||
//调用服务接口下发配置数据
|
//调用服务接口下发配置数据
|
||||||
json=gsonToJson(cfg);
|
json=gsonToJson(ipList);
|
||||||
logger.info("IP管控下发配置参数:"+json);
|
logger.info("IP管控下发配置参数:"+json);
|
||||||
//调用服务接口下发配置
|
//调用服务接口下发配置
|
||||||
try {
|
try {
|
||||||
@@ -201,6 +205,7 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
|||||||
Map<String,List> map = cfgConvert(ipRegionList,beans,1,cfg,groupRelationList);
|
Map<String,List> map = cfgConvert(ipRegionList,beans,1,cfg,groupRelationList);
|
||||||
ipRegionList=map.get("dstList");
|
ipRegionList=map.get("dstList");
|
||||||
groupRelationList=map.get("groupList");
|
groupRelationList=map.get("groupList");
|
||||||
|
numRegionList=map.get("numRegionList");
|
||||||
Map<String,List> areaMap = cfgConvert(areaIpRegionList,beans1,1,cfg,groupRelationList);
|
Map<String,List> areaMap = cfgConvert(areaIpRegionList,beans1,1,cfg,groupRelationList);
|
||||||
groupRelationList=areaMap.get("groupList");
|
groupRelationList=areaMap.get("groupList");
|
||||||
areaIpRegionList=areaMap.get("dstList");
|
areaIpRegionList=areaMap.get("dstList");
|
||||||
@@ -238,10 +243,11 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
|||||||
}
|
}
|
||||||
}else if(cfg.getIsAudit()==3){
|
}else if(cfg.getIsAudit()==3){
|
||||||
if(Constants.DROP_ACTION==cfg.getAction()||Constants.LOOP_ACTION==cfg.getAction()){
|
if(Constants.DROP_ACTION==cfg.getAction()||Constants.LOOP_ACTION==cfg.getAction()){
|
||||||
Map<String,Object> map=new HashMap<String, Object>();
|
List<InlineIp> ipList=new ArrayList<>();
|
||||||
map.put("updateStatCfgList", cfg);
|
InlineIp ip=convertCallBackIp(cfg);
|
||||||
|
ipList.add(ip);
|
||||||
//调用服务接口取消配置
|
//调用服务接口取消配置
|
||||||
json=gsonToJson(map);
|
json=gsonToJson(ipList);
|
||||||
logger.info("IP管控配置参数:"+json);
|
logger.info("IP管控配置参数:"+json);
|
||||||
//调用服务接口取消配置
|
//调用服务接口取消配置
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user