voip修改和删除功能

This commit is contained in:
duandongmei
2018-05-24 16:04:16 +08:00
parent 50663761c4
commit 4980354706
6 changed files with 486 additions and 73 deletions

View File

@@ -16,12 +16,14 @@ import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.nis.domain.Page;
import com.nis.domain.configuration.AvFileSampleCfg;
import com.nis.domain.configuration.AvSignSampleCfg;
import com.nis.domain.configuration.AvVoipAccountCfg;
import com.nis.domain.configuration.AvVoipIpCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.FileUtils;
import com.nis.util.StringUtil;
import com.nis.web.dao.FunctionRegionDictDao;
import com.nis.web.dao.FunctionServiceDictDao;
import com.nis.web.dao.configuration.AvCfgDao;
@@ -50,7 +52,7 @@ public class AvContentCfgService extends BaseService{
* @return
*/
public Page<CfgIndexInfo> findPage(Page<CfgIndexInfo> page, CfgIndexInfo entity) {
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"a"));
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
entity.setPage(page);
List<CfgIndexInfo> list=avContentCfgDao.findVoipList(entity);
page.setList(list);
@@ -155,12 +157,14 @@ public class AvContentCfgService extends BaseService{
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void saveOrUpdateAvVoip(CfgIndexInfo entity){
public void saveOrUpdateAvVoip(CfgIndexInfo entity,String voipIpIds,String voipAccountIds){
Date createTime=new Date();
//新增
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>();
try {
@@ -196,12 +200,110 @@ public class AvContentCfgService extends BaseService{
//修改
}else{
//entity.setEditorId(UserUtils.getUser().getId());
//entity.setEditTime(new Date());
//entity.setIsValid(0);
//entity.setIsAudit(0);
//avCfgDao.updateAvFileSample(entity);
Date editTime=new Date();
entity.setIsValid(0);
entity.setIsAudit(0);
voipIpIds=!StringUtil.isEmpty(voipIpIds)? voipIpIds+",":"";
voipAccountIds=!StringUtil.isEmpty(voipAccountIds)? voipAccountIds+",":"";
//判断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);
}
}
}
//将删除后的ACCOUNT置为删除1,1,1,
if(!StringUtil.isEmpty(voipAccountIds.replaceAll(",", ""))){
voipAccountIds=voipAccountIds.substring(1,voipAccountIds.length());
for (String cfgId : voipAccountIds.split(",")) {
CfgIndexInfo cfg=new CfgIndexInfo();
cfg.setEditorId(UserUtils.getUser().getId());
cfg.setEditTime(editTime);
cfg.setIsValid(-1);
AvVoipAccountCfg voipAccountCfg=new AvVoipAccountCfg();
voipAccountCfg.setCfgId(Long.parseLong(cfgId));
cfg.setVoipAccount(voipAccountCfg);
avContentCfgDao.updateAvVoipAccount(cfg);
}
}
//将删除后的IP置为删除 [is_valid=-1]
if(!StringUtil.isEmpty(voipIpIds.replaceAll(",", ""))){
voipIpIds=voipIpIds.substring(1,voipIpIds.length());
for (String cfgId : voipIpIds.split(",")) {
CfgIndexInfo cfg=new CfgIndexInfo();
cfg.setEditorId(UserUtils.getUser().getId());
cfg.setEditTime(editTime);
cfg.setIsValid(-1);
AvVoipIpCfg voipIpCfg=new AvVoipIpCfg();
voipIpCfg.setCfgId(Long.parseLong(cfgId));
cfg.setVoipIp(voipIpCfg);
avContentCfgDao.updateAvVoipIp(cfg);
}
}
//修改
entity.setEditorId(UserUtils.getUser().getId());
entity.setEditTime(editTime);
avContentCfgDao.updateCfgIndexInfo(entity);
}
}
/**
*
* @param isAudit
* @param isValid
* @param ids compileIds
*/
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void updateAvVoipValid(Integer isAudit,Integer isValid,String ids,Integer functionId){
CfgIndexInfo entity = new CfgIndexInfo();
String[] idArray = ids.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.updateAvVoipAccount(entity);
avContentCfgDao.updateCfgIndexInfo(entity);
}
}
}