voip 拆分为VoIP IP跟VoIP Account

This commit is contained in:
zhanghongqing
2018-08-20 11:35:07 +08:00
parent a8aebd9e23
commit 26d4ed4a9c
10 changed files with 2092 additions and 704 deletions

View File

@@ -20,6 +20,8 @@ import com.nis.domain.configuration.AvVoipIpCfg;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.NtcSubscribeIdCfg;
import com.nis.domain.maat.MaatCfg;
import com.nis.domain.maat.ToMaatBean;
import com.nis.domain.maat.ToMaatResult;
@@ -35,6 +37,7 @@ import com.nis.util.StringUtil;
import com.nis.util.StringUtils;
import com.nis.web.dao.configuration.AreaIpCfgDao;
import com.nis.web.dao.configuration.AvContentCfgDao;
import com.nis.web.dao.configuration.StringCfgDao;
import com.nis.web.security.UserUtils;
import com.nis.web.service.BaseService;
@@ -51,6 +54,8 @@ public class AvContentCfgService extends BaseService{
protected AvContentCfgDao avContentCfgDao;
@Autowired
protected AreaIpCfgDao areaIpCfgDao;
@Autowired
protected StringCfgDao stringCfgDao;
/********************************voip业务*********************************/
@@ -67,6 +72,19 @@ public class AvContentCfgService extends BaseService{
page.setList(list);
return page;
}
/**
* 查询account分页数据
* @param page 分页对象
* @param entity
* @return
*/
public Page<CfgIndexInfo> findAccountPage(Page<CfgIndexInfo> page, CfgIndexInfo entity) {
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
entity.setPage(page);
List<CfgIndexInfo> list=avContentCfgDao.findAccountList(entity);
page.setList(list);
return page;
}
/**
* 根据索引表信息获取voipIpCfg信息
* @param entity
@@ -83,199 +101,242 @@ public class AvContentCfgService extends BaseService{
public List<AvVoipAccountCfg> getVoipAccountCfgList(CfgIndexInfo entity) {
return avContentCfgDao.findVoipAccountCfgList(entity);
}
/**
* 公共订阅关键字SubscribeId
* @param cfgIndexInfo
* @return
*/
public List<NtcSubscribeIdCfg> getSubscribeIdCfgList(CfgIndexInfo entity) {
return avContentCfgDao.findSubscribeIdCfgList(entity);
}
/**
* 根据索引表信息获取voipAccountCfg信息
* @param entity
* @return
*/
public CfgIndexInfo getCfgIndexInfo(CfgIndexInfo entity) {
CfgIndexInfo cfg=avContentCfgDao.getCfgIndexInfo(entity);
List<NtcSubscribeIdCfg> ntcSubscribeList=getSubscribeIdCfgList(entity);
if(ntcSubscribeList ==null || ntcSubscribeList.size() <=0){
ntcSubscribeList.add(new NtcSubscribeIdCfg());
}
List<AvVoipIpCfg> voipIps=getVoipIpCfgList(entity);
if(voipIps ==null || voipIps.size() <=0){
voipIps.add(new AvVoipIpCfg());
}
cfg.setNtcSubscribeIdCfgList(ntcSubscribeList);
cfg.setVoipIps(voipIps);
return cfg;
}
public CfgIndexInfo getCfgIndexInfo2(CfgIndexInfo entity) {
CfgIndexInfo cfg=avContentCfgDao.getCfgIndexInfo(entity);
List<AvVoipAccountCfg> voipAccounts=new ArrayList<>();
voipAccounts=getVoipAccountCfgList(entity);
if(voipAccounts ==null || voipAccounts.size() <=0){
voipAccounts.add(new AvVoipAccountCfg());
}
List<AvVoipIpCfg> voipIps=new ArrayList<>();
voipIps=getVoipIpCfgList(entity);
if(voipIps ==null || voipIps.size() <=0){
voipIps.add(new AvVoipIpCfg());
List<NtcSubscribeIdCfg> ntcSubscribeList=getSubscribeIdCfgList(entity);
if(ntcSubscribeList ==null || ntcSubscribeList.size() <=0){
ntcSubscribeList.add(new NtcSubscribeIdCfg());
}
cfg.setVoipAccounts(voipAccounts);
cfg.setVoipIps(voipIps);
cfg.setNtcSubscribeIdCfgList(ntcSubscribeList);
return cfg;
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void saveOrUpdateAvVoip(CfgIndexInfo entity,String voipIpIds,String voipAccountIds,String areaCfgIds){
Date createTime=new Date();
public void saveOrUpdateAvVoip(CfgIndexInfo entity){
//设置区域运营商信息
setAreaEffectiveIds(entity);
entity.setIsValid(0);//无效
entity.setIsAudit(0);//未审核
if(entity.getCfgId()==null){
Integer compileId = 0;
try {
List<Integer> idList = ConfigServiceUtil.getId(1, 1);
if(idList!=null && idList.size()>0){
compileId = idList.get(0);
}
entity.setCompileId(compileId);
entity.setCreateTime(new Date());
entity.setCreatorId(entity.getCurrentUser().getId());
avContentCfgDao.insertCfgIndexInfo(entity);
if(entity.getVoipIps()!=null){
for (AvVoipIpCfg voipIp : entity.getVoipIps()) {
entity.setVoipIp(voipIp);
avContentCfgDao.insertAvVoipIp(entity);
}
}
if(entity.getNtcSubscribeIdCfgList()!=null){
for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
entity.setNtcSubscribeIdCfg(cfg);
avContentCfgDao.insertAvVoipKeywordCfg(entity);
}
}
}
//保存区域IP信息
if(entity.getAreaCfg()!=null){
for(AreaIpCfg cfg:entity.getAreaCfg()){
cfg.initDefaultValue();
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
} catch (Exception e) {
e.printStackTrace();
logger.info("获取编译ID出错");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
}
}else{
entity.setEditTime(new Date());
entity.setEditorId(entity.getCurrentUser().getId());
avContentCfgDao.updateCfgIndexInfo(entity);
//无效子配置后,再新增子配置
avContentCfgDao.deleteAvVoipIp(entity);
avContentCfgDao.deleteAvVoipKeywordCfg(entity);
AreaIpCfg area = new AreaIpCfg();
area.setCompileId(entity.getCompileId());
area.setFunctionId(entity.getFunctionId());
areaIpCfgDao.deleteAreaIpCfg(area);
entity.setCreateTime(new Date());
entity.setCreatorId(entity.getCurrentUser().getId());
if(entity.getVoipIps()!=null&&entity.getVoipIps().size()>0){
for (AvVoipIpCfg voipIp : entity.getVoipIps()) {
entity.setVoipIp(voipIp);
avContentCfgDao.insertAvVoipIp(entity);
}
}
if(entity.getNtcSubscribeIdCfgList()!=null){
for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
entity.setNtcSubscribeIdCfg(cfg);
avContentCfgDao.insertAvVoipKeywordCfg(entity);
}
}
}
//保存区域IP信息
if(entity.getAreaCfg()!=null){
for(AreaIpCfg cfg:entity.getAreaCfg()){
cfg.initDefaultValue();
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"});
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
}
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void saveOrUpdateAvVoipAccount(CfgIndexInfo entity){
//设置区域运营商信息
setAreaEffectiveIds(entity);
//新增
entity.setIsValid(0);//无效
entity.setIsAudit(0);//未审核
if(entity.getCfgId()==null){
entity.setCreatorId(UserUtils.getUser().getId());
entity.setCreateTime(createTime);
entity.setIsValid(0);
entity.setIsAudit(0);
//调用服务接口获取compileId
List<Integer> compileIds = new ArrayList<Integer>();
Integer compileId = 0;
try {
compileIds = ConfigServiceUtil.getId(1,1);
List<Integer> idList = ConfigServiceUtil.getId(1, 1);
if(idList!=null && idList.size()>0){
compileId = idList.get(0);
}
entity.setCompileId(compileId);
entity.setCreateTime(new Date());
entity.setCreatorId(entity.getCurrentUser().getId());
avContentCfgDao.insertCfgIndexInfo(entity);
if(entity.getVoipAccounts()!=null&&entity.getVoipAccounts().size()>0){
for(AvVoipAccountCfg voipAccount : entity.getVoipAccounts()){
entity.setVoipAccount(voipAccount);
avContentCfgDao.insertAvVoipAccountCfg(entity);
}
}
if(entity.getNtcSubscribeIdCfgList()!=null){
for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
entity.setNtcSubscribeIdCfg(cfg);
avContentCfgDao.insertAvVoipKeywordCfg(entity);
}
}
}
//保存区域IP信息
if(entity.getAreaCfg()!=null){
for(AreaIpCfg cfg:entity.getAreaCfg()){
cfg.initDefaultValue();
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
} catch (Exception e) {
e.printStackTrace();
logger.info("获取编译ID出错");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
}
if(compileIds != null && compileIds.size() >0 && compileIds.get(0) != 0){
entity.setCompileId(compileIds.get(0));
//保存avVoipIp
if(entity.getVoipIps() != null && entity.getVoipIps().size() > 0){
for (AvVoipIpCfg voipIp : entity.getVoipIps()) {
entity.setVoipIp(voipIp);
avContentCfgDao.insertAvVoipIp(entity);
}
}
//保存avVoipAccount
if(entity.getVoipAccounts() != null && entity.getVoipAccounts().size() > 0){
for (AvVoipAccountCfg voipAccount : entity.getVoipAccounts()) {
entity.setVoipAccount(voipAccount);
avContentCfgDao.insertAvVoipAccount(entity);
}
}
//保存区域IP信息
if(entity.getAreaCfg()!=null&&entity.getAreaCfg().size()>0){
for (AreaIpCfg areaIpCfg : entity.getAreaCfg()) {
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode","cfgType"});
areaIpCfgDao.saveAreaIpCfg(areaIpCfg);
}
}
//保存cfgIndexInfo
avContentCfgDao.insertCfgIndexInfo(entity);
}else{
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
}
//修改
}else{
Date editTime=new Date();
entity.setIsValid(0);
entity.setIsAudit(0);
voipIpIds=!StringUtil.isEmpty(voipIpIds)? voipIpIds+",":"";
voipAccountIds=!StringUtil.isEmpty(voipAccountIds)? voipAccountIds+",":"";
areaCfgIds=!StringUtil.isEmpty(areaCfgIds)? ","+areaCfgIds:"";
//判断voip信息为新增还是修改清楚voipIpIds修改的voipId记录剩下即为需要删除的voipId
if(!StringUtil.isEmpty(entity.getVoipIps())){
for (AvVoipIpCfg voipIp : entity.getVoipIps()) {
if(!StringUtil.isEmpty(voipIp.getCfgId())){
if(voipIpIds.contains(","+voipIp.getCfgId()+",")){
voipIpIds=voipIpIds.replace(voipIp.getCfgId()+",", "");
}
//修改
entity.setEditorId(UserUtils.getUser().getId());
entity.setEditTime(editTime);
entity.setVoipIp(voipIp);
avContentCfgDao.updateAvVoipIp(entity);
}else{
//新增
entity.setCreatorId(UserUtils.getUser().getId());
entity.setCreateTime(createTime);
entity.setVoipIp(voipIp);
avContentCfgDao.insertAvVoipIp(entity);
}
}
}
if(!StringUtil.isEmpty(entity.getVoipAccounts())){
for (AvVoipAccountCfg voipAccount : entity.getVoipAccounts()) {
if(!StringUtil.isEmpty(voipAccount.getCfgId())){
if(voipAccountIds.contains(","+voipAccount.getCfgId()+",")){
voipAccountIds=voipAccountIds.replace(voipAccount.getCfgId()+",", "");
}
//修改
entity.setEditorId(UserUtils.getUser().getId());
entity.setEditTime(editTime);
entity.setVoipAccount(voipAccount);
avContentCfgDao.updateAvVoipAccount(entity);
}else{
//新增
entity.setCreatorId(UserUtils.getUser().getId());
entity.setCreateTime(createTime);
entity.setVoipAccount(voipAccount);
avContentCfgDao.insertAvVoipAccount(entity);
}
}
}
if(!StringUtil.isEmpty(entity.getAreaCfg())){
for (AreaIpCfg areaIpCfg : entity.getAreaCfg()) {
if(!StringUtil.isEmpty(areaIpCfg.getCfgId())){
if(areaCfgIds.contains(","+areaIpCfg.getCfgId()+",")){
areaCfgIds=areaCfgIds.replace(areaIpCfg.getCfgId()+",", "");
}
//修改
entity.setEditorId(UserUtils.getUser().getId());
entity.setEditTime(editTime);
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode","cfgType","cfgId"});
areaIpCfgDao.updateAreaIpCfg(areaIpCfg);
}else{
//新增
entity.setCreatorId(UserUtils.getUser().getId());
entity.setCreateTime(createTime);
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
,"cfgType"
,"ipType"
,"ipPattern"
,"srcIpAddress"
,"portPattern"
,"srcPort"
,"destPort"
,"protocol"
,"direction"
,"protocolId"
});
areaIpCfgDao.saveAreaIpCfg(areaIpCfg);
}
}
}
//delete 真是删除voipAccount信息
if(!StringUtil.isEmpty(voipAccountIds.replaceAll(",", ""))){
voipAccountIds=voipAccountIds.substring(1,voipAccountIds.length());
for (String cfgId : voipAccountIds.split(",")) {
CfgIndexInfo cfg=new CfgIndexInfo();
AvVoipAccountCfg voipAccountCfg=new AvVoipAccountCfg();
voipAccountCfg.setCfgId(Long.parseLong(cfgId));
cfg.setVoipAccount(voipAccountCfg);
avContentCfgDao.deleteAvVoipAccount(cfg);
}
}
//delete 真是删除voipAccount信息
if(!StringUtil.isEmpty(voipIpIds.replaceAll(",", ""))){
voipIpIds=voipIpIds.substring(1,voipIpIds.length());
for (String cfgId : voipIpIds.split(",")) {
CfgIndexInfo cfg=new CfgIndexInfo();
AvVoipIpCfg voipIpCfg=new AvVoipIpCfg();
voipIpCfg.setCfgId(Long.parseLong(cfgId));
cfg.setVoipIp(voipIpCfg);
avContentCfgDao.deleteAvVoipIp(cfg);
}
}
//delete 真是删除areaIpCfg信息
if(!StringUtil.isEmpty(areaCfgIds.replaceAll(",", ""))){
areaCfgIds=areaCfgIds.substring(1,areaCfgIds.length());
for (String cfgId : areaCfgIds.split(",")) {
CfgIndexInfo cfg=new CfgIndexInfo();
AreaIpCfg areaIpCfg=new AreaIpCfg();
areaIpCfg.setCfgId(Long.parseLong(cfgId));
areaIpCfgDao.deleteAreaIpCfgByCfgId(areaIpCfg);
}
}
//修改
entity.setEditorId(UserUtils.getUser().getId());
entity.setEditTime(editTime);
entity.setEditTime(new Date());
entity.setEditorId(entity.getCurrentUser().getId());
avContentCfgDao.updateCfgIndexInfo(entity);
//无效子配置后,再新增子配置
avContentCfgDao.deleteAvVoipKeywordCfg(entity);
avContentCfgDao.deleteAvVoipAccountCfg(entity);
AreaIpCfg area = new AreaIpCfg();
area.setCompileId(entity.getCompileId());
area.setFunctionId(entity.getFunctionId());
areaIpCfgDao.deleteAreaIpCfg(area);
entity.setCreateTime(new Date());
entity.setCreatorId(entity.getCurrentUser().getId());
if(entity.getVoipAccounts()!=null&&entity.getVoipAccounts().size()>0){
for (AvVoipAccountCfg voipAccount : entity.getVoipAccounts()) {
entity.setVoipAccount(voipAccount);
avContentCfgDao.insertAvVoipAccountCfg(entity);
}
}
if(entity.getNtcSubscribeIdCfgList()!=null){
for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
entity.setNtcSubscribeIdCfg(cfg);
avContentCfgDao.insertAvVoipKeywordCfg(entity);
}
}
}
//保存区域IP信息
if(entity.getAreaCfg()!=null){
for(AreaIpCfg cfg:entity.getAreaCfg()){
cfg.initDefaultValue();
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"});
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
}
}
/**
*
* @param isAudit
* @param isValid
* @param ids compileIds
*/
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void updateAvVoipValid(Integer isAudit,Integer isValid,String compileIds,Integer functionId){
CfgIndexInfo entity = new CfgIndexInfo();
String[] idArray = compileIds.split(",");
for(String id :idArray){
entity.setCompileId(Integer.parseInt(id));
entity.setFunctionId(functionId);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setEditorId(UserUtils.getUser().getId());
entity.setEditTime(new Date());
avContentCfgDao.updateAvVoipIp(entity);
avContentCfgDao.updateAvVoipKeywordCfgt(entity);
avContentCfgDao.updateCfgIndexInfo(entity);
AreaIpCfg areaIpCfg=new AreaIpCfg();
BeanUtils.copyProperties(entity, areaIpCfg);
areaIpCfgDao.updateAreaIpCfgValid(areaIpCfg);
}
}
/**
@@ -285,9 +346,9 @@ public class AvContentCfgService extends BaseService{
* @param ids compileIds
*/
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void updateAvVoipValid(Integer isAudit,Integer isValid,String ids,Integer functionId){
public void updateAvVoipAccountValid(Integer isAudit,Integer isValid,String compileIds,Integer functionId){
CfgIndexInfo entity = new CfgIndexInfo();
String[] idArray = ids.split(",");
String[] idArray = compileIds.split(",");
for(String id :idArray){
entity.setCompileId(Integer.parseInt(id));
entity.setFunctionId(functionId);
@@ -295,8 +356,8 @@ public class AvContentCfgService extends BaseService{
entity.setIsValid(isValid);
entity.setEditorId(UserUtils.getUser().getId());
entity.setEditTime(new Date());
avContentCfgDao.updateAvVoipIp(entity);
avContentCfgDao.updateAvVoipAccount(entity);
avContentCfgDao.updateAvVoipKeywordCfgt(entity);
avContentCfgDao.updateCfgIndexInfo(entity);
AreaIpCfg areaIpCfg=new AreaIpCfg();
BeanUtils.copyProperties(entity, areaIpCfg);
@@ -316,7 +377,7 @@ public class AvContentCfgService extends BaseService{
List<CfgIndexInfo> list = new ArrayList();
List<AvVoipIpCfg> voipIpList = new ArrayList();
List<AvVoipAccountCfg> voipAccountList = new ArrayList();
List <NtcSubscribeIdCfg> ntcList = new ArrayList();
List<AreaIpCfg> areaIpCfgList = new ArrayList();
CfgIndexInfo searchCfg=new CfgIndexInfo();
@@ -328,16 +389,16 @@ public class AvContentCfgService extends BaseService{
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(auditTime);
avContentCfgDao.updateAvVoipIp(entity);
avContentCfgDao.updateAvVoipAccount(entity);
avContentCfgDao.updateAvVoipKeywordCfgt(entity);
avContentCfgDao.updateCfgIndexInfo(entity);
AreaIpCfg areaIpCfg=new AreaIpCfg();
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode","cfgType","cfgId"});
areaIpCfgDao.updateAreaIpCfg(areaIpCfg);
voipIpList=avContentCfgDao.findVoipIpCfgList(entity);
voipAccountList=avContentCfgDao.findVoipAccountCfgList(entity);
ntcList=avContentCfgDao.findSubscribeIdCfgList(entity);
areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
ToMaatBean maatBean = new ToMaatBean();
@@ -357,8 +418,122 @@ public class AvContentCfgService extends BaseService{
ipRegionList=ipMap.get("dstList");
}
if(!StringUtil.isEmpty(voipAccountList)){
Map<String,List> accountMap = cfgConvert(strRegionList,voipAccountList,2,entity,groupRelationList);
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(areaIpCfgList)){
Map<String,List> areaMap = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList);
groupRelationList=areaMap.get("groupList");
areaIpRegionList=areaMap.get("dstList");
}
}
//构造提交综合服务参数格式,一条配置提交一次综合服务
if(isAudit==1){
maatCfg.initDefaultValue();
BeanUtils.copyProperties(entity, maatCfg);
maatCfg.setAction(entity.getAction());
maatCfg.setAuditTime(auditTime);
maatCfg.setIpRegionList(ipRegionList);
maatCfg.setStrRegionList(strRegionList);
maatCfg.setNumRegionList(numRegionList);
maatCfg.setDigestRegionList(digestRegionList);
maatCfg.setGroupRelationList(groupRelationList);
maatCfg.setGroupNum(groupRelationList.size());
maatCfg.setAreaIpRegionList(areaIpRegionList);
maatCfg.setIsValid(entity.getIsValid());
configCompileList.add(maatCfg);
maatBean.setConfigCompileList(configCompileList);
maatBean.setAuditTime(auditTime);
maatBean.setCreatorName(entity.getCurrentUser().getName());
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.INSERT_ACTION);
//调用服务接口下发配置数据
String json=gsonToJson(maatBean);
logger.info("voip IP配置下发配置参数"+json);
//调用服务接口下发配置
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
logger.info("voip IP配置下发响应信息"+result.getMsg());
}else if(isAudit==3){
maatCfg.setCompileId(entity.getCompileId());
maatCfg.setServiceId(entity.getServiceId());
maatCfg.setIsValid(0);//无效
configCompileList.add(maatCfg);
maatBean.setConfigCompileList(configCompileList);
maatBean.setAuditTime(auditTime);
maatBean.setCreatorName(entity.getCurrentUser().getName());
maatBean.setVersion(Constants.MAAT_VERSION);
maatBean.setOpAction(Constants.UPDATE_ACTION);
//调用服务接口取消配置
String json=gsonToJson(maatBean);
logger.info("voip IP配置下发配置参数"+json);
//调用服务接口下发配置
ToMaatResult result = ConfigServiceUtil.put(json,1);
logger.info("voip IP配置取消配置响应信息"+result.getMsg());
}
}
/********************************voip业务*********************************/
/**
*
* @param isAudit
* @param isValid
* @param ids 编译Id
* @param functionId
*/
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void auditAvVoipAccount(Integer isAudit,Integer isValid,Integer functionId,String compileId,Date auditTime){
CfgIndexInfo entity = new CfgIndexInfo();
List<CfgIndexInfo> list = new ArrayList();
List<AvVoipAccountCfg> accountList = new ArrayList();
List <NtcSubscribeIdCfg> ntcList = new ArrayList();
List<AreaIpCfg> areaIpCfgList = new ArrayList();
CfgIndexInfo searchCfg=new CfgIndexInfo();
searchCfg.setCompileId(Integer.parseInt(compileId));
entity = avContentCfgDao.getCfgIndexInfo(searchCfg);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(auditTime);
avContentCfgDao.updateAvVoipAccount(entity);
avContentCfgDao.updateAvVoipKeywordCfgt(entity);
avContentCfgDao.updateCfgIndexInfo(entity);
AreaIpCfg areaIpCfg=new AreaIpCfg();
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode","cfgType","cfgId"});
areaIpCfgDao.updateAreaIpCfg(areaIpCfg);
ntcList=avContentCfgDao.findSubscribeIdCfgList(entity);
accountList=avContentCfgDao.findVoipAccountCfgList(entity);
areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
ToMaatBean maatBean = new ToMaatBean();
MaatCfg maatCfg = new MaatCfg();
List<MaatCfg> configCompileList = new ArrayList();
List<GroupCfg> groupRelationList = new ArrayList();
List<IpCfg> ipRegionList = new ArrayList();
List<StringCfg> strRegionList = new ArrayList();
List<NumBoundaryCfg> numRegionList = new ArrayList();
List<DigestCfg> digestRegionList = new ArrayList();
List<IpCfg> areaIpRegionList = new ArrayList();
if(isAudit==1){
if(!StringUtil.isEmpty(ntcList)){
Map<String,List> accountMap = cfgConvert(strRegionList,ntcList,2,entity,groupRelationList);
groupRelationList=accountMap.get("groupList");
strRegionList=accountMap.get("dstList");
}
if(!StringUtil.isEmpty(accountList)){
Map<String,List> accountMap = cfgConvert(strRegionList,accountList,2,entity,groupRelationList);
groupRelationList=accountMap.get("groupList");
strRegionList=accountMap.get("dstList");
}
@@ -391,11 +566,12 @@ public class AvContentCfgService extends BaseService{
maatBean.setOpAction(Constants.INSERT_ACTION);
//调用服务接口下发配置数据
String json=gsonToJson(maatBean);
logger.info("voip配置下发配置参数"+json);
logger.info("voip Account配置下发配置参数:"+json);
System.err.println(json);
//调用服务接口下发配置
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
logger.info("voip配置下发响应信息"+result.getMsg());
logger.info("voip Account配置下发响应信息:"+result.getMsg());
}else if(isAudit==3){
maatCfg.setCompileId(entity.getCompileId());
maatCfg.setServiceId(entity.getServiceId());
@@ -408,10 +584,10 @@ public class AvContentCfgService extends BaseService{
maatBean.setOpAction(Constants.UPDATE_ACTION);
//调用服务接口取消配置
String json=gsonToJson(maatBean);
logger.info("voip配置下发配置参数"+json);
logger.info("voip Account配置下发配置参数:"+json);
//调用服务接口下发配置
ToMaatResult result = ConfigServiceUtil.put(json,1);
logger.info("voip配置取消配置响应信息"+result.getMsg());
logger.info("voip Account配置取消配置响应信息:"+result.getMsg());
}