From cb2ce6f8ba938e47fa4068746d6542b62cf178e4 Mon Sep 17 00:00:00 2001 From: leijun Date: Fri, 12 Oct 2018 19:31:16 +0800 Subject: [PATCH] =?UTF-8?q?Stream=20Media=20=E5=9F=9F=E9=85=8D=E7=BD=AE=20?= =?UTF-8?q?NTC=5FSTREAM=5FMEDIA=5FURL=20NTC=5F=20SUBSCRIBE=5FID=20NTC=5FUN?= =?UTF-8?q?IVERSAL=5FIP[protocol=5Fid=3D23]=20NTC=5FUNIVERSAL=5FPROTO=5FTY?= =?UTF-8?q?PE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/configuration/AvContUrlCfg.java | 13 +- .../domain/configuration/CfgIndexInfo.java | 17 +- .../ntc/AvContentController.java | 97 +++- .../dao/configuration/AvContentCfgDao.java | 7 +- .../web/dao/configuration/AvContentCfgDao.xml | 130 ++++- .../configuration/AvContentCfgService.java | 314 +++++------ .../sql/20181012/update_stream_region.sql | 1 + .../views/cfg/av/contUrl/contSubList.jsp | 328 +++++++++++ .../views/cfg/av/contUrl/contUrlForm.jsp | 514 +++++++++++------- .../views/cfg/av/contUrl/contUrlList.jsp | 193 +++---- 10 files changed, 1102 insertions(+), 512 deletions(-) create mode 100644 src/main/resources/sql/20181012/update_stream_region.sql create mode 100644 src/main/webapp/WEB-INF/views/cfg/av/contUrl/contSubList.jsp diff --git a/src/main/java/com/nis/domain/configuration/AvContUrlCfg.java b/src/main/java/com/nis/domain/configuration/AvContUrlCfg.java index 0640e2b73..98b431dee 100644 --- a/src/main/java/com/nis/domain/configuration/AvContUrlCfg.java +++ b/src/main/java/com/nis/domain/configuration/AvContUrlCfg.java @@ -8,11 +8,22 @@ package com.nis.domain.configuration; * @version V1.0 */ public class AvContUrlCfg extends BaseStringCfg { - + 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; + } + } diff --git a/src/main/java/com/nis/domain/configuration/CfgIndexInfo.java b/src/main/java/com/nis/domain/configuration/CfgIndexInfo.java index 385387a73..008665178 100644 --- a/src/main/java/com/nis/domain/configuration/CfgIndexInfo.java +++ b/src/main/java/com/nis/domain/configuration/CfgIndexInfo.java @@ -56,6 +56,8 @@ public class CfgIndexInfo extends BaseCfg { private NtcBgpAsCfg ntcBgpAsCfg; private InterceptPktBin interceptPktBin; private List interceptPktBinList; + private AvContUrlCfg avContUrlCfg; + private List avContUrlCfgList; private Long dnsStrategyId; private String dnsStrategyName; @@ -66,9 +68,18 @@ public class CfgIndexInfo extends BaseCfg { private List p2pHashList; private List p2pKeywordList; - - - + public AvContUrlCfg getAvContUrlCfg() { + return avContUrlCfg; + } + public void setAvContUrlCfg(AvContUrlCfg avContUrlCfg) { + this.avContUrlCfg = avContUrlCfg; + } + public List getAvContUrlCfgList() { + return avContUrlCfgList; + } + public void setAvContUrlCfgList(List avContUrlCfgList) { + this.avContUrlCfgList = avContUrlCfgList; + } public Integer getAsnIpGroup() { return asnIpGroup; } diff --git a/src/main/java/com/nis/web/controller/configuration/ntc/AvContentController.java b/src/main/java/com/nis/web/controller/configuration/ntc/AvContentController.java index 6d7200c89..cec0d658d 100644 --- a/src/main/java/com/nis/web/controller/configuration/ntc/AvContentController.java +++ b/src/main/java/com/nis/web/controller/configuration/ntc/AvContentController.java @@ -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 page = avContentCfgService.findContUrlPage(new Page(request, response,"r"), entity); + if(entity.getAvContUrlCfgList()== null){ + entity.setAvContUrlCfg(new AvContUrlCfg());; + } + if(entity.getNtcSubscribeIdCfg()==null){ + entity.setNtcSubscribeIdCfg(new NtcSubscribeIdCfg()); + } + Page page = avContentCfgService.findPage(new Page(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 urlList=new ArrayList(); + 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 cfg = avContentCfgService.getContUrlCfgById(baseStrCfg); + CfgIndexInfo cfgIndexInfo = new CfgIndexInfo(); + cfgIndexInfo.setCfgId(cfgId); + CfgIndexInfo cfg = avContentCfgService.getUrlCfgIndexInfo(cfgIndexInfo); List 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业务***************/ diff --git a/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.java b/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.java index ec1b84cd6..47cf0fac4 100644 --- a/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.java +++ b/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.java @@ -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 findVoipIpCfgList(CfgIndexInfo entity); public List findVoipAccountCfgList(CfgIndexInfo entity); public CfgIndexInfo getCfgIndexInfo(CfgIndexInfo entity); + public List findStreamList(CfgIndexInfo entity) ; public List getIpPortList(CfgIndexInfo entity); public void saveIpPortCfg(IpPortCfg entity); public void deleteIpCfg(CfgIndexInfo entity); + public List 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); diff --git a/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.xml b/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.xml index e9ad54c57..986dd051f 100644 --- a/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.xml @@ -155,6 +155,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -237,6 +270,12 @@ FROM ip_port_cfg a where compile_id=#{compileId} and function_id=#{functionId} + + + + + + + SELECT LAST_INSERT_ID() + + 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 into cfg_index_info( @@ -1261,6 +1367,10 @@ + + delete from av_cont_url_cfg where compile_id=#{compileId} and function_id=#{functionId} + + diff --git a/src/main/java/com/nis/web/service/configuration/AvContentCfgService.java b/src/main/java/com/nis/web/service/configuration/AvContentCfgService.java index 7e8689ed8..6456c6b3e 100644 --- a/src/main/java/com/nis/web/service/configuration/AvContentCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/AvContentCfgService.java @@ -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 ntcSubscribeList=getSubscribeIdCfgList(cfg); - //List voipIps=getVoipIpCfgList(cfg); List ipPortList = avContentCfgDao.getIpPortList(cfg); List 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 ntcSubscribeList=getSubscribeIdCfgList(cfg); + List avContUrlList=avContentCfgDao.getAvContUrlList(cfg); + List 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 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 list = stringCfgDao.findSubscribeIdCfgList(subscribeIdCfg); + CfgIndexInfo cfgInfo=new CfgIndexInfo(); + cfgInfo.setCompileId(cfg.getCompileId()); + List ipPortList=avContentCfgDao.getIpPortList(cfgInfo); cfg.setNtcSubscribeIdCfgList(list); + return cfg; } @Transactional(readOnly=false,rollbackFor=RuntimeException.class) - public void saveOrUpdateContUrl(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 compileIds = new ArrayList(); + Integer compileId = 0; try { - compileIds = ConfigServiceUtil.getId(1,1); + List 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(":"+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(""); - } - - //修改 }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 list = new ArrayList(); + CfgIndexInfo entity = new CfgIndexInfo(); + List list = new ArrayList(); + List ipPortList =new ArrayList(); + List ntcList = new ArrayList(); List areaIpCfgList = new ArrayList(); + List 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 configCompileList = new ArrayList(); @@ -1545,13 +1544,36 @@ public class AvContentCfgService extends BaseService{ List digestRegionList = new ArrayList(); List 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 strMap = cfgConvert(strRegionList,list,2,entity,groupRelationList); - groupRelationList=strMap.get("groupList"); - strRegionList=strMap.get("dstList"); + if(!StringUtil.isEmpty(ipPortList)){ + Map 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 urlMap = cfgConvert(strRegionList,avContUrlCfgList,2,entity,groupRelationList); + groupRelationList=urlMap.get("groupList"); + strRegionList=urlMap.get("dstList"); } + if(!StringUtil.isEmpty(ntcList)){ + Map ntcMap = cfgConvert(strRegionList,ntcList,2,entity,groupRelationList); + groupRelationList=ntcMap.get("groupList"); + strRegionList=ntcMap.get("dstList"); + } + if(!StringUtil.isEmpty(areaIpCfgList)){ Map 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 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业务*********************************/ diff --git a/src/main/resources/sql/20181012/update_stream_region.sql b/src/main/resources/sql/20181012/update_stream_region.sql new file mode 100644 index 000000000..9b2a4fb5b --- /dev/null +++ b/src/main/resources/sql/20181012/update_stream_region.sql @@ -0,0 +1 @@ +update function_region_dict set config_region_value ='NTC_SUBSCRIBE_ID' where dict_id='201'; \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/av/contUrl/contSubList.jsp b/src/main/webapp/WEB-INF/views/cfg/av/contUrl/contSubList.jsp new file mode 100644 index 000000000..bcb73ceb1 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/cfg/av/contUrl/contSubList.jsp @@ -0,0 +1,328 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + + + + + + +
+ + +
+
+ + + + + + +
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+
+
+
+ + + +
+
+
+
+ +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+ +
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+ +
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+ +
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+
+
+ + + +
+
+
+
+ +
+
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+ +
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+ +
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+ +
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+
+
+
+
+
+ \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/av/contUrl/contUrlForm.jsp b/src/main/webapp/WEB-INF/views/cfg/av/contUrl/contUrlForm.jsp index 9439ea63f..0d4a39b1d 100644 --- a/src/main/webapp/WEB-INF/views/cfg/av/contUrl/contUrlForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/av/contUrl/contUrlForm.jsp @@ -3,216 +3,310 @@ <spring:message code="${cfgName}"></spring:message> + - + -
- -

- -

- -
-
-
-
-
- - - +
+

+ +

+ +
+
+
+
+
+ + + + + + + +
-
-
- -
- - - - -
- -
-
-
- -
- -
-
-
-
-
- -
- - - -
-
-
-
-
-
+
+ + + + + + + +
+ + +
-
- - - - - - - - - - +
+ +
+ +
+
+
+ +
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+ + + + + + + + + + + + +
- - - <%-- - - <%@include file="/WEB-INF/include/form/complexInfo.jsp" %> - - --%> - - - - -

- -

- <%@include file="/WEB-INF/include/form/complexInfo.jsp" %> -
- - - + + + + + + +

+ +

+ + <%-- --%> + + +
+ <%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%> +
+
+
+ + + +

+ + +

+ + <%-- --%> + + + + +
+ <%@include file="/WEB-INF/views/cfg/ipCfgForm.jsp"%> +
+ +
+
+
+ + + + +
+ +
+ + + +

- - + -
+
<%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%>
- + @@ -220,43 +314,49 @@ var delContent = function(contentClassName, addBtnClassName) { - + - -
-
-
-
-
- - -
-
-
-
-
-
- - -
-
+ + + +
+ <%@include file="/WEB-INF/include/form/areaInfo.jsp"%> +
+ <%@include file="/WEB-INF/include/form/basicInfo.jsp"%> +
+
+
+
+
+ + +
+
+
+
+
+
+ + +
+ + +
+
+
-
\ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/av/contUrl/contUrlList.jsp b/src/main/webapp/WEB-INF/views/cfg/av/contUrl/contUrlList.jsp index ddca26f93..762d87ec0 100644 --- a/src/main/webapp/WEB-INF/views/cfg/av/contUrl/contUrlList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/av/contUrl/contUrlList.jsp @@ -3,15 +3,35 @@ <spring:message code="${cfgName}"></spring:message> + + + + + + + + + + + + + +

- +

@@ -135,7 +143,6 @@ - <%-- --%>
@@ -146,9 +153,12 @@ - - + + + + + @@ -177,11 +187,12 @@
- + - + <%-- --%> +
- - - - - - - + + - - + + @@ -359,76 +365,40 @@ - - + + - - - - ${cfg.compileId } - ${cfg.cfgDesc } - - - ${fns:abbr(fn:replace(cfg.cfgKeywords, "***and***", " "),20)} - - - - - - - - - - - - - - - - - - - - - - + + + ${indexCfg.compileId } + ${indexCfg.cfgDesc } - + - + - - - - - - - -
- - - - + + + - ${cfg.requestName } + ${indexCfg.requestName } - + @@ -447,7 +417,7 @@ - + @@ -466,7 +436,7 @@ - + @@ -483,26 +453,33 @@ ${fns:abbr(lableInfo,20)} - - - - + + + + - - ${cfg.creatorName } - - ${cfg.editorName } - - ${cfg.auditorName } - - + + + + + + + + +
+ ${indexCfg.creatorName } + + ${indexCfg.editorName } + + ${indexCfg.auditorName } +
-
${page}
-
+
${page}
+