协议-配置支持对某些用户的配置不经过审核直接生效的流程

This commit is contained in:
leijun
2019-04-16 14:34:05 +08:00
parent 36e990a247
commit bdcc2bb1b4
23 changed files with 572 additions and 158 deletions

View File

@@ -103,6 +103,10 @@ public class BgpCfgService extends CrudService<BgpCfgDao,CfgIndexInfo> {
public void saveBgpCfg(CfgIndexInfo entity){
//设置区域运营商信息
setAreaEffectiveIds(entity);
int isValid=0;
if(!StringUtil.isEmpty(entity.getIsValid()) && entity.getIsValid()==1) {
isValid=1;
}
entity.setIsValid(0);
entity.setIsAudit(0);
if(entity.getCfgId()==null){
@@ -166,6 +170,12 @@ public class BgpCfgService extends CrudService<BgpCfgDao,CfgIndexInfo> {
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
auditBgpCfg(entity, isValid,Constants.INSERT_ACTION);
}
}else{
entity.setEditorId(entity.getCurrentUser().getId());
entity.setEditTime(new Date());
@@ -227,6 +237,11 @@ public class BgpCfgService extends CrudService<BgpCfgDao,CfgIndexInfo> {
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
auditBgpCfg(entity, isValid,Constants.UPDATE_ACTION);
}
}
}
/**
@@ -292,12 +307,15 @@ public class BgpCfgService extends CrudService<BgpCfgDao,CfgIndexInfo> {
* @param isAudit
* @throws MaatConvertException
*/
public void auditBgpCfg(CfgIndexInfo entity,Integer isAudit) throws MaatConvertException{
public void auditBgpCfg(CfgIndexInfo entity,Integer isAudit,Integer opAction) throws MaatConvertException{
//修改数据库审核状态信息
entity.setTableName(CfgIndexInfo.getTablename());
entity.setIsAudit(isAudit);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
bgpCfgDao.auditCfg(entity);
bgpCfgDao.updateBgpAsCfg(entity);
bgpCfgDao.updateSubscribeIdCfg(entity);
//bgpCfgDao.updateSubscribeIdCfg(entity);
ToMaatBean maatBean = new ToMaatBean();
MaatCfg maatCfg = new MaatCfg();
List<MaatCfg> configCompileList = new ArrayList();
@@ -325,7 +343,7 @@ public class BgpCfgService extends CrudService<BgpCfgDao,CfgIndexInfo> {
}
}
if(entity.getNtcSubscribeIdCfgList()!=null && entity.getNtcSubscribeIdCfgList().size()>0){
/*if(entity.getNtcSubscribeIdCfgList()!=null && entity.getNtcSubscribeIdCfgList().size()>0){
NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(NtcSubscribeIdCfg.getTablename());
@@ -335,7 +353,7 @@ public class BgpCfgService extends CrudService<BgpCfgDao,CfgIndexInfo> {
groupRelationList=map.get("groupList");
strRegionList=map.get("dstList");
}
}
}*/
if(entity.getNtcBgpAsCfgList()!=null && entity.getNtcBgpAsCfgList().size()>0){
NtcBgpAsCfg cfg = new NtcBgpAsCfg();
@@ -393,7 +411,7 @@ public class BgpCfgService extends CrudService<BgpCfgDao,CfgIndexInfo> {
maatBean.setAuditTime(entity.getAuditTime());
maatBean.setCreatorName(entity.getCurrentUser().getName());
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.INSERT_ACTION);
maatBean.setOpAction(opAction);
//调用服务接口下发配置数据
String json=gsonToJson(maatBean);
logger.info("BGP配置下发配置参数"+json);