Merge branch 'develop_no_common_group' of https://git.mesalab.cn/K18_NTCS_WEB/NTC.git into develop_no_common_group

This commit is contained in:
段冬梅
2019-04-19 18:33:01 +08:00
110 changed files with 3653 additions and 3258 deletions

View File

@@ -20,12 +20,14 @@ public class AsnIpCfg extends BaseCfg<AsnIpCfg> {
@ExcelField(title="ip_type",dictType="IP_TYPE",sort=6)
@SerializedName("ipType")
private Integer ipType;
@ExcelField(title="ip_pattern",dictType="IP_PATTERN",sort=8)
private Integer ipPattern;
private Integer srcIpPattern;
@ExcelField(title="dest_ip_pattern",dictType="IP_PATTERN",sort=8)
private Integer destIpPattern;
private String srcIpAddress;
@ExcelField(title="ip",sort=7)
private String destIpAddress;
private Integer portPattern;
private Integer srcPortPattern;
private Integer destPortPattern;
private String srcPort;
private String destPort;
//@ExcelField(title="group",sort=2)
@@ -117,11 +119,30 @@ public class AsnIpCfg extends BaseCfg<AsnIpCfg> {
public void setIpType(Integer ipType) {
this.ipType = ipType;
}
public Integer getIpPattern() {
return ipPattern;
public Integer getSrcIpPattern() {
return srcIpPattern;
}
public void setIpPattern(Integer ipPattern) {
this.ipPattern = ipPattern;
public void setSrcIpPattern(Integer srcIpPattern) {
this.srcIpPattern = srcIpPattern;
}
public Integer getDestIpPattern() {
return destIpPattern;
}
public void setDestIpPattern(Integer destIpPattern) {
this.destIpPattern = destIpPattern;
}
public Integer getSrcPortPattern() {
return srcPortPattern;
}
public void setSrcPortPattern(Integer srcPortPattern) {
this.srcPortPattern = srcPortPattern;
}
public Integer getDestPortPattern() {
return destPortPattern;
}
public void setDestPortPattern(Integer destPortPattern) {
this.destPortPattern = destPortPattern;
}
public String getSrcIpAddress() {
return srcIpAddress;
@@ -135,12 +156,6 @@ public class AsnIpCfg extends BaseCfg<AsnIpCfg> {
public void setDestIpAddress(String destIpAddress) {
this.destIpAddress = destIpAddress;
}
public Integer getPortPattern() {
return portPattern;
}
public void setPortPattern(Integer portPattern) {
this.portPattern = portPattern;
}
public String getSrcPort() {
return srcPort;
}
@@ -176,9 +191,10 @@ public class AsnIpCfg extends BaseCfg<AsnIpCfg> {
}
@Override
public String toString() {
return "AsnIpCfg [regionId=" + regionId + ", ratelimit=" + ratelimit + ", ipType=" + ipType + ", ipPattern="
+ ipPattern + ", srcIpAddress=" + srcIpAddress + ", destIpAddress=" + destIpAddress + ", portPattern="
+ portPattern + ", srcPort=" + srcPort + ", destPort=" + destPort + ", asnIpGroupName=" + asnIpGroupName
return "AsnIpCfg [regionId=" + regionId + ", ratelimit=" + ratelimit + ", ipType=" + ipType + ", srcIpPattern="
+ srcIpPattern + ", destIpPattern="+ destIpPattern+ ", srcIpAddress=" + srcIpAddress + ", destIpAddress="
+ destIpAddress + ", srcPortPattern="+ srcPortPattern+", destPortPattern="+ destPortPattern + ", srcPort="
+ srcPort + ", destPort=" + destPort + ", asnIpGroupName=" + asnIpGroupName
+ ", asnIpGroup=" + asnIpGroup + ", direction=" + direction + ", protocol=" + protocol + ", protocolId="
+ protocolId + ", compileId=" + compileId + ", isValid=" + isValid + ", userRegion1=" + userRegion1
+ ", userRegion2=" + userRegion2 + ", userRegion3=" + userRegion3 + ", userRegion4=" + userRegion4

View File

@@ -1,8 +1,6 @@
package com.nis.domain.configuration;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.nis.util.excel.ExcelField;
@@ -34,11 +32,13 @@ public class AppIpCfg extends BaseCfg<AppIpCfg> {
@ExcelField(title="ip_type",dictType="IP_TYPE",sort=3)
@SerializedName("ipType")
protected Integer ipType;
protected Integer ipPattern;
protected Integer srcIpPattern;
protected Integer destIpPattern;
protected String srcIpAddress;
@ExcelField(title="server_ip",sort=4)
protected String destIpAddress;
protected Integer portPattern;
protected Integer srcPortPattern;
protected Integer destPortPattern;
protected String srcPort;
@ExcelField(title="server_port",sort=5)
protected String destPort;
@@ -121,34 +121,7 @@ public class AppIpCfg extends BaseCfg<AppIpCfg> {
// this.protocolId = protocolId;
// }
/**
* ipPattern
* @return ipPattern
*/
public Integer getIpPattern() {
return ipPattern;
}
/**
* @param ipPattern the ipPattern to set
*/
public void setIpPattern(Integer ipPattern) {
this.ipPattern = ipPattern;
}
/**
* portPattern
* @return portPattern
*/
public Integer getPortPattern() {
return portPattern;
}
/**
* @param portPattern the portPattern to set
*/
public void setPortPattern(Integer portPattern) {
this.portPattern = portPattern;
}
/**
* srcIpAddress
@@ -158,6 +131,30 @@ public class AppIpCfg extends BaseCfg<AppIpCfg> {
public String getSrcIpAddress() {
return srcIpAddress;
}
public Integer getSrcIpPattern() {
return srcIpPattern;
}
public void setSrcIpPattern(Integer srcIpPattern) {
this.srcIpPattern = srcIpPattern;
}
public Integer getDestIpPattern() {
return destIpPattern;
}
public void setDestIpPattern(Integer destIpPattern) {
this.destIpPattern = destIpPattern;
}
public Integer getSrcPortPattern() {
return srcPortPattern;
}
public void setSrcPortPattern(Integer srcPortPattern) {
this.srcPortPattern = srcPortPattern;
}
public Integer getDestPortPattern() {
return destPortPattern;
}
public void setDestPortPattern(Integer destPortPattern) {
this.destPortPattern = destPortPattern;
}
/**
* @param srcIpAddress the srcIpAddress to set
*/
@@ -257,16 +254,10 @@ public class AppIpCfg extends BaseCfg<AppIpCfg> {
public String toString() {
return "AppIpCfg [compileId=" + compileId + ", ratelimit=" + ratelimit + ", appCode=" + appCode + ", behavCode="
+ behavCode + ", specServiceId=" + specServiceId + ", appName=" + appName + ", ipType=" + ipType
+ ", ipPattern=" + ipPattern + ", srcIpAddress=" + srcIpAddress + ", destIpAddress=" + destIpAddress
+ ", portPattern=" + portPattern + ", srcPort=" + srcPort + ", destPort=" + destPort + ", direction="
+ direction + ", protocol=" + protocol + ", userRegion1=" + userRegion1 + ", userRegion2=" + userRegion2
+ ", userRegion3=" + userRegion3 + ", userRegion4=" + userRegion4 + ", userRegion5=" + userRegion5
+ ", cfgId=" + cfgId + ", cfgDesc=" + cfgDesc + ", action=" + action + ", isValid=" + isValid
+ ", isAudit=" + isAudit + ", creatorId=" + creatorId + ", createTime=" + createTime + ", editorId="
+ editorId + ", editTime=" + editTime + ", auditorId=" + auditorId + ", auditTime=" + auditTime
+ ", serviceId=" + serviceId + ", requestId=" + requestId + ", cancelRequestId=" + cancelRequestId
+ ", isAreaEffective=" + isAreaEffective + ", classify=" + classify + ", attribute=" + attribute
+ ", lable=" + lable + ", areaEffectiveIds=" + areaEffectiveIds + ", cfgRegionCode=" + cfgRegionCode
+ ", cfgType=" + cfgType + ", functionId=" + functionId + ", doLog=" + doLog + "]";
+ ", srcIpPattern=" + srcIpPattern + ", destIpPattern=" + destIpPattern + ", srcIpAddress="
+ srcIpAddress + ", destIpAddress=" + destIpAddress + ", srcPortPattern=" + srcPortPattern
+ ", destPortPattern=" + destPortPattern + ", srcPort=" + srcPort + ", destPort=" + destPort
+ ", direction=" + direction + ", protocol=" + protocol + "]";
}
}

View File

@@ -59,7 +59,8 @@ public class AreaIpCfg extends BaseIpCfg {
this.cfgType=Constants.AREA_REGION;
this.cfgRegionCode=1;
this.protocol=0;
this.portPattern=1;
this.srcPortPattern=1;
this.destPortPattern=1;
this.srcPort="0";
this.destPort="0";
this.direction=0;

View File

@@ -45,14 +45,18 @@ public class BaseIpCfg extends BaseCfg<BaseIpCfg> {
@SerializedName("ipType")
@ExcelField(title="ip_type",dictType="IP_TYPE",sort=50)
protected Integer ipType;
@ExcelField(title="ip_pattern",dictType="IP_PATTERN",sort=51)
protected Integer ipPattern;
@ExcelField(title="client_ip",sort=53)
@ExcelField(title="src_ip_pattern",dictType="IP_PATTERN",sort=51)
protected Integer srcIpPattern;
@ExcelField(title="client_ip",sort=52)
protected String srcIpAddress;
@ExcelField(title="server_ip",sort=52)
@ExcelField(title="dest_ip_pattern",dictType="IP_PATTERN",sort=53)
protected Integer destIpPattern;
@ExcelField(title="server_ip",sort=54)
protected String destIpAddress;
@ExcelField(title="port_pattern",dictType="PORT_PATTERN",sort=54)
protected Integer portPattern;
@ExcelField(title="src_port_pattern",dictType="PORT_PATTERN",sort=54)
protected Integer srcPortPattern;
@ExcelField(title="dest_port_pattern",dictType="PORT_PATTERN",sort=54)
protected Integer destPortPattern;
@ExcelField(title="client_port",sort=55)
protected String srcPort;
@ExcelField(title="server_port",sort=56)
@@ -269,35 +273,31 @@ public class BaseIpCfg extends BaseCfg<BaseIpCfg> {
this.protocolId = protocolId;
}
/**
* ipPattern
* @return ipPattern
*/
public Integer getIpPattern() {
return ipPattern;
public Integer getSrcIpPattern() {
return srcIpPattern;
}
/**
* @param ipPattern the ipPattern to set
*/
public void setIpPattern(Integer ipPattern) {
this.ipPattern = ipPattern;
public void setSrcIpPattern(Integer srcIpPattern) {
this.srcIpPattern = srcIpPattern;
}
/**
* portPattern
* @return portPattern
*/
public Integer getPortPattern() {
return portPattern;
public Integer getDestIpPattern() {
return destIpPattern;
}
/**
* @param portPattern the portPattern to set
*/
public void setPortPattern(Integer portPattern) {
this.portPattern = portPattern;
public void setDestIpPattern(Integer destIpPattern) {
this.destIpPattern = destIpPattern;
}
public Integer getSrcPortPattern() {
return srcPortPattern;
}
public void setSrcPortPattern(Integer srcPortPattern) {
this.srcPortPattern = srcPortPattern;
}
public Integer getDestPortPattern() {
return destPortPattern;
}
public void setDestPortPattern(Integer destPortPattern) {
this.destPortPattern = destPortPattern;
}
/**
* srcIpAddress
* @return srcIpAddress

View File

@@ -1,31 +0,0 @@
package com.nis.domain.configuration.template;
/**
* wx 将部分字段的标题改变,或者不需要的字段隐藏
* 隐藏方法对于不需要的字段或者方法Override该字段方法但是@ExcelField注解不需要加上了
* @author dell
*
*/
@Deprecated
public class IpAddrTemplate extends IpCfgTemplate {
@Override
public Integer getIrType() {
// TODO Auto-generated method stub
return super.getIrType();
}
@Override
public Integer getDnsStrategyId() {
// TODO Auto-generated method stub
return super.getDnsStrategyId();
}
@Override
public String getRatelimit() {
// TODO Auto-generated method stub
return super.getRatelimit();
}
}

View File

@@ -8,7 +8,6 @@
*/
package com.nis.domain.configuration.template;
import com.google.gson.JsonObject;
import com.nis.util.excel.ExcelField;
/**

View File

@@ -1,310 +0,0 @@
/**
*@Title: BaseStringConfig.java
*@Package com.nis.domain.restful
*@Description TODO
*@author dell
*@date 2018年2月5日 下午5:26:02
*@version 版本号
*/
package com.nis.domain.configuration.template;
import com.nis.util.excel.ExcelField;
/**
* @Description: excel导入IP类配置
*/
@Deprecated
public class IpCfgTemplate {
/**
* @Fields serialVersionUID:TODO用一句话描述这个变量表示什么
*
* @since 1.0.0
*/
private Long cfgId;
private Integer ipType;//1
private Integer ipPattern;//2
private String srcIpAddress; //3
private String destIpAddress; //4
private Integer portPattern; //5
private String srcPort; //6
private String destPort;//7
private Integer protocol;//8
protected Integer direction;//9
private String cfgDesc;//10
private Integer requestId;//11
private String requestName;//12
private Integer isAreaEffective;//13
private String classify;//14
private String attribute;//15
private String lable;//16
private String classifyName;//17
private String attributeName;//18
private String lableName;//19
private String areaEffectiveIds;//20
private String ratelimit;//21
private Integer dnsStrategyId;//22
private Integer irType;//23
private String userRegion1;//77
private String userRegion2;//78
private String userRegion3;//79
private String userRegion4;//80
private String userRegion5;//81
/**
* userRegion1
* @return userRegion1
*/
// @ExcelField(title="userregion1",align=2,sort=77)
public String getUserRegion1() {
return userRegion1;
}
/**
* @param userRegion1 the userRegion1 to set
*/
public void setUserRegion1(String userRegion1) {
this.userRegion1 = userRegion1;
}
/**
* userRegion2
* @return userRegion2
*/
// @ExcelField(title="userregion2",align=2,sort=78)
public String getUserRegion2() {
return userRegion2;
}
/**
* @param userRegion2 the userRegion2 to set
*/
public void setUserRegion2(String userRegion2) {
this.userRegion2 = userRegion2;
}
/**
* userRegion3
* @return userRegion3
*/
// @ExcelField(title="userregion3",align=2,sort=79)
public String getUserRegion3() {
return userRegion3;
}
/**
* @param userRegion3 the userRegion3 to set
*/
public void setUserRegion3(String userRegion3) {
this.userRegion3 = userRegion3;
}
/**
* userRegion4
* @return userRegion4
*/
// @ExcelField(title="userregion4",align=2,sort=80)
public String getUserRegion4() {
return userRegion4;
}
/**
* @param userRegion4 the userRegion4 to set
*/
public void setUserRegion4(String userRegion4) {
this.userRegion4 = userRegion4;
}
/**
* userRegion5
* @return userRegion5
*/
// @ExcelField(title="userregion5",align=2,sort=81)
public String getUserRegion5() {
return userRegion5;
}
/**
* @param userRegion5 the userRegion5 to set
*/
public void setUserRegion5(String userRegion5) {
this.userRegion5 = userRegion5;
}
/**
* ratelimit
* @return ratelimit
*/
@ExcelField(title="ratelimit",align=2,sort=74)
public String getRatelimit() {
return ratelimit;
}
/**
* @param ratelimit the ratelimit to set
*/
public void setRatelimit(String ratelimit) {
this.ratelimit = ratelimit;
}
/**
* irType
* @return irType
*/
@ExcelField(title="ir_type",align=2,sort=76)
public Integer getIrType() {
return irType;
}
/**
* @param irType the irType to set
*/
public void setIrType(Integer irType) {
this.irType = irType;
}
/**
* dnsStrategyId
* @return dnsStrategyId
*/
@ExcelField(title="dns_strategy_id",align=2,sort=75)
public Integer getDnsStrategyId() {
return dnsStrategyId;
}
/**
* @param dnsStrategyId the dnsStrategyId to set
*/
public void setDnsStrategyId(Integer dnsStrategyId) {
this.dnsStrategyId = dnsStrategyId;
}
@ExcelField(title="ip_type",align=2,sort=1)
public Integer getIpType() {
return ipType;
}
public void setIpType(Integer ipType) {
this.ipType = ipType;
}
@ExcelField(title="ip_pattern",align=2,sort=2)
public Integer getIpPattern() {
return ipPattern;
}
public void setIpPattern(Integer ipPattern) {
this.ipPattern = ipPattern;
}
@ExcelField(title="client_ip",align=2,sort=3)
public String getSrcIpAddress() {
return srcIpAddress;
}
public void setSrcIpAddress(String srcIpAddress) {
this.srcIpAddress = srcIpAddress;
}
@ExcelField(title="server_ip",align=2,sort=4)
public String getDestIpAddress() {
return destIpAddress;
}
public void setDestIpAddress(String destIpAddress) {
this.destIpAddress = destIpAddress;
}
@ExcelField(title="port_pattern",align=2,sort=5)
public Integer getPortPattern() {
return portPattern;
}
public void setPortPattern(Integer portPattern) {
this.portPattern = portPattern;
}
@ExcelField(title="client_port",align=2,sort=6)
public String getSrcPort() {
return srcPort;
}
public void setSrcPort(String srcPort) {
this.srcPort = srcPort;
}
@ExcelField(title="server_port",align=2,sort=7)
public String getDestPort() {
return destPort;
}
public void setDestPort(String destPort) {
this.destPort = destPort;
}
public Long getCfgId() {
return cfgId;
}
public void setCfgId(Long cfgId) {
this.cfgId = cfgId;
}
@ExcelField(title="direction",align=2,sort=8)
public Integer getDirection() {
return direction;
}
public void setDirection(Integer direction) {
this.direction = direction;
}
@ExcelField(title="config_describe",align=2,sort=11)
public String getCfgDesc() {
return cfgDesc;
}
public void setCfgDesc(String cfgDesc) {
this.cfgDesc = cfgDesc;
}
@ExcelField(title="letter",align=2,sort=13)
public Integer getRequestId() {
return requestId;
}
public void setRequestId(Integer requestId) {
this.requestId = requestId;
}
public String getRequestName() {
return requestName;
}
public void setRequestName(String requestName) {
this.requestName = requestName;
}
public Integer getIsAreaEffective() {
return isAreaEffective;
}
public void setIsAreaEffective(Integer isAreaEffective) {
this.isAreaEffective = isAreaEffective;
}
@ExcelField(title="classification",align=2,sort=71)
public String getClassify() {
return classify;
}
public void setClassify(String classify) {
this.classify = classify;
}
@ExcelField(title="attribute",align=2,sort=72)
public String getAttribute() {
return attribute;
}
public void setAttribute(String attribute) {
this.attribute = attribute;
}
@ExcelField(title="label",align=2,sort=73)
public String getLable() {
return lable;
}
public void setLable(String lable) {
this.lable = lable;
}
public String getClassifyName() {
return classifyName;
}
public void setClassifyName(String classifyName) {
this.classifyName = classifyName;
}
public String getAttributeName() {
return attributeName;
}
public void setAttributeName(String attributeName) {
this.attributeName = attributeName;
}
public String getLableName() {
return lableName;
}
public void setLableName(String lableName) {
this.lableName = lableName;
}
// @ExcelField(title="area_effective",align=2,sort=70)
public String getAreaEffectiveIds() {
return areaEffectiveIds;
}
public void setAreaEffectiveIds(String areaEffectiveIds) {
this.areaEffectiveIds = areaEffectiveIds;
}
@ExcelField(title="protocol",align=2,sort=9)
public Integer getProtocol() {
return protocol;
}
public void setProtocol(Integer protocol) {
this.protocol = protocol;
}
}

View File

@@ -1,47 +0,0 @@
package com.nis.domain.configuration.template;
import com.nis.util.excel.ExcelField;
/**
* wx 将部分字段的标题改变,或者不需要的字段隐藏
* 隐藏方法对于不需要的字段或者方法Override该字段方法但是@ExcelField注解不需要加上了
* @author dell
*
*/
@Deprecated
public class IpMultiplexPolicyTemplate extends IpCfgTemplate {
@Override
@ExcelField(title="IP",align=2,sort=3)
public String getSrcIpAddress() {
return super.getSrcIpAddress();
}
@ExcelField(title="port",align=2,sort=6)
@Override
public String getSrcPort() {
// TODO Auto-generated method stub
return super.getSrcPort();
}
@Override
@ExcelField(title="group_name",align=2,sort=75)
public Integer getDnsStrategyId() {
// TODO Auto-generated method stub
return super.getDnsStrategyId();
}
@Override
public String getRatelimit() {
// TODO Auto-generated method stub
return super.getRatelimit();
}
@Override
public String getDestPort() {
// TODO Auto-generated method stub
return super.getDestPort();
}
@Override
public String getDestIpAddress() {
// TODO Auto-generated method stub
return super.getDestIpAddress();
}
}

View File

@@ -1,31 +0,0 @@
package com.nis.domain.configuration.template;
/**
* wx 将部分字段的标题改变,或者不需要的字段隐藏
* 隐藏方法对于不需要的字段或者方法Override该字段方法但是@ExcelField注解不需要加上了
* @author dell
*
*/
@Deprecated
public class IpsecTemplate extends IpCfgTemplate {
@Override
public Integer getIrType() {
// TODO Auto-generated method stub
return super.getIrType();
}
@Override
public Integer getDnsStrategyId() {
// TODO Auto-generated method stub
return super.getDnsStrategyId();
}
@Override
public String getRatelimit() {
// TODO Auto-generated method stub
return super.getRatelimit();
}
}

View File

@@ -1,37 +0,0 @@
package com.nis.domain.configuration.template;
/**
* wx 将部分字段的标题改变,或者不需要的字段隐藏
* 隐藏方法对于不需要的字段或者方法Override该字段方法但是@ExcelField注解不需要加上了
* @author dell
*
*/
@Deprecated
public class TunnelIpTemplate extends IpCfgTemplate {
@Override
public Integer getIrType() {
// TODO Auto-generated method stub
return super.getIrType();
}
@Override
public Integer getDnsStrategyId() {
// TODO Auto-generated method stub
return super.getDnsStrategyId();
}
@Override
public String getRatelimit() {
// TODO Auto-generated method stub
return super.getRatelimit();
}
@Override
public Integer getProtocol() {
// TODO Auto-generated method stub
return 0;
}
}

View File

@@ -1,66 +0,0 @@
package com.nis.domain.configuration.template;
/**
* wx 将部分字段的标题改变,或者不需要的字段隐藏
* 隐藏方法对于不需要的字段或者方法Override该字段方法但是@ExcelField注解不需要加上了
* @author dell
*
*/
@Deprecated
public class WhiteListIpTemplate extends IpCfgTemplate {
@Override
public Integer getDirection() {
// TODO Auto-generated method stub
return 0;
}
@Override
public Integer getProtocol() {
// TODO Auto-generated method stub
return 0;
}
@Override
public Integer getIrType() {
// TODO Auto-generated method stub
return super.getIrType();
}
@Override
public Integer getDnsStrategyId() {
// TODO Auto-generated method stub
return super.getDnsStrategyId();
}
@Override
public Integer getRequestId() {
// TODO Auto-generated method stub
return super.getRequestId();
}
@Override
public String getClassify() {
// TODO Auto-generated method stub
return super.getClassify();
}
@Override
public String getAttribute() {
// TODO Auto-generated method stub
return super.getAttribute();
}
@Override
public String getLable() {
// TODO Auto-generated method stub
return super.getLable();
}
@Override
public String getRatelimit() {
// TODO Auto-generated method stub
return super.getRatelimit();
}
}

View File

@@ -30,13 +30,15 @@ public class SpecificServiceHostCfg extends BaseEntity<SpecificServiceHostCfg>{
@Expose
private Integer protocol; //protocol 协议 int N 6表示tcp,17表示udp0表示任意
@Expose
private Integer ipPattern; //ip格式
private Integer srcIpPattern; //ip格式
private Integer destIpPattern; //ip格式
@Expose
private String srcIpAddress; //源客户端IP地址
@Expose
private String destIpAddress; //目的服务器IP地址
@Expose
private Integer portPattern; //端口格式
private Integer srcPortPattern; //端口格式
private Integer destPortPattern; //端口格式
@Expose
private String srcPort; //源(客户端)端口
@Expose
@@ -114,19 +116,33 @@ public class SpecificServiceHostCfg extends BaseEntity<SpecificServiceHostCfg>{
public void setDestPort(String destPort) {
this.destPort = destPort;
}
@ExcelField(title="ip_pattern",align=2,sort=21,fieldType=Integer.class)
public Integer getIpPattern() {
return ipPattern;
@ExcelField(title="src_ip_pattern",align=2,sort=21,fieldType=Integer.class)
public Integer getSrcIpPattern() {
return srcIpPattern;
}
public void setIpPattern(Integer ipPattern) {
this.ipPattern = ipPattern;
public void setSrcIpPattern(Integer srcIpPattern) {
this.srcIpPattern = srcIpPattern;
}
@ExcelField(title="port_pattern",align=2,sort=40,fieldType=Integer.class)
public Integer getPortPattern() {
return portPattern;
@ExcelField(title="dest_ip_pattern",align=2,sort=22,fieldType=Integer.class)
public Integer getDestIpPattern() {
return destIpPattern;
}
public void setPortPattern(Integer portPattern) {
this.portPattern = portPattern;
public void setDestIpPattern(Integer destIpPattern) {
this.destIpPattern = destIpPattern;
}
@ExcelField(title="src_port_pattern",align=2,sort=40,fieldType=Integer.class)
public Integer getSrcPortPattern() {
return srcPortPattern;
}
public void setSrcPortPattern(Integer srcPortPattern) {
this.srcPortPattern = srcPortPattern;
}
@ExcelField(title="dest_port_pattern",align=2,sort=41,fieldType=Integer.class)
public Integer getDestPortPattern() {
return destPortPattern;
}
public void setDestPortPattern(Integer destPortPattern) {
this.destPortPattern = destPortPattern;
}
@ExcelField(title="direction",align=2,sort=110)
public Integer getDirection() {

View File

@@ -395,7 +395,7 @@ public class ConfigConvertUtil {
*/
public static List<IpCfg> ipConvert(IpCfg dstIp, BaseIpCfg srcIp) {
List<IpCfg> ipConvertList = Lists.newArrayList();
boolean isRange = ((srcIp.getIpPattern() != null && srcIp.getIpPattern() == 2)
boolean isRange = (((srcIp.getSrcIpPattern() != null && srcIp.getSrcIpPattern() == 2)||(srcIp.getDestIpPattern()) != null && srcIp.getDestIpPattern() == 2)
|| (srcIp.getSrcIpAddress() != null && srcIp.getSrcIpAddress().indexOf("-") > -1)
|| (srcIp.getDestIpAddress() != null && srcIp.getDestIpAddress().indexOf("-") > -1));
if (isRange) {

View File

@@ -133,6 +133,7 @@ public class ConfigServiceUtil {
result=response.readEntity(String.class);
}
} catch (Exception e) {
logger.error("request_service_failed",e);
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
}
if(response != null && response.getStatus() == 200){

View File

@@ -39,6 +39,7 @@ import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.Assert;
import com.google.common.collect.Lists;
import com.nis.domain.FunctionRegionDict;
@@ -583,25 +584,28 @@ public class ExportExcel {
commentStr="";
}
}else{
String[] ipPatterns=region.getConfigIpPattern().split(";");
if("client_ip".equals(headerStr)){
Assert.isTrue(ipPatterns.length==2);
String srcIpPattern=ipPatterns[0];
if(((","+region.getConfigIpPortShow()+",").indexOf(",1,") > -1) ){
commentStr="";
if((","+region.getConfigIpType()+",").indexOf(",4,") > -1){
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
if((","+srcIpPattern+",").indexOf(",3,") > -1){
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_VALUE+"IPv4"+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV4_DEFAULT_IP_VALUE;
}
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
if((","+srcIpPattern+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv4_range_tip")+""+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV4_DEFAULT_IP_RANGE_VALUE;
}
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
if((","+srcIpPattern+",").indexOf(",1,") > -1){
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv4_subnet_tip")+""+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV4_DEFAULT_IP_SUBNET_VALUE;
@@ -610,21 +614,21 @@ public class ExportExcel {
}
}
if((","+region.getConfigIpType()+",").indexOf(",6,") > -1){
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
if((","+srcIpPattern+",").indexOf(",3,") > -1){
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_VALUE+"IPv6"+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV6_DEFAULT_IP_VALUE;
}
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
if((","+srcIpPattern+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv6_range_tip")+""+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV6_DEFAULT_IP_RANGE_VALUE;
}
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
if((","+srcIpPattern+",").indexOf(",1,") > -1){
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv6_subnet_tip")+""+"\n\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV6_DEFAULT_IP_SUBNET_VALUE;
@@ -673,12 +677,12 @@ public class ExportExcel {
,msgProp.getProperty("serverip"))+"\n";
index++;
index++;
commentStr=commentStr+""+String.format(msgProp.getProperty("the_same_ip_type_pattern"))+"\n";
commentStr=commentStr+""+String.format(msgProp.getProperty("the_same_ip_type"))+"\n";
index++;
index++;
}
//4、IP Range 开始IP和结束IP必须在同一网段
if(((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1)){
if(((","+srcIpPattern+",").indexOf(",2,") > -1)){
commentStr=commentStr+""+msgProp.getProperty("ip_range")+","+msgProp.getProperty("ip_range_bit_field")+"\n";
index++;
index++;
@@ -689,7 +693,7 @@ public class ExportExcel {
}
//6、IPv4 Mask 掩码范围16-32
if(((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1)){
if(((","+srcIpPattern+",").indexOf(",1,") > -1)){
if(((","+region.getConfigIpType()+",").indexOf(",4,") > -1)){
commentStr=commentStr+""+msgProp.getProperty("ipv4_subnet_tip")+","+msgProp.getProperty("ipv4_mask_range_tip")+"\n";
index++;
@@ -705,24 +709,25 @@ public class ExportExcel {
}
if("server_ip".equals(headerStr)){
String destIpPattern=ipPatterns[1];
if((","+region.getConfigIpPortShow()+",").indexOf(",3,") > -1){
commentStr="";
if((","+region.getConfigIpType()+",").indexOf(",4,") > -1){
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
if((","+destIpPattern+",").indexOf(",3,") > -1){
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_VALUE+"IPv4"+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV4_DEFAULT_IP_VALUE;
}
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
if((","+destIpPattern+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv4_range_tip")+""+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV4_DEFAULT_IP_RANGE_VALUE;
}
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
if((","+destIpPattern+",").indexOf(",1,") > -1){
commentStr=commentStr+Constants.IPV4_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv4_subnet_tip")+""+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV4_DEFAULT_IP_SUBNET_VALUE;
@@ -731,21 +736,21 @@ public class ExportExcel {
}
}
if((","+region.getConfigIpType()+",").indexOf(",6,") > -1){
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
if((","+destIpPattern+",").indexOf(",3,") > -1){
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_VALUE+"IPv6"+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV6_DEFAULT_IP_VALUE;
}
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
if((","+destIpPattern+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_RANGE_VALUE+""+msgProp.getProperty("ipv6_range_tip")+""+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV6_DEFAULT_IP_RANGE_VALUE;
}
index++;
}
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
if((","+destIpPattern+",").indexOf(",1,") > -1){
commentStr=commentStr+Constants.IPV6_DEFAULT_IP_SUBNET_VALUE+""+msgProp.getProperty("ipv6_subnet_tip")+""+"\n\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.IPV6_DEFAULT_IP_SUBNET_VALUE;
@@ -778,12 +783,12 @@ public class ExportExcel {
,msgProp.getProperty("serverip"))+"\n";
index++;
index++;
commentStr=commentStr+""+String.format(msgProp.getProperty("the_same_ip_type_pattern"))+"\n";
commentStr=commentStr+""+String.format(msgProp.getProperty("the_same_ip_type"))+"\n";
index++;
index++;
}
//4、IP Range 开始IP和结束IP必须在同一网段
if(((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1)){
if(((","+destIpPattern+",").indexOf(",2,") > -1)){
commentStr=commentStr+""+msgProp.getProperty("ip_range")+","+msgProp.getProperty("ip_range_bit_field")+"\n";
index++;
index++;
@@ -794,7 +799,7 @@ public class ExportExcel {
}
//6、IPv4 Mask 掩码范围16-32
if(((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1)){
if(((","+destIpPattern+",").indexOf(",1,") > -1)){
if(((","+region.getConfigIpType()+",").indexOf(",4,") > -1)){
commentStr=commentStr+""+msgProp.getProperty("ipv4_subnet_tip")+","+msgProp.getProperty("ipv4_mask_range_tip")+"\n";
index++;
@@ -820,17 +825,20 @@ public class ExportExcel {
}else{
protocol=region.getConfigProtocol();
}
String[] portPatterns=region.getConfigPortPattern().split(";");
Assert.isTrue(portPatterns.length==2);
if("client_port".equals(headerStr)){
String srcPortPattern=portPatterns[0];
if(((","+region.getConfigIpPortShow()+",").indexOf(",2,") > -1)){
commentStr="";
if((","+region.getConfigPortPattern()+",").indexOf(",1,") > -1){
if((","+srcPortPattern+",").indexOf(",1,") > -1){
commentStr=commentStr+Constants.PORT_DEFAULT+"Port"+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.PORT_DEFAULT;
}
index++;
}
if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){
if((","+srcPortPattern+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"Port/"+msgProp.getProperty("port_mask")+""+"\n\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.PORT_MASK_DEFAULT;
@@ -856,11 +864,11 @@ public class ExportExcel {
index++;
}
//2、源端口、目的端口格式必须一致
if(((","+region.getConfigIpPortShow()+",").indexOf(",2,") > -1) && ((","+region.getConfigIpPortShow()+",").indexOf(",4,") > -1)){
commentStr=commentStr+""+msgProp.getProperty("the_same_port_pattern")+"\n";
index++;
index++;
}
// if(((","+region.getConfigIpPortShow()+",").indexOf(",2,") > -1) && ((","+region.getConfigIpPortShow()+",").indexOf(",4,") > -1)){
// commentStr=commentStr+"▶"+msgProp.getProperty("the_same_port_pattern")+"\n";
// index++;
// index++;
// }
//3、端口和端口掩码范围0-65535
commentStr=commentStr+""+msgProp.getProperty("port_mask_comment_tip")+"\n";
index++;
@@ -895,16 +903,17 @@ public class ExportExcel {
}
}
if("server_port".equals(headerStr)){
String destPortPattern=portPatterns[1];
if((","+region.getConfigIpPortShow()+",").indexOf(",4,") > -1){
commentStr="";
if((","+region.getConfigPortPattern()+",").indexOf(",1,") > -1){
if((","+destPortPattern+",").indexOf(",1,") > -1){
commentStr=commentStr+Constants.PORT_DEFAULT+"Port"+"\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.PORT_DEFAULT;
}
index++;
}
if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){
if((","+destPortPattern+",").indexOf(",2,") > -1){
commentStr=commentStr+Constants.PORT_MASK_DEFAULT+"Port/"+msgProp.getProperty("port_mask")+""+"\n\n";
if(StringUtil.isEmpty(defaultValue)){
defaultValue=Constants.PORT_MASK_DEFAULT;
@@ -930,11 +939,11 @@ public class ExportExcel {
index++;
}
//2、源端口、目的端口格式必须一致
if(((","+region.getConfigIpPortShow()+",").indexOf(",2,") > -1) && ((","+region.getConfigIpPortShow()+",").indexOf(",4,") > -1)){
commentStr=commentStr+""+msgProp.getProperty("the_same_port_pattern")+"\n";
index++;
index++;
}
// if(((","+region.getConfigIpPortShow()+",").indexOf(",2,") > -1) && ((","+region.getConfigIpPortShow()+",").indexOf(",4,") > -1)){
// commentStr=commentStr+"▶"+msgProp.getProperty("the_same_port_pattern")+"\n";
// index++;
// index++;
// }
//3、端口和端口掩码范围0-65535
commentStr=commentStr+""+msgProp.getProperty("port_mask_comment_tip")+"\n";
index++;

View File

@@ -13,6 +13,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.jets3t.service.ServiceException;
import org.springframework.beans.BeanUtils;
import org.springframework.util.Assert;
import com.beust.jcommander.internal.Lists;
import com.nis.domain.FunctionRegionDict;
@@ -27,6 +28,7 @@ import com.nis.domain.configuration.template.IpRateLimitTemplate;
//import com.nis.util.AsnCacheUtils;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.IPUtil;
import com.nis.util.StringUtil;
public class CheckIpFormatThread implements Callable<String>{
@@ -92,14 +94,20 @@ public class CheckIpFormatThread implements Callable<String>{
}
boolean canIPv4 = ipType.indexOf("4") > -1;
boolean canIPv6 = ipType.indexOf("6") > -1;
String ipPattern = regionDict.getConfigIpPattern();
if (StringUtils.isBlank(ipPattern)) {
String[] ipPattern = regionDict.getConfigIpPattern().split(";");
Assert.isTrue(ipPattern!=null&&ipPattern.length==2);
String srcIpPattern = ipPattern[0];
String destIpPattern = ipPattern[1];
if (StringUtils.isBlank(srcIpPattern)||StringUtils.isBlank(destIpPattern)) {
throw new RuntimeException("Found IP region,but ipPattern is Empty");
}
boolean canIPFormat = ipType.indexOf("3") > -1;
boolean canIPSubnetFormat = ipType.indexOf("1") > -1;
boolean canIPRangeFormat = ipType.indexOf("2") > -1;
String portPattern = regionDict.getConfigPortPattern();
String[] portPattern = regionDict.getConfigPortPattern().split(";");
Assert.isTrue(ipPattern!=null&&ipPattern.length==2);
String srcPortPattern=portPattern[0];
String destPortPattern=portPattern[1];
String protocol = regionDict.getConfigProtocol();
String direction = regionDict.getConfigDirection();
StringBuffer errTip = new StringBuffer();
@@ -621,74 +629,40 @@ public class CheckIpFormatThread implements Callable<String>{
prop.getProperty("server_ip", "Server IP")) + ";");
} else if (configIpPortShow.indexOf("1") > -1) {
String matchType = this.validIPAddress("client_ip", errInfo, baseIpCfg.getSrcIpAddress(),
ipType, ipPattern);
ipType, srcIpPattern);
//设置源IP pattern
if (matchType.endsWith("RANGE")) {
baseIpCfg.setSrcIpPattern(2);
} else if (matchType.endsWith("SUBNET")) {
baseIpCfg.setSrcIpPattern(1);
}else {
baseIpCfg.setSrcIpPattern(3);
}
if (matchType.startsWith("IPV6")) {
if (matchType.endsWith("RANGE")) {
// baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
baseIpCfg.setDestIpAddress(Constants.IPV6_DEFAULT_IP_RANGE_VALUE);
baseIpCfg.setIpPattern(2);
if (baseIpCfg.getSrcIpAddress()
.startsWith(Constants.IPV6_DEFAULT_IP_RANGE_VALUE.split("-")[0])) {
errInfo.append(prop.getProperty("client_ip")+" "
+ String.format(prop.getProperty("can_not_be"),
Constants.IPV6_DEFAULT_IP_RANGE_VALUE.split("-")[0])
+ ";");
}
} else if (matchType.endsWith("SUBNET")) {
// baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
baseIpCfg.setDestIpAddress(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE);
baseIpCfg.setIpPattern(1);
if (baseIpCfg.getSrcIpAddress()
.startsWith(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.split("/")[0])) {
errInfo.append(
prop.getProperty("client_ip")+" "
+ String.format(prop.getProperty("can_not_be"),
Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.split("/")[0])
+ ";");
}
} else {
// baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
//设置dest ip值
if(destIpPattern.indexOf("3")>-1) {//优先设置IP类型因为拆分的IP较少
baseIpCfg.setDestIpAddress(Constants.IPV6_DEFAULT_IP_VALUE);
baseIpCfg.setIpPattern(3);
if (baseIpCfg.getSrcIpAddress().equals(Constants.IPV6_DEFAULT_IP_VALUE)) {
errInfo.append(prop.getProperty("client_ip")+" " + String.format(
prop.getProperty("can_not_be"), Constants.IPV6_DEFAULT_IP_VALUE) + ";");
}
baseIpCfg.setDestIpPattern(3);
}else if(destIpPattern.indexOf("1")>-1) {
baseIpCfg.setDestIpAddress(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE);
baseIpCfg.setDestIpPattern(1);
}else {
baseIpCfg.setDestIpAddress(Constants.IPV6_DEFAULT_IP_RANGE_VALUE);
baseIpCfg.setDestIpPattern(2);
}
//设置IP类型
baseIpCfg.setIpType(6);
} else {
if (matchType.endsWith("RANGE")) {
this.validIPv4Range("client_ip", errInfo, baseIpCfg.getSrcIpAddress());
// baseIpCfg.setSrcIpAddress("0.0.0.0-"+baseIpCfg.getSrcIpAddress().split("-")[0].substring(0,baseIpCfg.getSrcIpAddress().indexOf("-")+1)+baseIpCfg.getSrcIpAddress().split("-")[1]);
baseIpCfg.setDestIpAddress(Constants.IPV4_DEFAULT_IP_RANGE_VALUE);
baseIpCfg.setIpPattern(2);
if (baseIpCfg.getSrcIpAddress()
.startsWith(Constants.IPV4_DEFAULT_IP_RANGE_VALUE.split("-")[0])) {
errInfo.append(prop.getProperty("client_ip")+" "
+ String.format(prop.getProperty("can_not_be"),
Constants.IPV4_DEFAULT_IP_RANGE_VALUE.split("-")[0])
+ ";");
}
} else if (matchType.endsWith("SUBNET")) {
// baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
baseIpCfg.setDestIpAddress(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE);
baseIpCfg.setIpPattern(1);
if (baseIpCfg.getSrcIpAddress()
.startsWith(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.split("/")[0])) {
errInfo.append(
prop.getProperty("client_ip")+" "
+ String.format(prop.getProperty("can_not_be"),
Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.split("/")[0])
+ ";");
}
} else {
baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
//设置dest ip值
if(destIpPattern.indexOf("3")>-1) {//优先设置IP类型因为拆分的IP较少
baseIpCfg.setDestIpAddress(Constants.IPV4_DEFAULT_IP_VALUE);
baseIpCfg.setIpPattern(3);
if (baseIpCfg.getSrcIpAddress().equals(Constants.IPV4_DEFAULT_IP_VALUE)) {
errInfo.append(prop.getProperty("client_ip")+" " + String.format(
prop.getProperty("can_not_be"), Constants.IPV4_DEFAULT_IP_VALUE) + ";");
}
baseIpCfg.setDestIpPattern(3);
}else if(destIpPattern.indexOf("1")>-1) {
baseIpCfg.setDestIpAddress(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE);
baseIpCfg.setDestIpPattern(1);
}else {
baseIpCfg.setDestIpAddress(Constants.IPV4_DEFAULT_IP_RANGE_VALUE);
baseIpCfg.setDestIpPattern(2);
}
baseIpCfg.setIpType(4);
}
@@ -700,166 +674,169 @@ public class CheckIpFormatThread implements Callable<String>{
prop.getProperty("client_ip", "Client IP")) + ";");
} else if (configIpPortShow.indexOf("3") > -1) {
String matchType = this.validIPAddress("server_ip", errInfo, baseIpCfg.getDestIpAddress(),
ipType, ipPattern);
ipType, destIpPattern);
if (matchType.endsWith("RANGE")) {
baseIpCfg.setDestIpPattern(2);
} else if (matchType.endsWith("SUBNET")) {
baseIpCfg.setDestIpPattern(1);
}else {
baseIpCfg.setDestIpPattern(3);
}
if (matchType.startsWith("IPV6")) {
if (matchType.endsWith("RANGE")) {
// baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
baseIpCfg.setSrcIpAddress(Constants.IPV6_DEFAULT_IP_RANGE_VALUE);
baseIpCfg.setIpPattern(2);
if (baseIpCfg.getDestIpAddress()
.startsWith(Constants.IPV6_DEFAULT_IP_RANGE_VALUE.split("-")[0])) {
errInfo.append(prop.getProperty("server_ip")+" "
+ String.format(prop.getProperty("can_not_be"),
Constants.IPV6_DEFAULT_IP_RANGE_VALUE.split("-")[0])
+ ";");
}
} else if (matchType.endsWith("SUBNET")) {
// baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
baseIpCfg.setSrcIpAddress(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE);
baseIpCfg.setIpPattern(1);
if (baseIpCfg.getDestIpAddress()
.startsWith(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.split("/")[0])) {
errInfo.append(
prop.getProperty("server_ip")+" "
+ String.format(prop.getProperty("can_not_be"),
Constants.IPV6_DEFAULT_IP_SUBNET_VALUE.split("/")[0])
+ ";");
}
} else {
// baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
if(srcIpPattern.indexOf("3")>-1) {
baseIpCfg.setSrcIpAddress(Constants.IPV6_DEFAULT_IP_VALUE);
baseIpCfg.setIpPattern(3);
if (baseIpCfg.getDestIpAddress().equals(Constants.IPV6_DEFAULT_IP_VALUE)) {
errInfo.append(prop.getProperty("server_ip")+" " + String.format(
prop.getProperty("can_not_be"), Constants.IPV6_DEFAULT_IP_VALUE) + ";");
}
baseIpCfg.setSrcIpPattern(3);
}else if(srcIpPattern.indexOf("1")>-1) {
baseIpCfg.setSrcIpAddress(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE);
baseIpCfg.setSrcIpPattern(1);
}else {
baseIpCfg.setSrcIpAddress(Constants.IPV6_DEFAULT_IP_RANGE_VALUE);
baseIpCfg.setSrcIpPattern(2);
}
baseIpCfg.setIpType(6);
} else {
if (matchType.endsWith("RANGE")) {
this.validIPv4Range("server_ip", errInfo, baseIpCfg.getDestIpAddress());
// baseIpCfg.setDestIpAddress("0.0.0.0-"+baseIpCfg.getDestIpAddress().split("-")[0]
// .substring(0,baseIpCfg.getDestIpAddress().indexOf("-")+1)
// +baseIpCfg.getDestIpAddress().split("-")[1]);
baseIpCfg.setSrcIpAddress(Constants.IPV4_DEFAULT_IP_RANGE_VALUE);
baseIpCfg.setIpPattern(2);
if (baseIpCfg.getDestIpAddress()
.startsWith(Constants.IPV4_DEFAULT_IP_RANGE_VALUE.split("-")[0])) {
errInfo.append(prop.getProperty("server_ip")+" "
+ String.format(prop.getProperty("can_not_be"),
Constants.IPV4_DEFAULT_IP_RANGE_VALUE.split("-")[0])
+ ";");
}
} else if (matchType.endsWith("SUBNET")) {
// baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
baseIpCfg.setSrcIpAddress(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE);
baseIpCfg.setIpPattern(1);
if (baseIpCfg.getDestIpAddress()
.startsWith(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.split("/")[0])) {
errInfo.append(
prop.getProperty("server_ip")+" "
+ String.format(prop.getProperty("can_not_be"),
Constants.IPV4_DEFAULT_IP_SUBNET_VALUE.split("/")[0])
+ ";");
}
} else {
// baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
if(srcIpPattern.indexOf("3")>-1) {
baseIpCfg.setSrcIpAddress(Constants.IPV4_DEFAULT_IP_VALUE);
baseIpCfg.setIpPattern(3);
if (baseIpCfg.getDestIpAddress().equals(Constants.IPV4_DEFAULT_IP_VALUE)) {
errInfo.append(prop.getProperty("server_ip")+" " + String.format(
prop.getProperty("can_not_be"), Constants.IPV4_DEFAULT_IP_VALUE) + ";");
}
baseIpCfg.setSrcIpPattern(3);
}else if(srcIpPattern.indexOf("1")>-1) {
baseIpCfg.setSrcIpAddress(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE);
baseIpCfg.setSrcIpPattern(1);
}else {
baseIpCfg.setSrcIpAddress(Constants.IPV4_DEFAULT_IP_RANGE_VALUE);
baseIpCfg.setSrcIpPattern(2);
}
baseIpCfg.setIpType(4);
}
}
} else {// 全不为空
String matchType = this.validIPAddress("client_ip", errInfo, baseIpCfg.getSrcIpAddress(), ipType,
ipPattern);
String matchType1 = this.validIPAddress("server_ip", errInfo, baseIpCfg.getDestIpAddress(), ipType,
ipPattern);
if (StringUtils.isNotBlank(matchType) && StringUtils.isNotBlank(matchType1)
&& !matchType.equals(matchType1)) {
errInfo.append(prop.get("the_same_ip_type_pattern") + ";");
String srcMatchType = this.validIPAddress("client_ip", errInfo, baseIpCfg.getSrcIpAddress(), ipType,
srcIpPattern);
String destMatchType = this.validIPAddress("server_ip", errInfo, baseIpCfg.getDestIpAddress(), ipType,
destIpPattern);
if (StringUtils.isNotBlank(srcMatchType) && StringUtils.isNotBlank(destMatchType)
&& ((srcMatchType.startsWith("IPV6")&&destMatchType.startsWith("IPV4"))
||(srcMatchType.startsWith("IPV4")&&destMatchType.startsWith("IPV6")))) {
errInfo.append(prop.get("the_same_ip_type") + ";");
}
// baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
// baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
if (matchType.startsWith("IPV6")) {
if (srcMatchType.startsWith("IPV6")) {
baseIpCfg.setIpType(6);
} else {
baseIpCfg.setIpType(4);
}
if (matchType.endsWith("RANGE")) {
if (matchType.startsWith("IPV4")) {
if (srcMatchType.endsWith("RANGE")) {
baseIpCfg.setSrcIpPattern(2);
}else if(srcMatchType.endsWith("SUBNET")) {
baseIpCfg.setSrcIpPattern(1);
}else {
baseIpCfg.setSrcIpPattern(3);
}
if (destMatchType.endsWith("RANGE")) {
baseIpCfg.setDestIpPattern(2);
}else if(destMatchType.endsWith("SUBNET")) {
baseIpCfg.setDestIpPattern(1);
}else {
baseIpCfg.setDestIpPattern(3);
}
if(baseIpCfg.getIpType().equals(4)) {
if (srcMatchType.endsWith("RANGE")) {
this.validIPv4Range("client_ip", errInfo, baseIpCfg.getSrcIpAddress());
}
if (destMatchType.endsWith("RANGE")) {
this.validIPv4Range("server_ip", errInfo, baseIpCfg.getDestIpAddress());
}
if (baseIpCfg.getSrcIpAddress().split("-")[0]
.equals(baseIpCfg.getDestIpAddress().split("-")[0])) {
errInfo.append(String.format(prop.getProperty("are_the_same"),
baseIpCfg.getSrcIpAddress().split("-")[0],
baseIpCfg.getDestIpAddress().split("-")[0]) + ";");
//验证Ip范围
if(StringUtils.isEmpty(errInfo)&&(srcMatchType.endsWith("RANGE")||destMatchType.endsWith("RANGE"))) {
this.ValidateRangeCross(baseIpCfg.getSrcIpAddress(),baseIpCfg.getDestIpAddress(), errInfo);
}
baseIpCfg.setIpPattern(2);
} else if (matchType.endsWith("SUBNET")) {
if (baseIpCfg.getSrcIpAddress().split("/")[0]
.equals(baseIpCfg.getDestIpAddress().split("/")[0])) {
errInfo.append(String.format(prop.getProperty("are_the_same"),
baseIpCfg.getSrcIpAddress().split("/")[0],
baseIpCfg.getDestIpAddress().split("/")[0]) + ";");
}
boolean same=false;
if(baseIpCfg.getSrcIpAddress().indexOf("-")>-1) {
if(baseIpCfg.getDestIpAddress().indexOf("-")>-1) {
if(baseIpCfg.getSrcIpAddress().split("-")[0].equals(baseIpCfg.getDestIpAddress().split("-")[0])) {
same=true;
}
}else if(baseIpCfg.getDestIpAddress().indexOf("/")>-1) {
if(baseIpCfg.getSrcIpAddress().split("-")[0].equals(baseIpCfg.getDestIpAddress().split("/")[0])) {
same=true;
}
}else {
if(baseIpCfg.getSrcIpAddress().split("-")[0].equals(baseIpCfg.getDestIpAddress())) {
same=true;
}
}
baseIpCfg.setIpPattern(1);
} else {
if (baseIpCfg.getSrcIpAddress().equals(baseIpCfg.getDestIpAddress())) {
errInfo.append(String.format(prop.getProperty("are_the_same"),
prop.getProperty("client_ip"), prop.getProperty("server_ip")) + ";");
}else if(baseIpCfg.getSrcIpAddress().indexOf("/")>-1){
if(baseIpCfg.getDestIpAddress().indexOf("-")>-1) {
if(baseIpCfg.getSrcIpAddress().split("/")[0].equals(baseIpCfg.getDestIpAddress().split("-")[0])) {
same=true;
}
}else if(baseIpCfg.getDestIpAddress().indexOf("/")>-1) {
if(baseIpCfg.getSrcIpAddress().split("/")[0].equals(baseIpCfg.getDestIpAddress().split("/")[0])) {
same=true;
}
}else {
if(baseIpCfg.getSrcIpAddress().split("/")[0].equals(baseIpCfg.getDestIpAddress())) {
same=true;
}
}
baseIpCfg.setIpPattern(3);
}else {
if(baseIpCfg.getDestIpAddress().indexOf("-")>-1) {
if(baseIpCfg.getSrcIpAddress().equals(baseIpCfg.getDestIpAddress().split("-")[0])) {
same=true;
}
}else if(baseIpCfg.getDestIpAddress().indexOf("/")>-1) {
if(baseIpCfg.getSrcIpAddress().equals(baseIpCfg.getDestIpAddress().split("/")[0])) {
same=true;
}
}else {
if(baseIpCfg.getSrcIpAddress().equals(baseIpCfg.getDestIpAddress())) {
same=true;
}
}
}
if(same) {
errInfo.append(String.format(prop.getProperty("are_the_same"),
baseIpCfg.getSrcIpAddress().split("-")[0],
baseIpCfg.getDestIpAddress().split("-")[0]) + ";");
}
}
// TODO 判断源IP和目的IP的值
// TODO 判断源IP和目的IP格式
if (destPortEmpty) {
if (srcPortEmpty) {
if (srcPortEmpty) {
if(srcPortPattern.indexOf("1")>-1) {
baseIpCfg.setSrcPort("0");
baseIpCfg.setDestPort("0");
baseIpCfg.setPortPattern(1);
} else {
if (baseIpCfg.getSrcPort().indexOf("/") > -1) {
baseIpCfg.setDestPort("0/0");
baseIpCfg.setPortPattern(2);
} else {
baseIpCfg.setDestPort("0");
baseIpCfg.setPortPattern(1);
}
baseIpCfg.setSrcPort(baseIpCfg.getSrcPort().trim());
baseIpCfg.setSrcPortPattern(1);
}else {
baseIpCfg.setSrcPort("0/0");
baseIpCfg.setSrcPortPattern(2);
}
} else {
if (srcPortEmpty) {
if (baseIpCfg.getDestPort().indexOf("/") > -1) {
baseIpCfg.setSrcPort("0/0");
baseIpCfg.setPortPattern(2);
} else {
baseIpCfg.setSrcPort("0");
baseIpCfg.setPortPattern(1);
}
} else {
if (baseIpCfg.getSrcPort().indexOf("/") > -1) {
baseIpCfg.setPortPattern(2);
} else {
baseIpCfg.setPortPattern(1);
}
baseIpCfg.setSrcPort(baseIpCfg.getSrcPort().trim());
}
baseIpCfg.setDestPort(baseIpCfg.getDestPort().trim());
}else if(baseIpCfg.getSrcPort().indexOf("/")>-1) {
baseIpCfg.setSrcPortPattern(2);
}else {
baseIpCfg.setSrcPortPattern(1);
}
// TODO 判断源端口和目的端口格式
// TODO 判断源和目的端口的值
boolean validPort = this.validPort(errInfo, baseIpCfg.getSrcPort(), baseIpCfg.getDestPort(),
portPattern);
baseIpCfg.setSrcPort(baseIpCfg.getSrcPort().trim());
boolean validSrcPort = this.validPort(errInfo, baseIpCfg.getSrcPort(),
srcPortPattern,"client_port");
if (destPortEmpty) {
if(destPortPattern.indexOf("1")>-1) {
baseIpCfg.setDestPort("0");
baseIpCfg.setDestPortPattern(1);
}else {
baseIpCfg.setDestPort("0/0");
baseIpCfg.setDestPortPattern(2);
}
}else if(baseIpCfg.getDestPort().indexOf("/")>-1) {
baseIpCfg.setDestPortPattern(2);
}else {
baseIpCfg.setDestPortPattern(1);
}
baseIpCfg.setDestPort(baseIpCfg.getDestPort().trim());
boolean validDestPort = this.validPort(errInfo, baseIpCfg.getSrcPort(),
srcPortPattern,"server_port");
if (baseIpCfg.getProtocol()==null) {
//packet ip reject
if(regionDict.getFunctionId().equals(5)&&serviceDict!=null&&serviceDict.getServiceId().equals(16)) {
@@ -901,7 +878,7 @@ public class CheckIpFormatThread implements Callable<String>{
}
boolean validProtocol = this.validProtocol(errInfo, baseIpCfg.getProtocol(), protocol);
// 验证protocol与port是否符合逻辑
if (validProtocol && validPort) {
if (validProtocol && validSrcPort&&validDestPort) {
validProtocolAndPort(errInfo, baseIpCfg.getProtocol(), baseIpCfg.getSrcPort(),
baseIpCfg.getDestPort());
}
@@ -1030,153 +1007,85 @@ public class CheckIpFormatThread implements Callable<String>{
* @param portPattern
* @throws ServiceException
*/
public boolean validPort(StringBuffer errInfo, String srcPortStr, String destPortStr, String portPattern)
public boolean validPort(StringBuffer errInfo, String portStr, String portPattern,String portName)
throws ServiceException {
boolean valid = true;
if (portPattern.equals("1")) {
try {
Integer srcPort = Integer.parseInt(srcPortStr);
Integer srcPort = Integer.parseInt(portStr);
if (srcPort < 0 || srcPort > 65535) {
errInfo.append(prop.getProperty("client_port")
errInfo.append(prop.getProperty(portName)
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
valid = false;
}
} catch (Exception e) {
// TODO: handle exception
errInfo.append(String.format(prop.getProperty("not_number"), prop.getProperty("client_port")) + ";");
valid = false;
}
try {
Integer destPort = Integer.parseInt(destPortStr);
if (destPort < 0 || destPort > 65535) {
errInfo.append(prop.getProperty("server_port")
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
valid = false;
}
} catch (Exception e) {
// TODO: handle exception
errInfo.append(String.format(prop.getProperty("not_number"), prop.getProperty("server_port")) + ";");
errInfo.append(String.format(prop.getProperty("not_number"), prop.getProperty(portName)) + ";");
valid = false;
}
} else if (portPattern.equals("2")) {
Pattern p = Constants.PORT_MASK_PATTERN;
Matcher m = p.matcher(srcPortStr);
Matcher m = p.matcher(portStr);
if (!m.matches()) {
errInfo.append(
String.format(prop.getProperty("is_in_wrong_format"), prop.getProperty("client_port")) + ";");
String.format(prop.getProperty("is_in_wrong_format"), prop.getProperty(portName)) + ";");
valid = false;
}
m = p.matcher(destPortStr);
if (!m.matches()) {
errInfo.append(
String.format(prop.getProperty("is_in_wrong_format"), prop.getProperty("server_port")) + ";");
valid = false;
}
Integer srcPort = Integer.parseInt(srcPortStr.split("/")[0]);
Integer srcPortMask = Integer.parseInt(srcPortStr.split("/")[1]);
Integer destPort = Integer.parseInt(destPortStr.split("/")[0]);
Integer destPortMask = Integer.parseInt(destPortStr.split("/")[1]);
if (srcPort < 0 || srcPort > 65535) {
errInfo.append(prop.getProperty("client_port")
Integer port = Integer.parseInt(portStr.split("/")[0]);
Integer portMask = Integer.parseInt(portStr.split("/")[1]);
if (port < 0 || port > 65535) {
errInfo.append(prop.getProperty(portName)
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
valid = false;
}
if (srcPortMask < 0 || srcPortMask > 65535) {
errInfo.append(prop.getProperty("client_port_mask")
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
valid = false;
}
if (destPort < 0 || destPort > 65535) {
errInfo.append(prop.getProperty("server_port")
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
valid = false;
}
if (destPortMask < 0 || destPortMask > 65535) {
errInfo.append(prop.getProperty("server_port_mask")
if (portMask < 0 || portMask > 65535) {
errInfo.append(prop.getProperty(portName+"_mask")
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
valid = false;
}
} else if (portPattern.indexOf("1") > -1 && portPattern.indexOf("2") > -1) {
Pattern p = Constants.PORT_MASK_PATTERN;
Pattern p1 = Constants.PORT_PATTERN;
Matcher m = p.matcher(srcPortStr);// 源端口是端口掩码格式
Matcher m1 = p.matcher(destPortStr);// 目的端口是端口掩码格式
Matcher m2 = p1.matcher(srcPortStr);// 源端口是端口格式
Matcher m3 = p1.matcher(destPortStr);// 目的端口是端口格式
Matcher m = p.matcher(portStr);// 源端口是端口掩码格式
Matcher m2 = p1.matcher(portStr);// 端口是端口格式
if (m.matches()) {
Integer srcPort = Integer.parseInt(srcPortStr.split("/")[0]);
Integer srcPortMask = Integer.parseInt(srcPortStr.split("/")[1]);
Integer srcPort = Integer.parseInt(portStr.split("/")[0]);
Integer srcPortMask = Integer.parseInt(portStr.split("/")[1]);
if (srcPort < 0 || srcPort > 65535) {
errInfo.append(prop.getProperty("client_port")
errInfo.append(prop.getProperty(portName)
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
valid = false;
}
if (srcPortMask < 0 || srcPortMask > 65535) {
errInfo.append(prop.getProperty("client_port_mask")
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
valid = false;
}
}
if (m1.matches()) {
Integer destPort = Integer.parseInt(destPortStr.split("/")[0]);
Integer destPortMask = Integer.parseInt(destPortStr.split("/")[1]);
if (destPort < 0 || destPort > 65535) {
errInfo.append(prop.getProperty("server_port")
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
valid = false;
}
if (destPortMask < 0 || destPortMask > 65535) {
errInfo.append(prop.getProperty("server_port_mask")
errInfo.append(prop.getProperty(portName+"_mask")
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
valid = false;
}
}
if (m2.matches()) {
try {
Integer srcPort = Integer.parseInt(srcPortStr);
Integer srcPort = Integer.parseInt(portStr);
if (srcPort < 0 || srcPort > 65535) {
errInfo.append(prop.getProperty("client_port")
errInfo.append(prop.getProperty(portName)
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
valid = false;
}
} catch (Exception e) {
// TODO: handle exception
errInfo.append(
String.format(prop.getProperty("not_number"), prop.getProperty("client_port")) + ";");
String.format(prop.getProperty("not_number"), prop.getProperty(portName)) + ";");
valid = false;
}
}
if (m3.matches()) {
try {
Integer destPort = Integer.parseInt(destPortStr);
if (destPort < 0 || destPort > 65535) {
errInfo.append(prop.getProperty("server_port")
+ String.format(prop.getProperty("must_between"), 0, 65535) + ";");
valid = false;
}
} catch (Exception e) {
// TODO: handle exception
errInfo.append(
String.format(prop.getProperty("not_number"), prop.getProperty("server_port")) + ";");
valid = false;
}
}
if ((m.matches() && m3.matches()) || (m2.matches() && m1.matches())) {
errInfo.append(prop.getProperty("the_same_port_pattern") + ";");
valid = false;
}
if (!m.matches() && !m2.matches()) {
errInfo.append(
String.format(prop.getProperty("is_in_wrong_format"), prop.getProperty("client_port")) + ";");
String.format(prop.getProperty("is_in_wrong_format"), prop.getProperty(portName)) + ";");
valid = false;
}
if (!m1.matches() && !m3.matches()) {
errInfo.append(
String.format(prop.getProperty("is_in_wrong_format"), prop.getProperty("server_port")) + ";");
valid = false;
}
}
return valid;
}
@@ -1369,7 +1278,44 @@ public class CheckIpFormatThread implements Callable<String>{
}
return matchType;
}
public void ValidateRangeCross(String srcIp,String destIp,StringBuffer errInfo) {
long srcStart=0l,srcEnd=0,srcNum=0l,destStart=0l,destEnd=0l,destNum=0l;
if(srcIp.indexOf("-")>-1) {
String[] srcArr=srcIp.split("\\-");
srcStart=IPUtil.getIpHostDesimal(srcArr[0]);
srcEnd=IPUtil.getIpHostDesimal(srcArr[1]);
}else if(srcIp.indexOf("/")>-1) {
srcNum=IPUtil.getIpHostDesimal(srcIp.split("/")[0]);
}else {
srcNum=IPUtil.getIpHostDesimal(srcIp);
}
if(destIp.indexOf("-")>-1) {
String[] destArr=destIp.split("\\-");
destStart=IPUtil.getIpHostDesimal(destArr[0]);
destEnd=IPUtil.getIpHostDesimal(destArr[1]);
}else if(destIp.indexOf("/")>-1) {
destNum=IPUtil.getIpHostDesimal(destIp.split("/")[0]);
}else {
destNum=IPUtil.getIpHostDesimal(destIp);
}
if(srcNum==0l) {
if(destNum==0l) {
if(!(destEnd<srcStart||srcEnd<destStart)) {
errInfo.append(prop.getProperty("range_cross")+";");
}
}else {
if(destNum>=srcStart&&destNum<=srcEnd) {
errInfo.append(prop.getProperty("range_cross")+";");
}
}
}else {
if(destNum==0l) {
if(srcNum>=destStart&&srcNum<=destEnd) {
errInfo.append(prop.getProperty("range_cross")+";");
}
}
}
}
public List<Map<Long, AsnGroupInfo>> getAsnNoMaps() {
return asnNoMaps;
}
@@ -1382,5 +1328,4 @@ public class CheckIpFormatThread implements Callable<String>{
public void setAsnGroupInfos(Map<Long, AsnGroupInfo> asnGroupInfos) {
this.asnGroupInfos = asnGroupInfos;
}
}

View File

@@ -79,15 +79,19 @@ public class AsnIpController extends BaseController{
public String save(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")CfgIndexInfo cfg,RedirectAttributes redirectAttributes){
try{
asnIpCfgService.saveAsnIpCfg(cfg);
addMessage(redirectAttributes,"success","save_success");
}catch(Exception e){
logger.error("信息保存失败",e);
e.printStackTrace();
if(e instanceof MaatConvertException) {
addMessage(redirectAttributes,"error",e.getMessage());
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
addMessage(redirectAttributes,"error","save_failed");
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("ASN IP配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("ASN IP配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath +"/basics/asn/list?functionId="+cfg.getFunctionId();
@@ -98,11 +102,19 @@ public class AsnIpController extends BaseController{
try{
asnIpCfgService.update(cfg);
addMessage(redirectAttributes,"success","save_success");
}catch(Exception e){
logger.error("信息保存失败",e);
e.printStackTrace();
addMessage(redirectAttributes,"error","save_failed");
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("ASN IP配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("ASN IP配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath +"/basics/asn/list?functionId="+cfg.getFunctionId();

View File

@@ -77,4 +77,31 @@ public class InnerProtectionListController extends BaseController{
public Map<String,List<String>> ajaxGetAllInfo(HttpServletRequest request, HttpServletResponse response){
return innerProtectionListService.ajaxGetAllInfo();
}
/**
* 校验配置是否已存在
* @param cfg
* @param request
* @param response
* @return
*/
@ResponseBody
@RequestMapping(value = {"/checkKeywordExist"})
public boolean checkKeywordExist(ProtectionListInfo cfg, HttpServletRequest request, HttpServletResponse response){
if(!StringUtil.isEmpty(cfg.getProId())){ // 修改操作
ProtectionListInfo info = innerProtectionListService.getById(cfg.getProId());
if(info != null && info.getKeyword().equals(cfg.getKeyword()) && info.getTargetType().equals(cfg.getTargetType())){
return true;
}
}
Map<String, List<String>> map = innerProtectionListService.ajaxGetAllInfo();
List<String> list = map.get(cfg.getTargetType());
if(list != null) {
if(list.contains(cfg.getKeyword())) {
return false;
}
}
return true;
}
}

View File

@@ -219,15 +219,19 @@ public class AppCfgController extends BaseController {
entity.setAppCode(specificService.getSpecServiceCode());
}
appCfgService.saveOrUpdateAppPolicyCfg(entity);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
logger.error("saveAppPolicyCfg failed", e);
e.printStackTrace();
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
addMessage(redirectAttributes, "error", "save_failed");
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("app 协议配置下发失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("app 协议配置保存失败:",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/app/policyCfgList?functionId=" + entity.getFunctionId();
@@ -255,12 +259,10 @@ public class AppCfgController extends BaseController {
entity = appCfgService.getAppPolicyCfg(Long.parseLong(id), null);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_APP);
try {
appCfgService.auditAppPolicyCfg(entity, isAudit);
appCfgService.auditAppPolicyCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (Exception e) {
e.printStackTrace();
@@ -394,15 +396,19 @@ public class AppCfgController extends BaseController {
entity.setAppCode(specificService.getSpecServiceCode());
}
appCfgService.saveOrUpdateAppIpCfg(entity);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
e.printStackTrace();
logger.error("saveAppIpCfg failed", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
addMessage(redirectAttributes, "error", "save_failed");
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
}catch (MaatConvertException e) {
logger.error("APP IP配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("APP IP配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/app/ipCfgList?functionId=" + entity.getFunctionId();
@@ -432,10 +438,7 @@ public class AppCfgController extends BaseController {
entity = appCfgService.getAppIpCfg(Long.parseLong(id));
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
entity.setTableName(AppIpCfg.getTablename());
if (dataMap.containsKey(entity.getCompileId())) {
dataMap.get(entity.getCompileId()).add(entity);
} else {
@@ -737,14 +740,19 @@ public class AppCfgController extends BaseController {
entity.setAppCode(specificService.getSpecServiceCode());
}
appCfgService.saveOrUpdateAppDomainCfg(entity);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
e.printStackTrace();
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
addMessage(redirectAttributes, "error", "save_failed");
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("APP域名配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("APP域名配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/app/domainCfgList?functionId=" + entity.getFunctionId();
@@ -772,11 +780,9 @@ public class AppCfgController extends BaseController {
entity = appCfgService.getAppDomainCfg(Long.parseLong(id));
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
appCfgService.auditAppDomainCfg(entity, isAudit);
appCfgService.auditAppDomainCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (Exception e) {
e.printStackTrace();
@@ -1507,18 +1513,19 @@ public class AppCfgController extends BaseController {
entity.setCfgKeywords(entity.getCfgKeywords());
}
appCfgService.saveOrUpdateAppTopicDomainCfg(entity);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
if (e instanceof MaatConvertException) {
e.printStackTrace();
logger.info("app主题网站配置下发失败" + e.getMessage());
;
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
e.printStackTrace();
logger.error("app主题网站配置下发失败", e);
addMessage(redirectAttributes, "error", "save_failed");
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("APP主题网站配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("APP主题网站配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/app/topicDomainCfgList?functionId=" + entity.getFunctionId();
@@ -1546,11 +1553,9 @@ public class AppCfgController extends BaseController {
entity = appCfgService.getAppTopicDomainCfg(Long.parseLong(id));
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
appCfgService.auditAppTopicDomainCfg(entity, isAudit);
appCfgService.auditAppTopicDomainCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (Exception e) {
logger.error("app主题网站配置下发失败", e);

View File

@@ -142,14 +142,19 @@ public class AppFeatureCfgController extends BaseController {
entity.setAppCode(specificService.getSpecServiceCode());
}
appMultiFeatureCfgService.saveOrUpdateAppFeatureCfg(entity);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
e.printStackTrace();
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
addMessage(redirectAttributes, "error", "save_failed");
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("APP 特征配置下发失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("APP 特征配置保存失败:",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/app/feature/multiFeatureCfgList?functionId=" + entity.getFunctionId();
@@ -176,11 +181,9 @@ public class AppFeatureCfgController extends BaseController {
entity = appMultiFeatureCfgService.getAppFeatureIndex(Long.parseLong(id));
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
appMultiFeatureCfgService.auditAppFeatureCfg(entity, isAudit);
appMultiFeatureCfgService.auditAppFeatureCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (MaatConvertException e) {
e.printStackTrace();
@@ -350,7 +353,7 @@ public class AppFeatureCfgController extends BaseController {
String ipPortInfoNoExport = ",do_log,block_type,config_describe,valid_identifier,is_audit,creator,creator"
+ ",config_time,editor,edit_time,auditor,audit_time"
+ ",letter,whether_area_block,classification,attribute,label"
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
+ ",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,client_ip,src_ip_pattern,client_port,src_port_pattern,";
// 时间过滤
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {

View File

@@ -158,18 +158,22 @@ public class BasicProtocolController extends BaseController {
entity.setAppCode(specificService.getSpecServiceCode());
}
appCfgService.saveOrUpdateAppPolicyCfg(entity);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
e.printStackTrace();
logger.error("基础协议信息保存失败", e);
if (e instanceof MaatConvertException) {
// addMessage(redirectAttributes,e.getMessage());
addMessage(redirectAttributes, "error", "request_service_failed");
} else if (e instanceof CallExternalProceduresException) {
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
} else {
addMessage(redirectAttributes, "error", "save_failed");
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("基础协议配置下发失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (CallExternalProceduresException e) {
logger.error("调用外部程序出错:",e);
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
} catch (Exception e) {
logger.error("基础协议配置保存失败:",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/basicprotocol/list?functionId=" + entity.getFunctionId();
@@ -197,12 +201,10 @@ public class BasicProtocolController extends BaseController {
entity = appCfgService.getAppPolicyCfg(Long.parseLong(id), null);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL);
try {
appCfgService.auditAppPolicyCfg(entity, isAudit);
appCfgService.auditAppPolicyCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (Exception e) {
if (e instanceof MaatConvertException) {

View File

@@ -8,10 +8,8 @@
*/
package com.nis.web.controller.configuration;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -19,38 +17,22 @@ import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.axis2.databinding.types.soapencoding.Array;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.ui.Model;
import org.springframework.web.multipart.MultipartFile;
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.basics.ServiceDictInfo;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.HttpBodyCfg;
import com.nis.domain.configuration.HttpReqHeadCfg;
import com.nis.domain.configuration.HttpResHeadCfg;
import com.nis.domain.configuration.HttpUrlCfg;
import com.nis.domain.configuration.template.IpAllTemplate;
import com.nis.domain.configuration.template.IpCfgTemplate;
import com.nis.domain.specific.ConfigGroupInfo;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.NtcSubscribeIdCfg;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.DateUtils;
import com.nis.util.DictUtils;
import com.nis.util.StringUtil;
import com.nis.util.excel.ExportExcel;
import com.nis.util.excel.ImportExcel;
import com.nis.web.controller.BaseController;
import com.nis.web.dao.configuration.IpCfgDao;
import com.nis.web.security.UserUtils;
/**
* @ClassName: CommonController.java
@@ -288,15 +270,7 @@ public class CommonController extends BaseController {
e.printStackTrace();
}
}*/
public void _importFileTemplate(HttpServletRequest request,HttpServletResponse response,
RedirectAttributes redirectAttributes,Integer functionId,Integer cfgRegionCode) {
this.importCfgTemplate(request, response, redirectAttributes, functionId, cfgRegionCode);
}
@Deprecated
public void _importFileTemplate(HttpServletRequest request,HttpServletResponse response,
RedirectAttributes redirectAttributes,Integer functionId,Integer cfgRegionCode,Class clazz) {
this.importCfgTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,clazz);
}
//ip配置导出
public void _exportIp(String columns,Model model,HttpServletRequest request,HttpServletResponse response,
IpPortCfg entity,String ids,RedirectAttributes redirectAttributes){

View File

@@ -178,17 +178,22 @@ public class EncryptedTunnelBehaviorController extends BaseController {
entity.setAppCode(specificService.getSpecServiceCode());
}
appCfgService.saveOrUpdateAppPolicyCfg(entity);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
e.printStackTrace();
logger.error("加密隧道信息保存失败", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else if (e instanceof CallExternalProceduresException) {
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
} else {
addMessage(redirectAttributes, "error", "save_failed");
//配置仅保存
if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("加密隧道行为配置下发失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (CallExternalProceduresException e) {
logger.error("调用外部程序出错:",e);
addMessage(redirectAttributes, "error", "call_external_procedures_failed");
} catch (Exception e) {
logger.error("加密隧道行为配置保存失败:",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/encryptedtunnelbehav/list?functionId=" + entity.getFunctionId();
@@ -221,7 +226,7 @@ public class EncryptedTunnelBehaviorController extends BaseController {
entity.setFunctionId(functionId);
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR);
try {
appCfgService.auditAppPolicyCfg(entity, isAudit);
appCfgService.auditAppPolicyCfg(entity, isAudit,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (Exception e) {
if (e instanceof MaatConvertException) {

View File

@@ -98,15 +98,19 @@ public class DnsIpCfgController extends BaseController {
@ModelAttribute("cfg") DnsIpCfg cfg, RedirectAttributes redirectAttributes) {
try {
dnsIpCfgService.saveOrUpdate(cfg);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
logger.error("信息保存失败", e);
e.printStackTrace();
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
addMessage(redirectAttributes, "error", "save_failed");
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("DNS欺骗ip配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("DNS欺骗ip配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/cfg/dnsIp/list?functionId=" + cfg.getFunctionId();
@@ -235,7 +239,7 @@ public class DnsIpCfgController extends BaseController {
}
titleList.add(entity.getMenuNameCode());
classMap.put(entity.getMenuNameCode(), DnsIpCfg.class);
String cfgIndexInfoNoExport = ",log_total,whether_area_block,client_ip,port_pattern,client_port,server_port,ir_type,direction,protocol,do_log,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
String cfgIndexInfoNoExport = ",log_total,whether_area_block,client_ip,src_ip_pattern,src_port_pattern,dest_port_pattern,client_port,server_port,ir_type,direction,protocol,do_log,client_port,ir_type,group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
// 时间过滤
if (entity.getSearch_create_time_start() == null && entity.getSearch_create_time_end() == null) {

View File

@@ -80,10 +80,18 @@ public class DnsResStrategyController extends BaseController {
dnsResStrategyService.saveOrUpdate(cfg);
addMessage(redirectAttributes, "success", "save_success");
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("DNS响应策略配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("DNS响应策略配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
}

View File

@@ -71,15 +71,19 @@ public class DdosCfgController extends BaseController {
@ModelAttribute("cfg") DdosIpCfg cfg, RedirectAttributes redirectAttributes) {
try {
ddosCfgService.saveOrUpdate(cfg);
addMessage(redirectAttributes, "success", "save_success");
} catch (Exception e) {
logger.error("信息保存失败", e);
e.printStackTrace();
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
addMessage(redirectAttributes, "error", "save_failed");
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
} catch (MaatConvertException e) {
logger.error("DDOS配置下发失败",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("DDOS配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/manipulation/ddos/list?functionId=" + cfg.getFunctionId();
@@ -120,7 +124,7 @@ public class DdosCfgController extends BaseController {
Date auditTime = new Date();
for (String id : idArray) {
try {
ddosCfgService.audit(isAudit, isValid, functionId, id, auditTime);
ddosCfgService.audit(isAudit, isValid, functionId, id, auditTime,Constants.INSERT_ACTION);
addMessage(redirectAttributes, "success", "audit_success");
} catch (MaatConvertException e) {
e.printStackTrace();

View File

@@ -40,7 +40,6 @@ import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.IpReuseDnatPolicyCfg;
import com.nis.domain.configuration.IpReusePolicyCfg;
import com.nis.domain.configuration.UserManage;
import com.nis.domain.configuration.template.IpMultiplexPolicyTemplate;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
@@ -120,26 +119,6 @@ public class IpMultiplexController extends CommonController {
return "redirect:" + adminPath + "/manipulation/ipmulitiplex/list?functionId=" + cfg.getFunctionId();
}
// ip配置导入
/*
* @RequestMapping(value = "/import", method=RequestMethod.POST) public
* String importIp(String cfgName,RedirectAttributes redirectAttributes,
*
* @RequestParam("file") MultipartFile file,IpPortCfg cfg) {
* this._importIp(cfgName,redirectAttributes,
* file,cfg,IpMultiplexPolicyTemplate.class);
* redirectAttributes.addAttribute("urlPrefix","/manipulation/ipmulitiplex")
* ; redirectAttributes.addAttribute("requiresPermissionPrefix",
* "ip:mulitiplex"); return "redirect:" + adminPath
* +"/manipulation/ipmulitiplex/list?functionId="+cfg.getFunctionId(); }
*/
// ip模板下载
@RequestMapping(value = "import/template")
public void importFileTemplate(HttpServletRequest request, HttpServletResponse response,
RedirectAttributes redirectAttributes, Integer functionId, Integer cfgRegionCode) {
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,
IpMultiplexPolicyTemplate.class);
}
// ip配置导出
@RequestMapping(value = "export")

View File

@@ -112,20 +112,7 @@ public class RatelimitController extends CommonController {
redirectAttributes.addAttribute("requiresPermissionPrefix","domain:ratelimit");
return "redirect:" + adminPath +"/manipulation/ratelimit/domain/list?functionId="+cfg.getFunctionId();
}
//ip配置导入
/*@RequestMapping(value = "/ip/import", method=RequestMethod.POST)
public String importIp(String cfgName,RedirectAttributes redirectAttributes,
@RequestParam("file") MultipartFile file,IpPortCfg cfg) {
this._importIp(cfgName,redirectAttributes, file,cfg,IpRateLimitTemplate.class);
redirectAttributes.addAttribute("urlPrefix","/manipulation/ratelimit/ip");
redirectAttributes.addAttribute("requiresPermissionPrefix","ip:ratelimit");
return "redirect:" + adminPath +"/manipulation/ratelimit/ip/list?functionId="+cfg.getFunctionId();
}*/
@RequestMapping(value = "/ip/import/template")
public void importFileTemplate(HttpServletRequest request,HttpServletResponse response,
RedirectAttributes redirectAttributes,Integer functionId,Integer cfgRegionCode) {
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode,IpRateLimitTemplate.class);
}
//ip配置导出
@RequestMapping(value = "/ip/export")
public void exportIp(String columns,Model model,HttpServletRequest request,HttpServletResponse response,

View File

@@ -27,7 +27,6 @@ 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;
@@ -66,7 +65,6 @@ 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;

View File

@@ -14,15 +14,11 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.taglibs.standard.functions.Functions;
import org.springframework.beans.BeanUtils;
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.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.FunctionRegionDict;
@@ -31,10 +27,6 @@ import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.ComplexkeywordCfg;
import com.nis.domain.configuration.DnsResStrategy;
import com.nis.domain.configuration.ComplexStringCfgTemplate;
import com.nis.domain.configuration.template.IpCfgTemplate;
import com.nis.domain.specific.ConfigGroupInfo;
import com.nis.domain.configuration.StringCfgTemplate;
import com.nis.domain.configuration.HttpBodyCfg;
import com.nis.domain.configuration.HttpReqHeadCfg;
import com.nis.domain.configuration.HttpResHeadCfg;
@@ -46,7 +38,6 @@ import com.nis.exceptions.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.DictUtils;
import com.nis.util.StringUtil;
import com.nis.util.excel.ImportExcel;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
@@ -616,13 +607,6 @@ public class WebsiteController extends BaseController {
return "redirect:" + adminPath + "/ntc/website/dnsList?functionId=" + functionId;
}
@Deprecated
// 下载导入模板
@RequestMapping(value = "import/template")
public void importFileTemplate(HttpServletRequest request, HttpServletResponse response,
RedirectAttributes redirectAttributes, Integer functionId, Integer cfgRegionCode) {
this.importCfgTemplate(request, response, redirectAttributes, functionId, cfgRegionCode);
}
// http配置导入
/*
* @RequestMapping(value = "importHttp", method=RequestMethod.POST) public

View File

@@ -120,11 +120,6 @@ public class ControlController extends CommonController {
redirectAttributes.addAttribute("requiresPermissionPrefix","control:ip");
return "redirect:" + adminPath +"/proxy/control/ip/list?functionId="+cfg.getFunctionId();
}
@RequestMapping(value = "/ip/import/template")
public void importFileTemplate(HttpServletRequest request,HttpServletResponse response,
RedirectAttributes redirectAttributes,Integer functionId,Integer cfgRegionCode) {
this._importFileTemplate(request, response, redirectAttributes, functionId, cfgRegionCode);
}
//ip配置导出
@RequestMapping(value = "/ip/export")
public void exportIp(String columns,Model model,HttpServletRequest request,HttpServletResponse response,

View File

@@ -238,20 +238,26 @@ public class PxyObjKeyringController extends BaseController {
}
}
pxyObjKeyringService.saveOrUpdate(cfg);
addMessage(redirectAttributes, "success", "save_success");
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
}
} catch (MultiPartNewException e) {
logger.error("证书文件上传失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (MaatConvertException e) {
logger.error("拦截策略配置下发失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("证书上传失败", e);
if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else if (e instanceof MultiPartNewException) {
addMessage(redirectAttributes, "error", e.getMessage());
} else {
addMessage(redirectAttributes, "error", "save_failed");
}
logger.error("拦截策略配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/proxy/intercept/strateagy/list?functionId=" + cfg.getFunctionId();
}
@@ -641,18 +647,24 @@ public class PxyObjKeyringController extends BaseController {
}
}
pxyObjKeyringService.trustedCertsaveOrUpdate(cfg);
addMessage(redirectAttributes, "success", "save_success");
//配置仅保存
if(StringUtil.isEmpty(cfg.getIsValid()) || cfg.getIsValid()!=1) {
addMessage(redirectAttributes, "success", "save_success");
}else {
//配置直接生效
addMessage(redirectAttributes, "success", "audit_success");
}
}
} catch (MultiPartNewException e) {
logger.error("可信证书上传失败:",e);
addMessage(redirectAttributes, "error", e.getMessage());
} catch (MaatConvertException e) {
logger.error("可信证书单配置下发失败:",e);
addMessage(redirectAttributes, "error", "request_service_failed");
} catch (Exception e) {
logger.error("证书上传失败", e);
if (e instanceof MultiPartNewException) {
addMessage(redirectAttributes, "error", e.getMessage());
} else if (e instanceof MaatConvertException) {
addMessage(redirectAttributes, "error", "request_service_failed");
} else {
addMessage(redirectAttributes, "error", "save_failed");
}
logger.error("可信证书配置保存失败",e);
addMessage(redirectAttributes, "error", "save_failed");
}
return "redirect:" + adminPath + "/proxy/intercept/strateagy/trustedCertList?functionId=" + cfg.getFunctionId();

View File

@@ -5,7 +5,8 @@
<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="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" 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" />
@@ -48,7 +49,7 @@
</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.cfg_id,r.cfg_desc,r.ip_type,r.src_ip_address,r.src_ip_pattern,r.dest_ip_pattern,r.src_port_pattern,r.dest_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,
@@ -91,8 +92,11 @@
<if test="ipType != null">
AND r.IP_TYPE=#{ipType,jdbcType=INTEGER}
</if>
<if test="ipPattern != null">
AND r.IP_PATTERN=#{ipPattern,jdbcType=INTEGER}
<if test="srcIpPattern != null">
AND r.src_ip_pattern=#{srcIpPattern,jdbcType=INTEGER}
</if>
<if test="destIpPattern != null">
AND r.dest_ip_pattern=#{destIpPattern,jdbcType=INTEGER}
</if>
<if test="srcIpAddress != null and srcIpAddress != ''">
AND r.SRC_IP_ADDRESS=#{srcIpAddress,jdbcType=VARCHAR}
@@ -100,8 +104,11 @@
<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 test="srcPortPattern != null">
AND r.src_port_pattern=#{srcPortPattern,jdbcType=INTEGER}
</if>
<if test="destPortPattern != null">
AND r.dest_port_pattern=#{destPortPattern,jdbcType=INTEGER}
</if>
<if test="srcPort != null and srcPort !=''">
AND r.SRC_PORT=#{srcPort,jdbcType=VARCHAR}
@@ -227,8 +234,11 @@
<if test="ipType != null">
AND r.IP_TYPE=#{ipType,jdbcType=INTEGER}
</if>
<if test="ipPattern != null">
AND r.IP_PATTERN=#{ipPattern,jdbcType=INTEGER}
<if test="srcIpPattern != null">
AND r.src_ip_pattern=#{srcIpPattern,jdbcType=INTEGER}
</if>
<if test="destIpPattern != null">
AND r.dest_ip_pattern=#{destIpPattern,jdbcType=INTEGER}
</if>
<if test="srcIpAddress != null and srcIpAddress != ''">
AND r.SRC_IP_ADDRESS=#{srcIpAddress,jdbcType=VARCHAR}
@@ -236,8 +246,11 @@
<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 test="srcPortPattern != null">
AND r.src_port_pattern=#{srcPortPattern,jdbcType=INTEGER}
</if>
<if test="destPortPattern != null">
AND r.dest_port_pattern=#{destPortPattern,jdbcType=INTEGER}
</if>
<if test="srcPort != null and srcPort !=''">
AND r.SRC_PORT=#{srcPort,jdbcType=VARCHAR}
@@ -323,6 +336,9 @@
from asn_ip_cfg r where r.is_valid!=-1 and r.user_region1=#{asnId}
</select>
<insert id="insert" parameterType="com.nis.domain.basics.AsnIpCfg" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into asn_ip_cfg (
CFG_DESC,
ACTION,
@@ -345,9 +361,7 @@
AREA_EFFECTIVE_IDS,
function_id,
ip_type,
src_ip_address,
ip_pattern,
port_pattern,
src_ip_address,SRC_IP_PATTERN,DEST_IP_PATTERN,SRC_PORT_PATTERN,DEST_PORT_PATTERN,
src_port,
protocol,
protocol_id,
@@ -388,8 +402,8 @@
#{functionId,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{ipPattern,jdbcType=INTEGER},
#{portPattern,jdbcType=INTEGER},
#{srcIpPattern,jdbcType=INTEGER},#{destIpPattern,jdbcType=INTEGER},
#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},
#{srcPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{protocolId,jdbcType=INTEGER},
@@ -473,11 +487,17 @@
<if test="srcIpAddress != null and srcIpAddress != ''" >
src_ip_address = #{srcIpAddress,jdbcType=VARCHAR},
</if>
<if test="ipPattern != null" >
ip_pattern = #{ipPattern,jdbcType=INTEGER},
<if test="srcIpPattern != null" >
src_ip_pattern = #{srcIpPattern,jdbcType=INTEGER},
</if>
<if test="portPattern != null" >
port_pattern = #{portPattern,jdbcType=INTEGER},
<if test="destIpPattern != null" >
dest_ip_pattern =#{destIpPattern,jdbcType=INTEGER},
</if>
<if test="srcPortPattern != null" >
src_port_pattern = #{srcPortPattern,jdbcType=INTEGER},
</if>
<if test="destPortPattern != null" >
dest_port_pattern = #{destPortPattern,jdbcType=INTEGER},
</if>
<if test="srcPort != null and srcPort != ''" >
src_port = #{srcPort,jdbcType=VARCHAR},
@@ -564,7 +584,7 @@
INSERT INTO asn_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,region_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,
AREA_EFFECTIVE_IDS,function_id,ip_type,src_ip_address,SRC_IP_PATTERN,DEST_IP_PATTERN,SRC_PORT_PATTERN,DEST_PORT_PATTERN,src_port,
protocol,protocol_id,direction,dest_port,dest_ip_address,cfg_type,cfg_region_code,
asn_ip_group,user_region1,user_region2,user_region3,user_region4,user_region5,organization,country,detail)
VALUES
@@ -591,8 +611,10 @@
#{asnIp.functionId,jdbcType=INTEGER},
#{asnIp.ipType,jdbcType=INTEGER},
#{asnIp.srcIpAddress,jdbcType=VARCHAR},
#{asnIp.ipPattern,jdbcType=INTEGER},
#{asnIp.portPattern,jdbcType=INTEGER},
#{asnIp.srcIpPattern,jdbcType=INTEGER},
#{asnIp.destIpPattern,jdbcType=INTEGER},
#{asnIp.srcPortPattern,jdbcType=INTEGER},
#{asnIp.destPortPattern,jdbcType=INTEGER},
#{asnIp.srcPort,jdbcType=VARCHAR},
#{asnIp.protocol,jdbcType=INTEGER},
#{asnIp.protocolId,jdbcType=INTEGER},

View File

@@ -43,7 +43,8 @@
<result column="app_code" property="appCode" jdbcType="INTEGER" />
<result column="behav_code" property="behavCode" jdbcType="INTEGER" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="ip_pattern" property="ipPattern" jdbcType="INTEGER" />
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" />
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
<result column="port_pattern" property="portPattern" jdbcType="INTEGER" />
@@ -235,7 +236,8 @@
<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="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" 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" />
@@ -394,7 +396,7 @@
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,AREA_EFFECTIVE_IDS,r.RATELIMIT,r.FUNCTION_ID,r.CFG_TYPE,r.CFG_REGION_CODE,
r.IP_TYPE, r.IP_PATTERN, r.SRC_IP_ADDRESS,r.DEST_IP_ADDRESS, r.PORT_PATTERN,r.SRC_PORT,DEST_PORT,
r.IP_TYPE, r.SRC_IP_PATTERN,r.DEST_IP_PATTERN, r.SRC_IP_ADDRESS,r.DEST_IP_ADDRESS, r.SRC_PORT_PATTERN,r.DEST_PORT_PATTERN,r.SRC_PORT,DEST_PORT,
r.DIRECTION,r.PROTOCOL,r.DO_LOG,r.USER_REGION1,r.USER_REGION2,r.USER_REGION3,r.USER_REGION4,r.USER_REGION5
</sql>
@@ -461,7 +463,7 @@
</sql>
<sql id="IpCfg_Column" >
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port
,a.protocol,a.protocol_id,a.direction,a.cfg_type,a.action,a.dest_port,a.dest_ip_address
,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id
,a.edit_time,a.auditor_id,a.audit_time,a.service_id,a.request_id,
@@ -887,8 +889,11 @@
<if test="ipType != null">
AND r.IP_TYPE=#{ipType,jdbcType=INTEGER}
</if>
<if test="ipPattern != null">
AND r.IP_PATTERN=#{ipPattern,jdbcType=INTEGER}
<if test="srcIpPattern != null">
AND r.src_ip_pattern=#{srcIpPattern,jdbcType=INTEGER}
</if>
<if test="destIpPattern != null">
AND r.dest_ip_pattern=#{destIpPattern,jdbcType=INTEGER}
</if>
<if test="srcIpAddress != null and srcIpAddress != ''">
AND r.SRC_IP_ADDRESS=#{srcIpAddress,jdbcType=VARCHAR}
@@ -896,8 +901,11 @@
<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 test="srcPortPattern != null">
AND r.src_port_pattern=#{srcPortPattern,jdbcType=INTEGER}
</if>
<if test="destPortPattern != null">
AND r.dest_port_pattern=#{destPortPattern,jdbcType=INTEGER}
</if>
<if test="srcPort != null and srcPort !=''">
AND r.SRC_PORT=#{srcPort,jdbcType=VARCHAR}
@@ -1823,12 +1831,12 @@
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,
IP_TYPE, IP_PATTERN, SRC_IP_ADDRESS,DEST_IP_ADDRESS, PORT_PATTERN,SRC_PORT,DEST_PORT,
IP_TYPE,SRC_IP_PATTERN,DEST_IP_PATTERN, SRC_IP_ADDRESS,DEST_IP_ADDRESS,SRC_PORT_PATTERN,DEST_PORT_PATTERN,SRC_PORT,DEST_PORT,
DIRECTION,PROTOCOL,DO_LOG,user_region1,user_region2,user_region3,user_region4,user_region5
)values (
<include refid="AppCommonCfg_Value_List" />,
#{ipType,jdbcType=INTEGER}, #{ipPattern,jdbcType=INTEGER},#{srcIpAddress,jdbcType=VARCHAR},#{destIpAddress,jdbcType=VARCHAR},
#{portPattern,jdbcType=INTEGER},#{srcPort,jdbcType=VARCHAR},#{destPort,jdbcType=VARCHAR},#{direction,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER}, #{srcIpPattern,jdbcType=INTEGER},#{destIpPattern,jdbcType=INTEGER},#{srcIpAddress,jdbcType=VARCHAR},#{destIpAddress,jdbcType=VARCHAR},
#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},#{srcPort,jdbcType=VARCHAR},#{destPort,jdbcType=VARCHAR},#{direction,jdbcType=INTEGER},
#{protocol,jdbcType=INTEGER},#{doLog,jdbcType=INTEGER},#{userRegion1,jdbcType=VARCHAR},#{userRegion2,jdbcType=VARCHAR}
,#{userRegion3,jdbcType=VARCHAR},#{userRegion4,jdbcType=VARCHAR},#{userRegion5,jdbcType=VARCHAR}
)
@@ -1839,12 +1847,12 @@
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,
IP_TYPE, IP_PATTERN, SRC_IP_ADDRESS,DEST_IP_ADDRESS, PORT_PATTERN,SRC_PORT,DEST_PORT,
IP_TYPE,SRC_IP_PATTERN,DEST_IP_PATTERN, SRC_IP_ADDRESS,DEST_IP_ADDRESS,SRC_PORT_PATTERN,DEST_PORT_PATTERN,SRC_PORT,DEST_PORT,
DIRECTION,PROTOCOL,DO_LOG,user_region1,user_region2,user_region3,user_region4,user_region5
)values (
<include refid="AppCommonCfg_Value_List" />,
#{ipType,jdbcType=INTEGER}, #{ipPattern,jdbcType=INTEGER},#{srcIpAddress,jdbcType=VARCHAR},#{destIpAddress,jdbcType=VARCHAR},
#{portPattern,jdbcType=INTEGER},#{srcPort,jdbcType=VARCHAR},#{destPort,jdbcType=VARCHAR},#{direction,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER}, #{srcIpPattern,jdbcType=INTEGER},#{destIpPattern,jdbcType=INTEGER},#{srcIpAddress,jdbcType=VARCHAR},#{destIpAddress,jdbcType=VARCHAR},
#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},#{srcPort,jdbcType=VARCHAR},#{destPort,jdbcType=VARCHAR},#{direction,jdbcType=INTEGER},
#{protocol,jdbcType=INTEGER},#{doLog,jdbcType=INTEGER},#{userRegion1,jdbcType=VARCHAR},#{userRegion2,jdbcType=VARCHAR}
,#{userRegion3,jdbcType=VARCHAR},#{userRegion4,jdbcType=VARCHAR},#{userRegion5,jdbcType=VARCHAR}
)
@@ -1855,7 +1863,7 @@
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,
IP_TYPE, IP_PATTERN, SRC_IP_ADDRESS,DEST_IP_ADDRESS, PORT_PATTERN,SRC_PORT,DEST_PORT,
IP_TYPE,SRC_IP_PATTERN,DEST_IP_PATTERN, SRC_IP_ADDRESS,DEST_IP_ADDRESS,SRC_PORT_PATTERN,DEST_PORT_PATTERN,SRC_PORT,DEST_PORT,
DIRECTION,PROTOCOL,DO_LOG,user_region1,user_region2,user_region3,user_region4,user_region5
)values
<foreach collection ="list" item="appIp" separator =",">
@@ -1868,9 +1876,10 @@
#{appIp.requestId,jdbcType=INTEGER},#{appIp.compileId,jdbcType=INTEGER},#{appIp.isAreaEffective,jdbcType=INTEGER},
#{appIp.classify,jdbcType=VARCHAR},#{appIp.attribute,jdbcType=VARCHAR},#{appIp.lable,jdbcType=VARCHAR},
#{appIp.areaEffectiveIds,jdbcType=VARCHAR},#{appIp.ratelimit,jdbcType=VARCHAR},#{appIp.functionId,jdbcType=INTEGER},
#{appIp.cfgType,jdbcType=VARCHAR},#{appIp.cfgRegionCode,jdbcType=INTEGER},
#{appIp.ipType,jdbcType=INTEGER}, #{appIp.ipPattern,jdbcType=INTEGER},#{appIp.srcIpAddress,jdbcType=VARCHAR},#{appIp.destIpAddress,jdbcType=VARCHAR},
#{appIp.portPattern,jdbcType=INTEGER},#{appIp.srcPort,jdbcType=VARCHAR},#{appIp.destPort,jdbcType=VARCHAR},#{appIp.direction,jdbcType=INTEGER},
#{appIp.cfgType,jdbcType=VARCHAR},#{appIp.cfgRegionCode,jdbcType=INTEGER},#{appIp.ipType,jdbcType=INTEGER},
#{appIp.srcIpPattern,jdbcType=INTEGER},#{appIp.destIpPattern,jdbcType=INTEGER},#{appIp.srcIpAddress,jdbcType=VARCHAR},
#{appIp.destIpAddress,jdbcType=VARCHAR},#{appIp.srcPortPattern,jdbcType=INTEGER},#{appIp.destPortPattern,jdbcType=INTEGER},
#{appIp.srcPort,jdbcType=VARCHAR},#{appIp.destPort,jdbcType=VARCHAR},#{appIp.direction,jdbcType=INTEGER},
#{appIp.protocol,jdbcType=INTEGER},#{appIp.doLog,jdbcType=INTEGER},#{appIp.userRegion1,jdbcType=VARCHAR},#{appIp.userRegion2,jdbcType=VARCHAR}
,#{appIp.userRegion3,jdbcType=VARCHAR},#{appIp.userRegion4,jdbcType=VARCHAR},#{appIp.userRegion5,jdbcType=VARCHAR}
)
@@ -2057,9 +2066,7 @@
AREA_EFFECTIVE_IDS,
function_id,
ip_type,
src_ip_address,
ip_pattern,
port_pattern,
src_ip_address,SRC_IP_PATTERN,DEST_IP_PATTERN,SRC_PORT_PATTERN,DEST_PORT_PATTERN,
src_port,
protocol,
protocol_id,
@@ -2090,8 +2097,8 @@
#{functionId,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{ipPattern,jdbcType=INTEGER},
#{portPattern,jdbcType=INTEGER},
#{srcIpPattern,jdbcType=INTEGER},#{destIpPattern,jdbcType=INTEGER},
#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},
#{srcPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{protocolId,jdbcType=INTEGER},
@@ -2294,8 +2301,11 @@
<if test="ipType != null" >
IP_TYPE = #{ipType,jdbcType=INTEGER},
</if>
<if test="ipPattern != null">
IP_PATTERN=#{ipPattern,jdbcType=INTEGER},
<if test="srcIpPattern != null">
SRC_IP_PATTERN=#{srcIpPattern,jdbcType=INTEGER},
</if>
<if test="destIpPattern != null">
DEST_IP_PATTERN=#{destIpPattern,jdbcType=INTEGER},
</if>
<if test="srcIpAddress != null and srcIpAddress != ''">
SRC_IP_ADDRESS=#{srcIpAddress,jdbcType=VARCHAR},
@@ -2303,8 +2313,11 @@
<if test="destIpAddress != null and destIpAddress != ''">
DEST_IP_ADDRESS=#{destIpAddress,jdbcType=VARCHAR},
</if>
<if test="portPattern != null">
PORT_PATTERN=#{portPattern,jdbcType=INTEGER},
<if test="srcPortPattern != null">
SRC_PORT_PATTERN=#{srcPortPattern,jdbcType=INTEGER},
</if>
<if test="destPortPattern != null">
DEST_PORT_PATTERN=#{destPortPattern,jdbcType=INTEGER},
</if>
<if test="srcPort != null and srcPort !=''">
SRC_PORT=#{srcPort,jdbcType=VARCHAR},

View File

@@ -42,7 +42,8 @@
<result column="app_code" property="appCode" jdbcType="INTEGER" />
<result column="behav_code" property="behavCode" jdbcType="INTEGER" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="ip_pattern" property="ipPattern" jdbcType="INTEGER" />
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" />
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
<result column="port_pattern" property="portPattern" jdbcType="INTEGER" />
@@ -196,7 +197,7 @@
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,AREA_EFFECTIVE_IDS,r.FUNCTION_ID,r.CFG_TYPE,r.CFG_REGION_CODE,
r.IP_TYPE, r.IP_PATTERN, r.SRC_IP_ADDRESS,r.DEST_IP_ADDRESS, r.PORT_PATTERN,r.SRC_PORT,DEST_PORT,
r.IP_TYPE, r.src_ip_pattern,r.dest_ip_pattern, r.SRC_IP_ADDRESS,r.DEST_IP_ADDRESS, r.src_port_pattern,r.dest_port_pattern,r.SRC_PORT,DEST_PORT,
r.DIRECTION,r.PROTOCOL,r.DO_LOG,r.USER_REGION1,r.USER_REGION2,r.USER_REGION3,r.USER_REGION4,r.USER_REGION5
</sql>
@@ -540,13 +541,13 @@
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,CFG_TYPE,CFG_REGION_CODE,
IP_TYPE, IP_PATTERN, SRC_IP_ADDRESS,DEST_IP_ADDRESS, PORT_PATTERN,SRC_PORT,DEST_PORT,
IP_TYPE,SRC_IP_PATTERN,DEST_IP_PATTERN, SRC_IP_ADDRESS,DEST_IP_ADDRESS,SRC_PORT_PATTERN,DEST_PORT_PATTERN,SRC_PORT,DEST_PORT,
DIRECTION,PROTOCOL,DO_LOG,user_region1,user_region2,user_region3,user_region4,user_region5
)values (
<include refid="AppCommonCfg_Value_List" />,
#{cfgType,jdbcType=VARCHAR},#{cfgRegionCode,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER}, #{ipPattern,jdbcType=INTEGER},#{srcIpAddress,jdbcType=VARCHAR},#{destIpAddress,jdbcType=VARCHAR},
#{portPattern,jdbcType=INTEGER},#{srcPort,jdbcType=VARCHAR},#{destPort,jdbcType=VARCHAR},#{direction,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER}, #{srcIpPattern,jdbcType=INTEGER},#{destIpPattern,jdbcType=INTEGER},#{srcIpAddress,jdbcType=VARCHAR},#{destIpAddress,jdbcType=VARCHAR},
#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},#{srcPort,jdbcType=VARCHAR},#{destPort,jdbcType=VARCHAR},#{direction,jdbcType=INTEGER},
#{protocol,jdbcType=INTEGER},#{doLog,jdbcType=INTEGER},#{userRegion1,jdbcType=VARCHAR},#{userRegion2,jdbcType=VARCHAR}
,#{userRegion3,jdbcType=VARCHAR},#{userRegion4,jdbcType=VARCHAR},#{userRegion5,jdbcType=VARCHAR}
)

View File

@@ -1,13 +1,14 @@
<?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.AreaIpCfgDao" >
<resultMap id="BaseIpMap" type="com.nis.domain.configuration.AreaIpCfg" >
<resultMap id="AreaIpMap" type="com.nis.domain.configuration.AreaIpCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="ip_pattern" property="ipPattern" jdbcType="INTEGER" />
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" />
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
<result column="port_pattern" property="portPattern" jdbcType="INTEGER" />
@@ -36,13 +37,13 @@
<result column="function_id" property="functionId" jdbcType="INTEGER" />
</resultMap>
<sql id="AreaIpCfg_Column_List_with_id" >
CFG_ID,CFG_DESC,CFG_REGION_CODE,CFG_TYPE, IP_TYPE, IP_PATTERN, SRC_IP_ADDRESS,DEST_IP_ADDRESS, PORT_PATTERN,SRC_PORT,
CFG_ID,CFG_DESC,CFG_REGION_CODE,CFG_TYPE, IP_TYPE,SRC_IP_PATTERN,DEST_IP_PATTERN, SRC_IP_ADDRESS,DEST_IP_ADDRESS,SRC_PORT_PATTERN,DEST_PORT_PATTERN,SRC_PORT,
DEST_PORT,DIRECTION,PROTOCOL,PROTOCOL_ID,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
</sql>
<select id="getByCompileId" resultMap="BaseIpMap" >
<select id="getByCompileId" resultMap="AreaIpMap" >
SELECT
<include refid="AreaIpCfg_Column_List_with_id" />
FROM area_ip_cfg
@@ -76,9 +77,7 @@
AREA_EFFECTIVE_IDS,
function_id,
ip_type,
src_ip_address,
ip_pattern,
port_pattern,
src_ip_address,SRC_IP_PATTERN,DEST_IP_PATTERN,SRC_PORT_PATTERN,DEST_PORT_PATTERN,
src_port,
protocol,
protocol_id,
@@ -109,8 +108,8 @@
#{functionId,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{ipPattern,jdbcType=INTEGER},
#{portPattern,jdbcType=INTEGER},
#{srcIpPattern,jdbcType=INTEGER},#{destIpPattern,jdbcType=INTEGER},
#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},
#{srcPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{protocolId,jdbcType=INTEGER},
@@ -147,9 +146,7 @@
AREA_EFFECTIVE_IDS,
function_id,
ip_type,
src_ip_address,
ip_pattern,
port_pattern,
src_ip_address,SRC_IP_PATTERN,DEST_IP_PATTERN,SRC_PORT_PATTERN,DEST_PORT_PATTERN,
src_port,
protocol,
protocol_id,
@@ -180,8 +177,8 @@
#{functionId,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{ipPattern,jdbcType=INTEGER},
#{portPattern,jdbcType=INTEGER},
#{srcIpPattern,jdbcType=INTEGER},#{destIpPattern,jdbcType=INTEGER},
#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},
#{srcPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{protocolId,jdbcType=INTEGER},
@@ -255,11 +252,17 @@
<if test="srcIpAddress != null and srcIpAddress != ''" >
src_ip_address = #{srcIpAddress,jdbcType=VARCHAR},
</if>
<if test="ipPattern != null" >
ip_pattern = #{ipPattern,jdbcType=INTEGER},
<if test="srcIpPattern != null" >
src_ip_pattern = #{srcIpPattern,jdbcType=INTEGER},
</if>
<if test="portPattern != null" >
port_pattern = #{portPattern,jdbcType=INTEGER},
<if test="destIpPattern != null" >
dest_ip_pattern = #{destIpPattern,jdbcType=INTEGER},
</if>
<if test="srcPortPattern != null" >
src_port_pattern = #{srcPortPattern,jdbcType=INTEGER},
</if>
<if test="destPortPattern != null" >
dest_port_pattern = #{destPortPattern,jdbcType=INTEGER},
</if>
<if test="srcPort != null and srcPort != ''" >
src_port = #{srcPort,jdbcType=VARCHAR},

View File

@@ -30,7 +30,8 @@
<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="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" 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" />
@@ -94,7 +95,8 @@
<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="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" 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" />
@@ -193,7 +195,8 @@
<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="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" 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" />
@@ -224,7 +227,7 @@
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
</resultMap>
<sql id="IpCfg_Column" >
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port
,a.protocol,a.protocol_id,a.direction,a.cfg_type,a.action,a.dest_port,a.dest_ip_address
,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id
,a.edit_time,a.auditor_id,a.audit_time,a.service_id,a.request_id,
@@ -238,7 +241,7 @@
r.ATTRIBUTE,r.LABLE,r.AREA_EFFECTIVE_IDS,r.function_id,r.do_log,r.do_blacklist
</sql>
<sql id="AvVoipIp_Column" >
r.cfg_id,r.cfg_desc,r.ip_type,r.src_ip_address,r.ip_pattern,r.port_pattern,r.src_port
r.cfg_id,r.cfg_desc,r.ip_type,r.src_ip_address,r.src_ip_pattern,r.dest_ip_pattern,r.src_port_pattern,r.dest_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,
@@ -252,7 +255,7 @@
r.expr_type,r.match_method,r.is_hexbin,r.area_effective_ids,r.function_id,r.cfg_region_code
</sql>
<sql id="AvContIp_Column" >
r.cfg_id,r.cfg_desc,r.ip_type,r.src_ip_address,r.ip_pattern,r.port_pattern,r.src_port
r.cfg_id,r.cfg_desc,r.ip_type,r.src_ip_address,r.src_ip_pattern,r.dest_ip_pattern,r.src_port_pattern,r.dest_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,
@@ -816,8 +819,10 @@
function_id,
ip_type,
src_ip_address,
ip_pattern,
port_pattern,
src_ip_pattern,
dest_ip_pattern,
src_port_pattern,
dest_port_pattern,
src_port,
protocol,
protocol_id,
@@ -848,8 +853,10 @@
#{functionId,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{ipPattern,jdbcType=INTEGER},
#{portPattern,jdbcType=INTEGER},
#{srcIpPattern,jdbcType=INTEGER},
#{destIpPattern,jdbcType=INTEGER},
#{srcPortPattern,jdbcType=INTEGER},
#{destPortPattern,jdbcType=INTEGER},
#{srcPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{protocolId,jdbcType=INTEGER},
@@ -1053,9 +1060,7 @@
AREA_EFFECTIVE_IDS,
function_id,
ip_type,
src_ip_address,
ip_pattern,
port_pattern,
src_ip_address,SRC_IP_PATTERN,DEST_IP_PATTERN,SRC_PORT_PATTERN,DEST_PORT_PATTERN,
src_port,
protocol,
protocol_id,
@@ -1086,8 +1091,8 @@
#{functionId,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{ipPattern,jdbcType=INTEGER},
#{portPattern,jdbcType=INTEGER},
#{srcIpPattern,jdbcType=INTEGER},#{destIpPattern,jdbcType=INTEGER},
#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},
#{srcPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{protocolId,jdbcType=INTEGER},
@@ -1237,11 +1242,17 @@
<if test="voipIp != null and voipIp.srcIpAddress != null and voipIp.srcIpAddress != ''" >
src_ip_address = #{voipIp.srcIpAddress,jdbcType=VARCHAR},
</if>
<if test="voipIp != null and voipIp.ipPattern != null" >
ip_pattern = #{voipIp.ipPattern,jdbcType=INTEGER},
<if test="voipIp != null and voipIp.srcIpPattern != null" >
src_ip_pattern = #{voipIp.srcIpPattern,jdbcType=INTEGER},
</if>
<if test="voipIp != null and voipIp.portPattern != null" >
port_pattern = #{voipIp.portPattern,jdbcType=INTEGER},
<if test="voipIp != null and voipIp.destIpPattern != null" >
dest_ip_pattern = #{voipIp.destIpPattern,jdbcType=INTEGER},
</if>
<if test="voipIp != null and voipIp.srcPortPattern != null" >
src_port_pattern = #{voipIp.srcPortPattern,jdbcType=INTEGER},
</if>
<if test="voipIp != null and voipIp.destPortPattern != null" >
dest_port_pattern = #{voipIp.destPortPattern,jdbcType=INTEGER},
</if>
<if test="voipIp != null and voipIp.srcPort != null and voipIp.srcPort != ''" >
src_port = #{voipIp.srcPort,jdbcType=VARCHAR},
@@ -1652,9 +1663,7 @@
AREA_EFFECTIVE_IDS,
function_id,
ip_type,
src_ip_address,
ip_pattern,
port_pattern,
src_ip_address,SRC_IP_PATTERN,DEST_IP_PATTERN,SRC_PORT_PATTERN,DEST_PORT_PATTERN,
src_port,
protocol,
protocol_id,
@@ -1686,8 +1695,8 @@
#{functionId,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{ipPattern,jdbcType=INTEGER},
#{portPattern,jdbcType=INTEGER},
#{srcIpPattern,jdbcType=INTEGER},#{destIpPattern,jdbcType=INTEGER},
#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},
#{srcPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{protocolId,jdbcType=INTEGER},
@@ -1762,11 +1771,17 @@
<if test="srcIpAddress != null and srcIpAddress != ''" >
src_ip_address = #{srcIpAddress,jdbcType=VARCHAR},
</if>
<if test="ipPattern != null" >
ip_pattern = #{ipPattern,jdbcType=INTEGER},
<if test="srcIpPattern != null" >
src_ip_pattern = #{srcIpPattern,jdbcType=INTEGER},
</if>
<if test="portPattern != null" >
port_pattern = #{portPattern,jdbcType=INTEGER},
<if test="destIpPattern != null" >
dest_ip_pattern = #{destIpPattern,jdbcType=INTEGER},
</if>
<if test="srcPortPattern != null" >
src_port_pattern = #{srcPortPattern,jdbcType=INTEGER},
</if>
<if test="destPortPattern != null" >
dest_port_pattern = #{destPortPattern,jdbcType=INTEGER},
</if>
<if test="srcPort != null and srcPort != ''" >
src_port = #{srcPort,jdbcType=VARCHAR},

View File

@@ -30,7 +30,8 @@
<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="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" 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" />
@@ -162,7 +163,7 @@
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.do_log,a.do_blacklist
</sql>
<sql id="IpCfg_Column" >
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port
,a.protocol,a.protocol_id,a.direction,a.cfg_type,a.action,a.dest_port,a.dest_ip_address
,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id
,a.edit_time,a.auditor_id,a.audit_time,a.service_id,a.request_id,
@@ -432,9 +433,7 @@
AREA_EFFECTIVE_IDS,
function_id,
ip_type,
src_ip_address,
ip_pattern,
port_pattern,
src_ip_address,SRC_IP_PATTERN,DEST_IP_PATTERN,SRC_PORT_PATTERN,DEST_PORT_PATTERN,
src_port,
protocol,
protocol_id,
@@ -465,8 +464,8 @@
#{functionId,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{ipPattern,jdbcType=INTEGER},
#{portPattern,jdbcType=INTEGER},
#{srcIpPattern,jdbcType=INTEGER},#{destIpPattern,jdbcType=INTEGER},
#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},
#{srcPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{protocolId,jdbcType=INTEGER},

View File

@@ -74,7 +74,8 @@
<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="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" 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" />
@@ -172,7 +173,7 @@
a.do_blacklist
</sql>
<sql id="IpCfg_Column" >
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port
,a.protocol,a.protocol_id,a.direction,a.cfg_type,a.action,a.dest_port,a.dest_ip_address
,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id
,a.edit_time,a.auditor_id,a.audit_time,a.service_id,a.request_id,
@@ -489,9 +490,7 @@
AREA_EFFECTIVE_IDS,
function_id,
ip_type,
src_ip_address,
ip_pattern,
port_pattern,
src_ip_address,SRC_IP_PATTERN,DEST_IP_PATTERN,SRC_PORT_PATTERN,DEST_PORT_PATTERN,
src_port,
protocol,
protocol_id,
@@ -527,8 +526,8 @@
#{functionId,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{ipPattern,jdbcType=INTEGER},
#{portPattern,jdbcType=INTEGER},
#{srcIpPattern,jdbcType=INTEGER},#{destIpPattern,jdbcType=INTEGER},
#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},
#{srcPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{protocolId,jdbcType=INTEGER},

View File

@@ -80,7 +80,8 @@
<result column="app_code" property="appCode" jdbcType="INTEGER" />
<result column="behav_code" property="behavCode" jdbcType="INTEGER" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="ip_pattern" property="ipPattern" jdbcType="INTEGER" />
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" />
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
<result column="port_pattern" property="portPattern" jdbcType="INTEGER" />
@@ -240,7 +241,8 @@
<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="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" 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" />
@@ -381,7 +383,8 @@
<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="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" 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" />
@@ -701,7 +704,8 @@
<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="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" 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" />
@@ -775,12 +779,12 @@
<sql id="DdosIpCfg_Column" >
a.cfg_id,a.cfg_desc,a.action,a.is_valid,a.is_audit,a.creator_id,a.audit_time,
a.service_id,a.request_id,a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable,
a.area_effective_ids,a.function_id,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
a.area_effective_ids,a.function_id,a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port
,a.protocol,a.protocol_id,a.direction,a.dest_port,a.dest_ip_address,a.cfg_type,a.pps_threadshold,
a.antiddos_protocol,a.bps_threadshold
</sql>
<sql id="IpCfg_Column" >
a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port,
a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port,
a.protocol,a.protocol_id,a.direction,a.dest_port,a.dest_ip_address,a.cfg_type,a.compile_id
</sql>
<sql id="IpCfg_AllColumn" >
@@ -788,7 +792,7 @@
a.service_id,a.request_id,a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable,
a.area_effective_ids,a.function_id,a.do_log,a.dns_strategy_id,a.user_region1,a.user_region2,
a.user_region3,a.user_region4,a.user_region5,
a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port,
a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port,
a.protocol,a.protocol_id,a.direction,a.dest_port,a.dest_ip_address,a.cfg_type
</sql>
<sql id="IpDropCfg_Column" >
@@ -796,11 +800,11 @@
a.service_id,a.request_id,a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable,
a.area_effective_ids,a.function_id,a.user_region1,a.user_region2,
a.user_region3,a.user_region4,a.user_region5,
a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port,
a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port,
a.protocol,a.protocol_id,a.direction,a.dest_port,a.dest_ip_address,a.cfg_type
</sql>
<sql id="AsnIpCfg_Column" >
a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port
,a.protocol,a.protocol_id,a.direction,a.dest_port,a.dest_ip_address,a.cfg_type,a.asn_ip_group,
a.user_region1,a.region_id
</sql>
@@ -883,7 +887,7 @@
,a.area_effective_ids,a.function_id,a.cfg_region_code,a.compile_id
</sql>
<sql id="DnsIpCfgColumns">
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port
,a.protocol,a.protocol_id,a.direction,a.cfg_type,a.action,a.dest_port,a.dest_ip_address
,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id
,a.edit_time,a.auditor_id,a.audit_time,a.service_id,a.request_id,
@@ -907,7 +911,7 @@
a.feature_table_type,a.app_code,a.spec_service_id,a.cfg_region_code
</sql>
<sql id="AppIpCfg_Column" >
a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port
,a.protocol,a.direction,a.dest_port,a.dest_ip_address,a.cfg_type,a.compile_id
</sql>
@@ -928,7 +932,7 @@
a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME,
a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY,
a.ATTRIBUTE,a.LABLE,AREA_EFFECTIVE_IDS,a.RATELIMIT,a.FUNCTION_ID,a.CFG_TYPE,a.CFG_REGION_CODE,
a.IP_TYPE, a.IP_PATTERN, a.SRC_IP_ADDRESS,a.DEST_IP_ADDRESS, a.PORT_PATTERN,a.SRC_PORT,DEST_PORT,
a.IP_TYPE, a.src_ip_pattern,a.dest_ip_pattern, a.SRC_IP_ADDRESS,a.DEST_IP_ADDRESS, a.src_port_pattern,a.dest_port_pattern,a.SRC_PORT,DEST_PORT,
a.DIRECTION,a.PROTOCOL,a.DO_LOG,a.USER_REGION1,a.USER_REGION2,a.USER_REGION3,a.USER_REGION4,a.USER_REGION5
</sql>
@@ -1629,7 +1633,7 @@
</select>
<select id="getAsnIpList" resultType="com.nis.domain.basics.AsnIpCfg" parameterType="com.nis.domain.configuration.CfgIndexInfo">
select
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port
,a.protocol,a.protocol_id,a.direction,a.cfg_type,a.action,a.dest_port,a.dest_ip_address
,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id
,a.edit_time,a.auditor_id,a.audit_time,a.service_id,a.request_id,

View File

@@ -5,7 +5,8 @@
<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="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" 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" />
@@ -41,7 +42,7 @@
</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.cfg_id,r.cfg_desc,r.ip_type,r.src_ip_address,r.src_ip_pattern,r.dest_ip_pattern,r.src_port_pattern,r.dest_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,
@@ -80,8 +81,11 @@
<if test="ipType != null">
AND r.IP_TYPE=#{ipType,jdbcType=INTEGER}
</if>
<if test="ipPattern != null">
AND r.IP_PATTERN=#{ipPattern,jdbcType=INTEGER}
<if test="srcIpPattern != null">
AND r.src_ip_pattern=#{srcIpPattern,jdbcType=INTEGER}
</if>
<if test="destIpPattern != null">
AND r.dest_ip_pattern=#{destIpPattern,jdbcType=INTEGER}
</if>
<if test="srcIpAddress != null and srcIpAddress != ''">
AND r.SRC_IP_ADDRESS=#{srcIpAddress,jdbcType=VARCHAR}
@@ -89,8 +93,11 @@
<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 test="srcPortPattern != null">
AND r.src_port_pattern=#{srcPortPattern,jdbcType=INTEGER}
</if>
<if test="destPortPattern != null">
AND r.dest_port_pattern=#{destPortPattern,jdbcType=INTEGER}
</if>
<if test="srcPort != null and srcPort !=''">
AND r.SRC_PORT=#{srcPort,jdbcType=VARCHAR}
@@ -217,9 +224,7 @@
AREA_EFFECTIVE_IDS,
function_id,
ip_type,
src_ip_address,
ip_pattern,
port_pattern,
src_ip_address,SRC_IP_PATTERN,DEST_IP_PATTERN,SRC_PORT_PATTERN,DEST_PORT_PATTERN,
src_port,
protocol,
protocol_id,
@@ -254,8 +259,8 @@
#{functionId,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{ipPattern,jdbcType=INTEGER},
#{portPattern,jdbcType=INTEGER},
#{srcIpPattern,jdbcType=INTEGER},#{destIpPattern,jdbcType=INTEGER},
#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},
#{srcPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{protocolId,jdbcType=INTEGER},
@@ -332,11 +337,17 @@
<if test="srcIpAddress != null and srcIpAddress != ''" >
src_ip_address = #{srcIpAddress,jdbcType=VARCHAR},
</if>
<if test="ipPattern != null" >
ip_pattern = #{ipPattern,jdbcType=INTEGER},
<if test="srcIpPattern != null" >
src_ip_pattern = #{srcIpPattern,jdbcType=INTEGER},
</if>
<if test="portPattern != null" >
port_pattern = #{portPattern,jdbcType=INTEGER},
<if test="destIpPattern != null" >
dest_ip_pattern = #{destIpPattern,jdbcType=INTEGER},
</if>
<if test="srcPortPattern != null" >
src_port_pattern = #{srcPortPattern,jdbcType=INTEGER},
</if>
<if test="destPortPattern != null" >
dest_port_pattern = #{destPortPattern,jdbcType=INTEGER},
</if>
<if test="srcPort != null and srcPort != ''" >
src_port = #{srcPort,jdbcType=VARCHAR},

View File

@@ -5,7 +5,8 @@
<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="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" 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" />
@@ -40,7 +41,7 @@
</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.cfg_id,r.cfg_desc,r.ip_type,r.src_ip_address,r.src_ip_pattern,r.dest_ip_pattern,r.src_port_pattern,r.dest_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,
@@ -83,8 +84,11 @@
<if test="ipType != null">
AND r.IP_TYPE=#{ipType,jdbcType=INTEGER}
</if>
<if test="ipPattern != null">
AND r.IP_PATTERN=#{ipPattern,jdbcType=INTEGER}
<if test="srcIpPattern != null">
AND r.src_ip_pattern=#{srcIpPattern,jdbcType=INTEGER}
</if>
<if test="destIpPattern != null">
AND r.dest_ip_pattern=#{destIpPattern,jdbcType=INTEGER}
</if>
<if test="srcIpAddress != null and srcIpAddress != ''">
AND r.SRC_IP_ADDRESS=#{srcIpAddress,jdbcType=VARCHAR}
@@ -92,8 +96,11 @@
<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 test="srcPortPattern != null">
AND r.src_port_pattern=#{srcPortPattern,jdbcType=INTEGER}
</if>
<if test="destPortPattern != null">
AND r.dest_port_pattern=#{destPortPattern,jdbcType=INTEGER}
</if>
<if test="srcPort != null and srcPort !=''">
AND r.SRC_PORT=#{srcPort,jdbcType=VARCHAR}
@@ -208,6 +215,9 @@
</select>
<insert id="insert" parameterType="com.nis.domain.configuration.DnsIpCfg" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into dns_ip_cfg (
CFG_DESC,
ACTION,
@@ -229,9 +239,7 @@
AREA_EFFECTIVE_IDS,
function_id,
ip_type,
src_ip_address,
ip_pattern,
port_pattern,
src_ip_address,SRC_IP_PATTERN,DEST_IP_PATTERN,SRC_PORT_PATTERN,DEST_PORT_PATTERN,
src_port,
protocol,
protocol_id,
@@ -264,8 +272,8 @@
#{functionId,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{ipPattern,jdbcType=INTEGER},
#{portPattern,jdbcType=INTEGER},
#{srcIpPattern,jdbcType=INTEGER},#{destIpPattern,jdbcType=INTEGER},
#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},
#{srcPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{protocolId,jdbcType=INTEGER},
@@ -340,11 +348,17 @@
<if test="srcIpAddress != null and srcIpAddress != ''" >
src_ip_address = #{srcIpAddress,jdbcType=VARCHAR},
</if>
<if test="ipPattern != null" >
ip_pattern = #{ipPattern,jdbcType=INTEGER},
<if test="srcIpPattern != null" >
src_ip_pattern = #{srcIpPattern,jdbcType=INTEGER},
</if>
<if test="portPattern != null" >
port_pattern = #{portPattern,jdbcType=INTEGER},
<if test="destIpPattern != null" >
dest_ip_pattern = #{destIpPattern,jdbcType=INTEGER},
</if>
<if test="srcPortPattern != null" >
src_port_pattern = #{srcPortPattern,jdbcType=INTEGER},
</if>
<if test="destPortPattern != null" >
dest_port_pattern = #{destPortPattern,jdbcType=INTEGER},
</if>
<if test="srcPort != null and srcPort != ''" >
src_port = #{srcPort,jdbcType=VARCHAR},

View File

@@ -197,6 +197,9 @@ LEFT JOIN dns_res_strategy r ON a.dns_strategy_id=r.res_group_1_id
order by r.cfg_Id
</select>
<insert id="insert" parameterType="com.nis.domain.configuration.DnsResStrategy" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into dns_res_strategy (
CFG_DESC,
ACTION,

View File

@@ -35,7 +35,8 @@
<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="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" 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" />
@@ -172,7 +173,7 @@
a.do_blacklist
</sql>
<sql id="IpCfg_Column" >
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port
,a.protocol,a.protocol_id,a.direction,a.cfg_type,a.action,a.dest_port,a.dest_ip_address
,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id
,a.edit_time,a.auditor_id,a.audit_time,a.service_id,a.request_id,
@@ -453,9 +454,7 @@
AREA_EFFECTIVE_IDS,
function_id,
ip_type,
src_ip_address,
ip_pattern,
port_pattern,
src_ip_address,SRC_IP_PATTERN,DEST_IP_PATTERN,SRC_PORT_PATTERN,DEST_PORT_PATTERN,
src_port,
protocol,
protocol_id,
@@ -491,8 +490,8 @@
#{functionId,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{ipPattern,jdbcType=INTEGER},
#{portPattern,jdbcType=INTEGER},
#{srcIpPattern,jdbcType=INTEGER},#{destIpPattern,jdbcType=INTEGER},
#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},
#{srcPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{protocolId,jdbcType=INTEGER},

View File

@@ -1,13 +1,15 @@
<?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.IpCfgDao" >
<!-- 基础 -->
<resultMap id="BaseIpMap" type="com.nis.domain.configuration.BaseIpCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="ip_pattern" property="ipPattern" jdbcType="INTEGER" />
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" jdbcType="INTEGER" />
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
<result column="port_pattern" property="portPattern" jdbcType="INTEGER" />
@@ -85,7 +87,8 @@
<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="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" 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" />
@@ -116,14 +119,14 @@
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
</resultMap>
<sql id="BaseIpCfg_Column_List_with_id" >
CFG_ID, CFG_DESC,CFG_REGION_CODE,CFG_TYPE, IP_TYPE, IP_PATTERN, SRC_IP_ADDRESS,DEST_IP_ADDRESS, PORT_PATTERN,SRC_PORT,DEST_PORT,
CFG_ID, CFG_DESC,CFG_REGION_CODE,CFG_TYPE, IP_TYPE,SRC_IP_PATTERN,DEST_IP_PATTERN, SRC_IP_ADDRESS,DEST_IP_ADDRESS,SRC_PORT_PATTERN,DEST_PORT_PATTERN,SRC_PORT,DEST_PORT,
DIRECTION,PROTOCOL,PROTOCOL_ID,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,RATELIMIT,DNS_STRATEGY_ID,IR_TYPE,USER_REGION1,USER_REGION2,USER_REGION3,USER_REGION4,USER_REGION5
</sql>
<sql id="BaseIpCfg_Column_List_with_id_name" >
CFG_ID, CFG_DESC,CFG_REGION_CODE,CFG_TYPE, IP_TYPE, IP_PATTERN, SRC_IP_ADDRESS,DEST_IP_ADDRESS, PORT_PATTERN,SRC_PORT,DEST_PORT,
CFG_ID, CFG_DESC,CFG_REGION_CODE,CFG_TYPE, IP_TYPE,SRC_IP_PATTERN,DEST_IP_PATTERN, SRC_IP_ADDRESS,DEST_IP_ADDRESS,SRC_PORT_PATTERN,DEST_PORT_PATTERN,SRC_PORT,DEST_PORT,
DIRECTION,PROTOCOL,PROTOCOL_ID,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,
@@ -133,7 +136,8 @@
<choose>
<when test="page !=null and page.alias != null and page.alias != ''">
${page.alias}.CFG_ID as cfgId, ${page.alias}.CFG_DESC as cfgDesc,${page.alias}.CFG_REGION_CODE as cfgRegionCode,${page.alias}.CFG_TYPE as cfgType, ${page.alias}.IP_TYPE as ipType,
${page.alias}.IP_PATTERN as ipPattern, ${page.alias}.SRC_IP_ADDRESS as srcIpAddress, ${page.alias}.DEST_IP_ADDRESS as destIpAddress, ${page.alias}.PORT_PATTERN as portPattern,${page.alias}.SRC_PORT as srcPort,${page.alias}.DEST_PORT as destPort,
${page.alias}.SRC_IP_PATTERN as srcIpPattern,${page.alias}.DEST_IP_PATTERN as destIpPattern, ${page.alias}.SRC_IP_ADDRESS as srcIpAddress, ${page.alias}.DEST_IP_ADDRESS as destIpAddress,
${page.alias}.SRC_PORT_PATTERN as srcPortPattern,${page.alias}.DEST_PORT_PATTERN as destPortPattern,${page.alias}.SRC_PORT as srcPort,${page.alias}.DEST_PORT as destPort,
${page.alias}.DIRECTION as direction,${page.alias}.PROTOCOL as protocol,${page.alias}.PROTOCOL_ID as protocolId,${page.alias}.ACTION as action,${page.alias}.IS_VALID as isValid,${page.alias}.IS_AUDIT as isAudit,
${page.alias}.CREATOR_ID as creatorId,${page.alias}.CREATE_TIME AS createTime,${page.alias}.EDITOR_ID as editorId,${page.alias}.EDIT_TIME AS editTime,${page.alias}.AUDITOR_ID as auditorId,${page.alias}.AUDIT_TIME AS auditTime,
${page.alias}.SERVICE_ID as serviceId,${page.alias}.REQUEST_ID AS requestId,${page.alias}.COMPILE_ID AS compileId,${page.alias}.IS_AREA_EFFECTIVE as isAreaEffective,${page.alias}.classify,
@@ -147,7 +151,8 @@
</when>
<otherwise>
r.CFG_ID as cfgId, r.CFG_DESC as cfgDesc,r.CFG_REGION_CODE as cfgRegionCode,r.CFG_TYPE as cfgType, r.IP_TYPE as ipType,
r.IP_PATTERN as ipPattern, r.SRC_IP_ADDRESS as srcIpAddress, r.DEST_IP_ADDRESS as destIpAddress, r.PORT_PATTERN as portPattern,r.SRC_PORT as srcPort,r.DEST_PORT as destPort,
r.src_ip_pattern as srcIpPattern,r.dest_ip_pattern as destIpPattern, r.SRC_IP_ADDRESS as srcIpAddress, r.DEST_IP_ADDRESS as destIpAddress,
r.src_port_pattern as srcPortPattern,r.dest_port_pattern as destPortPattern,r.SRC_PORT as srcPort,r.DEST_PORT as destPort,
r.DIRECTION as direction,r.PROTOCOL as protocol,r.PROTOCOL_ID as protocolId,r.ACTION as action,r.IS_VALID as isValid,r.IS_AUDIT as isAudit,
r.CREATOR_ID as creatorId,r.CREATE_TIME AS createTime,r.EDITOR_ID as editorId,r.EDIT_TIME AS editTime,r.AUDITOR_ID as auditorId,r.AUDIT_TIME AS auditTime,
r.SERVICE_ID as serviceId,r.REQUEST_ID AS requestId,r.COMPILE_ID AS compileId,r.IS_AREA_EFFECTIVE as isAreaEffective,r.classify,
@@ -163,8 +168,7 @@
</sql>
<sql id="BaseIpCfg_Column_List" >
CFG_DESC,CFG_REGION_CODE,CFG_TYPE,
IP_TYPE,IP_PATTERN,SRC_IP_ADDRESS,DEST_IP_ADDRESS,
PORT_PATTERN,SRC_PORT,DEST_PORT,DIRECTION,
IP_TYPE,SRC_IP_PATTERN,DEST_IP_PATTERN,SRC_IP_ADDRESS,DEST_IP_ADDRESS,SRC_PORT_PATTERN,DEST_PORT_PATTERN,SRC_PORT,DEST_PORT,DIRECTION,
PROTOCOL,PROTOCOL_ID,ACTION,
IS_VALID,IS_AUDIT,CREATOR_ID,
CREATE_TIME,EDITOR_ID,EDIT_TIME,
@@ -176,8 +180,8 @@
</sql>
<sql id="BaseIpCfg_Value_List" >
#{cfgDesc,jdbcType=VARCHAR},#{cfgRegionCode,jdbcType=INTEGER},#{cfgType,jdbcType=VARCHAR},
#{ipType,jdbcType=INTEGER}, #{ipPattern,jdbcType=INTEGER},#{srcIpAddress,jdbcType=VARCHAR},#{destIpAddress,jdbcType=VARCHAR},
#{portPattern,jdbcType=INTEGER},#{srcPort,jdbcType=VARCHAR},#{destPort,jdbcType=VARCHAR},#{direction,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER}, #{srcIpPattern,jdbcType=INTEGER},#{destIpPattern,jdbcType=INTEGER},#{srcIpAddress,jdbcType=VARCHAR},#{destIpAddress,jdbcType=VARCHAR},
#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},#{srcPort,jdbcType=VARCHAR},#{destPort,jdbcType=VARCHAR},#{direction,jdbcType=INTEGER},
#{protocol,jdbcType=INTEGER},#{protocolId,jdbcType=INTEGER},#{action,jdbcType=INTEGER},
#{isValid,jdbcType=INTEGER},#{isAudit,jdbcType=INTEGER},#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},#{editorId,jdbcType=INTEGER},#{editTime,jdbcType=TIMESTAMP},
@@ -201,7 +205,7 @@
a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.do_log,a.do_blacklist
</sql>
<sql id="IpCfg_Column" >
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port
,a.protocol,a.protocol_id,a.direction,a.cfg_type,a.action,a.dest_port,a.dest_ip_address
,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id
,a.edit_time,a.auditor_id,a.audit_time,a.service_id,a.request_id,
@@ -291,8 +295,11 @@
<if test="ipType != null">
AND ${page.alias}.IP_TYPE=#{ipType,jdbcType=INTEGER}
</if>
<if test="ipPattern != null">
AND ${page.alias}.IP_PATTERN=#{ipPattern,jdbcType=INTEGER}
<if test="srcIpPattern != null">
AND ${page.alias}.SRC_IP_PATTERN=#{srcIpPattern,jdbcType=INTEGER}
</if>
<if test="destIpPattern != null">
AND ${page.alias}.DEST_IP_PATTERN=#{destIpPattern,jdbcType=INTEGER}
</if>
<if test="srcIpAddress != null and srcIpAddress != ''">
AND ${page.alias}.SRC_IP_ADDRESS=#{srcIpAddress,jdbcType=VARCHAR}
@@ -300,8 +307,11 @@
<if test="destIpAddress != null and destIpAddress != ''">
AND ${page.alias}.DEST_IP_ADDRESS=#{destIpAddress,jdbcType=VARCHAR}
</if>
<if test="portPattern != null">
AND ${page.alias}.PORT_PATTERN=#{portPattern,jdbcType=INTEGER}
<if test="srcPortPattern != null">
AND ${page.alias}.SRC_PORT_PATTERN=#{srcPortPattern,jdbcType=INTEGER}
</if>
<if test="destPortPattern != null">
AND ${page.alias}.DEST_PORT_PATTERN=#{destPortPattern,jdbcType=INTEGER}
</if>
<if test="srcPort != null and srcPort !=''">
AND ${page.alias}.SRC_PORT=#{srcPort,jdbcType=VARCHAR}
@@ -416,8 +426,11 @@
<if test="ipType != null">
AND r.IP_TYPE=#{ipType,jdbcType=INTEGER}
</if>
<if test="ipPattern != null">
AND r.IP_PATTERN=#{ipPattern,jdbcType=INTEGER}
<if test="srcIpPattern != null">
AND r.src_ip_pattern=#{srcIpPattern,jdbcType=INTEGER}
</if>
<if test="destIpPattern != null">
AND r.dest_ip_pattern=#{destIpPattern,jdbcType=INTEGER}
</if>
<if test="srcIpAddress != null and srcIpAddress != ''">
AND r.SRC_IP_ADDRESS=#{srcIpAddress,jdbcType=VARCHAR}
@@ -425,8 +438,11 @@
<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 test="srcPortPattern != null">
AND r.src_port_pattern=#{srcPortPattern,jdbcType=INTEGER}
</if>
<if test="destPortPattern != null">
AND r.dest_port_pattern=#{destPortPattern,jdbcType=INTEGER}
</if>
<if test="srcPort != null and srcPort !=''">
AND r.SRC_PORT=#{srcPort,jdbcType=VARCHAR}
@@ -596,8 +612,11 @@
<if test="ipType != null" >
IP_TYPE = #{ipType,jdbcType=INTEGER},
</if>
<if test="ipPattern != null">
IP_PATTERN=#{ipPattern,jdbcType=INTEGER},
<if test="srcIpPattern != null">
SRC_IP_PATTERN=#{srcIpPattern,jdbcType=INTEGER},
</if>
<if test="destIpPattern != null">
DEST_IP_PATTERN=#{destIpPattern,jdbcType=INTEGER},
</if>
<if test="srcIpAddress != null and srcIpAddress != ''">
SRC_IP_ADDRESS=#{srcIpAddress,jdbcType=VARCHAR},
@@ -606,7 +625,7 @@
DEST_IP_ADDRESS=#{destIpAddress,jdbcType=VARCHAR},
</if>
<if test="portPattern != null">
PORT_PATTERN=#{portPattern,jdbcType=INTEGER},
PORT_PATTERN=#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},
</if>
<if test="srcPort != null and srcPort !=''">
SRC_PORT=#{srcPort,jdbcType=VARCHAR},
@@ -744,7 +763,8 @@
<select id="getListByCfgIdWithName" resultMap="BaseIpMapWithUser">
select
r.CFG_ID as cfgId, r.CFG_DESC as cfgDesc,r.CFG_REGION_CODE as cfgRegionCode,r.CFG_TYPE as cfgType, r.IP_TYPE as ipType,
r.IP_PATTERN as ipPattern, r.SRC_IP_ADDRESS as srcIpAddress, r.DEST_IP_ADDRESS as destIpAddress, r.PORT_PATTERN as portPattern,r.SRC_PORT as srcPort,r.DEST_PORT as destPort,
r.src_ip_pattern as srcIpPattern,r.dest_ip_pattern as destIpPattern, r.SRC_IP_ADDRESS as srcIpAddress, r.DEST_IP_ADDRESS as destIpAddress,
r.src_port_pattern as srcPortPattern,r.dest_port_pattern as destPortPattern,r.SRC_PORT as srcPort,r.DEST_PORT as destPort,
r.DIRECTION as direction,r.PROTOCOL as protocol,r.PROTOCOL_ID as protocolId,r.ACTION as action,r.IS_VALID as isValid,r.IS_AUDIT as isAudit,
r.CREATOR_ID as creatorId,r.CREATE_TIME AS createTime,r.EDITOR_ID as editorId,r.EDIT_TIME AS editTime,r.AUDITOR_ID as auditorId,r.AUDIT_TIME AS auditTime,
r.SERVICE_ID as serviceId,r.REQUEST_ID AS requestId,r.COMPILE_ID AS compileId,r.IS_AREA_EFFECTIVE as isAreaEffective,r.classify,
@@ -927,9 +947,7 @@
AREA_EFFECTIVE_IDS,
function_id,
ip_type,
src_ip_address,
ip_pattern,
port_pattern,
src_ip_address,SRC_IP_PATTERN,DEST_IP_PATTERN,SRC_PORT_PATTERN,DEST_PORT_PATTERN,
src_port,
protocol,
protocol_id,
@@ -965,8 +983,10 @@
#{functionId,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{ipPattern,jdbcType=INTEGER},
#{portPattern,jdbcType=INTEGER},
#{srcIpPattern,jdbcType=INTEGER},
#{destIpPattern,jdbcType=INTEGER},
#{srcPortPattern,jdbcType=INTEGER},
#{destPortPattern,jdbcType=INTEGER},
#{srcPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{protocolId,jdbcType=INTEGER},

View File

@@ -29,7 +29,8 @@
<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="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" 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" />
@@ -124,7 +125,7 @@
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.do_log,a.do_blacklist
</sql>
<sql id="IpCfg_Column" >
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port
,a.protocol,a.protocol_id,a.direction,a.cfg_type,a.action,a.dest_port,a.dest_ip_address
,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id
,a.edit_time,a.auditor_id,a.audit_time,a.service_id,a.request_id,
@@ -384,9 +385,7 @@
AREA_EFFECTIVE_IDS,
function_id,
ip_type,
src_ip_address,
ip_pattern,
port_pattern,
src_ip_address,SRC_IP_PATTERN,DEST_IP_PATTERN,SRC_PORT_PATTERN,DEST_PORT_PATTERN,
src_port,
protocol,
protocol_id,
@@ -417,8 +416,8 @@
#{functionId,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{ipPattern,jdbcType=INTEGER},
#{portPattern,jdbcType=INTEGER},
#{srcIpPattern,jdbcType=INTEGER},#{destIpPattern,jdbcType=INTEGER},
#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},
#{srcPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{protocolId,jdbcType=INTEGER},

View File

@@ -359,6 +359,9 @@
</where>
</select>
<insert id="insert" parameterType="com.nis.domain.configuration.PxyObjKeyring" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into pxy_obj_keyring (
CFG_ID,
CFG_DESC,
@@ -434,6 +437,9 @@
)
</insert>
<insert id="insertPxyObjTrustedCaCert" parameterType="com.nis.domain.configuration.PxyObjTrustedCaCert" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into pxy_obj_trusted_ca_cert (
CFG_ID,
CFG_DESC,

View File

@@ -39,7 +39,8 @@
<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="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" 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" />
@@ -137,7 +138,7 @@
a.do_blacklist
</sql>
<sql id="IpCfg_Column" >
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port
,a.protocol,a.protocol_id,a.direction,a.cfg_type,a.action,a.dest_port,a.dest_ip_address
,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id
,a.edit_time,a.auditor_id,a.audit_time,a.service_id,a.request_id,
@@ -567,9 +568,7 @@
AREA_EFFECTIVE_IDS,
function_id,
ip_type,
src_ip_address,
ip_pattern,
port_pattern,
src_ip_address,SRC_IP_PATTERN,DEST_IP_PATTERN,SRC_PORT_PATTERN,DEST_PORT_PATTERN,
src_port,
protocol,
protocol_id,
@@ -605,8 +604,8 @@
#{functionId,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{ipPattern,jdbcType=INTEGER},
#{portPattern,jdbcType=INTEGER},
#{srcIpPattern,jdbcType=INTEGER},#{destIpPattern,jdbcType=INTEGER},
#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},
#{srcPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{protocolId,jdbcType=INTEGER},

View File

@@ -29,7 +29,8 @@
<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="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" 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" />
@@ -125,7 +126,7 @@
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,do_log
</sql>
<sql id="IpCfg_Column" >
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.src_ip_pattern,a.dest_ip_pattern,a.src_port_pattern,a.dest_port_pattern,a.src_port
,a.protocol,a.protocol_id,a.direction,a.cfg_type,a.action,a.dest_port,a.dest_ip_address
,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id
,a.edit_time,a.auditor_id,a.audit_time,a.service_id,a.request_id,
@@ -353,9 +354,7 @@
AREA_EFFECTIVE_IDS,
function_id,
ip_type,
src_ip_address,
ip_pattern,
port_pattern,
src_ip_address,SRC_IP_PATTERN,DEST_IP_PATTERN,SRC_PORT_PATTERN,DEST_PORT_PATTERN,
src_port,
protocol,
protocol_id,
@@ -386,8 +385,8 @@
#{functionId,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{ipPattern,jdbcType=INTEGER},
#{portPattern,jdbcType=INTEGER},
#{srcIpPattern,jdbcType=INTEGER},#{destIpPattern,jdbcType=INTEGER},
#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},
#{srcPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{protocolId,jdbcType=INTEGER},

View File

@@ -7,7 +7,8 @@
<id column="host_id" property="hostId" jdbcType="INTEGER" />
<result column="spec_service_id" property="specServiceId" jdbcType="INTEGER" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="ip_pattern" property="ipPattern" jdbcType="INTEGER" />
<result column="src_ip_pattern" property="srcIpPattern" jdbcType="INTEGER" />
<result column="dest_ip_pattern" property="destIpPattern" 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" />
@@ -121,9 +122,7 @@ from specific_service_host_cfg s where s.spec_service_id = #{specServiceId}
<!-- 新增 -->
<insert id="insert" parameterType="com.nis.domain.specific.SpecificServiceHostCfg">
insert into specific_service_host_cfg (spec_service_id,ip_type,
src_ip_address,
ip_pattern,
port_pattern,
src_ip_address,SRC_IP_PATTERN,DEST_IP_PATTERN,SRC_PORT_PATTERN,DEST_PORT_PATTERN,
src_port,
protocol,
direction,
@@ -132,8 +131,8 @@ from specific_service_host_cfg s where s.spec_service_id = #{specServiceId}
is_valid,is_audit,creator_id,create_time,editor_id,edit_time,auditor_id,audit_time)
values(#{specServiceId},#{ipType,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{ipPattern,jdbcType=INTEGER},
#{portPattern,jdbcType=INTEGER},
#{srcIpPattern,jdbcType=INTEGER},#{destIpPattern,jdbcType=INTEGER},
#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},
#{srcPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{direction,jdbcType=INTEGER},
@@ -146,10 +145,10 @@ from specific_service_host_cfg s where s.spec_service_id = #{specServiceId}
update specific_service_host_cfg s set
s.spec_service_id = #{specServiceId},
s.IP_TYPE = #{ipType,jdbcType=INTEGER},
s.IP_PATTERN=#{ipPattern,jdbcType=INTEGER},
s.IP_PATTERN=#{srcIpPattern,jdbcType=INTEGER},#{destIpPattern,jdbcType=INTEGER},
s.SRC_IP_ADDRESS=#{srcIpAddress,jdbcType=VARCHAR},
s.DEST_IP_ADDRESS=#{destIpAddress,jdbcType=VARCHAR},
s.PORT_PATTERN=#{portPattern,jdbcType=INTEGER},
s.PORT_PATTERN=#{srcPortPattern,jdbcType=INTEGER},#{destPortPattern,jdbcType=INTEGER},
s.SRC_PORT=#{srcPort,jdbcType=VARCHAR},
s.DEST_PORT=#{destPort,jdbcType=VARCHAR},
s.direction = #{direction,jdbcType=INTEGER},

View File

@@ -34,6 +34,7 @@ import com.nis.domain.maat.ToMaatResult;
import com.nis.domain.specific.ConfigGroupInfo;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.StringUtil;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.basics.AsnGroupInfoDao;
import com.nis.web.dao.basics.AsnIpCfgDao;
@@ -82,24 +83,31 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
public void save(List<AsnIpCfg> entitys) {
logger.warn("Start to save IP,size:"+entitys.size());
long start=System.currentTimeMillis();
SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
SqlSession batchSqlSession = null;
try{
batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
for(AsnIpCfg asnIpCfg:entitys) {
((AsnIpCfgDao) batchSqlSession.getMapper(AsnIpCfgDao.class)).insert(asnIpCfg);
}
batchSqlSession.commit();
}finally {
if(batchSqlSession != null){
batchSqlSession.close();
}
}
// SqlSessionFactory sqlSessionFactory=SpringContextHolder.getBean(SqlSessionFactory.class);
// SqlSession batchSqlSession = null;
// try{
// batchSqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
// for(AsnIpCfg asnIpCfg:entitys) {
// ((AsnIpCfgDao) batchSqlSession.getMapper(AsnIpCfgDao.class)).insert(asnIpCfg);
// }
// batchSqlSession.commit();
for(AsnIpCfg asnIpCfg:entitys) {
asnIpCfgDao.insert(asnIpCfg);
}
// }finally {
// if(batchSqlSession != null){
// batchSqlSession.close();
// }
// }
long end=System.currentTimeMillis();
logger.warn("Save IP finish,cost:"+(end-start));
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void update(AsnIpCfg entity){
int isValid=0;
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
isValid=1;
}
Date editTime=new Date();
entity.setEditTime(editTime);
entity.setEditorId(entity.getCurrentUser().getId());
@@ -115,6 +123,22 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
entity.setDetail(detail);
entity.setCompileId(groupInfo.getCompileId());
asnIpCfgDao.update(entity);
if(isValid==1) {
Map<Long,List<AsnIpCfg>> asnIpMap=Maps.newHashMap();
entity.setIsAudit(1);
entity.setIsValid(1);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
if(asnIpMap.containsKey(Long.parseLong(entity.getUserRegion1()))) {
asnIpMap.get(Long.parseLong(entity.getUserRegion1())).add(entity);
}else {
List<AsnIpCfg> _asnIps=Lists.newArrayList();
_asnIps.add(entity);
asnIpMap.put(Long.parseLong(entity.getUserRegion1()), _asnIps);
}
auditIpBatch(asnIpMap,entity.getIsAudit());
}
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void processGroup(Map<Long,AsnGroupInfo> asnNoMap){
@@ -261,6 +285,10 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void saveAsnIpCfg(CfgIndexInfo entity) {
int isValid=0;
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
isValid=1;
}
Date createTime=new Date();
//asn号
String userRegion1=entity.getUserRegion1();
@@ -308,6 +336,26 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
}
}
this.save(entity.getAsnIpCfgs());
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
Map<Long,List<AsnIpCfg>> asnIpMap=Maps.newHashMap();
for(AsnIpCfg asnIpCfg:entity.getAsnIpCfgs()) {
asnIpCfg.setIsAudit(1);
asnIpCfg.setIsValid(1);
asnIpCfg.setAuditorId(UserUtils.getUser().getId());
asnIpCfg.setAuditTime(new Date());
if(asnIpMap.containsKey(Long.parseLong(asnIpCfg.getUserRegion1()))) {
asnIpMap.get(Long.parseLong(asnIpCfg.getUserRegion1())).add(asnIpCfg);
}else {
List<AsnIpCfg> _asnIps=Lists.newArrayList();
_asnIps.add(asnIpCfg);
asnIpMap.put(Long.parseLong(asnIpCfg.getUserRegion1()), _asnIps);
}
}
auditIpBatch(asnIpMap,entity.getIsAudit());
}
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void delete(String ids) {

View File

@@ -248,7 +248,10 @@ public class AppCfgService extends BaseService {
public void saveOrUpdateAppPolicyCfg(AppPolicyCfg entity) throws Exception {
// 设置区域运营商信息
setAreaEffectiveIds(entity);
int isValid=0;
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
isValid=1;
}
if (entity.getCfgId() == null) {
Integer compileId = 0;
try {
@@ -302,7 +305,20 @@ public class AppCfgService extends BaseService {
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
if(entity.getFunctionId() == 407){
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL);
}
if(entity.getFunctionId() == 63){
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_APP);
}
if(entity.getFunctionId() == 408){
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR);
}
auditAppPolicyCfg(entity, entity.getIsAudit(),Constants.INSERT_ACTION);
}
} else {
entity.setEditorId(entity.getCurrentUser().getId());
entity.setEditTime(new Date());
@@ -356,6 +372,20 @@ public class AppCfgService extends BaseService {
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
if(entity.getFunctionId() == 407){
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL);
}
if(entity.getFunctionId() == 63){
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_APP);
}
if(entity.getFunctionId() == 408){
entity.setConfigType(Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR);
}
auditAppPolicyCfg(entity, entity.getIsAudit(),Constants.UPDATE_ACTION);
}
}
}
@@ -363,7 +393,10 @@ public class AppCfgService extends BaseService {
public void saveOrUpdateAppIpCfg(AppIpCfg entity) throws Exception {
// 设置区域运营商信息
setAreaEffectiveIds(entity);
int isValid=0;
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
isValid=1;
}
if (entity.getCfgId() == null) {
SpecificServiceCfg specificServiceCfg=specificServiceCfgDao.getBySpecServiceId(entity.getSpecServiceId());
@@ -429,10 +462,17 @@ public class AppCfgService extends BaseService {
BeanUtils.copyProperties(entity, cfg,
new String[] { "cfgRegionCode", "cfgType", "ipType", "isAreaEffective",
"areaEffectiveIds", "protocol", "portPattern", "srcPort", "destPort",
"direction", "destIpAddress", "srcIpAddress", "ipPattern" });
"direction", "destIpAddress", "srcIpAddress", "srcIpPattern", "destIpPattern" });
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
if(isValid==1) {
List<AppIpCfg> entitys=new ArrayList<AppIpCfg>();
entity.setIsAudit(1);
entity.setIsValid(1);
entitys.add(entity);
auditAppIpCfg(entitys, entity.getIsAudit());
}
} else {
entity.setEditorId(entity.getCurrentUser().getId());
entity.setEditTime(new Date());
@@ -453,10 +493,20 @@ public class AppCfgService extends BaseService {
BeanUtils.copyProperties(entity, cfg,
new String[] { "cfgRegionCode", "cfgType", "ipType", "isAreaEffective", "areaEffectiveIds",
"protocol", "portPattern", "srcPort", "destPort", "direction", "destIpAddress",
"srcIpAddress", "ipPattern" });
"srcIpAddress", "srcIpPattern", "destIpPattern" });
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
if(isValid==1) {
List<AppIpCfg> entitys=new ArrayList<AppIpCfg>();
entity.setIsAudit(1);
entity.setIsValid(1);
AppIpCfg entity2 = appCfgDao.getAppIpCfg(entity.getCfgId());
entity2.setIsAudit(1);
entity2.setIsValid(1);
entitys.add(entity2);
auditAppIpCfg(entitys, entity.getIsAudit());
}
}
}
public void saveAppHttpCfg(List<ComplexkeywordCfg> cfgs) {
@@ -538,7 +588,10 @@ public class AppCfgService extends BaseService {
public void saveOrUpdateAppDomainCfg(AppDomainCfg entity) throws Exception {
// 设置区域运营商信息
setAreaEffectiveIds(entity);
int isValid=0;
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
isValid=1;
}
if (entity.getCfgId() == null) {
Integer compileId = 0;
try {
@@ -565,6 +618,11 @@ public class AppCfgService extends BaseService {
logger.info("获取编译ID出错");
throw new MaatConvertException(e.getMessage());
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
auditAppDomainCfg(entity, entity.getIsAudit(),Constants.INSERT_ACTION);
}
} else {
entity.setEditorId(entity.getCurrentUser().getId());
entity.setEditTime(new Date());
@@ -586,6 +644,11 @@ public class AppCfgService extends BaseService {
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
auditAppDomainCfg(entity, entity.getIsAudit(),Constants.UPDATE_ACTION);
}
}
}
@@ -593,7 +656,10 @@ public class AppCfgService extends BaseService {
public void saveOrUpdateAppTopicDomainCfg(AppTopicDomainCfg entity) throws Exception {
// 设置区域运营商信息
setAreaEffectiveIds(entity);
int isValid=0;
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
isValid=1;
}
if (entity.getCfgId() == null) {
Integer compileId = 0;
try {
@@ -620,6 +686,11 @@ public class AppCfgService extends BaseService {
logger.info("获取编译ID出错");
throw new MaatConvertException(e.getMessage());
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
auditAppTopicDomainCfg(entity, entity.getIsAudit(),Constants.INSERT_ACTION);
}
} else {
entity.setEditorId(entity.getCurrentUser().getId());
entity.setEditTime(new Date());
@@ -641,6 +712,11 @@ public class AppCfgService extends BaseService {
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
auditAppTopicDomainCfg(entity, entity.getIsAudit(),Constants.UPDATE_ACTION);
}
}
}
@@ -890,7 +966,10 @@ public class AppCfgService extends BaseService {
}
}
public void auditAppPolicyCfg(AppPolicyCfg entity, Integer isAudit) {
public void auditAppPolicyCfg(AppPolicyCfg entity, Integer isAudit,Integer opAction) {
entity.setIsAudit(isAudit);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
String configType = entity.getConfigType();
ToMaatBean maatBean = new ToMaatBean();
MaatCfg maatCfg = new MaatCfg();
@@ -1036,7 +1115,7 @@ public class AppCfgService extends BaseService {
maatBean.setAuditTime(entity.getAuditTime());
maatBean.setCreatorName(entity.getCurrentUser().getName());
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.INSERT_ACTION);
maatBean.setOpAction(opAction);
// 调用服务接口下发配置数据
String json = gsonToJson(maatBean);
logger.info("app策略配置下发配置参数" + json);
@@ -1164,6 +1243,12 @@ public class AppCfgService extends BaseService {
}
}
public void auditAppIpCfg(List<AppIpCfg> entitys, Integer isAudit) {
for (AppIpCfg entity : entitys) {
entity.setTableName(AppIpCfg.getTablename());
entity.setIsAudit(isAudit);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
}
MaatCfg maatCfg = new MaatCfg();
List<MaatCfg> configCompileList = new ArrayList();
List<GroupCfg> groupRelationList = new ArrayList();
@@ -1380,7 +1465,10 @@ public class AppCfgService extends BaseService {
}
}
public void auditAppDomainCfg(AppDomainCfg entity, Integer isAudit) {
public void auditAppDomainCfg(AppDomainCfg entity, Integer isAudit,Integer opAction) {
entity.setIsAudit(isAudit);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
ToMaatBean maatBean = new ToMaatBean();
MaatCfg maatCfg = new MaatCfg();
List<MaatCfg> configCompileList = new ArrayList();
@@ -1441,7 +1529,7 @@ public class AppCfgService extends BaseService {
maatBean.setAuditTime(entity.getAuditTime());
maatBean.setCreatorName(entity.getCurrentUser().getName());
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.INSERT_ACTION);
maatBean.setOpAction(opAction);
// 调用服务接口下发配置数据
String json = gsonToJson(maatBean);
logger.info("app域名配置下发配置参数" + json);
@@ -1469,7 +1557,10 @@ public class AppCfgService extends BaseService {
}
// app主题网站配置审核
public void auditAppTopicDomainCfg(AppTopicDomainCfg entity, Integer isAudit) {
public void auditAppTopicDomainCfg(AppTopicDomainCfg entity, Integer isAudit,Integer opAction) {
entity.setIsAudit(isAudit);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
ToMaatBean maatBean = new ToMaatBean();
MaatCfg maatCfg = new MaatCfg();
List<MaatCfg> configCompileList = new ArrayList();
@@ -1536,7 +1627,7 @@ public class AppCfgService extends BaseService {
maatBean.setAuditTime(entity.getAuditTime());
maatBean.setCreatorName(entity.getCurrentUser().getName());
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.INSERT_ACTION);
maatBean.setOpAction(opAction);
// 调用服务接口下发配置数据
String json = gsonToJson(maatBean);
logger.info("app主题网站配置下发配置参数" + json);

View File

@@ -78,6 +78,10 @@ public class AppMultiFeatureCfgService extends BaseService {
//新增或保存复杂特征配置
@Transactional(readOnly = false, rollbackFor = RuntimeException.class)
public void saveOrUpdateAppFeatureCfg(AppFeatureIndex entity) throws Exception {
int isValid=0;
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
isValid=1;
}
if (entity.getCfgId() == null) {
Integer compileId = 0;
try {
@@ -166,6 +170,11 @@ public class AppMultiFeatureCfgService extends BaseService {
logger.info("获取编译ID出错");
throw new MaatConvertException(e.getMessage());
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
auditAppFeatureCfg(entity, entity.getIsAudit(),Constants.INSERT_ACTION);
}
} else {
entity.setEditorId(entity.getCurrentUser().getId());
entity.setEditTime(new Date());
@@ -243,6 +252,11 @@ public class AppMultiFeatureCfgService extends BaseService {
}
}
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
auditAppFeatureCfg(entity, entity.getIsAudit(),Constants.UPDATE_ACTION);
}
}
}
@@ -286,7 +300,11 @@ public class AppMultiFeatureCfgService extends BaseService {
cfg.setCfgKeywords(keyword);
}
public void auditAppFeatureCfg(AppFeatureIndex entity, Integer isAudit) {
public void auditAppFeatureCfg(AppFeatureIndex entity, Integer isAudit,Integer opAction) {
entity.setIsAudit(isAudit);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
ToMaatBean maatBean = new ToMaatBean();
MaatCfg maatCfg = new MaatCfg();
List<MaatCfg> configCompileList = new ArrayList();
@@ -421,7 +439,7 @@ public class AppMultiFeatureCfgService extends BaseService {
maatBean.setAuditTime(entity.getAuditTime());
maatBean.setCreatorName(entity.getCurrentUser().getName());
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.INSERT_ACTION);
maatBean.setOpAction(opAction);
// 调用服务接口下发配置数据
String json = gsonToJson(maatBean);
logger.info("app 特征配置下发配置参数:" + json);

View File

@@ -255,7 +255,6 @@ public class AvContentCfgService extends BaseService{
auditAvVoip(entity,entity.getIsAudit(), Constants.INSERT_ACTION);
}
}else{
entity.setEditTime(new Date());
entity.setEditorId(entity.getCurrentUser().getId());
@@ -534,7 +533,6 @@ public class AvContentCfgService extends BaseService{
}
}
//构造提交综合服务参数格式,一条配置提交一次综合服务
if(isAudit==1){
maatCfg.initDefaultValue();
@@ -772,9 +770,11 @@ public class AvContentCfgService extends BaseService{
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
,"cfgType"
,"ipType"
,"ipPattern"
,"srcIpPattern"
,"destIpPattern"
,"srcIpAddress"
,"portPattern"
,"srcPortPattern"
,"destPortPattern"
,"srcPort"
,"destPort"
,"protocol"
@@ -812,9 +812,11 @@ public class AvContentCfgService extends BaseService{
,"cfgType"
,"cfgId"
,"ipType"
,"ipPattern"
,"srcIpPattern"
,"destIpPattern"
,"srcIpAddress"
,"portPattern"
,"srcPortPattern"
,"destPortPattern"
,"srcPort"
,"destPort"
,"protocol"
@@ -829,9 +831,11 @@ public class AvContentCfgService extends BaseService{
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
,"cfgType"
,"ipType"
,"ipPattern"
,"srcIpPattern"
,"destIpPattern"
,"srcIpAddress"
,"portPattern"
,"srcPortPattern"
,"destPortPattern"
,"srcPort"
,"destPort"
,"protocol"
@@ -936,9 +940,11 @@ public class AvContentCfgService extends BaseService{
,"cfgType"
,"cfgId"
,"ipType"
,"ipPattern"
,"srcIpPattern"
,"destIpPattern"
,"srcIpAddress"
,"portPattern"
,"srcPortPattern"
,"destPortPattern"
,"srcPort"
,"destPort"
,"protocol"
@@ -1111,9 +1117,11 @@ public class AvContentCfgService extends BaseService{
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
,"cfgType"
,"ipType"
,"ipPattern"
,"srcIpPattern"
,"destIpPattern"
,"srcIpAddress"
,"portPattern"
,"srcPortPattern"
,"destPortPattern"
,"srcPort"
,"destPort"
,"protocol"
@@ -1151,9 +1159,11 @@ public class AvContentCfgService extends BaseService{
,"cfgType"
,"cfgId"
,"ipType"
,"ipPattern"
,"srcIpPattern"
,"destIpPattern"
,"srcIpAddress"
,"portPattern"
,"srcPortPattern"
,"destPortPattern"
,"srcPort"
,"destPort"
,"protocol"
@@ -1168,9 +1178,11 @@ public class AvContentCfgService extends BaseService{
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
,"cfgType"
,"ipType"
,"ipPattern"
,"srcIpPattern"
,"destIpPattern"
,"srcIpAddress"
,"portPattern"
,"srcPortPattern"
,"destPortPattern"
,"srcPort"
,"destPort"
,"protocol"
@@ -1275,9 +1287,11 @@ public class AvContentCfgService extends BaseService{
,"cfgType"
,"cfgId"
,"ipType"
,"ipPattern"
,"srcIpPattern"
,"destIpPattern"
,"srcIpAddress"
,"portPattern"
,"srcPortPattern"
,"destPortPattern"
,"srcPort"
,"destPort"
,"protocol"

View File

@@ -71,10 +71,14 @@ public class DdosCfgService extends BaseService{
return ddosCfgDao.getDdosIpCfg(cfgId,compileId);
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void saveOrUpdate(DdosIpCfg entity){
public void saveOrUpdate(DdosIpCfg entity) throws Exception{
Date createTime=new Date();
//设置区域运营商信息
setAreaEffectiveIds(entity);
int isValid=0;
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
isValid=1;
}
String antiddosProtocol = entity.getAntiddosProtocol();
Long bpsThreadshold = entity.getBpsThreadshold();
Long ppsThreadshold = entity.getPpsThreadshold();
@@ -116,7 +120,11 @@ public class DdosCfgService extends BaseService{
}else {
throw new RuntimeException("Could not get compileId!");
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
audit(entity.getIsAudit(), isValid, entity.getFunctionId(),String.valueOf(entity.getCfgId()), new Date(),Constants.INSERT_ACTION);
}
//修改
}else{
Date editTime=new Date();
@@ -126,6 +134,11 @@ public class DdosCfgService extends BaseService{
entity.setEditTime(editTime);
ddosCfgDao.update(entity);
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
audit(entity.getIsAudit(), isValid, entity.getFunctionId(),String.valueOf(entity.getCfgId()), new Date(),Constants.UPDATE_ACTION);
}
}
}
@@ -228,7 +241,7 @@ public class DdosCfgService extends BaseService{
}*/
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void audit(Integer isAudit,Integer isValid,Integer functionId,String id,Date auditTime) throws Exception{
public void audit(Integer isAudit,Integer isValid,Integer functionId,String id,Date auditTime,Integer opAction) throws Exception{
DdosIpCfg entity = new DdosIpCfg();
entity=ddosCfgDao.getDdosIpCfg(Long.valueOf(id),entity.getCompileId());
@@ -308,7 +321,7 @@ public class DdosCfgService extends BaseService{
maatBean.setAuditTime(auditTime);
maatBean.setCreatorName(entity.getCurrentUser().getName());
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.INSERT_ACTION);
maatBean.setOpAction(opAction);
//调用服务接口下发配置数据
String json=gsonToJson(maatBean);
logger.info("ddos 配置下发配置参数:"+json);

View File

@@ -22,6 +22,7 @@ import com.nis.domain.maat.ToMaatResult;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.StringUtil;
import com.nis.web.dao.configuration.DnsIpCfgDao;
import com.nis.web.security.UserUtils;
import com.nis.web.service.BaseService;
@@ -64,6 +65,10 @@ public class DnsIpCfgService extends BaseService{
Date createTime=new Date();
//设置区域运营商信息
setAreaEffectiveIds(entity);
int isValid=0;
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
isValid=1;
}
//新增
if(entity.getCfgId()==null){
entity.setCreatorId(UserUtils.getUser().getId());
@@ -102,6 +107,11 @@ public class DnsIpCfgService extends BaseService{
entity.setEditTime(editTime);
dnsIpCfgDao.update(entity);
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
audit( entity.getIsAudit(), isValid, entity.getFunctionId(), String.valueOf(entity.getCfgId()), new Date());
}
}
/**
@@ -140,11 +150,13 @@ public class DnsIpCfgService extends BaseService{
dnsIp.setFunctionId(401);
dnsIp.setCfgRegionCode(1);
dnsIp.setCfgType("dns_fake_ip");
dnsIp.setIpPattern(3);
dnsIp.setSrcIpPattern(3);
dnsIp.setDestIpPattern(3);
dnsIp.setSrcIpAddress("0.0.0.0");
dnsIp.setDestPort("0");
dnsIp.setSrcPort("0");
dnsIp.setPortPattern(1);
dnsIp.setSrcPortPattern(1);
dnsIp.setDestPortPattern(1);
dnsIp.setDnsStrategyId(0);
dnsIp.setAction(16);
dnsIp.setServiceId(64);

View File

@@ -19,6 +19,7 @@ import com.nis.domain.configuration.DnsResStrategy;
import com.nis.domain.maat.ToMaatResult;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.StringUtil;
import com.nis.web.dao.configuration.DnsResStrategyDao;
import com.nis.web.dao.configuration.StringCfgDao;
@@ -86,6 +87,10 @@ public class DnsResStrategyService extends BaseService{
public void saveOrUpdate(DnsResStrategy entity){
Date createTime=new Date();
setAreaEffectiveIds(entity);
int isValid=0;
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
isValid=1;
}
List<DnsResStrategy> list = new ArrayList<DnsResStrategy>();
if( entity.getCfgId()!=null && !"".equals(entity.getCfgId())){
list=dnsResStrategyDao.findList(entity.getCfgId(),null,null);
@@ -112,6 +117,11 @@ public class DnsResStrategyService extends BaseService{
}
}
dnsResStrategyDao.insert(entity);
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
audit( entity.getIsAudit(), isValid, entity.getFunctionId(), String.valueOf(entity.getCfgId()), new Date());
}
//修改
}else{
Date editTime=new Date();
@@ -121,6 +131,11 @@ public class DnsResStrategyService extends BaseService{
entity.setEditTime(editTime);
dnsResStrategyDao.update(entity);
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
audit( entity.getIsAudit(), isValid, entity.getFunctionId(), String.valueOf(entity.getCfgId()), new Date());
}
}
}
@@ -157,8 +172,8 @@ public class DnsResStrategyService extends BaseService{
cfg.setCfgId(Long.valueOf(id));
cfg.setIsValid(isValid);
cfg.setIsAudit(isAudit);
cfg.setEditTime(auditTime);
cfg.setEditorId(UserUtils.getUser().getId());
// cfg.setEditTime(auditTime);
// cfg.setEditorId(UserUtils.getUser().getId());
cfg.setAuditorId(UserUtils.getUser().getId());
cfg.setAuditTime(auditTime);
dnsResStrategyDao.update(cfg);

View File

@@ -76,7 +76,7 @@ public class DomainService extends CrudService<DomainDao,HttpUrlCfg> {
c.initDefaultValue();
BeanUtils.copyProperties(cfg, c,new String[]{"cfgId","ipType","direction",
"protocol","protocolId","areaEffectiveIds","cfgRegionCode",
"cfgType","ipPattern","srcIpAddress","portPattern","srcPort","destIpAddress","destPort"});
"cfgType","srcIpPattern","destIpPattern","srcIpAddress","srcPortPattern","destPortPattern","srcPort","destIpAddress","destPort"});
c.setTableName(AreaIpCfg.getTablename());
}
this.saveIpBatch(cfg.getAreaCfg());
@@ -106,7 +106,7 @@ public class DomainService extends CrudService<DomainDao,HttpUrlCfg> {
c.initDefaultValue();
BeanUtils.copyProperties(cfg, c,new String[]{"cfgId","ipType","direction",
"protocol","protocolId","areaEffectiveIds","cfgRegionCode",
"cfgType","ipPattern","srcIpAddress","portPattern","srcPort","destIpAddress","destPort"});
"cfgType","srcIpPattern","destIpPattern","srcIpAddress","srcPortPattern","destPortPattern","srcPort","destIpAddress","destPort"});
c.setTableName(AreaIpCfg.getTablename());
c.setCreatorId(cfg.getCurrentUser().getId());
c.setCreateTime(date);
@@ -202,9 +202,11 @@ public class DomainService extends CrudService<DomainDao,HttpUrlCfg> {
,"cfgType"
,"cfgId"
,"ipType"
,"ipPattern"
,"srcIpPattern"
,"destIpPattern"
,"srcIpAddress"
,"portPattern"
,"srcPortPattern"
,"destPortPattern"
,"srcPort"
,"destPort"
,"protocol"

View File

@@ -1,14 +1,11 @@
package com.nis.web.service.configuration;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -16,14 +13,12 @@ import org.springframework.transaction.annotation.Transactional;
import com.beust.jcommander.internal.Lists;
import com.nis.domain.Page;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.DdosIpCfg;
import com.nis.domain.configuration.IpReuseDnatPolicyCfg;
import com.nis.domain.configuration.IpReusePolicyCfg;
import com.nis.domain.maat.ToMaatResult;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.StringUtils;
import com.nis.web.dao.configuration.IpMultiplexDao;
import com.nis.web.security.UserUtils;
import com.nis.web.service.BaseService;

View File

@@ -20,6 +20,7 @@ import com.nis.domain.configuration.PxyObjTrustedCaCrl;
import com.nis.domain.maat.ToMaatResult;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.StringUtil;
import com.nis.web.dao.basics.ServiceDictInfoDao;
import com.nis.web.dao.configuration.PxyObjKeyringDao;
@@ -100,6 +101,10 @@ public class PxyObjKeyringService extends BaseService{
public void saveOrUpdate(PxyObjKeyring entity){
Date createTime=new Date();
setAreaEffectiveIds(entity);
int isValid=0;
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
isValid=1;
}
entity.setIsValid(0);
entity.setIsAudit(0);
//新增
@@ -128,11 +133,21 @@ public class PxyObjKeyringService extends BaseService{
pxyObjKeyringDao.update(entity);
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
audit( entity.getIsAudit(), isValid, entity.getFunctionId(), String.valueOf(entity.getCfgId()), new Date());
}
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void trustedCertsaveOrUpdate(PxyObjTrustedCaCert entity){
public void trustedCertsaveOrUpdate(PxyObjTrustedCaCert entity) throws InterruptedException{
Date createTime=new Date();
setAreaEffectiveIds(entity);
int isValid=0;
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
isValid=1;
}
entity.setIsValid(0);
entity.setIsAudit(0);
//新增
@@ -162,11 +177,16 @@ public class PxyObjKeyringService extends BaseService{
//修改主表cert配置时需要修改子表crl配置信息
PxyObjTrustedCaCrl crlCfg =new PxyObjTrustedCaCrl();
BeanUtils.copyProperties(entity, crlCfg, new String[]{"cfgId","serviceId","compileId","cfgType"});
entity=pxyObjKeyringDao.getPxyObjTrustedCaCert(entity.getCfgId());
crlCfg.setCertId(entity.getCompileId());
PxyObjTrustedCaCert cert=pxyObjKeyringDao.getPxyObjTrustedCaCert(entity.getCfgId());
crlCfg.setCertId(cert.getCompileId());
pxyObjKeyringDao.updatePxyObjTrustedCaCrl(crlCfg);
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
trustedCertAudit(entity.getIsAudit(), isValid, entity.getFunctionId(), String.valueOf(entity.getCfgId()), new Date());
}
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void trustedCrlsaveOrUpdate(PxyObjTrustedCaCrl entity){
@@ -320,8 +340,8 @@ public class PxyObjKeyringService extends BaseService{
cfg.setCfgId(Long.valueOf(id));
cfg.setIsValid(isValid);
cfg.setIsAudit(isAudit);
cfg.setEditTime(auditTime);
cfg.setEditorId(UserUtils.getUser().getId());
// cfg.setEditTime(auditTime);
// cfg.setEditorId(UserUtils.getUser().getId());
cfg.setAuditorId(UserUtils.getUser().getId());
cfg.setAuditTime(auditTime);
pxyObjKeyringDao.update(cfg);
@@ -402,8 +422,8 @@ public class PxyObjKeyringService extends BaseService{
cfg.setCfgId(Long.valueOf(id));
cfg.setIsValid(isValid);
cfg.setIsAudit(isAudit);
cfg.setEditTime(auditTime);
cfg.setEditorId(UserUtils.getUser().getId());
// cfg.setEditTime(auditTime);
// cfg.setEditorId(UserUtils.getUser().getId());
cfg.setAuditorId(UserUtils.getUser().getId());
cfg.setAuditTime(auditTime);
//修改主表cert 配置状态

View File

@@ -17,7 +17,6 @@ import com.nis.domain.Page;
import com.nis.domain.SysUser;
import com.nis.domain.specific.SpecificServiceCfg;
import com.nis.domain.specific.SpecificServiceHostCfg;
import com.nis.util.BasicProvingUtil;
import com.nis.util.StringUtil;
import com.nis.web.dao.specific.SpecificServiceHostCfgDao;
import com.nis.web.security.UserUtils;
@@ -58,45 +57,66 @@ public class SpecificServiceHostCfgService extends BaseService{
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void saveOrUpdate(SpecificServiceHostCfg specificServiceHostCfg) {
SysUser user = UserUtils.getUser();
String defaultIp = "0.0.0.0"; //缺省0.0.0.0值表示任意
String defaultSrcIp = "0.0.0.0"; //缺省0.0.0.0值表示任意
String defaultDestIp = "0.0.0.0"; //缺省0.0.0.0值表示任意
if(specificServiceHostCfg.getIpType().equals(4)){
if(specificServiceHostCfg.getIpPattern()==1){
defaultIp = "0.0.0.0/32"; //0.0.0.0表示任意
}else if(specificServiceHostCfg.getIpPattern()==2){
defaultIp = "0.0.0.0-0.0.0.0";
if(specificServiceHostCfg.getSrcIpPattern()==1){
defaultSrcIp = "0.0.0.0/32"; //0.0.0.0表示任意
}else if(specificServiceHostCfg.getSrcIpPattern()==2){
defaultSrcIp = "0.0.0.0-0.0.0.0";
}else{
defaultIp = "0.0.0.0";
defaultSrcIp = "0.0.0.0";
}
if(specificServiceHostCfg.getDestIpPattern()==1){
defaultDestIp = "0.0.0.0/32"; //0.0.0.0表示任意
}else if(specificServiceHostCfg.getDestIpPattern()==2){
defaultDestIp = "0.0.0.0-0.0.0.0";
}else{
defaultDestIp = "0.0.0.0";
}
}
if(specificServiceHostCfg.getIpType().equals(6)){
if(specificServiceHostCfg.getIpPattern()==1){
defaultIp = "::/64";
}else if(specificServiceHostCfg.getIpPattern()==2){
defaultIp = "::-::";
if(specificServiceHostCfg.getSrcIpPattern()==1){
defaultSrcIp = "::/64";
}else if(specificServiceHostCfg.getSrcIpPattern()==2){
defaultSrcIp = "::-::";
}else{
defaultIp = "::";
defaultSrcIp = "::";
}
if(specificServiceHostCfg.getDestIpPattern()==1){
defaultDestIp = "::/64";
}else if(specificServiceHostCfg.getDestIpPattern()==2){
defaultDestIp = "::-::";
}else{
defaultDestIp = "::";
}
}
String defaultPort = "0"; //0表示任意
if(specificServiceHostCfg.getPortPattern().equals(1)){
defaultPort = "0";
String defaultSrcPort = "0"; //0表示任意
String defaultDestPort = "0"; //0表示任意
if(specificServiceHostCfg.getSrcPortPattern().equals(1)){
defaultSrcPort = "0";
}else{
defaultPort = "0/0";
defaultSrcPort = "0/0";
}
if(specificServiceHostCfg.getDestPortPattern().equals(1)){
defaultDestPort = "0";
}else{
defaultDestPort = "0/0";
}
//ip地址默认 缺省0.0.0.0值表示任意
if(StringUtil.isBlank(specificServiceHostCfg.getSrcIpAddress())){
specificServiceHostCfg.setSrcIpAddress(defaultIp);
specificServiceHostCfg.setSrcIpAddress(defaultSrcIp);
}
if(StringUtil.isBlank(specificServiceHostCfg.getDestIpAddress())){
specificServiceHostCfg.setDestIpAddress(defaultIp);
specificServiceHostCfg.setDestIpAddress(defaultDestIp);
}
//端口掩码默认
if(StringUtil.isBlank(specificServiceHostCfg.getSrcPort())){
specificServiceHostCfg.setSrcPort(defaultPort);
specificServiceHostCfg.setSrcPort(defaultSrcPort);
}
if(StringUtil.isBlank(specificServiceHostCfg.getDestPort())){
specificServiceHostCfg.setDestPort(defaultPort);
specificServiceHostCfg.setDestPort(defaultDestPort);
}
//方向缺省
if(specificServiceHostCfg.getDirection()==null){

View File

@@ -31,20 +31,24 @@ public class MaatCfgConverTest {
ToMaatBean maat = new ToMaatBean();
BaseStringCfg str = new BaseStringCfg();
BaseIpCfg ip = new BaseIpCfg();
ip.setIpPattern(1);
ip.setSrcIpPattern(1);
ip.setDestIpPattern(1);
ip.setIpType(4);
ip.setSrcIpAddress("192.168.10.0/24");
ip.setPortPattern(2);
ip.setSrcPortPattern(2);
ip.setDestPortPattern(2);
ip.setSrcPort("8080-8089");
ip.setCompileId(123);
ip.setProtocol(6);
ip.setDirection(2);
ipList.add(ip);
ip = new BaseIpCfg();
ip.setIpPattern(2);
ip.setSrcIpPattern(2);
ip.setDestIpPattern(2);
ip.setIpType(4);
ip.setSrcIpAddress("10.0.6.0-10.0.6.100");
ip.setPortPattern(1);
ip.setSrcPortPattern(1);
ip.setDestPortPattern(1);
ip.setSrcPort("7080/65534");
ip.setCompileId(124);
ip.setDirection(1);
@@ -67,17 +71,17 @@ public class MaatCfgConverTest {
for(BaseIpCfg c:ipList){
IpCfg ipCfg = new IpCfg();
ipCfg.setRegionId(regionId);
if(c.getIpPattern()==1){
if(c.getSrcIpPattern()==1){
ipCfg.setSrcIp(c.getSrcIpAddress().split("/")[0]);
ipCfg.setSrcIpMask(IpUtil.convertMask(Integer.parseInt(c.getSrcIpAddress().split("/")[1])));
}else if(c.getIpPattern()==2){
}else if(c.getSrcIpPattern()==2){
ipCfg.setSrcIp(c.getSrcIpAddress().split("-")[0]);
ipCfg.setSrcIpMask(IpUtil.getMask(c.getSrcIpAddress().split("-")[0], c.getSrcIpAddress().split("-")[1]));
}
if(c.getPortPattern()==1){
if(c.getSrcPortPattern()==1){
ipCfg.setSrcPort(c.getSrcPort().split("/")[0]);
ipCfg.setSrcPortMask(c.getSrcPort().split("/")[1]);
}else if(c.getPortPattern()==2){
}else if(c.getSrcPortPattern()==2){
ipCfg.setSrcPort(c.getSrcPort().split("-")[0]);
Integer portMask = Integer.parseInt(c.getSrcPort().split("-")[1])-Integer.parseInt(c.getSrcPort().split("-")[0]);
ipCfg.setSrcPortMask(portMask.toString());