增加高级功能菜单下的配置审核不通过、删除功能.

This commit is contained in:
zhangwenqing
2019-04-15 16:23:14 +08:00
parent ecb1fed2d5
commit a2f8cf56d3
13 changed files with 491 additions and 128 deletions

View File

@@ -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<AsnIpCfg> list=asnIpCfgService.findPage(page, searchAsnIpCfg).getList();
if(!StringUtil.isEmpty(list)){
Map<Integer,List> 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<BaseCfg> 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<Integer,List> 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<AppIpCfg> list=appCfgService.findAppIpList(page, searchAppIpCfg).getList();
if(!StringUtil.isEmpty(list)){
Map<Integer,List> 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<BaseCfg> 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<Integer,List> 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<Map<String,Object>> cfgList = (List<Map<String, Object>>) 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<CfgIndexInfo> list = getDataList(page,searchCfg,null,null,null); // 通过serviceId获取主配置表数据
if(!StringUtil.isEmpty(list)){
List<BaseCfg> BaseCfgList=new ArrayList<>();
List<BaseCfg> 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<FileDigestCfg> list = getDataList(page,null,null,searchDigestCfg,null); // 通过serviceId获取主配置表数据
if(!StringUtil.isEmpty(list)){
List<BaseCfg> BaseCfgList=new ArrayList<>();
List<BaseCfg> 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<AppPolicyCfg> list = getDataList(page,null,searchAppCfg,null,null); // 通过serviceId获取主配置表数据
if(!StringUtil.isEmpty(list)){
List<BaseCfg> BaseCfgList=new ArrayList<>();
List<BaseCfg> 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<AppFeatureIndex> list = getDataList(page,null,null,null,searchAppFeatureIndex); // 通过serviceId获取主配置表数据
if(!StringUtil.isEmpty(list)){
List<BaseCfg> 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<DdosIpCfg> list=ddosCfgService.findPage(page, searchDdosIpCfg).getList();
if(!StringUtil.isEmpty(list)){
List<BaseCfg> 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<DdosIpCfg> list=ddosCfgService.findPage(page, searchDdosIpCfg).getList();
List<BaseCfg> list = dnsResStrategyService.findPage(page,searchDnsResStrategy).getList();
if(!StringUtil.isEmpty(list)){
List<BaseCfg> 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<DnsIpCfg> list = dnsIpCfgService.findPage(page,searchDnsIpCfg).getList();
if(!StringUtil.isEmpty(list)){
List<BaseCfg> 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<BaseCfg> 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<BaseCfg> 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<BaseCfg> 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<BaseCfg> 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();