Stream Media 域配置

NTC_STREAM_MEDIA_URL
NTC_ SUBSCRIBE_ID
NTC_UNIVERSAL_IP[protocol_id=23]
NTC_UNIVERSAL_PROTO_TYPE
This commit is contained in:
leijun
2018-10-12 19:31:16 +08:00
parent c5130454f1
commit cb2ce6f8ba
10 changed files with 1102 additions and 512 deletions

View File

@@ -8,11 +8,22 @@ package com.nis.domain.configuration;
* @version V1.0
*/
public class AvContUrlCfg extends BaseStringCfg<AvContUrlCfg> {
private static final String tableName="av_cont_url_cfg";
/**
*
*/
private static final long serialVersionUID = 1249923766365462700L;
@Override
public void initDefaultValue() {
super.initDefaultValue();
this.exprType=0;
this.matchMethod=0;
}
public static String getTablename() {
return tableName;
}
}

View File

@@ -56,6 +56,8 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
private NtcBgpAsCfg ntcBgpAsCfg;
private InterceptPktBin interceptPktBin;
private List<InterceptPktBin> interceptPktBinList;
private AvContUrlCfg avContUrlCfg;
private List<AvContUrlCfg> avContUrlCfgList;
private Long dnsStrategyId;
private String dnsStrategyName;
@@ -66,9 +68,18 @@ public class CfgIndexInfo extends BaseCfg<CfgIndexInfo> {
private List<P2pHashCfg> p2pHashList;
private List<P2pKeywordCfg> p2pKeywordList;
public AvContUrlCfg getAvContUrlCfg() {
return avContUrlCfg;
}
public void setAvContUrlCfg(AvContUrlCfg avContUrlCfg) {
this.avContUrlCfg = avContUrlCfg;
}
public List<AvContUrlCfg> getAvContUrlCfgList() {
return avContUrlCfgList;
}
public void setAvContUrlCfgList(List<AvContUrlCfg> avContUrlCfgList) {
this.avContUrlCfgList = avContUrlCfgList;
}
public Integer getAsnIpGroup() {
return asnIpGroup;
}

View File

@@ -24,6 +24,7 @@ import com.nis.domain.basics.ServiceDictInfo;
import com.nis.domain.basics.SysDictInfo;
import com.nis.domain.configuration.AreaBean;
import com.nis.domain.configuration.AreaIpCfg;
import com.nis.domain.configuration.AvContUrlCfg;
import com.nis.domain.configuration.AvVoipAccountCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.IpPortCfg;
@@ -545,12 +546,18 @@ public class AvContentController extends BaseController {
@RequestMapping(value = {"/contUrlList"})
public String contUrlList(Model model,HttpServletRequest request
,HttpServletResponse response
,@ModelAttribute("cfg")BaseStringCfg entity
,@ModelAttribute("cfg")CfgIndexInfo entity
,RedirectAttributes redirectAttributes){
if(entity.getIpPort()== null){
entity.setIpPort(new IpPortCfg());
}
Page<BaseStringCfg> page = avContentCfgService.findContUrlPage(new Page<BaseStringCfg>(request, response,"r"), entity);
if(entity.getAvContUrlCfgList()== null){
entity.setAvContUrlCfg(new AvContUrlCfg());;
}
if(entity.getNtcSubscribeIdCfg()==null){
entity.setNtcSubscribeIdCfg(new NtcSubscribeIdCfg());
}
Page<CfgIndexInfo> page = avContentCfgService.findPage(new Page<CfgIndexInfo>(request, response,"r"), entity);
model.addAttribute("page", page);
initPageCondition(model,entity);
return "/cfg/av/contUrl/contUrlList";
@@ -558,15 +565,25 @@ public class AvContentController extends BaseController {
//音视频CONTUrl新增界面
@RequestMapping(value = {"/contUrlForm"})
@RequiresPermissions(value={"avContUrl:config"})
public String contUrlForm(Model model,HttpServletRequest request
,HttpServletResponse response,String ids,String compileIds
,@ModelAttribute("cfg")BaseStringCfg cfg
,RedirectAttributes redirectAttributes){
if(!StringUtil.isEmpty(compileIds)){
cfg.setCompileId(Integer.parseInt(compileIds));
cfg = avContentCfgService.getContUrlCfgById(cfg);
public String contUrlForm(Model model,HttpServletRequest request ,HttpServletResponse response
,String compileIds,String ids, CfgIndexInfo cfg ,RedirectAttributes redirectAttributes){
if(!StringUtil.isEmpty(ids)){
cfg.setCfgId(Long.parseLong(ids));
cfg = avContentCfgService.getUrlCfgIndexInfo(cfg);
AvContUrlCfg urlCfg = new AvContUrlCfg();
urlCfg.setCfgType("NTC_STREAMING_MEDIA_URL");
cfg.setAvContUrlCfg(urlCfg);
if(cfg.getAvContUrlCfgList().size()==0){
cfg.getAvContUrlCfgList().add(urlCfg);
}
initUpdateFormCondition(model, cfg);
}else{
AvContUrlCfg urlCfg = new AvContUrlCfg();
urlCfg.setCfgType("NTC_STREAMING_MEDIA_URL");
cfg.setAvContUrlCfg(urlCfg);
List<AvContUrlCfg> urlList=new ArrayList<AvContUrlCfg>();
urlList.add(urlCfg);
cfg.setAvContUrlCfgList(urlList);
initFormCondition(model,cfg);
}
model.addAttribute("_cfg", cfg);
@@ -575,19 +592,22 @@ public class AvContentController extends BaseController {
//保存CONTUrl信息
@RequestMapping(value = {"/saveContUrl"})
public String saveContUrl(Model model,HttpServletRequest request
,HttpServletResponse response,
@ModelAttribute("cfg")BaseStringCfg cfg,
@ModelAttribute("areaCfgIds")String areaCfgIds
,RedirectAttributes redirectAttributes){
public String saveContUrl(Model model,HttpServletRequest request,HttpServletResponse response,String ids,
CfgIndexInfo cfg ,RedirectAttributes redirectAttributes){
try{
avContentCfgService.saveOrUpdateContUrl(cfg,areaCfgIds);
avContentCfgService.saveOrUpdateContUrl(cfg);
addMessage(redirectAttributes,"save_success");
}catch(Exception e){
logger.error("信息保存失败",e);
addMessage(redirectAttributes,"save_failed");
if(e instanceof MaatConvertException) {
e.printStackTrace();
logger.error("Stream Media 信息保存失败",e);
addMessage(redirectAttributes,"request_service_failed");
}else {
e.printStackTrace();
logger.error("Stream Media 信息保存失败",e);
addMessage(redirectAttributes,"save_failed");
}
}
return "redirect:" + adminPath +"/ntc/av/contUrlList?functionId="+cfg.getFunctionId();
}
@@ -606,8 +626,8 @@ public class AvContentController extends BaseController {
public String auditContUrl(Integer isAudit,Integer isValid,String ids
,String compileIds,Integer functionId
, RedirectAttributes redirectAttributes) {
if(!StringUtil.isEmpty(compileIds)){
String[] idArray = compileIds.split(",");
if(!StringUtil.isEmpty(ids)){
String[] idArray = ids.split(",");
Date auditTime=new Date();
for(String id :idArray){
try {
@@ -625,25 +645,44 @@ public class AvContentController extends BaseController {
// 获取域配置信息
@RequestMapping(value = {"ajaxAvContUrlList"})
public String ajaxAvContUrlList(Model model,Long cfgId,Integer index) {
BaseStringCfg baseStrCfg = new BaseStringCfg();
baseStrCfg.setCfgId(cfgId);
BaseStringCfg<NtcSubscribeIdCfg> cfg = avContentCfgService.getContUrlCfgById(baseStrCfg);
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
cfgIndexInfo.setCfgId(cfgId);
CfgIndexInfo cfg = avContentCfgService.getUrlCfgIndexInfo(cfgIndexInfo);
List<String[]> tabList = new ArrayList();
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.getAvContUrlCfgList()!=null){
String cfgType = null;
for(AvContUrlCfg avContUrlCfg:cfg.getAvContUrlCfgList()){
if(!avContUrlCfg.getCfgType().equals(cfgType)){
tabList.add(new String[]{"2",avContUrlCfg.getCfgType()});
cfgType = avContUrlCfg.getCfgType();
}
}
}
tabList.add(new String[]{"2",cfg.getCfgType()});
//查询关键字
if(cfg.getNtcSubscribeIdCfgList()!=null){
String cfgType = null;
for(NtcSubscribeIdCfg subscribeId:cfg.getNtcSubscribeIdCfgList()){
if(!subscribeId.getCfgType().equals(cfgType)){
tabList.add(new String[]{"2",subscribeId.getCfgType()});
cfgType = subscribeId.getCfgType();
for(NtcSubscribeIdCfg ntc:cfg.getNtcSubscribeIdCfgList()){
if(!ntc.getCfgType().equals(cfgType)){
tabList.add(new String[]{"2",ntc.getCfgType()});
cfgType = ntc.getCfgType();
}
}
}
model.addAttribute("_cfg", cfg);
model.addAttribute("index", index);
model.addAttribute("tabList", tabList);
return "/cfg/av/subList";
return "/cfg/av/contUrl/contSubList";
}
/*****************************contUrl业务***************/

View File

@@ -3,7 +3,7 @@ package com.nis.web.dao.configuration;
import java.util.List;
import com.nis.domain.configuration.AvContUrlCfg;
import com.nis.domain.configuration.AvVoipAccountCfg;
import com.nis.domain.configuration.AvVoipIpCfg;
import com.nis.domain.configuration.BaseCfg;
@@ -21,11 +21,16 @@ public interface AvContentCfgDao {
public List<AvVoipIpCfg> findVoipIpCfgList(CfgIndexInfo entity);
public List<AvVoipAccountCfg> findVoipAccountCfgList(CfgIndexInfo entity);
public CfgIndexInfo getCfgIndexInfo(CfgIndexInfo entity);
public List<CfgIndexInfo> findStreamList(CfgIndexInfo entity) ;
public List<IpPortCfg> getIpPortList(CfgIndexInfo entity);
public void saveIpPortCfg(IpPortCfg entity);
public void deleteIpCfg(CfgIndexInfo entity);
public List<AvContUrlCfg> getAvContUrlList(CfgIndexInfo entity);
public void saveAvContUrlCfg(CfgIndexInfo entity);
public void deleteAvContUrlCfg(CfgIndexInfo entity);
public void insertCfgIndexInfo(CfgIndexInfo entity);
public void insertAvVoipIp(CfgIndexInfo entity);
public void insertAvVoipAccountCfg(CfgIndexInfo entity);

View File

@@ -155,6 +155,39 @@
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="do_log" property="doLog" jdbcType="INTEGER" />
</resultMap>
<resultMap id="AvContUrlCfgMap" type="com.nis.domain.configuration.AvContUrlCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" 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" />
<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="expr_type " property="exprType" jdbcType="INTEGER" />
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<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" />
<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" />
@@ -237,6 +270,12 @@
FROM ip_port_cfg a where compile_id=#{compileId} and function_id=#{functionId}
</select>
<select id="getAvContUrlList" resultMap="AvContUrlCfgMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT
<include refid="BaseStringCfg_Column" />
FROM av_cont_url_cfg r where compile_id=#{compileId} and function_id=#{functionId}
</select>
<!-- voip IP条件查询列表信息 -->
<select id="findVoipList" resultMap="CfgIndexInfoMap" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
SELECT
@@ -373,6 +412,20 @@
</where>
)
</if>
<if test="avContUrlCfg!=null">
<if test="(avContUrlCfg.cfgKeywords != null and avContUrlCfg.cfgKeywords != '') ">
AND r.compile_id in (select s.compile_id from av_cont_url_cfg s
<where>
<if test="avContUrlCfg.cfgKeywords != null and avContUrlCfg.cfgKeywords != ''">
and s.cfg_keywords like concat(concat('%',#{avContUrlCfg.cfgKeywords,jdbcType=VARCHAR}),'%')
</if>
<if test="compileId != null">
and s.compile_id =#{compileId,jdbcType=INTEGER}
</if>
</where>
)
</if>
</if>
<!-- 数据范围过滤 -->
${sqlMap.dsf}
@@ -565,18 +618,71 @@
<if test="compileId != null">
and a.compile_Id=#{compileId,jdbcType=INTEGER}
</if>
<choose>
<when test="isValid != null">
and a.is_valid=#{isValid,jdbcType=INTEGER}
</when>
<otherwise>
and a.is_valid != -1
</otherwise>
</choose>
</where>
</select>
<!-- insert av_cont_url_cfg表信息 -->
<insert id="saveAvContUrlCfg" parameterType="com.nis.domain.configuration.AvContUrlCfg" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into av_cont_url_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,
cfg_keywords,
cfg_type,
cfg_region_code,
expr_type,
match_method,
is_hexbin,
do_log
)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},
#{avContUrlCfg.cfgKeywords,jdbcType=VARCHAR},
#{avContUrlCfg.cfgType,jdbcType=VARCHAR},
#{avContUrlCfg.cfgRegionCode,jdbcType=INTEGER},
#{avContUrlCfg.exprType,jdbcType=INTEGER},
#{avContUrlCfg.matchMethod,jdbcType=INTEGER},
#{avContUrlCfg.isHexbin,jdbcType=INTEGER},
#{doLog,jdbcType=INTEGER}
)
</insert>
<!-- insert cfgIndexInfox -->
<insert id="insertCfgIndexInfo" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
insert into cfg_index_info(
@@ -1261,6 +1367,10 @@
</where>
</delete>
<delete id="deleteAvContUrlCfg">
delete from av_cont_url_cfg where compile_id=#{compileId} and function_id=#{functionId}
</delete>
<!-- 删除http子配置 -->
<delete id="deleteIpCfg" >

View File

@@ -15,11 +15,13 @@ import org.springframework.transaction.annotation.Transactional;
import com.nis.domain.Page;
import com.nis.domain.configuration.AreaBean;
import com.nis.domain.configuration.AreaIpCfg;
import com.nis.domain.configuration.AvContUrlCfg;
import com.nis.domain.configuration.AvVoipAccountCfg;
import com.nis.domain.configuration.AvVoipIpCfg;
import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.HttpUrlCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.domain.configuration.NtcSubscribeIdCfg;
import com.nis.domain.maat.MaatCfg;
@@ -117,15 +119,26 @@ 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<IpPortCfg> ipPortList = avContentCfgDao.getIpPortList(cfg);
List<AvVoipAccountCfg> voipAccounts=getVoipAccountCfgList(cfg);
cfg.setNtcSubscribeIdCfgList(ntcSubscribeList);
//cfg.setVoipIps(voipIps);
cfg.setVoipAccounts(voipAccounts);
cfg.setIpPortList(ipPortList);
return cfg;
}
public CfgIndexInfo getUrlCfgIndexInfo(CfgIndexInfo entity) {
CfgIndexInfo cfg=avContentCfgDao.getCfgIndexInfo(entity);
List<NtcSubscribeIdCfg> ntcSubscribeList=getSubscribeIdCfgList(cfg);
List<AvContUrlCfg> avContUrlList=avContentCfgDao.getAvContUrlList(cfg);
List<IpPortCfg> ipPortList = avContentCfgDao.getIpPortList(cfg);
cfg.setNtcSubscribeIdCfgList(ntcSubscribeList);
cfg.setIpPortList(ipPortList);
cfg.setAvContUrlCfgList(avContUrlList);
return cfg;
}
/* public CfgIndexInfo getCfgIndexInfo2(CfgIndexInfo entity) {
CfgIndexInfo cfg=avContentCfgDao.getCfgIndexInfo(entity);
List<AvVoipAccountCfg> voipAccounts=new ArrayList<>();
@@ -348,13 +361,15 @@ public class AvContentCfgService extends BaseService{
String[] idArray = compileIds.split(",");
for(String id :idArray){
CfgIndexInfo entity = new CfgIndexInfo();
entity.setCompileId(Integer.parseInt(id));
entity.setCfgId(Long.parseLong(id));
entity.setFunctionId(functionId);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setEditorId(UserUtils.getUser().getId());
entity.setEditTime(new Date());
//avContentCfgDao.updateAvVoipIp(entity);
entity.setTableName(CfgIndexInfo.getTablename());
avContentCfgDao.updateCfgValid(entity);
entity = getCfgIndexInfo(entity);
if(entity.getIpPortList()!=null && entity.getIpPortList().size()>0){
IpPortCfg cfg = new IpPortCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
@@ -1344,129 +1359,108 @@ public class AvContentCfgService extends BaseService{
NtcSubscribeIdCfg subscribeIdCfg = new NtcSubscribeIdCfg();
BeanUtils.copyProperties(cfg, subscribeIdCfg, new String[] {"cfgId","isValid"});
List<NtcSubscribeIdCfg> list = stringCfgDao.findSubscribeIdCfgList(subscribeIdCfg);
CfgIndexInfo cfgInfo=new CfgIndexInfo();
cfgInfo.setCompileId(cfg.getCompileId());
List<IpPortCfg> ipPortList=avContentCfgDao.getIpPortList(cfgInfo);
cfg.setNtcSubscribeIdCfgList(list);
return cfg;
}
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void saveOrUpdateContUrl(BaseStringCfg<BaseStringCfg> entity,String areaCfgIds){
Date createTime=new Date();
entity.setTableName("av_cont_url_cfg");
public void saveOrUpdateContUrl(CfgIndexInfo entity){
//设置区域运营商信息
setAreaEffectiveIds(entity);
//新增
entity.setIsValid(0);//无效
entity.setIsAudit(0);//未审核
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>();
Integer compileId = 0;
try {
compileIds = ConfigServiceUtil.getId(1,1);
List<Integer> idList = ConfigServiceUtil.getId(1, 1);
if(idList!=null && idList.size()>0){
compileId = idList.get(0);
}
entity.setCompileId(compileId);
entity.setCreateTime(new Date());
entity.setCreatorId(entity.getCurrentUser().getId());
avContentCfgDao.insertCfgIndexInfo(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()){
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
entity.setNtcSubscribeIdCfg(cfg);
avContentCfgDao.insertAvVoipKeywordCfg(entity);
}
}
}
if(entity.getAvContUrlCfgList()!=null&&entity.getAvContUrlCfgList().size()>0){
for(AvContUrlCfg avContUrlCfg : entity.getAvContUrlCfgList()){
entity.setAvContUrlCfg(avContUrlCfg);
avContentCfgDao.saveAvContUrlCfg(entity);
}
}
//保存区域IP信息
if(entity.getAreaCfg()!=null){
for(AreaIpCfg cfg:entity.getAreaCfg()){
cfg.initDefaultValue();
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
} catch (Exception e) {
e.printStackTrace();
logger.info("获取编译ID出错");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
}
// 添加subscribeId
if(entity.getNtcSubscribeIdCfgList()!=null){
for(NtcSubscribeIdCfg cfg:entity.getNtcSubscribeIdCfgList()){
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
entity.setCompileId(compileIds.get(0));
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType",
"cfgKeywords","exprType",
"matchMethod","isHexbin"});
stringCfgDao.saveSubscribeIdCfg(cfg);
}
}
}
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"
});
areaIpCfgDao.saveAreaIpCfg(areaIpCfg);
}
}
//保存cfgIndexInfo
avContentCfgDao.insertString(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"
});
areaIpCfgDao.updateAreaIpCfg(areaIpCfg);
}else{
//新增
entity.setCreatorId(UserUtils.getUser().getId());
entity.setCreateTime(createTime);
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
,"cfgType"
});
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);
entity.setTableName("av_cont_url_cfg");
avContentCfgDao.updateString(entity);
entity.setEditTime(new Date());
entity.setEditorId(entity.getCurrentUser().getId());
avContentCfgDao.updateCfgIndexInfo(entity);
//无效子配置后,再新增子配置
avContentCfgDao.deleteIpCfg(entity);
stringCfgDao.deleteSubscribeIdCfgByCfgIndexInfo(entity);
avContentCfgDao.deleteAvContUrlCfg(entity);
AreaIpCfg area = new AreaIpCfg();
area.setCompileId(entity.getCompileId());
area.setFunctionId(entity.getFunctionId());
areaIpCfgDao.deleteAreaIpCfg(area);
entity.setCreateTime(new Date());
entity.setCreatorId(entity.getCurrentUser().getId());
// 删除SubscribeId配置再进行添加
NtcSubscribeIdCfg subscribeIdCfg = new NtcSubscribeIdCfg();
BeanUtils.copyProperties(entity, subscribeIdCfg,new String[]{"cfgId","cfgType"});
stringCfgDao.deleteSubscribeIdCfg(subscribeIdCfg);
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()){
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType",
"cfgKeywords","exprType",
"matchMethod","isHexbin"});
stringCfgDao.saveSubscribeIdCfg(cfg);
entity.setNtcSubscribeIdCfg(cfg);
avContentCfgDao.insertAvVoipKeywordCfg(entity);
}
}
}
if(entity.getAvContUrlCfgList()!=null&&entity.getAvContUrlCfgList().size()>0){
for(AvContUrlCfg avContUrlCfg : entity.getAvContUrlCfgList()){
entity.setAvContUrlCfg(avContUrlCfg);
avContentCfgDao.saveAvContUrlCfg(entity);
}
}
//保存区域IP信息
if(entity.getAreaCfg()!=null){
for(AreaIpCfg cfg:entity.getAreaCfg()){
cfg.initDefaultValue();
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"});
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
}
}
}
/**
*
@@ -1478,24 +1472,30 @@ public class AvContentCfgService extends BaseService{
public void updateContUrlValid(Integer isAudit,Integer isValid,String ids,Integer functionId){
String[] idArray = ids.split(",");
for(String id :idArray){
BaseStringCfg entity = new BaseStringCfg();
CfgIndexInfo entity = new CfgIndexInfo();
entity.setCfgId(Long.parseLong(id));
BaseStringCfg urlCfg = this.getContUrlCfgById(entity);// 获取CompileId
entity.setCompileId(urlCfg.getCompileId());
entity.setTableName("av_cont_url_cfg");
entity.setFunctionId(functionId);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setEditorId(UserUtils.getUser().getId());
entity.setEditTime(new Date());
avContentCfgDao.updateString(entity);
// 查询域配置信息
BaseStringCfg cfg = this.getContUrlCfgById(entity);
if(cfg.getNtcSubscribeIdCfgList() != null && cfg.getNtcSubscribeIdCfgList().size()>0) {
NtcSubscribeIdCfg subscribeIdCfg = new NtcSubscribeIdCfg();
BeanUtils.copyProperties(cfg, subscribeIdCfg, new String[] {"cfgId","cfgType","tableName"});
stringCfgDao.updateSubscribeIdCfg(subscribeIdCfg);
entity.setTableName(CfgIndexInfo.getTablename());
avContentCfgDao.updateCfgValid(entity);
entity = getUrlCfgIndexInfo(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);
}
if(entity.getAvContUrlCfgList()!=null && entity.getAvContUrlCfgList().size()>0){
AvContUrlCfg cfg = new AvContUrlCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(AvContUrlCfg.getTablename());
avContentCfgDao.updateCfgValid(cfg);
}
avContentCfgDao.updateAvVoipKeywordCfgt(entity);
avContentCfgDao.updateCfgIndexInfo(entity);
AreaIpCfg areaIpCfg=new AreaIpCfg();
BeanUtils.copyProperties(entity, areaIpCfg);
areaIpCfgDao.updateAreaIpCfgValid(areaIpCfg);
@@ -1510,31 +1510,30 @@ public class AvContentCfgService extends BaseService{
*/
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
public void auditContUrl(Integer isAudit,Integer isValid,Integer functionId,String id,Date auditTime){
BaseStringCfg entity = new BaseStringCfg();
entity.setTableName("av_cont_url_cfg");
List<BaseStringCfg> list = new ArrayList();
CfgIndexInfo entity = new CfgIndexInfo();
List<CfgIndexInfo> list = new ArrayList();
List<IpPortCfg> ipPortList =new ArrayList();
List <NtcSubscribeIdCfg> ntcList = new ArrayList();
List<AreaIpCfg> areaIpCfgList = new ArrayList();
List<AvContUrlCfg> avContUrlCfgList = new ArrayList();
CfgIndexInfo searchCfg=new CfgIndexInfo();
searchCfg.setCfgId(Long.parseLong(id));
entity.setCompileId(Integer.parseInt(id));
entity = avContentCfgDao.findStringCfgById(entity);
entity.setTableName("av_cont_url_cfg");
entity = avContentCfgDao.getCfgIndexInfo(searchCfg);
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(auditTime);
avContentCfgDao.updateString(entity);
avContentCfgDao.updateAvVoipKeywordCfgt(entity);
avContentCfgDao.updateCfgIndexInfo(entity);
AreaIpCfg areaIpCfg=new AreaIpCfg();
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode"
,"cfgType"
,"cfgId"
});
BeanUtils.copyProperties(entity, areaIpCfg,new String[]{"cfgRegionCode","cfgType","cfgId"});
areaIpCfgDao.updateAreaIpCfg(areaIpCfg);
list=avContentCfgDao.getStringList(entity);
ipPortList = avContentCfgDao.getIpPortList(entity);
ntcList=stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity);
areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
avContUrlCfgList=avContentCfgDao.getAvContUrlList(entity);
ToMaatBean maatBean = new ToMaatBean();
MaatCfg maatCfg = new MaatCfg();
List<MaatCfg> configCompileList = new ArrayList();
@@ -1545,13 +1544,36 @@ public class AvContentCfgService extends BaseService{
List<DigestCfg> digestRegionList = new ArrayList();
List<IpCfg> areaIpRegionList = new ArrayList();
if(avContUrlCfgList!=null && avContUrlCfgList.size()>0){
entity.setAvContUrlCfgList(avContUrlCfgList);
AvContUrlCfg cfg = new AvContUrlCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(AvContUrlCfg.getTablename());
avContentCfgDao.updateCfgValid(cfg);
}
if(isAudit==1){
if(!StringUtil.isEmpty(list)){
Map<String,List> strMap = cfgConvert(strRegionList,list,2,entity,groupRelationList);
groupRelationList=strMap.get("groupList");
strRegionList=strMap.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(avContUrlCfgList)){
Map<String,List> urlMap = cfgConvert(strRegionList,avContUrlCfgList,2,entity,groupRelationList);
groupRelationList=urlMap.get("groupList");
strRegionList=urlMap.get("dstList");
}
if(!StringUtil.isEmpty(ntcList)){
Map<String,List> ntcMap = cfgConvert(strRegionList,ntcList,2,entity,groupRelationList);
groupRelationList=ntcMap.get("groupList");
strRegionList=ntcMap.get("dstList");
}
if(!StringUtil.isEmpty(areaIpCfgList)){
Map<String,List> areaMap = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList);
groupRelationList=areaMap.get("groupList");
@@ -1559,20 +1581,6 @@ public class AvContentCfgService extends BaseService{
}
}
// 修改审核状态
BaseStringCfg baseStrCfg = this.getContUrlCfgById(entity);
if(!StringUtil.isEmpty(baseStrCfg.getNtcSubscribeIdCfgList())) {
NtcSubscribeIdCfg cfg = new NtcSubscribeIdCfg();
BeanUtils.copyProperties(entity, cfg, new String[] {"cfgId","cfgType","cfgKeywords",
"exprType","matchMethod","isHexbin"});
stringCfgDao.updateSubscribeIdCfg(cfg);
if(isAudit==1) {
Map<String,List> map = cfgConvert(strRegionList,baseStrCfg.getNtcSubscribeIdCfgList(),2,entity,groupRelationList);
groupRelationList=map.get("groupList");
strRegionList=map.get("dstList");
}
}
//构造提交综合服务参数格式,一条配置提交一次综合服务
if(isAudit==1){
maatCfg.initDefaultValue();
@@ -1595,11 +1603,11 @@ public class AvContentCfgService extends BaseService{
maatBean.setOpAction(Constants.INSERT_ACTION);
//调用服务接口下发配置数据
String json=gsonToJson(maatBean);
logger.info("contUrl配置下发配置参数"+json);
logger.info("contUrl 配置下发配置参数:"+json);
//调用服务接口下发配置
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
logger.info("contUrl配置下发响应信息"+result.getMsg());
logger.info("contUrl 配置下发响应信息:"+result.getMsg());
}else if(isAudit==3){
maatCfg.setCompileId(entity.getCompileId());
maatCfg.setServiceId(entity.getServiceId());
@@ -1612,12 +1620,12 @@ public class AvContentCfgService extends BaseService{
maatBean.setOpAction(Constants.UPDATE_ACTION);
//调用服务接口取消配置
String json=gsonToJson(maatBean);
logger.info("contUrl配置下发配置参数"+json);
logger.info("contUrl 配置下发配置参数:"+json);
//调用服务接口下发配置
ToMaatResult result = ConfigServiceUtil.put(json,1);
logger.info("contUrl配置取消配置响应信息"+result.getMsg());
logger.info("contUrl 配置取消配置响应信息:"+result.getMsg());
}
}
}
/********************************contUrl业务*********************************/