146 lines
4.5 KiB
Java
146 lines
4.5 KiB
Java
|
|
package com.nis.web.service.configuration;
|
||
|
|
|
||
|
|
|
||
|
|
import java.io.File;
|
||
|
|
import java.util.ArrayList;
|
||
|
|
import java.util.Date;
|
||
|
|
import java.util.HashMap;
|
||
|
|
import java.util.List;
|
||
|
|
import java.util.Map;
|
||
|
|
|
||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
|
import org.springframework.stereotype.Service;
|
||
|
|
|
||
|
|
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.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.web.dao.FunctionRegionDictDao;
|
||
|
|
import com.nis.web.dao.FunctionServiceDictDao;
|
||
|
|
import com.nis.web.dao.configuration.AvCfgDao;
|
||
|
|
import com.nis.web.dao.configuration.AvContentCfgDao;
|
||
|
|
import com.nis.web.security.UserUtils;
|
||
|
|
import com.nis.web.service.BaseService;
|
||
|
|
import com.nis.web.service.CrudService;
|
||
|
|
|
||
|
|
import net.sf.json.JSONObject;
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 音视频文本
|
||
|
|
* @author dell
|
||
|
|
*
|
||
|
|
*/
|
||
|
|
@Service
|
||
|
|
public class AvContentCfgService extends BaseService{
|
||
|
|
@Autowired
|
||
|
|
protected AvContentCfgDao avContentCfgDao;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 查询分页数据
|
||
|
|
* @param page 分页对象
|
||
|
|
* @param entity
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public Page<CfgIndexInfo> findPage(Page<CfgIndexInfo> page, CfgIndexInfo entity) {
|
||
|
|
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"a"));
|
||
|
|
entity.setPage(page);
|
||
|
|
List<CfgIndexInfo> list=avContentCfgDao.findVoipList(entity);
|
||
|
|
page.setList(list);
|
||
|
|
return page;
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* 根据索引表信息获取voipIpCfg信息
|
||
|
|
* @param entity
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public List<AvVoipIpCfg> getVoipIpCfgList(CfgIndexInfo entity) {
|
||
|
|
return avContentCfgDao.findVoipIpCfgList(entity);
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* 根据索引表信息获取voipAccountCfg信息
|
||
|
|
* @param entity
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public List<AvVoipAccountCfg> getVoipAccountCfgList(CfgIndexInfo entity) {
|
||
|
|
return avContentCfgDao.findVoipAccountCfgList(entity);
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* 根据索引表信息获取voipAccountCfg信息
|
||
|
|
* @param entity
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public CfgIndexInfo getCfgIndexInfo(CfgIndexInfo entity) {
|
||
|
|
CfgIndexInfo cfg=avContentCfgDao.getCfgIndexInfo(entity);
|
||
|
|
cfg.setVoipAccounts(getVoipAccountCfgList(entity));
|
||
|
|
cfg.setVoipIps(getVoipIpCfgList(entity));
|
||
|
|
|
||
|
|
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());
|
||
|
|
}
|
||
|
|
}*/
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|