VoIP ip配置修改

This commit is contained in:
leijun
2018-10-11 18:33:23 +08:00
parent aa6c1963e7
commit 97a06a9874
7 changed files with 250 additions and 21 deletions

View File

@@ -26,6 +26,7 @@ import com.nis.domain.configuration.AreaBean;
import com.nis.domain.configuration.AreaIpCfg;
import com.nis.domain.configuration.AvVoipAccountCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.NtcSubscribeIdCfg;
import com.nis.exceptions.MaatConvertException;
import com.nis.domain.configuration.AvVoipIpCfg;
@@ -124,8 +125,8 @@ public class AvContentController extends BaseController {
@RequestMapping(value = {"/voipList"})
public String voipCfgList(Model model,HttpServletRequest request ,HttpServletResponse response ,@ModelAttribute("cfg")CfgIndexInfo entity
,RedirectAttributes redirectAttributes){
if(entity.getVoipIp()== null){
entity.setVoipIp(new AvVoipIpCfg());
if(entity.getIpPort()== null){
entity.setIpPort(new IpPortCfg());
}
if(entity.getVoipAccount()== null){
entity.setVoipAccount(new AvVoipAccountCfg());
@@ -283,7 +284,7 @@ public class AvContentController extends BaseController {
CfgIndexInfo cfg = avContentCfgService.getCfgIndexInfo(cfgIndexInfo);
List<String[]> tabList = new ArrayList();
//获取voipIpCfg信息
if(cfg.getVoipIps()!=null){
/* if(cfg.getVoipIps()!=null){
String cfgType = null;
for(AvVoipIpCfg ip:cfg.getVoipIps()){
if(!ip.getCfgType().equals(cfgType)){
@@ -291,7 +292,17 @@ public class AvContentController extends BaseController {
cfgType = ip.getCfgType();
}
}
}*/
if(cfg.getIpPortList()!=null){
String cfgType = null;
for(IpPortCfg ip:cfg.getIpPortList()){
if(!ip.getCfgType().equals(cfgType)){
tabList.add(new String[]{"1",ip.getCfgType()});
cfgType = ip.getCfgType();
}
}
}
if(cfg.getVoipAccounts()!=null){
String cfgType = null;
for(AvVoipAccountCfg account:cfg.getVoipAccounts()){
@@ -536,6 +547,9 @@ public class AvContentController extends BaseController {
,HttpServletResponse response
,@ModelAttribute("cfg")BaseStringCfg entity
,RedirectAttributes redirectAttributes){
if(entity.getIpPort()== null){
entity.setIpPort(new IpPortCfg());
}
Page<BaseStringCfg> page = avContentCfgService.findContUrlPage(new Page<BaseStringCfg>(request, response,"r"), entity);
model.addAttribute("page", page);
initPageCondition(model,entity);

View File

@@ -6,9 +6,11 @@ import java.util.List;
import com.nis.domain.configuration.AvVoipAccountCfg;
import com.nis.domain.configuration.AvVoipIpCfg;
import com.nis.domain.configuration.BaseCfg;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.web.dao.MyBatisDao;
@@ -20,6 +22,10 @@ public interface AvContentCfgDao {
public List<AvVoipAccountCfg> findVoipAccountCfgList(CfgIndexInfo entity);
public CfgIndexInfo getCfgIndexInfo(CfgIndexInfo entity);
public List<IpPortCfg> getIpPortList(CfgIndexInfo entity);
public void saveIpPortCfg(IpPortCfg entity);
public void deleteIpCfg(CfgIndexInfo entity);
public void insertCfgIndexInfo(CfgIndexInfo entity);
public void insertAvVoipIp(CfgIndexInfo entity);
public void insertAvVoipAccountCfg(CfgIndexInfo entity);
@@ -38,7 +44,7 @@ public interface AvContentCfgDao {
public void updateIp(BaseIpCfg entity);
public List<BaseIpCfg> findIpList(BaseIpCfg entity) ;
public List<BaseIpCfg> getIpList(BaseIpCfg entity) ;
public void updateCfgValid(BaseCfg entity);
public BaseStringCfg findStringCfgById(BaseStringCfg entity) ;
public void insertString(BaseStringCfg entity);
public void updateString(BaseStringCfg entity);

View File

@@ -155,7 +155,48 @@
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="do_log" property="doLog" jdbcType="INTEGER" />
</resultMap>
<resultMap id="ipPortMap" type="com.nis.domain.configuration.IpPortCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="ip_pattern" property="ipPattern" jdbcType="INTEGER" />
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
<result column="dest_port" property="destPort" jdbcType="VARCHAR" />
<result column="src_port" property="srcPort" jdbcType="VARCHAR" />
<result column="port_pattern" property="portPattern" jdbcType="INTEGER" />
<result column="direction" property="direction" jdbcType="INTEGER" />
<result column="protocol" property="protocol" jdbcType="INTEGER" />
<result column="protocol_id" property="protocolId" jdbcType="INTEGER" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
</resultMap>
<sql id="IpCfg_Column" >
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
,a.protocol,a.protocol_id,a.direction,a.cfg_type,a.action,a.dest_port,a.dest_ip_address
,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id
,a.edit_time,a.auditor_id,a.audit_time,a.service_id,a.request_id,
a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable
,a.area_effective_ids,a.function_id,a.cfg_region_code
</sql>
<sql id="AvVoip_Column" >
r.CFG_ID,r.CFG_DESC,r.ACTION,r.IS_VALID,r.IS_AUDIT,
r.CREATOR_ID,r.CREATE_TIME,r.EDITOR_ID,r.EDIT_TIME,r.AUDITOR_ID,r.AUDIT_TIME,
@@ -190,6 +231,12 @@
r.audit_time,r.service_id,r.request_id,r.compile_id,r.is_area_effective,r.classify,r.attribute,r.lable,
r.expr_type,r.match_method,r.is_hexbin,r.area_effective_ids,r.function_id,r.cfg_region_code,r.do_log
</sql>
<select id="getIpPortList" resultMap="ipPortMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT
<include refid="IpCfg_Column" />
FROM ip_port_cfg a where compile_id=#{compileId} and function_id=#{functionId}
</select>
<!-- voip IP条件查询列表信息 -->
<select id="findVoipList" resultMap="CfgIndexInfoMap" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
SELECT
@@ -283,7 +330,26 @@
<if test="functionId != null">
AND r.function_id=#{functionId,jdbcType=INTEGER}
</if>
<if test="(voipIp.srcIpAddress != null and voipIp.srcIpAddress != '') or (voipIp.srcPort != null and voipIp.srcPort != '')">
<if test="(ipPort.srcIpAddress != null and ipPort.srcIpAddress != '') or (ipPort.srcPort != null and ipPort.srcPort != '')">
AND r.compile_id in (select t.compile_id from ip_port_cfg t
<where>
and t.protocol_id=4
<if test="ipPort.srcIpAddress != null and ipPort.srcIpAddress != ''">
and t.src_ip_address =#{(ipPort.srcIpAddress,jdbcType=VARCHAR}
</if>
<if test="ipPort.srcPort != null and ipPort.srcPort != ''">
and t.src_port =#{ipPort.srcPort,jdbcType=VARCHAR}
</if>
<if test="ipPort.destIpAddress != null and ipPort.destIpAddress != ''">
and t.dest_ip_address =#{(ipPort.destIpAddress,jdbcType=VARCHAR}
</if>
<if test="ipPort.destPort != null and ipPort.destPort != ''">
and t.dest_port =#{ipPort.destPort,jdbcType=VARCHAR}
</if>
</where>
)
</if>
<!-- <if test="(voipIp.srcIpAddress != null and voipIp.srcIpAddress != '') or (voipIp.srcPort != null and voipIp.srcPort != '')">
AND r.compile_id in (select t.compile_id from av_voip_ip_cfg t
<where>
<if test="voipIp.srcIpAddress != null and voipIp.srcIpAddress != ''">
@@ -294,7 +360,7 @@
</if>
</where>
)
</if>
</if> -->
<if test="(ntcSubscribeIdCfg.cfgKeywords != null and ntcSubscribeIdCfg.cfgKeywords != '') ">
AND r.compile_id in (select f.compile_id from ntc_subscribe_id_cfg f
<where>
@@ -737,6 +803,78 @@
#{ntcSubscribeIdCfg.isHexbin,jdbcType=INTEGER}
)
</insert>
<insert id="saveIpPortCfg" parameterType="com.nis.domain.configuration.IpPortCfg" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ip_port_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 (
#{cfgDesc,jdbcType=VARCHAR},
#{action,jdbcType=INTEGER},
0,
0,
#{creatorId,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP},
#{editorId,jdbcType=INTEGER},
#{editTime,jdbcType=TIMESTAMP},
#{auditorId,jdbcType=INTEGER},
#{auditTime,jdbcType=TIMESTAMP},
#{serviceId,jdbcType=INTEGER},
#{requestId,jdbcType=INTEGER},
#{compileId,jdbcType=INTEGER},
#{isAreaEffective,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR},
#{attribute,jdbcType=VARCHAR},
#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{ipType,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{ipPattern,jdbcType=INTEGER},
#{portPattern,jdbcType=INTEGER},
#{srcPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{protocolId,jdbcType=INTEGER},
#{direction,jdbcType=INTEGER},
#{destPort,jdbcType=VARCHAR},
#{destIpAddress,jdbcType=VARCHAR},
#{cfgType,jdbcType=VARCHAR},
#{cfgRegionCode,jdbcType=INTEGER}
)
</insert>
<!-- update cfg_index_info表信息 -->
<update id="updateCfgIndexInfo" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
update cfg_index_info
@@ -1122,6 +1260,12 @@
</if>
</where>
</delete>
<!-- 删除http子配置 -->
<delete id="deleteIpCfg" >
delete from ip_port_cfg where compile_id=#{compileId} and function_id=#{functionId}
</delete>
<!--**********************************BaseIpCfg*******************************************************-->
<!-- avContIp条件查询列表信息 -->
<select id="findIpList" resultMap="AvContIpCfgMap" parameterType="com.nis.domain.configuration.BaseIpCfg" >
@@ -1734,4 +1878,18 @@
</choose>
</where>
</select>
<update id="updateCfgValid" parameterType="com.nis.domain.configuration.BaseCfg">
update ${tableName} set is_valid = #{isValid,jdbcType=INTEGER},
editor_id = #{editorId,jdbcType=INTEGER} ,
edit_time = #{editTime,jdbcType=TIMESTAMP}
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId !=null ">
AND cfg_id = #{cfgId,jdbcType=BIGINT}
</if>
<if test="compileId !=null ">
AND compile_id = #{compileId,jdbcType=INTEGER}
</if>
and function_id=#{functionId,jdbcType=INTEGER}
</trim>
</update>
</mapper>

View File

@@ -117,12 +117,13 @@ public class AvContentCfgService extends BaseService{
public CfgIndexInfo getCfgIndexInfo(CfgIndexInfo entity) {
CfgIndexInfo cfg=avContentCfgDao.getCfgIndexInfo(entity);
List<NtcSubscribeIdCfg> ntcSubscribeList=getSubscribeIdCfgList(cfg);
List<AvVoipIpCfg> voipIps=getVoipIpCfgList(cfg);
//List<AvVoipIpCfg> voipIps=getVoipIpCfgList(cfg);
List<IpPortCfg> ipPortList = avContentCfgDao.getIpPortList(cfg);
List<AvVoipAccountCfg> voipAccounts=getVoipAccountCfgList(cfg);
cfg.setNtcSubscribeIdCfgList(ntcSubscribeList);
cfg.setVoipIps(voipIps);
//cfg.setVoipIps(voipIps);
cfg.setVoipAccounts(voipAccounts);
cfg.setIpPortList(ipPortList);
return cfg;
}
/* public CfgIndexInfo getCfgIndexInfo2(CfgIndexInfo entity) {
@@ -160,11 +161,17 @@ public class AvContentCfgService extends BaseService{
entity.setCreateTime(new Date());
entity.setCreatorId(entity.getCurrentUser().getId());
avContentCfgDao.insertCfgIndexInfo(entity);
if(entity.getVoipIps()!=null){
/* if(entity.getVoipIps()!=null){
for (AvVoipIpCfg voipIp : entity.getVoipIps()) {
entity.setVoipIp(voipIp);
avContentCfgDao.insertAvVoipIp(entity);
}
}*/
if(entity.getIpPortList()!=null){
for(IpPortCfg cfg:entity.getIpPortList()){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
avContentCfgDao.saveIpPortCfg(cfg);
}
}
if(entity.getNtcSubscribeIdCfgList()!=null){
for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){
@@ -199,7 +206,8 @@ public class AvContentCfgService extends BaseService{
entity.setEditorId(entity.getCurrentUser().getId());
avContentCfgDao.updateCfgIndexInfo(entity);
//无效子配置后,再新增子配置
avContentCfgDao.deleteAvVoipIp(entity);
//avContentCfgDao.deleteAvVoipIp(entity);
avContentCfgDao.deleteIpCfg(entity);
stringCfgDao.deleteSubscribeIdCfgByCfgIndexInfo(entity);
avContentCfgDao.deleteAvVoipAccountCfg(entity);
AreaIpCfg area = new AreaIpCfg();
@@ -208,11 +216,17 @@ public class AvContentCfgService extends BaseService{
areaIpCfgDao.deleteAreaIpCfg(area);
entity.setCreateTime(new Date());
entity.setCreatorId(entity.getCurrentUser().getId());
if(entity.getVoipIps()!=null&&entity.getVoipIps().size()>0){
/*if(entity.getVoipIps()!=null&&entity.getVoipIps().size()>0){
for (AvVoipIpCfg voipIp : entity.getVoipIps()) {
entity.setVoipIp(voipIp);
avContentCfgDao.insertAvVoipIp(entity);
}
}*/
if(entity.getIpPortList()!=null){
for(IpPortCfg cfg:entity.getIpPortList()){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
avContentCfgDao.saveIpPortCfg(cfg);
}
}
if(entity.getNtcSubscribeIdCfgList()!=null){
for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){
@@ -340,7 +354,13 @@ public class AvContentCfgService extends BaseService{
entity.setIsValid(isValid);
entity.setEditorId(UserUtils.getUser().getId());
entity.setEditTime(new Date());
avContentCfgDao.updateAvVoipIp(entity);
//avContentCfgDao.updateAvVoipIp(entity);
if(entity.getIpPortList()!=null && entity.getIpPortList().size()>0){
IpPortCfg cfg = new IpPortCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(IpPortCfg.getTablename());
avContentCfgDao.updateCfgValid(cfg);
}
avContentCfgDao.updateAvVoipKeywordCfgt(entity);
avContentCfgDao.updateAvVoipAccount(entity);
avContentCfgDao.updateCfgIndexInfo(entity);
@@ -386,7 +406,8 @@ public class AvContentCfgService extends BaseService{
CfgIndexInfo entity = new CfgIndexInfo();
List<CfgIndexInfo> list = new ArrayList();
List<AvVoipIpCfg> voipIpList = new ArrayList();
//List<AvVoipIpCfg> voipIpList = new ArrayList();
List<IpPortCfg> ipPortList =new ArrayList();
List <NtcSubscribeIdCfg> ntcList = new ArrayList();
List<AvVoipAccountCfg> accountList = new ArrayList();
List<AreaIpCfg> areaIpCfgList = new ArrayList();
@@ -409,7 +430,8 @@ public class AvContentCfgService extends BaseService{
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode","cfgType","cfgId"});
areaIpCfgDao.updateAreaIpCfg(areaIpCfg);
voipIpList=avContentCfgDao.findVoipIpCfgList(entity);
//voipIpList=avContentCfgDao.findVoipIpCfgList(entity);
ipPortList = avContentCfgDao.getIpPortList(entity);
accountList=avContentCfgDao.findVoipAccountCfgList(entity);
ntcList=stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity);
areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
@@ -424,11 +446,21 @@ public class AvContentCfgService extends BaseService{
List<DigestCfg> digestRegionList = new ArrayList();
List<IpCfg> areaIpRegionList = new ArrayList();
if(isAudit==1){
if(!StringUtil.isEmpty(voipIpList)){
/* if(!StringUtil.isEmpty(voipIpList)){
Map<String,List> ipMap = cfgConvert(ipRegionList,voipIpList,1,entity,groupRelationList);
groupRelationList=ipMap.get("groupList");
ipRegionList=ipMap.get("dstList");
}*/
if(!StringUtil.isEmpty(ipPortList)){
Map<String,List> ipMap = cfgConvert(ipRegionList,ipPortList,1,entity,groupRelationList);
groupRelationList=ipMap.get("groupList");
ipRegionList=ipMap.get("dstList");
if(ipMap.get("numRegionList")!=null){
numRegionList.addAll(ipMap.get("numRegionList"));
}
}
if(!StringUtil.isEmpty(ntcList)){

View File

@@ -0,0 +1,19 @@
#流媒体协议配置
update function_service_dict set service_id='39',protocol_id='23' where dict_id='30';
update function_service_dict set service_id='151',protocol_id='23' where dict_id='31';
#流媒体协议 增加IP配置
INSERT INTO `function_region_dict` (`function_id`, `config_district`, `config_region_code`, `config_region_value`, `config_desc`, `is_valid`, `is_maat`, `region_type`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `config_service_type`, `config_expr_type`, `config_match_method`, `config_ip_type`, `config_hex`, `config_multi_keywords`, `config_ip_pattern`, `config_port_pattern`, `config_direction`, `config_protocol`, `config_ip_port_show`, `config_region_sort`) VALUES ('22', '', '1', 'NTC_UNIVERSAL_IP', '流媒体协议 IP配置', '1', '1', '1', NULL, '0000-00-00 00:00:00', NULL, '0000-00-00 00:00:00', '', '', '', '4,6', '', '', '1,2,3', '1,2', '0,1', '0,6,17', '1,2,3,4', '1');
#voip配置
update function_service_dict set service_id='38',protocol_id='22' where dict_id='16';
update function_service_dict set service_id='150',protocol_id='22' where dict_id='17';
#voip 配置
update function_region_dict set config_region_value='NTC_UNIVERSAL_IP' where dict_id='8';
#文件摘要配置
update function_service_dict set service_id='399' where dict_id='59';
update function_service_dict set service_id='273' where dict_id='60';
update function_region_dict set config_region_value ='MM_FILE_DIGEST' where dict_id='50';
update function_region_dict set is_valid='0' where dict_id='187';

View File

@@ -250,11 +250,11 @@
class="glyphicon glyphicon-plus ${tabName}Add"
onClick="addContent(this,'${tabName}')" title="add"></span></small>
</h4>
<c:set var="cfgName" value="voipIps[${ipCfgIndex}]"></c:set>
<c:set var="cfgName" value="ipPortList[${ipCfgIndex}]"></c:set>
<%-- <c:set var="regionValue" value="${region.configRegionValue}"></c:set> --%>
<c:choose>
<c:when test="${fn:length(_cfg.voipIps)>0 and ipCfgIndex<fn:length(_cfg.voipIps) }">
<c:forEach items="${_cfg.voipIps}" var="ipPort">
<c:when test="${fn:length(_cfg.ipPortList)>0 and ipCfgIndex<fn:length(_cfg.ipPortList) }">
<c:forEach items="${_cfg.ipPortList}" var="ipPort">
<c:if test="${region.configRegionValue eq ipPort.cfgType }">
<div class="row boxSolid ${tabName}${status.index}">
<%@include file="/WEB-INF/views/cfg/ipCfgForm.jsp"%>

View File

@@ -22,7 +22,7 @@
</div>
<c:forEach items="${tabList}" var="region">
<c:if test="${region[0] eq 1 }">
<c:forEach items="${_cfg.voipIps}" var="cfg">
<c:forEach items="${_cfg.ipPortList}" var="cfg">
<c:if test="${region[1] eq cfg.cfgType }">
<div id="${region[1]}Info${index}" class="content" name="subCfg${index}">
<div class="row">