diff --git a/src/main/java/com/nis/web/controller/BaseController.java b/src/main/java/com/nis/web/controller/BaseController.java index 59331ae96..6d4f887cd 100644 --- a/src/main/java/com/nis/web/controller/BaseController.java +++ b/src/main/java/com/nis/web/controller/BaseController.java @@ -3136,7 +3136,7 @@ public class BaseController { }else{ //400 ASN IP if(auditBatchCfg.getServiceId().equals(400)) { - if(auditBatchCfg.getIsValid() == 1) { + if(auditBatchCfg.getIsAudit() == 1) { boolean hasData = true; //批量生效[按每组每批次下发一次] AsnGroupInfo groupInfo=new AsnGroupInfo(); @@ -3178,28 +3178,39 @@ public class BaseController { List list=asnIpCfgService.findPage(page, searchAsnIpCfg).getList(); if(!StringUtil.isEmpty(list)){ - Map asnIpMap=new HashMap(); - if(!StringUtil.isEmpty(list)) { - for (AsnIpCfg obj : list) { - BaseCfg baseCfg=(BaseCfg)obj; - if(!StringUtil.isEmpty(asnIpMap.get(obj.getAsnIpGroup()))) { - asnIpMap.get(obj.getAsnIpGroup()).add(baseCfg); - asnIpMap.put(obj.getAsnIpGroup(), asnIpMap.get(obj.getAsnIpGroup())); - }else { - List newList=new ArrayList<>(); - newList.add(baseCfg); - asnIpMap.put(obj.getAsnIpGroup(),newList); + if(auditBatchCfg.getIsAudit() == 2) { + List BaseCfgList=new ArrayList<>(); + for (AsnIpCfg cfg : list) { + BaseCfg baseCfg=new BaseCfg(); + BeanUtils.copyProperties(cfg, baseCfg); + BaseCfgList.add(baseCfg); + } + hasData = commonPolicyService.batchUnApproveMaatData(cfgList, page, auditBatchCfg, BaseCfgList, hasData); + }else { + Map asnIpMap=new HashMap(); + if(!StringUtil.isEmpty(list)) { + for (AsnIpCfg obj : list) { + BaseCfg baseCfg=(BaseCfg)obj; + if(!StringUtil.isEmpty(asnIpMap.get(obj.getAsnIpGroup()))) { + asnIpMap.get(obj.getAsnIpGroup()).add(baseCfg); + asnIpMap.put(obj.getAsnIpGroup(), asnIpMap.get(obj.getAsnIpGroup())); + }else { + List newList=new ArrayList<>(); + newList.add(baseCfg); + asnIpMap.put(obj.getAsnIpGroup(),newList); + } } } + hasData=commonPolicyService.auditReuseConfigData(page, auditBatchCfg,asnIpMap,hasData); } - hasData=commonPolicyService.auditReuseConfigData(page, auditBatchCfg,asnIpMap,hasData); + }else{ hasData = false; } } } }else if(auditBatchCfg.getServiceId().equals(1028)) { - if(auditBatchCfg.getIsValid() == 1) { + if(auditBatchCfg.getIsAudit() == 1) { boolean hasData = true; //批量生效[按每组每批次下发一次] ConfigGroupInfo groupInfo=new ConfigGroupInfo(); @@ -3249,21 +3260,32 @@ public class BaseController { List list=appCfgService.findAppIpList(page, searchAppIpCfg).getList(); if(!StringUtil.isEmpty(list)){ - Map appIpMap=new HashMap(); - if(!StringUtil.isEmpty(list)) { - for (AppIpCfg obj : list) { - BaseCfg baseCfg=(BaseCfg)obj; - if(!StringUtil.isEmpty(appIpMap.get((groupMap.get(obj.getCompileId()))))) { - appIpMap.get(groupMap.get(obj.getCompileId())).add(baseCfg); - appIpMap.put(groupMap.get(obj.getCompileId()), appIpMap.get(groupMap.get(obj.getCompileId()))); - }else { - List newList=new ArrayList<>(); - newList.add(baseCfg); - appIpMap.put(groupMap.get(obj.getCompileId()),newList); + if(auditBatchCfg.getIsAudit() == 2) { // 配置批量审核不通过 + List BaseCfgList=new ArrayList<>(); + for (AppIpCfg cfg : list) { + BaseCfg baseCfg=new BaseCfg(); + BeanUtils.copyProperties(cfg, baseCfg); + BaseCfgList.add(baseCfg); + } + hasData = commonPolicyService.batchUnApproveMaatData(cfgList, page, auditBatchCfg, BaseCfgList, hasData); + + }else { + Map appIpMap=new HashMap(); + if(!StringUtil.isEmpty(list)) { + for (AppIpCfg obj : list) { + BaseCfg baseCfg=(BaseCfg)obj; + if(!StringUtil.isEmpty(appIpMap.get((groupMap.get(obj.getCompileId()))))) { + appIpMap.get(groupMap.get(obj.getCompileId())).add(baseCfg); + appIpMap.put(groupMap.get(obj.getCompileId()), appIpMap.get(groupMap.get(obj.getCompileId()))); + }else { + List newList=new ArrayList<>(); + newList.add(baseCfg); + appIpMap.put(groupMap.get(obj.getCompileId()),newList); + } } } + hasData=commonPolicyService.auditReuseConfigData(page, auditBatchCfg,appIpMap,hasData); } - hasData=commonPolicyService.auditReuseConfigData(page, auditBatchCfg,appIpMap,hasData); }else{ hasData = false; } @@ -3296,7 +3318,7 @@ public class BaseController { list=appCfgService.findAppHttpList(page, searchAppHttpCfg).getList(); } if(!StringUtil.isEmpty(list)){ - if(auditBatchCfg.getIsValid().equals(1)) { + if(auditBatchCfg.getIsAudit().equals(1)) { hasData=configSynchronizationService.auditSingleMaatData(cfgType,userRegionList, page,auditBatchCfg,list,hasData,true); }else { @@ -3307,7 +3329,11 @@ public class BaseController { newList.add(cfg); } } - hasData=commonPolicyService.auditNtcMaatData(cfgList, page, auditBatchCfg,newList, hasData); + if(auditBatchCfg.getIsAudit().equals(2)) { // 配置批量审核不通过 + hasData = commonPolicyService.batchUnApproveMaatData(cfgList, page, auditBatchCfg, newList, hasData); + }else { + hasData=commonPolicyService.auditNtcMaatData(cfgList, page, auditBatchCfg,newList, hasData); + } } }else{ hasData = false; @@ -3372,6 +3398,19 @@ public class BaseController { AvFileSampleCfg searchFileSampleCfg=new AvFileSampleCfg(); DdosIpCfg searchDdosIpCfg=new DdosIpCfg(); + AppIpCfg searchAppIpCfg=new AppIpCfg(); + AppHttpCfg searchAppHttpCfg=new AppHttpCfg(); + AppDomainCfg searchAppDomainCfg=new AppDomainCfg(); + AppTopicDomainCfg searchAppTopicCfg=new AppTopicDomainCfg(); + AppSslCertCfg searchAppSslCertCfg=new AppSslCertCfg(); + AppFeatureIndex searchAppFeatureIndex=new AppFeatureIndex(); + + DnsResStrategy searchDnsResStrategy=new DnsResStrategy(); + DnsIpCfg searchDnsIpCfg=new DnsIpCfg(); + PxyObjKeyring searchObjKeyringCfg=new PxyObjKeyring(); + PxyObjTrustedCaCert searchTrustedCaCertCfg=new PxyObjTrustedCaCert(); + AsnIpCfg searchAsnIpCfg=new AsnIpCfg(); + // 传递检索条件 if(entity != null && (entity instanceof CfgIndexInfo)) { BeanUtils.copyProperties(entity, searchCfg); @@ -3403,6 +3442,78 @@ public class BaseController { searchDdosIpCfg.setIsAudit(0); searchDdosIpCfg.setFunctionId(functionId); } + if(entity != null && (entity instanceof AppHttpCfg)) { + BeanUtils.copyProperties(entity, searchAppHttpCfg); + searchAppHttpCfg.setIsValid(0); + searchAppHttpCfg.setIsAudit(0); + searchAppHttpCfg.setFunctionId(functionId); + } + if(entity != null && (entity instanceof AppHttpCfg)) { + BeanUtils.copyProperties(entity, searchAppHttpCfg); + searchAppHttpCfg.setIsValid(0); + searchAppHttpCfg.setIsAudit(0); + searchAppHttpCfg.setFunctionId(functionId); + } + if(entity != null && (entity instanceof AppDomainCfg)) { + BeanUtils.copyProperties(entity, searchAppDomainCfg); + searchAppDomainCfg.setIsValid(0); + searchAppDomainCfg.setIsAudit(0); + searchAppDomainCfg.setFunctionId(functionId); + } + if(entity != null && (entity instanceof AppTopicDomainCfg)) { + BeanUtils.copyProperties(entity, searchAppTopicCfg); + searchAppTopicCfg.setIsValid(0); + searchAppTopicCfg.setIsAudit(0); + searchAppTopicCfg.setFunctionId(functionId); + } + if(entity != null && (entity instanceof AppSslCertCfg)) { + BeanUtils.copyProperties(entity, searchAppSslCertCfg); + searchAppSslCertCfg.setIsValid(0); + searchAppSslCertCfg.setIsAudit(0); + searchAppSslCertCfg.setFunctionId(functionId); + } + if(entity != null && (entity instanceof AppIpCfg)) { + BeanUtils.copyProperties(entity, searchAppIpCfg); + searchAppIpCfg.setIsValid(0); + searchAppIpCfg.setIsAudit(0); + searchAppIpCfg.setFunctionId(functionId); + } + if(entity != null && (entity instanceof AppFeatureIndex)) { + BeanUtils.copyProperties(entity, searchAppFeatureIndex); + searchAppFeatureIndex.setIsValid(0); + searchAppFeatureIndex.setIsAudit(0); + searchAppFeatureIndex.setFunctionId(functionId); + } + if(entity != null && (entity instanceof DnsResStrategy)) { + BeanUtils.copyProperties(entity, searchDnsResStrategy); + searchDnsResStrategy.setIsValid(0); + searchDnsResStrategy.setIsAudit(0); + searchDnsResStrategy.setFunctionId(functionId); + } + if(entity != null && (entity instanceof DnsIpCfg)) { + BeanUtils.copyProperties(entity, searchDnsIpCfg); + searchDnsIpCfg.setIsValid(0); + searchDnsIpCfg.setIsAudit(0); + searchDnsIpCfg.setFunctionId(functionId); + } + if(entity != null && (entity instanceof PxyObjKeyring)) { + BeanUtils.copyProperties(entity, searchObjKeyringCfg); + searchObjKeyringCfg.setIsValid(0); + searchObjKeyringCfg.setIsAudit(0); + searchObjKeyringCfg.setFunctionId(functionId); + } + if(entity != null && (entity instanceof PxyObjTrustedCaCert)) { + BeanUtils.copyProperties(entity, searchTrustedCaCertCfg); + searchTrustedCaCertCfg.setIsValid(0); + searchTrustedCaCertCfg.setIsAudit(0); + searchTrustedCaCertCfg.setFunctionId(functionId); + } + if(entity != null && (entity instanceof AsnIpCfg)) { + BeanUtils.copyProperties(entity, searchAsnIpCfg); + searchAsnIpCfg.setIsValid(0); + searchAsnIpCfg.setIsAudit(0); + searchAsnIpCfg.setFunctionId(functionId); + } BaseCfg batchCfg = new BaseCfg(); batchCfg.setEditTime(new Date()); @@ -3427,7 +3538,8 @@ public class BaseController { // 存放域配置类型 及 对应表名 List> cfgList = (List>) service.get("cfgList"); - //if(!StringUtil.isEmpty(cfgList)) { + if(!StringUtil.isEmpty(cfgList)) { + /** -- 多域maat -- **/ if("cfg_index_info".equals(tableNameXml)){ boolean hasData = true; while(hasData){ @@ -3435,13 +3547,13 @@ public class BaseController { page.setLastPage(false); List list = getDataList(page,searchCfg,null,null,null); // 通过serviceId获取主配置表数据 if(!StringUtil.isEmpty(list)){ - List BaseCfgList=new ArrayList<>(); + List baseCfgList=new ArrayList<>(); for (CfgIndexInfo cfg : list) { BaseCfg baseCfg=new BaseCfg(); BeanUtils.copyProperties(cfg, baseCfg); - BaseCfgList.add(baseCfg); + baseCfgList.add(baseCfg); } - hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, BaseCfgList, hasData); + hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, baseCfgList, hasData); }else{ hasData = false; } @@ -3453,13 +3565,13 @@ public class BaseController { page.setLastPage(false); List list = getDataList(page,null,null,searchDigestCfg,null); // 通过serviceId获取主配置表数据 if(!StringUtil.isEmpty(list)){ - List BaseCfgList=new ArrayList<>(); + List baseCfgList=new ArrayList<>(); for (FileDigestCfg cfg : list) { BaseCfg baseCfg=new BaseCfg(); BeanUtils.copyProperties(cfg, baseCfg); - BaseCfgList.add(baseCfg); + baseCfgList.add(baseCfg); } - hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, BaseCfgList, hasData); + hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, baseCfgList, hasData); }else{ hasData = false; } @@ -3471,17 +3583,60 @@ public class BaseController { page.setLastPage(false); List list = getDataList(page,null,searchAppCfg,null,null); // 通过serviceId获取主配置表数据 if(!StringUtil.isEmpty(list)){ - List BaseCfgList=new ArrayList<>(); + List baseCfgList=new ArrayList<>(); for (AppPolicyCfg cfg : list) { BaseCfg baseCfg=new BaseCfg(); BeanUtils.copyProperties(cfg, baseCfg); - BaseCfgList.add(baseCfg); + baseCfgList.add(baseCfg); } - hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, BaseCfgList, hasData); + hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, baseCfgList, hasData); }else{ hasData = false; } } + }else if("app_feature_index".equals(tableNameXml)) { + boolean hasData = true; + while(hasData){ + page.setPageNo(1); + page.setLastPage(false); + List list = getDataList(page,null,null,null,searchAppFeatureIndex); // 通过serviceId获取主配置表数据 + if(!StringUtil.isEmpty(list)){ + List baseCfgList=new ArrayList<>(); + for (AppFeatureIndex cfg : list) { + BaseCfg baseCfg=new BaseCfg(); + BeanUtils.copyProperties(cfg, baseCfg); + baseCfgList.add(baseCfg); + } + hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, baseCfgList, hasData); + }else{ + hasData = false; + } + } + + }else{ + logger.info("未知业务"); + } + }else { + /** -- 单域maat -- **/ + if("ddos_ip_cfg".equals(tableNameXml)) { + boolean hasData = true; + while(hasData){ + page.setPageNo(1); + page.setLastPage(false); + List list=ddosCfgService.findPage(page, searchDdosIpCfg).getList(); + if(!StringUtil.isEmpty(list)){ + List baseCfgList=new ArrayList<>(); + for (DdosIpCfg cfg : list) { + BaseCfg baseCfg=new BaseCfg(); + BeanUtils.copyProperties(cfg, baseCfg); + baseCfgList.add(baseCfg); + } + hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, baseCfgList, hasData); + }else{ + hasData = false; + } + } + }else if("av_file_sample_cfg".equals(tableNameXml)) { boolean hasData = true; while(hasData){ @@ -3495,31 +3650,123 @@ public class BaseController { } } - }else if("ddos_ip_cfg".equals(tableNameXml)) { + }else if("dns_res_strategy".equals(tableNameXml)) { boolean hasData = true; while(hasData){ page.setPageNo(1); page.setLastPage(false); - List list=ddosCfgService.findPage(page, searchDdosIpCfg).getList(); + List list = dnsResStrategyService.findPage(page,searchDnsResStrategy).getList(); if(!StringUtil.isEmpty(list)){ - List BaseCfgList=new ArrayList<>(); - for (DdosIpCfg cfg : list) { - BaseCfg baseCfg=new BaseCfg(); - BeanUtils.copyProperties(cfg, baseCfg); - BaseCfgList.add(baseCfg); - } - hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, BaseCfgList, hasData); + hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, list, hasData); }else{ hasData = false; } } - }else if("app_feature_index".equals(tableNameXml)) { + }else if("dns_ip_cfg".equals(tableNameXml)) { + boolean hasData = true; + while(hasData){ + page.setPageNo(1); + page.setLastPage(false); + List list = dnsIpCfgService.findPage(page,searchDnsIpCfg).getList(); + if(!StringUtil.isEmpty(list)){ + List baseCfgList=new ArrayList<>(); + for (DnsIpCfg cfg : list) { + BaseCfg baseCfg=new BaseCfg(); + BeanUtils.copyProperties(cfg, baseCfg); + baseCfgList.add(baseCfg); + } + hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, baseCfgList, hasData); + }else{ + hasData = false; + } + } - }else{ - logger.info("未知业务"); + }else if("pxy_obj_keyring".equals(tableNameXml)) { + boolean hasData = true; + while(hasData){ + page.setPageNo(1); + page.setLastPage(false); + List list = pxyObjKeyringService.findPage(page,searchObjKeyringCfg).getList(); + if(!StringUtil.isEmpty(list)){ + hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, list, hasData); + }else{ + hasData = false; + } + } + + }else if("pxy_obj_trusted_ca_cert".equals(tableNameXml)) { + boolean hasData = true; + while(hasData){ + page.setPageNo(1); + page.setLastPage(false); + List list = pxyObjKeyringService.findTrustedCertPage(page,searchTrustedCaCertCfg).getList(); + if(!StringUtil.isEmpty(list)){ + hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, list, hasData); + }else{ + hasData = false; + } + } + + }else if("asn_ip_cfg".equals(tableNameXml)) { // ASN IP + boolean hasData = true; + while(hasData){ + page.setPageNo(1); + page.setLastPage(false); + List list=asnIpCfgService.findPage(page, searchAsnIpCfg).getList(); + if(!StringUtil.isEmpty(list)){ + hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, list, hasData); + }else{ + hasData = false; + } + } + + }else { + boolean hasData = true; + while(hasData){ + page.setPageNo(1); + page.setLastPage(false); + List list = Lists.newArrayList(); + /* + 1026 app_domain_cfg + 1028 app_ip_cfg + 1029 app_ssl_cert_cfg + 1152 app_topic_domain_cfg + 1024 app_http_cfg + 1026 app_domain_cfg + */ + if(batchCfg.getServiceId().equals(1028)) { + list = appCfgService.findAppIpList(page, searchAppIpCfg).getList(); + } + if(batchCfg.getServiceId().equals(1026)) { + list = appCfgService.findAppDomainList(page, searchAppDomainCfg).getList(); + } + if(batchCfg.getServiceId().equals(1029)) { + list = appCfgService.findAppSslList(page, searchAppSslCertCfg).getList(); + } + if(batchCfg.getServiceId().equals(1152)) { + list = appCfgService.findAppTopicDomainList(page, searchAppTopicCfg).getList(); + } + if(batchCfg.getServiceId().equals(1024)) { + list = appCfgService.findAppHttpList(page, searchAppHttpCfg).getList(); + } + if(!StringUtil.isEmpty(list)){ + List baseCfgList = new ArrayList<>(); + if(!StringUtil.isEmpty(list)) { + for (Object obj : list) { + BaseCfg cfg = (BaseCfg)obj; + baseCfgList.add(cfg); + } + } + hasData = commonPolicyService.batchDeleteMaatData(cfgList, page, batchCfg, baseCfgList, hasData); + }else{ + hasData = false; + } + } + } - //} + + } } long end=System.currentTimeMillis(); diff --git a/src/main/java/com/nis/web/controller/basics/AsnIpController.java b/src/main/java/com/nis/web/controller/basics/AsnIpController.java index d37717ce7..c14885e6c 100644 --- a/src/main/java/com/nis/web/controller/basics/AsnIpController.java +++ b/src/main/java/com/nis/web/controller/basics/AsnIpController.java @@ -160,12 +160,17 @@ public class AsnIpController extends BaseController{ } @RequestMapping(value = {"/delete"}) @RequiresPermissions(value={"asn:ip:config"}) - public String delete(Integer isValid - ,String ids,Integer functionId - ,RedirectAttributes redirectAttributes){ + public String delete(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes, + HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AsnIpCfg cfg){ try{ - asnIpCfgService.delete(ids); - addMessage(redirectAttributes,"success","delete_success"); + if (!StringUtil.isEmpty(ids)) { + asnIpCfgService.delete(ids); + addMessage(redirectAttributes,"success","delete_success"); + }else { + // 批量删除 + Page searchPage = new Page(request, response, "a"); + deleteAll(searchPage, functionId, cfg); + } }catch(Exception e){ logger.error("Delete failed",e); if(e instanceof MaatConvertException) { diff --git a/src/main/java/com/nis/web/controller/configuration/AppCfgController.java b/src/main/java/com/nis/web/controller/configuration/AppCfgController.java index 753e83022..770b397c0 100644 --- a/src/main/java/com/nis/web/controller/configuration/AppCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/AppCfgController.java @@ -314,7 +314,7 @@ public class AppCfgController extends BaseController { addMessage(redirectAttributes, "success", "delete_success"); }else { // 批量删除 - Page searchPage = new Page(request, response, "a"); + Page searchPage = new Page(request, response, "a"); deleteAll(searchPage, functionId, cfg); } } catch (Exception e) { @@ -492,8 +492,26 @@ public class AppCfgController extends BaseController { */ @RequestMapping(value = { "updateAppIpCfgValid" }) @RequiresPermissions(value = { "app:ip:config" }) - public String updateAppIpCfgValid(Integer isValid, String ids, Integer functionId) { - appCfgService.updateAppIpCfgValid(isValid, ids, functionId); + public String updateAppIpCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes, + HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AppIpCfg cfg) { + try { + if (!StringUtil.isEmpty(ids)) { + appCfgService.updateAppIpCfgValid(isValid, ids, functionId); + addMessage(redirectAttributes, "success", "delete_success"); + }else { + // 批量删除 + Page searchPage = new Page(request, response, "a"); + deleteAll(searchPage, functionId, cfg); + } + } catch (Exception e) { + logger.error("配置删除失败:", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "delete_failed"); + } + + } return "redirect:" + adminPath + "/app/ipCfgList?functionId=" + functionId; } @@ -803,8 +821,26 @@ public class AppCfgController extends BaseController { */ @RequestMapping(value = { "updateAppDomainCfgValid" }) @RequiresPermissions(value = { "app:domain:config" }) - public String updateAppDomainCfgValid(Integer isValid, String ids, Integer functionId) { - appCfgService.updateAppDomainCfgValid(isValid, ids, functionId); + public String updateAppDomainCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes, + HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AppDomainCfg cfg) { + try { + if (!StringUtil.isEmpty(ids)) { + appCfgService.updateAppDomainCfgValid(isValid, ids, functionId); + addMessage(redirectAttributes, "success", "delete_success"); + }else { + // 批量删除 + Page searchPage = new Page(request, response, "a"); + deleteAll(searchPage, functionId, cfg); + } + } catch (Exception e) { + logger.error("配置删除失败:", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "delete_failed"); + } + + } return "redirect:" + adminPath + "/app/domainCfgList?functionId=" + functionId; } @@ -1558,20 +1594,24 @@ public class AppCfgController extends BaseController { */ @RequestMapping(value = { "updateAppTopicDomainCfgValid" }) @RequiresPermissions(value = { "app:topic:config" }) - public String updateAppTopicDomainCfgValid(Integer isValid, String ids, Integer functionId, - RedirectAttributes redirectAttributes) { + public String updateAppTopicDomainCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes, + HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AppTopicDomainCfg cfg) { try { - appCfgService.updateAppTopicDomainCfgValid(isValid, ids, functionId); - addMessage(redirectAttributes, "success", "delete_success"); + if (!StringUtil.isEmpty(ids)) { + appCfgService.updateAppTopicDomainCfgValid(isValid, ids, functionId); + addMessage(redirectAttributes, "success", "delete_success"); + }else { + // 批量删除 + Page searchPage = new Page(request, response, "a"); + deleteAll(searchPage, functionId, cfg); + } } catch (Exception e) { logger.error("app主题网站删除失败", e); if (e instanceof MaatConvertException) { - e.printStackTrace(); addMessage(redirectAttributes, "error", "request_service_failed"); } else if (e instanceof CallExternalProceduresException) { addMessage(redirectAttributes, "error", "call_external_procedures_failed"); } else { - e.printStackTrace(); addMessage(redirectAttributes, "error", "delete_failed"); } } diff --git a/src/main/java/com/nis/web/controller/configuration/AppFeatureCfgController.java b/src/main/java/com/nis/web/controller/configuration/AppFeatureCfgController.java index b93e63115..d3c48eaec 100644 --- a/src/main/java/com/nis/web/controller/configuration/AppFeatureCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/AppFeatureCfgController.java @@ -225,8 +225,26 @@ public class AppFeatureCfgController extends BaseController { * @return */ @RequestMapping(value = { "updateAppFeatureCfgValid" }) - public String updateAppFeatureCfgValid(Integer isValid, String ids, Integer functionId) { - appMultiFeatureCfgService.updateAppFeatureCfgValid(isValid, ids, functionId); + public String updateAppFeatureCfgValid(Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes, + HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")AppFeatureIndex cfg) { + try { + if (!StringUtil.isEmpty(ids)) { + appMultiFeatureCfgService.updateAppFeatureCfgValid(isValid, ids, functionId); + addMessage(redirectAttributes, "success", "delete_success"); + }else { + // 批量删除 + Page searchPage = new Page(request, response, "a"); + deleteAll(searchPage, functionId, cfg); + } + } catch (Exception e) { + logger.error("配置删除失败:", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "delete_failed"); + } + + } return "redirect:" + adminPath + "/app/feature/multiFeatureCfgList?functionId=" + functionId; } diff --git a/src/main/java/com/nis/web/controller/configuration/BasicProtocolController.java b/src/main/java/com/nis/web/controller/configuration/BasicProtocolController.java index 4f82aabc7..1c9f6df58 100644 --- a/src/main/java/com/nis/web/controller/configuration/BasicProtocolController.java +++ b/src/main/java/com/nis/web/controller/configuration/BasicProtocolController.java @@ -258,7 +258,7 @@ public class BasicProtocolController extends BaseController { appCfgService.updateAppPolicyCfgValid(isValid, ids, functionId); addMessage(redirectAttributes, "success", "delete_success"); }else { - Page searchPage = new Page(request, response, "a"); + Page searchPage = new Page(request, response, "a"); deleteAll(searchPage, functionId, cfg); } } catch (Exception e) { diff --git a/src/main/java/com/nis/web/controller/configuration/EncryptedTunnelBehaviorController.java b/src/main/java/com/nis/web/controller/configuration/EncryptedTunnelBehaviorController.java index f685b7bd9..cc29faeaa 100644 --- a/src/main/java/com/nis/web/controller/configuration/EncryptedTunnelBehaviorController.java +++ b/src/main/java/com/nis/web/controller/configuration/EncryptedTunnelBehaviorController.java @@ -279,7 +279,7 @@ public class EncryptedTunnelBehaviorController extends BaseController { addMessage(redirectAttributes, "success", "delete_success"); }else { // 批量删除 - Page searchPage = new Page(request, response, "a"); + Page searchPage = new Page(request, response, "a"); deleteAll(searchPage, functionId, cfg); } } catch (Exception e) { diff --git a/src/main/java/com/nis/web/controller/configuration/maintenance/DnsIpCfgController.java b/src/main/java/com/nis/web/controller/configuration/maintenance/DnsIpCfgController.java index 4b77aebec..6ea10ab4e 100644 --- a/src/main/java/com/nis/web/controller/configuration/maintenance/DnsIpCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/maintenance/DnsIpCfgController.java @@ -114,9 +114,26 @@ public class DnsIpCfgController extends BaseController { @RequestMapping(value = { "/delete" }) @RequiresPermissions(value = { "dns:fake:ip:config" }) - public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, - RedirectAttributes redirectAttributes) { - dnsIpCfgService.delete(isAudit, isValid, ids, functionId); + public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, RedirectAttributes redirectAttributes, + HttpServletRequest request, HttpServletResponse response, @ModelAttribute("cfg")DnsIpCfg cfg) { + try { + if (!StringUtil.isEmpty(ids)) { + dnsIpCfgService.delete(isAudit, isValid, ids, functionId); + addMessage(redirectAttributes, "success", "delete_success"); + }else { + // 批量删除 + Page searchPage = new Page(request, response, "a"); + deleteAll(searchPage, functionId, cfg); + } + } catch (Exception e) { + logger.error("配置删除失败:", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "delete_failed"); + } + + } return "redirect:" + adminPath + "/cfg/dnsIp/list?functionId=" + functionId; } diff --git a/src/main/java/com/nis/web/controller/configuration/maintenance/DnsResStrategyController.java b/src/main/java/com/nis/web/controller/configuration/maintenance/DnsResStrategyController.java index b47a850f1..2c368c953 100644 --- a/src/main/java/com/nis/web/controller/configuration/maintenance/DnsResStrategyController.java +++ b/src/main/java/com/nis/web/controller/configuration/maintenance/DnsResStrategyController.java @@ -103,12 +103,26 @@ public class DnsResStrategyController extends BaseController { @RequestMapping(value = { "/delete" }) @RequiresPermissions(value = { "dns:res:strategy:config" }) - public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model, + public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model, @ModelAttribute("cfg")DnsResStrategy cfg, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) { - if (!StringUtil.isEmpty(ids)) { - dnsResStrategyService.delete(isAudit, isValid, ids, functionId); - } + try { + if (!StringUtil.isEmpty(ids)) { + dnsResStrategyService.delete(isAudit, isValid, ids, functionId); + addMessage(redirectAttributes, "success", "delete_success"); + }else { + // 批量删除 + Page searchPage = new Page(request, response, "a"); + deleteAll(searchPage, functionId, cfg); + } + } catch (Exception e) { + logger.error("配置删除失败:", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "delete_failed"); + } + } return "redirect:" + adminPath + "/maintenance/dnsResStrategy/list?functionId=" + functionId; } diff --git a/src/main/java/com/nis/web/controller/configuration/manipulation/DdosCfgController.java b/src/main/java/com/nis/web/controller/configuration/manipulation/DdosCfgController.java index bc7e32882..66c0e7462 100644 --- a/src/main/java/com/nis/web/controller/configuration/manipulation/DdosCfgController.java +++ b/src/main/java/com/nis/web/controller/configuration/manipulation/DdosCfgController.java @@ -95,7 +95,7 @@ public class DdosCfgController extends BaseController { addMessage(redirectAttributes, "success", "delete_success"); }else { // 批量删除 - Page searchPage = new Page(request, response, "a"); + Page searchPage = new Page(request, response, "a"); deleteAll(searchPage, functionId, cfg); } } catch (Exception e) { diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/AvController.java b/src/main/java/com/nis/web/controller/configuration/ntc/AvController.java index 9f8e57610..530479a55 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/AvController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/AvController.java @@ -358,7 +358,7 @@ public class AvController extends BaseController { addMessage(redirectAttributes, "success", "delete_success"); }else { // 批量删除 - Page searchPage = new Page(request, response, "a"); + Page searchPage = new Page(request, response, "a"); deleteAll(searchPage, functionId, cfg); } } catch (Exception e) { diff --git a/src/main/java/com/nis/web/controller/configuration/proxy/PxyObjKeyringController.java b/src/main/java/com/nis/web/controller/configuration/proxy/PxyObjKeyringController.java index c5059b0d0..b1f38c0bc 100644 --- a/src/main/java/com/nis/web/controller/configuration/proxy/PxyObjKeyringController.java +++ b/src/main/java/com/nis/web/controller/configuration/proxy/PxyObjKeyringController.java @@ -328,10 +328,25 @@ public class PxyObjKeyringController extends BaseController { @RequestMapping(value = { "/delete" }) @RequiresPermissions(value = { "proxy:intercept:config" }) - public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model, + public String delete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model, @ModelAttribute("cfg")PxyObjKeyring cfg, HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) { - if (!StringUtil.isEmpty(ids)) { - pxyObjKeyringService.delete(isAudit, isValid, ids, functionId); + try { + if (!StringUtil.isEmpty(ids)) { + pxyObjKeyringService.delete(isAudit, isValid, ids, functionId); + addMessage(redirectAttributes, "success", "delete_success"); + }else { + // 批量删除 + Page searchPage = new Page(request, response, "a"); + deleteAll(searchPage, functionId, cfg); + } + } catch (Exception e) { + logger.error("配置删除失败:", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "delete_failed"); + } + } return "redirect:" + adminPath + "/proxy/intercept/strateagy/list?functionId=" + functionId; @@ -860,11 +875,25 @@ public class PxyObjKeyringController extends BaseController { @RequestMapping(value = { "/trustedCertDelete" }) @RequiresPermissions(value = { "proxy:trustedCert:config" }) public String trustedCertDelete(Integer isAudit, Integer isValid, String ids, Integer functionId, Model model, - HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) { - if (!StringUtil.isEmpty(ids)) { - pxyObjKeyringService.trustedCertDelete(isAudit, isValid, ids, functionId); - } + HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes, @ModelAttribute PxyObjTrustedCaCert cfg) { + try { + if (!StringUtil.isEmpty(ids)) { + pxyObjKeyringService.trustedCertDelete(isAudit, isValid, ids, functionId); + addMessage(redirectAttributes, "success", "delete_success"); + }else { + // 批量删除 + Page searchPage = new Page(request, response, "a"); + deleteAll(searchPage, functionId, cfg); + } + } catch (Exception e) { + logger.error("配置删除失败:", e); + if (e instanceof MaatConvertException) { + addMessage(redirectAttributes, "error", "request_service_failed"); + } else { + addMessage(redirectAttributes, "error", "delete_failed"); + } + } return "redirect:" + adminPath + "/proxy/intercept/strateagy/trustedCertList?functionId=" + functionId; } diff --git a/src/main/java/com/nis/web/dao/configuration/CommonPolicyDao.xml b/src/main/java/com/nis/web/dao/configuration/CommonPolicyDao.xml index aa444f749..c1536b682 100644 --- a/src/main/java/com/nis/web/dao/configuration/CommonPolicyDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/CommonPolicyDao.xml @@ -1019,10 +1019,26 @@ editor_id = #{entity.editorId,jdbcType=INTEGER}, edit_time = #{entity.editTime,jdbcType=TIMESTAMP} - AND compile_id IN - - #{compileId} - + + + AND user_region1 IN + + #{compileId} + + + + AND region_id IN + + #{compileId} + + + + AND compile_id IN + + #{compileId} + + + diff --git a/src/main/java/com/nis/web/service/configuration/CommonPolicyService.java b/src/main/java/com/nis/web/service/configuration/CommonPolicyService.java index 676b08bb1..76902cac6 100644 --- a/src/main/java/com/nis/web/service/configuration/CommonPolicyService.java +++ b/src/main/java/com/nis/web/service/configuration/CommonPolicyService.java @@ -322,46 +322,17 @@ public class CommonPolicyService extends CrudService compileIds = new ArrayList(); for(BaseCfg cfg:list){ - compileIds.add(cfg.getCompileId()); + if(entity.getServiceId().equals(1028)) { + compileIds.add(Integer.parseInt(cfg.getUserRegion1())); + }else if(entity.getServiceId().equals(400)) { + compileIds.add(cfg.getRegionId()); + }else { + compileIds.add(cfg.getCompileId()); + } } // 2.更新配置审核状态(主表) if(!StringUtil.isEmpty(compileIds) && !StringUtil.isEmpty(entity.getTableName())) { - List auditHttpCompileIds= new ArrayList(); - List deleteHttpCompileIds= new ArrayList(); - - // Protocol -> HTTP 请求/响应内容关键字单独处理 ------> - //http关键字配置失效,获取与其匹配的http url配置 - if(entity.getServiceId().equals(152) || entity.getServiceId().equals(40)) { - List httpUrlCfgs=commonPolicyDao.getHttpUrlCfgBySourceCompileId(compileIds); - if(!StringUtil.isEmpty(httpUrlCfgs)) { - for (CfgIndexInfo httpUrlCfg: httpUrlCfgs) { - //审核通过的 - if(httpUrlCfg.getIsValid().equals(1) && httpUrlCfg.getIsAudit().equals(1)) { - auditHttpCompileIds.add(httpUrlCfg.getCompileId()); - /*maatCfg = new MaatCfg(); - maatCfg.setCompileId(httpUrlCfg.getCompileId()); - maatCfg.setServiceId(httpUrlCfg.getServiceId()); - maatCfg.setIsValid(0);//无效 - configCompileList.add(maatCfg);*/ - } - //未审核或者审核未通过的 - if(httpUrlCfg.getIsValid().equals(0) && (httpUrlCfg.getIsAudit().equals(0) || httpUrlCfg.getIsAudit().equals(2))) { - deleteHttpCompileIds.add(httpUrlCfg.getCompileId()); - } - } - } - } - if(!StringUtil.isEmpty(auditHttpCompileIds)) { - commonPolicyDao.auditCfgBatch("cfg_index_info", entity,auditHttpCompileIds,null); - commonPolicyDao.auditCfgBatch("http_url_cfg", entity,auditHttpCompileIds,null); - } - if(!StringUtil.isEmpty(deleteHttpCompileIds)) { - commonPolicyDao.deleteHttpUrlCfg("cfg_index_info", entity,deleteHttpCompileIds); - commonPolicyDao.deleteHttpUrlCfg("http_url_cfg", entity,deleteHttpCompileIds); - } - // Protocol -> HTTP 请求/响应内容关键字单独处理 ------> - commonPolicyDao.auditCfgBatch( entity.getTableName(), entity,compileIds,null); // 批量审核并修改配置审核状态(主表) } @@ -386,7 +357,13 @@ public class CommonPolicyService extends CrudService compileIds = new ArrayList(); for(BaseCfg cfg:list){ - compileIds.add(cfg.getCompileId()); + if(entity.getServiceId().equals(1028)) { + compileIds.add(Integer.parseInt(cfg.getUserRegion1())); + }else if(entity.getServiceId().equals(400)) { + compileIds.add(cfg.getRegionId()); + }else { + compileIds.add(cfg.getCompileId()); + } } // 2.更新配置状态(主表)