appip全量下发逻辑:
1、全量下发 (1)、批量下发已下发过的app的app IP配置(走maat配置下发接口) appip批量审核逻辑: 1、审核通过 (1)、批量下发已下发过的app的app IP配置(走ip复用接口) 批量修改app ip配置状态为已下发 (2)、批量下发未下发过的app的app ip配置(走maat下发接口) 批量修改group_info为已下发 批量修改app ip为已下发 2、取消审核通过 (1)、批量失效已下发过的app的app IP配置(走ip复用接口) 批量修改app ip配置状态为失效 (2)、未下发过的app不存在已下发的配置,无需处理取消。
This commit is contained in:
@@ -169,6 +169,7 @@ import com.nis.web.service.configuration.UserManageService;
|
||||
import com.nis.web.service.configuration.WebsiteCfgService;
|
||||
import com.nis.web.service.configuration.XmppCfgService;
|
||||
import com.nis.web.service.configuration.statistics.ConfigureStatisticsService;
|
||||
import com.nis.web.service.specific.ConfigGroupInfoService;
|
||||
import com.nis.web.service.specific.SpecificServiceCfgService;
|
||||
import com.nis.web.service.specific.SpecificServiceHostCfgService;
|
||||
import com.nis.web.service.systemService.ServiceConfigInfoService;
|
||||
@@ -298,6 +299,8 @@ public class BaseController {
|
||||
protected IpReuseIpCfgService ipReuseIpCfgService;
|
||||
@Autowired
|
||||
protected IpAddrPoolCfgService ipAddrPoolCfgService;// 地址池管理service
|
||||
@Autowired
|
||||
protected ConfigGroupInfoService configGroupInfoService;// 分组复用
|
||||
/**
|
||||
* 管理基础路径
|
||||
*/
|
||||
@@ -2000,7 +2003,7 @@ public class BaseController {
|
||||
BeanUtils.copyProperties(entity, auditBatchCfg);
|
||||
BeanUtils.copyProperties(entity, searchTrustedCaCrlCfg);
|
||||
}
|
||||
if(entity != null && (entity instanceof CfgIndexInfo)) {
|
||||
if(entity != null && (entity instanceof DnsResStrategy)) {
|
||||
BeanUtils.copyProperties(entity, auditBatchCfg);
|
||||
BeanUtils.copyProperties(entity, searchDnsResStrategy);
|
||||
}
|
||||
@@ -2008,7 +2011,7 @@ public class BaseController {
|
||||
BeanUtils.copyProperties(entity, auditBatchCfg);
|
||||
BeanUtils.copyProperties(entity, searchDnsIpCfg);
|
||||
}
|
||||
if(entity != null && (entity instanceof CfgIndexInfo)) {
|
||||
if(entity != null && (entity instanceof IpPortCfg)) {
|
||||
BeanUtils.copyProperties(entity, auditBatchCfg);
|
||||
BeanUtils.copyProperties(entity, searchIpPortCfg);
|
||||
}
|
||||
@@ -2021,7 +2024,7 @@ public class BaseController {
|
||||
BeanUtils.copyProperties(entity, auditBatchCfg);
|
||||
BeanUtils.copyProperties(entity, searchDdosIpCfg);
|
||||
}
|
||||
if(entity != null && (entity instanceof CfgIndexInfo)) {
|
||||
if(entity != null && (entity instanceof AppIpCfg)) {
|
||||
BeanUtils.copyProperties(entity, auditBatchCfg);
|
||||
BeanUtils.copyProperties(entity, searchAppIpCfg);
|
||||
}
|
||||
@@ -2331,58 +2334,131 @@ public class BaseController {
|
||||
}
|
||||
}
|
||||
}else{
|
||||
boolean hasData = true;
|
||||
while(hasData){
|
||||
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(auditBatchCfg.getServiceId().equals(1026)) {
|
||||
list=appCfgService.findAppDomainList(page, searchAppDomainCfg).getList();
|
||||
}
|
||||
if(auditBatchCfg.getServiceId().equals(1028)) {
|
||||
list=appCfgService.findAppIpList(page, searchAppIpCfg).getList();
|
||||
}
|
||||
if(auditBatchCfg.getServiceId().equals(1029)) {
|
||||
list=appCfgService.findAppSslList(page, searchAppSslCertCfg).getList();
|
||||
}
|
||||
if(auditBatchCfg.getServiceId().equals(1152)) {
|
||||
list=appCfgService.findAppTopicDomainList(page, searchAppTopicCfg).getList();
|
||||
}
|
||||
if(auditBatchCfg.getServiceId().equals(1024)) {
|
||||
list=appCfgService.findAppHttpList(page, searchAppHttpCfg).getList();
|
||||
}
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
if(auditBatchCfg.getIsValid().equals(1)) {
|
||||
if(auditBatchCfg.getServiceId().equals(1028)){
|
||||
hasData=configSynchronizationService.auditAppIpData(userRegionList,
|
||||
page,auditBatchCfg,list,hasData,true);
|
||||
}else{
|
||||
hasData=configSynchronizationService.auditSingleMaatData(cfgType,userRegionList,
|
||||
page,auditBatchCfg,list,hasData,true);
|
||||
}
|
||||
}else {
|
||||
List<BaseCfg> newList=new ArrayList<>();
|
||||
if(!StringUtil.isEmpty(list)) {
|
||||
for (Object obj : list) {
|
||||
BaseCfg cfg=(BaseCfg)obj;
|
||||
newList.add(cfg);
|
||||
//批量下发时,未下发过的app需要下发正常配置;已下发过的app需要下发ip复用配置(为保证事物,分两种方式下发)
|
||||
//1028 app_ip_cfg
|
||||
if(auditBatchCfg.getServiceId().equals(1028)) {
|
||||
if(true) {
|
||||
boolean hasData = true;
|
||||
while(hasData){
|
||||
/************预先获取已下发的groupid和compileid,且每批次重新获取,避免上一批次有新的compileId下发*************/
|
||||
Map<Integer, Integer> isIssuedCompileIds=new HashMap<>();
|
||||
//分组复用组信息1:app ip,2:内容,3:区域 ,4 asn
|
||||
ConfigGroupInfo groupInfo=new ConfigGroupInfo();
|
||||
groupInfo.setIsIssued(1);
|
||||
groupInfo.setGroupType(1);
|
||||
List<ConfigGroupInfo> groupInfos=configGroupInfoService.findAllList(groupInfo);//每一批次下发都取一次最新的group_info信息
|
||||
Map<Integer, Integer> compileGroups=new HashMap<>();
|
||||
if(!StringUtil.isEmpty(groupInfos)) {
|
||||
for (ConfigGroupInfo configGroupInfo : groupInfos) {
|
||||
isIssuedCompileIds.put(configGroupInfo.getCompileId(), configGroupInfo.getGroupId());
|
||||
}
|
||||
}
|
||||
hasData=commonPolicyService.auditNtcMaatData(cfgList, page, auditBatchCfg,newList, hasData);
|
||||
if(!StringUtil.isEmpty(isIssuedCompileIds)) {
|
||||
auditBatchCfg.setCompileGroupMap(isIssuedCompileIds);
|
||||
auditBatchCfg.setCompileIsIssued(1);
|
||||
List list = Lists.newArrayList();
|
||||
searchAppIpCfg.setCompileGroupMap(isIssuedCompileIds);
|
||||
list=appCfgService.findAppIpList(page, searchAppIpCfg).getList();
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
//APP IP配置生效/失效
|
||||
hasData=configSynchronizationService.auditAppIpData(userRegionList,
|
||||
page,auditBatchCfg,list,hasData,true);
|
||||
if(hasData) {
|
||||
page.setPageNo(1);
|
||||
}
|
||||
}else{
|
||||
hasData = false;
|
||||
}
|
||||
}else {
|
||||
hasData = false;
|
||||
}
|
||||
}
|
||||
if(hasData) {
|
||||
page.setPageNo(1);
|
||||
}
|
||||
if(auditBatchCfg.getIsValid().equals(1)) {
|
||||
boolean hasData = true;
|
||||
while(hasData){
|
||||
/************预先获取未下发的groupid和compileid,********************/
|
||||
//获取已下发的appcompileid
|
||||
Map<Integer, Integer> notIssuedCompileIds=new HashMap<>();
|
||||
//分组复用组信息1:app ip,2:内容,3:区域 ,4 asn
|
||||
ConfigGroupInfo groupInfo=new ConfigGroupInfo();
|
||||
groupInfo.setIsIssued(0);
|
||||
groupInfo.setGroupType(1);
|
||||
List<ConfigGroupInfo> groupInfos=configGroupInfoService.findAllList(groupInfo);//每一批次下发都取一次最新的group_info信息
|
||||
Map<Integer, Integer> compileGroups=new HashMap<>();
|
||||
if(!StringUtil.isEmpty(groupInfos)) {
|
||||
for (ConfigGroupInfo configGroupInfo : groupInfos) {
|
||||
notIssuedCompileIds.put(configGroupInfo.getCompileId(), configGroupInfo.getGroupId());
|
||||
}
|
||||
}
|
||||
if(!StringUtil.isEmpty(notIssuedCompileIds)) {
|
||||
auditBatchCfg.setCompileGroupMap(notIssuedCompileIds);
|
||||
searchAppIpCfg.setCompileGroupMap(notIssuedCompileIds);
|
||||
auditBatchCfg.setCompileIsIssued(0);
|
||||
List list = Lists.newArrayList();
|
||||
list=appCfgService.findAppIpList(page, searchAppIpCfg).getList();
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
//APP IP配置生效/失效
|
||||
hasData=configSynchronizationService.auditAppIpData(userRegionList,
|
||||
page,auditBatchCfg,list,hasData,true);
|
||||
if(hasData) {
|
||||
page.setPageNo(1);
|
||||
}
|
||||
}else{
|
||||
hasData = false;
|
||||
}
|
||||
}else {
|
||||
hasData = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
boolean hasData = true;
|
||||
while(hasData){
|
||||
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(auditBatchCfg.getServiceId().equals(1026)) {
|
||||
list=appCfgService.findAppDomainList(page, searchAppDomainCfg).getList();
|
||||
}
|
||||
if(auditBatchCfg.getServiceId().equals(1029)) {
|
||||
list=appCfgService.findAppSslList(page, searchAppSslCertCfg).getList();
|
||||
}
|
||||
if(auditBatchCfg.getServiceId().equals(1152)) {
|
||||
list=appCfgService.findAppTopicDomainList(page, searchAppTopicCfg).getList();
|
||||
}
|
||||
if(auditBatchCfg.getServiceId().equals(1024)) {
|
||||
list=appCfgService.findAppHttpList(page, searchAppHttpCfg).getList();
|
||||
}
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
if(auditBatchCfg.getIsValid().equals(1)) {
|
||||
hasData=configSynchronizationService.auditSingleMaatData(cfgType,userRegionList,
|
||||
page,auditBatchCfg,list,hasData,true);
|
||||
}else {
|
||||
List<BaseCfg> newList=new ArrayList<>();
|
||||
if(!StringUtil.isEmpty(list)) {
|
||||
for (Object obj : list) {
|
||||
BaseCfg cfg=(BaseCfg)obj;
|
||||
newList.add(cfg);
|
||||
}
|
||||
}
|
||||
hasData=commonPolicyService.auditNtcMaatData(cfgList, page, auditBatchCfg,newList, hasData);
|
||||
}
|
||||
if(hasData) {
|
||||
page.setPageNo(1);
|
||||
}
|
||||
}else{
|
||||
hasData = false;
|
||||
}
|
||||
}else{
|
||||
hasData = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}else if("2".equals(serviceTypeXml)){
|
||||
|
||||
Reference in New Issue
Block a user