分组配置增加以ud_flag字段标识状态
This commit is contained in:
@@ -2,7 +2,7 @@ package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class IpCommCfgTemplate extends IpAllTemplate{
|
||||
public class IpCommCfgTemplate extends IpAllNotDoLogTemplate{
|
||||
@ExcelField(title="ip_group",align=2,sort=10)
|
||||
private Integer groupId;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.nis.util.excel.ExcelField;
|
||||
* @author dell
|
||||
*
|
||||
*/
|
||||
public class UrlCommCfgTemplate extends StringAllTemplate{
|
||||
public class UrlCommCfgTemplate extends StringAllNotDoLogTemplate{
|
||||
|
||||
@ExcelField(title="url_group",align=2,sort=10)
|
||||
private Integer groupId;
|
||||
|
||||
@@ -54,7 +54,7 @@ public class IpCommGroupController extends BaseController {
|
||||
List<FunctionRegionDict> regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId());
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(entity.getFunctionId());
|
||||
List<CommonGroupInfo> policyGroupInfos=commonGroupManageService.findCommonGroupInfosByType(5);
|
||||
|
||||
|
||||
model.addAttribute("page", page);
|
||||
model.addAttribute("regionList", regionList);
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
@@ -81,6 +81,7 @@ public class IpCommGroupController extends BaseController {
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
ipCommGroupCfgService.saveIpCommGroupCfg(cfg);
|
||||
addMessage(redirectAttributes, "success", "save_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("信息保存失败", e);
|
||||
if (e instanceof MaatConvertException) {
|
||||
@@ -123,9 +124,9 @@ public class IpCommGroupController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "/delete" })
|
||||
@RequiresPermissions(value = { "ip:common:config" })
|
||||
public String delete(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
public String delete(String compileIds, String ids, Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
ipCommGroupCfgService.delete(ids);
|
||||
ipCommGroupCfgService.delete(ids, compileIds);
|
||||
addMessage(redirectAttributes, "success", "delete_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("Delete failed", e);
|
||||
|
||||
@@ -66,6 +66,7 @@ public class UrlCommGroupController extends BaseController{
|
||||
HttpServletRequest request,HttpServletResponse response){
|
||||
try{
|
||||
urlCommGroupService.saveUrlCommGroupCfg(cfg);
|
||||
addMessage(redirectAttributes,"success","save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
if(e instanceof MaatConvertException) {
|
||||
@@ -105,11 +106,9 @@ public class UrlCommGroupController extends BaseController{
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/delete"})
|
||||
public String delete(Integer isValid
|
||||
,String ids,Integer functionId
|
||||
,RedirectAttributes redirectAttributes){
|
||||
public String delete(String compileIds, String ids, Integer functionId, RedirectAttributes redirectAttributes){
|
||||
try{
|
||||
urlCommGroupService.delete(ids);
|
||||
urlCommGroupService.delete(ids,compileIds);
|
||||
addMessage(redirectAttributes,"success","delete_success");
|
||||
}catch(Exception e){
|
||||
logger.error("Delete failed",e);
|
||||
|
||||
@@ -17,5 +17,7 @@ public interface CommonGroupManageDao extends CrudDao<CommonGroupInfo> {
|
||||
List<CommonGroupInfo> findCommonGroupInfosByType(int groupType);
|
||||
|
||||
List<CommonGroupInfo> findGroupInfoList(@Param("ids")String ids);
|
||||
|
||||
void updateGroupStatus(@Param("serviceGroupId")String serviceGroupId, @Param("udFlag")Integer udFlag, @Param("groupType")Integer groupType);
|
||||
|
||||
}
|
||||
@@ -172,4 +172,12 @@
|
||||
r.group_id IN (${ids})
|
||||
</select>
|
||||
|
||||
<update id="updateGroupStatus">
|
||||
UPDATE
|
||||
policy_group_info
|
||||
SET
|
||||
ud_flag = #{udFlag,jdbcType=INTEGER}
|
||||
WHERE
|
||||
service_group_id IN (${serviceGroupId}) AND group_type = #{groupType}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -489,9 +489,6 @@
|
||||
<if test="cfgRegionCode != null " >
|
||||
CFG_REGION_CODE = #{cfgRegionCode,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="userRegion1 != null and userRegion1 != ''" >
|
||||
USER_REGION1 = #{userRegion1,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userRegion2 != null and userRegion2 != ''" >
|
||||
USER_REGION2 = #{userRegion2,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
||||
@@ -192,7 +192,7 @@
|
||||
FROM
|
||||
url_comm_cfg r
|
||||
WHERE
|
||||
r.user_region3 IN(${ids}) AND r.is_valid != -1
|
||||
r.group_id IN(${ids}) AND r.is_valid != -1
|
||||
</select>
|
||||
|
||||
<insert id="insertUrlCommGroupCfg" parameterType="com.nis.domain.basics.UrlCommCfg">
|
||||
@@ -358,9 +358,6 @@
|
||||
<if test="groupId != null">
|
||||
group_id = #{groupId,jdbcType=INTEGER}
|
||||
</if>
|
||||
<if test="userRegion1 != null and userRegion1 != ''" >
|
||||
user_region1 = #{userRegion1,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="userRegion2 != null and userRegion2 != ''" >
|
||||
user_region2 = #{userRegion2,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
||||
@@ -151,4 +151,30 @@ public class CommonGroupManageService extends BaseService{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新分组状态 policy_group_info ud_flag:0(无有效的域配置) 1(存在有效的域配置)
|
||||
* @param serviceGroupId
|
||||
* @param groupType
|
||||
*/
|
||||
public void updateGroupStatus(String serviceGroupId, Integer groupType) {
|
||||
/**
|
||||
* void updateUdFlag(String groupIds, Integer udFlag, Integer groupType);
|
||||
*/
|
||||
|
||||
Integer udFlag = 0;
|
||||
if(groupType == 5) { // IP
|
||||
List<IpCommCfg> list = ipCommGroupCfgDao.getCfgInfoByGroupIds(serviceGroupId);
|
||||
if(list.size() > 0) {
|
||||
udFlag = 1; // 可用
|
||||
}
|
||||
}else if(groupType == 7) { // URL
|
||||
List<UrlCommCfg> list = urlCommGroupDao.getCfgInfoByGroupIds(serviceGroupId);
|
||||
if(list.size() > 0) {
|
||||
udFlag = 1;
|
||||
}
|
||||
}
|
||||
commonGroupManageDao.updateGroupStatus(serviceGroupId, udFlag, groupType);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,6 +33,8 @@ public class IpCommGroupCfgService extends BaseService {
|
||||
@Autowired
|
||||
private IpCommGroupCfgDao ipCommGroupCfgDao;
|
||||
|
||||
private CommonGroupManageService groupManageService = SpringContextHolder.getBean(CommonGroupManageService.class);
|
||||
|
||||
/**
|
||||
* @param page
|
||||
* @param entity
|
||||
@@ -68,6 +70,10 @@ public class IpCommGroupCfgService extends BaseService {
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void update(IpCommCfg entity){
|
||||
ipCommGroupCfgDao.update(entity);
|
||||
// 更新分组状态
|
||||
groupManageService.updateGroupStatus(entity.getUserRegion1(), 5); // old
|
||||
groupManageService.updateGroupStatus(entity.getGroupId()+"", 5); // new
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -106,16 +112,20 @@ public class IpCommGroupCfgService extends BaseService {
|
||||
entity.getIpCommGroupCfgList().get(i).setGroupId(entity.getGroupId());
|
||||
ipCommGroupCfgDao.insertForBatch(entity.getIpCommGroupCfgList().get(i));
|
||||
}
|
||||
// 更新分组状态
|
||||
groupManageService.updateGroupStatus(entity.getGroupId()+"", 5);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void delete(String ids) {
|
||||
// TODO 公共组配置删除时 需检索是否被其它业务配置引用,没被引用可删除
|
||||
|
||||
public void delete(String ids, String compileIds) {
|
||||
if(ids==null) {
|
||||
throw new RuntimeException("ids is null!");
|
||||
}
|
||||
ipCommGroupCfgDao.delete(ids);
|
||||
// 更新分组状态
|
||||
groupManageService.updateGroupStatus(compileIds, 5);
|
||||
}
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
|
||||
@@ -17,13 +17,16 @@ import com.nis.util.Constants;
|
||||
import com.nis.web.dao.CrudDao;
|
||||
import com.nis.web.dao.basics.UrlCommGroupDao;
|
||||
import com.nis.web.service.CrudService;
|
||||
import com.nis.web.service.SpringContextHolder;
|
||||
|
||||
@Service
|
||||
public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCommCfg>{
|
||||
|
||||
@Autowired
|
||||
private UrlCommGroupDao urlCommGroupDao;
|
||||
|
||||
|
||||
private CommonGroupManageService groupManageService = SpringContextHolder.getBean(CommonGroupManageService.class);
|
||||
|
||||
public Page<UrlCommCfg> findPage(Page<UrlCommCfg> page, UrlCommCfg entity) {
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
|
||||
entity.setPage(page);
|
||||
@@ -78,11 +81,9 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCom
|
||||
|
||||
urlCommGroupDao.insertUrlCommGroupCfg(entity.getUrlCommGroupList().get(i));
|
||||
}
|
||||
// //修改公共组的标识
|
||||
// Integer udFlag=urlCommGroupDao.findUrlUdFlag(Integer.parseInt(entity.getUserRegion3()));
|
||||
// if(udFlag == 0){
|
||||
// urlCommGroupDao.updateUrlUdFlag(Integer.parseInt(entity.getUserRegion3()), 1);
|
||||
// }
|
||||
// 更新分组状态
|
||||
groupManageService.updateGroupStatus(entity.getGroupId()+"", 7);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,12 +100,18 @@ public class UrlCommGroupService extends CrudService<CrudDao<UrlCommCfg>, UrlCom
|
||||
entity.setExprType(0);
|
||||
}
|
||||
urlCommGroupDao.update(entity);
|
||||
|
||||
// 更新分组状态
|
||||
groupManageService.updateGroupStatus(entity.getUserRegion1(), 7); // old
|
||||
groupManageService.updateGroupStatus(entity.getGroupId()+"", 7); // new
|
||||
}
|
||||
|
||||
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void delete(String ids) {
|
||||
public void delete(String ids, String groupIds) {
|
||||
urlCommGroupDao.delete(ids);
|
||||
// 更新分组状态
|
||||
groupManageService.updateGroupStatus(groupIds, 7);
|
||||
}
|
||||
|
||||
public List<UrlCommCfg> getByIds(String ids) {
|
||||
|
||||
@@ -10,7 +10,7 @@ INSERT INTO `sys_menu` (`parent_id`, `parent_ids`, `code`, `name`, `sort`, `href
|
||||
INSERT INTO `sys_menu` (`parent_id`, `parent_ids`, `code`, `name`, `sort`, `href`, `target`, `icon`, `is_show`, `permission`, `create_by`, `create_date`, `update_by`, `update_date`, `remarks`, `del_flag`, `menu_bg`, `quick_action`, `is_top`, `function_id`) VALUES ('109', '0,1,109,', 'common_group_manage', '公共组管理', '5090', '/basics/commonGroup/list', '', 'fa fa-object-ungroup', '1', '', '1', '2019-05-27 16:15:23', '1', '2019-05-28 15:28:59', '', '1', NULL, '0', '0', NULL);
|
||||
|
||||
# 配置
|
||||
INSERT INTO `function_region_dict` (`function_id`, `config_district`, `config_region_code`, `config_region_value`, `config_desc`, `is_valid`, `is_maat`, `region_type`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `config_service_type`, `config_expr_type`, `config_match_method`, `config_ip_type`, `config_hex`, `config_multi_keywords`, `config_ip_pattern`, `config_port_pattern`, `config_direction`, `config_protocol`, `config_ip_port_show`, `config_region_sort`, `is_import`) VALUES ('605', '', '1', 'IP_COMMON_GROUP', 'IP公共组管理', '1', '1', '1', NULL, '2019-05-27 14:50:16', NULL, NULL, '', '', '', '4,6', '', '', '1,2,3;1,2,3', '1,2;1,2', '0,1', '0,6,17', '3,4', '1', '1');
|
||||
INSERT INTO `function_region_dict` (`function_id`, `config_district`, `config_region_code`, `config_region_value`, `config_desc`, `is_valid`, `is_maat`, `region_type`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `config_service_type`, `config_expr_type`, `config_match_method`, `config_ip_type`, `config_hex`, `config_multi_keywords`, `config_ip_pattern`, `config_port_pattern`, `config_direction`, `config_protocol`, `config_ip_port_show`, `config_region_sort`, `is_import`) VALUES ('605', '', '1', 'IP_COMMON_GROUP', 'IP公共组管理', '1', '1', '1', NULL, '2019-05-27 14:50:16', NULL, NULL, '', '', '', '4,6', '', '', '1,2,3;1,2,3', '1,2;1,2', '0,1', '0,6,17', '1,2,3,4', '1', '1');
|
||||
INSERT INTO `function_region_dict` (`function_id`, `config_district`, `config_region_code`, `config_region_value`, `config_desc`, `is_valid`, `is_maat`, `region_type`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `config_service_type`, `config_expr_type`, `config_match_method`, `config_ip_type`, `config_hex`, `config_multi_keywords`, `config_ip_pattern`, `config_port_pattern`, `config_direction`, `config_protocol`, `config_ip_port_show`, `config_region_sort`, `is_import`) VALUES ('606', '', '2', 'URL_COMMON_GROUP', 'URL公共组管理', '1', '1', '2', NULL, '2019-05-27 16:00:39', NULL, NULL, '', '0,1', '0,1,2,3', '', '0', '1', NULL, NULL, NULL, NULL, NULL, '1', '1');
|
||||
|
||||
INSERT INTO `function_service_dict` (`function_id`, `protocol_id`, `action`, `action_code`, `service_id`, `service_name`, `service_desc`, `is_valid`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `region_code`, `is_import`, `sort`, `config_do_log`) VALUES ('605', '0', '1', 'monit', '0', 'ip_common_group', NULL, '1', '1', '2019-05-27 14:47:47', NULL, NULL, '1', '1', '0', '0;2;2');
|
||||
@@ -36,4 +36,8 @@ VALUES
|
||||
'1',
|
||||
'1',
|
||||
(SELECT id FROM sys_data_dictionary_name WHERE mark = 'GROUP_TYPE')
|
||||
);
|
||||
);
|
||||
|
||||
# 修改表字段注释
|
||||
ALTER TABLE policy_group_info MODIFY COLUMN group_type INT(2) DEFAULT NULL COMMENT '1:dns 2:ip复用, 4:asn, 5:IP通用组, 7:URL通用组, 8:Domain通用组, 9:SubscribeId通用组',
|
||||
MODIFY COLUMN ud_flag INT(2) NOT NULL DEFAULT 0 COMMENT '0:不可用,1:未被引用(可用),2:已被引用(可用)|默认0';
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
<input type="hidden" id="isAreaEffective" name="isAreaEffective" value="0">
|
||||
<input type="hidden" id="requestId" name="requestId" value="${_cfg.requestId}">
|
||||
<input type="hidden" id="protocolId" name="protocolId" value="${_cfg.protocolId}">
|
||||
<input type="hidden" name="userRegion1" value="${_cfg.groupId}">
|
||||
<!-- 配置域类型 -->
|
||||
<c:forEach items="${regionList}" var="region">
|
||||
<c:if test="${_cfg.functionId eq region.functionId}">
|
||||
|
||||
@@ -238,8 +238,8 @@
|
||||
<th column="config_describe" ><spring:message code="config_describe"/></th>
|
||||
<th class="sort-column r.group_id" column="groupId" ><spring:message code="group_name"/></th>
|
||||
<th column="ip_type" ><spring:message code="ip_type"/></th>
|
||||
<th column="ip_pattern" ><spring:message code="ip_pattern"/></th>
|
||||
<th column="IP" ><spring:message code="IP"/></th>
|
||||
<th column="client_ip" ><spring:message code="client_ip"/></th>
|
||||
<th column="server_ip" ><spring:message code="server_ip"/></th>
|
||||
<th column="protocol" ><spring:message code="protocol"/></th>
|
||||
<th column="direction" ><spring:message code="direction"/></th>
|
||||
<th column="creator" ><spring:message code="creator"/></th>
|
||||
@@ -251,7 +251,7 @@
|
||||
<tbody>
|
||||
<c:forEach items="${page.list }" var="cfg" varStatus="status" step="1">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="i-checks" id="${cfg.cfgId}" isValid="${cfg.isValid}" value="${cfg.isAudit}"></td>
|
||||
<td><input type="checkbox" class="i-checks" id="${cfg.cfgId}" isValid="${cfg.isValid}" value="${cfg.isAudit}" compileId="${cfg.groupId}"></td>
|
||||
<td>${cfg.cfgDesc }</td>
|
||||
<td>
|
||||
<c:forEach items="${policyGroupInfos}" var="policyGroup">
|
||||
@@ -265,11 +265,7 @@
|
||||
<c:if test="${cfg.ipType==ipTypeC.itemCode}"><spring:message code="${ipTypeC.itemValue }"/></c:if>
|
||||
</c:forEach>
|
||||
</td>
|
||||
<td>
|
||||
<c:forEach items="${fns:getDictList('IP_PATTERN')}" var="ipPatternC">
|
||||
<c:if test="${cfg.destIpPattern==ipPatternC.itemCode}"><spring:message code="${ipPatternC.itemValue }"/></c:if>
|
||||
</c:forEach>
|
||||
</td>
|
||||
<td title="${cfg.srcIpAddress }">${fns:abbr(cfg.srcIpAddress, 42)}</td>
|
||||
<td title="${cfg.destIpAddress }">${fns:abbr(cfg.destIpAddress, 42)}</td>
|
||||
<td>
|
||||
<c:forEach items="${fns:getDictList('PROTOCOL')}" var="protocolC">
|
||||
|
||||
@@ -83,6 +83,7 @@
|
||||
<input type="hidden" id="serviceId" name="serviceId" value="${_cfg.serviceId}">
|
||||
<input type="hidden" id="isAreaEffective" name="isAreaEffective" value="0">
|
||||
<input type="hidden" id="requestId" name="requestId" value="${_cfg.requestId}">
|
||||
<input type="hidden" name="userRegion1" value="${_cfg.groupId}">
|
||||
<%-- <input type="hidden" id="protocolId" name="protocolId" value="${_cfg.protocolId}">
|
||||
<input type="hidden" id="asnIpGroup" name="asnIpGroup" value="${_cfg.asnIpGroup}"> --%>
|
||||
<!-- 配置域类型 -->
|
||||
|
||||
@@ -209,7 +209,7 @@
|
||||
<tbody>
|
||||
<c:forEach items="${page.list }" var="cfg" varStatus="status" step="1">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="i-checks" id="${cfg.cfgId}" isValid="${cfg.isValid}" value="${cfg.isAudit}"></td>
|
||||
<td><input type="checkbox" class="i-checks" id="${cfg.cfgId}" isValid="${cfg.isValid}" value="${cfg.isAudit}" compileId="${cfg.groupId}"></td>
|
||||
<td>${cfg.cfgDesc }</td>
|
||||
<td>
|
||||
<c:forEach items="${policyGroupInfos}" var="info">
|
||||
|
||||
Reference in New Issue
Block a user