diff --git a/src/main/java/com/nis/web/controller/basics/IpCommGroupController.java b/src/main/java/com/nis/web/controller/basics/IpCommGroupController.java index 725c09864..cafe0c005 100644 --- a/src/main/java/com/nis/web/controller/basics/IpCommGroupController.java +++ b/src/main/java/com/nis/web/controller/basics/IpCommGroupController.java @@ -10,11 +10,9 @@ import java.util.concurrent.BlockingQueue; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.jets3t.service.ServiceException; -import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; @@ -30,20 +28,15 @@ import com.beust.jcommander.internal.Lists; import com.nis.domain.FunctionRegionDict; import com.nis.domain.FunctionServiceDict; import com.nis.domain.Page; -import com.nis.domain.basics.AsnGroupInfo; import com.nis.domain.basics.IpCommCfg; import com.nis.domain.basics.PolicyGroupInfo; -import com.nis.domain.configuration.BaseCfg; import com.nis.domain.configuration.BaseIpCfg; import com.nis.domain.configuration.CfgIndexInfo; import com.nis.domain.configuration.IpPortCfg; import com.nis.domain.configuration.template.IpCommCfgTemplate; import com.nis.exceptions.MaatConvertException; -import com.nis.util.ConfigServiceUtil; import com.nis.util.Constants; import com.nis.util.DictUtils; -import com.nis.util.Reflections; -import com.nis.util.ServiceConfigTemplateUtil; import com.nis.util.StringUtil; import com.nis.util.excel.ImportBigExcel; import com.nis.web.controller.BaseController; @@ -131,46 +124,46 @@ public class IpCommGroupController extends BaseController { return "redirect:" + adminPath + "/basics/ip/list?functionId=" + cfg.getFunctionId(); } - @RequestMapping(value = { "/audit" }) - @RequiresPermissions(value = { "ip:common:config" }) - public String audit(Model model, @ModelAttribute("cfg") IpCommCfg cfg, Integer isAudit, Integer isValid, - String ids, Integer functionId, HttpServletRequest request, HttpServletResponse response, - RedirectAttributes redirectAttributes) { - // 选中配置审核 - if (!StringUtil.isEmpty(ids)) { - List ipGroupCfgs = ipCommGroupCfgService.getByIds(ids); - List temp = Lists.newArrayList(); - try { - ipCommGroupCfgService.audit(ipGroupCfgs, isAudit, isValid); - } catch (Exception e) { - logger.error("审核失败", e); - addMessage(redirectAttributes, "error", "audit_failed"); - } finally { - temp.clear(); - } - return "redirect:" + adminPath + "/basics/ip/list?functionId=" + cfg.getFunctionId(); - } else {// 全部审核 - // 条件下所有配置审核 - Page searchPage = new Page(request, response, "a"); - Page auditPage = new Page(request, response, "a"); - BeanUtils.copyProperties(searchPage, auditPage); - - try { - auditAll(auditPage, isValid, cfg); - addMessage(redirectAttributes, "success", "audit_success"); - } catch (Exception e) { - logger.error("配置下发失败:", e); - if (e instanceof MaatConvertException) { - addMessage(redirectAttributes, "error", "request_service_failed"); - } else { - addMessage(redirectAttributes, "error", "audit_failed"); - } - - } - - return list(model, request, response, cfg); - } - } +// @RequestMapping(value = { "/audit" }) +// @RequiresPermissions(value = { "ip:common:config" }) +// public String audit(Model model, @ModelAttribute("cfg") IpCommCfg cfg, Integer isAudit, Integer isValid, +// String ids, Integer functionId, HttpServletRequest request, HttpServletResponse response, +// RedirectAttributes redirectAttributes) { +// // 选中配置审核 +// if (!StringUtil.isEmpty(ids)) { +// List ipGroupCfgs = ipCommGroupCfgService.getByIds(ids); +// List temp = Lists.newArrayList(); +// try { +// ipCommGroupCfgService.audit(ipGroupCfgs, isAudit, isValid); +// } catch (Exception e) { +// logger.error("审核失败", e); +// addMessage(redirectAttributes, "error", "audit_failed"); +// } finally { +// temp.clear(); +// } +// return "redirect:" + adminPath + "/basics/ip/list?functionId=" + cfg.getFunctionId(); +// } else {// 全部审核 +// // 条件下所有配置审核 +// Page searchPage = new Page(request, response, "a"); +// Page auditPage = new Page(request, response, "a"); +// BeanUtils.copyProperties(searchPage, auditPage); +// +// try { +// auditAll(auditPage, isValid, cfg); +// addMessage(redirectAttributes, "success", "audit_success"); +// } catch (Exception e) { +// logger.error("配置下发失败:", e); +// if (e instanceof MaatConvertException) { +// addMessage(redirectAttributes, "error", "request_service_failed"); +// } else { +// addMessage(redirectAttributes, "error", "audit_failed"); +// } +// +// } +// +// return list(model, request, response, cfg); +// } +// } @RequestMapping(value = { "/delete" }) @RequiresPermissions(value = { "ip:common:config" }) @@ -260,121 +253,121 @@ public class IpCommGroupController extends BaseController { * @param redirectAttributes * @return */ - @Override - public void auditAll(Page page, Integer auditType, Object entity) throws Exception { - long start = System.currentTimeMillis(); - page.setOrderBy(""); - page.setPageSize(Constants.MAAT_JSON_SEND_SIZE); - page.setPageNo(1); - page.setLastPage(false); - // 携带审核状态信息的BaseCfg - BaseCfg auditBatchCfg = new BaseCfg(); - // 携带审核条件的BaseCfg - IpCommCfg searchIpCommGroupCfg = new IpCommCfg(); - BeanUtils.copyProperties(entity, auditBatchCfg); - BeanUtils.copyProperties(entity, searchIpCommGroupCfg); - - auditType = (Integer) Reflections.invokeGetter(entity, "isAudit"); - - // 全部审核通过,只查询当前条件下的所有未审核的配置 -批量审核通过/不通过 - if (auditType.equals(1) || auditType.equals(2)) { - - searchIpCommGroupCfg.setIsValid(0); - searchIpCommGroupCfg.setIsAudit(0); - - if (auditType.equals(1)) { - auditBatchCfg.setIsAudit(1); - auditBatchCfg.setIsValid(1); - } else { - auditBatchCfg.setIsAudit(2); - auditBatchCfg.setIsValid(0); - } - auditBatchCfg.setAuditTime(new Date()); - auditBatchCfg.setAuditorId(UserUtils.getUser().getId()); - } else { - // 全部取消通过,只查询当前条件下的所有审核通过的配置 - searchIpCommGroupCfg.setIsValid(1); - searchIpCommGroupCfg.setIsAudit(1); - - auditBatchCfg.setIsAudit(3); - auditBatchCfg.setIsValid(0); - auditBatchCfg.setAuditTime(new Date()); - auditBatchCfg.setAuditorId(UserUtils.getUser().getId()); - } - - ServiceConfigTemplateUtil serviceTemplate = new ServiceConfigTemplateUtil(); - Integer functionId = 0; - if (auditBatchCfg != null && !StringUtil.isEmpty(auditBatchCfg.getFunctionId())) { - functionId = auditBatchCfg.getFunctionId(); - } - List> serviceList = serviceTemplate.getServiceListByFunctionId(functionId); - for (Map service : serviceList) { - String tableNameXml = service.get("tableName").toString(); // 获取业务主配置表 - String serviceTypeXml = service.get("serviceType").toString(); // 业务类型 1maat 2callback - String classNameXml = service.get("className").toString(); // 主配置Java类 - String serviceIdXml = service.get("id").toString(); // service字典表 service_id字段 - auditBatchCfg.setServiceId(Integer.valueOf(serviceIdXml)); - auditBatchCfg.setTableName(tableNameXml); - searchIpCommGroupCfg.setServiceId(Integer.valueOf(serviceIdXml)); - searchIpCommGroupCfg.setTableName(tableNameXml); - - if ("1".equals(serviceTypeXml)) {// maat类配置 - // 存放域配置类型 及 对应表名 - List> cfgList = (List>) service.get("cfgList"); - List> userRegionList = (List>) service.get("userRegionList"); - int cfgType = Integer.parseInt(service.get("cfgType").toString()); - if (auditBatchCfg.getIsAudit() == 1) { - boolean hasData = true; - - while (hasData) { - page.setPageNo(1); - page.setLastPage(false); - List list = ipCommGroupCfgService.findPage(page, searchIpCommGroupCfg).getList(); - if(CollectionUtils.isNotEmpty(list)){ - Map groupIdMap=new HashMap(); - // 配置生效处理 - if(auditBatchCfg.getIsAudit().equals(1)) { - hasData=commonPolicyService.auditReuseCommonConfigData(page, auditBatchCfg,groupIdMap,hasData); - Map groupIpMap=new HashMap(); - if(CollectionUtils.isNotEmpty(list)) { - for (IpCommCfg obj : (List)list) { - BaseCfg baseCfg=(BaseCfg)obj; - if(!StringUtil.isEmpty(obj.getGroupId())) { - groupIdMap.get(obj.getGroupId()).add(baseCfg); - }else { - List newList=new ArrayList<>(); - newList.add(baseCfg); - groupIdMap.put(obj.getGroupId(),newList); - } - } - } - - } - if(hasData) { - page.setPageNo(1); - page.setLastPage(false); - } - }else{ - hasData = false; - } - } - } - } else { - throw new RuntimeException("wrong service type " + serviceTypeXml); - } - } - - // 批量审核通过时,如果没有携带isValid检索条件,返回界面需要将isValid置为null - if (!StringUtil.isEmpty(entity)) { - BaseCfg base = (BaseCfg) entity; - if (!StringUtil.isEmpty(base.getSeltype()) && base.getSeltype().equals("isValid")) { - base.setIsValid(null); - BeanUtils.copyProperties(base, entity); - } - } - long end = System.currentTimeMillis(); - logger.warn("配置批量生效/失效耗时:" + (end - start)); - } +// @Override +// public void auditAll(Page page, Integer auditType, Object entity) throws Exception { +// long start = System.currentTimeMillis(); +// page.setOrderBy(""); +// page.setPageSize(Constants.MAAT_JSON_SEND_SIZE); +// page.setPageNo(1); +// page.setLastPage(false); +// // 携带审核状态信息的BaseCfg +// BaseCfg auditBatchCfg = new BaseCfg(); +// // 携带审核条件的BaseCfg +// IpCommCfg searchIpCommGroupCfg = new IpCommCfg(); +// BeanUtils.copyProperties(entity, auditBatchCfg); +// BeanUtils.copyProperties(entity, searchIpCommGroupCfg); +// +// auditType = (Integer) Reflections.invokeGetter(entity, "isAudit"); +// +// // 全部审核通过,只查询当前条件下的所有未审核的配置 -批量审核通过/不通过 +// if (auditType.equals(1) || auditType.equals(2)) { +// +// searchIpCommGroupCfg.setIsValid(0); +// searchIpCommGroupCfg.setIsAudit(0); +// +// if (auditType.equals(1)) { +// auditBatchCfg.setIsAudit(1); +// auditBatchCfg.setIsValid(1); +// } else { +// auditBatchCfg.setIsAudit(2); +// auditBatchCfg.setIsValid(0); +// } +// auditBatchCfg.setAuditTime(new Date()); +// auditBatchCfg.setAuditorId(UserUtils.getUser().getId()); +// } else { +// // 全部取消通过,只查询当前条件下的所有审核通过的配置 +// searchIpCommGroupCfg.setIsValid(1); +// searchIpCommGroupCfg.setIsAudit(1); +// +// auditBatchCfg.setIsAudit(3); +// auditBatchCfg.setIsValid(0); +// auditBatchCfg.setAuditTime(new Date()); +// auditBatchCfg.setAuditorId(UserUtils.getUser().getId()); +// } +// +// ServiceConfigTemplateUtil serviceTemplate = new ServiceConfigTemplateUtil(); +// Integer functionId = 0; +// if (auditBatchCfg != null && !StringUtil.isEmpty(auditBatchCfg.getFunctionId())) { +// functionId = auditBatchCfg.getFunctionId(); +// } +// List> serviceList = serviceTemplate.getServiceListByFunctionId(functionId); +// for (Map service : serviceList) { +// String tableNameXml = service.get("tableName").toString(); // 获取业务主配置表 +// String serviceTypeXml = service.get("serviceType").toString(); // 业务类型 1maat 2callback +// String classNameXml = service.get("className").toString(); // 主配置Java类 +// String serviceIdXml = service.get("id").toString(); // service字典表 service_id字段 +// auditBatchCfg.setServiceId(Integer.valueOf(serviceIdXml)); +// auditBatchCfg.setTableName(tableNameXml); +// searchIpCommGroupCfg.setServiceId(Integer.valueOf(serviceIdXml)); +// searchIpCommGroupCfg.setTableName(tableNameXml); +// +// if ("1".equals(serviceTypeXml)) {// maat类配置 +// // 存放域配置类型 及 对应表名 +// List> cfgList = (List>) service.get("cfgList"); +// List> userRegionList = (List>) service.get("userRegionList"); +// int cfgType = Integer.parseInt(service.get("cfgType").toString()); +// if (auditBatchCfg.getIsAudit() == 1) { +// boolean hasData = true; +// +// while (hasData) { +// page.setPageNo(1); +// page.setLastPage(false); +// List list = ipCommGroupCfgService.findPage(page, searchIpCommGroupCfg).getList(); +// if(CollectionUtils.isNotEmpty(list)){ +// Map groupIdMap=new HashMap(); +// // 配置生效处理 +// if(auditBatchCfg.getIsAudit().equals(1)) { +// hasData=commonPolicyService.auditReuseCommonConfigData(page, auditBatchCfg,groupIdMap,hasData); +// Map groupIpMap=new HashMap(); +// if(CollectionUtils.isNotEmpty(list)) { +// for (IpCommCfg obj : (List)list) { +// BaseCfg baseCfg=(BaseCfg)obj; +// if(!StringUtil.isEmpty(obj.getGroupId())) { +// groupIdMap.get(obj.getGroupId()).add(baseCfg); +// }else { +// List newList=new ArrayList<>(); +// newList.add(baseCfg); +// groupIdMap.put(obj.getGroupId(),newList); +// } +// } +// } +// +// } +// if(hasData) { +// page.setPageNo(1); +// page.setLastPage(false); +// } +// }else{ +// hasData = false; +// } +// } +// } +// } else { +// throw new RuntimeException("wrong service type " + serviceTypeXml); +// } +// } +// +// // 批量审核通过时,如果没有携带isValid检索条件,返回界面需要将isValid置为null +// if (!StringUtil.isEmpty(entity)) { +// BaseCfg base = (BaseCfg) entity; +// if (!StringUtil.isEmpty(base.getSeltype()) && base.getSeltype().equals("isValid")) { +// base.setIsValid(null); +// BeanUtils.copyProperties(base, entity); +// } +// } +// long end = System.currentTimeMillis(); +// logger.warn("配置批量生效/失效耗时:" + (end - start)); +// } @RequestMapping(value = "import", method=RequestMethod.POST) public String importIp(HttpServletRequest request,HttpServletResponse response,RedirectAttributes redirectAttributes, @RequestParam("files") MultipartFile[] files @@ -416,10 +409,10 @@ public class IpCommGroupController extends BaseController { List _ipPortCfgs=Lists.newArrayList(Constants.MAAT_JSON_SEND_SIZE); while(!ipPortCfgs.isEmpty()) { ipPortCfgs.drainTo(_ipPortCfgs, Constants.MAAT_JSON_SEND_SIZE); - List regionIds=Lists.newArrayList(); - List numRegionGroupIds=Lists.newArrayList(); - List numRegionRegionIds=Lists.newArrayList(); - if(!regionDict.getFunctionId().equals(405)) {//app ip compileId 从config_group_info中取 + //List regionIds=Lists.newArrayList(); + //List numRegionGroupIds=Lists.newArrayList(); + //List numRegionRegionIds=Lists.newArrayList(); + /*if(!regionDict.getFunctionId().equals(405)) {//app ip compileId 从config_group_info中取 try { if(isSend.equals("1")) { regionIds = ConfigServiceUtil.getId(3,_ipPortCfgs.size()); @@ -442,7 +435,7 @@ public class IpCommGroupController extends BaseController { logger.info("获取域ID出错"); throw new MaatConvertException(":"+e.getMessage()); } - } + }*/ int ind=0; for (BaseIpCfg cfg : _ipPortCfgs) { cfg.setAction(serviceDict==null?null:serviceDict.getAction()); @@ -459,7 +452,7 @@ public class IpCommGroupController extends BaseController { cfg.setIsValid(Constants.VALID_YES); cfg.setAuditorId(UserUtils.getUser().getId()); cfg.setAuditTime(date); - if(regionIds!=null&®ionIds.size()==_ipPortCfgs.size()) { + /*if(regionIds!=null&®ionIds.size()==_ipPortCfgs.size()) { cfg.setRegionId(regionIds.get(ind)); } if(serviceDict!=null&&serviceDict.getProtocolId()!=null) { @@ -469,7 +462,7 @@ public class IpCommGroupController extends BaseController { if(numRegionRegionIds!=null&&numRegionRegionIds.size()==_ipPortCfgs.size()) { cfg.setNumberRegionRegionId(numRegionRegionIds.get(ind)); } - } + }*/ }else { cfg.setIsAudit(Constants.AUDIT_NOT_YET); cfg.setIsValid(Constants.VALID_NO); @@ -518,9 +511,9 @@ public class IpCommGroupController extends BaseController { public Map ajaxGetGroups(Model model,@RequestParam(required=true,value="groupIds")String groupIds){ Map groupIdList=new HashMap(); if(StringUtils.isNotBlank(groupIds)) { - List list=policyGroupInfoService.findPolicyByServiceGroupInfoList(groupIds); + List list=policyGroupInfoService.findPolicyByGroupInfoList(groupIds); for(PolicyGroupInfo p:list) { - groupIdList.put(p.getServiceGroupId(), p.getGroupName()); + groupIdList.put(p.getGroupId(), p.getGroupName()); } } return groupIdList; diff --git a/src/main/java/com/nis/web/controller/configuration/proxy/HttpRedirectPolicyController.java b/src/main/java/com/nis/web/controller/configuration/proxy/HttpRedirectPolicyController.java index 01aa90285..43b71ba1e 100644 --- a/src/main/java/com/nis/web/controller/configuration/proxy/HttpRedirectPolicyController.java +++ b/src/main/java/com/nis/web/controller/configuration/proxy/HttpRedirectPolicyController.java @@ -181,6 +181,27 @@ public class HttpRedirectPolicyController extends BaseController { return "/cfg/proxy/control/httpRedirectForm"; } + @RequestMapping(value = { "commForm" }) + @RequiresPermissions(value = { "control:httpBlock:config", "control:httpRedirect:config", + "control:httpReplace:config", "control:httpMinit:config", + "control:httpWhitelist:config" }, logical = Logical.OR) + public String commForm(Model model, HttpServletRequest request, HttpServletResponse response, String ids, + @ModelAttribute("cfg") CfgIndexInfo entity) { + if (StringUtils.isNotBlank(ids)) { + entity = httpRedirectCfgService.getCommCfg(Long.parseLong(ids), null); + + initUpdateFormCondition(model, entity); + } else { + initFormCondition(model, entity); + } + // 获取所有的响应文件内容,阻断,或重定向时可以选择 + List allProxyFileStrategys = proxyFileStrategyService + .getProxyFileStrategyCfgList(new ProxyFileStrategyCfg()); + model.addAttribute("_cfg", entity); + model.addAttribute("allProxyFileStrategys", allProxyFileStrategys); + return "/cfg/proxy/control/httpRedirectCommonForm"; + } + @RequestMapping(value = { "saveOrUpdate" }) @RequiresPermissions(value = { "control:httpBlock:config", "control:httpRedirect:config", "control:httpReplace:config", "control:httpMinit:config", diff --git a/src/main/java/com/nis/web/service/basics/IpCommGroupCfgService.java b/src/main/java/com/nis/web/service/basics/IpCommGroupCfgService.java index b5de70607..f3e508d17 100644 --- a/src/main/java/com/nis/web/service/basics/IpCommGroupCfgService.java +++ b/src/main/java/com/nis/web/service/basics/IpCommGroupCfgService.java @@ -118,78 +118,78 @@ public class IpCommGroupCfgService extends BaseService { } } } - @Transactional(readOnly=false,rollbackFor=RuntimeException.class) - public void audit(List ipCommGroupCfgs, Integer isAudit, Integer isValid) { - // TODO Auto-generated method stub - Set groupIds=Sets.newHashSet(); - if(!StringUtil.isEmpty(ipCommGroupCfgs)){ - for(IpCommCfg cfg:ipCommGroupCfgs) { - cfg.setIsValid(isValid); - cfg.setIsAudit(isAudit); - cfg.setAuditorId(UserUtils.getUser().getId()); - cfg.setAuditTime(new Date()); - groupIds.add(cfg.getGroupId()); - ipCommGroupCfgDao.update(cfg); - } - } - //查询有效的Ip配置个数 - for(Integer groupId:groupIds) { - Integer groupCount=ipCommGroupCfgDao.getGroupIdCount(groupId); - if(groupCount>0){//udFlag 设置为1 - policyGroupInfoDao.updateUdFlag(groupId, 1,5); - }else{//udFlag 设置为0 - policyGroupInfoDao.updateUdFlag(groupId, 0,5); - } - } - //下发配置时改变公共组udFlag标识 - send2Maat(ipCommGroupCfgs,isValid); - } - public void send2Maat(List ipCommGroupCfgs,int isValid) { - GroupReuseAddBean maatBean = new GroupReuseAddBean(); - List groupReuseList=new ArrayList<>(); - GroupReuseCfg groupReuseCfg=new GroupReuseCfg(); - List ipRegionList = groupReuseCfgAddRemoveConvert(ipCommGroupCfgs,isValid,null); - List strRegionList = new ArrayList<>(); - List numRegionList = new ArrayList<>(); - groupReuseCfg.setIpRegionList(ipRegionList); - groupReuseCfg.setStrRegionList(strRegionList); - groupReuseCfg.setNumRegionList(numRegionList); - groupReuseList.add(groupReuseCfg); - maatBean.setGroupReuseCfgList(groupReuseList); - maatBean.setAuditTime(new Date()); - maatBean.setCreatorName(UserUtils.getUser().getName()); - maatBean.setVersion(Constants.MAAT_VERSION); - logger.warn("IP Common Region Send To Maat start"); - long start=System.currentTimeMillis(); - if(isValid==Constants.VALID_YES) { - maatBean.setOpAction(Constants.INSERT_ACTION); - //调用服务接口下发配置数据 - String json=gsonToJson(maatBean); - if(ipCommGroupCfgs.size()<=100) { - logger.info("ip 公共组域新增配置下发配置参数:"+json); - }else { - logger.info("ip 公共组域新增配置下发region条数:"+ipCommGroupCfgs.size()); - } - //调用服务接口下发配置 - ToMaatResult result =ConfigServiceUtil.postGroupReuseSources(json); - logger.info("ip 公共组域新增配置响应信息:"+result.getMsg()); - }else { - maatBean.setOpAction(Constants.UPDATE_ACTION); - //调用服务接口下发配置数据 - String json=gsonToJson(maatBean); - if(ipCommGroupCfgs.size()<=100) { - logger.info("ip 公共组域删除配置下发配置参数:"+json); - }else { - logger.info("ip 公共组域删除配置下发region条数:"+ipCommGroupCfgs.size()); - - } - //调用服务接口下发配置 - ToMaatResult result = ConfigServiceUtil.put(json,3); - logger.info("asn ip复用域删除配置响应信息:"+result.getMsg()); - } - long end=System.currentTimeMillis(); - logger.warn("IP Common Region Send To Maat finish,cost:"+(end-start)); - } +// @Transactional(readOnly=false,rollbackFor=RuntimeException.class) +// public void audit(List ipCommGroupCfgs, Integer isAudit, Integer isValid) { +// // TODO Auto-generated method stub +// Set groupIds=Sets.newHashSet(); +// if(!StringUtil.isEmpty(ipCommGroupCfgs)){ +// for(IpCommCfg cfg:ipCommGroupCfgs) { +// cfg.setIsValid(isValid); +// cfg.setIsAudit(isAudit); +// cfg.setAuditorId(UserUtils.getUser().getId()); +// cfg.setAuditTime(new Date()); +// groupIds.add(cfg.getGroupId()); +// ipCommGroupCfgDao.update(cfg); +// } +// } +// //查询有效的Ip配置个数 +// for(Integer groupId:groupIds) { +// Integer groupCount=ipCommGroupCfgDao.getGroupIdCount(groupId); +// if(groupCount>0){//udFlag 设置为1 +// policyGroupInfoDao.updateUdFlag(groupId, 1,5); +// }else{//udFlag 设置为0 +// policyGroupInfoDao.updateUdFlag(groupId, 0,5); +// } +// } +// //下发配置时改变公共组udFlag标识 +// send2Maat(ipCommGroupCfgs,isValid); +// } +// public void send2Maat(List ipCommGroupCfgs,int isValid) { +// GroupReuseAddBean maatBean = new GroupReuseAddBean(); +// List groupReuseList=new ArrayList<>(); +// GroupReuseCfg groupReuseCfg=new GroupReuseCfg(); +// List ipRegionList = groupReuseCfgAddRemoveConvert(ipCommGroupCfgs,isValid,null); +// List strRegionList = new ArrayList<>(); +// List numRegionList = new ArrayList<>(); +// groupReuseCfg.setIpRegionList(ipRegionList); +// groupReuseCfg.setStrRegionList(strRegionList); +// groupReuseCfg.setNumRegionList(numRegionList); +// groupReuseList.add(groupReuseCfg); +// maatBean.setGroupReuseCfgList(groupReuseList); +// maatBean.setAuditTime(new Date()); +// maatBean.setCreatorName(UserUtils.getUser().getName()); +// maatBean.setVersion(Constants.MAAT_VERSION); +// logger.warn("IP Common Region Send To Maat start"); +// long start=System.currentTimeMillis(); +// if(isValid==Constants.VALID_YES) { +// maatBean.setOpAction(Constants.INSERT_ACTION); +// //调用服务接口下发配置数据 +// String json=gsonToJson(maatBean); +// if(ipCommGroupCfgs.size()<=100) { +// logger.info("ip 公共组域新增配置下发配置参数:"+json); +// }else { +// logger.info("ip 公共组域新增配置下发region条数:"+ipCommGroupCfgs.size()); +// } +// //调用服务接口下发配置 +// ToMaatResult result =ConfigServiceUtil.postGroupReuseSources(json); +// logger.info("ip 公共组域新增配置响应信息:"+result.getMsg()); +// }else { +// maatBean.setOpAction(Constants.UPDATE_ACTION); +// //调用服务接口下发配置数据 +// String json=gsonToJson(maatBean); +// if(ipCommGroupCfgs.size()<=100) { +// logger.info("ip 公共组域删除配置下发配置参数:"+json); +// }else { +// logger.info("ip 公共组域删除配置下发region条数:"+ipCommGroupCfgs.size()); +// +// } +// //调用服务接口下发配置 +// ToMaatResult result = ConfigServiceUtil.put(json,3); +// logger.info("asn ip复用域删除配置响应信息:"+result.getMsg()); +// } +// long end=System.currentTimeMillis(); +// logger.warn("IP Common Region Send To Maat finish,cost:"+(end-start)); +// } public void delete(String ids) { // TODO Auto-generated method stub if(ids==null) { @@ -217,24 +217,24 @@ public class IpCommGroupCfgService extends BaseService { BeanUtils.copyProperties(cfg, ipCommCfg); ipCommCfgs.add(ipCommCfg); ((IpCommGroupCfgDao) batchSqlSession.getMapper(IpCommGroupCfgDao.class)).insertForBatch(ipCommCfg); - if(send) { - if(groupCount.containsKey(ipCommCfg.getGroupId())) { - groupCount.put(ipCommCfg.getGroupId(), groupCount.get(ipCommCfg.getGroupId())+1); - }else { - groupCount.put(ipCommCfg.getGroupId(), 1); - } - } +// if(send) { +// if(groupCount.containsKey(ipCommCfg.getGroupId())) { +// groupCount.put(ipCommCfg.getGroupId(), groupCount.get(ipCommCfg.getGroupId())+1); +// }else { +// groupCount.put(ipCommCfg.getGroupId(), 1); +// } +// } } - if(send) { - if(groupCount.size()>0) { - for(Entry groupId:groupCount.entrySet()) { - policyGroupInfoDao.updateUdFlag(groupId.getKey(), 1,5); - } - - this.send2Maat(ipCommCfgs, Constants.VALID_YES); - } - } +// if(send) { +// if(groupCount.size()>0) { +// for(Entry groupId:groupCount.entrySet()) { +// policyGroupInfoDao.updateUdFlag(groupId.getKey(), 1,5); +// } +// +// this.send2Maat(ipCommCfgs, Constants.VALID_YES); +// } +// } batchSqlSession.commit(); }finally { if(batchSqlSession != null){ diff --git a/src/main/java/com/nis/web/service/configuration/HttpRedirectCfgService.java b/src/main/java/com/nis/web/service/configuration/HttpRedirectCfgService.java index 50bda8346..5edb1ed07 100644 --- a/src/main/java/com/nis/web/service/configuration/HttpRedirectCfgService.java +++ b/src/main/java/com/nis/web/service/configuration/HttpRedirectCfgService.java @@ -78,6 +78,10 @@ public class HttpRedirectCfgService extends CrudService exportHttpCfg(CfgIndexInfo entity){ Map dataMap=new HashMap(); diff --git a/src/main/webapp/WEB-INF/include/header.jsp b/src/main/webapp/WEB-INF/include/header.jsp index 2f6e99881..e0e2fc1f8 100644 --- a/src/main/webapp/WEB-INF/include/header.jsp +++ b/src/main/webapp/WEB-INF/include/header.jsp @@ -110,3 +110,6 @@ + + + diff --git a/src/main/webapp/WEB-INF/views/basics/ipCommGroupFormAdd.jsp b/src/main/webapp/WEB-INF/views/basics/ipCommGroupFormAdd.jsp index 3d498b3ac..40d72eb3a 100644 --- a/src/main/webapp/WEB-INF/views/basics/ipCommGroupFormAdd.jsp +++ b/src/main/webapp/WEB-INF/views/basics/ipCommGroupFormAdd.jsp @@ -143,8 +143,8 @@ var reSort=function(obj,index){ - diff --git a/src/main/webapp/WEB-INF/views/basics/ipCommonGroupCfgList.jsp b/src/main/webapp/WEB-INF/views/basics/ipCommonGroupCfgList.jsp index c0877c5f9..9106c6c41 100644 --- a/src/main/webapp/WEB-INF/views/basics/ipCommonGroupCfgList.jsp +++ b/src/main/webapp/WEB-INF/views/basics/ipCommonGroupCfgList.jsp @@ -75,7 +75,6 @@ $(".group").each(function(){ var text=$(this); $.each(data,function(key,values){ - console.log(key); if(key==$(text).text()){ $(text).html(values); } @@ -132,7 +131,7 @@
-
+ <%--
@@ -141,7 +140,7 @@ -
+
--%>
@@ -151,7 +150,7 @@ - + <%-- --%>
@@ -197,7 +196,7 @@
- + <%--
-
+
--%> href="javascript:;"> @@ -256,7 +255,7 @@ -
+ <%--
" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:true});"/>
-
+
--%> @@ -287,7 +286,7 @@ - + <%-- --%> <%-- --%> <%-- --%> @@ -295,18 +294,15 @@ - - - - + <%-- --%> <%-- --%> - - + <%-- + --%> <%-- --%> @@ -314,7 +310,7 @@ - ${cfg.compileId } + <%-- ${cfg.compileId } --%> ${cfg.cfgDesc } ${cfg.groupId} @@ -329,7 +325,7 @@ - + <%-- @@ -337,7 +333,7 @@ - + --%> <%--
--%> @@ -348,8 +344,8 @@ ${cfg.editorName } - ${cfg.auditorName } - + <%-- ${cfg.auditorName } + --%>
diff --git a/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpRedirectCommonForm.jsp b/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpRedirectCommonForm.jsp new file mode 100644 index 000000000..af9e30159 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/cfg/proxy/control/httpRedirectCommonForm.jsp @@ -0,0 +1,533 @@ +<%@ page contentType="text/html;charset=UTF-8"%> +<%@ include file="/WEB-INF/include/taglib.jsp"%> + + +<spring:message code="${cfgName}"></spring:message> + + + + + + + +
+

+ +

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

+ + +

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

+ + +

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

+ + +

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

+ + +

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

+ + +

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

+ + +

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

+ + +

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

+ + +

+ + +
hidden disabled "> +
+
+ +
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+
+
+
+
+ <%@include file="/WEB-INF/include/form/areaInfo.jsp"%> +
+ <%@include file="/WEB-INF/include/form/basicInfo.jsp"%> +
+ <%@include file="/WEB-INF/include/form/scheduleNew.jsp"%> +
+
+
+
+
+ + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+ +
+
+
+
+
+ + \ No newline at end of file