(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;
|
||||
|
||||
@@ -18,7 +22,9 @@ import com.nis.web.service.BaseService;
|
||||
public class PolicyGroupInfoService extends BaseService{
|
||||
|
||||
@Autowired
|
||||
private PolicyGroupInfoDao policyGroupInfoDao;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user