voip 区域信息增加,voipAccount修改为字符串类型配置

区域信息单选切换移至common.js
This commit is contained in:
duandongmei
2018-05-29 18:31:43 +08:00
parent 3ff6acb8c8
commit 787510e168
18 changed files with 1586 additions and 308 deletions

View File

@@ -0,0 +1,18 @@
package com.nis.domain.configuration;
/**
* @ClassName: AvVoipIpCfg.java
* @Description: 音视频Cont IP
* @author (dell)
* @date 2018年2月6日 上午8:29:26
* @version V1.0
*/
public class AvContIpCfg extends BaseIpCfg {
/**
*
*/
private static final long serialVersionUID = 1249923766365462700L;
}

View File

@@ -1,5 +1,6 @@
package com.nis.domain.configuration;
/**
* @ClassName: AvVoipAccountCfg.java
* @Description: TODO
@@ -7,7 +8,7 @@ package com.nis.domain.configuration;
* @date 2018年2月6日 上午8:18:55
* @version V1.0
*/
public class AvVoipAccountCfg extends ComplexkeywordCfg{
public class AvVoipAccountCfg extends BaseStringCfg{
private static final long serialVersionUID = -7398698517584394431L;

View File

@@ -27,6 +27,7 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
private static final String tableName="cfg_index_info";
private List<AvVoipAccountCfg> voipAccounts;//Add表单使用
private List<AvVoipIpCfg> voipIps; //Add表单使用
private AreaIpCfg areaIpCfg;
private AvVoipAccountCfg voipAccount;//Search使用
private AvVoipIpCfg voipIp;//Search使用
private IpPortCfg ipPort;
@@ -142,5 +143,11 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
public static String getTablename() {
return tableName;
}
public AreaIpCfg getAreaIpCfg() {
return areaIpCfg;
}
public void setAreaIpCfg(AreaIpCfg areaIpCfg) {
this.areaIpCfg = areaIpCfg;
}
}

View File

@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.nis.domain.Page;
import com.nis.domain.configuration.AvContIpCfg;
import com.nis.domain.configuration.AvVoipAccountCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.AvVoipIpCfg;
@@ -36,6 +37,7 @@ public class AvContentController extends BaseController {
if(!StringUtil.isEmpty(ids)){
cfg.setCompileId(Integer.parseInt(ids));
cfg = avContentCfgService.getCfgIndexInfo(cfg);
initUpdateFormCondition(model, cfg);
}else{
List<AvVoipAccountCfg> avVoipAccountCfgs=new ArrayList<AvVoipAccountCfg>();
avVoipAccountCfgs.add(new AvVoipAccountCfg());
@@ -43,9 +45,9 @@ public class AvContentController extends BaseController {
List<AvVoipIpCfg> avVoipIpCfgs=new ArrayList<AvVoipIpCfg>();
avVoipIpCfgs.add(new AvVoipIpCfg());
cfg.setVoipIps(avVoipIpCfgs);
initFormCondition(model,cfg);
}
initFormCondition(model,cfg);
model.addAttribute("_cfg", cfg);
return "/cfg/av/voip/voipForm";
}
@@ -55,10 +57,11 @@ public class AvContentController extends BaseController {
@RequestMapping(value = {"/saveVoip"})
public String saveVoip(Model model,HttpServletRequest request,HttpServletResponse response,
@ModelAttribute("cfg")CfgIndexInfo cfg,
@ModelAttribute("areaCfgIds")String areaCfgIds,
@ModelAttribute("voipIpIds")String voipIpIds,
@ModelAttribute("voipAccountIds")String voipAccountIds){
try{
avContentCfgService.saveOrUpdateAvVoip(cfg,voipIpIds,voipAccountIds);
avContentCfgService.saveOrUpdateAvVoip(cfg,voipIpIds,voipAccountIds,areaCfgIds);
addMessage(model,"save_success");
}catch(Exception e){
logger.error("voip信息保存失败",e);
@@ -117,18 +120,37 @@ public class AvContentController extends BaseController {
}
//视频文本内容配置列表
@RequestMapping(value = {"/contIpList"})
public String contIpList(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")CfgIndexInfo entity){
if(entity.getVoipIp()== null){
entity.setVoipIp(new AvVoipIpCfg());
}
if(entity.getVoipAccount()== null){
entity.setVoipAccount(new AvVoipAccountCfg());
}
Page<CfgIndexInfo> page = avContentCfgService.findPage(new Page<CfgIndexInfo>(request, response,"r"), entity);
@RequestMapping(value = {"/contentIpList"})
public String contIpList(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")AvContIpCfg entity){
Page<AvContIpCfg> page = avContentCfgService.findContIpPage(new Page<AvContIpCfg>(request, response,"r"), entity);
model.addAttribute("page", page);
initPageCondition(model);
return "/cfg/av/voip/voipList";
return "/cfg/av/contIp/contIpList";
}
//音视频文本内容新增界面
@RequestMapping(value = {"/contentIpForm"})
public String contIpForm(Model model,HttpServletRequest request,HttpServletResponse response,String ids,@ModelAttribute("cfg")AvContIpCfg cfg){
if(!StringUtil.isEmpty(ids)){
cfg = avContentCfgService.getContIpCfgById(cfg);
}
initFormCondition(model,cfg);
model.addAttribute("_cfg", cfg);
return "/cfg/av/contIp/contIpForm";
}
//保存voip信息
@RequestMapping(value = {"/saveContIp"})
public String saveContIp(Model model,HttpServletRequest request,HttpServletResponse response,
@ModelAttribute("cfg")AvContIpCfg cfg){
try{
avContentCfgService.saveOrUpdateAvContIp(cfg);
addMessage(model,"save_success");
}catch(Exception e){
logger.error("信息保存失败",e);
e.printStackTrace();
addMessage(model,"save_failed");
}
return "redirect:" + adminPath +"/ntc/av/contentIpList?functionId="+cfg.getFunctionId();
}
}

View File

@@ -5,6 +5,7 @@ import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.nis.domain.configuration.AreaIpCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
@@ -16,6 +17,10 @@ import com.nis.web.dao.MyBatisDao;
@MyBatisDao
public interface AreaIpCfgDao extends CrudDao<AreaIpCfg>{
public List<AreaIpCfg> getByCompileId(@Param("compileId") int compileId) ;
public List<AreaIpCfg> findAreaIpCfgList(CfgIndexInfo entity);
public void saveAreaIpCfg(AreaIpCfg entity);
public void saveAreaIpCfgFromCfgIndexInfo(CfgIndexInfo entity);
public void updateAreaIpCfgFromCfgIndexInfo(CfgIndexInfo entity);
public void deleteAreaIpCfg(AreaIpCfg entity);
public void deleteAreaIpCfgByCfgId(CfgIndexInfo entity);
}

View File

@@ -53,7 +53,26 @@
AND IS_VALID!=-1
</trim>
</select>
<!-- 根据compileId获取avVoipAccountCfg信息 -->
<select id="findAreaIpCfgList" resultMap="BaseIpMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
select
<include refid="AreaIpCfg_Column_List_with_id" />
from area_ip_cfg r
<where>
<if test="compileId != null">
and r.COMPILE_ID=#{compileId,jdbcType=INTEGER}
</if>
<choose>
<when test="isValid != null">
and r.is_valid=#{isValid,jdbcType=INTEGER}
</when>
<otherwise>
and r.is_valid != -1
</otherwise>
</choose>
</where>
</select>
<!-- insert area_ip_cfg表信息 -->
<insert id="saveAreaIpCfg" parameterType="com.nis.domain.configuration.AreaIpCfg" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
@@ -125,8 +144,201 @@
#{cfgRegionCode,jdbcType=INTEGER}
)
</insert>
<!-- insert area_ip_cfg表信息 -->
<insert id="saveAreaIpCfgFromCfgIndexInfo" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into area_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 (
#{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},
#{areaIpCfg.ipType,jdbcType=INTEGER},
#{areaIpCfg.srcIpAddress,jdbcType=VARCHAR},
#{areaIpCfg.ipPattern,jdbcType=INTEGER},
#{areaIpCfg.portPattern,jdbcType=INTEGER},
#{areaIpCfg.srcPort,jdbcType=VARCHAR},
#{areaIpCfg.protocol,jdbcType=INTEGER},
#{areaIpCfg.protocolId,jdbcType=INTEGER},
#{areaIpCfg.direction,jdbcType=INTEGER},
#{areaIpCfg.destPort,jdbcType=VARCHAR},
#{areaIpCfg.destIpAddress,jdbcType=VARCHAR},
#{areaIpCfg.cfgType,jdbcType=VARCHAR},
#{areaIpCfg.cfgRegionCode,jdbcType=INTEGER}
)
</insert>
<!-- update av_voip_ip_cfg表信息 -->
<update id="updateAreaIpCfgFromCfgIndexInfo" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
update area_ip_cfg
<set >
<trim suffixOverrides=",">
<if test="cfgDesc != null and cfgDesc != ''" >
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
</if>
<if test="action != null" >
action = #{action,jdbcType=INTEGER},
</if>
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null" >
is_audit = #{isAudit,jdbcType=INTEGER},
</if>
<if test="editorId != null" >
editor_id = #{editorId,jdbcType=INTEGER},
</if>
<if test="editTime != null and editTime != ''" >
edit_time = #{editTime,jdbcType=TIMESTAMP},
</if>
<if test="auditorId != null" >
AUDITOR_ID = #{auditorId,jdbcType=INTEGER},
</if>
<if test="auditTime != null and auditTime != ''" >
AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP},
</if>
<if test="compileId != null" >
COMPILE_ID = #{compileId,jdbcType=TIMESTAMP},
</if>
<if test="requestId != null" >
request_id = #{requestId,jdbcType=INTEGER},
</if>
<if test="isAreaEffective != null" >
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
</if>
<if test="classify != null and classify != ''" >
classify = #{classify,jdbcType=VARCHAR},
</if>
<if test="attribute != null and attribute != ''" >
attribute = #{attribute,jdbcType=VARCHAR},
</if>
<if test="lable != null and lable != ''" >
lable = #{lable,jdbcType=VARCHAR},
</if>
<if test="areaEffectiveIds != null" >
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
</if>
<if test="functionId != null" >
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="serviceId != null" >
service_id = #{serviceId,jdbcType=INTEGER},
</if>
<if test="areaIpCfg != null and areaIpCfg.ipType != null" >
ip_type = #{areaIpCfg.ipType,jdbcType=INTEGER},
</if>
<if test="areaIpCfg != null and areaIpCfg.srcIpAddress != null and areaIpCfg.srcIpAddress != ''" >
src_ip_address = #{areaIpCfg.srcIpAddress,jdbcType=VARCHAR},
</if>
<if test="areaIpCfg != null and areaIpCfg.ipPattern != null" >
ip_pattern = #{areaIpCfg.ipPattern,jdbcType=INTEGER},
</if>
<if test="areaIpCfg != null and areaIpCfg.portPattern != null" >
port_pattern = #{areaIpCfg.portPattern,jdbcType=INTEGER},
</if>
<if test="areaIpCfg != null and areaIpCfg.srcPort != null and areaIpCfg.srcPort != ''" >
src_port = #{areaIpCfg.srcPort,jdbcType=VARCHAR},
</if>
<if test="areaIpCfg != null and areaIpCfg.protocol != null" >
protocol = #{areaIpCfg.protocol,jdbcType=INTEGER},
</if>
<if test="areaIpCfg != null and areaIpCfg.protocolId != null" >
protocol_id = #{areaIpCfg.protocolId,jdbcType=INTEGER},
</if>
<if test="areaIpCfg != null and areaIpCfg.direction != null" >
direction = #{areaIpCfg.direction,jdbcType=INTEGER},
</if>
<if test="areaIpCfg != null and areaIpCfg.destPort != null and areaIpCfg.destPort != ''" >
dest_port = #{areaIpCfg.destPort,jdbcType=VARCHAR},
</if>
<if test="areaIpCfg != null and areaIpCfg.destIpAddress != null and areaIpCfg.destIpAddress != ''" >
dest_ip_address = #{areaIpCfg.destIpAddress,jdbcType=VARCHAR},
</if>
<if test="areaIpCfg != null and areaIpCfg.cfgType != null and areaIpCfg.cfgType != ''" >
cfg_type = #{areaIpCfg.cfgType,jdbcType=VARCHAR},
</if>
<if test="areaIpCfg != null and areaIpCfg.cfgRegionCode != null " >
cfg_region_code = #{areaIpCfg.cfgRegionCode,jdbcType=INTEGER},
</if>
</trim>
</set>
<where>
<if test="areaIpCfg != null and areaIpCfg.cfgId != null" >
and cfg_id = #{areaIpCfg.cfgId,jdbcType=INTEGER}
</if>
<if test="compileId != null" >
and compile_id = #{compileId,jdbcType=INTEGER}
</if>
<if test="functionId != null" >
and function_id = #{functionId,jdbcType=INTEGER}
</if>
</where>
</update>
<!-- 删除区域IP配置 -->
<delete id="deleteAreaIpCfg" >
delete from area_ip_cfg where compile_id=#{compileId} and function_id=#{functionId}
</delete>
<!-- 删除区域IP配置 -->
<!-- 删除voipIp信息 -->
<delete id="deleteAreaIpCfgByCfgId" parameterType="com.nis.domain.configuration.AreaIpCfg" >
delete from area_ip_cfg
<where>
<if test="areaIpCfg != null and areaIpCfg.cfgId != null" >
and cfg_id = #{areaIpCfg.cfgId,jdbcType=INTEGER}
</if>
<if test="compileId != null" >
and compile_id = #{compileId,jdbcType=INTEGER}
</if>
<if test="functionId != null" >
and function_id = #{functionId,jdbcType=INTEGER}
</if>
</where>
</delete>
</mapper>

View File

@@ -9,6 +9,7 @@ import com.nis.domain.configuration.AvVoipAccountCfg;
import com.nis.domain.configuration.AvVoipIpCfg;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.AvContIpCfg;
import com.nis.domain.configuration.AvFileSampleCfg;
import com.nis.domain.configuration.AvSignSampleCfg;
import com.nis.web.dao.CrudDao;
@@ -18,6 +19,7 @@ import com.nis.web.dao.MyBatisDao;
@MyBatisDao
public interface AvContentCfgDao {
public List<CfgIndexInfo> findVoipList(CfgIndexInfo entity) ;
public List<AvContIpCfg> findContIpList(AvContIpCfg entity) ;
public List<AvVoipIpCfg> findVoipIpCfgList(CfgIndexInfo entity);
public List<AvVoipAccountCfg> findVoipAccountCfgList(CfgIndexInfo entity);
public CfgIndexInfo getCfgIndexInfo(CfgIndexInfo entity);
@@ -29,4 +31,7 @@ public interface AvContentCfgDao {
public void updateAvVoipAccount(CfgIndexInfo entity);
public void deleteAvVoipIp(CfgIndexInfo entity);
public void deleteAvVoipAccount(CfgIndexInfo entity);
public AvContIpCfg findVoipIpCfgById(AvContIpCfg entity) ;
public void insertAvContIp(AvContIpCfg entity);
public void updateAvContIp(AvContIpCfg entity);
}

View File

@@ -61,7 +61,6 @@
<resultMap id="AvVoipAccountCfgMap" type="com.nis.domain.configuration.AvVoipAccountCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="district" property="district" jdbcType="VARCHAR" />
<result column="cfg_keywords" property="cfgKeywords" jdbcType="VARCHAR" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
@@ -89,6 +88,41 @@
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="AvContIpCfgMap" type="com.nis.domain.configuration.AvContIpCfg" >
<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="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,
@@ -104,12 +138,20 @@
,r.area_effective_ids,r.function_id,r.cfg_region_code
</sql>
<sql id="AvVoipAccount_Column" >
r.cfg_id,r.cfg_desc,r.district,r.cfg_keywords,r.cfg_type,
r.cfg_id,r.cfg_desc,r.cfg_keywords,r.cfg_type,
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,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
</sql>
<!-- 条件查询列表信息 -->
<sql id="AvContIp_Column" >
r.cfg_id,r.cfg_desc,r.ip_type,r.src_ip_address,r.ip_pattern,r.port_pattern,r.src_port
,r.protocol,r.protocol_id,r.direction,r.cfg_type,r.action,r.dest_port,r.dest_ip_address
,r.is_valid,r.is_audit,r.creator_id,r.create_time,r.editor_id
,r.edit_time,r.auditor_id,r.audit_time,r.service_id,r.request_id,
r.compile_id,r.is_area_effective,r.classify,r.attribute,r.lable
,r.area_effective_ids,r.function_id,r.cfg_region_code
</sql>
<!-- voip条件查询列表信息 -->
<select id="findVoipList" resultMap="CfgIndexInfoMap" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
SELECT
<include refid="AvVoip_Column" />
@@ -211,15 +253,12 @@
</where>
)
</if>
<if test="(voipAccount.cfgKeywords != null and voipAccount.cfgKeywords != '') or (voipAccount.district != null and voipAccount.district != '') ">
<if test="(voipAccount.cfgKeywords != null and voipAccount.cfgKeywords != '') ">
AND r.compile_id in (select f.compile_id from av_voip_account_cfg f
<where>
<if test="voipAccount.cfgKeywords != null and voipAccount.cfgKeywords != ''">
and f.cfg_keywords like concat(concat('%',#{voipAccount.cfgKeywords,jdbcType=VARCHAR}),'%')
</if>
<if test="voipAccount.district != null and voipAccount.district != ''">
and f.district =#{voipAccount.district,jdbcType=VARCHAR}
</if>
<if test="compileId != null">
and f.compile_id =#{compileId,jdbcType=INTEGER}
</if>
@@ -445,7 +484,6 @@
LABLE,
AREA_EFFECTIVE_IDS,
function_id,
district,
cfg_keywords,
cfg_type,
cfg_region_code,
@@ -472,7 +510,6 @@
#{lable,jdbcType=VARCHAR},
#{areaEffectiveIds,jdbcType=VARCHAR},
#{functionId,jdbcType=INTEGER},
#{voipAccount.district,jdbcType=VARCHAR},
#{voipAccount.cfgKeywords,jdbcType=VARCHAR},
#{voipAccount.cfgType,jdbcType=VARCHAR},
#{voipAccount.cfgRegionCode,jdbcType=INTEGER},
@@ -713,9 +750,6 @@
<if test="serviceId != null" >
service_id = #{serviceId,jdbcType=INTEGER},
</if>
<if test="voipAccount != null and voipAccount.district != null and voipAccount.district != ''" >
district = #{voipAccount.district,jdbcType=VARCHAR},
</if>
<if test="voipAccount != null and voipAccount.cfgKeywords != null and voipAccount.cfgKeywords != ''" >
cfg_keywords = #{voipAccount.cfgKeywords,jdbcType=VARCHAR},
</if>
@@ -778,7 +812,306 @@
</if>
</where>
</delete>
<!-- avContIp条件查询列表信息 -->
<select id="findContIpList" resultMap="AvContIpCfgMap" parameterType="com.nis.domain.configuration.AvContIpCfg" >
SELECT
<include refid="AvContIp_Column" />
<trim prefix="," prefixOverrides=",">
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName
</trim>
FROM av_cont_ip_cfg r
left join sys_user s on r.creator_id=s.id
left join sys_user e on r.editor_id=e.id
left join sys_user u on r.auditor_id=u.id
left join request_info ri on r.request_id=ri.id
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="cfgId != null">
AND r.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND r.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND r.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND r.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND r.IS_VALID != -1
</if>
<if test="isAudit != null">
AND r.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="creatorName != null and creatorName != ''">
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<!-- <if test="search_create_time_start != null and search_create_time_start != ''">
<![CDATA[AND r.CREATE_TIME >= #{search_create_time_start,jdbcType=TIMESTAMP}]]>
</if>
<if test="search_create_time_end != null and search_create_time_end != ''">
<![CDATA[AND r.CREATE_TIME <= #{search_create_time_end,jdbcType=TIMESTAMP}]]>
</if> -->
<if test="editorName != null and editorName != ''">
AND r.EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<!-- <if test="search_edit_time_start != null and search_edit_time_start != ''">
<![CDATA[AND r.EDIT_TIME >= #{search_edit_time_start,jdbcType=TIMESTAMP}]]>
</if>
<if test="search_edit_time_end != null and search_edit_time_end != ''">
<![CDATA[AND r.EDIT_TIME <= #{search_edit_time_end,jdbcType=TIMESTAMP}]]>
</if> -->
<if test="auditorName != null and auditorName != ''">
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<!-- <if test="search_audit_time_start != null and search_audit_time_start != ''">
<![CDATA[AND r.AUDIT_TIME >= #{search_audit_time_start,jdbcType=TIMESTAMP}]]>
</if>
<if test="search_audit_time_end != null and search_audit_time_end != ''">
<![CDATA[AND r.AUDIT_TIME <= #{search_audit_time_end,jdbcType=TIMESTAMP}]]>
</if> -->
<if test="serviceId != null">
AND r.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND r.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="compileId != null">
AND r.COMPILE_ID=#{compileId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND r.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify != ''">
AND r.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute != ''">
AND r.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable != ''">
AND r.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds != ''">
AND r.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND r.function_id=#{functionId,jdbcType=INTEGER}
</if>
<if test="srcIpAddress != null and srcIpAddress != ''">
and r.src_ip_address =#{srcIpAddress,jdbcType=VARCHAR}
</if>
<if test="srcPort != null and srcPort != ''">
and r.src_port =#{srcPort,jdbcType=VARCHAR}
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY r.CFG_ID desc
</otherwise>
</choose>
</select>
<!-- 根据cfg_id获取avContIpCfg信息 -->
<select id="findContIpCfgById" resultMap="AvContIpCfgMap" parameterType="com.nis.domain.configuration.AvContIpCfg">
select
<include refid="AvContIp_Column" />
from av_cont_ip_cfg r
<where>
<if test="cfgId != null">
and r.cfg_id=#{cfgId,jdbcType=INTEGER}
</if>
<choose>
<when test="isValid != null">
and r.is_valid=#{isValid,jdbcType=INTEGER}
</when>
<otherwise>
and r.is_valid != -1
</otherwise>
</choose>
</where>
</select>
<!-- insert AV_cont_IP_CFG表信息 -->
<insert id="insertAvContIp" parameterType="com.nis.domain.configuration.AvContIpCfg" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into av_cont_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 (
#{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 av_cont_ip_cfg表信息 -->
<update id="updateAvContIp" parameterType="com.nis.domain.configuration.AvContIpCfg" >
update av_cont_ip_cfg
<set >
<trim suffixOverrides=",">
<if test="cfgDesc != null and cfgDesc != ''" >
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
</if>
<if test="action != null" >
action = #{action,jdbcType=INTEGER},
</if>
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null" >
is_audit = #{isAudit,jdbcType=INTEGER},
</if>
<if test="editorId != null" >
editor_id = #{editorId,jdbcType=INTEGER},
</if>
<if test="editTime != null and editTime != ''" >
edit_time = #{editTime,jdbcType=TIMESTAMP},
</if>
<if test="auditorId != null" >
AUDITOR_ID = #{auditorId,jdbcType=INTEGER},
</if>
<if test="auditTime != null and auditTime != ''" >
AUDIT_TIME = #{auditTime,jdbcType=TIMESTAMP},
</if>
<if test="compileId != null" >
COMPILE_ID = #{compileId,jdbcType=TIMESTAMP},
</if>
<if test="requestId != null" >
request_id = #{requestId,jdbcType=INTEGER},
</if>
<if test="isAreaEffective != null" >
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
</if>
<if test="classify != null and classify != ''" >
classify = #{classify,jdbcType=VARCHAR},
</if>
<if test="attribute != null and attribute != ''" >
attribute = #{attribute,jdbcType=VARCHAR},
</if>
<if test="lable != null and lable != ''" >
lable = #{lable,jdbcType=VARCHAR},
</if>
<if test="areaEffectiveIds != null" >
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
</if>
<if test="functionId != null" >
function_id = #{functionId,jdbcType=INTEGER},
</if>
<if test="serviceId != null" >
service_id = #{serviceId,jdbcType=INTEGER},
</if>
<if test="ipType != null" >
ip_type = #{ipType,jdbcType=INTEGER},
</if>
<if test="srcIpAddress != null and srcIpAddress != ''" >
src_ip_address = #{srcIpAddress,jdbcType=VARCHAR},
</if>
<if test="ipPattern != null" >
ip_pattern = #{ipPattern,jdbcType=INTEGER},
</if>
<if test="portPattern != null" >
port_pattern = #{portPattern,jdbcType=INTEGER},
</if>
<if test="srcPort != null and srcPort != ''" >
src_port = #{srcPort,jdbcType=VARCHAR},
</if>
<if test="protocol != null" >
protocol = #{protocol,jdbcType=INTEGER},
</if>
<if test="protocolId != null" >
protocol_id = #{protocolId,jdbcType=INTEGER},
</if>
<if test="direction != null" >
protocol_id = #{direction,jdbcType=INTEGER},
</if>
<if test="destPort != null and destPort != ''" >
dest_port = #{destPort,jdbcType=VARCHAR},
</if>
<if test="destIpAddress != null and destIpAddress != ''" >
dest_ip_address = #{destIpAddress,jdbcType=VARCHAR},
</if>
<if test="cfgType != null and cfgType != ''" >
cfg_type = #{cfgType,jdbcType=VARCHAR},
</if>
<if test="cfgRegionCode != null " >
cfg_region_code = #{cfgRegionCode,jdbcType=INTEGER},
</if>
</trim>
</set>
<where>
<if test="cfgId != null" >
and cfg_id = #{cfgId,jdbcType=INTEGER}
</if>
<if test="functionId != null" >
and function_id = #{functionId,jdbcType=INTEGER}
</if>
</where>
</update>
</mapper>

View File

@@ -15,25 +15,24 @@ import org.springframework.transaction.annotation.Transactional;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.nis.domain.Page;
import com.nis.domain.configuration.AreaBean;
import com.nis.domain.configuration.AreaIpCfg;
import com.nis.domain.configuration.AvContIpCfg;
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.domain.maat.ToMaatResult;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.FileUtils;
import com.nis.util.Constants;
import com.nis.util.StringUtil;
import com.nis.web.dao.FunctionRegionDictDao;
import com.nis.web.dao.FunctionServiceDictDao;
import com.nis.web.dao.configuration.AvCfgDao;
import com.nis.util.StringUtils;
import com.nis.web.dao.configuration.AreaIpCfgDao;
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;
/**
@@ -45,6 +44,8 @@ import net.sf.json.JSONObject;
public class AvContentCfgService extends BaseService{
@Autowired
protected AvContentCfgDao avContentCfgDao;
@Autowired
protected AreaIpCfgDao areaIpCfgDao;
/**
* 查询分页数据
@@ -100,8 +101,33 @@ public class AvContentCfgService extends BaseService{
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void saveOrUpdateAvVoip(CfgIndexInfo entity,String voipIpIds,String voipAccountIds){
public void saveOrUpdateAvVoip(CfgIndexInfo entity,String voipIpIds,String voipAccountIds,String areaCfgIds){
Date createTime=new Date();
//区域IPsetAreaEffectiveIds设置
List<AreaIpCfg> areaCfg=entity.getAreaCfg();
List<AreaBean> areaIsps=entity.getAreaIsp();
if(Constants.IS_AREA_EFFECTIVE_NO==entity.getIsAreaEffective()){
entity.setAreaEffectiveIds("");
entity.setAreaType(null);
}else if(Constants.IS_AREA_EFFECTIVE_YES==entity.getIsAreaEffective()){
if(Constants.AREA_EFFECTIVE_TYPE_AREA_ISP==entity.getAreaType()&&areaIsps!=null&&areaIsps.size()>0){
StringBuffer areaEffectiveIds=new StringBuffer();
for(int i=0;i<areaIsps.size();i++){
if(StringUtils.isNotBlank(areaIsps.get(i).getIsp())){
areaEffectiveIds.append(areaIsps.get(i).getArea()+":"+areaIsps.get(i).getIsp());
}else{
areaEffectiveIds.append(areaIsps.get(i).getArea());
}
if(i!=areaIsps.size()-1){
areaEffectiveIds.append(",");
}
}
entity.setAreaEffectiveIds(areaEffectiveIds.toString());
}else if(Constants.AREA_EFFECTIVE_TYPE_AREA_IP==entity.getAreaType()&&areaCfg!=null&&areaCfg.size()>0){
entity.setAreaEffectiveIds("");
}
}
//新增
if(entity.getCfgId()==null){
entity.setCreatorId(UserUtils.getUser().getId());
@@ -111,7 +137,7 @@ public class AvContentCfgService extends BaseService{
//调用服务接口获取compileId
List<Integer> compileIds = new ArrayList<Integer>();
try {
//TODO 后期修改为动态获取
//TODO
//compileIds = ConfigServiceUtil.getId(1,1);
compileIds.add((int)Math.floor(Math.random()*1000000+1));
} catch (Exception e) {
@@ -135,12 +161,18 @@ public class AvContentCfgService extends BaseService{
avContentCfgDao.insertAvVoipAccount(entity);
}
}
//保存区域IP信息
if(entity.getAreaCfg()!=null&&entity.getAreaCfg().size()>0){
for (AreaIpCfg areaIpCfg : entity.getAreaCfg()) {
entity.setAreaIpCfg(areaIpCfg);
areaIpCfgDao.saveAreaIpCfgFromCfgIndexInfo(entity);
}
}
//保存cfgIndexInfo
avContentCfgDao.insertCfgIndexInfo(entity);
}else{
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
}
//修改
}else{
Date editTime=new Date();
@@ -149,6 +181,7 @@ public class AvContentCfgService extends BaseService{
voipIpIds=!StringUtil.isEmpty(voipIpIds)? voipIpIds+",":"";
voipAccountIds=!StringUtil.isEmpty(voipAccountIds)? voipAccountIds+",":"";
areaCfgIds=!StringUtil.isEmpty(areaCfgIds)? ","+areaCfgIds:"";
//判断voip信息为新增还是修改清楚voipIpIds修改的voipId记录剩下即为需要删除的voipId
if(!StringUtil.isEmpty(entity.getVoipIps())){
@@ -192,6 +225,26 @@ public class AvContentCfgService extends BaseService{
}
}
}
if(!StringUtil.isEmpty(entity.getAreaCfg())){
for (AreaIpCfg areaIpCfg : entity.getAreaCfg()) {
if(!StringUtil.isEmpty(areaIpCfg.getCfgId())){
if(areaCfgIds.contains(","+areaIpCfg.getCfgId()+",")){
areaCfgIds=areaCfgIds.replace(areaIpCfg.getCfgId()+",", "");
}
//修改
entity.setEditorId(UserUtils.getUser().getId());
entity.setEditTime(editTime);
entity.setAreaIpCfg(areaIpCfg);
areaIpCfgDao.updateAreaIpCfgFromCfgIndexInfo(entity);
}else{
//新增
entity.setCreatorId(UserUtils.getUser().getId());
entity.setCreateTime(createTime);
entity.setAreaIpCfg(areaIpCfg);
areaIpCfgDao.saveAreaIpCfgFromCfgIndexInfo(entity);
}
}
}
//delete 真是删除voipAccount信息
if(!StringUtil.isEmpty(voipAccountIds.replaceAll(",", ""))){
voipAccountIds=voipAccountIds.substring(1,voipAccountIds.length());
@@ -215,6 +268,18 @@ public class AvContentCfgService extends BaseService{
avContentCfgDao.deleteAvVoipIp(cfg);
}
}
//delete 真是删除areaIpCfg信息
if(!StringUtil.isEmpty(areaCfgIds.replaceAll(",", ""))){
areaCfgIds=areaCfgIds.substring(1,areaCfgIds.length());
for (String cfgId : areaCfgIds.split(",")) {
CfgIndexInfo cfg=new CfgIndexInfo();
AreaIpCfg areaIpCfg=new AreaIpCfg();
areaIpCfg.setCfgId(Long.parseLong(cfgId));
cfg.setAreaIpCfg(areaIpCfg);
areaIpCfgDao.deleteAreaIpCfgByCfgId(cfg);
}
}
//修改
entity.setEditorId(UserUtils.getUser().getId());
entity.setEditTime(editTime);
@@ -241,6 +306,7 @@ public class AvContentCfgService extends BaseService{
avContentCfgDao.updateAvVoipIp(entity);
avContentCfgDao.updateAvVoipAccount(entity);
avContentCfgDao.updateCfgIndexInfo(entity);
areaIpCfgDao.updateAreaIpCfgFromCfgIndexInfo(entity);
}
}
/**
@@ -256,6 +322,7 @@ public class AvContentCfgService extends BaseService{
List<CfgIndexInfo> list = new ArrayList();
List<AvVoipIpCfg> voipIpList = new ArrayList();
List<AvVoipAccountCfg> voipAccountList = new ArrayList();
List<AreaIpCfg> areaIpCfgList = new ArrayList();
Map<String, Object> childMap=new HashMap<>();
CfgIndexInfo searchCfg=new CfgIndexInfo();
Date auditTime=new Date();
@@ -268,12 +335,15 @@ public class AvContentCfgService extends BaseService{
entity.setAuditTime(auditTime);
voipIpList=avContentCfgDao.findVoipIpCfgList(entity);
voipAccountList=avContentCfgDao.findVoipAccountCfgList(entity);
areaIpCfgList=areaIpCfgDao.findAreaIpCfgList(entity);
avContentCfgDao.updateAvVoipIp(entity);
avContentCfgDao.updateAvVoipAccount(entity);
avContentCfgDao.updateCfgIndexInfo(entity);
childMap.put("voipIp", voipIpList);
childMap.put("voipAccount", voipAccountList);
areaIpCfgDao.updateAreaIpCfgFromCfgIndexInfo(entity);
childMap.put("voipIps", voipIpList);
childMap.put("voipAccounts", voipAccountList);
childMap.put("areaIpCfgs", areaIpCfgList);
list.add(entity);
}
/*if(isAudit==1){
@@ -305,4 +375,66 @@ public class AvContentCfgService extends BaseService{
}*/
}
/**
* contIp查询分页数据
* @param page 分页对象
* @param entity
* @return
*/
public Page<AvContIpCfg> findContIpPage(Page page, AvContIpCfg entity) {
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
entity.setPage(page);
List<AvContIpCfg> list=avContentCfgDao.findContIpList(entity);
page.setList(list);
return page;
}
/**
* contUp根据id查询contIpCfg信息
* @param entity
* @return
*/
public AvContIpCfg getContIpCfgById(AvContIpCfg entity) {
return avContentCfgDao.findVoipIpCfgById(entity);
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void saveOrUpdateAvContIp(AvContIpCfg entity){
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 {
//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));
//保存cfgIndexInfo
avContentCfgDao.insertAvContIp(entity);
}else{
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
}
//修改
}else{
Date editTime=new Date();
entity.setIsValid(0);
entity.setIsAudit(0);
entity.setEditorId(UserUtils.getUser().getId());
entity.setEditTime(editTime);
avContentCfgDao.updateAvContIp(entity);
}
}
}