域清空时取消obj-group-list maat配置
This commit is contained in:
@@ -3362,6 +3362,7 @@ public abstract class BaseService {
|
||||
realGroupIds.deleteCharAt(realGroupIds.toString().length()-1);
|
||||
}
|
||||
List<CfgIndexInfo> toUpdateCfgIndexInfos=new ArrayList<>();
|
||||
List<CfgIndexInfo> toCancelCfgIndexInfos=new ArrayList<>();
|
||||
//查询cfg_index_info表,获取所有用到了这个group_id的非删除配置
|
||||
List<CfgIndexInfo> cfgIndexInfos=commonPolicyDao.getObjGroupListByGroupIds(realGroupIds.toString(),null,null);
|
||||
|
||||
@@ -3373,6 +3374,7 @@ public abstract class BaseService {
|
||||
List compileIds=new ArrayList();
|
||||
//组织一个大的json
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
ToMaatBean cancelMaatBean = new ToMaatBean();
|
||||
ServiceConfigTemplateUtil templateUtil=new ServiceConfigTemplateUtil();
|
||||
Map<String,Object> interceptUserRegionMap=new HashMap<>();
|
||||
for(CfgIndexInfo cfgIndexInfo:cfgIndexInfos){
|
||||
@@ -3381,6 +3383,7 @@ public abstract class BaseService {
|
||||
MaatCfg maatCfg = new MaatCfg();
|
||||
Set<Integer> groupIdSet=new HashSet<>();
|
||||
List<MaatCfg> configCompileList = new ArrayList();
|
||||
List<MaatCfg> cancelConfigCompileList = new ArrayList();
|
||||
List<GroupCfg> groupRelationList = new ArrayList();
|
||||
List<IpCfg> ipRegionList = new ArrayList();
|
||||
List<StringCfg> strRegionList = new ArrayList();
|
||||
@@ -3398,17 +3401,27 @@ public abstract class BaseService {
|
||||
|
||||
//需要更新的组
|
||||
cfgIndexInfo.setCommonGroupIds(gsonToJson(userRgionMap));
|
||||
if(!oldCommonGroupIds.equals(cfgIndexInfo.getCommonGroupIds())){
|
||||
if(CollectionUtils.isEmpty(cfgIndexInfo.getIpCommGroupCfgList())&&
|
||||
CollectionUtils.isEmpty(cfgIndexInfo.getUrlCommGroupList())&&CollectionUtils.isEmpty(cfgIndexInfo.getScriberIdCommGroupList())&&
|
||||
CollectionUtils.isEmpty(cfgIndexInfo.getDomainCommGroupList())){
|
||||
cfgIndexInfo.setIsValid(Constants.VALID_NO);
|
||||
cfgIndexInfo.setIsAudit(Constants.AUDIT_NOT_YES);
|
||||
cfgIndexInfo.setCommonGroupIds("");
|
||||
toCancelCfgIndexInfos.add(cfgIndexInfo);
|
||||
}else if(!oldCommonGroupIds.equals(cfgIndexInfo.getCommonGroupIds())){
|
||||
toUpdateCfgIndexInfos.add(cfgIndexInfo);
|
||||
//commonPolicyDao.updateCfgIndexCommonGroupIds(cfgIndexInfo);
|
||||
}
|
||||
|
||||
if(cfgIndexInfo.getIsValid().equals(Constants.VALID_YES)){
|
||||
//没组了,取消配置
|
||||
if(userRgionMap.isEmpty()){
|
||||
//没组了,取消配置,没域了,取消配置
|
||||
if(userRgionMap.isEmpty()||(CollectionUtils.isEmpty(cfgIndexInfo.getIpCommGroupCfgList())&&
|
||||
CollectionUtils.isEmpty(cfgIndexInfo.getUrlCommGroupList())&&CollectionUtils.isEmpty(cfgIndexInfo.getScriberIdCommGroupList())&&
|
||||
CollectionUtils.isEmpty(cfgIndexInfo.getDomainCommGroupList()))){
|
||||
maatCfg.setCompileId(cfgIndexInfo.getCompileId());
|
||||
maatCfg.setServiceId(cfgIndexInfo.getServiceId());
|
||||
maatCfg.setIsValid(0);//无效
|
||||
configCompileList.add(maatCfg);
|
||||
cancelConfigCompileList.add(maatCfg);
|
||||
}else{//有组,重新下发配置
|
||||
//保存区域IP信息
|
||||
List<AreaIpCfg> areaIpCfgList=areaIpCfgDao.getByCompileId(cfgIndexInfo.getCompileId());
|
||||
@@ -3519,22 +3532,49 @@ public abstract class BaseService {
|
||||
|
||||
configCompileList.add(maatCfg);
|
||||
}
|
||||
if(CollectionUtils.isEmpty(maatBean.getConfigCompileList())){
|
||||
if(configCompileList.size()>0&&CollectionUtils.isEmpty(maatBean.getConfigCompileList())){
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(cfgIndexInfo.getAuditTime());
|
||||
maatBean.setCreatorName(cfgIndexInfo.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
}
|
||||
}else if(cfgIndexInfo.getIsValid().equals(Constants.VALID_NO)){//生效的配置置为了失效
|
||||
maatCfg.setCompileId(cfgIndexInfo.getCompileId());
|
||||
maatCfg.setServiceId(cfgIndexInfo.getServiceId());
|
||||
maatCfg.setIsValid(0);//无效
|
||||
cancelConfigCompileList.add(maatCfg);
|
||||
}
|
||||
if(cancelConfigCompileList.size()>0&&CollectionUtils.isEmpty(cancelMaatBean.getConfigCompileList())){
|
||||
cancelMaatBean.setConfigCompileList(cancelConfigCompileList);
|
||||
cancelMaatBean.setAuditTime(cfgIndexInfo.getAuditTime());
|
||||
cancelMaatBean.setCreatorName(cfgIndexInfo.getCurrentUser().getName());
|
||||
cancelMaatBean.setVersion(Constants.MAAT_VERSION);
|
||||
cancelMaatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
}
|
||||
|
||||
//下发maat配置
|
||||
//auditPolicy(cfgIndexInfo,cfgIndexInfo.getIsAudit(),Constants.UPDATE_ACTION);
|
||||
}
|
||||
}
|
||||
//需要更新的cfg_index_info数据库更新
|
||||
if(toCancelCfgIndexInfos.size()>0){
|
||||
for(CfgIndexInfo info:toCancelCfgIndexInfos){
|
||||
commonPolicyDao.updateCfgIndexCommonGroupIds(info);
|
||||
}
|
||||
}
|
||||
if(toUpdateCfgIndexInfos.size()>0){
|
||||
commonPolicyDao.updateCfgIndexCommonGroupIds(toUpdateCfgIndexInfos);
|
||||
for(CfgIndexInfo info:toUpdateCfgIndexInfos){
|
||||
commonPolicyDao.updateCfgIndexCommonGroupIds(info);
|
||||
}
|
||||
}
|
||||
//向maat发送配置
|
||||
if(CollectionUtils.isNotEmpty(cancelMaatBean.getConfigCompileList())){
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(cancelMaatBean);
|
||||
logger.info("策略对象组取消配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.put(json,1);
|
||||
logger.info("策略对象组取消响应信息:"+result.getMsg());
|
||||
}
|
||||
//向maat发送配置
|
||||
if(CollectionUtils.isNotEmpty(maatBean.getConfigCompileList())){
|
||||
|
||||
Reference in New Issue
Block a user