ASN ip,APP特征业务的配置批量取消功能完成

This commit is contained in:
段冬梅
2019-03-11 17:06:31 +08:00
parent c8e43c81f1
commit 785150f921
8 changed files with 241 additions and 37 deletions

View File

@@ -120,6 +120,7 @@ import com.nis.domain.maat.MaatCfg.NumBoundaryCfg;
import com.nis.domain.maat.MaatCfg.StringCfg;
import com.nis.domain.maat.ToMaatBean;
import com.nis.domain.report.NtcPzReport;
import com.nis.domain.specific.ConfigGroupInfo;
import com.nis.domain.specific.SpecificServiceCfg;
import com.nis.exceptions.MaatConvertException;
//import com.nis.util.AsnCacheUtils;
@@ -2696,6 +2697,7 @@ public class BaseController {
* @return
*/
public void auditAll(Page page,Integer auditType,Object entity)throws Exception {
long start=System.currentTimeMillis();
page.setOrderBy("");
page.setPageSize(Constants.MAAT_JSON_SEND_SIZE);
page.setPageNo(1);
@@ -2721,6 +2723,7 @@ public class BaseController {
AppTopicDomainCfg searchAppTopicCfg=new AppTopicDomainCfg();
AppFeatureIndex searchAppFeatureIndex=new AppFeatureIndex();
AppSslCertCfg searchAppSslCertCfg=new AppSslCertCfg();
AsnIpCfg searchAsnIpCfg=new AsnIpCfg();
if(entity != null && (entity instanceof CfgIndexInfo)) {
BeanUtils.copyProperties(entity, auditBatchCfg);
BeanUtils.copyProperties(entity, searchCfg);
@@ -2794,6 +2797,10 @@ public class BaseController {
BeanUtils.copyProperties(entity, auditBatchCfg);
BeanUtils.copyProperties(entity, searchAppSslCertCfg);
}
if(entity != null && (entity instanceof AsnIpCfg)) {
BeanUtils.copyProperties(entity, auditBatchCfg);
BeanUtils.copyProperties(entity, searchAsnIpCfg);
}
@@ -2835,6 +2842,8 @@ public class BaseController {
searchAppFeatureIndex.setIsAudit(0);
searchAppSslCertCfg.setIsValid(0);
searchAppSslCertCfg.setIsAudit(0);
searchAsnIpCfg.setIsValid(0);
searchAsnIpCfg.setIsAudit(0);
auditBatchCfg.setIsAudit(1);
auditBatchCfg.setIsValid(1);
@@ -2878,6 +2887,8 @@ public class BaseController {
searchAppFeatureIndex.setIsAudit(1);
searchAppSslCertCfg.setIsValid(1);
searchAppSslCertCfg.setIsAudit(1);
searchAsnIpCfg.setIsValid(1);
searchAsnIpCfg.setIsAudit(1);
auditBatchCfg.setIsAudit(3);
auditBatchCfg.setIsValid(0);
@@ -3080,10 +3091,89 @@ public class BaseController {
}
}
}else{
//1028 app_ip_cfg
//TODO 批量审核通过APP IP需要处理的问题一批中存在一个APP 所有IP均未下发过的问题待解决
//批量下发时未下发过的app需要下发正常配置;已下发过的app需要下发ip复用配置为保证事物分两种方式下发
if(auditBatchCfg.getServiceId().equals(1028)) {
//400 ASN IP
if(auditBatchCfg.getServiceId().equals(400)) {
//所有已下发的ASN IP组
boolean hasData = true;
while(hasData){
//已下发的ASN IP
List<AsnIpCfg> list=asnIpCfgService.findPage(page, searchAsnIpCfg).getList();
if(!StringUtil.isEmpty(list)){
if(auditBatchCfg.getIsValid().equals(1)) {
}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);
}
if(hasData) {
page.setPageNo(page.getNext());
}
}else{
hasData = false;
}
}
}else if(auditBatchCfg.getServiceId().equals(1028)) {
//所有已下发的app IP组
ConfigGroupInfo groupInfo=new ConfigGroupInfo();
groupInfo.setIsIssued(1);
groupInfo.setGroupType(1);//1:app ip
List<ConfigGroupInfo> groupInfos=configGroupInfoService.findAllList(groupInfo);
Map<Integer,Integer> groupMap=new HashMap<>();
for (ConfigGroupInfo configGroupInfo : groupInfos) {
groupMap.put(configGroupInfo.getCompileId(), configGroupInfo.getGroupId());
}
boolean hasData = true;
while(hasData){
//已下发的APP IP
List<AppIpCfg> list=appCfgService.findAppIpList(page, searchAppIpCfg).getList();
if(!StringUtil.isEmpty(list)){
if(auditBatchCfg.getIsValid().equals(1)) {
//TODO 批量审核通过APP IP需要处理的问题一批中存在一个APP 所有IP均未下发过的问题待解决
//批量下发时未下发过的app需要下发正常配置;已下发过的app需要下发ip复用配置为保证事物分两种方式下发
/*hasData=configSynchronizationService.auditDdosMaatData(cfgList,userRegionList,
page,auditBatchCfg,list,hasData,true);*/
}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);
}
if(hasData) {
page.setPageNo(page.getNext());
}
}else{
hasData = false;
}
}
/*if(true) {
page.setOrderBy("");
page.setPageSize(Constants.MAAT_JSON_SEND_SIZE);
@@ -3249,6 +3339,8 @@ public class BaseController {
BeanUtils.copyProperties(base, entity);
}
}
long end=System.currentTimeMillis();
logger.info("配置批量生效/失效耗时:"+(end-start));
}