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

@@ -18,7 +18,6 @@ import com.nis.domain.Page;
import com.nis.domain.configuration.AvVoipAccountCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.AvVoipIpCfg;
import com.nis.util.StringUtil;
import com.nis.web.controller.BaseController;
@@ -34,23 +33,39 @@ public class AvContentController extends BaseController {
//音视频VOIP配置新增界面
@RequestMapping(value = {"/voipForm"})
public String voipFrom(Model model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity){
public String voipFrom(Model model,HttpServletRequest request,HttpServletResponse response,String ids,@ModelAttribute("cfg")CfgIndexInfo cfg){
if(!StringUtil.isEmpty(ids)){
entity.setCfgId(Long.parseLong(ids));
entity = avContentCfgService.getCfgIndexInfo(entity);
cfg.setCompileId(Integer.parseInt(ids));
cfg = avContentCfgService.getCfgIndexInfo(cfg);
}else{
List<AvVoipAccountCfg> avVoipAccountCfgs=new ArrayList<AvVoipAccountCfg>();
avVoipAccountCfgs.add(new AvVoipAccountCfg());
entity.setVoipAccounts(avVoipAccountCfgs);
cfg.setVoipAccounts(avVoipAccountCfgs);
List<AvVoipIpCfg> avVoipIpCfgs=new ArrayList<AvVoipIpCfg>();
avVoipIpCfgs.add(new AvVoipIpCfg());
entity.setVoipIps(avVoipIpCfgs);
cfg.setVoipIps(avVoipIpCfgs);
}
initFormCondition(model,entity);
model.addAttribute("_cfg", entity);
initFormCondition(model,cfg);
model.addAttribute("_cfg", cfg);
return "/cfg/av/voip/voipForm";
}
//保存voip信息
@RequestMapping(value = {"/saveVoip"})
public String saveVoip(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")CfgIndexInfo cfg){
try{
avContentCfgService.saveOrUpdateAvVoip(cfg);
}catch(Exception e){
logger.error("voip信息保存失败",e);
e.printStackTrace();
addMessage(model,"save_voip_failed");
}
return "redirect:" + adminPath +"/ntc/av/voipList?functionId="+cfg.getFunctionId();
}
//视频文本VOIP配置列表
@RequestMapping(value = {"/voipList"})
public String voipCfgList(@ModelAttribute("cfg")CfgIndexInfo entity,Model model,HttpServletRequest request,HttpServletResponse response){

View File

@@ -21,4 +21,7 @@ public interface AvContentCfgDao extends CrudDao<BaseIpCfg>{
public List<AvVoipIpCfg> findVoipIpCfgList(@Param("cfg")CfgIndexInfo entity);
public List<AvVoipAccountCfg> findVoipAccountCfgList(@Param("cfg")CfgIndexInfo entity);
public CfgIndexInfo getCfgIndexInfo(@Param("cfg")CfgIndexInfo entity);
public void insertCfgIndexInfo(@Param("cfg")CfgIndexInfo entity);
public void insertAvVoipIp(@Param("cfg")CfgIndexInfo entity);
public void insertAvVoipAccount(@Param("cfg")CfgIndexInfo entity);
}

View File

@@ -109,6 +109,7 @@
a.audit_time,a.service_id,a.request_id,a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable,
a.expr_type,a.match_method,a.is_hexbin,a.area_effective_ids,a.function_id,a.cfg_region_code
</sql>
<!-- 条件查询列表信息 -->
<select id="findVoipList" resultMap="CfgIndexInfoMap" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
SELECT
<include refid="AvVoip_Column" />
@@ -238,7 +239,8 @@
</otherwise>
</choose>
</select>
<select id="findVoipIpCfgList" resultMap="AvVoipIpCfgMap">
<!-- 根据compileId获取avVoipIpCfg信息 -->
<select id="findVoipIpCfgList" resultMap="AvVoipIpCfgMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
select
<include refid="AvVoipIp_Column" />
from av_voip_ip_cfg a
@@ -248,9 +250,8 @@
</if>
</where>
</select>
<select id="findVoipAccountCfgList" resultMap="AvVoipAccountCfgMap">
<!-- 根据compileId获取avVoipAccountCfg信息 -->
<select id="findVoipAccountCfgList" resultMap="AvVoipAccountCfgMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
select
<include refid="AvVoipAccount_Column" />
from av_voip_account_cfg a
@@ -261,6 +262,7 @@
</where>
</select>
<!-- 根据Id获取cfgIndexInfo信息 -->
<select id="getCfgIndexInfo" resultMap="CfgIndexInfoMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT
*
@@ -269,10 +271,188 @@
<if test="cfg.cfgId != null">
and a.CFG_ID=#{cfg.cfgId,jdbcType=INTEGER}
</if>
<!-- <if test="cfg.compileId != null">
and a.compileId=#{cfg.compileId,jdbcType=INTEGER}
</if> -->
<if test="cfg.compileId != null">
and a.compile_Id=#{cfg.compileId,jdbcType=INTEGER}
</if>
</where>
</select>
<!-- insert cfgIndexInfox -->
<insert id="insertCfgIndexInfo" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cfg_index_info(
CFG_DESC,
ACTION,
IS_VALID,
IS_AUDIT,
CREATOR_ID,
CREATE_TIME,
EDITOR_ID,
EDIT_TIME,
AUDITOR_ID,
AUDIT_TIME,
SERVICE_ID,
REQUEST_ID,
COMPILE_ID,
IS_AREA_EFFECTIVE,
CLASSIFY,
ATTRIBUTE,
LABLE,
AREA_EFFECTIVE_IDS,
function_id
)values (
#{cfg.cfgDesc,jdbcType=VARCHAR},
#{cfg.action,jdbcType=INTEGER},
0,
0,
#{cfg.creatorId,jdbcType=INTEGER},
#{cfg.createTime,jdbcType=TIMESTAMP},
#{cfg.editorId,jdbcType=INTEGER},
#{cfg.editTime,jdbcType=TIMESTAMP},
#{cfg.auditorId,jdbcType=INTEGER},
#{cfg.auditTime,jdbcType=TIMESTAMP},
#{cfg.serviceId,jdbcType=INTEGER},
#{cfg.requestId,jdbcType=INTEGER},
#{cfg.compileId,jdbcType=INTEGER},
#{cfg.isAreaEffective,jdbcType=INTEGER},
#{cfg.classify,jdbcType=VARCHAR},
#{cfg.attribute,jdbcType=VARCHAR},
#{cfg.lable,jdbcType=VARCHAR},
#{cfg.areaEffectiveIds,jdbcType=VARCHAR},
#{cfg.functionId,jdbcType=INTEGER}
)
</insert>
<!-- insert AV_VOIP_IP_CFG表信息 -->
<insert id="insertAvVoipIp" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into av_voip_ip_cfg (
CFG_DESC,
ACTION,
IS_VALID,
IS_AUDIT,
CREATOR_ID,
CREATE_TIME,
EDITOR_ID,
EDIT_TIME,
AUDITOR_ID,
AUDIT_TIME,
SERVICE_ID,
REQUEST_ID,
COMPILE_ID,
IS_AREA_EFFECTIVE,
CLASSIFY,
ATTRIBUTE,
LABLE,
AREA_EFFECTIVE_IDS,
function_id,
ip_type,
src_ip_address,
ip_pattern,
port_pattern,
src_port,
protocol,
protocol_id,
direction,
dest_port,
dest_ip_address,
cfg_type,
cfg_region_code
)values (
#{cfg.cfgDesc,jdbcType=VARCHAR},
#{cfg.action,jdbcType=INTEGER},
0,
0,
#{cfg.creatorId,jdbcType=INTEGER},
#{cfg.createTime,jdbcType=TIMESTAMP},
#{cfg.editorId,jdbcType=INTEGER},
#{cfg.editTime,jdbcType=TIMESTAMP},
#{cfg.auditorId,jdbcType=INTEGER},
#{cfg.auditTime,jdbcType=TIMESTAMP},
#{cfg.serviceId,jdbcType=INTEGER},
#{cfg.requestId,jdbcType=INTEGER},
#{cfg.compileId,jdbcType=INTEGER},
#{cfg.isAreaEffective,jdbcType=INTEGER},
#{cfg.classify,jdbcType=VARCHAR},
#{cfg.attribute,jdbcType=VARCHAR},
#{cfg.lable,jdbcType=VARCHAR},
#{cfg.areaEffectiveIds,jdbcType=VARCHAR},
#{cfg.functionId,jdbcType=INTEGER},
#{cfg.voipIp.ipType,jdbcType=INTEGER},
#{cfg.voipIp.srcIpAddress,jdbcType=VARCHAR},
#{cfg.voipIp.ipPattern,jdbcType=INTEGER},
#{cfg.voipIp.portPattern,jdbcType=INTEGER},
#{cfg.voipIp.srcPort,jdbcType=VARCHAR},
#{cfg.voipIp.protocol,jdbcType=INTEGER},
#{cfg.voipIp.protocolId,jdbcType=INTEGER},
#{cfg.voipIp.direction,jdbcType=INTEGER},
#{cfg.voipIp.destPort,jdbcType=VARCHAR},
#{cfg.voipIp.destIpAddress,jdbcType=VARCHAR},
#{cfg.voipIp.cfgType,jdbcType=VARCHAR},
#{cfg.voipIp.cfgRegionCode,jdbcType=INTEGER}
)
</insert>
<!-- insert AV_VOIP_ACCOUNT_CFG表信息 -->
<insert id="insertAvVoipAccount" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into av_voip_account_cfg (
CFG_DESC,
ACTION,
IS_VALID,
IS_AUDIT,
CREATOR_ID,
CREATE_TIME,
EDITOR_ID,
EDIT_TIME,
AUDITOR_ID,
AUDIT_TIME,
SERVICE_ID,
REQUEST_ID,
COMPILE_ID,
IS_AREA_EFFECTIVE,
CLASSIFY,
ATTRIBUTE,
LABLE,
AREA_EFFECTIVE_IDS,
function_id,
district,
cfg_keywords,
cfg_type,
cfg_region_code,
expr_type,
match_method,
is_hexbin
)values (
#{cfg.cfgDesc,jdbcType=VARCHAR},
#{cfg.action,jdbcType=INTEGER},
0,
0,
#{cfg.creatorId,jdbcType=INTEGER},
#{cfg.createTime,jdbcType=TIMESTAMP},
#{cfg.editorId,jdbcType=INTEGER},
#{cfg.editTime,jdbcType=TIMESTAMP},
#{cfg.auditorId,jdbcType=INTEGER},
#{cfg.auditTime,jdbcType=TIMESTAMP},
#{cfg.serviceId,jdbcType=INTEGER},
#{cfg.requestId,jdbcType=INTEGER},
#{cfg.compileId,jdbcType=INTEGER},
#{cfg.isAreaEffective,jdbcType=INTEGER},
#{cfg.classify,jdbcType=VARCHAR},
#{cfg.attribute,jdbcType=VARCHAR},
#{cfg.lable,jdbcType=VARCHAR},
#{cfg.areaEffectiveIds,jdbcType=VARCHAR},
#{cfg.functionId,jdbcType=INTEGER},
#{cfg.voipAccount.district,jdbcType=VARCHAR},
#{cfg.voipAccount.cfgKeywords,jdbcType=VARCHAR},
#{cfg.voipAccount.cfgType,jdbcType=VARCHAR},
#{cfg.voipAccount.cfgRegionCode,jdbcType=INTEGER},
#{cfg.voipAccount.exprType,jdbcType=INTEGER},
#{cfg.voipAccount.matchMethod,jdbcType=INTEGER},
#{cfg.voipAccount.isHexbin,jdbcType=INTEGER}
)
</insert>
</mapper>

View File

@@ -73,7 +73,7 @@ public class AvCfgService extends BaseService{
//调用服务接口获取compileId
String result = "";
try {
result = ConfigServiceUtil.getId(1,1);
result ="1";// ConfigServiceUtil.getId(1,1);
} catch (Exception e) {
e.printStackTrace();
logger.info("获取编译ID出错");
@@ -101,7 +101,7 @@ public class AvCfgService extends BaseService{
//调用服务接口获取compileId
String result = "";
try {
result = ConfigServiceUtil.getId(1,1);
result ="1";// ConfigServiceUtil.getId(1,1);
} catch (Exception e) {
e.printStackTrace();
logger.info("获取编译ID出错");

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);
}
}
}

View File

@@ -124,12 +124,12 @@ public class MaatCfgConverTest {
List<ComplexkeywordCfg> list2 = new ArrayList();
complex.setAction(1);
complex.setDistrict("UA");
complex.setKeywords("测试1");
complex.setCfgKeywords("测试1");
list2.add(complex);
str = new BaseStringCfg();
complex.setAction(1);
complex.setDistrict("cookie");
complex.setKeywords("测试2");
complex.setCfgKeywords("测试2");
list2.add(complex);
if(list2.size()>0){
groupId++;