voip删除、审核、列表分页功能完成

This commit is contained in:
duandongmei
2018-05-25 09:01:23 +08:00
parent 262087ecf0
commit 2b17b9e3fe
5 changed files with 437 additions and 384 deletions

View File

@@ -20,6 +20,7 @@ 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.domain.maat.ToMaatResult;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.FileUtils;
@@ -97,64 +98,6 @@ public class AvContentCfgService extends BaseService{
return cfg;
}
/**
* 审核
* @param isAudit
* @param isValid
* @param ids **编译Id
* @param functionId 业务id
*/
public void auditAvVoip(Integer isAudit,Integer isValid,String ids){
CfgIndexInfo entity = new CfgIndexInfo();
String[] idArray = ids.split(",");
List<CfgIndexInfo> list = new ArrayList();
Gson gson=new GsonBuilder().disableHtmlEscaping()
.excludeFieldsWithoutExposeAnnotation()
.create();
//多域配置审核时间为同一个时间
Date auditTime=new Date();
for(String id :idArray){
CfgIndexInfo cfgSearch=new CfgIndexInfo();
cfgSearch.setCfgId(Long.parseLong(id));
entity = avContentCfgDao.getCfgIndexInfo(cfgSearch);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(auditTime);
/*avCfgDao.auditAvFileSample(entity);
list.add(entity);*/
}
/*if(isAudit==1){
//调用服务接口下发配置数据
String json=gson.toJson(list);
logger.info("音视频文件样例下发配置参数:"+json);
//调用服务接口下发配置
try {
String result = ConfigServiceUtil.postCallbackCfg(json);
logger.info("音视频文件样例配置下发响应信息:"+result);
} catch (Exception e) {
e.printStackTrace();
logger.info("音视频文件样例配置下发失败");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
}
}else if(isAudit==3){
//调用服务接口取消配置
String json=gson.toJson(list);
logger.info("音视频文件样例下发配置参数:"+json);
//调用服务接口下发配置
try {
String result = ConfigServiceUtil.put(json,2);
logger.info("音视频文件样例取消配置响应信息:"+result);
} catch (Exception e) {
e.printStackTrace();
logger.info("音视频文件样取消配置失败");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
}
}*/
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void saveOrUpdateAvVoip(CfgIndexInfo entity,String voipIpIds,String voipAccountIds){
@@ -249,33 +192,27 @@ public class AvContentCfgService extends BaseService{
}
}
}
//将删除后的ACCOUNT置为删除1,1,1,
//delete 真是删除voipAccount信息
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);
avContentCfgDao.deleteAvVoipAccount(cfg);
}
}
//将删除后的IP置为删除 [is_valid=-1]
//delete 真是删除voipAccount信息
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);
avContentCfgDao.deleteAvVoipIp(cfg);
}
}
//修改
@@ -306,4 +243,66 @@ public class AvContentCfgService extends BaseService{
avContentCfgDao.updateCfgIndexInfo(entity);
}
}
/**
*
* @param isAudit
* @param isValid
* @param ids 编译Id
* @param functionId
*/
public void auditAvVoip(Integer isAudit,Integer isValid,String ids,Integer functionId){
CfgIndexInfo entity = new CfgIndexInfo();
String[] idArray = ids.split(",");
List<CfgIndexInfo> list = new ArrayList();
List<AvVoipIpCfg> voipIpList = new ArrayList();
List<AvVoipAccountCfg> voipAccountList = new ArrayList();
Map<String, Object> childMap=new HashMap<>();
CfgIndexInfo searchCfg=new CfgIndexInfo();
Date auditTime=new Date();
for(String id :idArray){
searchCfg.setCompileId(Integer.parseInt(id));
entity = avContentCfgDao.getCfgIndexInfo(searchCfg);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(auditTime);
voipIpList=avContentCfgDao.findVoipIpCfgList(entity);
voipAccountList=avContentCfgDao.findVoipAccountCfgList(entity);
avContentCfgDao.updateAvVoipIp(entity);
avContentCfgDao.updateAvVoipAccount(entity);
avContentCfgDao.updateCfgIndexInfo(entity);
childMap.put("voipIp", voipIpList);
childMap.put("voipAccount", voipAccountList);
list.add(entity);
}
/*if(isAudit==1){
//调用服务接口下发配置数据
String json=gsonToJson(list);
logger.info("文件样例下发配置参数:"+json);
//调用服务接口下发配置
try {
ToMaatResult result = ConfigServiceUtil.postCallbackCfg(json);
logger.info("音视频VOIP配置下发响应信息"+result.getMsg());
} catch (Exception e) {
e.printStackTrace();
logger.info("音视频VOIP配置下发失败");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
}
}else if(isAudit==3){
//调用服务接口取消配置
String json=gsonToJson(list);
logger.info("音视频VOIP配置参数"+json);
//调用服务接口取消配置
try {
ToMaatResult result = ConfigServiceUtil.put(json, 2);
logger.info("音视频VOIP取消配置响应信息"+result.getMsg());
} catch (Exception e) {
e.printStackTrace();
logger.info("音视频VOIP消配置失败");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
}
}*/
}
}