diff --git a/src/main/java/com/nis/domain/configuration/template/IpCommCfgTemplate.java b/src/main/java/com/nis/domain/configuration/template/IpCommCfgTemplate.java index 35296ca4e..00dc56ebc 100644 --- a/src/main/java/com/nis/domain/configuration/template/IpCommCfgTemplate.java +++ b/src/main/java/com/nis/domain/configuration/template/IpCommCfgTemplate.java @@ -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; diff --git a/src/main/java/com/nis/domain/configuration/template/UrlCommCfgTemplate.java b/src/main/java/com/nis/domain/configuration/template/UrlCommCfgTemplate.java index 820df4741..9627fea19 100644 --- a/src/main/java/com/nis/domain/configuration/template/UrlCommCfgTemplate.java +++ b/src/main/java/com/nis/domain/configuration/template/UrlCommCfgTemplate.java @@ -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; diff --git a/src/main/java/com/nis/web/controller/basics/IpCommGroupController.java b/src/main/java/com/nis/web/controller/basics/IpCommGroupController.java index ae47be7bb..4b32cad00 100644 --- a/src/main/java/com/nis/web/controller/basics/IpCommGroupController.java +++ b/src/main/java/com/nis/web/controller/basics/IpCommGroupController.java @@ -54,7 +54,7 @@ public class IpCommGroupController extends BaseController { List regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId()); List serviceList = DictUtils.getFunctionServiceDictList(entity.getFunctionId()); List 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); diff --git a/src/main/java/com/nis/web/controller/basics/UrlCommGroupController.java b/src/main/java/com/nis/web/controller/basics/UrlCommGroupController.java index 855d68f0f..cf8efd882 100644 --- a/src/main/java/com/nis/web/controller/basics/UrlCommGroupController.java +++ b/src/main/java/com/nis/web/controller/basics/UrlCommGroupController.java @@ -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); diff --git a/src/main/java/com/nis/web/dao/basics/CommonGroupManageDao.java b/src/main/java/com/nis/web/dao/basics/CommonGroupManageDao.java index a25907fec..21f2f7bb6 100644 --- a/src/main/java/com/nis/web/dao/basics/CommonGroupManageDao.java +++ b/src/main/java/com/nis/web/dao/basics/CommonGroupManageDao.java @@ -17,5 +17,7 @@ public interface CommonGroupManageDao extends CrudDao { List findCommonGroupInfosByType(int groupType); List findGroupInfoList(@Param("ids")String ids); + + void updateGroupStatus(@Param("serviceGroupId")String serviceGroupId, @Param("udFlag")Integer udFlag, @Param("groupType")Integer groupType); } \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/basics/CommonGroupManageDao.xml b/src/main/java/com/nis/web/dao/basics/CommonGroupManageDao.xml index e69880749..833e7d1dd 100644 --- a/src/main/java/com/nis/web/dao/basics/CommonGroupManageDao.xml +++ b/src/main/java/com/nis/web/dao/basics/CommonGroupManageDao.xml @@ -172,4 +172,12 @@ r.group_id IN (${ids}) + + UPDATE + policy_group_info + SET + ud_flag = #{udFlag,jdbcType=INTEGER} + WHERE + service_group_id IN (${serviceGroupId}) AND group_type = #{groupType} + \ No newline at end of file diff --git a/src/main/java/com/nis/web/dao/basics/IpCommGroupCfgDao.xml b/src/main/java/com/nis/web/dao/basics/IpCommGroupCfgDao.xml index 5a07f931e..466404d5b 100644 --- a/src/main/java/com/nis/web/dao/basics/IpCommGroupCfgDao.xml +++ b/src/main/java/com/nis/web/dao/basics/IpCommGroupCfgDao.xml @@ -489,9 +489,6 @@ CFG_REGION_CODE = #{cfgRegionCode,jdbcType=INTEGER}, - - USER_REGION1 = #{userRegion1,jdbcType=VARCHAR}, - USER_REGION2 = #{userRegion2,jdbcType=VARCHAR}, diff --git a/src/main/java/com/nis/web/dao/basics/UrlCommGroupDao.xml b/src/main/java/com/nis/web/dao/basics/UrlCommGroupDao.xml index ae33830d2..19eb509a5 100644 --- a/src/main/java/com/nis/web/dao/basics/UrlCommGroupDao.xml +++ b/src/main/java/com/nis/web/dao/basics/UrlCommGroupDao.xml @@ -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 @@ -358,9 +358,6 @@ group_id = #{groupId,jdbcType=INTEGER} - - user_region1 = #{userRegion1,jdbcType=VARCHAR}, - user_region2 = #{userRegion2,jdbcType=VARCHAR}, diff --git a/src/main/java/com/nis/web/service/basics/CommonGroupManageService.java b/src/main/java/com/nis/web/service/basics/CommonGroupManageService.java index 90c7dde1b..bd663312e 100644 --- a/src/main/java/com/nis/web/service/basics/CommonGroupManageService.java +++ b/src/main/java/com/nis/web/service/basics/CommonGroupManageService.java @@ -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 list = ipCommGroupCfgDao.getCfgInfoByGroupIds(serviceGroupId); + if(list.size() > 0) { + udFlag = 1; // 可用 + } + }else if(groupType == 7) { // URL + List list = urlCommGroupDao.getCfgInfoByGroupIds(serviceGroupId); + if(list.size() > 0) { + udFlag = 1; + } + } + commonGroupManageDao.updateGroupStatus(serviceGroupId, udFlag, groupType); + + } + } diff --git a/src/main/java/com/nis/web/service/basics/IpCommGroupCfgService.java b/src/main/java/com/nis/web/service/basics/IpCommGroupCfgService.java index 9295a6630..b430fcffc 100644 --- a/src/main/java/com/nis/web/service/basics/IpCommGroupCfgService.java +++ b/src/main/java/com/nis/web/service/basics/IpCommGroupCfgService.java @@ -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) diff --git a/src/main/java/com/nis/web/service/basics/UrlCommGroupService.java b/src/main/java/com/nis/web/service/basics/UrlCommGroupService.java index 0af3056bb..5b19b9ee8 100644 --- a/src/main/java/com/nis/web/service/basics/UrlCommGroupService.java +++ b/src/main/java/com/nis/web/service/basics/UrlCommGroupService.java @@ -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, UrlCommCfg>{ @Autowired private UrlCommGroupDao urlCommGroupDao; - + + private CommonGroupManageService groupManageService = SpringContextHolder.getBean(CommonGroupManageService.class); + public Page findPage(Page page, UrlCommCfg entity) { entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r")); entity.setPage(page); @@ -78,11 +81,9 @@ public class UrlCommGroupService extends CrudService, 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, 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 getByIds(String ids) { diff --git a/src/main/resources/sql/20190603/object_list_group.sql b/src/main/resources/sql/20190603/object_list_group.sql index d405a53ce..bcab02e3b 100644 --- a/src/main/resources/sql/20190603/object_list_group.sql +++ b/src/main/resources/sql/20190603/object_list_group.sql @@ -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') - ); \ No newline at end of file + ); + +# 修改表字段注释 +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'; diff --git a/src/main/webapp/WEB-INF/views/basics/ipCommGroupFormUpdate.jsp b/src/main/webapp/WEB-INF/views/basics/ipCommGroupFormUpdate.jsp index a8b71cda8..b45fd929f 100644 --- a/src/main/webapp/WEB-INF/views/basics/ipCommGroupFormUpdate.jsp +++ b/src/main/webapp/WEB-INF/views/basics/ipCommGroupFormUpdate.jsp @@ -56,6 +56,7 @@ + diff --git a/src/main/webapp/WEB-INF/views/basics/ipCommonGroupCfgList.jsp b/src/main/webapp/WEB-INF/views/basics/ipCommonGroupCfgList.jsp index fd160dda6..1de8a8fef 100644 --- a/src/main/webapp/WEB-INF/views/basics/ipCommonGroupCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/basics/ipCommonGroupCfgList.jsp @@ -238,8 +238,8 @@ - - + + @@ -251,7 +251,7 @@ - + ${cfg.cfgDesc } @@ -265,11 +265,7 @@ - - - - - + ${fns:abbr(cfg.srcIpAddress, 42)} ${fns:abbr(cfg.destIpAddress, 42)} diff --git a/src/main/webapp/WEB-INF/views/basics/urlCommGroupFormUpdate.jsp b/src/main/webapp/WEB-INF/views/basics/urlCommGroupFormUpdate.jsp index c6133f5be..b2fe7a731 100644 --- a/src/main/webapp/WEB-INF/views/basics/urlCommGroupFormUpdate.jsp +++ b/src/main/webapp/WEB-INF/views/basics/urlCommGroupFormUpdate.jsp @@ -83,6 +83,7 @@ + <%-- --%> diff --git a/src/main/webapp/WEB-INF/views/basics/urlCommGroupList.jsp b/src/main/webapp/WEB-INF/views/basics/urlCommGroupList.jsp index a33499073..f2b328bd9 100644 --- a/src/main/webapp/WEB-INF/views/basics/urlCommGroupList.jsp +++ b/src/main/webapp/WEB-INF/views/basics/urlCommGroupList.jsp @@ -209,7 +209,7 @@ - + ${cfg.cfgDesc }