音视频内容IP审核功能完成
音视频图片IP功能完成 音视频VOIP界面protocolId修改
This commit is contained in:
18
src/main/java/com/nis/domain/configuration/AvPicIpCfg.java
Normal file
18
src/main/java/com/nis/domain/configuration/AvPicIpCfg.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package com.nis.domain.configuration;
|
||||
|
||||
/**
|
||||
* @ClassName: AvPicIpCfg.java
|
||||
* @Description: 音视频Pic IP
|
||||
* @author (dell)
|
||||
* @date 2018年2月6日 上午8:29:26
|
||||
* @version V1.0
|
||||
*/
|
||||
public class AvPicIpCfg extends BaseIpCfg {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1249923766365462700L;
|
||||
|
||||
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
@@ -21,6 +22,7 @@ import com.nis.domain.configuration.AvContIpCfg;
|
||||
import com.nis.domain.configuration.AvVoipAccountCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.AvVoipIpCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
@@ -33,9 +35,10 @@ import com.nis.web.security.UserUtils;
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/ntc/av")
|
||||
public class AvContentController extends BaseController {
|
||||
|
||||
/*****************************voip业务***************/
|
||||
//音视频VOIP配置新增界面
|
||||
@RequestMapping(value = {"/voipForm"})
|
||||
@RequiresPermissions(value={"avVoip:config"})
|
||||
public String voipFrom(Model model,HttpServletRequest request,HttpServletResponse response,String ids,@ModelAttribute("cfg")CfgIndexInfo cfg){
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg.setCompileId(Integer.parseInt(ids));
|
||||
@@ -93,12 +96,14 @@ public class AvContentController extends BaseController {
|
||||
|
||||
//修改VOIP例配置状态
|
||||
@RequestMapping(value = {"/updateAvVoipValid"})
|
||||
@RequiresPermissions(value={"avVoip:config"})
|
||||
public String updateVoipValid(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
avContentCfgService.updateAvVoipValid(isAudit,isValid,ids,functionId);
|
||||
return "redirect:" + adminPath +"/ntc/av/voipList?functionId="+functionId;
|
||||
}
|
||||
//修改VOIP配置审核状态
|
||||
@RequestMapping(value = {"/auditAvVoip"})
|
||||
@RequiresPermissions(value={"avVoip:audit"})
|
||||
public String auditVoip(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
String[] idArray = ids.split(",");
|
||||
@@ -128,18 +133,21 @@ public class AvContentController extends BaseController {
|
||||
voipAndAccountInfoMap.put("account", voipAccountCfgList);
|
||||
return voipAndAccountInfoMap;
|
||||
}
|
||||
/*****************************voip业务***************/
|
||||
|
||||
/*****************************contIp业务***************/
|
||||
//视频文本内容配置列表
|
||||
@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);
|
||||
public String contIpList(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")BaseIpCfg entity){
|
||||
Page<BaseIpCfg> page = avContentCfgService.findContIpPage(new Page<BaseIpCfg>(request, response,"r"), entity);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model);
|
||||
return "/cfg/av/contIp/contIpList";
|
||||
}
|
||||
//音视频文本内容新增界面
|
||||
//音视频CONTIP新增界面
|
||||
@RequestMapping(value = {"/contentIpForm"})
|
||||
public String contIpForm(Model model,HttpServletRequest request,HttpServletResponse response,String ids,@ModelAttribute("cfg")AvContIpCfg cfg){
|
||||
@RequiresPermissions(value={"avContentIp:config"})
|
||||
public String contIpForm(Model model,HttpServletRequest request,HttpServletResponse response,String ids,@ModelAttribute("cfg")BaseIpCfg cfg){
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg.setCfgId(Long.parseLong(ids));
|
||||
cfg = avContentCfgService.getContIpCfgById(cfg);
|
||||
@@ -151,13 +159,13 @@ public class AvContentController extends BaseController {
|
||||
return "/cfg/av/contIp/contIpForm";
|
||||
}
|
||||
|
||||
//保存voip信息
|
||||
//保存CONTIP信息
|
||||
@RequestMapping(value = {"/saveContIp"})
|
||||
public String saveContIp(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")AvContIpCfg cfg,
|
||||
@ModelAttribute("cfg")BaseIpCfg cfg,
|
||||
@ModelAttribute("areaCfgIds")String areaCfgIds){
|
||||
try{
|
||||
avContentCfgService.saveOrUpdateAvContIp(cfg,areaCfgIds);
|
||||
avContentCfgService.saveOrUpdateContIp(cfg,areaCfgIds);
|
||||
addMessage(model,"save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
@@ -167,4 +175,92 @@ public class AvContentController extends BaseController {
|
||||
|
||||
return "redirect:" + adminPath +"/ntc/av/contentIpList?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
|
||||
//修改CONTIP例配置状态
|
||||
@RequestMapping(value = {"/updateAvContIpValid"})
|
||||
@RequiresPermissions(value={"avContentIp:config"})
|
||||
public String updateAvContIpValid(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
avContentCfgService.updateContIpValid(isAudit,isValid,ids,functionId);
|
||||
return "redirect:" + adminPath +"/ntc/av/contentIpList?functionId="+functionId;
|
||||
}
|
||||
//修改CONTIP配置审核
|
||||
@RequestMapping(value = {"/auditAvContIp"})
|
||||
@RequiresPermissions(value={"avContentIp:audit"})
|
||||
public String auditContIp(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime=new Date();
|
||||
for(String id :idArray){
|
||||
avContentCfgService.auditContIp(isAudit,isValid,functionId,id,auditTime);
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/av/contentIpList?functionId="+functionId;
|
||||
}
|
||||
/*****************************contIp业务***************/
|
||||
|
||||
/*****************************picIp业务***************/
|
||||
//视频文本内容配置列表
|
||||
@RequestMapping(value = {"/picIpList"})
|
||||
public String picIpList(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")BaseIpCfg entity){
|
||||
Page<BaseIpCfg> page = avContentCfgService.findPicIpPage(new Page<BaseIpCfg>(request, response,"r"), entity);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model);
|
||||
return "/cfg/av/picIp/picIpList";
|
||||
}
|
||||
//音视频CONTIP新增界面
|
||||
@RequestMapping(value = {"/picIpForm"})
|
||||
@RequiresPermissions(value={"avPicIp:config"})
|
||||
public String picIpForm(Model model,HttpServletRequest request,HttpServletResponse response,String ids,@ModelAttribute("cfg")BaseIpCfg cfg){
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
cfg.setCfgId(Long.parseLong(ids));
|
||||
cfg = avContentCfgService.getPicIpCfgById(cfg);
|
||||
initUpdateFormCondition(model, cfg);
|
||||
}else{
|
||||
initFormCondition(model,cfg);
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
return "/cfg/av/contIp/contIpForm";
|
||||
}
|
||||
|
||||
//保存CONTIP信息
|
||||
@RequestMapping(value = {"/savePicIp"})
|
||||
public String savePicIp(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")BaseIpCfg cfg,
|
||||
@ModelAttribute("areaCfgIds")String areaCfgIds){
|
||||
try{
|
||||
avContentCfgService.saveOrUpdatePicIp(cfg,areaCfgIds);
|
||||
addMessage(model,"save_success");
|
||||
}catch(Exception e){
|
||||
logger.error("信息保存失败",e);
|
||||
e.printStackTrace();
|
||||
addMessage(model,"save_failed");
|
||||
}
|
||||
|
||||
return "redirect:" + adminPath +"/ntc/av/picIpList?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
|
||||
//修改CONTIP例配置状态
|
||||
@RequestMapping(value = {"/updatePicIpValid"})
|
||||
@RequiresPermissions(value={"avPicIp:config"})
|
||||
public String updateAvPicIpValid(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
avContentCfgService.updatePicIpValid(isAudit,isValid,ids,functionId);
|
||||
return "redirect:" + adminPath +"/ntc/av/picIpList?functionId="+functionId;
|
||||
}
|
||||
//修改CONTIP配置审核
|
||||
@RequestMapping(value = {"/auditPicIp"})
|
||||
@RequiresPermissions(value={"avPicIp:audit"})
|
||||
public String auditPicIp(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
String[] idArray = ids.split(",");
|
||||
Date auditTime=new Date();
|
||||
for(String id :idArray){
|
||||
avContentCfgService.auditPicIp(isAudit,isValid,functionId,id,auditTime);
|
||||
}
|
||||
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/av/picIpList?functionId="+functionId;
|
||||
}
|
||||
/*****************************picIp业务***************/
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,8 @@ import com.nis.web.dao.MyBatisDao;
|
||||
@MyBatisDao
|
||||
public interface AvContentCfgDao {
|
||||
public List<CfgIndexInfo> findVoipList(CfgIndexInfo entity) ;
|
||||
public List<AvContIpCfg> findContIpList(AvContIpCfg entity) ;
|
||||
public List<BaseIpCfg> findIpList(BaseIpCfg entity) ;
|
||||
public List<BaseIpCfg> getIpList(BaseIpCfg entity) ;
|
||||
public List<AvVoipIpCfg> findVoipIpCfgList(CfgIndexInfo entity);
|
||||
public List<AvVoipAccountCfg> findVoipAccountCfgList(CfgIndexInfo entity);
|
||||
public CfgIndexInfo getCfgIndexInfo(CfgIndexInfo entity);
|
||||
@@ -31,7 +32,7 @@ public interface AvContentCfgDao {
|
||||
public void updateAvVoipAccount(CfgIndexInfo entity);
|
||||
public void deleteAvVoipIp(CfgIndexInfo entity);
|
||||
public void deleteAvVoipAccount(CfgIndexInfo entity);
|
||||
public AvContIpCfg findContIpCfgById(AvContIpCfg entity) ;
|
||||
public void insertAvContIp(AvContIpCfg entity);
|
||||
public void updateAvContIp(AvContIpCfg entity);
|
||||
public BaseIpCfg findIpCfgById(BaseIpCfg entity) ;
|
||||
public void insertIp(BaseIpCfg entity);
|
||||
public void updateIp(BaseIpCfg entity);
|
||||
}
|
||||
|
||||
@@ -804,14 +804,14 @@
|
||||
</where>
|
||||
</delete>
|
||||
<!-- avContIp条件查询列表信息 -->
|
||||
<select id="findContIpList" resultMap="AvContIpCfgMap" parameterType="com.nis.domain.configuration.AvContIpCfg" >
|
||||
<select id="findIpList" resultMap="AvContIpCfgMap" parameterType="com.nis.domain.configuration.BaseIpCfg" >
|
||||
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
|
||||
FROM ${tableName} 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
|
||||
@@ -912,10 +912,10 @@
|
||||
</choose>
|
||||
</select>
|
||||
<!-- 根据cfg_id获取avContIpCfg信息 -->
|
||||
<select id="findContIpCfgById" resultMap="AvContIpCfgMap" parameterType="com.nis.domain.configuration.AvContIpCfg">
|
||||
<select id="findIpCfgById" resultMap="AvContIpCfgMap" parameterType="com.nis.domain.configuration.BaseIpCfg">
|
||||
select
|
||||
<include refid="AvContIp_Column" />
|
||||
from av_cont_ip_cfg r
|
||||
from ${tableName} r
|
||||
<where>
|
||||
<if test="cfgId != null">
|
||||
and r.cfg_id=#{cfgId,jdbcType=INTEGER}
|
||||
@@ -932,11 +932,8 @@
|
||||
|
||||
</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 (
|
||||
<insert id="insertIp" parameterType="com.nis.domain.configuration.BaseIpCfg" >
|
||||
insert into ${tableName} (
|
||||
CFG_DESC,
|
||||
ACTION,
|
||||
IS_VALID,
|
||||
@@ -1003,8 +1000,8 @@
|
||||
)
|
||||
</insert>
|
||||
<!-- update av_cont_ip_cfg表信息 -->
|
||||
<update id="updateAvContIp" parameterType="com.nis.domain.configuration.AvContIpCfg" >
|
||||
update av_cont_ip_cfg
|
||||
<update id="updateIp" parameterType="com.nis.domain.configuration.BaseIpCfg" >
|
||||
update ${tableName}
|
||||
<set >
|
||||
<trim suffixOverrides=",">
|
||||
<if test="cfgDesc != null and cfgDesc != ''" >
|
||||
@@ -1105,4 +1102,22 @@
|
||||
</if>
|
||||
</where>
|
||||
</update>
|
||||
<select id="getIpList" resultMap="AvVoipIpCfgMap" parameterType="com.nis.domain.configuration.BaseIpCfg">
|
||||
select
|
||||
<include refid="AvVoipIp_Column" />
|
||||
from ${tableName} 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>
|
||||
</mapper>
|
||||
@@ -1,10 +1,8 @@
|
||||
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;
|
||||
|
||||
@@ -13,22 +11,13 @@ 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;
|
||||
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.BaseIpCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.HttpBodyCfg;
|
||||
import com.nis.domain.configuration.HttpReqHeadCfg;
|
||||
import com.nis.domain.configuration.HttpResHeadCfg;
|
||||
import com.nis.domain.configuration.HttpUrlCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.maat.MaatCfg;
|
||||
import com.nis.domain.maat.ToMaatBean;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
@@ -61,6 +50,8 @@ public class AvContentCfgService extends BaseService{
|
||||
@Autowired
|
||||
protected AreaIpCfgDao areaIpCfgDao;
|
||||
|
||||
|
||||
/********************************voip业务*********************************/
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param page 分页对象
|
||||
@@ -253,7 +244,18 @@ public class AvContentCfgService extends BaseService{
|
||||
//新增
|
||||
entity.setCreatorId(UserUtils.getUser().getId());
|
||||
entity.setCreateTime(createTime);
|
||||
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
|
||||
,"cfgType"
|
||||
,"ipType"
|
||||
,"ipPattern"
|
||||
,"srcIpAddress"
|
||||
,"portPattern"
|
||||
,"srcPort"
|
||||
,"destPort"
|
||||
,"protocol"
|
||||
,"direction"
|
||||
,"protocolId"
|
||||
});
|
||||
areaIpCfgDao.saveAreaIpCfg(areaIpCfg);
|
||||
}
|
||||
}
|
||||
@@ -428,26 +430,29 @@ public class AvContentCfgService extends BaseService{
|
||||
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
//调用服务接口取消配置
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("http配置下发配置参数:"+json);
|
||||
logger.info("voip配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.put(json,1);
|
||||
logger.info("http配置取消配置响应信息:"+result.getMsg());
|
||||
logger.info("voip配置取消配置响应信息:"+result.getMsg());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/********************************voip业务*********************************/
|
||||
|
||||
|
||||
/********************************contIp业务*********************************/
|
||||
/**
|
||||
* contIp查询分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<AvContIpCfg> findContIpPage(Page page, AvContIpCfg entity) {
|
||||
public Page<BaseIpCfg> findContIpPage(Page page, BaseIpCfg entity) {
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
|
||||
entity.setPage(page);
|
||||
List<AvContIpCfg> list=avContentCfgDao.findContIpList(entity);
|
||||
entity.setTableName("av_cont_ip_cfg");
|
||||
List<BaseIpCfg> list=avContentCfgDao.findIpList(entity);
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
@@ -457,12 +462,14 @@ public class AvContentCfgService extends BaseService{
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public AvContIpCfg getContIpCfgById(AvContIpCfg entity) {
|
||||
return avContentCfgDao.findContIpCfgById(entity);
|
||||
public BaseIpCfg getContIpCfgById(BaseIpCfg entity) {
|
||||
entity.setTableName("av_cont_ip_cfg");
|
||||
return avContentCfgDao.findIpCfgById(entity);
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveOrUpdateAvContIp(AvContIpCfg entity,String areaCfgIds){
|
||||
public void saveOrUpdateContIp(BaseIpCfg entity,String areaCfgIds){
|
||||
Date createTime=new Date();
|
||||
entity.setTableName("av_cont_ip_cfg");
|
||||
|
||||
//区域IPsetAreaEffectiveIds设置
|
||||
List<AreaIpCfg> areaCfg=entity.getAreaCfg();
|
||||
@@ -510,13 +517,24 @@ public class AvContentCfgService extends BaseService{
|
||||
//保存区域IP信息
|
||||
if(entity.getAreaCfg()!=null&&entity.getAreaCfg().size()>0){
|
||||
for (AreaIpCfg areaIpCfg : entity.getAreaCfg()) {
|
||||
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
|
||||
,"cfgType"
|
||||
,"ipType"
|
||||
,"ipPattern"
|
||||
,"srcIpAddress"
|
||||
,"portPattern"
|
||||
,"srcPort"
|
||||
,"destPort"
|
||||
,"protocol"
|
||||
,"direction"
|
||||
,"protocolId"
|
||||
});
|
||||
areaIpCfgDao.saveAreaIpCfg(areaIpCfg);
|
||||
}
|
||||
}
|
||||
|
||||
//保存cfgIndexInfo
|
||||
avContentCfgDao.insertAvContIp(entity);
|
||||
avContentCfgDao.insertIp(entity);
|
||||
}else{
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||
}
|
||||
@@ -538,13 +556,36 @@ public class AvContentCfgService extends BaseService{
|
||||
//修改
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(editTime);
|
||||
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode","cfgType","cfgId"});
|
||||
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
|
||||
,"cfgType"
|
||||
,"cfgId"
|
||||
,"ipType"
|
||||
,"ipPattern"
|
||||
,"srcIpAddress"
|
||||
,"portPattern"
|
||||
,"srcPort"
|
||||
,"destPort"
|
||||
,"protocol"
|
||||
,"direction"
|
||||
,"protocolId"
|
||||
});
|
||||
areaIpCfgDao.updateAreaIpCfg(areaIpCfg);
|
||||
}else{
|
||||
//新增
|
||||
entity.setCreatorId(UserUtils.getUser().getId());
|
||||
entity.setCreateTime(createTime);
|
||||
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
|
||||
,"cfgType"
|
||||
,"ipType"
|
||||
,"ipPattern"
|
||||
,"srcIpAddress"
|
||||
,"portPattern"
|
||||
,"srcPort"
|
||||
,"destPort"
|
||||
,"protocol"
|
||||
,"direction"
|
||||
,"protocolId"
|
||||
});
|
||||
areaIpCfgDao.saveAreaIpCfg(areaIpCfg);
|
||||
}
|
||||
}
|
||||
@@ -561,7 +602,448 @@ public class AvContentCfgService extends BaseService{
|
||||
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(editTime);
|
||||
avContentCfgDao.updateAvContIp(entity);
|
||||
avContentCfgDao.updateIp(entity);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param isAudit
|
||||
* @param isValid
|
||||
* @param ids compileIds
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void updateContIpValid(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
BaseIpCfg entity = new BaseIpCfg();
|
||||
entity.setTableName("av_cont_ip_cfg");
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity.setCfgId(Long.parseLong(id));
|
||||
entity.setFunctionId(functionId);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
avContentCfgDao.updateIp(entity);
|
||||
AreaIpCfg areaIpCfg=new AreaIpCfg();
|
||||
BeanUtils.copyProperties(entity, areaIpCfg);
|
||||
areaIpCfgDao.updateAreaIpCfgValid(areaIpCfg);
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param isAudit
|
||||
* @param isValid
|
||||
* @param ids cfgId
|
||||
* @param functionId
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void auditContIp(Integer isAudit,Integer isValid,Integer functionId,String id,Date auditTime){
|
||||
BaseIpCfg entity = new BaseIpCfg();
|
||||
entity.setTableName("av_cont_ip_cfg");
|
||||
|
||||
List<BaseIpCfg> list = new ArrayList();
|
||||
List<AreaIpCfg> areaIpCfgList = new ArrayList();
|
||||
|
||||
entity.setCfgId(Long.parseLong(id));
|
||||
entity = avContentCfgDao.findIpCfgById(entity);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(auditTime);
|
||||
|
||||
|
||||
avContentCfgDao.updateIp(entity);
|
||||
AreaIpCfg areaIpCfg=new AreaIpCfg();
|
||||
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
|
||||
,"cfgType"
|
||||
,"cfgId"
|
||||
,"ipType"
|
||||
,"ipPattern"
|
||||
,"srcIpAddress"
|
||||
,"portPattern"
|
||||
,"srcPort"
|
||||
,"destPort"
|
||||
,"protocol"
|
||||
,"direction"
|
||||
,"protocolId"
|
||||
});
|
||||
|
||||
areaIpCfgDao.updateAreaIpCfg(areaIpCfg);
|
||||
|
||||
list=avContentCfgDao.getIpList(entity);
|
||||
areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
|
||||
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
MaatCfg maatCfg = new MaatCfg();
|
||||
List<MaatCfg> configCompileList = new ArrayList();
|
||||
List<GroupCfg> groupRelationList = new ArrayList();
|
||||
List<IpCfg> ipRegionList = new ArrayList();
|
||||
List<StringCfg> strRegionList = new ArrayList();
|
||||
List<NumBoundaryCfg> numRegionList = new ArrayList();
|
||||
List<DigestCfg> digestRegionList = new ArrayList();
|
||||
List<IpCfg> areaIpRegionList = new ArrayList();
|
||||
|
||||
if(isAudit==1){
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
Map<String,List> ipMap = cfgConvert(ipRegionList,list,1,entity,groupRelationList);
|
||||
groupRelationList=ipMap.get("groupList");
|
||||
ipRegionList=ipMap.get("dstList");
|
||||
}
|
||||
|
||||
if(!StringUtil.isEmpty(areaIpCfgList)){
|
||||
Map<String,List> areaMap = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList);
|
||||
groupRelationList=areaMap.get("groupList");
|
||||
areaIpRegionList=areaMap.get("dstList");
|
||||
}
|
||||
}
|
||||
|
||||
//构造提交综合服务参数格式,一条配置提交一次综合服务
|
||||
if(isAudit==1){
|
||||
maatCfg.initDefaultValue();
|
||||
BeanUtils.copyProperties(entity, maatCfg);
|
||||
maatCfg.setAction(entity.getAction());
|
||||
maatCfg.setAuditTime(entity.getAuditTime());
|
||||
maatCfg.setIpRegionList(ipRegionList);
|
||||
maatCfg.setStrRegionList(strRegionList);
|
||||
maatCfg.setNumRegionList(numRegionList);
|
||||
maatCfg.setDigestRegionList(digestRegionList);
|
||||
maatCfg.setGroupRelationList(groupRelationList);
|
||||
maatCfg.setGroupNum(groupRelationList.size());
|
||||
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
||||
maatCfg.setIsValid(entity.getIsValid());
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("contIp配置下发配置参数:"+json);
|
||||
//TODO 调用服务接口下发配置
|
||||
//ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
//logger.info("contIp配置下发响应信息:"+result.getMsg());
|
||||
|
||||
}else if(isAudit==3){
|
||||
maatCfg.setCompileId(entity.getCompileId());
|
||||
maatCfg.setServiceId(entity.getServiceId());
|
||||
maatCfg.setIsValid(0);//无效
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
//调用服务接口取消配置
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("contIp配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
//ToMaatResult result = ConfigServiceUtil.put(json,1);
|
||||
//logger.info("http配置取消配置响应信息:"+result.getMsg());
|
||||
}
|
||||
}
|
||||
/********************************contIp业务*********************************/
|
||||
|
||||
|
||||
/********************************picIp业务*********************************/
|
||||
/**
|
||||
* picIp查询分页数据
|
||||
* @param page 分页对象
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public Page<BaseIpCfg> findPicIpPage(Page page, BaseIpCfg entity) {
|
||||
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r"));
|
||||
entity.setPage(page);
|
||||
entity.setTableName("av_pic_ip_cfg");
|
||||
List<BaseIpCfg> list=avContentCfgDao.findIpList(entity);
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* picIp根据id查询contIpCfg信息
|
||||
* @param entity
|
||||
* @return
|
||||
*/
|
||||
public BaseIpCfg getPicIpCfgById(BaseIpCfg entity) {
|
||||
entity.setTableName("av_pic_ip_cfg");
|
||||
return avContentCfgDao.findIpCfgById(entity);
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void saveOrUpdatePicIp(BaseIpCfg entity,String areaCfgIds){
|
||||
Date createTime=new Date();
|
||||
entity.setTableName("av_pic_ip_cfg");
|
||||
//区域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());
|
||||
entity.setCreateTime(createTime);
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
//调用服务接口获取compileId
|
||||
List<Integer> compileIds = new ArrayList<Integer>();
|
||||
try {
|
||||
compileIds = ConfigServiceUtil.getId(1,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));
|
||||
|
||||
//保存区域IP信息
|
||||
if(entity.getAreaCfg()!=null&&entity.getAreaCfg().size()>0){
|
||||
for (AreaIpCfg areaIpCfg : entity.getAreaCfg()) {
|
||||
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
|
||||
,"cfgType"
|
||||
,"ipType"
|
||||
,"ipPattern"
|
||||
,"srcIpAddress"
|
||||
,"portPattern"
|
||||
,"srcPort"
|
||||
,"destPort"
|
||||
,"protocol"
|
||||
,"direction"
|
||||
,"protocolId"
|
||||
});
|
||||
areaIpCfgDao.saveAreaIpCfg(areaIpCfg);
|
||||
}
|
||||
}
|
||||
|
||||
//保存cfgIndexInfo
|
||||
avContentCfgDao.insertIp(entity);
|
||||
}else{
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||
}
|
||||
|
||||
//修改
|
||||
}else{
|
||||
Date editTime=new Date();
|
||||
entity.setIsValid(0);
|
||||
entity.setIsAudit(0);
|
||||
|
||||
areaCfgIds=!StringUtil.isEmpty(areaCfgIds)? ","+areaCfgIds:"";
|
||||
|
||||
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);
|
||||
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
|
||||
,"cfgType"
|
||||
,"cfgId"
|
||||
,"ipType"
|
||||
,"ipPattern"
|
||||
,"srcIpAddress"
|
||||
,"portPattern"
|
||||
,"srcPort"
|
||||
,"destPort"
|
||||
,"protocol"
|
||||
,"direction"
|
||||
,"protocolId"
|
||||
});
|
||||
areaIpCfgDao.updateAreaIpCfg(areaIpCfg);
|
||||
}else{
|
||||
//新增
|
||||
entity.setCreatorId(UserUtils.getUser().getId());
|
||||
entity.setCreateTime(createTime);
|
||||
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
|
||||
,"cfgType"
|
||||
,"ipType"
|
||||
,"ipPattern"
|
||||
,"srcIpAddress"
|
||||
,"portPattern"
|
||||
,"srcPort"
|
||||
,"destPort"
|
||||
,"protocol"
|
||||
,"direction"
|
||||
,"protocolId"
|
||||
});
|
||||
areaIpCfgDao.saveAreaIpCfg(areaIpCfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
//delete 真是删除areaIpCfg信息
|
||||
if(!StringUtil.isEmpty(areaCfgIds.replaceAll(",", ""))){
|
||||
areaCfgIds=areaCfgIds.substring(1,areaCfgIds.length());
|
||||
for (String cfgId : areaCfgIds.split(",")) {
|
||||
AreaIpCfg areaIpCfg=new AreaIpCfg();
|
||||
areaIpCfg.setCfgId(Long.parseLong(cfgId));
|
||||
areaIpCfgDao.deleteAreaIpCfgByCfgId(areaIpCfg);
|
||||
}
|
||||
}
|
||||
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(editTime);
|
||||
avContentCfgDao.updateIp(entity);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param isAudit
|
||||
* @param isValid
|
||||
* @param ids compileIds
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void updatePicIpValid(Integer isAudit,Integer isValid,String ids,Integer functionId){
|
||||
BaseIpCfg entity = new BaseIpCfg();
|
||||
entity.setTableName("av_pic_ip_cfg");
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity.setCfgId(Long.parseLong(id));
|
||||
entity.setFunctionId(functionId);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setEditorId(UserUtils.getUser().getId());
|
||||
entity.setEditTime(new Date());
|
||||
avContentCfgDao.updateIp(entity);
|
||||
AreaIpCfg areaIpCfg=new AreaIpCfg();
|
||||
BeanUtils.copyProperties(entity, areaIpCfg);
|
||||
areaIpCfgDao.updateAreaIpCfgValid(areaIpCfg);
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param isAudit
|
||||
* @param isValid
|
||||
* @param ids cfgId
|
||||
* @param functionId
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void auditPicIp(Integer isAudit,Integer isValid,Integer functionId,String id,Date auditTime){
|
||||
BaseIpCfg entity = new BaseIpCfg();
|
||||
entity.setTableName("av_pic_ip_cfg");
|
||||
List<BaseIpCfg> list = new ArrayList();
|
||||
List<AreaIpCfg> areaIpCfgList = new ArrayList();
|
||||
|
||||
entity.setCfgId(Long.parseLong(id));
|
||||
entity = avContentCfgDao.findIpCfgById(entity);
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(auditTime);
|
||||
|
||||
|
||||
avContentCfgDao.updateIp(entity);
|
||||
AreaIpCfg areaIpCfg=new AreaIpCfg();
|
||||
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
|
||||
,"cfgType"
|
||||
,"cfgId"
|
||||
,"ipType"
|
||||
,"ipPattern"
|
||||
,"srcIpAddress"
|
||||
,"portPattern"
|
||||
,"srcPort"
|
||||
,"destPort"
|
||||
,"protocol"
|
||||
,"direction"
|
||||
,"protocolId"
|
||||
});
|
||||
areaIpCfgDao.updateAreaIpCfg(areaIpCfg);
|
||||
|
||||
list=avContentCfgDao.getIpList(entity);
|
||||
areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
|
||||
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
MaatCfg maatCfg = new MaatCfg();
|
||||
List<MaatCfg> configCompileList = new ArrayList();
|
||||
List<GroupCfg> groupRelationList = new ArrayList();
|
||||
List<IpCfg> ipRegionList = new ArrayList();
|
||||
List<StringCfg> strRegionList = new ArrayList();
|
||||
List<NumBoundaryCfg> numRegionList = new ArrayList();
|
||||
List<DigestCfg> digestRegionList = new ArrayList();
|
||||
List<IpCfg> areaIpRegionList = new ArrayList();
|
||||
|
||||
if(isAudit==1){
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
Map<String,List> ipMap = cfgConvert(ipRegionList,list,1,entity,groupRelationList);
|
||||
groupRelationList=ipMap.get("groupList");
|
||||
ipRegionList=ipMap.get("dstList");
|
||||
}
|
||||
|
||||
if(!StringUtil.isEmpty(areaIpCfgList)){
|
||||
Map<String,List> areaMap = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList);
|
||||
groupRelationList=areaMap.get("groupList");
|
||||
areaIpRegionList=areaMap.get("dstList");
|
||||
}
|
||||
}
|
||||
|
||||
//构造提交综合服务参数格式,一条配置提交一次综合服务
|
||||
if(isAudit==1){
|
||||
maatCfg.initDefaultValue();
|
||||
BeanUtils.copyProperties(entity, maatCfg);
|
||||
maatCfg.setAction(entity.getAction());
|
||||
maatCfg.setAuditTime(entity.getAuditTime());
|
||||
maatCfg.setIpRegionList(ipRegionList);
|
||||
maatCfg.setStrRegionList(strRegionList);
|
||||
maatCfg.setNumRegionList(numRegionList);
|
||||
maatCfg.setDigestRegionList(digestRegionList);
|
||||
maatCfg.setGroupRelationList(groupRelationList);
|
||||
maatCfg.setGroupNum(groupRelationList.size());
|
||||
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
||||
maatCfg.setIsValid(entity.getIsValid());
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("contIp配置下发配置参数:"+json);
|
||||
//TODO 调用服务接口下发配置
|
||||
//ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
//logger.info("contIp配置下发响应信息:"+result.getMsg());
|
||||
|
||||
}else if(isAudit==3){
|
||||
maatCfg.setCompileId(entity.getCompileId());
|
||||
maatCfg.setServiceId(entity.getServiceId());
|
||||
maatCfg.setIsValid(0);//无效
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
//调用服务接口取消配置
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("contIp配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
//ToMaatResult result = ConfigServiceUtil.put(json,1);
|
||||
//logger.info("http配置取消配置响应信息:"+result.getMsg());
|
||||
}
|
||||
}
|
||||
/********************************contIp业务*********************************/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user