(1)策略分组修改,增加分租asn,id 为4
(2)策略分组删除时判断ASN分组是否已经下发过,如果已经下发过,则不能删除 (3)配置分组修改不能更新分组类型
This commit is contained in:
@@ -20,7 +20,14 @@ public class PolicyGroupInfo extends BaseCfg<PolicyGroupInfo> implements Seriali
|
||||
private Integer groupId;
|
||||
private String groupName;
|
||||
private Integer groupType;
|
||||
private Integer serviceGroupId;
|
||||
|
||||
public Integer getServiceGroupId() {
|
||||
return serviceGroupId;
|
||||
}
|
||||
public void setServiceGroupId(Integer serviceGroupId) {
|
||||
this.serviceGroupId = serviceGroupId;
|
||||
}
|
||||
public Integer getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
@@ -1,30 +1,24 @@
|
||||
package com.nis.web.controller.basics;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
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.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.util.ConfigDictUtils;
|
||||
import com.nis.util.Configurations;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.StringUtils;
|
||||
import com.nis.web.controller.BaseController;
|
||||
/**
|
||||
* 协议分组
|
||||
@@ -106,5 +100,12 @@ public class PolicyGroupController extends BaseController {
|
||||
}
|
||||
return "redirect:" + adminPath + "/basics/policyGroup/policyGroupList";
|
||||
}
|
||||
|
||||
@RequestMapping(value="ajaxServiceIdState",method=RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public boolean ajaxServiceIdState(Model model,@RequestParam(required=true,value="serviceGroupIds")String serviceGroupIds){
|
||||
if(StringUtils.isNotBlank(serviceGroupIds)) {
|
||||
return policyGroupInfoService.checkIsIssued(serviceGroupIds);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,10 +11,11 @@
|
||||
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
|
||||
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
|
||||
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
|
||||
<result column="service_group_id" property="serviceGroupId" jdbcType="INTEGER" />
|
||||
</resultMap>
|
||||
<sql id="PolicyGroupInfoColumns">
|
||||
r.group_id,r.group_name,r.group_type,r.is_valid,
|
||||
r.create_time,r.edit_time,r.creator_id,r.editor_id
|
||||
r.create_time,r.edit_time,r.creator_id,r.editor_id,r.service_group_id
|
||||
</sql>
|
||||
|
||||
<!-- 查出所有 有效数据-->
|
||||
@@ -78,13 +79,15 @@
|
||||
CREATOR_ID,
|
||||
CREATE_TIME,
|
||||
GROUP_NAME,
|
||||
GROUP_TYPE
|
||||
GROUP_TYPE,
|
||||
SERVICE_GROUP_ID
|
||||
)values (
|
||||
1,
|
||||
#{creatorId,jdbcType=INTEGER},
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
#{groupName,jdbcType=VARCHAR},
|
||||
#{groupType,jdbcType=INTEGER}
|
||||
#{groupType,jdbcType=INTEGER},
|
||||
#{serviceGroupId,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
<update id="update" parameterType="com.nis.domain.basics.PolicyGroupInfo" >
|
||||
@@ -112,6 +115,9 @@
|
||||
<if test="groupId != null" >
|
||||
and group_id = #{groupId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="serviceGroupId != null" >
|
||||
and service_group_id = #{serviceGroupId,jdbcType=INTEGER}
|
||||
</if>
|
||||
</where>
|
||||
</update>
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ public interface SpecificServiceCfgDao extends CrudDao<SpecificServiceCfg> {
|
||||
List<SpecificServiceCfg> getChildrenById(Integer specServiceId);
|
||||
|
||||
ConfigGroupInfo getConfigGroupInfoByGroupId(Integer groupId);
|
||||
Integer getIssuedConfigGroupInfoByGroupIds(String groupIds);
|
||||
|
||||
Integer insertConfigGroupInfo(ConfigGroupInfo entity);
|
||||
|
||||
|
||||
@@ -215,6 +215,9 @@
|
||||
select id,group_id,group_name,is_issued,insert_time,update_time,group_type
|
||||
from config_group_info c where c.group_id= #{groupId}
|
||||
</select>
|
||||
<select id="getIssuedConfigGroupInfoByGroupIds" resultType="java.lang.Integer" parameterType="java.lang.String">
|
||||
select count(1) from config_group_info c where c.group_id in(#{groupIds}) and is_issued=1
|
||||
</select>
|
||||
|
||||
<!-- 修改配置分组状态信息 -->
|
||||
<update id="updateConfigGroupInfobyGroupId" parameterType="com.nis.domain.specific.ConfigGroupInfo">
|
||||
|
||||
@@ -9,8 +9,12 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.basics.PolicyGroupInfoDao;
|
||||
import com.nis.web.dao.specific.SpecificServiceCfgDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.BaseService;
|
||||
|
||||
@@ -19,6 +23,8 @@ public class PolicyGroupInfoService extends BaseService{
|
||||
|
||||
@Autowired
|
||||
private PolicyGroupInfoDao policyGroupInfoDao;
|
||||
@Autowired
|
||||
private SpecificServiceCfgDao specificServiceCfgDao;
|
||||
|
||||
/**
|
||||
* @param page
|
||||
@@ -47,13 +53,34 @@ public class PolicyGroupInfoService extends BaseService{
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveOrUpdate(PolicyGroupInfo entity){
|
||||
public void saveOrUpdate(PolicyGroupInfo entity) throws MaatConvertException{
|
||||
entity.setIsValid(1);
|
||||
//新增
|
||||
if(entity.getGroupId()==null){
|
||||
Date createTime=new Date();
|
||||
entity.setCreatorId(UserUtils.getUser().getId());
|
||||
entity.setCreateTime(createTime);
|
||||
//asn类型从综合服务获取groupId
|
||||
if(4==entity.getGroupType().intValue()) {
|
||||
int serviceGroupId=0;
|
||||
List<Integer> groupIds= ConfigServiceUtil.getId(2,1);
|
||||
if(groupIds.size()>0) {
|
||||
serviceGroupId=groupIds.get(0).intValue();
|
||||
}else {
|
||||
throw new MaatConvertException("Get asn group id failed");
|
||||
}
|
||||
entity.setServiceGroupId(serviceGroupId);
|
||||
//新增协议分组
|
||||
ConfigGroupInfo group = specificServiceCfgDao.getConfigGroupInfoByGroupId(serviceGroupId);
|
||||
if(group==null){
|
||||
group = new ConfigGroupInfo();
|
||||
group.setGroupId(serviceGroupId);
|
||||
group.setGroupName(entity.getGroupName());
|
||||
group.setIsIssued(0);
|
||||
group.setGroupType(entity.getGroupType());
|
||||
specificServiceCfgDao.insertConfigGroupInfo(group);
|
||||
}
|
||||
}
|
||||
policyGroupInfoDao.insert(entity);
|
||||
//修改
|
||||
}else{
|
||||
@@ -79,5 +106,12 @@ public class PolicyGroupInfoService extends BaseService{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkIsIssued(String groupIds) {
|
||||
for(String groupId:groupIds.split(",")) {
|
||||
Integer.parseInt(groupId);
|
||||
}
|
||||
Integer count=specificServiceCfgDao.getIssuedConfigGroupInfoByGroupIds(groupIds);
|
||||
if(count>0) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1123,3 +1123,4 @@ certificate_validity=Certificate Validity Period
|
||||
end_entity=End-entity Certificate
|
||||
header=Header
|
||||
layer=Layer
|
||||
can_not_delete_issued_asn_group=Can not delete issued ASN group
|
||||
@@ -1120,3 +1120,4 @@ not_after_time=\u8BC1\u4E66\u7EC8\u6B62\u65F6\u95F4
|
||||
certificate_validity=\u8BC1\u4E66\u6709\u6548\u671F
|
||||
header=\u5173\u952E\u5B57
|
||||
layer=\u5339\u914D\u533A\u57DF
|
||||
can_not_delete_issued_asn_group=\u4E0D\u80FD\u5220\u9664\u5DF2\u7ECF\u4E0B\u53D1\u8FC7\u7684ASN\u5206\u7EC4
|
||||
61
src/main/resources/sql/about_asn.sql
Normal file
61
src/main/resources/sql/about_asn.sql
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
SQLyog Professional v12.08 (64 bit)
|
||||
MySQL - 10.2.14-MariaDB-log
|
||||
*********************************************************************
|
||||
*/
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
DROP TABLE IF EXISTS `asn_ip_cfg`;
|
||||
CREATE TABLE `asn_ip_cfg` (
|
||||
`cfg_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '主键,自增',
|
||||
`cfg_desc` VARCHAR(128) DEFAULT NULL,
|
||||
`ip_type` INT(11) NOT NULL COMMENT 'IPV4=4,IPV6=6',
|
||||
`direction` INT(11) NOT NULL COMMENT '0双向,1单向,默认缺省为双向。',
|
||||
`protocol` INT(11) NOT NULL COMMENT '6表示tcp,17表示udp,0表示任意',
|
||||
`protocol_id` INT(11) NOT NULL COMMENT '非0时,maat规范需写入通用IP配置表与通用协议类型配置表 此表固定写0',
|
||||
`action` INT(11) NOT NULL COMMENT '1:阻断,2:监测, 5: FD 白名单,6:监测白名单,7: FD 监测都白名单,应与业务ID所代表的逻辑相匹配,8-灰名单',
|
||||
`is_valid` INT(11) NOT NULL COMMENT '0无效,1有效,-1删除;1) 未审核时配置可删除;2) 审核通过,此字段置1;3) 取消审核通过,此字段置0',
|
||||
`is_audit` INT(11) NOT NULL COMMENT '0未审核,1审核通过,2审核未通过,3取消审核通过;1) 审核未通过,配置可修改;2) 审核通过,配置不可删除,只能取消审核通过',
|
||||
`creator_id` INT(11) NOT NULL COMMENT '取自sys_user.id',
|
||||
`create_time` DATETIME NOT NULL,
|
||||
`editor_id` INT(11) DEFAULT NULL COMMENT '取自sys_user.id',
|
||||
`edit_time` DATETIME DEFAULT NULL,
|
||||
`auditor_id` INT(11) DEFAULT NULL COMMENT '取自sys_user.id',
|
||||
`audit_time` DATETIME DEFAULT NULL,
|
||||
`service_id` INT(11) NOT NULL COMMENT '参考系统业务类型管理表',
|
||||
`request_id` INT(11) NOT NULL COMMENT '取自request_info.id',
|
||||
`compile_id` INT(11) NOT NULL COMMENT '取自服务接口返回的maat配置的编译id,配置初始入库时获取。',
|
||||
`is_area_effective` INT(11) NOT NULL COMMENT '0否,1是',
|
||||
`classify` VARCHAR(128) DEFAULT NULL COMMENT '分类id,多个用英文逗号分隔',
|
||||
`attribute` VARCHAR(128) DEFAULT NULL COMMENT '性质id,多个用英文逗号分隔',
|
||||
`lable` VARCHAR(128) DEFAULT NULL COMMENT '标签id,多个用英文逗号分隔',
|
||||
`area_effective_ids` VARCHAR(1024) DEFAULT NULL COMMENT '多个英文逗号分隔',
|
||||
`function_id` INT(11) DEFAULT NULL,
|
||||
`cfg_region_code` INT(11) DEFAULT NULL,
|
||||
`cfg_type` VARCHAR(64) DEFAULT NULL,
|
||||
`ip_pattern` INT(11) NOT NULL,
|
||||
`src_ip_address` VARCHAR(128) NOT NULL,
|
||||
`port_pattern` INT (11) NOT NULL,
|
||||
`src_port` VARCHAR (16) NOT NULL,
|
||||
`dest_ip_address` VARCHAR (128) DEFAULT NULL,
|
||||
`dest_port` VARCHAR(16) DEFAULT NULL,
|
||||
`ratelimit` VARCHAR(10) DEFAULT NULL,
|
||||
`dns_strategy_id` INT(11) DEFAULT NULL,
|
||||
`IR_TYPE` INT (11) DEFAULT NULL,
|
||||
`user_region1` VARCHAR(1024) DEFAULT '' COMMENT '预留自定义域1',
|
||||
`user_region2` VARCHAR(1024) DEFAULT '' COMMENT '预留自定义域2',
|
||||
`user_region3` VARCHAR(1024) DEFAULT '' COMMENT '预留自定义域3',
|
||||
`user_region4` VARCHAR(1024) DEFAULT '' COMMENT '预留自定义域4',
|
||||
`user_region5` VARCHAR(1024) DEFAULT '' COMMENT '预留自定义域5',
|
||||
PRIMARY KEY (`cfg_id`)
|
||||
) ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
#修改config_group_info comment, 新增asn说明
|
||||
ALTER TABLE config_group_info MODIFY group_type INT(11) NULL COMMENT '1:协议,2:内容,3:区域 ,4 asn'
|
||||
#修改policy_group_info comment, 新增asn说明,并新增一列 service_group_id用于存放从综合服务获取的组号
|
||||
ALTER TABLE policy_group_info MODIFY group_type INT(2) NULL COMMENT '1:dns 2:ip复用, 4 asn'
|
||||
ALTER TABLE policy_group_info ADD service_group_id INT(11) NULL COMMENT '从综合服务获取的组号,用于存放asn的组号.由于group_id是自增的主键,从综合服务获取的组号会与之冲突'
|
||||
#GROUP_TYPE字典更新,增加一列ASN
|
||||
SELECT * FROM sys_data_dictionary_item WHERE dictionary_id=(SELECT ID FROM sys_data_dictionary_name WHERE mark='GROUP_TYPE')
|
||||
INSERT INTO sys_data_dictionary_item (item_code,item_value,item_desc,item_sort,STATUS,TYPE,dictionary_id)
|
||||
VALUE(4,'ASN','ANS号',0,1,1,83)
|
||||
@@ -5,6 +5,14 @@
|
||||
<title><spring:message code="${cfgName}"></spring:message></title>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
if($("[name=groupId]").val()){
|
||||
$("[name=groupType] option").each(function(){
|
||||
if("${_cfg.groupType}"!=$(this).attr("value")){
|
||||
$(this).attr("disabled",true);
|
||||
}
|
||||
});
|
||||
$("[name=groupType]").selectpicker("refresh");
|
||||
}
|
||||
$(".action").on("change", function() {
|
||||
$("#serviceId").val($(this).attr("serviceId"));
|
||||
});
|
||||
|
||||
@@ -34,15 +34,38 @@
|
||||
var checkboxes=$("tbody tr td input.i-checks:checkbox");
|
||||
var ids="";
|
||||
var str="";
|
||||
var serviceGroupIds=[];
|
||||
checkboxes.each(function(){
|
||||
if(true == $(this).is(':checked')){
|
||||
if($(this).attr("groupType")==4){
|
||||
serviceGroupIds.push($(this).attr("serviceGroupId"));
|
||||
}
|
||||
str+=$(this).attr("id")+",";
|
||||
}
|
||||
});
|
||||
if(str.substr(str.length-1)== ','){
|
||||
ids = str.substr(0,str.length-1);
|
||||
}
|
||||
var canDel=true;
|
||||
if(serviceGroupIds.length>0){
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:'${ctx}/basics/policyGroup/ajaxServiceIdState',
|
||||
data:{"serviceGroupIds":serviceGroupIds.join(',')},
|
||||
async:false,
|
||||
success:function(data,textStatus){//处理返回结果
|
||||
if(data){
|
||||
canDel=false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if(canDel){
|
||||
window.location = url+"&ids="+ids;
|
||||
}else{
|
||||
$.jBox.tip('<spring:message code="can_not_delete_issued_asn_group"/>');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
@@ -188,7 +211,7 @@
|
||||
<tbody>
|
||||
<c:forEach items="${page.list }" var="cfg" varStatus="status" step="1">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="i-checks" id="${cfg.groupId}"></td>
|
||||
<td><input type="checkbox" class="i-checks" id="${cfg.groupId}" groupType="${cfg.groupType}" serviceGroupId="${cfg.serviceGroupId}"></td>
|
||||
<td>
|
||||
<a href="javascript:;" data-original-title="${cfg.groupName}"
|
||||
class="tooltips" data-flag="false" data-html="true" data-placement="top">
|
||||
|
||||
Reference in New Issue
Block a user