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

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

@@ -195,6 +195,10 @@ public class AvContentCfgService extends BaseService{
public void saveOrUpdateAvVoip(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){
@@ -245,6 +249,12 @@ public class AvContentCfgService extends BaseService{
logger.info("获取编译ID出错");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
auditAvVoip(entity,entity.getIsAudit(), Constants.INSERT_ACTION);
}
}else{
entity.setEditTime(new Date());
@@ -293,6 +303,11 @@ public class AvContentCfgService extends BaseService{
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
if(isValid==1) {
entity.setIsAudit(1);
entity.setIsValid(1);
auditAvVoip(entity,entity.getIsAudit(), Constants.UPDATE_ACTION);
}
}
}
@@ -447,40 +462,15 @@ public class AvContentCfgService extends BaseService{
* @param functionId
*/
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void auditAvVoip(Integer isAudit,Integer isValid,Integer functionId,String id,Date auditTime){
CfgIndexInfo entity = new CfgIndexInfo();
List<CfgIndexInfo> list = new ArrayList();
//List<AvVoipIpCfg> voipIpList = new ArrayList();
List<IpPortCfg> ipPortList =new ArrayList();
List <NtcSubscribeIdCfg> ntcList = new ArrayList();
List<AvVoipAccountCfg> accountList = new ArrayList();
List<AreaIpCfg> areaIpCfgList = new ArrayList();
CfgIndexInfo searchCfg=new CfgIndexInfo();
searchCfg.setCfgId(Long.parseLong(id));
entity = avContentCfgDao.getCfgIndexInfo(searchCfg);
public void auditAvVoip(CfgIndexInfo entity,Integer isAudit,Integer opAction){
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(auditTime);
avContentCfgDao.updateAvVoipIp(entity);
avContentCfgDao.updateAvVoipAccount(entity);
avContentCfgDao.updateAvVoipKeywordCfgt(entity);
avContentCfgDao.updateCfgIndexInfo(entity);
entity.setTableName(CfgIndexInfo.getTablename());
entity.setAuditTime(new Date());
avContentCfgDao.updateCfgValid(entity);
AreaIpCfg areaIpCfg=new AreaIpCfg();
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode","cfgType","cfgId"});
areaIpCfgDao.updateAreaIpCfg(areaIpCfg);
//voipIpList=avContentCfgDao.findVoipIpCfgList(entity);
ipPortList = avContentCfgDao.getIpPortList(entity);
accountList=avContentCfgDao.findVoipAccountCfgList(entity);
ntcList=stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity);
areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
ToMaatBean maatBean = new ToMaatBean();
MaatCfg maatCfg = new MaatCfg();
List<MaatCfg> configCompileList = new ArrayList();
@@ -492,45 +482,65 @@ public class AvContentCfgService extends BaseService{
List<IpCfg> areaIpRegionList = new ArrayList();
if(isAudit==1){
/* if(!StringUtil.isEmpty(voipIpList)){
Map<String,List> ipMap = cfgConvert(ipRegionList,voipIpList,1,entity,groupRelationList);
groupRelationList=ipMap.get("groupList");
ipRegionList=ipMap.get("dstList");
}*/
if(!StringUtil.isEmpty(ipPortList)){
Map<String,List> ipMap = cfgConvert(ipRegionList,ipPortList,1,entity,groupRelationList);
if(entity.getNtcSubscribeIdCfgList()!=null && entity.getNtcSubscribeIdCfgList().size()>0){
NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(NtcSubscribeIdCfg.getTablename());
avContentCfgDao.updateCfgValid(cfg);
if(isAudit==1){
Map<String,List> ntcMap = cfgConvert(strRegionList,entity.getNtcSubscribeIdCfgList(),2,entity,groupRelationList);
groupRelationList=ntcMap.get("groupList");
strRegionList=ntcMap.get("dstList");
}
}
if(entity.getVoipAccounts()!=null && entity.getVoipAccounts().size()>0){
AvVoipAccountCfg cfg = new AvVoipAccountCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(AvVoipAccountCfg.getTablename());
avContentCfgDao.updateCfgValid(cfg);
if(isAudit==1){
Map<String,List> urlMap = cfgConvert(strRegionList,entity.getVoipAccounts(),2,entity,groupRelationList);
groupRelationList=urlMap.get("groupList");
strRegionList=urlMap.get("dstList");
}
}
if(!StringUtil.isEmpty(entity.getIpPortList())){
IpPortCfg cfg = new IpPortCfg();
BeanUtils.copyProperties(entity, cfg, new String[] { "cfgId" });
cfg.setTableName(IpPortCfg.getTablename());
avContentCfgDao.updateCfgValid(cfg);
if(isAudit==1){
Map<String,List> ipMap = cfgConvert(ipRegionList,entity.getIpPortList(),1,entity,groupRelationList);
groupRelationList=ipMap.get("groupList");
ipRegionList=ipMap.get("dstList");
if(ipMap.get("numRegionList")!=null){
numRegionList.addAll(ipMap.get("numRegionList"));
}
}
if(!StringUtil.isEmpty(ntcList)){
Map<String,List> ntcMap = cfgConvert(strRegionList,ntcList,2,entity,groupRelationList);
groupRelationList=ntcMap.get("groupList");
strRegionList=ntcMap.get("dstList");
}
if(!StringUtil.isEmpty(accountList)){
Map<String,List> accountMap = cfgConvert(strRegionList,accountList,2,entity,groupRelationList);
groupRelationList=accountMap.get("groupList");
strRegionList=accountMap.get("dstList");
}
if(!StringUtil.isEmpty(areaIpCfgList)){
Map<String,List> areaMap = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList);
groupRelationList=areaMap.get("groupList");
areaIpRegionList=areaMap.get("dstList");
}
}
//保存区域IP信息
List<AreaIpCfg> areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
if(!StringUtil.isEmpty(areaIpCfgList)){
AreaIpCfg cfg = new AreaIpCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(AreaIpCfg.getTablename());
avContentCfgDao.updateCfgValid(cfg);
if(isAudit==1){
Map<String,List> map = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList);
groupRelationList=map.get("groupList");
areaIpRegionList=map.get("dstList");
}
}
//构造提交综合服务参数格式,一条配置提交一次综合服务
if(isAudit==1){
maatCfg.initDefaultValue();
BeanUtils.copyProperties(entity, maatCfg);
maatCfg.setAction(entity.getAction());
maatCfg.setAuditTime(auditTime);
maatCfg.setAuditTime(new Date());
maatCfg.setIpRegionList(ipRegionList);
maatCfg.setStrRegionList(strRegionList);
maatCfg.setNumRegionList(numRegionList);
@@ -541,10 +551,10 @@ public class AvContentCfgService extends BaseService{
maatCfg.setIsValid(entity.getIsValid());
configCompileList.add(maatCfg);
maatBean.setConfigCompileList(configCompileList);
maatBean.setAuditTime(auditTime);
maatBean.setAuditTime(new Date());
maatBean.setCreatorName(entity.getCurrentUser().getName());
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.INSERT_ACTION);
maatBean.setOpAction(opAction);
//调用服务接口下发配置数据
String json=gsonToJson(maatBean);
logger.info("voip 配置下发配置参数:"+json);
@@ -558,7 +568,7 @@ public class AvContentCfgService extends BaseService{
maatCfg.setIsValid(0);//无效
configCompileList.add(maatCfg);
maatBean.setConfigCompileList(configCompileList);
maatBean.setAuditTime(auditTime);
maatBean.setAuditTime(new Date());
maatBean.setCreatorName(entity.getCurrentUser().getName());
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.UPDATE_ACTION);