界面配置转maat配置时分组创建规则为一条业务配置创建一个分组,区域IP配置多条IP配置创建一个分组,应用层IP配置,还需额外创建协议号配置与协议号配置分组。
Signed-off-by: zhangwei <zhangwei@intranet.com>
This commit is contained in:
@@ -273,7 +273,6 @@ public abstract class BaseService {
|
||||
*/
|
||||
public static Map<String,List> cfgConvert(List dstList,List srcList,Integer cfgType,BaseCfg baseCfg,List groupRelationList){
|
||||
Map<String,List> map = new HashMap();
|
||||
String regionValue = null;
|
||||
if(cfgType==1){
|
||||
List numRegionList = new ArrayList();
|
||||
Integer groupId = 0;
|
||||
@@ -281,8 +280,9 @@ public abstract class BaseService {
|
||||
BaseIpCfg baseIpCfg = (BaseIpCfg) srcList.get(i);
|
||||
IpCfg cfg = new IpCfg();
|
||||
BeanUtils.copyProperties(baseIpCfg, cfg);
|
||||
GroupCfg group = new GroupCfg();
|
||||
if(!cfg.getCfgType().equals(regionValue)){
|
||||
//区域IP配置,多条IP配置属于同一个分组,其他业务配置IP,一条配置一个分组
|
||||
if(groupId==0 || !cfg.getCfgType().equals(Constants.AREA_REGION)){
|
||||
GroupCfg group = new GroupCfg();
|
||||
groupId = ConfigServiceUtil.getId(2, 1).get(0);
|
||||
group.setGroupId(groupId);
|
||||
group.setCompileId(baseCfg.getCompileId());
|
||||
@@ -290,31 +290,27 @@ public abstract class BaseService {
|
||||
group.setIsValid(baseCfg.getIsValid());
|
||||
groupRelationList.add(group);
|
||||
}
|
||||
|
||||
cfg.setGroupId(groupId);
|
||||
cfg.setRegionId(ConfigServiceUtil.getId(3, 1).get(0));
|
||||
cfg.setAuditTime(baseCfg.getAuditTime());
|
||||
cfg.setIsValid(baseCfg.getIsValid());
|
||||
cfg = ipConvert(cfg,baseIpCfg);
|
||||
dstList.add(cfg);
|
||||
regionValue = cfg.getCfgType();
|
||||
|
||||
//如果protocolId非空非零,需要构造数值型域配置
|
||||
if(baseIpCfg.getProtocolId()!=null && baseIpCfg.getProtocolId()!=0){
|
||||
if(groupId==0){//只构造一次配置分组
|
||||
GroupCfg group1 = new GroupCfg();
|
||||
groupId = ConfigServiceUtil.getId(2, 1).get(0);
|
||||
group1.setGroupId(groupId);
|
||||
group1.setCompileId(baseIpCfg.getCompileId());
|
||||
group1.setAuditTime(baseIpCfg.getAuditTime());
|
||||
group1.setIsValid(baseCfg.getIsValid());
|
||||
groupRelationList.add(group1);
|
||||
}
|
||||
GroupCfg group1 = new GroupCfg();
|
||||
group1.setGroupId(ConfigServiceUtil.getId(2, 1).get(0));
|
||||
group1.setCompileId(baseIpCfg.getCompileId());
|
||||
group1.setAuditTime(baseCfg.getAuditTime());
|
||||
group1.setIsValid(baseCfg.getIsValid());
|
||||
groupRelationList.add(group1);
|
||||
NumBoundaryCfg numCfg = new NumBoundaryCfg();
|
||||
numCfg.setLowBoundary(baseIpCfg.getProtocolId());
|
||||
numCfg.setUpBoundary(baseIpCfg.getProtocolId());
|
||||
numCfg.setRegionId(ConfigServiceUtil.getId(3, 1).get(0));
|
||||
numCfg.setAuditTime(baseCfg.getAuditTime());
|
||||
numCfg.setGroupId(groupId);
|
||||
numCfg.setGroupId(group1.getGroupId());
|
||||
numCfg.setCfgType(baseIpCfg.getCfgType());
|
||||
cfg.setIsValid(baseCfg.getIsValid());
|
||||
numRegionList.add(numCfg);
|
||||
@@ -324,16 +320,15 @@ public abstract class BaseService {
|
||||
|
||||
}else if(cfgType==2 || cfgType==3){
|
||||
for(int i=0;i<srcList.size();i++){
|
||||
//一条业务配置创建一个分组
|
||||
GroupCfg group = new GroupCfg();
|
||||
StringCfg cfg = new StringCfg();
|
||||
BeanUtils.copyProperties(srcList.get(i), cfg);
|
||||
if(!cfg.getCfgType().equals(regionValue)){
|
||||
group.setGroupId(ConfigServiceUtil.getId(2, 1).get(0));
|
||||
group.setCompileId(baseCfg.getCompileId());
|
||||
group.setAuditTime(baseCfg.getAuditTime());
|
||||
group.setIsValid(baseCfg.getIsValid());
|
||||
groupRelationList.add(group);
|
||||
}
|
||||
group.setGroupId(ConfigServiceUtil.getId(2, 1).get(0));
|
||||
group.setCompileId(baseCfg.getCompileId());
|
||||
group.setAuditTime(baseCfg.getAuditTime());
|
||||
group.setIsValid(baseCfg.getIsValid());
|
||||
groupRelationList.add(group);
|
||||
cfg.setGroupId(group.getGroupId());
|
||||
cfg.setRegionId(ConfigServiceUtil.getId(3, 1).get(0));
|
||||
cfg.setAuditTime(baseCfg.getAuditTime());
|
||||
@@ -341,20 +336,18 @@ public abstract class BaseService {
|
||||
//处理配置关键字转译
|
||||
cfg.setCfgKeywords(keywordsEscape(cfg.getCfgKeywords()));
|
||||
dstList.add(cfg);
|
||||
regionValue = cfg.getCfgType();
|
||||
}
|
||||
}else if(cfgType==4){
|
||||
for(int i=0;i<srcList.size();i++){
|
||||
//一条业务配置创建一个分组
|
||||
com.nis.domain.maat.MaatCfg.NumBoundaryCfg cfg = new com.nis.domain.maat.MaatCfg.NumBoundaryCfg();
|
||||
BeanUtils.copyProperties(srcList.get(i), cfg);
|
||||
GroupCfg group = new GroupCfg();
|
||||
if(!cfg.getCfgType().equals(regionValue)){
|
||||
group.setGroupId(ConfigServiceUtil.getId(2, 1).get(0));
|
||||
group.setCompileId(baseCfg.getCompileId());
|
||||
group.setAuditTime(baseCfg.getAuditTime());
|
||||
group.setIsValid(baseCfg.getIsValid());
|
||||
groupRelationList.add(group);
|
||||
}
|
||||
group.setGroupId(ConfigServiceUtil.getId(2, 1).get(0));
|
||||
group.setCompileId(baseCfg.getCompileId());
|
||||
group.setAuditTime(baseCfg.getAuditTime());
|
||||
group.setIsValid(baseCfg.getIsValid());
|
||||
groupRelationList.add(group);
|
||||
cfg.setGroupId(group.getGroupId());
|
||||
cfg.setRegionId(ConfigServiceUtil.getId(3, 1).get(0));
|
||||
cfg.setAuditTime(baseCfg.getAuditTime());
|
||||
@@ -363,16 +356,15 @@ public abstract class BaseService {
|
||||
}
|
||||
}else if(cfgType==5){
|
||||
for(int i=0;i<srcList.size();i++){
|
||||
//一条业务配置创建一个分组
|
||||
com.nis.domain.maat.MaatCfg.DigestCfg cfg = new com.nis.domain.maat.MaatCfg.DigestCfg();
|
||||
BeanUtils.copyProperties(srcList.get(i), cfg);
|
||||
GroupCfg group = new GroupCfg();
|
||||
if(!cfg.getCfgType().equals(regionValue)){
|
||||
group.setGroupId(ConfigServiceUtil.getId(2, 1).get(0));
|
||||
group.setCompileId(baseCfg.getCompileId());
|
||||
group.setAuditTime(baseCfg.getAuditTime());
|
||||
group.setIsValid(baseCfg.getIsValid());
|
||||
groupRelationList.add(group);
|
||||
}
|
||||
group.setGroupId(ConfigServiceUtil.getId(2, 1).get(0));
|
||||
group.setCompileId(baseCfg.getCompileId());
|
||||
group.setAuditTime(baseCfg.getAuditTime());
|
||||
group.setIsValid(baseCfg.getIsValid());
|
||||
groupRelationList.add(group);
|
||||
cfg.setGroupId(group.getGroupId());
|
||||
cfg.setRegionId(ConfigServiceUtil.getId(3, 1).get(0));
|
||||
cfg.setAuditTime(baseCfg.getAuditTime());
|
||||
|
||||
Reference in New Issue
Block a user