From a478bee5f3f7c17e535e810b0f37d8bdd5f2a16c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E5=86=AC=E6=A2=85?= Date: Sat, 13 Apr 2019 09:01:24 +0800 Subject: [PATCH] =?UTF-8?q?IP=E7=99=BD=E5=90=8D=E5=8D=95=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=9B=B4=E6=8E=A5=E7=94=9F=E6=95=88(?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E5=88=86=E9=85=8D=E6=9D=83=E9=99=90=EF=BC=8C?= =?UTF-8?q?=E6=AD=A4=E5=8A=9F=E8=83=BD=E6=89=8D=E5=8F=AF=E5=BC=80=E5=90=AF?= =?UTF-8?q?).=20ip=E7=99=BD=E5=90=8D=E5=8D=95=E9=85=8D=E7=BD=AE=E7=94=9F?= =?UTF-8?q?=E6=95=88=E7=8A=B6=E6=80=81=E4=B8=8B=E5=8F=AF=E4=BF=AE=E6=94=B9?= =?UTF-8?q?(=E4=BF=AE=E6=94=B9delRow=E7=9A=84=E5=88=A4=E6=96=AD=E6=89=8D?= =?UTF-8?q?=E5=8F=AF=E5=BC=80=E5=90=AF=E6=AD=A4=E5=8A=9F=E8=83=BD).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../configuration/ntc/IpController.java | 2 +- .../ntc/WhiteListController.java | 23 +++++++++++---- .../service/configuration/IpCfgService.java | 22 ++++++++++++-- .../sql/201904011/add_save_and_audit.sql | 5 ++++ src/main/resources/sql/truncate_tables.sql | 15 +++++----- .../WEB-INF/include/excel/importModal.jsp | 29 +++++++++++++++---- src/main/webapp/WEB-INF/tags/sys/delRow.tag | 1 + .../WEB-INF/views/cfg/whitelist/ipForm.jsp | 22 ++++++++++++-- 8 files changed, 94 insertions(+), 25 deletions(-) create mode 100644 src/main/resources/sql/201904011/add_save_and_audit.sql diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java b/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java index af31023be..77dd1c3f3 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/IpController.java @@ -194,7 +194,7 @@ public class IpController extends BaseController{ /*if(StringUtils.isNoneBlank(entity.getUserRegion4())) { ipCfgService.auditAsnCfg(entity, isAudit); }else {*/ - ipCfgService.auditIpCfg(entity,isAudit); + ipCfgService.auditIpCfg(entity,isAudit,Constants.INSERT_ACTION); /*}*/ addMessage(redirectAttributes,"success", "audit_success"); } catch (Exception e) { diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/WhiteListController.java b/src/main/java/com/nis/web/controller/configuration/ntc/WhiteListController.java index fa5615f78..c0c3983b8 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/WhiteListController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/WhiteListController.java @@ -97,9 +97,24 @@ public class WhiteListController extends CommonController { } @RequestMapping(value = { "ip/save" }) - public String saveIpCfg(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response, + public String saveIpCfg(RedirectAttributes model, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes, String ids, CfgIndexInfo entity) { - ipCfgService.saveIpCfg(entity); + try { + ipCfgService.saveIpCfg(entity); + //配置仅保存 + if(StringUtil.isEmpty(entity.getIsValid()) || entity.getIsValid()!=1) { + addMessage(redirectAttributes, "success", "save_success"); + }else { + //配置直接生效 + addMessage(redirectAttributes, "success", "audit_success"); + } + } catch (MaatConvertException e) { + logger.error("ip白名单配置下发失败:",e); + addMessage(redirectAttributes, "error", "request_service_failed"); + } catch (Exception e) { + logger.error("ip白名单配置保存失败:",e); + addMessage(redirectAttributes, "error", "save_failed"); + } return "redirect:" + adminPath + "/ntc/whitelist/ip/list?functionId=" + entity.getFunctionId(); } @@ -115,11 +130,9 @@ public class WhiteListController extends CommonController { entity = ipCfgService.getIpPortCfg(Long.parseLong(id), null); entity.setIsAudit(isAudit); entity.setIsValid(isValid); - entity.setAuditorId(UserUtils.getUser().getId()); - entity.setAuditTime(new Date()); entity.setFunctionId(functionId); try { - ipCfgService.auditIpCfg(entity, isAudit); + ipCfgService.auditIpCfg(entity, isAudit,Constants.INSERT_ACTION); addMessage(redirectAttributes, "success", "audit_success"); } catch (MaatConvertException e) { logger.info("ip配置下发失败:" + e.getMessage()); diff --git a/src/main/java/com/nis/web/service/configuration/IpCfgService.java b/src/main/java/com/nis/web/service/configuration/IpCfgService.java index af1ab9204..e8c95eb9a 100644 --- a/src/main/java/com/nis/web/service/configuration/IpCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/IpCfgService.java @@ -115,6 +115,10 @@ public class IpCfgService extends CrudService { //设置区域运营商信息 setAreaEffectiveIds(entity); + int isValid=0; + if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) { + isValid=1; + } entity.setIsValid(0); entity.setIsAudit(0); @@ -189,6 +193,11 @@ public class IpCfgService extends CrudService { } } + if(isValid==1) { + entity.setIsAudit(1); + entity.setIsValid(1); + auditIpCfg(entity, isValid,Constants.INSERT_ACTION); + } }else{ entity.setEditTime(new Date()); entity.setEditorId(entity.getCurrentUser().getId()); @@ -262,6 +271,12 @@ public class IpCfgService extends CrudService { } } + + if(isValid==1) { + entity.setIsAudit(1); + entity.setIsValid(1); + auditIpCfg(entity, isValid,Constants.INSERT_ACTION); + } } } public void updateIpCfgValid(Integer isValid,String ids,Integer functionId){ @@ -526,12 +541,15 @@ public class IpCfgService extends CrudService { } } } - public void auditIpCfg(CfgIndexInfo entity,Integer isAudit) throws MaatConvertException{ + public void auditIpCfg(CfgIndexInfo entity,Integer isAudit,Integer opAction) throws MaatConvertException{ Properties props=this.getMsgProp(); //修改数据库审核状态信息 entity.setTableName(CfgIndexInfo.getTablename()); entity.setIsAudit(isAudit); + entity.setAuditorId(UserUtils.getUser().getId()); + entity.setAuditTime(new Date()); ipCfgDao.auditCfg(entity); + ToMaatBean maatBean = new ToMaatBean(); MaatCfg maatCfg = new MaatCfg(); List configCompileList = new ArrayList(); @@ -665,7 +683,7 @@ public class IpCfgService extends CrudService { maatBean.setAuditTime(entity.getAuditTime()); maatBean.setCreatorName(entity.getCurrentUser().getName()); maatBean.setVersion(Constants.MAAT_VERSION); - maatBean.setOpAction(Constants.INSERT_ACTION); + maatBean.setOpAction(opAction); //限速需要发Droprate=0.001 ,暂不支持Bandwidth=200kbps if(entity.getAction().equals(Constants.RATELIMIT_ACTION)){ if(entity.getUserRegion1().equals("0")){//丢包率 diff --git a/src/main/resources/sql/201904011/add_save_and_audit.sql b/src/main/resources/sql/201904011/add_save_and_audit.sql new file mode 100644 index 000000000..50c9a3cd8 --- /dev/null +++ b/src/main/resources/sql/201904011/add_save_and_audit.sql @@ -0,0 +1,5 @@ +#审核并下发功能,只有将此菜单分配给保存并下发用户的角色,此角色下的用户新增的配置可直接下发(此版本注意角色分配) +#新增审核并下发菜单 +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 (86, '0,1,86,', 'save_and_audit', '保存并下发按钮', 5060, '', '', '', 0, 'save:audit:permission', '1', '2019-04-08 11:30:31', '1', '2019-04-08 11:47:16', '保存并下发功能权限', 1, NULL, 0, 0, NULL); +#新增审核并下发角色 +INSERT INTO `sys_role`(`NAME`, `DATA_SCOPE`, `REMARK`, `STATUS`, `CREATE_TIME`, `ROLE_TYPE`) VALUES ('saveAndAudit', 10, '', 1, '2019-04-09 11:33:40', 'user'); \ No newline at end of file diff --git a/src/main/resources/sql/truncate_tables.sql b/src/main/resources/sql/truncate_tables.sql index 5e221342f..21c1bb3a6 100644 --- a/src/main/resources/sql/truncate_tables.sql +++ b/src/main/resources/sql/truncate_tables.sql @@ -67,16 +67,13 @@ DELETE FROM ip_reuse_policy_cfg; DELETE FROM user_manage; #clear vpn DELETE FROM service_dict_info where item_type='5'; -#DNSҲҪ100ԲԷ101ʼ +#����DNS����������Ҳ��Ҫ����100�����Բ��Է��������������101��ʼ ALTER TABLE policy_group_info auto_increment = 101; -#asnŷ +#���asn�ŷ���� DELETE FROM asn_group_info; -#Ĭ϶̬IPַ +#Ĭ�϶�̬IP��ַ�� INSERT INTO `ip_reuse_addr_pool` (`cfg_id`, `addr_pool_name`, `ip_total`, `action`, `is_valid`, `is_audit`, `cfg_region_code`, `cfg_type`, `function_id`, `service_id`, `compile_id`, `is_area_effective`, `area_effective_ids`, `request_id`, `classify`, `attribute`, `lable`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `auditor_id`, `audit_time`, `description`, `cancel_request_id`, `user_region1`, `user_region2`, `user_region3`, `user_region4`, `user_region5`) VALUES ('0', 'dynamic_pool', '1', '96', '1', '1', '1', 'IR_STATIC_NOMINEE_IP', '633', '834', '0', '0', '', '0', '0', '0', '0', '0', '0000-00-00 00:00:00', NULL, '0000-00-00 00:00:00', NULL, '0000-00-00 00:00:00', '', NULL, '', '', '', '', ''); UPDATE ip_reuse_addr_pool set cfg_id=0 where addr_pool_name= 'dynamic_pool'; -DELETE FROM schedule_cfg; -DELETE FROM schedule_exce_log; -DELETE FROM schedule_exce_new; DELETE FROM sys_log; DELETE FROM sys_cfg_operation_log; DELETE FROM sys_cfg_operation_log; @@ -85,11 +82,13 @@ DELETE FROM cfg_num_statistics; DELETE FROM request_num_statistics; DELETE FROM common_keyword_cfg; DELETE FROM pxy_obj_spoofing_ip_pool; +DELETE FROM schedule_cfg; +DELETE FROM schedule_exce_log; +DELETE FROM schedule_exce_new; - -#ʱıؽsqlڸ֮ɾؽ +#��ʱ����ı��ؽ�sql�����ڸ���֮���������������������ɾ���ؽ��� # In your Quartz properties file, you'll need to set # org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.StdJDBCDelegate # diff --git a/src/main/webapp/WEB-INF/include/excel/importModal.jsp b/src/main/webapp/WEB-INF/include/excel/importModal.jsp index 7de33313a..a7f64e253 100644 --- a/src/main/webapp/WEB-INF/include/excel/importModal.jsp +++ b/src/main/webapp/WEB-INF/include/excel/importModal.jsp @@ -225,12 +225,29 @@
- - + + + + + + + + + + + + + + +

diff --git a/src/main/webapp/WEB-INF/tags/sys/delRow.tag b/src/main/webapp/WEB-INF/tags/sys/delRow.tag index 799361fa6..c211e589b 100644 --- a/src/main/webapp/WEB-INF/tags/sys/delRow.tag +++ b/src/main/webapp/WEB-INF/tags/sys/delRow.tag @@ -116,6 +116,7 @@ function update(url){ return; } */ if($(checkboxes).filter(":checked").length==1){ + //TODO 生效配置可更改功能,在最后功能实现完成后打开【打开时确认来函和专项是否影响】 if(cked.val()==1){ top.$.jBox.tip("", ""); return; diff --git a/src/main/webapp/WEB-INF/views/cfg/whitelist/ipForm.jsp b/src/main/webapp/WEB-INF/views/cfg/whitelist/ipForm.jsp index db5d7c5a3..8a75a1944 100644 --- a/src/main/webapp/WEB-INF/views/cfg/whitelist/ipForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/whitelist/ipForm.jsp @@ -169,6 +169,8 @@ + + @@ -342,9 +344,23 @@
- + + + + + + + + + + + + +