voip 新增功能

voip新增界面优化
This commit is contained in:
duandongmei
2018-05-23 17:34:40 +08:00
parent 67494ba358
commit 1175e0d3a5
9 changed files with 406 additions and 115 deletions

View File

@@ -10,6 +10,7 @@ import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -78,8 +79,11 @@ public class AvContentCfgService extends BaseService{
*/
public CfgIndexInfo getCfgIndexInfo(CfgIndexInfo entity) {
CfgIndexInfo cfg=avContentCfgDao.getCfgIndexInfo(entity);
cfg.setVoipAccounts(getVoipAccountCfgList(entity));
cfg.setVoipIps(getVoipIpCfgList(entity));
List<AvVoipAccountCfg> voipAccounts=getVoipAccountCfgList(entity);
List<AvVoipIpCfg> voipIps=getVoipIpCfgList(entity);
getVoipIpCfgList(entity);
cfg.setVoipAccounts(voipAccounts);
cfg.setVoipIps(voipIps);
return cfg;
}
@@ -142,4 +146,54 @@ public class AvContentCfgService extends BaseService{
}*/
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void saveOrUpdateAvVoip(CfgIndexInfo entity){
Date createTime=new Date();
//新增
if(entity.getCfgId()==null){
entity.setCreatorId(UserUtils.getUser().getId());
entity.setCreateTime(createTime);
//调用服务接口获取compileId
List<Integer> compileIds = new ArrayList<Integer>();
try {
//TODO 后期修改为动态获取
//compileIds = ConfigServiceUtil.getId(1,1);
compileIds.add((int)Math.floor(Math.random()*1000000+1));
} 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);
}
}
//保存cfgIndexInfo
avContentCfgDao.insertCfgIndexInfo(entity);
}else{
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
}
//修改
}else{
//entity.setEditorId(UserUtils.getUser().getId());
//entity.setEditTime(new Date());
//entity.setIsValid(0);
//entity.setIsAudit(0);
//avCfgDao.updateAvFileSample(entity);
}
}
}