diff --git a/src/main/java/com/nis/domain/configuration/AvPicIpCfg.java b/src/main/java/com/nis/domain/configuration/AvPicIpCfg.java new file mode 100644 index 000000000..7788c2bcb --- /dev/null +++ b/src/main/java/com/nis/domain/configuration/AvPicIpCfg.java @@ -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; + + +} 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 00fe378f4..7fbff469b 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 @@ -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 page = avContentCfgService.findContIpPage(new Page(request, response,"r"), entity); + public String contIpList(Model model,HttpServletRequest request,HttpServletResponse response,@ModelAttribute("cfg")BaseIpCfg entity){ + Page page = avContentCfgService.findContIpPage(new Page(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 page = avContentCfgService.findPicIpPage(new Page(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业务***************/ + } 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 f918f19d7..fb94dd275 100644 --- a/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.java +++ b/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.java @@ -19,7 +19,8 @@ import com.nis.web.dao.MyBatisDao; @MyBatisDao public interface AvContentCfgDao { public List findVoipList(CfgIndexInfo entity) ; - public List findContIpList(AvContIpCfg entity) ; + public List findIpList(BaseIpCfg entity) ; + public List getIpList(BaseIpCfg entity) ; public List findVoipIpCfgList(CfgIndexInfo entity); public List 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); } 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 2b771a296..c6940aaf1 100644 --- a/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.xml +++ b/src/main/java/com/nis/web/dao/configuration/AvContentCfgDao.xml @@ -804,14 +804,14 @@ - SELECT , s.name as creator_name,e.name as editor_name,u.name as auditor_name ,ri.request_title as requestName - 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 @@ - select - from av_cont_ip_cfg r + from ${tableName} r and r.cfg_id=#{cfgId,jdbcType=INTEGER} @@ -932,11 +932,8 @@ - - - SELECT LAST_INSERT_ID() - - insert into av_cont_ip_cfg ( + + insert into ${tableName} ( CFG_DESC, ACTION, IS_VALID, @@ -1003,8 +1000,8 @@ ) - - update av_cont_ip_cfg + + update ${tableName} @@ -1105,4 +1102,22 @@ + \ No newline at end of file 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 737114318..2c7ca969e 100644 --- a/src/main/java/com/nis/web/service/configuration/AvContentCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/AvContentCfgService.java @@ -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 findContIpPage(Page page, AvContIpCfg entity) { + public Page findContIpPage(Page page, BaseIpCfg entity) { entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r")); entity.setPage(page); - List list=avContentCfgDao.findContIpList(entity); + entity.setTableName("av_cont_ip_cfg"); + List 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 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(""); } @@ -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 list = new ArrayList(); + List 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 configCompileList = new ArrayList(); + List groupRelationList = new ArrayList(); + List ipRegionList = new ArrayList(); + List strRegionList = new ArrayList(); + List numRegionList = new ArrayList(); + List digestRegionList = new ArrayList(); + List areaIpRegionList = new ArrayList(); + + if(isAudit==1){ + if(!StringUtil.isEmpty(list)){ + Map ipMap = cfgConvert(ipRegionList,list,1,entity,groupRelationList); + groupRelationList=ipMap.get("groupList"); + ipRegionList=ipMap.get("dstList"); + } + + if(!StringUtil.isEmpty(areaIpCfgList)){ + Map 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 findPicIpPage(Page page, BaseIpCfg entity) { + entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"r")); + entity.setPage(page); + entity.setTableName("av_pic_ip_cfg"); + List 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 areaCfg=entity.getAreaCfg(); + List 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;i0){ + entity.setAreaEffectiveIds(""); + } + } + + //新增 + if(entity.getCfgId()==null){ + entity.setCreatorId(UserUtils.getUser().getId()); + entity.setCreateTime(createTime); + entity.setIsValid(0); + entity.setIsAudit(0); + //调用服务接口获取compileId + List compileIds = new ArrayList(); + try { + compileIds = ConfigServiceUtil.getId(1,1); + } catch (Exception e) { + e.printStackTrace(); + logger.info("获取编译ID出错"); + throw new MaatConvertException(":"+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(""); + } + + //修改 + }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 list = new ArrayList(); + List 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 configCompileList = new ArrayList(); + List groupRelationList = new ArrayList(); + List ipRegionList = new ArrayList(); + List strRegionList = new ArrayList(); + List numRegionList = new ArrayList(); + List digestRegionList = new ArrayList(); + List areaIpRegionList = new ArrayList(); + + if(isAudit==1){ + if(!StringUtil.isEmpty(list)){ + Map ipMap = cfgConvert(ipRegionList,list,1,entity,groupRelationList); + groupRelationList=ipMap.get("groupList"); + ipRegionList=ipMap.get("dstList"); + } + + if(!StringUtil.isEmpty(areaIpCfgList)){ + Map 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业务*********************************/ } diff --git a/src/main/webapp/WEB-INF/views/cfg/av/contIp/contIpForm.jsp b/src/main/webapp/WEB-INF/views/cfg/av/contIp/contIpForm.jsp index 03bb68f24..0448ea4e2 100644 --- a/src/main/webapp/WEB-INF/views/cfg/av/contIp/contIpForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/av/contIp/contIpForm.jsp @@ -8,10 +8,12 @@ $(function(){ $("#cancel").on("click",function(){ window.history.back(); }); - $(".action").on("change",function(){ + $(".action").on("change", function() { $("#serviceId").val($(this).attr("serviceId")); + $("#protocolId").val($(this).attr("protocolId")); }); $("#serviceId").val($(".action:checked").attr("serviceId")); + $("#protocolId").val($(".action:checked").attr("protocolId")); $("#cfgFrom").validate({ errorPlacement: function(error,element){ $(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error); @@ -50,6 +52,7 @@ $(function(){ + @@ -72,16 +75,19 @@ $(function(){
- - - + + +
diff --git a/src/main/webapp/WEB-INF/views/cfg/av/contIp/contIpList.jsp b/src/main/webapp/WEB-INF/views/cfg/av/contIp/contIpList.jsp index 079a3d4b9..7df9386e6 100644 --- a/src/main/webapp/WEB-INF/views/cfg/av/contIp/contIpList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/av/contIp/contIpList.jsp @@ -292,11 +292,11 @@ - + - + - + <%-- --%> diff --git a/src/main/webapp/WEB-INF/views/cfg/av/picIp/picIpForm.jsp b/src/main/webapp/WEB-INF/views/cfg/av/picIp/picIpForm.jsp new file mode 100644 index 000000000..36a081af0 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/cfg/av/picIp/picIpForm.jsp @@ -0,0 +1,123 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + +<spring:message code="${cfgName}"></spring:message> + + + + +
+ + <%--

+ +

--%> + +
+
+
+
+
+ + + +
+
+
+ +
+ + + + + + + + + + + + +
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+ + + +
+
+
+
+
+ + <%@include file="/WEB-INF/include/form/ipInfo.jsp" %> + <%@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/picIp/picIpList.jsp b/src/main/webapp/WEB-INF/views/cfg/av/picIp/picIpList.jsp new file mode 100644 index 000000000..bb69704a5 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/cfg/av/picIp/picIpList.jsp @@ -0,0 +1,410 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + +<spring:message code="${cfgName}"></spring:message> + + + + +
+ + +

+ +

+ +
+
+
+
+
+ + + + + + + + + +
+
+ + + + + + + <%-- --%> + +
+ +
+ +
+
+ + + + + + + +
+ + + +
+
+
+ + + +
+
+ + + + + +
+ + +
+
+ href="javascript:;"> + + +
+
+ + + +
+
+ +
+ +
+ + + + + + + + +
+ +
+ +
+ +
+ + + + + + + +
+ +
+ +
+ +
+ + + + + + + + +
+ +
+ +
+ +
+ + + + + + + +
+ +
+ +
+ +
+
+
+ + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+ +
+
+ + " onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/> + +
+
+
+ + +
+ + +
+
+
+ + + + + <%-- --%> + + + + + + + + + + + + + + + + + + + + + + + + + <%-- --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- --%> + + + + + + + + + + + + +
${cfg.cfgDesc }${cfg.ipType }${cfg.srcIpAddress }${cfg.srcPort }${cfg.destIpAddress }${cfg.destPort }${cfg.ipPattern }${cfg.portPattern }${cfg.direction }${cfg.protocol } + + + + + + + + + ${cfg.requestName } + ${fns:abbr(classify,20)} + + ${fns:abbr(attribute,20)} + + ${fns:abbr(lableInfo,20)} + ${cfg.areaEffectiveIds } + + + + + + + + + + + ${cfg.creatorName }${cfg.editorName }${cfg.auditorName }
+
${page}
+
+ +
+
+
+ + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/cfg/av/voip/voipForm.jsp b/src/main/webapp/WEB-INF/views/cfg/av/voip/voipForm.jsp index 62af14cb4..dfe254cee 100644 --- a/src/main/webapp/WEB-INF/views/cfg/av/voip/voipForm.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/av/voip/voipForm.jsp @@ -15,10 +15,12 @@ $(function(){ $("#cancel").on("click",function(){ window.history.back(); }); - $(".action").on("change",function(){ + $(".action").on("change", function() { $("#serviceId").val($(this).attr("serviceId")); + $("#protocolId").val($(this).attr("protocolId")); }); $("#serviceId").val($(".action:checked").attr("serviceId")); + $("#protocolId").val($(".action:checked").attr("protocolId")); $("#cfgFrom").validate({ errorPlacement: function(error,element){ $(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error); @@ -119,16 +121,19 @@ var delContent=function(contentClassName,addBtnClassName){
- - - + + +
@@ -159,6 +164,7 @@ var delContent=function(contentClassName,addBtnClassName){ + diff --git a/src/main/webapp/WEB-INF/views/cfg/av/voip/voipList.jsp b/src/main/webapp/WEB-INF/views/cfg/av/voip/voipList.jsp index 733a57dbd..7087edbf3 100644 --- a/src/main/webapp/WEB-INF/views/cfg/av/voip/voipList.jsp +++ b/src/main/webapp/WEB-INF/views/cfg/av/voip/voipList.jsp @@ -83,7 +83,7 @@ html+="
"; if(data.ip.length >0){ hasIp=true; - html+="
"; + html+="
"; html+=""; html+=""; html+=""; @@ -91,7 +91,7 @@ } if(data.account.length >0){ hasAccount=true; - html+="
"; + html+="
"; html+=""; html+=""; html+=""; @@ -101,7 +101,7 @@ html+="
"; //ip信息 if(data.ip.length >0){ - html+="
"; + html+="
"; $.each(data.ip,function(index,item){ html+="
"; html+="
"; @@ -226,7 +226,7 @@ } //account信息 if(data.account.length > 0){ - html+="