ASN分组逻辑调整,配置使用ANS号对应组织的分组改为使用ANS号新增的唯一分组
(cherry picked from commit 5b49bf1d80)
This commit is contained in:
@@ -3022,7 +3022,7 @@ public abstract class BaseService {
|
||||
//<!-- 是否自动更新ASN NO -->
|
||||
asnKeywordCfg.setUserRegion4(StringUtil.isEmpty(asnKeywordCfg.getUserRegion4()) ? "1":"0");
|
||||
if("1".equals(asnKeywordCfg.getUserRegion4())){ //是否标记为下发ALL
|
||||
signAuditAllGroupList.add(Integer.parseInt(asnKeywordCfg.getUserRegion4()));
|
||||
signAuditAllGroupList.add(Integer.parseInt(asnKeywordCfg.getUserRegion3()));
|
||||
}
|
||||
groupWithRegion.put(asnKeywordCfg.getUserRegion2(), asnKeywordCfg.getUserRegion3());
|
||||
//需要标记为is_used=1的组织
|
||||
@@ -3107,6 +3107,169 @@ public abstract class BaseService {
|
||||
}
|
||||
|
||||
|
||||
/*if(asnList!=null && asnList.size()>0){
|
||||
|
||||
for (AsnKeywordCfg asnKeywordCfg : asnList) {
|
||||
asnNoStr+=asnKeywordCfg.getCfgKeywords()+",";
|
||||
}
|
||||
|
||||
AsnKeywordCfg cfg = new AsnKeywordCfg();
|
||||
cfg.setTableName(AsnKeywordCfg.getTablename());
|
||||
cfg.setCompileId(entity.getCompileId());
|
||||
cfg.setIsAudit(entity.getIsAudit());
|
||||
cfg.setIsValid(entity.getIsValid());
|
||||
cfg.setAuditorId(entity.getAuditorId());
|
||||
cfg.setAuditTime(entity.getAuditTime());
|
||||
cfg.setFunctionId(entity.getFunctionId());
|
||||
ipCfgDao.auditCfg(cfg);
|
||||
Map<String,List> map = cfgConvert(strRegionList,asnList,7,entity,groupRelationList);
|
||||
groupRelationList=map.get("groupList");
|
||||
strRegionList=map.get("dstList");
|
||||
}
|
||||
//修改配置选中的ASN NO 和 asn orga是否被策略引用过
|
||||
if(!StringUtil.isEmpty(asnNoStr)){
|
||||
asnNoStr=asnNoStr.substring(0, asnNoStr.length()-1);
|
||||
if(!StringUtil.isEmpty(asnNoStr)){
|
||||
//如果asnGroup由is_use=0,修改为is_use=1;查询asn no下所有未下发的asn ip,并进行下发,走POST接口【暂时不考虑】
|
||||
AsnIpCfgDao asnIpCfgDao=SpringContextHolder.getBean(AsnIpCfgDao.class);
|
||||
AsnIpCfg asnIp=new AsnIpCfg();
|
||||
asnIp.setIsAudit(0);
|
||||
asnIp.setIsValid(0);
|
||||
List<AsnIpCfg> asnIpList=asnIpCfgDao.findAllListByAsnGroup(asnIp, null, asnNoStr);
|
||||
|
||||
//下发asn IP和修改asn ip的状态必须在一个事物中
|
||||
//重新修改下发时间,下发人员信息
|
||||
AsnIpCfg auditAsnIpCfg=new AsnIpCfg();
|
||||
auditAsnIpCfg.setIsAudit(1);
|
||||
auditAsnIpCfg.setAuditTime(new Date());
|
||||
auditAsnIpCfg.setAuditorId(UserUtils.getUser().getId());
|
||||
auditAsnIpCfg.setIsValid(1);
|
||||
auditAllAsnRegionCfg(auditAsnIpCfg, null, asnNoStr);
|
||||
|
||||
AsnGroupInfoDao asnGroupInfoDao=SpringContextHolder.getBean(AsnGroupInfoDao.class);
|
||||
asnGroupInfoDao.updateIsUsed(asnNoStr, 1);
|
||||
}
|
||||
}*/
|
||||
|
||||
}
|
||||
/**
|
||||
* ASN关键字配置处理 ip地址用
|
||||
* @param asnList
|
||||
* @param entity
|
||||
*/
|
||||
public void auditAsnCfgForIpAddr(List<GroupCfg> groupRelationList,List<StringCfg> strRegionList,BaseCfg entity,List<AsnKeywordCfg> asnList){
|
||||
//注意:一条配置是一个分组,keywords=asnNos|userRegion1=groupId|userRegion2=isAuditAll 0 1
|
||||
if(!StringUtil.isEmpty(asnList)){
|
||||
AsnGroupInfoDao asnGroupInfoDao=SpringContextHolder.getBean(AsnGroupInfoDao.class);
|
||||
ConfigGroupInfoDao configGroupInfoDao=SpringContextHolder.getBean(ConfigGroupInfoDao.class);
|
||||
StringCfgDao stringCfgDao=SpringContextHolder.getBean(StringCfgDao.class);
|
||||
//域和分组的关系
|
||||
Map<String,String> groupWithRegion=new HashMap<>();
|
||||
//需要标记为下发全部域的groupId集合
|
||||
List signAuditAllGroupList=new ArrayList<>();
|
||||
//需要标记下发的groupId
|
||||
List isUsedGroupIdList=new ArrayList<>();
|
||||
//所有已被策略引用过的域
|
||||
List<AsnGroupInfo> auditRegionList=new ArrayList<>();
|
||||
//所有未被策略过的域
|
||||
List<AsnGroupInfo> notAuditRegionList=new ArrayList<>();
|
||||
//所有策略所选asn No
|
||||
List<String> asnGroupIdList=new ArrayList<>();
|
||||
//所有未下发过的asnNo
|
||||
List<String> notAuditGroupIdList=new ArrayList<>();
|
||||
//最新的asn域集合
|
||||
List<AsnKeywordCfg> newAsnList=new ArrayList<>();
|
||||
|
||||
//2、记录标记为下发all的groupId|存储组和asnno的关系|记录需要标记为已下发的group
|
||||
for (AsnKeywordCfg asnKeywordCfg : asnList) {
|
||||
//<!-- 是否自动更新ASN NO -->
|
||||
asnKeywordCfg.setUserRegion4(StringUtil.isEmpty(asnKeywordCfg.getUserRegion4()) ? "1":"0");
|
||||
if("1".equals(asnKeywordCfg.getUserRegion4())){ //是否标记为下发ALL
|
||||
signAuditAllGroupList.add(Integer.parseInt(asnKeywordCfg.getUserRegion3()));
|
||||
}
|
||||
groupWithRegion.put(asnKeywordCfg.getUserRegion2(), asnKeywordCfg.getUserRegion5()); //UserRegion5 ip地址使用组
|
||||
//需要标记为is_used=1的组织
|
||||
if(!isUsedGroupIdList.contains(Integer.parseInt(asnKeywordCfg.getUserRegion3()))){
|
||||
isUsedGroupIdList.add(Integer.parseInt(asnKeywordCfg.getUserRegion3()));
|
||||
}
|
||||
//需要标记为is_used=1的asn no,根据groupId
|
||||
asnGroupIdList.add(asnKeywordCfg.getUserRegion2());
|
||||
|
||||
AsnKeywordCfg asnCfg=new AsnKeywordCfg();
|
||||
BeanUtils.copyProperties(entity, asnCfg,new String[]{"cfgId","userReigon1","userReigon2","userReigon3","userReigon4","userReigon5"});
|
||||
asnCfg.setTableName(AsnKeywordCfg.getTablename());
|
||||
asnCfg.setCfgId(asnKeywordCfg.getCfgId());
|
||||
asnCfg.setUserRegion1(asnKeywordCfg.getUserRegion1());
|
||||
asnCfg.setUserRegion2(asnKeywordCfg.getUserRegion2());
|
||||
asnCfg.setUserRegion3(asnKeywordCfg.getUserRegion3());
|
||||
asnCfg.setUserRegion4(asnKeywordCfg.getUserRegion4());
|
||||
asnCfg.setUserRegion5(asnKeywordCfg.getUserRegion5());
|
||||
stringCfgDao.updateAsnKeyword(asnCfg);
|
||||
}
|
||||
//3、//根据asnGroupIdList查询所有下发过的ASN NO
|
||||
if(!StringUtil.isEmpty(asnGroupIdList)){
|
||||
auditRegionList=asnGroupInfoDao.findAsnGroupInfoByGroupIds(asnGroupIdList, 1);
|
||||
}
|
||||
//已下发过的asn groupId只需要下发组
|
||||
if(!StringUtil.isEmpty(auditRegionList)){
|
||||
for (AsnGroupInfo asnGroupInfo : auditRegionList) {
|
||||
AsnKeywordCfg cfg = new AsnKeywordCfg();
|
||||
cfg.setCompileId(entity.getCompileId());
|
||||
cfg.setRegionId(asnGroupInfo.getRegionId());
|
||||
cfg.setGroupId(Integer.parseInt(groupWithRegion.get(asnGroupInfo.getGroupId().toString()))); //组号
|
||||
cfg.setUserRegion3("0"); //是否下发域
|
||||
cfg.setIsAudit(entity.getIsAudit());
|
||||
cfg.setIsValid(entity.getIsValid());
|
||||
cfg.setAuditorId(entity.getAuditorId());
|
||||
cfg.setAuditTime(entity.getAuditTime());
|
||||
newAsnList.add(cfg);
|
||||
}
|
||||
}
|
||||
|
||||
//4、查询所有未下发过的 ASN NO
|
||||
if(!StringUtil.isEmpty(asnGroupIdList)){
|
||||
notAuditRegionList=asnGroupInfoDao.findAsnGroupInfoByGroupIds(asnGroupIdList, 0);
|
||||
}
|
||||
|
||||
if(!StringUtil.isEmpty(notAuditRegionList)){
|
||||
for (AsnGroupInfo asnGroupInfo : notAuditRegionList) {
|
||||
AsnKeywordCfg cfg = new AsnKeywordCfg();
|
||||
cfg.initDefaultValue();
|
||||
cfg.setTableName(AsnKeywordCfg.getTablename());
|
||||
cfg.setCompileId(entity.getCompileId());
|
||||
cfg.setCfgType(asnList.get(0).getCfgType());
|
||||
cfg.setCfgKeywords(asnGroupInfo.getAsnId().toString());//关键字
|
||||
cfg.setGroupId(Integer.parseInt(groupWithRegion.get(asnGroupInfo.getGroupId().toString()))); //groupId
|
||||
cfg.setRegionId(asnGroupInfo.getRegionId());//regionid
|
||||
cfg.setUserRegion3("1"); //是否下发域
|
||||
cfg.setIsAudit(entity.getIsAudit());
|
||||
cfg.setIsValid(entity.getIsValid());
|
||||
cfg.setAuditorId(entity.getAuditorId());
|
||||
cfg.setAuditTime(entity.getAuditTime());
|
||||
cfg.setFunctionId(entity.getFunctionId());
|
||||
newAsnList.add(cfg);
|
||||
notAuditGroupIdList.add(asnGroupInfo.getGroupId().toString());
|
||||
}
|
||||
}
|
||||
//5、修改所有下发的asn为已下发
|
||||
if(!StringUtil.isEmpty(notAuditGroupIdList)){
|
||||
asnGroupInfoDao.updateIsUsedAndIsValid(notAuditGroupIdList,1,null);
|
||||
}
|
||||
//6、标记组已被策略标记为全部下发
|
||||
if(!StringUtil.isEmpty(signAuditAllGroupList)){
|
||||
configGroupInfoDao.updateIsAuditAll(4, 1,signAuditAllGroupList );
|
||||
}
|
||||
//7、标记组已被策略引用
|
||||
if(!StringUtil.isEmpty(isUsedGroupIdList)){
|
||||
configGroupInfoDao.updateIsUsed(4, 1, isUsedGroupIdList);
|
||||
}
|
||||
//8、maat配置转换
|
||||
if(!StringUtil.isEmpty(newAsnList)){
|
||||
Map<String,List> map = cfgConvert(strRegionList,newAsnList,7,entity,groupRelationList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*if(asnList!=null && asnList.size()>0){
|
||||
|
||||
for (AsnKeywordCfg asnKeywordCfg : asnList) {
|
||||
|
||||
Reference in New Issue
Block a user