bgp模块ip域配置提交

导出全部数据简单功能
This commit is contained in:
duandongmei
2018-06-13 09:30:03 +08:00
parent b6bfcdda1f
commit 611c9139cf
17 changed files with 1532 additions and 52 deletions

View File

@@ -62,6 +62,8 @@ public class Page<T> {
private RequestContext requestContext; private RequestContext requestContext;
private int maxExportSize=Constants.MAX_EXPORT_SIZE;
public Page() { public Page() {
this.pageSize = -1; this.pageSize = -1;
} }
@@ -662,7 +664,13 @@ public class Page<T> {
public String getFuncParam() { public String getFuncParam() {
return funcParam; return funcParam;
} }
@JsonIgnore
public int getMaxExportSize() {
return maxExportSize;
}
public void setMaxExportSize(int maxExportSize) {
this.maxExportSize = maxExportSize;
}
/** /**
* 设置分页函数的附加参数 * 设置分页函数的附加参数
* @return * @return

View File

@@ -15,6 +15,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.google.gson.annotations.Expose; import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import com.nis.domain.BaseEntity; import com.nis.domain.BaseEntity;
import com.nis.util.excel.ExcelField;
/** /**
* @ClassName: BaseConfig.java * @ClassName: BaseConfig.java
@@ -48,20 +49,24 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
/** /**
* 配置描述 * 配置描述
*/ */
@ExcelField(title="config_describe")
protected String cfgDesc; protected String cfgDesc;
/** /**
* GK类型 * GK类型
*/ */
@ExcelField(title="action")
protected Integer action; protected Integer action;
/** /**
* 有效标识 * 有效标识
*/ */
@ExcelField(title="valid_identifier")
@Expose @Expose
protected Integer isValid; protected Integer isValid;
/** /**
* 是否审核 * 是否审核
*/ */
@ExcelField(title="is_audit")
protected Integer isAudit; protected Integer isAudit;
/** /**
* 创建人员 * 创建人员
@@ -70,10 +75,12 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
/** /**
* 创建人员 * 创建人员
*/ */
@ExcelField(title="creator")
protected String creatorName; protected String creatorName;
/** /**
* 配置时间 * 配置时间
*/ */
@ExcelField(title="config_time")
protected Date createTime; protected Date createTime;
/** /**
* 修改人员 * 修改人员
@@ -82,10 +89,12 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
/** /**
* 创建人员 * 创建人员
*/ */
@ExcelField(title="editor")
protected String editorName; protected String editorName;
/** /**
* 修改时间 * 修改时间
*/ */
@ExcelField(title="edit_time")
protected Date editTime; protected Date editTime;
/** /**
* 审核人员 * 审核人员
@@ -94,11 +103,13 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
/** /**
* 审核人员 * 审核人员
*/ */
@ExcelField(title="auditor")
protected String auditorName; protected String auditorName;
/** /**
* 审核时间 * 审核时间
*/ */
@Expose @Expose
@ExcelField(title="audit_time")
@SerializedName("opTime") @SerializedName("opTime")
protected Date auditTime; protected Date auditTime;
/** /**
@@ -114,22 +125,27 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
/** /**
* 来函 * 来函
*/ */
@ExcelField(title="letter")
protected String requestName; protected String requestName;
/** /**
* 是否区域gk * 是否区域gk
*/ */
@ExcelField(title="whether_area_block")
protected Integer isAreaEffective; protected Integer isAreaEffective;
/** /**
* 分类 * 分类
*/ */
@ExcelField(title="type")
protected String classify; protected String classify;
/** /**
* 性质 * 性质
*/ */
@ExcelField(title="attribute")
protected String attribute; protected String attribute;
/** /**
* 标签 * 标签
*/ */
@ExcelField(title="label")
protected String lable; protected String lable;
/** /**
* 分类 * 分类

View File

@@ -12,6 +12,7 @@ import org.apache.commons.lang3.StringEscapeUtils;
import com.google.gson.annotations.Expose; import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import com.nis.util.excel.ExcelField;
/** /**
* @ClassName: BaseStringConfig.java * @ClassName: BaseStringConfig.java
@@ -34,7 +35,9 @@ public class BaseStringCfg extends BaseCfg<BaseStringCfg> {
*/ */
@Expose @Expose
@SerializedName("keywords") @SerializedName("keywords")
@ExcelField(title="key_word")
protected String cfgKeywords; protected String cfgKeywords;
protected String cfgKeywordsShowName; protected String cfgKeywordsShowName;
/** /**
* @param cfgKeywords the cfgKeywords to set * @param cfgKeywords the cfgKeywords to set
@@ -46,18 +49,21 @@ public class BaseStringCfg extends BaseCfg<BaseStringCfg> {
* 表达式类型 * 表达式类型
*/ */
@Expose @Expose
@ExcelField(title="expression_type")
@SerializedName("exprType") @SerializedName("exprType")
protected Integer exprType ; protected Integer exprType ;
/** /**
* 匹配方式 * 匹配方式
*/ */
@Expose @Expose
@ExcelField(title="match_method")
@SerializedName("matchMethod") @SerializedName("matchMethod")
protected Integer matchMethod ; protected Integer matchMethod ;
/** /**
* 是否hex二进制 * 是否hex二进制
*/ */
@Expose @Expose
@ExcelField(title="whether_hexbinary")
@SerializedName("isHexbin") @SerializedName("isHexbin")
protected Integer isHexbin; protected Integer isHexbin;

View File

@@ -161,6 +161,10 @@ public final class Constants {
* 每页最大显示数 * 每页最大显示数
*/ */
public static final int MAX_PAGE_SIZE = Configurations.getIntProperty("maxPageSize", 100000); public static final int MAX_PAGE_SIZE = Configurations.getIntProperty("maxPageSize", 100000);
/**
* 每次最大导出条数
*/
public static final int MAX_EXPORT_SIZE = Configurations.getIntProperty("maxExportSize", 100000);
/** /**
* 对/错 * 对/错
@@ -324,6 +328,6 @@ public final class Constants {
public static final String SSL_SAN_REGION = Configurations.getStringProperty("ssl_san_region","ssl_san"); public static final String SSL_SAN_REGION = Configurations.getStringProperty("ssl_san_region","ssl_san");
public static final String SSL_CA_REGION = Configurations.getStringProperty("ssl_ca_region","ssl_ca"); public static final String SSL_CA_REGION = Configurations.getStringProperty("ssl_ca_region","ssl_ca");
public static final String PROTOCOL_NUM_REGION = Configurations.getStringProperty("protocol_num_region","protocol_num"); public static final String PROTOCOL_NUM_REGION = Configurations.getStringProperty("protocol_num_region","protocol_num");
public static final String BGP_IP_REGION = Configurations.getStringProperty("bgp_ip_region","bgp_ip");
public static final String KEYWORD_EXPR = Configurations.getStringProperty("keyword_expr","***and***"); public static final String KEYWORD_EXPR = Configurations.getStringProperty("keyword_expr","***and***");
} }

View File

@@ -9,6 +9,7 @@ import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.Date; import java.util.Date;
@@ -41,6 +42,7 @@ import com.google.common.collect.Lists;
import com.nis.util.DictUtils; import com.nis.util.DictUtils;
import com.nis.util.Encodes; import com.nis.util.Encodes;
import com.nis.util.Reflections; import com.nis.util.Reflections;
import com.nis.util.StringUtil;
/** /**
* 导出Excel文件导出“XLSX”格式支持大数据量导出 @see org.apache.poi.ss.SpreadsheetVersion * 导出Excel文件导出“XLSX”格式支持大数据量导出 @see org.apache.poi.ss.SpreadsheetVersion
@@ -76,6 +78,23 @@ public class ExportExcel {
*/ */
List<Object[]> annotationList = Lists.newArrayList(); List<Object[]> annotationList = Lists.newArrayList();
/**
* //递归获取cls实体对象及父级对象的属性
* @param list
* @param cls
*/
public void getFields(List<Field> list,Class<?> cls) {
Field[] fields=cls.getDeclaredFields();
if(fields != null && fields.length > 0){
for (Field field : fields) {
list.add(field);
}
}
if(cls.getSuperclass() != null){
getFields(list,cls.getSuperclass());
}
}
/** /**
* 构造函数 * 构造函数
* @param title 表格标题,传“空值”,表示无标题 * @param title 表格标题,传“空值”,表示无标题
@@ -84,7 +103,6 @@ public class ExportExcel {
public ExportExcel(String title, Class<?> cls){ public ExportExcel(String title, Class<?> cls){
this(title, cls, 1); this(title, cls, 1);
} }
/** /**
* 构造函数 * 构造函数
* @param title 表格标题,传“空值”,表示无标题 * @param title 表格标题,传“空值”,表示无标题
@@ -93,27 +111,31 @@ public class ExportExcel {
* @param groups 导入分组 * @param groups 导入分组
*/ */
public ExportExcel(String title, Class<?> cls, int type, int... groups){ public ExportExcel(String title, Class<?> cls, int type, int... groups){
List<Field> list=new ArrayList<Field>();
// Get annotation field // Get annotation field
Field[] fs = cls.getDeclaredFields(); getFields(list, cls);
for (Field f : fs){
ExcelField ef = f.getAnnotation(ExcelField.class); if(!StringUtil.isEmpty(list)){
if (ef != null && (ef.type()==0 || ef.type()==type)){ for (Field f : list){
if (groups!=null && groups.length>0){ ExcelField ef = f.getAnnotation(ExcelField.class);
boolean inGroup = false; if (ef != null && (ef.type()==0 || ef.type()==type)){
for (int g : groups){ if (groups!=null && groups.length>0){
if (inGroup){ boolean inGroup = false;
break; for (int g : groups){
} if (inGroup){
for (int efg : ef.groups()){
if (g == efg){
inGroup = true;
annotationList.add(new Object[]{ef, f});
break; break;
} }
for (int efg : ef.groups()){
if (g == efg){
inGroup = true;
annotationList.add(new Object[]{ef, f});
break;
}
}
} }
}else{
annotationList.add(new Object[]{ef, f});
} }
}else{
annotationList.add(new Object[]{ef, f});
} }
} }
} }
@@ -171,27 +193,32 @@ public class ExportExcel {
* @param groups 导入分组 * @param groups 导入分组
*/ */
public ExportExcel(Properties msgProp,String title, Class<?> cls, int type, int... groups){ public ExportExcel(Properties msgProp,String title, Class<?> cls, int type, int... groups){
List<Field> list=new ArrayList<Field>();
// Get annotation field // Get annotation field
Field[] fs = cls.getDeclaredFields(); //递归获取cls实体对象及父级对象的属性
for (Field f : fs){ getFields(list, cls);
ExcelField ef = f.getAnnotation(ExcelField.class);
if (ef != null && (ef.type()==0 || ef.type()==type)){ if(!StringUtil.isEmpty(list)){
if (groups!=null && groups.length>0){ for (Field f : list){
boolean inGroup = false; ExcelField ef = f.getAnnotation(ExcelField.class);
for (int g : groups){ if (ef != null && (ef.type()==0 || ef.type()==type)){
if (inGroup){ if (groups!=null && groups.length>0){
break; boolean inGroup = false;
} for (int g : groups){
for (int efg : ef.groups()){ if (inGroup){
if (g == efg){
inGroup = true;
annotationList.add(new Object[]{ef, f});
break; break;
} }
for (int efg : ef.groups()){
if (g == efg){
inGroup = true;
annotationList.add(new Object[]{ef, f});
break;
}
}
} }
}else{
annotationList.add(new Object[]{ef, f});
} }
}else{
annotationList.add(new Object[]{ef, f});
} }
} }
} }

View File

@@ -6,6 +6,7 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Properties;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@@ -14,6 +15,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.InitBinder;
@@ -37,6 +39,7 @@ import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.ComplexkeywordCfg; import com.nis.domain.configuration.ComplexkeywordCfg;
import com.nis.domain.configuration.NumBoundaryCfg; import com.nis.domain.configuration.NumBoundaryCfg;
import com.nis.domain.configuration.RequestInfo; import com.nis.domain.configuration.RequestInfo;
import com.nis.util.Configurations;
//import com.nis.main.ConvertTool; //import com.nis.main.ConvertTool;
import com.nis.util.Constants; import com.nis.util.Constants;
import com.nis.util.DateUtils; import com.nis.util.DateUtils;
@@ -56,6 +59,7 @@ import com.nis.web.service.basics.SysDictInfoService;
import com.nis.web.service.configuration.AppCfgService; import com.nis.web.service.configuration.AppCfgService;
import com.nis.web.service.configuration.AvCfgService; import com.nis.web.service.configuration.AvCfgService;
import com.nis.web.service.configuration.AvContentCfgService; import com.nis.web.service.configuration.AvContentCfgService;
import com.nis.web.service.configuration.BgpCfgService;
import com.nis.web.service.configuration.ComplexStringCfgService; import com.nis.web.service.configuration.ComplexStringCfgService;
import com.nis.web.service.configuration.DnsIpCfgService; import com.nis.web.service.configuration.DnsIpCfgService;
import com.nis.web.service.configuration.FileTransferCfgService; import com.nis.web.service.configuration.FileTransferCfgService;
@@ -143,6 +147,8 @@ public class BaseController {
protected AvContentCfgService avContentCfgService; protected AvContentCfgService avContentCfgService;
@Autowired @Autowired
protected WebsiteCfgService websiteCfgService; protected WebsiteCfgService websiteCfgService;
@Autowired
protected BgpCfgService bgpCfgService;
/** /**
* 管理基础路径 * 管理基础路径
*/ */
@@ -401,4 +407,26 @@ public class BaseController {
} }
return areaIspList; return areaIspList;
} }
/**
* 获取国际化配置文件
* @return
*/
public Properties getMsgProp(){
Properties msgProp = new Properties();
try {
String language = LocaleContextHolder.getLocale().getLanguage();
if(language.equals("zh_cn")||language.equals("zh")){
msgProp.load(Configurations.class.getResourceAsStream("/messages/message_zh_CN.properties"));
}else if(language.equals("ru")){
msgProp.load(Configurations.class.getResourceAsStream("/messages/message_ru.properties"));
}else{
msgProp.load(Configurations.class.getResourceAsStream("/messages/message_en.properties"));
}
} catch (Exception e) {
msgProp = null;
logger.error("未知i18n消息配置文件,请确定文件是否存在!",e);
}
return msgProp;
}
} }

View File

@@ -3,14 +3,17 @@ package com.nis.web.controller.configuration.ntc;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Properties;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.ModelAttribute;
@@ -19,6 +22,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes; import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.Page; import com.nis.domain.Page;
import com.nis.domain.SysUser;
import com.nis.domain.basics.SysDictInfo; import com.nis.domain.basics.SysDictInfo;
import com.nis.domain.configuration.AreaBean; import com.nis.domain.configuration.AreaBean;
import com.nis.domain.configuration.AreaIpCfg; import com.nis.domain.configuration.AreaIpCfg;
@@ -29,8 +33,11 @@ import com.nis.exceptions.MaatConvertException;
import com.nis.domain.configuration.AvVoipIpCfg; import com.nis.domain.configuration.AvVoipIpCfg;
import com.nis.domain.configuration.BaseIpCfg; import com.nis.domain.configuration.BaseIpCfg;
import com.nis.domain.configuration.BaseStringCfg; import com.nis.domain.configuration.BaseStringCfg;
import com.nis.util.Configurations;
import com.nis.util.Constants; import com.nis.util.Constants;
import com.nis.util.DateUtils;
import com.nis.util.StringUtil; import com.nis.util.StringUtil;
import com.nis.util.excel.ExportExcel;
import com.nis.web.controller.BaseController; import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils; import com.nis.web.security.UserUtils;
@@ -457,4 +464,54 @@ public class AvContentController extends BaseController {
data.put("areaIps", areaIps); data.put("areaIps", areaIps);
return data; return data;
} }
//视频文本VOIP配置列表导出
@RequestMapping(value = {"/voipExport"})
public String voipExport(Model model,
HttpServletRequest request,
HttpServletResponse response,
@ModelAttribute("cfg")CfgIndexInfo entity,
String ids,
RedirectAttributes redirectAttributes){
Properties msgProp = getMsgProp();
try {
String fileName = "数据-"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
//导出选中记录
if(!StringUtil.isEmpty(ids)){
}else{
//导出查询条件下的所有记录
if(entity.getVoipIp()== null){
entity.setVoipIp(new AvVoipIpCfg());
}
if(entity.getVoipAccount()== null){
entity.setVoipAccount(new AvVoipAccountCfg());
}
//条件导出数据大于最大导出数,只导出最大导出条数
Page pageInfo=new Page<CfgIndexInfo>(request, response,"r");
//int pageNo=pageInfo.getPageNo();
//int pageSize=pageInfo.getPageSize();
if(pageInfo.getCount()>Constants.MAX_EXPORT_SIZE){
pageInfo.setPageNo(1);
pageInfo.setPageSize(Constants.MAX_EXPORT_SIZE);
}else{
pageInfo.setPageNo(1);
pageInfo.setPageSize(-1);
}
Page<CfgIndexInfo> page = avContentCfgService.findPage(pageInfo, entity);
new ExportExcel(msgProp,null, CfgIndexInfo.class,1).setDataList(page.getList()).write(response, fileName).dispose();
}
return null;
} catch (Exception e) {
e.printStackTrace();
addMessage(redirectAttributes, "导出失败!失败信息:"+e.getMessage());
}
return "redirect:" + adminPath +"/ntc/av/picUrlList?functionId="+entity.getFunctionId();
}
} }

View File

@@ -0,0 +1,128 @@
package com.nis.web.controller.configuration.ntc;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
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;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.nis.domain.Page;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.HttpUrlCfg;
import com.nis.domain.configuration.IpPortCfg;
import com.nis.exception.MaatConvertException;
import com.nis.util.Constants;
import com.nis.util.StringUtils;
import com.nis.web.controller.BaseController;
import com.nis.web.security.UserUtils;
/**
* BGP配置
* @author dell
*
*/
@Controller
@RequestMapping("${adminPath}/ntc/other/")
public class BgpCfgController extends BaseController{
@RequestMapping(value = {"bgpList"})
@RequiresPermissions(value={"other:bgp:config"})
public String httpList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) {
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
Page<CfgIndexInfo> page = bgpCfgService.getBgpList(searchPage, cfg);
model.addAttribute("page", page);
initPageCondition(model,cfg);
return "/cfg/other/bgpList";
}
@RequestMapping(value = {"bgpForm"})
@RequiresPermissions(value={"other:bgp:config"})
public String bgpForm(Model model,String ids,CfgIndexInfo entity) {
if(StringUtils.isNotBlank(ids)){
entity = bgpCfgService.getBgpCfg(Long.parseLong(ids));
initUpdateFormCondition(model,entity);
}else{
initFormCondition(model,entity);
}
model.addAttribute("_cfg", entity);
return "/cfg/other/bgpForm";
}
@RequestMapping(value = {"saveBgpCfg"})
@RequiresPermissions(value={"other:bgp:config"})
public String saveBgpCfg(Model model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
bgpCfgService.saveBgpCfg(entity);
return "redirect:" + adminPath +"/ntc/other/bgpList?functionId="+entity.getFunctionId();
}
@RequestMapping(value = {"ajaxBgpSubList"})
public String ajaxBgpSubList(Model model,Long cfgId,Integer index) {
CfgIndexInfo cfg = bgpCfgService.getBgpCfg(cfgId);
List<String[]> tabList = new ArrayList();
if(cfg.getIpPortList()!=null){
String cfgType = null;
for(IpPortCfg ip:cfg.getIpPortList()){
if(!ip.getCfgType().equals(cfgType)){
tabList.add(new String[]{"1",ip.getCfgType()});
cfgType = ip.getCfgType();
}
}
}
/*TODO
* if(cfg.getDomainList()!=null){
String cfgType = null;
for(ComplexkeywordCfg keyword:cfg.getDomainList()){
if(!keyword.getCfgType().equals(cfgType)){
tabList.add(new String[]{"3",keyword.getCfgType()});
cfgType = keyword.getCfgType();
}
}
}*/
model.addAttribute("_cfg", cfg);
model.addAttribute("index", index);
model.addAttribute("tabList", tabList);
return "/cfg/website/dnsSubList";
}
@RequestMapping(value = {"updateBgpCfgValid"})
@RequiresPermissions(value={"other:bgp:config"})
public String updateBgpCfgValid(Integer isValid,String ids,Integer functionId) {
bgpCfgService.updateBgpCfgValid(isValid,ids,functionId);
return "redirect:" + adminPath +"/ntc/other/bgpList?functionId="+functionId;
}
@RequestMapping(value = {"auditBgpCfg"})
@RequiresPermissions(value={"other:bgp:audit"})
public String auditBgpCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
CfgIndexInfo entity = new CfgIndexInfo();
String[] idArray = ids.split(",");
for(String id :idArray){
entity = bgpCfgService.getBgpCfg(Long.parseLong(id));
entity.setIsAudit(isAudit);
entity.setIsValid(isValid);
entity.setAuditorId(UserUtils.getUser().getId());
entity.setAuditTime(new Date());
entity.setFunctionId(functionId);
try {
bgpCfgService.auditBgpCfg(entity,isAudit);
} catch (MaatConvertException e) {
e.printStackTrace();
logger.info("bgp配置下发失败"+e.getMessage());
addMessage(redirectAttributes, e.getMessage());
}
}
return "redirect:" + adminPath +"/ntc/other/bgpList?functionId="+functionId;
}
}

View File

@@ -0,0 +1,49 @@
package com.nis.web.dao.configuration;
import java.util.List;
import com.nis.domain.configuration.AvFileSampleCfg;
import com.nis.domain.configuration.AvSignSampleCfg;
import com.nis.domain.configuration.BaseCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.ComplexkeywordCfg;
import com.nis.domain.configuration.DnsDomainCfg;
import com.nis.domain.configuration.DnsIpCfg;
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.configuration.SslKeywordCfg;
import com.nis.web.dao.CrudDao;
import com.nis.web.dao.MyBatisDao;
/**
* WEB相关配置数据处理类
* @author dell
*
*/
@MyBatisDao
public interface BgpCfgDao extends CrudDao<CfgIndexInfo>{
public CfgIndexInfo getCfgIndexInfo(Long id);
public List<CfgIndexInfo> getBgpList(CfgIndexInfo entity);
public List<IpPortCfg> getIpPortList(CfgIndexInfo entity);
public List<HttpUrlCfg> getHttpUrlList(CfgIndexInfo entity);
public void saveCfgIndex(CfgIndexInfo entity);
public void saveIpPortCfg(IpPortCfg entity);
//public void saveHttpUrlCfg(HttpUrlCfg entity);
public void deleteHttpIpCfg(CfgIndexInfo entity);
//public void deleteHttpUrlCfg(CfgIndexInfo entity);
public void updateCfgIndex(CfgIndexInfo entity);
public void updateCfgValid(BaseCfg entity);
public void auditCfg(BaseCfg entity);
public void saveDnsDomainCfg(ComplexkeywordCfg entity);
public void deleteIpCfg(CfgIndexInfo entity);
}

View File

@@ -0,0 +1,547 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.nis.web.dao.configuration.BgpCfgDao" >
<resultMap id="CfgIndexInfoMap" type="com.nis.domain.configuration.CfgIndexInfo" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
</resultMap>
<resultMap id="ipPortMap" type="com.nis.domain.configuration.IpPortCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="ip_type" property="ipType" jdbcType="INTEGER" />
<result column="ip_pattern" property="ipPattern" jdbcType="INTEGER" />
<result column="dest_ip_address" property="destIpAddress" jdbcType="VARCHAR" />
<result column="src_ip_address" property="srcIpAddress" jdbcType="VARCHAR" />
<result column="dest_port" property="destPort" jdbcType="VARCHAR" />
<result column="src_port" property="srcPort" jdbcType="VARCHAR" />
<result column="port_pattern" property="portPattern" jdbcType="INTEGER" />
<result column="direction" property="direction" jdbcType="INTEGER" />
<result column="protocol" property="protocol" jdbcType="INTEGER" />
<result column="protocol_id" property="protocolId" jdbcType="INTEGER" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="stringCfgMap" type="com.nis.domain.configuration.BaseStringCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_keywords" property="cfgKeywords" jdbcType="VARCHAR" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="expr_type " property="exprType" jdbcType="INTEGER" />
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
</resultMap>
<resultMap id="complexCfgMap" type="com.nis.domain.configuration.ComplexkeywordCfg" >
<id column="cfg_id" property="cfgId" jdbcType="BIGINT" />
<result column="cfg_desc" property="cfgDesc" jdbcType="VARCHAR" />
<result column="cfg_keywords" property="cfgKeywords" jdbcType="VARCHAR" />
<result column="district" property="district" jdbcType="VARCHAR" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
<result column="action" property="action" jdbcType="INTEGER" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="is_audit" property="isAudit" jdbcType="INTEGER" />
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="edit_time" property="editTime" jdbcType="TIMESTAMP" />
<result column="auditor_id" property="auditorId" jdbcType="INTEGER" />
<result column="audit_time" property="auditTime" jdbcType="TIMESTAMP" />
<result column="service_id" property="serviceId" jdbcType="INTEGER" />
<result column="request_id" property="requestId" jdbcType="INTEGER" />
<result column="compile_id" property="compileId" jdbcType="INTEGER" />
<result column="is_area_effective" property="isAreaEffective" jdbcType="INTEGER" />
<result column="classify" property="classify" jdbcType="VARCHAR" />
<result column="attribute" property="attribute" jdbcType="VARCHAR" />
<result column="lable" property="lable" jdbcType="VARCHAR" />
<result column="expr_type " property="exprType" jdbcType="INTEGER" />
<result column="match_method" property="matchMethod" jdbcType="INTEGER" />
<result column="is_hexbin" property="isHexbin" jdbcType="INTEGER" />
<result column="area_effective_ids" property="areaEffectiveIds" jdbcType="VARCHAR" />
<result column="function_id" property="functionId" jdbcType="INTEGER" />
<result column="cfg_region_code" property="cfgRegionCode" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="VARCHAR" />
</resultMap>
<sql id="ConfigIndex_Column" >
a.CFG_ID,a.CFG_DESC,a.ACTION,a.IS_VALID,a.IS_AUDIT,
a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME,
a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY,
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id
</sql>
<sql id="IpCfg_Column" >
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
,a.protocol,a.protocol_id,a.direction,a.cfg_type,a.action,a.dest_port,a.dest_ip_address
,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id
,a.edit_time,a.auditor_id,a.audit_time,a.service_id,a.request_id,
a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable
,a.area_effective_ids,a.function_id,a.cfg_region_code
</sql>
<sql id="StrCfg_Column" >
a.cfg_id,a.cfg_desc,a.cfg_keywords,a.cfg_type,
a.action,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id,a.edit_time, a.auditor_id,
a.audit_time,a.service_id,a.request_id,a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable,
a.expr_type,a.match_method,a.is_hexbin,a.area_effective_ids,a.function_id,a.cfg_region_code
</sql>
<sql id="ComplexCfg_Column" >
a.cfg_id,a.cfg_desc,a.cfg_keywords,a.cfg_type,a.district,
a.action,a.is_valid,a.is_audit,a.creator_id,a.create_time,a.editor_id,a.edit_time, a.auditor_id,
a.audit_time,a.service_id,a.request_id,a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable,
a.expr_type,a.match_method,a.is_hexbin,a.area_effective_ids,a.function_id,a.cfg_region_code
</sql>
<select id="getBgpList" resultMap="CfgIndexInfoMap" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
SELECT
<include refid="ConfigIndex_Column" />
<trim prefix="," prefixOverrides=",">
, s.name as creator_name,e.name as editor_name,u.name as auditor_name
,ri.request_title as requestName
</trim>
FROM cfg_index_info a
left join sys_user s on a.creator_id=s.id
left join sys_user e on a.editor_id=e.id
left join sys_user u on a.auditor_id=u.id
left join request_info ri on a.request_id=ri.id
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="page !=null and page.where != null and page.where != ''">
AND ${page.where}
</if>
<if test="cfgId != null">
AND a.CFG_ID=#{cfgId,jdbcType=BIGINT}
</if>
<if test="cfgDesc != null and cfgDesc != ''">
AND a.CFG_DESC like concat(concat('%',#{cfgDesc,jdbcType=VARCHAR}),'%')
</if>
<if test="action != null">
AND a.ACTION=#{action,jdbcType=INTEGER}
</if>
<if test="isValid != null">
AND a.IS_VALID=#{isValid,jdbcType=INTEGER}
</if>
<if test="isValid == null">
AND a.IS_VALID != -1
</if>
<if test="isAudit != null">
AND a.IS_AUDIT=#{isAudit,jdbcType=INTEGER}
</if>
<if test="creatorName != null and creatorName != ''">
AND CREATOR_NAME like concat(concat('%',#{creatorName,jdbcType=VARCHAR}),'%')
</if>
<if test="editorName != null and editorName != ''">
AND EDITOR_NAME like concat(concat('%',#{editorName,jdbcType=VARCHAR}),'%')
</if>
<if test="auditorName != null and auditorName != ''">
AND AUDITOR_NAME like concat(concat('%',#{auditorName,jdbcType=VARCHAR}),'%')
</if>
<if test="serviceId != null">
AND a.SERVICE_ID=#{serviceId,jdbcType=INTEGER}
</if>
<if test="requestId != null">
AND a.REQUEST_ID=#{requestId,jdbcType=INTEGER}
</if>
<if test="compileId != null">
AND a.COMPILE_ID=#{compileId,jdbcType=INTEGER}
</if>
<if test="isAreaEffective != null">
AND a.IS_AREA_EFFECTIVE=#{isAreaEffective,jdbcType=INTEGER}
</if>
<if test="classify != null and classify != ''">
AND a.classify like concat(concat('%',#{classify,jdbcType=VARCHAR}),'%')
</if>
<if test="attribute != null and attribute != ''">
AND a.attribute like concat(concat('%',#{attribute,jdbcType=VARCHAR}),'%')
</if>
<if test="lable != null and lable != ''">
AND a.lable like concat(concat('%',#{lable,jdbcType=VARCHAR}),'%')
</if>
<if test="areaEffectiveIds != null and areaEffectiveIds != ''">
AND a.AREA_EFFECTIVE_IDS like concat(concat('%',#{areaEffectiveIds,jdbcType=VARCHAR}),'%')
</if>
<if test="functionId != null">
AND a.function_id=#{functionId,jdbcType=INTEGER}
</if>
<if test="ipPort!=null">
AND a.compile_id in (select t.compile_id from ip_port_cfg t
<where>
and t.protocol_id=19
<if test="ipPort.srcIpAddress != null and ipPort.srcIpAddress != ''">
and t.src_ip_address =#{(ipPort.srcIpAddress,jdbcType=VARCHAR}
</if>
<if test="ipPort.srcPort != null and ipPort.srcPort != ''">
and t.src_port =#{ipPort.srcPort,jdbcType=VARCHAR}
</if>
<if test="ipPort.destIpAddress != null and ipPort.destIpAddress != ''">
and t.dest_ip_address =#{(ipPort.destIpAddress,jdbcType=VARCHAR}
</if>
<if test="ipPort.destPort != null and ipPort.destPort != ''">
and t.dest_port =#{ipPort.destPort,jdbcType=VARCHAR}
</if>
</where>
)
</if>
<!-- <if test="httpUrl!=null">
AND a.compile_id in (select f.compile_id from http_url_cfg f
<where>
<if test="httpUrl.cfgKeywords != null and httpUrl.cfgKeywords != ''">
and f.cfg_keywords like concat(concat('%',#{httpUrl.cfgKeywords,jdbcType=VARCHAR}),'%')
</if>
</where>
)
</if> -->
<!-- 数据范围过滤 -->
${sqlMap.dsf}
</trim>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.CFG_ID desc
</otherwise>
</choose>
</select>
<select id="getCfgIndexInfo" resultMap="CfgIndexInfoMap" parameterType="java.lang.Long">
SELECT
<include refid="ConfigIndex_Column" />
FROM cfg_index_info a where cfg_id=#{cfgId}
</select>
<select id="getIpPortList" resultMap="ipPortMap" parameterType="com.nis.domain.configuration.CfgIndexInfo">
SELECT
<include refid="IpCfg_Column" />
FROM ip_port_cfg a where compile_id=#{compileId} and function_id=#{functionId}
</select>
<select id="getHttpUrlList" resultMap="stringCfgMap">
SELECT
<include refid="StrCfg_Column" />
FROM http_url_cfg a where compile_id=#{compileId} and function_id=#{functionId}
</select>
<!-- insert cfgIndexInfox -->
<insert id="saveCfgIndex" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cfg_index_info(
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
)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}
)
</insert>
<!-- insert ip_port_cfg表信息 -->
<insert id="saveIpPortCfg" parameterType="com.nis.domain.configuration.IpPortCfg" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ip_port_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,
ip_type,
src_ip_address,
ip_pattern,
port_pattern,
src_port,
protocol,
protocol_id,
direction,
dest_port,
dest_ip_address,
cfg_type,
cfg_region_code
)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},
#{ipType,jdbcType=INTEGER},
#{srcIpAddress,jdbcType=VARCHAR},
#{ipPattern,jdbcType=INTEGER},
#{portPattern,jdbcType=INTEGER},
#{srcPort,jdbcType=VARCHAR},
#{protocol,jdbcType=INTEGER},
#{protocolId,jdbcType=INTEGER},
#{direction,jdbcType=INTEGER},
#{destPort,jdbcType=VARCHAR},
#{destIpAddress,jdbcType=VARCHAR},
#{cfgType,jdbcType=VARCHAR},
#{cfgRegionCode,jdbcType=INTEGER}
)
</insert>
<!-- insert http_url_cfg表信息 -->
<insert id="saveHttpUrlCfg" parameterType="com.nis.domain.configuration.HttpUrlCfg" >
<selectKey resultType="java.lang.Long" order="AFTER" keyProperty="cfgId">
SELECT LAST_INSERT_ID()
</selectKey>
insert into http_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
)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},
#{cfgKeywords,jdbcType=VARCHAR},
#{cfgType,jdbcType=VARCHAR},
#{cfgRegionCode,jdbcType=INTEGER},
#{exprType,jdbcType=INTEGER},
#{matchMethod,jdbcType=INTEGER},
#{isHexbin,jdbcType=INTEGER}
)
</insert>
<update id="updateCfgIndex" parameterType="com.nis.domain.configuration.CfgIndexInfo" >
update cfg_index_info
<set >
<trim suffixOverrides=",">
<if test="cfgDesc != null and cfgDesc != ''" >
cfg_desc = #{cfgDesc,jdbcType=VARCHAR},
</if>
<if test="action != null" >
action = #{action,jdbcType=INTEGER},
</if>
<if test="isValid != null" >
is_valid = #{isValid,jdbcType=INTEGER},
</if>
<if test="isAudit != null" >
is_audit = #{isAudit,jdbcType=INTEGER},
</if>
<if test="creatorId != null" >
creator_id = #{creatorId,jdbcType=INTEGER},
</if>
<if test="createTime != null and createTime != ''" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="editorId != null" >
editor_id = #{editorId,jdbcType=INTEGER},
</if>
edit_time = #{editTime,jdbcType=TIMESTAMP},
<if test="serviceId != null" >
service_id = #{serviceId,jdbcType=INTEGER},
</if>
<if test="requestId != null" >
request_id = #{requestId,jdbcType=INTEGER},
</if>
<if test="isAreaEffective != null" >
is_area_effective = #{isAreaEffective,jdbcType=INTEGER},
</if>
<if test="classify != null and classify != ''" >
classify = #{classify,jdbcType=VARCHAR},
</if>
<if test="attribute != null and attribute != ''" >
attribute = #{attribute,jdbcType=VARCHAR},
</if>
<if test="lable != null and lable != ''" >
lable = #{lable,jdbcType=VARCHAR},
</if>
<if test="areaEffectiveIds != null" >
area_effective_ids = #{areaEffectiveIds,jdbcType=VARCHAR},
</if>
<if test="functionId != null" >
function_id = #{functionId,jdbcType=INTEGER},
</if>
</trim>
</set>
where cfg_id = #{cfgId,jdbcType=BIGINT}
</update>
<!-- 删除http子配置 -->
<delete id="deleteIpCfg" >
delete from ip_port_cfg where compile_id=#{compileId} and protocol_id=19 and function_id=#{functionId}
</delete>
<delete id="deleteHttpUrlCfg">
delete from http_url_cfg where compile_id=#{compileId} and function_id=#{functionId}
</delete>
<update id="updateCfgValid" parameterType="com.nis.domain.configuration.BaseCfg">
update ${tableName} set is_valid = #{isValid,jdbcType=INTEGER},
editor_id = #{editorId,jdbcType=INTEGER} ,
edit_time = #{editTime,jdbcType=TIMESTAMP}
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId !=null ">
AND cfg_id = #{cfgId,jdbcType=BIGINT}
</if>
<if test="compileId !=null ">
AND compile_id = #{compileId,jdbcType=INTEGER}
</if>
and function_id=#{functionId,jdbcType=INTEGER}
</trim>
</update>
<update id="auditCfg" parameterType="com.nis.domain.configuration.BaseCfg">
update ${tableName} set is_audit = #{isAudit,jdbcType=INTEGER},
auditor_id = #{auditorId,jdbcType=INTEGER},
audit_time = #{auditTime,jdbcType=TIMESTAMP}
<if test="isValid != null" >
,is_valid = #{isValid,jdbcType=INTEGER}
</if>
<trim prefix="WHERE" prefixOverrides="AND |OR ">
<if test="cfgId !=null ">
AND cfg_id = #{cfgId,jdbcType=BIGINT}
</if>
<if test="compileId !=null ">
AND compile_id = #{compileId,jdbcType=INTEGER}
</if>
and function_id=#{functionId,jdbcType=INTEGER}
</trim>
</update>
</mapper>

View File

@@ -0,0 +1,315 @@
package com.nis.web.service.configuration;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.nis.domain.Page;
import com.nis.domain.configuration.AreaIpCfg;
import com.nis.domain.configuration.BaseStringCfg;
import com.nis.domain.configuration.CfgIndexInfo;
import com.nis.domain.configuration.ComplexkeywordCfg;
import com.nis.domain.configuration.DnsDomainCfg;
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.configuration.SslKeywordCfg;
import com.nis.domain.maat.MaatCfg;
import com.nis.domain.maat.MaatCfg.NumBoundaryCfg;
import com.nis.domain.maat.ToMaatBean;
import com.nis.domain.maat.ToMaatResult;
import com.nis.domain.maat.MaatCfg.DigestCfg;
import com.nis.domain.maat.MaatCfg.GroupCfg;
import com.nis.domain.maat.MaatCfg.IpCfg;
import com.nis.domain.maat.MaatCfg.StringCfg;
import com.nis.exceptions.MaatConvertException;
import com.nis.util.ConfigServiceUtil;
import com.nis.util.Constants;
import com.nis.util.StringUtil;
import com.nis.web.dao.configuration.AreaIpCfgDao;
import com.nis.web.dao.configuration.BgpCfgDao;
import com.nis.web.security.UserUtils;
import com.nis.web.service.CrudService;
/**
* BGP相关配置事务类
* @author dell
*
*/
@Service
public class BgpCfgService extends CrudService<BgpCfgDao,CfgIndexInfo> {
@Autowired
protected BgpCfgDao bgpCfgDao;
@Autowired
protected AreaIpCfgDao areaIpCfgDao;
public CfgIndexInfo getBgpCfg(Long cfgId){
CfgIndexInfo entity = bgpCfgDao.getCfgIndexInfo(cfgId);
List<IpPortCfg> ipPortList = bgpCfgDao.getIpPortList(entity);
//List<HttpUrlCfg> httpUrlList = bgpCfgDao.getHttpUrlList(entity);
entity.setIpPortList(ipPortList);
//entity.setHttpReqBodyList(httpUrlList);
return entity;
}
public Page<CfgIndexInfo> getBgpList(Page<CfgIndexInfo> page, CfgIndexInfo entity){
// 生成数据权限过滤条件dsf为dataScopeFilter的简写在xml中使用 ${sqlMap.dsf}调用权限SQL
entity.getSqlMap().put("dsf", configScopeFilter(entity.getCurrentUser(),"a"));
entity.setPage(page);
List<CfgIndexInfo> list = bgpCfgDao.getBgpList(entity);
page.setList(list);
return page;
}
/**
* 保存配置
* @param entity
*/
public void saveBgpCfg(CfgIndexInfo entity){
//设置区域运营商信息
setAreaEffectiveIds(entity);
if(entity.getCfgId()==null){
Integer compileId = 0;
try {
List<Integer> idList = ConfigServiceUtil.getId(1, 1);
if(idList!=null && idList.size()>0){
compileId = idList.get(0);
}
entity.setCompileId(compileId);
entity.setCreateTime(new Date());
entity.setCreatorId(entity.getCurrentUser().getId());
bgpCfgDao.saveCfgIndex(entity);
if(entity.getIpPortList()!=null){
for(IpPortCfg cfg:entity.getIpPortList()){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
bgpCfgDao.saveIpPortCfg(cfg);
}
}
/**TODO
* if(entity.getDomainList()!=null){
for(ComplexkeywordCfg cfg:entity.getDomainList()){
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
if(StringUtils.isNoneBlank(cfg.getDistrictShowName()) && cfg.getDistrict().equals("others")){
cfg.setDistrict(cfg.getDistrictShowName());
}
bgpCfgDao.saveDnsDomainCfg(cfg);
}
}
}*/
//保存区域IP信息
if(entity.getAreaCfg()!=null){
for(AreaIpCfg cfg:entity.getAreaCfg()){
cfg.initDefaultValue();
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
} catch (Exception e) {
e.printStackTrace();
logger.info("获取编译ID出错");
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
}
}else{
bgpCfgDao.updateCfgIndex(entity);
//无效子配置后,再新增子配置
bgpCfgDao.deleteIpCfg(entity);
//TODO
//bgpCfgDao.deleteDnsDomainCfg(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());
if(entity.getIpPortList()!=null){
for(IpPortCfg cfg:entity.getIpPortList()){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
bgpCfgDao.saveIpPortCfg(cfg);
}
}
/**TODO
* if(entity.getDomainList()!=null){
for(ComplexkeywordCfg cfg:entity.getDomainList()){
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
if(StringUtils.isNoneBlank(cfg.getDistrictShowName()) && cfg.getDistrict().equals("others")){
cfg.setDistrict(cfg.getDistrictShowName());
}
bgpCfgDao.saveDnsDomainCfg(cfg);
}
}
}*/
//保存区域IP信息
if(entity.getAreaCfg()!=null){
for(AreaIpCfg cfg:entity.getAreaCfg()){
cfg.initDefaultValue();
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgDesc","cfgRegionCode","cfgType"});
areaIpCfgDao.saveAreaIpCfg(cfg);
}
}
}
}
/**
* 配置删除
* @param isValid
* @param ids
* @param functionId
*/
public void updateBgpCfgValid(Integer isValid,String ids,Integer functionId){
CfgIndexInfo entity = new CfgIndexInfo();
String[] idArray = ids.split(",");
for(String id :idArray){
entity.setCfgId(Long.parseLong(id));
entity.setIsValid(isValid);
entity.setEditorId(UserUtils.getUser().getId());
entity.setEditTime(new Date());
entity.setTableName(CfgIndexInfo.getTablename());
entity.setFunctionId(functionId);
bgpCfgDao.updateCfgValid(entity);
//查询子配置
entity = this.getBgpCfg(Long.parseLong(id));
if(entity.getIpPortList()!=null && entity.getIpPortList().size()>0){
IpPortCfg cfg = new IpPortCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(IpPortCfg.getTablename());
bgpCfgDao.updateCfgValid(cfg);
}
/*TODO
* if(entity.getDomainList()!=null && entity.getDomainList().size()>0)
{
SslKeywordCfg cfg = new SslKeywordCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(DnsDomainCfg.getTablename());
bgpCfgDao.updateCfgValid(cfg);
}*/
//保存区域IP信息
if(entity.getAreaCfg()!=null && entity.getAreaCfg().size()>0){
AreaIpCfg cfg = new AreaIpCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(AreaIpCfg.getTablename());
bgpCfgDao.updateCfgValid(cfg);
}
}
}
/**
* 配置审核
* @param entity
* @param isAudit
* @throws MaatConvertException
*/
public void auditBgpCfg(CfgIndexInfo entity,Integer isAudit) throws MaatConvertException{
//修改数据库审核状态信息
entity.setTableName(CfgIndexInfo.getTablename());
bgpCfgDao.auditCfg(entity);
ToMaatBean maatBean = new ToMaatBean();
MaatCfg maatCfg = new MaatCfg();
List<MaatCfg> configCompileList = new ArrayList();
List<GroupCfg> groupRelationList = new ArrayList();
List<IpCfg> ipRegionList = new ArrayList();
List<StringCfg> strRegionList = new ArrayList();
List<NumBoundaryCfg> numRegionList = new ArrayList();
List<DigestCfg> digestRegionList = new ArrayList();
List<IpCfg> areaIpRegionList = new ArrayList();
//查询子配置并修改审核状态
entity = this.getBgpCfg(entity.getCfgId());
if(entity.getIpPortList()!=null && entity.getIpPortList().size()>0){
IpPortCfg cfg = new IpPortCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(IpPortCfg.getTablename());
bgpCfgDao.auditCfg(cfg);
if(isAudit==1){
Map<String,List> map = cfgConvert(ipRegionList,entity.getIpPortList(),1,entity,groupRelationList);
groupRelationList=map.get("groupList");
ipRegionList=map.get("dstList");
if(map.get("numRegionList")!=null){
numRegionList.addAll(map.get("numRegionList"));
}
}
}
/*TODO
* if(entity.getDomainList()!=null && entity.getDomainList().size()>0){
DnsDomainCfg cfg = new DnsDomainCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(DnsDomainCfg.getTablename());
bgpCfgDao.auditCfg(cfg);
if(isAudit==1){
Map<String,List> map = cfgConvert(strRegionList,entity.getDomainList(),2,entity,groupRelationList);
groupRelationList=map.get("groupList");
strRegionList=map.get("dstList");
}
}*/
//保存区域IP信息
List<AreaIpCfg> areaIpCfgList=areaIpCfgDao.getByCompileId(entity.getCompileId());
if(!StringUtil.isEmpty(areaIpCfgList)){
AreaIpCfg cfg = new AreaIpCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(AreaIpCfg.getTablename());
bgpCfgDao.auditCfg(cfg);
if(isAudit==1){
Map<String,List> map = cfgConvert(areaIpRegionList,areaIpCfgList,1,entity,groupRelationList);
groupRelationList=map.get("groupList");
areaIpRegionList=map.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());
maatCfg.setUserRegion(entity.getCompileId()+"");
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("BGP配置下发配置参数"+json);
//调用服务接口下发配置
//ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
//logger.info("BGP配置下发响应信息"+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("BGP配置下发配置参数"+json);
//调用服务接口下发配置
//ToMaatResult result = ConfigServiceUtil.put(json,1);
//logger.info("BGP配置取消配置响应信息"+result.getMsg());
}
}
}

View File

@@ -820,7 +820,6 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
cfg.setTableName(IpPortCfg.getTablename()); cfg.setTableName(IpPortCfg.getTablename());
websiteCfgDao.auditCfg(cfg); websiteCfgDao.auditCfg(cfg);
if(isAudit==1){ if(isAudit==1){
entity.setAreaEffectiveIds("0");
Map<String,List> map = cfgConvert(ipRegionList,entity.getIpPortList(),1,entity,groupRelationList); Map<String,List> map = cfgConvert(ipRegionList,entity.getIpPortList(),1,entity,groupRelationList);
groupRelationList=map.get("groupList"); groupRelationList=map.get("groupList");
ipRegionList=map.get("dstList"); ipRegionList=map.get("dstList");

View File

@@ -255,6 +255,8 @@ jdbc.hive.AName=xa_dfbhit_hive
jdbc.hive.BName=xa_z2_mesalog_hive jdbc.hive.BName=xa_z2_mesalog_hive
maxPageSize=100000 maxPageSize=100000
#导出最大条数
maxExportSize=100000
#\u5141\u8bb8\u914d\u7f6e\u6700\u5927\u5c42\u7ea7 #\u5141\u8bb8\u914d\u7f6e\u6700\u5927\u5c42\u7ea7
maxLevelNo=4 maxLevelNo=4
#\u4e0a\u4e0b\u7ea7\u663e\u793a\u95f4\u9694\u6807\u8bc6\u7b26 #\u4e0a\u4e0b\u7ea7\u663e\u793a\u95f4\u9694\u6807\u8bc6\u7b26
@@ -277,6 +279,7 @@ ssl_sni_region=ssl_sni
ssl_san_region=ssl_san ssl_san_region=ssl_san
ssl_ca_region=ssl_ca ssl_ca_region=ssl_ca
ssl_ip_region=ssl_ip ssl_ip_region=ssl_ip
bgp_ip_region=bgp_ip
#存在与表达式的关键字特殊分隔符 #存在与表达式的关键字特殊分隔符
keyword_expr=***and*** keyword_expr=***and***
#时区 #时区

View File

@@ -24,8 +24,7 @@
<mapping path="/nis/ntc/mail/ajax*" exclue="true"/> <mapping path="/nis/ntc/mail/ajax*" exclue="true"/>
<mapping path="/nis/ntc/fileTransfer/ajax*" exclue="true"/> <mapping path="/nis/ntc/fileTransfer/ajax*" exclue="true"/>
<mapping path="/nis/ntc/app/ajax*" exclue="true"/> <mapping path="/nis/ntc/app/ajax*" exclue="true"/>
<mapping path="/nis/ntc/xmpp/ajax*" exclue="true"/> <mapping path="/nis/ntc/other/ajax*" exclue="true"/>
<mapping path="/nis/ntc/bgp/ajax*" exclue="true"/>
<!-- 对同一路径,启用多个装饰器 --> <!-- 对同一路径,启用多个装饰器 -->
<mapping> <mapping>
<path>/articles/*</path> <path>/articles/*</path>

View File

@@ -3,6 +3,7 @@
<%@ attribute name="id" type="java.lang.String" required="true"%> <%@ attribute name="id" type="java.lang.String" required="true"%>
<%@ attribute name="url" type="java.lang.String" required="true"%> <%@ attribute name="url" type="java.lang.String" required="true"%>
<%@ attribute name="label" type="java.lang.String" required="false"%> <%@ attribute name="label" type="java.lang.String" required="false"%>
<%@ attribute name="maxRow" type="java.lang.Long" required="false"%>
<c:choose> <c:choose>
<c:when test="${label eq 'delete'}"> <c:when test="${label eq 'delete'}">
<a href="javascript:void(0);" class="btn btn-default" onclick="del('${url}')" data-toggle="tooltip" data-placement="top"> <a href="javascript:void(0);" class="btn btn-default" onclick="del('${url}')" data-toggle="tooltip" data-placement="top">
@@ -20,8 +21,10 @@
<c:when test="${label eq 'unapproved'}"> <c:when test="${label eq 'unapproved'}">
<a href="javascript:void(0);" onclick="noPassOpt('${url}')"><i class="fa fa-remove"></i> <spring:message code="unapproved"/></a> <a href="javascript:void(0);" onclick="noPassOpt('${url}')"><i class="fa fa-remove"></i> <spring:message code="unapproved"/></a>
</c:when> </c:when>
<c:when test="${label eq 'cancelPass'}"> <c:when test="${label eq 'export'}">
<a href="javascript:void(0);" onclick="cancelPassOpt('${url}')"><i class="fa fa-undo"></i> <spring:message code="cancel_approved"/></a> <a href="javascript:void(0);" class="btn btn-default" onclick="exportData('${url}',${maxRow })" data-toggle="tooltip" data-placement="top">
<i class="fa fa-download"> <spring:message code="export"/></i>
</a>
</c:when> </c:when>
</c:choose> </c:choose>
<%-- 使用方法: 1.将本tag写在查询的form之前2.传入table的id和controller的url --%> <%-- 使用方法: 1.将本tag写在查询的form之前2.传入table的id和controller的url --%>
@@ -190,4 +193,26 @@ var checkboxes=$("#${id} ${value} tbody tr td input.i-checks:checkbox");
}); });
return flag; return flag;
} }
//删除
function exportData(url,maxRow){
var checkboxes=$("#${id} ${value} tbody tr td input.i-checks:checkbox");
//导出选中数据
if($(checkboxes).filter(":checked").length>0){
doAll(checkboxes,url);
//导出检索条件下所有数据
}else{
if($("#showTotalCount").html().trim() > maxRow){
top.$.jBox.confirm("<spring:message code='export_confirm_message'/>"+maxRow+"!","<spring:message code='info'/>",function(v,h,f){
if(v=="ok"){
$("#searchForm").attr("action",url);
$("#searchForm").submit();
}
},{buttonsFocus:1});
top.$('.jbox-body .jbox-icon').css('top','55px');
}else{
$("#searchForm").attr("action",url);
$("#searchForm").submit();
}
}
}
</script> </script>

View File

@@ -0,0 +1,269 @@
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/include/taglib.jsp"%>
<html>
<head>
<title><spring:message code="${cfgName}"></spring:message></title>
<style type="text/css">
.boxSolid {
border: 1px solid #eeeeee
}
</style>
<script type="text/javascript">
$(document)
.ready(
function() {
$("#cancel").on("click", function() {
window.history.back();
});
$(".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);
},
submitHandler : function(form) {
//loading('onloading...');
var flag = true;
//代表所有业务都隐藏了,提示必须增加一种业务数据
if($(".boxSolid").length ==$(".boxSolid.hidden").length){
top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>");
return;
}
//代表所有区域都隐藏了,提示必须增加个区域信息
if($("input[name='isAreaEffective']:checked").val()==1 && $(".container-fluid:visible").size()==0){
if($("#areaIsp").hasClass("hidden")) $("#areaIp").find(".glyphicon-plus").click();
if($("#areaIp").hasClass("hidden")) $("#areaIsp").find(".glyphicon-plus").click();
top.$.jBox.tip("<spring:message code='one_more_area'/>", "<spring:message code='info'/>");
return;
}
$(".boxSolid:visible").find("input[name$='cfgKeywords']").each(function(){
if($(this).val()==''){
$(this).parents(".form-group").find(
"div[for='"
+ $(this).attr("name")
+ "']").html("<label id=\"cfgKeywordsError\" class=\"error\">"+$("#keywordError").text()+"</label>");
flag = false;
return;
}
})
if(flag){
//将disable属性的元素删除
$(".disabled").each(function(){
$(this).remove();
});
$("input[name$='exprType']").attr("disabled",false);
form.submit();
}
},
errorContainer : "#messageBox",
});
//业务内容增加
/* $("span[title='add']").on("click", function() {
$(".ipPort0").removeClass("hidden");
}); */
});
//业务窗口打开
var addContent = function(obj, contentClassName) {
var showDiv = $(obj).parent().parent().next();
$(showDiv).removeClass("hidden").removeClass(
"disabled");
/* $("."+contentClassName+"0").find("input,select").each(function(){
$(this).removeAttr("disabled");
}); */
$(obj).addClass("hidden");
}
//业务窗口关闭
var delContent = function(contentClassName, addBtnClassName) {
$("." + contentClassName).addClass("hidden").addClass("disabled");
/* $("."+contentClassName).find("input,select").each(function(){
$(this).attr("disabled","true");
}); */
$("." + addBtnClassName).removeClass("hidden");
}
</script>
</head>
<body>
<span id="keywordError" style="display:none"><spring:message code="required"></spring:message></span>
<span id="tagsinputTip" style="display:none"><spring:message code="multiple_keywords_tip"></spring:message></span>
<div class="page-content">
<div class="row">
<div class="col-md-12">
<div class="portlet box blue">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>
<c:if test="${empty _cfg.cfgId}">
<spring:message code="add"></spring:message>
</c:if>
<c:if test="${not empty _cfg.cfgId}">
<spring:message code="edit"></spring:message>
</c:if>
</div>
</div>
<div class="portlet-body form">
<!-- BEGIN FORM-->
<form id="cfgFrom" action="${ctx}/ntc/other/saveBgpCfg"
method="post" class="form-horizontal">
<input type="hidden" name="cfgId" value="${_cfg.cfgId}">
<input type="hidden" name="compileId" value="${_cfg.compileId}">
<input type="hidden" name="functionId" value="${_cfg.functionId}">
<input type="hidden" id="serviceId" name="serviceId"
value="${_cfg.serviceId}">
<div class="form-body">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><spring:message
code="config_describe" /></label>
<div class="col-md-6">
<input class="form-control" type="text" name="cfgDesc"
value="${_cfg.cfgDesc}">
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><spring:message
code="action" /></label>
<div class="col-md-6">
<c:forEach items="${serviceList}" var="service"
varStatus="satus">
<label class="radio-inline"> <c:if
test="${_cfg.functionId eq service.functionId}">
<input type="radio" name="action"
serviceId="${service.serviceId }"
protocolId="${service.protocolId }"
value="${service.action }" class="required action"
<c:if test="${_cfg.action==service.action || _cfg.action==null}">checked</c:if>>
<spring:message code="${service.actionCode }" />
</c:if>
</label>
</c:forEach>
</div>
<div for="action"></div>
</div>
</div>
</div>
<c:set var="ipCfgIndex" value="0"></c:set>
<c:set var="complexCfgIndex" value="0"></c:set>
<c:forEach items="${regionList}" var="region" varStatus="status">
<c:if test="${region.regionType eq 1 }">
<!--ip info-->
<c:set var="tabName" value="${region.configRegionValue}Tab"></c:set>
<h4 class="form-section">
<spring:message code="${region.configRegionValue}" />
<small> <span
class="glyphicon glyphicon-plus ${tabName}Add"
onClick="addContent(this,'${tabName}')" title="add"></span></small>
</h4>
<c:set var="cfgName" value="ipPortList[${ipCfgIndex}]"></c:set>
<%-- <c:set var="regionValue" value="${region.configRegionValue}"></c:set> --%>
<c:choose>
<c:when test="${fn:length(_cfg.ipPortList)>0 and ipCfgIndex<fn:length(_cfg.ipPortList) }">
<c:forEach items="${_cfg.ipPortList}" var="ipPort">
<c:if test="${region.configRegionValue eq ipPort.cfgType }">
<div class="row boxSolid ${tabName}${status.index}">
<%@include file="/WEB-INF/views/cfg/ipCfgForm.jsp"%>
</div>
<c:set var="ipCfgIndex" value="${ipCfgIndex+1}"></c:set>
</c:if>
</c:forEach>
</c:when>
<c:otherwise>
<div class="row boxSolid ${tabName}${status.index} hidden disabled">
<%@include file="/WEB-INF/views/cfg/ipCfgForm.jsp"%>
</div>
<c:set var="ipCfgIndex" value="${ipCfgIndex+1 }"></c:set>
</c:otherwise>
</c:choose>
<!--/ip info-->
</c:if>
<c:if test="${region.regionType eq 3 }">
<c:set var="tabName" value="${region.configRegionValue}Tab"></c:set>
<h4 class="form-section">
<spring:message code="${region.configRegionValue}" />
<small> <span
class="glyphicon glyphicon-plus ${tabName}Add"
onClick="addContent(this,'${tabName}')" title="add"></span></small>
</h4>
<c:set var="cfgName" value="domainList[${complexCfgIndex}]"></c:set>
<%-- <c:set var="regionValue" value="${region.configRegionValue}"></c:set> --%>
<c:choose>
<c:when test="${fn:length(_cfg.domainList)>0}">
<c:set var="isBreak" value="false" ></c:set>
<c:forEach items="${_cfg.domainList}" var="complexCfg">
<c:choose>
<c:when test="${region.configRegionValue eq complexCfg.cfgType and !isBreak}">
<div class="row boxSolid ${tabName}${status.index}">
<%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%>
</div>
<c:set var="isBreak" value="true" ></c:set>
<c:set var="complexCfgIndex" value="${complexCfgIndex+1 }"></c:set>
</c:when>
</c:choose>
</c:forEach>
<c:if test="${!isBreak}">
<div class="row boxSolid ${tabName}${status.index} hidden disabled">
<%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%>
</div>
<c:set var="complexCfgIndex" value="${complexCfgIndex+1 }"></c:set>
</c:if>
</c:when>
<c:otherwise>
<div class="row boxSolid ${tabName}${status.index} hidden disabled">
<%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%>
</div>
<c:set var="complexCfgIndex" value="${complexCfgIndex+1 }"></c:set>
</c:otherwise>
</c:choose>
</c:if>
</c:forEach>
<br>
<%@include file="/WEB-INF/include/form/areaInfo.jsp"%>
<br>
<%@include file="/WEB-INF/include/form/basicInfo.jsp"%>
<div class="form-actions">
<div class="row">
<div class="col-md-6">
<div class="row">
<div class="col-md-offset-3 col-md-8">
<button id="save" type="submit" class="btn green">
<spring:message code="submit" />
</button>
<button id="cancel" type="button" class="btn default">
<spring:message code="cancel" />
</button>
</div>
</div>
</div>
<div class="col-md-6"></div>
</div>
</div>
</div>
</form>
<!-- END FORM-->
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@@ -46,7 +46,7 @@
$.ajax({ $.ajax({
type:'post', type:'post',
async:false, async:false,
url:'${ctx}/ntc/website/ajaxHttpSubList', url:'${ctx}/ntc/other/ajaxBgpSubList',
data:{"cfgId":cfgId,"index":index}, data:{"cfgId":cfgId,"index":index},
dataType:"html", dataType:"html",
success:function(data){ success:function(data){
@@ -85,16 +85,16 @@
<div class="page-content"> <div class="page-content">
<div class="theme-panel hidden-xs hidden-sm"> <div class="theme-panel hidden-xs hidden-sm">
<shiro:hasPermission name="website:http:config"> <shiro:hasPermission name="other:bgp:config">
<button type="button" class="btn btn-primary" <button type="button" class="btn btn-primary"
onClick="javascript:window.location='${ctx}/ntc/website/httpForm?functionId=${cfg.functionId}'"> onClick="javascript:window.location='${ctx}/ntc/other/bgpForm?functionId=${cfg.functionId}'">
<i class="fa fa-plus"></i> <i class="fa fa-plus"></i>
<spring:message code="add"></spring:message></button> <spring:message code="add"></spring:message></button>
</shiro:hasPermission> </shiro:hasPermission>
</div> </div>
<h3 class="page-title"> <h3 class="page-title">
<spring:message code="http_control"></spring:message> <spring:message code="bgp_control"></spring:message>
<small><spring:message code="date_list"/></small> <small><spring:message code="date_list"/></small>
</h3> </h3>
<h5 class="page-header"></h5> <h5 class="page-header"></h5>
@@ -103,7 +103,7 @@
<div class="portlet-body"> <div class="portlet-body">
<div class="row" > <div class="row" >
<sys:message content="${message}"/> <sys:message content="${message}"/>
<form:form id="searchForm" modelAttribute="cfg" action="${ctx}/ntc/website/httpList?functionId=${cfg.functionId}" method="post" class="form-search"> <form:form id="searchForm" modelAttribute="cfg" action="${ctx}/ntc/other/bgpList?functionId=${cfg.functionId}" method="post" class="form-search">
<input id="functionId" name="functionId" type="hidden" value="${cfg.functionId}"/> <input id="functionId" name="functionId" type="hidden" value="${cfg.functionId}"/>
<input id="audit" name="audit" type="hidden" value="${audit}"/> <input id="audit" name="audit" type="hidden" value="${audit}"/>
<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/> <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
@@ -150,20 +150,20 @@
<button type="button" class="btn btn-default" id="filter-btn"> <spring:message code="filter"/> <i class="fa fa-angle-double-down"></i></button> <button type="button" class="btn btn-default" id="filter-btn"> <spring:message code="filter"/> <i class="fa fa-angle-double-down"></i></button>
</div> </div>
<div class="pull-right"> <div class="pull-right">
<shiro:hasPermission name="website:http:config"> <shiro:hasPermission name="other:bgp:config">
<sys:delRow url="${ctx}/ntc/website/httpForm" id="contentTable" label="update"></sys:delRow> <sys:delRow url="${ctx}/ntc/other/bgpForm" id="contentTable" label="update"></sys:delRow>
<sys:delRow url="${ctx}/ntc/website/updateHttpCfgValid?isValid=-1&functionId=${cfg.functionId }" id="contentTable" label="delete"></sys:delRow> <sys:delRow url="${ctx}/ntc/other/updateBgpCfgValid?isValid=-1&functionId=${cfg.functionId }" id="contentTable" label="delete"></sys:delRow>
</shiro:hasPermission> </shiro:hasPermission>
<shiro:hasPermission name="website:http:audit"> <shiro:hasPermission name="other:bgp:audit">
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-wrench"></i> <spring:message code="examine"></spring:message> <i class="fa fa-wrench"></i> <spring:message code="examine"></spring:message>
<i class="fa fa-angle-down"></i> <i class="fa fa-angle-down"></i>
</button> </button>
<ul class="dropdown-menu pull-right"> <ul class="dropdown-menu pull-right">
<li><sys:delRow url="${ctx}/ntc/website/auditHttpCfg?isAudit=1&isValid=1&functionId=${cfg.functionId }" id="contentTable" label="approved"></sys:delRow></li> <li><sys:delRow url="${ctx}/ntc/other/auditBgpCfg?isAudit=1&isValid=1&functionId=${cfg.functionId }" id="contentTable" label="approved"></sys:delRow></li>
<li><sys:delRow url="${ctx}/ntc/website/auditHttpCfg?isAudit=2&isValid=0&functionId=${cfg.functionId }" id="contentTable" label="unapproved"></sys:delRow></li> <li><sys:delRow url="${ctx}/ntc/other/auditBgpCfg?isAudit=2&isValid=0&functionId=${cfg.functionId }" id="contentTable" label="unapproved"></sys:delRow></li>
<li><sys:delRow url="${ctx}/ntc/website/auditHttpCfg?isAudit=3&isValid=0&functionId=${cfg.functionId }" id="contentTable" label="cancelPass"></sys:delRow></li> <li><sys:delRow url="${ctx}/ntc/other/auditBgpCfg?isAudit=3&isValid=0&functionId=${cfg.functionId }" id="contentTable" label="cancelPass"></sys:delRow></li>
</ul> </ul>
</div> </div>
</shiro:hasPermission> </shiro:hasPermission>