协议IP表结构变更,修改协议IP管理功能。
This commit is contained in:
@@ -26,26 +26,21 @@ public class SpecificServiceHostCfg extends BaseEntity<SpecificServiceHostCfg>{
|
||||
@Expose
|
||||
private Integer ipType; //ip地址类型 ipV4=4 ipV6=6
|
||||
@Expose
|
||||
private String srcIp; //src_ip 源IP地址 varchar(64) N 缺省0.0.0.0值表示任意
|
||||
@Expose
|
||||
private String srcIpMask; //src_ip_mask 源地址掩码 varchar(64) N IPV4:255.255.255.255表示无掩码,即精确IP匹配,0.0.0.0值表示任意;
|
||||
//IPV6:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF表示无掩码,::(两个半角冒号)表示任意。非0掩码值必须是2的指数幂,下同。
|
||||
@Expose
|
||||
private String srcPort; //src_port 源端口 varchar(6) N 0表示任意值
|
||||
@Expose
|
||||
private String srcPortMask; //src_port_mask 源端口掩码 varchar(6) N 65535表示无掩码,即精确端口匹配,0表示任意
|
||||
@Expose
|
||||
private String dstIp; //dst_ip 目的IP地址 varchar(64) N 缺省0.0.0.0值表示任意
|
||||
@Expose
|
||||
private String dstIpMask; //dst_ip_mask 目的地址掩码 varchar(64) N 同源ip地址掩码
|
||||
@Expose
|
||||
private String dstPort; //dst_port 目的端口 varchar(6) N 目的端口,0表示任意值
|
||||
@Expose
|
||||
private String dstPortMask; //dst_port_mask 目的端口掩码 varchar(6) N 同源端口掩码
|
||||
@Expose
|
||||
private Integer direction;; //direction 方向 int N 0双向,1单向,默认缺省为双向。
|
||||
@Expose
|
||||
private Integer protocol; //protocol 协议 int N 6表示tcp,17表示udp,0表示任意
|
||||
@Expose
|
||||
private Integer ipPattern; //ip格式
|
||||
@Expose
|
||||
private String srcIpAddress; //源(客户端)IP地址
|
||||
@Expose
|
||||
private String destIpAddress; //目的(服务器)IP地址
|
||||
@Expose
|
||||
private Integer portPattern; //端口格式
|
||||
@Expose
|
||||
private String srcPort; //源(客户端)端口
|
||||
@Expose
|
||||
private String destPort;//目的(服务器)端口
|
||||
|
||||
private Integer isValid; //is_valid 有效标识 int N 0无效,1有效
|
||||
private Integer isAudit; //is_audit 是否审核 int N 0未审核,1审核通过,2审核未通过,3取消审核通过(即删除)
|
||||
@@ -90,19 +85,13 @@ public class SpecificServiceHostCfg extends BaseEntity<SpecificServiceHostCfg>{
|
||||
this.ipType = ipType;
|
||||
}
|
||||
@ExcelField(title="client_ip",align=2,sort=30,fieldType=String.class)
|
||||
public String getSrcIp() {
|
||||
return srcIp;
|
||||
public String getSrcIpAddress() {
|
||||
return srcIpAddress;
|
||||
}
|
||||
public void setSrcIp(String srcIp) {
|
||||
this.srcIp = srcIp;
|
||||
}
|
||||
@ExcelField(title="client_address_mask",align=2,sort=40,fieldType=String.class)
|
||||
public String getSrcIpMask() {
|
||||
return srcIpMask;
|
||||
}
|
||||
public void setSrcIpMask(String srcIpMask) {
|
||||
this.srcIpMask = srcIpMask;
|
||||
public void setSrcIpAddress(String srcIpAddress) {
|
||||
this.srcIpAddress = srcIpAddress;
|
||||
}
|
||||
|
||||
@ExcelField(title="client_port",align=2,sort=50,fieldType=String.class)
|
||||
public String getSrcPort() {
|
||||
return srcPort;
|
||||
@@ -110,40 +99,34 @@ public class SpecificServiceHostCfg extends BaseEntity<SpecificServiceHostCfg>{
|
||||
public void setSrcPort(String srcPort) {
|
||||
this.srcPort = srcPort;
|
||||
}
|
||||
@ExcelField(title="client_port_mask",align=2,sort=60,fieldType=String.class)
|
||||
public String getSrcPortMask() {
|
||||
return srcPortMask;
|
||||
}
|
||||
public void setSrcPortMask(String srcPortMask) {
|
||||
this.srcPortMask = srcPortMask;
|
||||
}
|
||||
|
||||
@ExcelField(title="server_ip",align=2,sort=70,fieldType=String.class)
|
||||
public String getDstIp() {
|
||||
return dstIp;
|
||||
public String getDestIpAddress() {
|
||||
return destIpAddress;
|
||||
}
|
||||
public void setDstIp(String dstIp) {
|
||||
this.dstIp = dstIp;
|
||||
}
|
||||
@ExcelField(title="server_address_mask",align=2,sort=80,fieldType=String.class)
|
||||
public String getDstIpMask() {
|
||||
return dstIpMask;
|
||||
}
|
||||
public void setDstIpMask(String dstIpMask) {
|
||||
this.dstIpMask = dstIpMask;
|
||||
public void setDestIpAddress(String destIpAddress) {
|
||||
this.destIpAddress = destIpAddress;
|
||||
}
|
||||
@ExcelField(title="server_port",align=2,sort=90,fieldType=String.class)
|
||||
public String getDstPort() {
|
||||
return dstPort;
|
||||
public String getDestPort() {
|
||||
return destPort;
|
||||
}
|
||||
public void setDstPort(String dstPort) {
|
||||
this.dstPort = dstPort;
|
||||
public void setDestPort(String destPort) {
|
||||
this.destPort = destPort;
|
||||
}
|
||||
@ExcelField(title="server_port_mask",align=2,sort=100,fieldType=String.class)
|
||||
public String getDstPortMask() {
|
||||
return dstPortMask;
|
||||
@ExcelField(title="ip_pattern",align=2,sort=21,fieldType=Integer.class)
|
||||
public Integer getIpPattern() {
|
||||
return ipPattern;
|
||||
}
|
||||
public void setDstPortMask(String dstPortMask) {
|
||||
this.dstPortMask = dstPortMask;
|
||||
public void setIpPattern(Integer ipPattern) {
|
||||
this.ipPattern = ipPattern;
|
||||
}
|
||||
@ExcelField(title="port_pattern",align=2,sort=40,fieldType=Integer.class)
|
||||
public Integer getPortPattern() {
|
||||
return portPattern;
|
||||
}
|
||||
public void setPortPattern(Integer portPattern) {
|
||||
this.portPattern = portPattern;
|
||||
}
|
||||
@ExcelField(title="direction",align=2,sort=110)
|
||||
public Integer getDirection() {
|
||||
@@ -209,9 +192,6 @@ public class SpecificServiceHostCfg extends BaseEntity<SpecificServiceHostCfg>{
|
||||
public void setAuditTime(Date auditTime) {
|
||||
this.auditTime = auditTime;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Date getBeginDate() {
|
||||
return beginDate;
|
||||
}
|
||||
|
||||
@@ -181,14 +181,16 @@ public class SpecificServiceCfgController extends BaseController {
|
||||
|
||||
/**
|
||||
* 父节点选择树形结构
|
||||
* @param extId
|
||||
* @param extId排除节点id
|
||||
* @param isShowHide
|
||||
* @param isLeafShow:叶子节点是否显示
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "treeData")
|
||||
public List<Map<String, Object>> treeData(@RequestParam(required=false) String extId,@RequestParam(required=false) String isShowHide, HttpServletResponse response){
|
||||
public List<Map<String, Object>> treeData(@RequestParam(required=false) String extId,@RequestParam(required=false) String isShowHide,
|
||||
@RequestParam(required=false)boolean isLeafShow,HttpServletResponse response){
|
||||
List<Map<String, Object>> mapList = Lists.newArrayList();
|
||||
Map<String, Object> map2 = Maps.newHashMap();
|
||||
map2.put("id", 0);
|
||||
@@ -200,7 +202,8 @@ public class SpecificServiceCfgController extends BaseController {
|
||||
for (int i=0; i<list.size(); i++){
|
||||
SpecificServiceCfg specificServiceCfg = list.get(i);
|
||||
if(StringUtils.isBlank(extId)||(extId!=null&&!extId.equals(specificServiceCfg.getSpecServiceId().toString()))){
|
||||
if(specificServiceCfg.getIsValid().equals(0)||specificServiceCfg.getIsLeaf().equals(1)){
|
||||
if(specificServiceCfg.getIsValid().equals(0)||
|
||||
(!isLeafShow && specificServiceCfg.getIsLeaf().equals(1))){
|
||||
continue;
|
||||
}
|
||||
Map<String, Object> map = Maps.newHashMap();
|
||||
|
||||
@@ -7,16 +7,14 @@
|
||||
<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="src_ip" property="srcIp" jdbcType="VARCHAR" />
|
||||
<result column="src_ip_mask" property="srcIpMask" jdbcType="VARCHAR" />
|
||||
<result column="src_port" property="srcPort" jdbcType="VARCHAR" />
|
||||
<result column="src_port_mask" property="srcPortMask" jdbcType="VARCHAR" />
|
||||
<result column="dst_ip" property="dstIp" jdbcType="VARCHAR" />
|
||||
<result column="dst_ip_mask" property="dstIpMask" jdbcType="VARCHAR" />
|
||||
<result column="dst_port" property="dstPort" jdbcType="VARCHAR" />
|
||||
<result column="dst_port_mask" property="dstPortMask" jdbcType="VARCHAR" />
|
||||
<result column="direction" property="direction" jdbcType="INTEGER" />
|
||||
<result column="protocol" property="protocol" jdbcType="INTEGER" />
|
||||
<result column="ip_pattern" property="ipPattern" jdbcType="INTEGER" />
|
||||
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
|
||||
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
|
||||
<result column="dest_port" property="destPort" jdbcType="VARCHAR" />
|
||||
<result column="src_port" property="srcPort" jdbcType="VARCHAR" />
|
||||
<result column="port_pattern" property="portPattern" jdbcType="INTEGER" />
|
||||
<result column="direction" property="direction" jdbcType="INTEGER" />
|
||||
<result column="protocol" property="protocol" jdbcType="INTEGER" />
|
||||
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
|
||||
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
@@ -39,17 +37,8 @@
|
||||
<sql id="specificServiceHostCfgColumns">
|
||||
s.host_id AS hostId,
|
||||
s.spec_service_id AS specServiceId,
|
||||
s.ip_type AS ipType,
|
||||
s.src_ip AS srcIp,
|
||||
s.src_ip_mask AS srcIpMask,
|
||||
s.src_port AS srcPort,
|
||||
s.src_port_mask AS srcPortMask,
|
||||
s.dst_ip AS dstIp,
|
||||
s.dst_ip_mask AS dstIpMask,
|
||||
s.dst_port AS dstPort,
|
||||
s.dst_port_mask AS dstPortMask,
|
||||
s.direction AS direction,
|
||||
s.protocol AS protocol,
|
||||
s.ip_type,s.src_ip_address,s.ip_pattern,s.port_pattern,s.src_port
|
||||
,s.protocol,s.direction,s.dest_ip_address,s.dest_port,
|
||||
s.is_valid AS isValid,
|
||||
s.is_audit AS isAudit,
|
||||
s.creator_id AS "creator.id",
|
||||
@@ -81,11 +70,11 @@ select * from specific_service_host_cfg where is_valid = 1
|
||||
<if test="ipType !=null" >
|
||||
AND ip_type = #{ipType}
|
||||
</if>
|
||||
<if test="srcIp !=null and srcIp !='' " >
|
||||
AND src_ip = #{srcIp}
|
||||
<if test="srcIpAddress !=null and srcIpAddress !='' " >
|
||||
AND src_ip_address = #{srcIpAddress}
|
||||
</if>
|
||||
<if test="dstIp !=null and dstIp !='' " >
|
||||
AND dst_ip = #{dstIp}
|
||||
<if test="destIpAddress !=null and destIpAddress !='' " >
|
||||
AND dest_ip_address = #{destIpAddress}
|
||||
</if>
|
||||
<if test="protocol !=null" >
|
||||
AND protocol = #{protocol}
|
||||
@@ -131,24 +120,40 @@ 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,src_ip_mask,src_port,src_port_mask,dst_ip,dst_ip_mask,dst_port,dst_port_mask,direction,protocol,is_valid,is_audit,creator_id,create_time,editor_id,edit_time,auditor_id,audit_time)
|
||||
values(#{specServiceId},#{ipType},#{srcIp},#{srcIpMask},#{srcPort},#{srcPortMask},#{dstIp},#{dstIpMask},#{dstPort},#{dstPortMask},#{direction},#{protocol},#{isValid},#{isAudit},#{creator.id},#{createTime},#{editor.id},#{editTime},#{auditor.id},#{auditTime})
|
||||
insert into specific_service_host_cfg (spec_service_id,ip_type,
|
||||
src_ip_address,
|
||||
ip_pattern,
|
||||
port_pattern,
|
||||
src_port,
|
||||
protocol,
|
||||
direction,
|
||||
dest_port,
|
||||
dest_ip_address,
|
||||
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},
|
||||
#{srcPort,jdbcType=VARCHAR},
|
||||
#{protocol,jdbcType=INTEGER},
|
||||
#{direction,jdbcType=INTEGER},
|
||||
#{destPort,jdbcType=VARCHAR},
|
||||
#{destIpAddress,jdbcType=VARCHAR},
|
||||
#{isValid},#{isAudit},#{creator.id},#{createTime},#{editor.id},#{editTime},#{auditor.id},#{auditTime})
|
||||
</insert>
|
||||
<!-- 修改 -->
|
||||
<update id="update" parameterType="com.nis.domain.specific.SpecificServiceHostCfg">
|
||||
update specific_service_host_cfg s set
|
||||
s.spec_service_id = #{specServiceId},
|
||||
s.ip_type = #{ipType},
|
||||
s.src_ip = #{srcIp},
|
||||
s.src_ip_mask = #{srcIpMask},
|
||||
s.src_port = #{srcPort},
|
||||
s.src_port_mask = #{srcPortMask},
|
||||
s.dst_ip = #{dstIp},
|
||||
s.dst_ip_mask = #{dstIpMask},
|
||||
s.dst_port = #{dstPort},
|
||||
s.dst_port_mask = #{dstPortMask},
|
||||
s.direction = #{direction},
|
||||
s.protocol = #{protocol},
|
||||
s.IP_TYPE = #{ipType,jdbcType=INTEGER},
|
||||
s.IP_PATTERN=#{ipPattern,jdbcType=INTEGER},
|
||||
s.SRC_IP_ADDRESS=#{srcIpAddress,jdbcType=VARCHAR},
|
||||
s.DEST_IP_ADDRESS=#{destIpAddress,jdbcType=VARCHAR},
|
||||
s.PORT_PATTERN=#{portPattern,jdbcType=INTEGER},
|
||||
s.SRC_PORT=#{srcPort,jdbcType=VARCHAR},
|
||||
s.DEST_PORT=#{destPort,jdbcType=VARCHAR},
|
||||
s.direction = #{direction,jdbcType=INTEGER},
|
||||
s.protocol = #{protocol,jdbcType=INTEGER},
|
||||
s.is_valid = #{isValid},
|
||||
s.is_audit = #{isAudit},
|
||||
s.creator_id = #{creator.id},
|
||||
|
||||
@@ -83,10 +83,25 @@ public class SpecificServiceCfgService extends BaseService{
|
||||
specificServiceCfgDao.insertConfigGroupInfo(group);
|
||||
}
|
||||
if(specificServiceCfg.getSpecServiceId()==null){//新增
|
||||
if(specificServiceCfg.getIsLeaf()==null){
|
||||
if(specificServiceCfg.getParent().getSpecServiceId().equals(0)){
|
||||
specificServiceCfg.setIsLeaf(0);
|
||||
}else{
|
||||
specificServiceCfg.setIsLeaf(1);
|
||||
}
|
||||
}
|
||||
|
||||
specificServiceCfg.setIsValid(1);
|
||||
specificServiceCfg.setOpTime(new Date());
|
||||
specificServiceCfgDao.insert(specificServiceCfg);
|
||||
}else{//修改
|
||||
if(specificServiceCfg.getIsLeaf()==null){
|
||||
if(specificServiceCfg.getParent().getSpecServiceId().equals(0)){
|
||||
specificServiceCfg.setIsLeaf(0);
|
||||
}else{
|
||||
specificServiceCfg.setIsLeaf(1);
|
||||
}
|
||||
}
|
||||
specificServiceCfg.setOpTime(new Date());
|
||||
specificServiceCfgDao.update(specificServiceCfg);
|
||||
}
|
||||
|
||||
@@ -59,34 +59,44 @@ public class SpecificServiceHostCfgService extends BaseService{
|
||||
public void saveOrUpdate(SpecificServiceHostCfg specificServiceHostCfg) {
|
||||
SysUser user = UserUtils.getUser();
|
||||
String defaultIp = "0.0.0.0"; //缺省0.0.0.0值表示任意
|
||||
String defaultIpMask = "";
|
||||
if(specificServiceHostCfg.getIpType().equals(4)){
|
||||
defaultIpMask = "255.255.255.255"; //255.255.255.255表示无掩码
|
||||
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";
|
||||
}else{
|
||||
defaultIp = "0.0.0.0";
|
||||
}
|
||||
|
||||
}
|
||||
if(specificServiceHostCfg.getIpType().equals(6)){
|
||||
defaultIpMask = "FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF"; //FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF表示无掩码
|
||||
if(specificServiceHostCfg.getIpPattern()==1){
|
||||
defaultIp = "::/64";
|
||||
}else if(specificServiceHostCfg.getIpPattern()==2){
|
||||
defaultIp = "::-::";
|
||||
}else{
|
||||
defaultIp = "::";
|
||||
}
|
||||
}
|
||||
String defaultPort = "0"; //0表示任意
|
||||
if(specificServiceHostCfg.getPortPattern().equals(1)){
|
||||
defaultPort = "0";
|
||||
}else{
|
||||
defaultPort = "0/0";
|
||||
}
|
||||
String defaultPortMask = "65535"; //65535表示无掩码
|
||||
//ip地址默认 缺省0.0.0.0值表示任意
|
||||
if(StringUtil.isBlank(specificServiceHostCfg.getSrcIp())){
|
||||
specificServiceHostCfg.setSrcIp(defaultIp);
|
||||
if(StringUtil.isBlank(specificServiceHostCfg.getSrcIpAddress())){
|
||||
specificServiceHostCfg.setSrcIpAddress(defaultIp);
|
||||
}
|
||||
if(StringUtil.isBlank(specificServiceHostCfg.getDstIp())){
|
||||
specificServiceHostCfg.setDstIp(defaultIp);
|
||||
}
|
||||
//ip掩码默认
|
||||
if(StringUtil.isBlank(specificServiceHostCfg.getSrcIpMask())){
|
||||
specificServiceHostCfg.setSrcIpMask(defaultIpMask);
|
||||
}
|
||||
if(StringUtil.isBlank(specificServiceHostCfg.getDstIpMask())){
|
||||
specificServiceHostCfg.setDstIpMask(defaultIpMask);
|
||||
if(StringUtil.isBlank(specificServiceHostCfg.getDestIpAddress())){
|
||||
specificServiceHostCfg.setDestIpAddress(defaultIp);
|
||||
}
|
||||
//端口掩码默认
|
||||
if(StringUtil.isBlank(specificServiceHostCfg.getSrcPortMask())){
|
||||
specificServiceHostCfg.setSrcPortMask(defaultPortMask);
|
||||
if(StringUtil.isBlank(specificServiceHostCfg.getSrcPort())){
|
||||
specificServiceHostCfg.setSrcPort(defaultPort);
|
||||
}
|
||||
if(StringUtil.isBlank(specificServiceHostCfg.getDstPortMask())){
|
||||
specificServiceHostCfg.setDstPortMask(defaultPortMask);
|
||||
if(StringUtil.isBlank(specificServiceHostCfg.getDestPort())){
|
||||
specificServiceHostCfg.setDestPort(defaultPort);
|
||||
}
|
||||
//方向缺省
|
||||
if(specificServiceHostCfg.getDirection()==null){
|
||||
@@ -181,7 +191,7 @@ public class SpecificServiceHostCfgService extends BaseService{
|
||||
}
|
||||
|
||||
//源IP
|
||||
if(!StringUtil.isEmpty(specificServiceHostCfg.getSrcIp())&&!BasicProvingUtil.isIpOrIpMask(specificServiceHostCfg.getSrcIp(), specificServiceHostCfg.getIpType())){
|
||||
/*if(!StringUtil.isEmpty(specificServiceHostCfg.getSrcIp())&&!BasicProvingUtil.isIpOrIpMask(specificServiceHostCfg.getSrcIp(), specificServiceHostCfg.getIpType())){
|
||||
logger.info(msgProp.getProperty("the_line_of").replace("rowNum", (i+3)+"")+ msgProp.getProperty("val_src_ip"));
|
||||
// throw new RuntimeException(msgProp.getProperty("the_line_of").replace("rowNum", (i+3)+"")+ msgProp.getProperty("val_src_ip"));
|
||||
importErrorInfo=new ImportErrorInfo(i+3+"",msgProp.getProperty("client_ip"),msgProp.getProperty("the_line_of").replace("rowNum", (i+3)+"")+ msgProp.getProperty("val_src_ip"));
|
||||
@@ -293,7 +303,7 @@ public class SpecificServiceHostCfgService extends BaseService{
|
||||
//方向缺省
|
||||
if(specificServiceHostCfg.getDirection()==null){
|
||||
specificServiceHostCfg.setDirection(0);
|
||||
}
|
||||
}*/
|
||||
Date date = new Date();
|
||||
specificServiceHostCfg.setIsValid(1);
|
||||
specificServiceHostCfg.setCreator(user);
|
||||
|
||||
Reference in New Issue
Block a user