voip界面去掉无用的检索条件
摘要文件类型增加音视频文件类 ip和http增加配置导出
This commit is contained in:
@@ -36,19 +36,20 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
|
||||
protected String showName;//表在界面上展示的名称
|
||||
protected String seltype;//选中类型,页面搜索用
|
||||
protected String tableName;
|
||||
@ExcelField(title="userregion1")
|
||||
@ExcelField(title="userregion1",sort=1001)
|
||||
protected String userRegion1;
|
||||
@ExcelField(title="userregion2")
|
||||
@ExcelField(title="userregion2",sort=1002)
|
||||
protected String userRegion2;
|
||||
@ExcelField(title="userregion3")
|
||||
@ExcelField(title="userregion3",sort=1003)
|
||||
protected String userRegion3;
|
||||
@ExcelField(title="userregion4")
|
||||
@ExcelField(title="userregion4",sort=1004)
|
||||
protected String userRegion4;
|
||||
@ExcelField(title="userregion5")
|
||||
@ExcelField(title="userregion5",sort=1005)
|
||||
protected String userRegion5;
|
||||
/**
|
||||
* 编译id
|
||||
*/
|
||||
@ExcelField(title="cfg_id",sort=0)
|
||||
protected Integer compileId ;
|
||||
/**
|
||||
* @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么)
|
||||
@@ -64,25 +65,25 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
|
||||
/**
|
||||
* 配置描述
|
||||
*/
|
||||
@ExcelField(title="config_describe")
|
||||
@ExcelField(title="config_describe",sort=1)
|
||||
protected String cfgDesc;
|
||||
|
||||
/**
|
||||
* GK类型
|
||||
*/
|
||||
@Expose
|
||||
@ExcelField(title="action",dictType="SERVICE_ACTION")
|
||||
@ExcelField(title="action",dictType="SERVICE_ACTION",sort=2)
|
||||
protected Integer action;
|
||||
/**
|
||||
* 有效标识
|
||||
*/
|
||||
@ExcelField(title="valid_identifier",dictType="VALID_IDENTIFIER")
|
||||
@ExcelField(title="valid_identifier",dictType="VALID_IDENTIFIER",sort=9)
|
||||
@Expose
|
||||
protected Integer isValid;
|
||||
/**
|
||||
* 是否审核
|
||||
*/
|
||||
@ExcelField(title="is_audit",dictType="AUDIT_STATUS")
|
||||
@ExcelField(title="is_audit",dictType="AUDIT_STATUS",sort=10)
|
||||
protected Integer isAudit;
|
||||
/**
|
||||
* 创建人员
|
||||
@@ -91,12 +92,12 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
|
||||
/**
|
||||
* 创建人员
|
||||
*/
|
||||
@ExcelField(title="creator")
|
||||
@ExcelField(title="creator",sort=11)
|
||||
protected String creatorName;
|
||||
/**
|
||||
* 配置时间
|
||||
*/
|
||||
@ExcelField(title="config_time")
|
||||
@ExcelField(title="config_time",sort=12)
|
||||
protected Date createTime;
|
||||
/**
|
||||
* 修改人员
|
||||
@@ -105,12 +106,12 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
|
||||
/**
|
||||
* 创建人员
|
||||
*/
|
||||
@ExcelField(title="editor")
|
||||
@ExcelField(title="editor",sort=13)
|
||||
protected String editorName;
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@ExcelField(title="edit_time")
|
||||
@ExcelField(title="edit_time",sort=14)
|
||||
protected Date editTime;
|
||||
/**
|
||||
* 审核人员
|
||||
@@ -119,13 +120,13 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
|
||||
/**
|
||||
* 审核人员
|
||||
*/
|
||||
@ExcelField(title="auditor")
|
||||
@ExcelField(title="auditor",sort=15)
|
||||
protected String auditorName;
|
||||
/**
|
||||
* 审核时间
|
||||
*/
|
||||
@Expose
|
||||
@ExcelField(title="audit_time")
|
||||
@ExcelField(title="audit_time",sort=16)
|
||||
@SerializedName("opTime")
|
||||
protected Date auditTime;
|
||||
/**
|
||||
@@ -141,27 +142,27 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
|
||||
/**
|
||||
* 来函
|
||||
*/
|
||||
@ExcelField(title="letter")
|
||||
@ExcelField(title="letter",sort=5)
|
||||
protected String requestName;
|
||||
/**
|
||||
* 是否区域gk
|
||||
*/
|
||||
@ExcelField(title="whether_area_block",dictType="WHETHER_AREA_BLOCK")
|
||||
@ExcelField(title="whether_area_block",dictType="WHETHER_AREA_BLOCK",sort=4)
|
||||
protected Integer isAreaEffective;
|
||||
/**
|
||||
* 分类
|
||||
*/
|
||||
@ExcelField(title="classification",dictType="type")
|
||||
@ExcelField(title="classification",dictType="type",sort=6)
|
||||
protected String classify;
|
||||
/**
|
||||
* 性质
|
||||
*/
|
||||
@ExcelField(title="attribute",dictType="attribute")
|
||||
@ExcelField(title="attribute",dictType="attribute",sort=7)
|
||||
protected String attribute;
|
||||
/**
|
||||
* 标签
|
||||
*/
|
||||
@ExcelField(title="label",dictType="label")
|
||||
@ExcelField(title="label",dictType="label",sort=8)
|
||||
protected String lable;
|
||||
/**
|
||||
* 分类
|
||||
@@ -212,6 +213,7 @@ public class BaseCfg<T> extends BaseEntity<T> implements Cloneable{
|
||||
/**
|
||||
* do_log属性在界面(do_log:0不需要1记录所有日志2只记录结构化日志。默认是2)
|
||||
*/
|
||||
@ExcelField(title="do_log",dictType="DO_LOG",sort=3)
|
||||
protected Integer doLog = Constants.MAAT_CFG_DOLOG_DEFAULT;
|
||||
|
||||
|
||||
|
||||
@@ -42,24 +42,24 @@ public class BaseIpCfg extends BaseCfg<BaseIpCfg> {
|
||||
*/
|
||||
@Expose
|
||||
@SerializedName("ipType")
|
||||
@ExcelField(title="ip_type",dictType="IP_TYPE")
|
||||
@ExcelField(title="ip_type",dictType="IP_TYPE",sort=101)
|
||||
protected Integer ipType;
|
||||
@ExcelField(title="ip_pattern",dictType="IP_PATTERN")
|
||||
@ExcelField(title="ip_pattern",dictType="IP_PATTERN",sort=102)
|
||||
protected Integer ipPattern;
|
||||
@ExcelField(title="client_ip")
|
||||
@ExcelField(title="client_ip",sort=103)
|
||||
protected String srcIpAddress;
|
||||
@ExcelField(title="server_ip")
|
||||
@ExcelField(title="server_ip",sort=104)
|
||||
protected String destIpAddress;
|
||||
@ExcelField(title="port_pattern",dictType="PORT_PATTERN")
|
||||
@ExcelField(title="port_pattern",dictType="PORT_PATTERN",sort=105)
|
||||
protected Integer portPattern;
|
||||
@ExcelField(title="client_port")
|
||||
@ExcelField(title="client_port",sort=106)
|
||||
protected String srcPort;
|
||||
@ExcelField(title="server_port")
|
||||
@ExcelField(title="server_port",sort=107)
|
||||
protected String destPort;
|
||||
protected Integer dnsStrategyId;
|
||||
@ExcelField(title="ir_type",dictType="IR_TYPE")
|
||||
@ExcelField(title="ir_type",dictType="IR_TYPE",sort=108)
|
||||
protected Integer irType;
|
||||
@ExcelField(title="group_name")
|
||||
@ExcelField(title="group_name",sort=109)
|
||||
protected String groupName;
|
||||
|
||||
private List<NtcSubscribeIdCfg> ntcSubscribeIdCfgList;
|
||||
@@ -97,12 +97,14 @@ public class BaseIpCfg extends BaseCfg<BaseIpCfg> {
|
||||
*/
|
||||
@Expose
|
||||
@SerializedName("direction")
|
||||
@ExcelField(title="direction",dictType="DIRECTION",sort=110)
|
||||
protected Integer direction ;
|
||||
/**
|
||||
* 方向
|
||||
*/
|
||||
@Expose
|
||||
@SerializedName("protocol")
|
||||
@ExcelField(title="protocol",dictType="PROTOCOL",sort=111)
|
||||
protected Integer protocol ;
|
||||
/**
|
||||
* 协议ID
|
||||
|
||||
@@ -35,7 +35,7 @@ public class BaseStringCfg<T> extends BaseCfg<T> {
|
||||
*/
|
||||
@Expose
|
||||
@SerializedName("keywords")
|
||||
@ExcelField(title="key_word")
|
||||
@ExcelField(title="key_word",sort=201)
|
||||
protected String cfgKeywords;
|
||||
protected String cfgKeywordsShowName;
|
||||
|
||||
@@ -49,21 +49,30 @@ public class BaseStringCfg<T> extends BaseCfg<T> {
|
||||
* 表达式类型
|
||||
*/
|
||||
@Expose
|
||||
@ExcelField(title="expression_type")
|
||||
@ExcelField(title="expression_type",dictType="EXPRESSION_TYPE",sort=202)
|
||||
@SerializedName("exprType")
|
||||
protected Integer exprType ;
|
||||
/**
|
||||
* 匹配方式
|
||||
*/
|
||||
@Expose
|
||||
@ExcelField(title="match_method")
|
||||
@ExcelField(title="match_method",dictType="MATCH_METHOD",sort=203)
|
||||
@SerializedName("matchMethod")
|
||||
protected Integer matchMethod ;
|
||||
/**
|
||||
* 是否hex
|
||||
*/
|
||||
@ExcelField(title="is_hex",sort=204)
|
||||
protected Integer isHex;
|
||||
/**
|
||||
* 是否hex
|
||||
*/
|
||||
@ExcelField(title="is_case_insenstive",sort=205)
|
||||
protected Integer isCaseInsenstive;
|
||||
/**
|
||||
* 是否hex二进制
|
||||
*/
|
||||
@Expose
|
||||
@ExcelField(title="whether_hexbinary")
|
||||
@SerializedName("isHexbin")
|
||||
protected Integer isHexbin;
|
||||
|
||||
@@ -167,4 +176,18 @@ public class BaseStringCfg<T> extends BaseCfg<T> {
|
||||
public void setNtcSubscribeIdCfg(NtcSubscribeIdCfg ntcSubscribeIdCfg) {
|
||||
this.ntcSubscribeIdCfg = ntcSubscribeIdCfg;
|
||||
}
|
||||
public Integer getIsHex() {
|
||||
return isHex=this.isHexbin;
|
||||
}
|
||||
public void setIsHex(Integer isHex) {
|
||||
this.isHex = this.isHexbin;
|
||||
}
|
||||
public Integer getIsCaseInsenstive() {
|
||||
return isCaseInsenstive=this.isHexbin;
|
||||
}
|
||||
public void setIsCaseInsenstive(Integer isCaseInsenstive) {
|
||||
this.isCaseInsenstive =this.isHexbin;;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.apache.commons.lang3.StringEscapeUtils;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* @ClassName: BaseEnhancedStringConfig.java
|
||||
@@ -32,6 +33,7 @@ public class ComplexkeywordCfg extends BaseCfg<ComplexkeywordCfg>{
|
||||
* 匹配区域
|
||||
*/
|
||||
@Expose
|
||||
@ExcelField(title="district",sort=301)
|
||||
@SerializedName("district")
|
||||
protected String district ;
|
||||
protected String districtShowName;
|
||||
@@ -40,6 +42,7 @@ public class ComplexkeywordCfg extends BaseCfg<ComplexkeywordCfg>{
|
||||
*/
|
||||
@Expose
|
||||
@SerializedName("keywords")
|
||||
@ExcelField(title="key_word",sort=302)
|
||||
protected String cfgKeywords;
|
||||
protected String keywordsShowName;
|
||||
/**
|
||||
@@ -47,13 +50,27 @@ public class ComplexkeywordCfg extends BaseCfg<ComplexkeywordCfg>{
|
||||
*/
|
||||
@Expose
|
||||
@SerializedName("exprType")
|
||||
@ExcelField(title="expression_type",dictType="EXPRESSION_TYPE",sort=303)
|
||||
protected Integer exprType ;
|
||||
/**
|
||||
* 匹配方式
|
||||
*/
|
||||
@Expose
|
||||
@ExcelField(title="match_method",dictType="MATCH_METHOD",sort=304)
|
||||
@SerializedName("matchMethod")
|
||||
protected Integer matchMethod ;
|
||||
|
||||
/**
|
||||
* 是否hex
|
||||
*/
|
||||
@ExcelField(title="is_hex",sort=305)
|
||||
protected Integer isHex;
|
||||
/**
|
||||
* 是否hex
|
||||
*/
|
||||
@ExcelField(title="is_case_insenstive",sort=306)
|
||||
protected Integer isCaseInsenstive;
|
||||
|
||||
/**
|
||||
* 是否hex二进制
|
||||
*/
|
||||
@@ -131,6 +148,18 @@ public class ComplexkeywordCfg extends BaseCfg<ComplexkeywordCfg>{
|
||||
public void setIsHexbin(Integer isHexbin) {
|
||||
this.isHexbin = isHexbin;
|
||||
}
|
||||
public Integer getIsHex() {
|
||||
return isHex= this.isHexbin;
|
||||
}
|
||||
public void setIsHex(Integer isHex) {
|
||||
this.isHex = this.isHexbin;
|
||||
}
|
||||
public Integer getIsCaseInsenstive() {
|
||||
return isCaseInsenstive=this.isHexbin;
|
||||
}
|
||||
public void setIsCaseInsenstive(Integer isCaseInsenstive) {
|
||||
this.isCaseInsenstive =this.isHexbin;;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see com.nis.domain.configuration.BaseCfg#initDefaultValue()
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
*@Title: BaseStringConfig.java
|
||||
*@Package com.nis.domain.restful
|
||||
*@Description TODO
|
||||
*@author dell
|
||||
*@date 2018年2月5日 下午5:26:02
|
||||
*@version 版本号
|
||||
*/
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* @Description: excel导入IP类配置
|
||||
*/
|
||||
public class IpAllTemplate {
|
||||
|
||||
/**
|
||||
* @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么)
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
|
||||
|
||||
private String cfgDesc;
|
||||
private String srcIpAddress;
|
||||
private String destIpAddress;
|
||||
private String srcPort;
|
||||
private String destPort;
|
||||
private Integer protocol;
|
||||
private Integer direction;
|
||||
|
||||
@ExcelField(title="config_describe",align=2,sort=1)
|
||||
public String getCfgDesc() {
|
||||
return cfgDesc;
|
||||
}
|
||||
public void setCfgDesc(String cfgDesc) {
|
||||
this.cfgDesc = cfgDesc;
|
||||
}
|
||||
@ExcelField(title="client_ip",align=2,sort=2)
|
||||
public String getSrcIpAddress() {
|
||||
return srcIpAddress;
|
||||
}
|
||||
public void setSrcIpAddress(String srcIpAddress) {
|
||||
this.srcIpAddress = srcIpAddress;
|
||||
}
|
||||
@ExcelField(title="server_ip",align=2,sort=3)
|
||||
public String getDestIpAddress() {
|
||||
return destIpAddress;
|
||||
}
|
||||
public void setDestIpAddress(String destIpAddress) {
|
||||
this.destIpAddress = destIpAddress;
|
||||
}
|
||||
|
||||
@ExcelField(title="client_port",align=2,sort=4)
|
||||
public String getSrcPort() {
|
||||
return srcPort;
|
||||
}
|
||||
public void setSrcPort(String srcPort) {
|
||||
this.srcPort = srcPort;
|
||||
}
|
||||
@ExcelField(title="server_port",align=2,sort=5)
|
||||
public String getDestPort() {
|
||||
return destPort;
|
||||
}
|
||||
public void setDestPort(String destPort) {
|
||||
this.destPort = destPort;
|
||||
}
|
||||
|
||||
@ExcelField(title="protocol",align=2,sort=6)
|
||||
public Integer getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
public void setProtocol(Integer protocol) {
|
||||
this.protocol = protocol;
|
||||
}
|
||||
@ExcelField(title="direction",align=2,sort=7)
|
||||
public Integer getDirection() {
|
||||
return direction;
|
||||
}
|
||||
public void setDirection(Integer direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
}
|
||||
@@ -2,14 +2,19 @@ package com.nis.domain.specific;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
public class ConfigGroupInfo {
|
||||
private Integer id;
|
||||
private Integer groupId;
|
||||
@ExcelField(title="group_name",sort=302)
|
||||
private String groupName;
|
||||
private Integer isIssued;
|
||||
private Date insertTime;
|
||||
private Date updateTime;
|
||||
private Integer groupType;
|
||||
@ExcelField(title="cfg_id",sort=301)
|
||||
private Integer compileId;
|
||||
|
||||
public Integer getCompileId() {
|
||||
|
||||
@@ -26,6 +26,10 @@ public @interface ExcelField {
|
||||
* 导出字段标题(需要添加批注请用“**”分隔,标题**批注,仅对导出模板有效)
|
||||
*/
|
||||
String title();
|
||||
/**
|
||||
* 导出字段注释(仅对导出模板有效)
|
||||
*/
|
||||
String comment() default "";
|
||||
|
||||
/**
|
||||
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
|
||||
|
||||
@@ -9,14 +9,17 @@ import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -39,11 +42,16 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.SysDataDictionaryItem;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.Encodes;
|
||||
import com.nis.util.Reflections;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.sun.xml.internal.rngom.ast.builder.CommentList;
|
||||
|
||||
import sun.util.logging.resources.logging;
|
||||
|
||||
/**
|
||||
* 导出Excel文件(导出“XLSX”格式,支持大数据量导出 @see org.apache.poi.ss.SpreadsheetVersion)
|
||||
@@ -64,6 +72,11 @@ public class ExportExcel {
|
||||
*/
|
||||
private Sheet sheet;
|
||||
|
||||
/**
|
||||
* 工作表对象
|
||||
*/
|
||||
private Map<String,Sheet> sheets;
|
||||
|
||||
/**
|
||||
* 样式列表
|
||||
*/
|
||||
@@ -74,10 +87,16 @@ public class ExportExcel {
|
||||
*/
|
||||
private int rownum;
|
||||
|
||||
/**
|
||||
* 当前行号
|
||||
*/
|
||||
private Map<String, Integer> rownums;
|
||||
|
||||
/**
|
||||
* 注解列表(Object[]{ ExcelField, Field/Method })
|
||||
*/
|
||||
List<Object[]> annotationList = Lists.newArrayList();
|
||||
Map<String, List<Object[]>> annotationMap=new HashMap<>();
|
||||
|
||||
/**
|
||||
* //递归获取cls实体对象及父级对象的属性
|
||||
@@ -111,6 +130,159 @@ public class ExportExcel {
|
||||
getFields(list,cls.getSuperclass());
|
||||
}
|
||||
}
|
||||
public String[] validRegionFieldAndSetComment(String headerStr,String commentStr,FunctionRegionDict region,Properties msgProp){
|
||||
String[] titleInfo=new String[2];
|
||||
if(region.getIsMaat().equals(1)){//maat
|
||||
if(region.getRegionType().equals(1)){//IP配置
|
||||
//ip配置需要导入的信息:srcIp srcPort destIp destPort Protocol Direction
|
||||
//确定需要导入的srcIp srcPort destIp destPort信息
|
||||
if(StringUtil.isEmpty(region.getConfigIpPortShow())){//无源目的ip和端口
|
||||
if("client_ip".equals(headerStr)
|
||||
|| "server_ip".equals(headerStr)
|
||||
|| "client_port".equals(headerStr)
|
||||
|| "server_port".equals(headerStr)
|
||||
){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}
|
||||
}else{
|
||||
if("client_ip".equals(headerStr)){
|
||||
if(((","+region.getConfigIpPortShow()+",").indexOf(",1,") > -1) ){
|
||||
commentStr="";
|
||||
if((","+region.getConfigIpType()+",").indexOf(",4,") > -1){
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
|
||||
commentStr=commentStr+"0.0.0.0"+"\n";
|
||||
}
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
|
||||
commentStr=commentStr+"0.0.0.0-1"+"\n";
|
||||
}
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
|
||||
commentStr=commentStr+"0.0.0.0/16"+"\n";
|
||||
}
|
||||
}
|
||||
if((","+region.getConfigIpType()+",").indexOf(",6,") > -1){
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
|
||||
commentStr=commentStr+"::"+"\n";
|
||||
}
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
|
||||
commentStr=commentStr+"::-::"+"\n";
|
||||
}
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
|
||||
commentStr=commentStr+"::/128"+"\n";
|
||||
}
|
||||
}
|
||||
}else{
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}
|
||||
}
|
||||
if("server_ip".equals(headerStr)){
|
||||
if((","+region.getConfigIpPortShow()+",").indexOf(",3,") > -1){
|
||||
commentStr="";
|
||||
if((","+region.getConfigIpType()+",").indexOf(",4,") > -1){
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
|
||||
commentStr=commentStr+"0.0.0.0"+"\n";
|
||||
}
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
|
||||
commentStr=commentStr+"0.0.0.0-1"+"\n";
|
||||
}
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
|
||||
commentStr=commentStr+"0.0.0.0/16"+"\n";
|
||||
}
|
||||
}
|
||||
if((","+region.getConfigIpType()+",").indexOf(",6,") > -1){
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",3,") > -1){
|
||||
commentStr=commentStr+"::"+"\n";
|
||||
}
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",2,") > -1){
|
||||
commentStr=commentStr+"::-::"+"\n";
|
||||
}
|
||||
if((","+region.getConfigIpPattern()+",").indexOf(",1,") > -1){
|
||||
commentStr=commentStr+"::/128"+"\n";
|
||||
}
|
||||
}
|
||||
}else{
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}
|
||||
}
|
||||
if("client_port".equals(headerStr)){
|
||||
if(((","+region.getConfigIpPortShow()+",").indexOf(",2,") > -1)){
|
||||
commentStr="";
|
||||
if((","+region.getConfigPortPattern()+",").indexOf(",1,") > -1){
|
||||
commentStr=commentStr+"0["+msgProp.getProperty("val_src_port")+"]"+"\n";
|
||||
}
|
||||
if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){
|
||||
commentStr=commentStr+"0/65535["+msgProp.getProperty("val_src_port_mask")+"]"+"\n";
|
||||
}
|
||||
}else{
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}
|
||||
}
|
||||
if("server_port".equals(headerStr)){
|
||||
if((","+region.getConfigIpPortShow()+",").indexOf(",4,") > -1){
|
||||
commentStr="";
|
||||
if((","+region.getConfigPortPattern()+",").indexOf(",1,") > -1){
|
||||
commentStr=commentStr+"0["+msgProp.getProperty("val_src_port")+"]"+"\n";
|
||||
}
|
||||
if((","+region.getConfigPortPattern()+",").indexOf(",2,") > -1){
|
||||
commentStr=commentStr+"0/65535["+msgProp.getProperty("val_src_port_mask")+"]"+"\n";
|
||||
}
|
||||
}else{
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}
|
||||
}
|
||||
}
|
||||
//导入的Protocol
|
||||
if("protocol".equals(headerStr)){
|
||||
if(StringUtil.isEmpty(region.getConfigProtocol())){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}else{
|
||||
commentStr="";
|
||||
List<SysDataDictionaryItem> protocol=DictUtils.getDictList("PROTOCOL");
|
||||
if(protocol !=null && protocol.size()>0){
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : protocol) {
|
||||
if((","+region.getConfigProtocol()+",").indexOf(","+sysDataDictionaryItem.getItemCode()+",") >0){
|
||||
if(StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
|
||||
}else{
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//导入的Direction
|
||||
if("direction".equals(headerStr)){
|
||||
if(StringUtil.isEmpty(region.getConfigProtocol())){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}else{
|
||||
commentStr="";
|
||||
List<SysDataDictionaryItem> direction=DictUtils.getDictList("DIRECTION");
|
||||
if(direction !=null && direction.size()>0){
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : direction) {
|
||||
if(StringUtil.isEmpty(msgProp.getProperty(sysDataDictionaryItem.getItemValue()))){
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
|
||||
}else{
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+msgProp.getProperty(sysDataDictionaryItem.getItemValue())+"\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
titleInfo[0]=headerStr;
|
||||
titleInfo[1]=commentStr;
|
||||
return titleInfo;
|
||||
}
|
||||
/**
|
||||
* //递归获取cls实体对象及父级对象的method
|
||||
* @param list
|
||||
@@ -225,18 +397,116 @@ public class ExportExcel {
|
||||
});
|
||||
// Initialize
|
||||
List<String> headerList = Lists.newArrayList();
|
||||
List<String> commentList = Lists.newArrayList();
|
||||
for (Object[] os : annotationList){
|
||||
String t = ((ExcelField)os[0]).title();
|
||||
String titleStr = ((ExcelField)os[0]).title();
|
||||
String commentStr = ((ExcelField)os[0]).comment();
|
||||
// 如果是导出,则去掉注释
|
||||
if (type==1){
|
||||
String[] ss = StringUtils.split(t, "**", 2);
|
||||
if (ss.length==2){
|
||||
t = ss[0];
|
||||
commentStr="";
|
||||
}
|
||||
headerList.add(titleStr);
|
||||
commentList.add(commentStr);
|
||||
}
|
||||
initialize(title, headerList,commentList);
|
||||
}
|
||||
/**
|
||||
* 构造函数
|
||||
* @param FunctionRegionDict region信息
|
||||
* @param msgProp 国际化配置
|
||||
* @param title 表格标题,传“空值”,表示无标题
|
||||
* @param cls 实体对象,通过annotation.ExportField获取标题
|
||||
* @param type 导出类型(1:导出数据;2:导出模板)
|
||||
* @param groups 导入分组
|
||||
*/
|
||||
public ExportExcel(FunctionRegionDict region,Properties msgProp,String title, Class<?> cls, int type, int... groups){
|
||||
List<Field> list=new ArrayList<Field>();
|
||||
// Get annotation field
|
||||
//递归获取cls实体对象及父级对象的属性
|
||||
getFields(list, cls);
|
||||
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
for (Field f : list){
|
||||
ExcelField ef = f.getAnnotation(ExcelField.class);
|
||||
if (ef != null && (ef.type()==0 || ef.type()==type)){
|
||||
if (groups!=null && groups.length>0){
|
||||
boolean inGroup = false;
|
||||
for (int g : groups){
|
||||
if (inGroup){
|
||||
break;
|
||||
}
|
||||
for (int efg : ef.groups()){
|
||||
if (g == efg){
|
||||
inGroup = true;
|
||||
annotationList.add(new Object[]{ef, f});
|
||||
break;
|
||||
}
|
||||
}
|
||||
headerList.add(t);
|
||||
}
|
||||
initialize(title, headerList);
|
||||
}else{
|
||||
annotationList.add(new Object[]{ef, f});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
List<Method> ms=new ArrayList<Method>();
|
||||
// Get annotation method
|
||||
//递归获取cls实体对象及父级对象的属性
|
||||
getMethods(ms, cls);
|
||||
if(!StringUtil.isEmpty(ms)){
|
||||
for (Method m : ms){
|
||||
ExcelField ef = m.getAnnotation(ExcelField.class);
|
||||
if (ef != null && (ef.type()==0 || ef.type()==type)){
|
||||
if (groups!=null && groups.length>0){
|
||||
boolean inGroup = false;
|
||||
for (int g : groups){
|
||||
if (inGroup){
|
||||
break;
|
||||
}
|
||||
for (int efg : ef.groups()){
|
||||
if (g == efg){
|
||||
inGroup = true;
|
||||
annotationList.add(new Object[]{ef, m});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
annotationList.add(new Object[]{ef, m});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Field sorting
|
||||
Collections.sort(annotationList, new Comparator<Object[]>() {
|
||||
public int compare(Object[] o1, Object[] o2) {
|
||||
return new Integer(((ExcelField)o1[0]).sort()).compareTo(
|
||||
new Integer(((ExcelField)o2[0]).sort()));
|
||||
};
|
||||
});
|
||||
// Initialize
|
||||
List<String> headerList = Lists.newArrayList();
|
||||
List<String> commentList = Lists.newArrayList();
|
||||
for (Object[] os : annotationList){
|
||||
String titleStr = ((ExcelField)os[0]).title();
|
||||
String commentStr = ((ExcelField)os[0]).comment();
|
||||
|
||||
// 如果是导出,则去掉注释
|
||||
if (type==1){
|
||||
commentStr="";
|
||||
}else{
|
||||
//判断此业务导出模板内容,设置导入提示信息
|
||||
String[] titleInfo=validRegionFieldAndSetComment(titleStr,commentStr,region,msgProp);
|
||||
titleStr=titleInfo[0];
|
||||
commentStr=titleInfo[1];
|
||||
}
|
||||
if(!StringUtil.isEmpty(titleStr)){
|
||||
headerList.add(msgProp.getProperty(titleStr)==null?titleStr:msgProp.getProperty(titleStr));
|
||||
commentList.add(commentStr);
|
||||
}
|
||||
|
||||
}
|
||||
initialize(title, headerList,commentList);
|
||||
}
|
||||
/**
|
||||
* 构造函数
|
||||
@@ -283,9 +553,6 @@ public class ExportExcel {
|
||||
if(!StringUtil.isEmpty(ms)){
|
||||
for (Method m : ms){
|
||||
ExcelField ef = m.getAnnotation(ExcelField.class);
|
||||
if(m.getName().equals("getSrcIpAddress")) {
|
||||
System.out.println(ef.title());
|
||||
}
|
||||
if (ef != null && (ef.type()==0 || ef.type()==type)){
|
||||
if (groups!=null && groups.length>0){
|
||||
boolean inGroup = false;
|
||||
@@ -316,18 +583,22 @@ public class ExportExcel {
|
||||
});
|
||||
// Initialize
|
||||
List<String> headerList = Lists.newArrayList();
|
||||
List<String> commentList = Lists.newArrayList();
|
||||
for (Object[] os : annotationList){
|
||||
String t = ((ExcelField)os[0]).title();
|
||||
String titleStr = ((ExcelField)os[0]).title();
|
||||
String commentStr = ((ExcelField)os[0]).comment();
|
||||
|
||||
// 如果是导出,则去掉注释
|
||||
if (type==1){
|
||||
String[] ss = StringUtils.split(t, "**", 2);
|
||||
if (ss.length==2){
|
||||
t = ss[0];
|
||||
commentStr="";
|
||||
}
|
||||
if(!StringUtil.isEmpty(titleStr)){
|
||||
headerList.add(msgProp.getProperty(titleStr)==null?titleStr:msgProp.getProperty(titleStr));
|
||||
commentList.add(commentStr);
|
||||
}
|
||||
headerList.add(msgProp.getProperty(t)==null?t:msgProp.getProperty(t));
|
||||
|
||||
}
|
||||
initialize(title, headerList);
|
||||
initialize(title, headerList,commentList);
|
||||
}
|
||||
/**
|
||||
* 构造函数
|
||||
@@ -347,14 +618,19 @@ public class ExportExcel {
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
for (Field f : list){
|
||||
ExcelField ef = f.getAnnotation(ExcelField.class);
|
||||
/*if(ef==null || StringUtil.isEmpty(ef.title())){
|
||||
break;
|
||||
}
|
||||
String titleP=StringUtil.isEmpty(msgProp.get(ef.title())) ? ef.title().toString():msgProp.get(ef.title()).toString();
|
||||
boolean export=false;
|
||||
for(String column:cloumnArray) {
|
||||
if(ef!=null&&column.equals(ef.title())) {
|
||||
|
||||
if(ef!=null&&column.equals(titleP)) {
|
||||
export=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(export) {
|
||||
if(export) {*/
|
||||
if (ef != null && (ef.type()==0 || ef.type()==type)){
|
||||
if (groups!=null && groups.length>0){
|
||||
boolean inGroup = false;
|
||||
@@ -374,7 +650,7 @@ public class ExportExcel {
|
||||
annotationList.add(new Object[]{ef, f});
|
||||
}
|
||||
}
|
||||
}
|
||||
/*}*/
|
||||
}
|
||||
}
|
||||
List<Method> ms=new ArrayList<Method>();
|
||||
@@ -423,43 +699,46 @@ public class ExportExcel {
|
||||
});
|
||||
// Initialize
|
||||
List<String> headerList = Lists.newArrayList();
|
||||
List<String> commentList = Lists.newArrayList();
|
||||
for (Object[] os : annotationList){
|
||||
String t = ((ExcelField)os[0]).title();
|
||||
String titleStr = ((ExcelField)os[0]).title();
|
||||
String commentStr = ((ExcelField)os[0]).comment();
|
||||
// 如果是导出,则去掉注释
|
||||
if (type==1){
|
||||
String[] ss = StringUtils.split(t, "**", 2);
|
||||
if (ss.length==2){
|
||||
t = ss[0];
|
||||
commentStr="";
|
||||
}
|
||||
headerList.add(msgProp.getProperty(titleStr)==null?titleStr:msgProp.getProperty(titleStr));
|
||||
commentList.add(commentStr);
|
||||
}
|
||||
headerList.add(msgProp.getProperty(t)==null?t:msgProp.getProperty(t));
|
||||
}
|
||||
initialize(title, headerList);
|
||||
initialize(title, headerList,commentList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
* @param title 表格标题,传“空值”,表示无标题
|
||||
* @param headers 表头数组
|
||||
*/
|
||||
public ExportExcel(String title, String[] headers) {
|
||||
initialize(title, Lists.newArrayList(headers));
|
||||
public ExportExcel(String title, String[] headers, String[] comments) {
|
||||
initialize(title, Lists.newArrayList(headers), Lists.newArrayList(comments));
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
* @param title 表格标题,传“空值”,表示无标题
|
||||
* @param headerList 表头列表
|
||||
* @param commentList 注释列表
|
||||
*/
|
||||
public ExportExcel(String title, List<String> headerList) {
|
||||
initialize(title, headerList);
|
||||
public ExportExcel(String title, List<String> headerList, List<String> commentList) {
|
||||
initialize(title, headerList,commentList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 初始化函数
|
||||
* @param title 表格标题,传“空值”,表示无标题
|
||||
* @param headerList 表头列表
|
||||
*/
|
||||
private void initialize(String title, List<String> headerList) {
|
||||
private void initialize(String title, List<String> headerList, List<String> commentList) {
|
||||
this.wb = new SXSSFWorkbook(500);
|
||||
this.sheet = wb.createSheet("Export");
|
||||
this.styles = createStyles(wb);
|
||||
@@ -482,12 +761,12 @@ public class ExportExcel {
|
||||
for (int i = 0; i < headerList.size(); i++) {
|
||||
Cell cell = headerRow.createCell(i);
|
||||
cell.setCellStyle(styles.get("header"));
|
||||
String[] ss = StringUtils.split(headerList.get(i), "**", 2);
|
||||
if (ss.length==2){
|
||||
cell.setCellValue(ss[0]);
|
||||
String commentStr = commentList.get(i);
|
||||
if (!StringUtil.isEmpty(commentStr)){
|
||||
cell.setCellValue(headerList.get(i));
|
||||
Comment comment = this.sheet.createDrawingPatriarch().createCellComment(
|
||||
new XSSFClientAnchor(0, 0, 0, 0, (short) i, 0, (short) i+4, 3));
|
||||
comment.setString(new XSSFRichTextString(ss[1]));
|
||||
comment.setString(new XSSFRichTextString(commentStr));
|
||||
cell.setCellComment(comment);
|
||||
}else{
|
||||
cell.setCellValue(headerList.get(i));
|
||||
@@ -574,6 +853,15 @@ public class ExportExcel {
|
||||
public Row addRow(){
|
||||
return sheet.createRow(rownum++);
|
||||
}
|
||||
/**
|
||||
* 添加一行
|
||||
* @return 行对象
|
||||
*/
|
||||
public Row addRow(Sheet sheet,Integer rownum,String key){
|
||||
rownum++;
|
||||
rownums.put(key, rownum);
|
||||
return sheet.createRow(rownum);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -612,9 +900,8 @@ public class ExportExcel {
|
||||
} else if (val instanceof Float) {
|
||||
cell.setCellValue((Float) val);
|
||||
} else if (val instanceof Date) {
|
||||
DataFormat format = wb.createDataFormat();
|
||||
style.setDataFormat(format.getFormat("yyyy-MM-dd HH:mm:ss"));
|
||||
cell.setCellValue((Date) val);
|
||||
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
cell.setCellValue(sdf.format(val));
|
||||
} else {
|
||||
if (fieldType != Class.class){
|
||||
cell.setCellValue((String)fieldType.getMethod("setValue", Object.class).invoke(null, val));
|
||||
@@ -681,6 +968,80 @@ public class ExportExcel {
|
||||
}
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* 添加数据(通过annotation.ExportField添加数据)
|
||||
* @return list 数据列表
|
||||
*/
|
||||
public <E> ExportExcel setDataList(Properties msgProp, Map<String,List> dataMap, Map<Object,Object> map){
|
||||
Set<String> keyList=dataMap.keySet();
|
||||
for (String key : keyList) {
|
||||
List<E> list=dataMap.get(key);
|
||||
for (E e : list){
|
||||
int colunm = 0;
|
||||
Row row = this.addRow(sheets.get(key),rownums.get(key),key);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (Object[] os : annotationMap.get(key)){
|
||||
ExcelField ef = (ExcelField)os[0];
|
||||
Object val = null;
|
||||
// Get entity value
|
||||
try{
|
||||
if (StringUtils.isNotBlank(ef.value())){
|
||||
val = Reflections.invokeGetter(e, ef.value());
|
||||
}else{
|
||||
if (os[1] instanceof Field){
|
||||
val = Reflections.invokeGetter(e, ((Field)os[1]).getName());
|
||||
}else if (os[1] instanceof Method){
|
||||
val = Reflections.invokeMethod(e, ((Method)os[1]).getName(), new Class[] {}, new Object[] {});
|
||||
}
|
||||
}
|
||||
// If is dict, get dict label
|
||||
if (StringUtils.isNotBlank(ef.dictType())){
|
||||
String valStr=val==null?"":val.toString();
|
||||
if("type".equals(ef.dictType()) || "attribute".equals(ef.dictType())
|
||||
|| "label".equals(ef.dictType())){
|
||||
// Get basic info
|
||||
val = getBasicInfo(ef.dictType(),map,valStr);
|
||||
}else{
|
||||
//字典数据已做国际化处理
|
||||
String dict=DictUtils.getDictLabel(ef.dictType(), valStr, "");
|
||||
//如果找不到字典国际化值,把字典本身作为默认值放进去,不然导出就是空了
|
||||
val = msgProp.getProperty(dict,dict);
|
||||
}
|
||||
|
||||
}
|
||||
if(ef.title().equals("is_hex") && !StringUtil.isEmpty(val)){
|
||||
Integer isHex=Integer.parseInt(val.toString());
|
||||
if(isHex.equals(0) || isHex.equals(2)){
|
||||
val = msgProp.getProperty("not_hex","not_hex");
|
||||
}else if(isHex.equals(1)){
|
||||
val = msgProp.getProperty("hex","hex");
|
||||
}else{
|
||||
val ="";
|
||||
}
|
||||
}
|
||||
if(ef.title().equals("is_case_insenstive") && !StringUtil.isEmpty(val)){
|
||||
Integer isCaseSenstive=Integer.parseInt(val.toString());
|
||||
if(isCaseSenstive.equals(0) || isCaseSenstive.equals(1)){
|
||||
val = msgProp.getProperty("case_insenstive","case_insenstive");
|
||||
}else if(isCaseSenstive.equals(1)){
|
||||
val = msgProp.getProperty("case_senstive","case_senstive");
|
||||
}else{
|
||||
val ="";
|
||||
}
|
||||
}
|
||||
}catch(Exception ex) {
|
||||
// Failure to ignore
|
||||
log.error("Get entity value failed",ex);
|
||||
val = "";
|
||||
}
|
||||
this.addCell(row, colunm++, val, ef.align(), ef.fieldType());
|
||||
sb.append(val + ", ");
|
||||
}
|
||||
log.debug("Write success: ["+row.getRowNum()+"] "+sb.toString());
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* 添加数据(通过annotation.ExportField添加数据)
|
||||
* @return list 数据列表
|
||||
@@ -795,6 +1156,177 @@ public class ExportExcel {
|
||||
}
|
||||
return basicInfo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************************************/
|
||||
/**
|
||||
* 构造函数
|
||||
* @param msgProp 国际化配置
|
||||
* @param title sheet名称
|
||||
* @param cls 实体对象,通过annotation.ExportField获取标题
|
||||
* @param type 导出类型(1:导出数据;2:导出模板)
|
||||
* @param groups 导入分组
|
||||
* @return
|
||||
*/
|
||||
public ExportExcel(Properties msgProp,List<String> titleList,Map<String,String> noExportMap,Map<String, Class<?>> clsMap, int type, int... groups){
|
||||
Map<String, List<String>> headerMap=new HashMap<String, List<String>>();
|
||||
Map<String, List<String>> commentMap=new HashMap<String, List<String>>();
|
||||
for (String title : titleList) {
|
||||
String noExportField=noExportMap.get(title);
|
||||
List<Object[]> annotationList = Lists.newArrayList();
|
||||
List<Field> list=new ArrayList<Field>();
|
||||
// Get annotation field
|
||||
//递归获取cls实体对象及父级对象的属性
|
||||
getFields(list, clsMap.get(title));
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
for (Field f : list){
|
||||
ExcelField ef = f.getAnnotation(ExcelField.class);
|
||||
if (ef != null && (ef.type()==0 || ef.type()==type)){
|
||||
if (groups!=null && groups.length>0){
|
||||
boolean inGroup = false;
|
||||
for (int g : groups){
|
||||
if (inGroup){
|
||||
break;
|
||||
}
|
||||
for (int efg : ef.groups()){
|
||||
if (g == efg){
|
||||
inGroup = true;
|
||||
if(!StringUtil.isEmpty(ef.title()) && !(noExportField.indexOf(","+ef.title()+",") > -1)){
|
||||
annotationList.add(new Object[]{ef, f});
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(!StringUtil.isEmpty(ef.title()) && !(noExportField.indexOf(","+ef.title()+",") > -1)){
|
||||
annotationList.add(new Object[]{ef, f});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
List<Method> ms=new ArrayList<Method>();
|
||||
// Get annotation method
|
||||
//递归获取cls实体对象及父级对象的属性
|
||||
getMethods(ms, clsMap.get(title));
|
||||
if(!StringUtil.isEmpty(ms)){
|
||||
for (Method m : ms){
|
||||
ExcelField ef = m.getAnnotation(ExcelField.class);
|
||||
if (ef != null && (ef.type()==0 || ef.type()==type)){
|
||||
if (groups!=null && groups.length>0){
|
||||
boolean inGroup = false;
|
||||
for (int g : groups){
|
||||
if (inGroup){
|
||||
break;
|
||||
}
|
||||
for (int efg : ef.groups()){
|
||||
if (g == efg){
|
||||
inGroup = true;
|
||||
if(!StringUtil.isEmpty(ef.title()) && !(noExportField.indexOf(","+ef.title()+",") > -1)){
|
||||
annotationList.add(new Object[]{ef, m});
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(!StringUtil.isEmpty(ef.title()) && !(noExportField.indexOf(","+ef.title()+",") > -1)){
|
||||
annotationList.add(new Object[]{ef, m});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Field sorting
|
||||
Collections.sort(annotationList, new Comparator<Object[]>() {
|
||||
public int compare(Object[] o1, Object[] o2) {
|
||||
return new Integer(((ExcelField)o1[0]).sort()).compareTo(
|
||||
new Integer(((ExcelField)o2[0]).sort()));
|
||||
};
|
||||
});
|
||||
// Initialize
|
||||
List<String> headerList = Lists.newArrayList();
|
||||
List<String> commentList = Lists.newArrayList();
|
||||
for (Object[] os : annotationList){
|
||||
String titleStr = ((ExcelField)os[0]).title();
|
||||
String commentStr = ((ExcelField)os[0]).comment();
|
||||
|
||||
// 如果是导出,则去掉注释
|
||||
if (type==1){
|
||||
commentStr="";
|
||||
}
|
||||
if(!StringUtil.isEmpty(titleStr)){
|
||||
//去掉不需要展示的header
|
||||
if(!(noExportField.indexOf(","+titleStr+",") > -1)){
|
||||
titleStr=msgProp.getProperty(titleStr)==null?titleStr:msgProp.getProperty(titleStr);
|
||||
headerList.add(titleStr);
|
||||
commentList.add(commentStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
headerMap.put(title, headerList);
|
||||
commentMap.put(title, commentList);
|
||||
annotationMap.put(title, annotationList);
|
||||
}
|
||||
initializeMultiSheet(msgProp,titleList, headerMap,commentMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化函数
|
||||
* @param title 表格标题,传“空值”,表示无标题
|
||||
* @param headerList 表头列表
|
||||
*/
|
||||
private void initializeMultiSheet(Properties msgProp,List<String> titleList,Map<String, List<String>> headerMap,Map<String,List<String>> commentMap) {
|
||||
this.wb = new SXSSFWorkbook(500);
|
||||
int j=0;
|
||||
sheets=new HashMap<>();
|
||||
rownums=new HashMap<>();
|
||||
for (String title : titleList) {
|
||||
List<String> headerList=headerMap.get(title);
|
||||
List<String> commentList=commentMap.get(title);
|
||||
Sheet sheet = wb.createSheet(StringUtil.isEmpty(msgProp.get(title)) ? title:msgProp.get(title).toString());
|
||||
rownums.put(title, 0);
|
||||
sheets.put(title, sheet);
|
||||
this.styles = createStyles(wb);
|
||||
// Create header
|
||||
if (headerList == null){
|
||||
throw new RuntimeException("headerList not null!");
|
||||
}
|
||||
Integer rownum=rownums.get(title);
|
||||
Row headerRow = sheet.createRow(rownum++);
|
||||
headerRow.setHeightInPoints(16);
|
||||
for (int i = 0; i < headerList.size(); i++) {
|
||||
Cell cell = headerRow.createCell(i);
|
||||
cell.setCellStyle(styles.get("header"));
|
||||
String commentStr = commentList.get(i);
|
||||
if (!StringUtil.isEmpty(commentStr)){
|
||||
cell.setCellValue(headerList.get(i));
|
||||
Comment comment = sheet.createDrawingPatriarch().createCellComment(
|
||||
new XSSFClientAnchor(0, 0, 0, 0, (short) i, 0, (short) i+4, 3));
|
||||
comment.setString(new XSSFRichTextString(commentStr));
|
||||
cell.setCellComment(comment);
|
||||
}else{
|
||||
cell.setCellValue(headerList.get(i));
|
||||
}
|
||||
sheet.autoSizeColumn(i);
|
||||
}
|
||||
for (int i = 0; i < headerList.size(); i++) {
|
||||
int colWidth = sheet.getColumnWidth(i)*2;
|
||||
sheet.setColumnWidth(i, colWidth < 3000 ? 3000 : colWidth);
|
||||
}
|
||||
j++;
|
||||
}
|
||||
log.debug("Initialize success.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 输出数据流
|
||||
* @param os 输出数据流
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
@@ -20,12 +21,14 @@ import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jets3t.service.ServiceException;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.WebDataBinder;
|
||||
import org.springframework.web.bind.annotation.InitBinder;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
@@ -39,9 +42,12 @@ import com.nis.domain.configuration.AreaBean;
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexStringCfgTemplate;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.RequestInfo;
|
||||
import com.nis.domain.configuration.StringCfgTemplate;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.IpCfgTemplate;
|
||||
import com.nis.domain.log.BaseLogEntity;
|
||||
import com.nis.domain.log.SearchReport;
|
||||
@@ -54,6 +60,9 @@ import com.nis.util.DictUtils;
|
||||
import com.nis.util.JsonMapper;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ExportExcel;
|
||||
import com.nis.util.excel.ImportExcel;
|
||||
import com.nis.web.dao.configuration.IpCfgDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.ArchiveServcie;
|
||||
import com.nis.web.service.AreaService;
|
||||
import com.nis.web.service.DictService;
|
||||
@@ -605,17 +614,17 @@ public class BaseController {
|
||||
if(dict.getRegionType()==1){
|
||||
List<IpCfgTemplate> list = Lists.newArrayList();
|
||||
list.add(new IpCfgTemplate());
|
||||
new ExportExcel(msgProp,null, IpCfgTemplate.class, 2).setDataList(msgProp,list,null).
|
||||
new ExportExcel(new FunctionRegionDict(),msgProp,null, IpCfgTemplate.class, 2).setDataList(msgProp,list,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(dict.getRegionType()==2){
|
||||
List<StringCfgTemplate> list = Lists.newArrayList();
|
||||
list.add(new StringCfgTemplate());
|
||||
new ExportExcel(msgProp,null, StringCfgTemplate.class, 2).setDataList(msgProp,list,null).
|
||||
new ExportExcel(new FunctionRegionDict(),msgProp,null, StringCfgTemplate.class, 2).setDataList(msgProp,list,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(dict.getRegionType()==3){
|
||||
List<ComplexStringCfgTemplate> list = Lists.newArrayList();
|
||||
list.add(new ComplexStringCfgTemplate());
|
||||
new ExportExcel(msgProp,null, ComplexStringCfgTemplate.class, 2).setDataList(msgProp,list,null).
|
||||
new ExportExcel(new FunctionRegionDict(),msgProp,null, ComplexStringCfgTemplate.class, 2).setDataList(msgProp,list,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}
|
||||
}
|
||||
@@ -637,17 +646,17 @@ public class BaseController {
|
||||
if(dict.getRegionType()==1){
|
||||
List<IpCfgTemplate> list = Lists.newArrayList();
|
||||
list.add((IpCfgTemplate)clazz.newInstance());
|
||||
new ExportExcel(msgProp,null, clazz, 2).setDataList(msgProp,list,null).
|
||||
new ExportExcel(new FunctionRegionDict(),msgProp,null, clazz, 2).setDataList(msgProp,list,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(dict.getRegionType()==2){
|
||||
List<StringCfgTemplate> list = Lists.newArrayList();
|
||||
list.add(new StringCfgTemplate());
|
||||
new ExportExcel(msgProp,null, clazz, 2).setDataList(msgProp,list,null).
|
||||
new ExportExcel(new FunctionRegionDict(),msgProp,null, clazz, 2).setDataList(msgProp,list,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else if(dict.getRegionType()==3){
|
||||
List<ComplexStringCfgTemplate> list = Lists.newArrayList();
|
||||
list.add(new ComplexStringCfgTemplate());
|
||||
new ExportExcel(msgProp,null, clazz, 2).setDataList(msgProp,list,null).
|
||||
new ExportExcel(new FunctionRegionDict(),msgProp,null, clazz, 2).setDataList(msgProp,list,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}
|
||||
}
|
||||
@@ -778,6 +787,572 @@ public class BaseController {
|
||||
params.put("searchCfgId", entry.getCfgId());
|
||||
}
|
||||
}
|
||||
|
||||
public List<BaseIpCfg> checkIpCfg(FunctionServiceDict serviceDict,FunctionRegionDict regionDict,List<IpAllTemplate> list) throws ServiceException{
|
||||
List<BaseIpCfg> ipList=new ArrayList<BaseIpCfg>();
|
||||
Properties prop=this.getMsgProp();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
IpAllTemplate ipCfg=list.get(i);
|
||||
IpPortCfg baseIpCfg=new IpPortCfg();
|
||||
baseIpCfg.setCfgDesc(ipCfg.getCfgDesc());
|
||||
if(regionDict.getIsMaat().equals(1)){
|
||||
if(regionDict.getRegionType().equals(1)){
|
||||
boolean srcIpEmpty=false;
|
||||
boolean srcPortEmpty=false;
|
||||
if(StringUtil.isEmpty(ipCfg.getSrcIpAddress())){
|
||||
srcIpEmpty=true;
|
||||
}
|
||||
if(StringUtil.isEmpty(ipCfg.getDestIpAddress())){
|
||||
if(srcIpEmpty){
|
||||
baseIpCfg.setSrcIpAddress("0.0.0.0");
|
||||
baseIpCfg.setDestIpAddress("0.0.0.0");
|
||||
baseIpCfg.setIpPattern(3);
|
||||
baseIpCfg.setIpType(4);
|
||||
}else{
|
||||
if(ipCfg.getSrcIpAddress().indexOf(":") > -1){
|
||||
if(ipCfg.getSrcIpAddress().indexOf("-") > -1){
|
||||
baseIpCfg.setSrcIpAddress(ipCfg.getSrcIpAddress());
|
||||
baseIpCfg.setDestIpAddress("::-::");
|
||||
baseIpCfg.setIpPattern(2);
|
||||
}else if(ipCfg.getSrcIpAddress().indexOf("/") > -1){
|
||||
baseIpCfg.setSrcIpAddress(ipCfg.getSrcIpAddress());
|
||||
baseIpCfg.setDestIpAddress("::/128");
|
||||
baseIpCfg.setIpPattern(1);
|
||||
}else{
|
||||
baseIpCfg.setSrcIpAddress(ipCfg.getSrcIpAddress());
|
||||
baseIpCfg.setDestIpAddress("::");
|
||||
baseIpCfg.setIpPattern(3);
|
||||
}
|
||||
baseIpCfg.setIpType(6);
|
||||
}else{
|
||||
if(ipCfg.getSrcIpAddress().indexOf("-") > -1){
|
||||
baseIpCfg.setSrcIpAddress("0.0.0.0-"+ipCfg.getSrcIpAddress().split("-")[0].substring(0,ipCfg.getSrcIpAddress().indexOf("-")+1)+ipCfg.getSrcIpAddress().split("-")[1]);
|
||||
baseIpCfg.setDestIpAddress("0.0.0.0-0.0.0.0");
|
||||
baseIpCfg.setIpPattern(2);
|
||||
}else if(ipCfg.getSrcIpAddress().indexOf("/") > -1){
|
||||
baseIpCfg.setSrcIpAddress(ipCfg.getSrcIpAddress());
|
||||
baseIpCfg.setDestIpAddress("0.0.0.0/16");
|
||||
baseIpCfg.setIpPattern(1);
|
||||
}else{
|
||||
baseIpCfg.setSrcIpAddress(ipCfg.getSrcIpAddress());
|
||||
baseIpCfg.setDestIpAddress("0.0.0.0");
|
||||
baseIpCfg.setIpPattern(3);
|
||||
}
|
||||
baseIpCfg.setIpType(4);
|
||||
}
|
||||
}
|
||||
} else{
|
||||
if(srcIpEmpty){
|
||||
if(ipCfg.getDestIpAddress().indexOf(":") > -1){
|
||||
if(ipCfg.getDestIpAddress().indexOf("-") > -1){
|
||||
baseIpCfg.setDestIpAddress(ipCfg.getDestIpAddress());
|
||||
baseIpCfg.setSrcIpAddress("::-::");
|
||||
baseIpCfg.setIpPattern(2);
|
||||
}else if(ipCfg.getDestIpAddress().indexOf("/") > -1){
|
||||
baseIpCfg.setDestIpAddress(ipCfg.getDestIpAddress());
|
||||
baseIpCfg.setSrcIpAddress("::/128");
|
||||
baseIpCfg.setIpPattern(1);
|
||||
}else{
|
||||
baseIpCfg.setDestIpAddress(ipCfg.getDestIpAddress());
|
||||
baseIpCfg.setSrcIpAddress("::");
|
||||
baseIpCfg.setIpPattern(3);
|
||||
}
|
||||
baseIpCfg.setIpType(6);
|
||||
}else{
|
||||
if(ipCfg.getDestIpAddress().indexOf("-") > -1){
|
||||
baseIpCfg.setDestIpAddress("0.0.0.0-"+ipCfg.getDestIpAddress().split("-")[0].substring(0,ipCfg.getDestIpAddress().indexOf("-")+1)+ipCfg.getDestIpAddress().split("-")[1]);
|
||||
baseIpCfg.setSrcIpAddress("0.0.0.0-0.0.0.0");
|
||||
baseIpCfg.setIpPattern(2);
|
||||
}else if(ipCfg.getDestIpAddress().indexOf("/") > -1){
|
||||
baseIpCfg.setDestIpAddress(ipCfg.getDestIpAddress());
|
||||
baseIpCfg.setSrcIpAddress("0.0.0.0/16");
|
||||
baseIpCfg.setIpPattern(1);
|
||||
}else{
|
||||
baseIpCfg.setDestIpAddress(ipCfg.getDestIpAddress());
|
||||
baseIpCfg.setSrcIpAddress("0.0.0.0");
|
||||
baseIpCfg.setIpPattern(3);
|
||||
}
|
||||
baseIpCfg.setIpType(4);
|
||||
}
|
||||
}else{
|
||||
baseIpCfg.setSrcIpAddress(ipCfg.getSrcIpAddress());
|
||||
baseIpCfg.setDestIpAddress(ipCfg.getDestIpAddress());
|
||||
if(ipCfg.getSrcIpAddress().indexOf(":") > -1){
|
||||
baseIpCfg.setIpType(6);
|
||||
}else{
|
||||
baseIpCfg.setIpType(4);
|
||||
}
|
||||
if(ipCfg.getSrcIpAddress().indexOf("-") > -1){
|
||||
baseIpCfg.setIpPattern(2);
|
||||
}else if(ipCfg.getSrcIpAddress().indexOf("/") > -1){
|
||||
baseIpCfg.setIpPattern(1);
|
||||
}else{
|
||||
baseIpCfg.setIpPattern(3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO 判断源IP和目的IP的值
|
||||
//TODO 判断源IP和目的IP格式
|
||||
|
||||
if(StringUtil.isEmpty(ipCfg.getSrcPort())){
|
||||
srcPortEmpty=true;
|
||||
}
|
||||
if(StringUtil.isEmpty(ipCfg.getDestPort())){
|
||||
if(srcPortEmpty){
|
||||
baseIpCfg.setSrcPort("0");
|
||||
baseIpCfg.setDestPort("0");
|
||||
baseIpCfg.setPortPattern(1);
|
||||
}else{
|
||||
if(ipCfg.getSrcPort().indexOf("/") > -1){
|
||||
baseIpCfg.setDestPort("0/0");
|
||||
baseIpCfg.setPortPattern(2);
|
||||
}else{
|
||||
baseIpCfg.setDestPort("0");
|
||||
baseIpCfg.setPortPattern(1);
|
||||
}
|
||||
baseIpCfg.setSrcPort(ipCfg.getSrcPort());
|
||||
}
|
||||
}else{
|
||||
if(srcPortEmpty){
|
||||
if(ipCfg.getDestPort().indexOf("/") > -1){
|
||||
baseIpCfg.setSrcPort("0/0");
|
||||
baseIpCfg.setPortPattern(2);
|
||||
}else{
|
||||
baseIpCfg.setSrcPort("0");
|
||||
baseIpCfg.setPortPattern(1);
|
||||
}
|
||||
baseIpCfg.setDestPort(ipCfg.getSrcPort());
|
||||
}else{
|
||||
if(ipCfg.getSrcPort().indexOf("/") > -1){
|
||||
baseIpCfg.setPortPattern(2);
|
||||
}else{
|
||||
baseIpCfg.setPortPattern(1);
|
||||
}
|
||||
baseIpCfg.setSrcPort(ipCfg.getSrcPort());
|
||||
baseIpCfg.setDestPort(ipCfg.getDestPort());
|
||||
|
||||
}
|
||||
}
|
||||
//TODO 判断源端口和目的端口格式
|
||||
//TODO 判断源和目的端口的值
|
||||
|
||||
if(StringUtil.isEmpty(ipCfg.getProtocol())){
|
||||
if(StringUtil.isEmpty(regionDict.getConfigProtocol())){
|
||||
baseIpCfg.setProtocol(0);
|
||||
}else{
|
||||
baseIpCfg.setProtocol(Integer.parseInt(regionDict.getConfigProtocol().split(",")[0]));
|
||||
}
|
||||
baseIpCfg.setProtocolId(serviceDict.getProtocolId());
|
||||
}else{
|
||||
baseIpCfg.setProtocol(ipCfg.getProtocol());
|
||||
baseIpCfg.setProtocolId(serviceDict.getProtocolId());
|
||||
}
|
||||
//TODO 判断Protocol的值
|
||||
|
||||
if(StringUtil.isEmpty(ipCfg.getDirection())){
|
||||
if(StringUtil.isEmpty(regionDict.getConfigDirection())){
|
||||
baseIpCfg.setDirection(0);
|
||||
}else{
|
||||
baseIpCfg.setDirection(Integer.parseInt(regionDict.getConfigDirection().split(",")[0]));
|
||||
}
|
||||
}else{
|
||||
baseIpCfg.setDirection(ipCfg.getDirection());
|
||||
}
|
||||
|
||||
//TODO 判断Direction的值
|
||||
}
|
||||
}
|
||||
ipList.add(baseIpCfg);
|
||||
}
|
||||
return ipList;
|
||||
|
||||
/*List<SysDataDictionaryItem> ipTypeList = DictUtils.getDictList("IP_TYPE");
|
||||
List<SysDataDictionaryItem> ipPatternList = DictUtils.getDictList("IP_PATTERN");
|
||||
List<SysDataDictionaryItem> portPatternList = DictUtils.getDictList("PORT_PATTERN");
|
||||
List<SysDataDictionaryItem> directionList = DictUtils.getDictList("DIRECTION");
|
||||
List<SysDataDictionaryItem> protocolList = DictUtils.getDictList("PROTOCOL");
|
||||
List<SysDataDictionaryItem> ipsecProrocolList = DictUtils.getDictList("IPSEC_PROTOCOL");
|
||||
List<SysDataDictionaryItem> tunnelProrocolList = DictUtils.getDictList("TUNNEL_PROTOCOL");
|
||||
List<SysDataDictionaryItem> specialFunctionIdList = DictUtils.getDictList("SPECIAL_FUNCTION_ID");
|
||||
List<SysDataDictionaryItem> irTypeList = DictUtils.getDictList("IR_TYPE");
|
||||
String specialItem=null;
|
||||
for(SysDataDictionaryItem sfuncItem:specialFunctionIdList){
|
||||
if(functionId==Integer.parseInt(sfuncItem.getItemCode())){
|
||||
specialItem=sfuncItem.getItemValue();
|
||||
}
|
||||
}
|
||||
if("ipaddr".equals(specialItem)){
|
||||
List<SysDataDictionaryItem> icmpprotocolList = DictUtils.getDictList("ICMP_PROTOCOL");
|
||||
if(action==Constants.DROP_ACTION) {
|
||||
protocolList.addAll(icmpprotocolList);
|
||||
}
|
||||
}
|
||||
StringBuffer msg=new StringBuffer();
|
||||
int line=1;
|
||||
for(IpCfgTemplate value:list){
|
||||
String lineStart=String.format(prop.getProperty("line"), line)+":";
|
||||
StringBuffer errInfo=new StringBuffer();
|
||||
// ip_type check start
|
||||
Integer ipType=value.getIpType();
|
||||
if(ipType==null){
|
||||
errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("ip_type"))+";");
|
||||
}else{
|
||||
boolean has=false;
|
||||
for(SysDataDictionaryItem ipTypeItem:ipTypeList){
|
||||
if(ipType==Integer.parseInt(ipTypeItem.getItemCode())){
|
||||
has=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("ip_type"))+";");
|
||||
}
|
||||
}
|
||||
// ip_type check end
|
||||
// ip_pattern check start
|
||||
Integer ipPattern=value.getIpPattern();
|
||||
if(ipPattern==null){
|
||||
errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("ip_pattern"))+";");
|
||||
}else{
|
||||
boolean has=false;
|
||||
for(SysDataDictionaryItem ipPatternItem:ipPatternList){
|
||||
if(ipPattern==Integer.parseInt(ipPatternItem.getItemCode())){
|
||||
has=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("ip_pattern"))+";");
|
||||
}
|
||||
}
|
||||
// ip_pattern check end
|
||||
//client_ip check start
|
||||
String srcIp=value.getSrcIpAddress();
|
||||
String _msg="";
|
||||
if("ipmulitiplex".equals(specialItem)) {
|
||||
_msg=checkIP(prop,prop.getProperty("IP"),srcIp,ipType,ipPattern);
|
||||
}else {
|
||||
_msg=checkIP(prop,prop.getProperty("client_ip"),srcIp,ipType,ipPattern);
|
||||
}
|
||||
if(StringUtils.isNotBlank(_msg)){
|
||||
errInfo.append(_msg);
|
||||
}
|
||||
//client_ip check end
|
||||
//server_ip check start
|
||||
String destIp=value.getDestIpAddress();
|
||||
if("ipmulitiplex".equals(specialItem)) {//set 默认值
|
||||
if(ipPattern!=null&&ipType!=null) {
|
||||
if(1==ipPattern.intValue()) {
|
||||
if(4==ipType.intValue()) {
|
||||
value.setDestIpAddress(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE);
|
||||
}else if(6==ipType.intValue()) {
|
||||
value.setDestIpAddress(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE);
|
||||
}else if(46==ipType.intValue()) {
|
||||
value.setDestIpAddress(Constants.IPV6_DEFAULT_IP_SUBNET_VALUE);
|
||||
}else if(64==ipType.intValue()) {
|
||||
value.setDestIpAddress(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE);
|
||||
}else if(10==ipType.intValue()) {
|
||||
value.setDestIpAddress(Constants.IPV4_DEFAULT_IP_SUBNET_VALUE);
|
||||
}
|
||||
}else if(2==ipPattern.intValue()) {
|
||||
if(4==ipType.intValue()) {
|
||||
value.setDestIpAddress(Constants.IPV4_DEFAULT_IP_RANGE_VALUE);
|
||||
}else if(6==ipType.intValue()) {
|
||||
value.setDestIpAddress(Constants.IPV6_DEFAULT_IP_RANGE_VALUE);
|
||||
}else if(46==ipType.intValue()) {
|
||||
value.setDestIpAddress(Constants.IPV6_DEFAULT_IP_RANGE_VALUE);
|
||||
}else if(64==ipType.intValue()) {
|
||||
value.setDestIpAddress(Constants.IPV4_DEFAULT_IP_RANGE_VALUE);
|
||||
}else if(10==ipType.intValue()) {
|
||||
value.setDestIpAddress(Constants.IPV4_DEFAULT_IP_RANGE_VALUE);
|
||||
}
|
||||
}else if(3==ipPattern.intValue()) {
|
||||
if(4==ipType.intValue()) {
|
||||
value.setDestIpAddress(Constants.IPV4_DEFAULT_IP_VALUE);
|
||||
}else if(6==ipType.intValue()) {
|
||||
value.setDestIpAddress(Constants.IPV6_DEFAULT_IP_VALUE);
|
||||
}else if(46==ipType.intValue()) {
|
||||
value.setDestIpAddress(Constants.IPV6_DEFAULT_IP_VALUE);
|
||||
}else if(64==ipType.intValue()) {
|
||||
value.setDestIpAddress(Constants.IPV4_DEFAULT_IP_VALUE);
|
||||
}else if(10==ipType.intValue()) {
|
||||
value.setDestIpAddress(Constants.IPV4_DEFAULT_IP_VALUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
if(srcIp.equals(destIp)){
|
||||
String info=String.format(prop.getProperty("are_the_same"),prop.getProperty("client_ip"),prop.getProperty("server_ip"));
|
||||
errInfo.append(info+";");
|
||||
}
|
||||
_msg=checkIP(prop,prop.getProperty("server_ip"),destIp,ipType,ipPattern);
|
||||
if(StringUtils.isNotBlank(_msg)){
|
||||
errInfo.append(_msg);
|
||||
}
|
||||
}
|
||||
if(!"ipmulitiplex".equals(specialItem)&&(46==ipType.intValue()||64==ipType.intValue()||10==ipType.intValue())) {
|
||||
_msg=checkIp(prop, prop.getProperty("client_ip"), srcIp, prop.getProperty("server_ip"), destIp, ipType, ipPattern);
|
||||
if(StringUtils.isNotBlank(_msg)){
|
||||
errInfo.append(_msg);
|
||||
}
|
||||
}
|
||||
//server_ip check end
|
||||
//port_pattern check start
|
||||
Integer portPattern=value.getPortPattern();
|
||||
if(portPattern==null){
|
||||
errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("port_pattern"))+";");
|
||||
}else{
|
||||
boolean has=false;
|
||||
for(SysDataDictionaryItem portPatternItem:portPatternList){
|
||||
if(portPattern==Integer.parseInt(portPatternItem.getItemCode())){
|
||||
has=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("port_pattern"))+";");
|
||||
}
|
||||
}
|
||||
//port_pattern check end
|
||||
//src_port check start
|
||||
String srcPort=value.getSrcPort();
|
||||
if("ipmulitiplex".equals(specialItem)) {
|
||||
_msg=checkPort(prop,prop.getProperty("port"), srcPort, portPattern);
|
||||
}else {
|
||||
_msg=checkPort(prop,prop.getProperty("client_port"), srcPort, portPattern);
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(_msg)){
|
||||
errInfo.append(_msg);
|
||||
}
|
||||
//src_port check end
|
||||
//dest_port check start
|
||||
String destPort=value.getDestPort();
|
||||
if("ipmulitiplex".equals(specialItem)) {//set 默认值
|
||||
if(portPattern!=null) {
|
||||
if(2==portPattern.intValue()) {
|
||||
value.setDestPort(Constants.PORT_MASK_DEFAULT);
|
||||
}else if(1==portPattern.intValue()) {
|
||||
value.setDestPort(Constants.PORT_DEFAULT);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
_msg=checkPort(prop,prop.getProperty("server_port"), destPort, portPattern);
|
||||
}
|
||||
if(StringUtils.isNotBlank(_msg)){
|
||||
errInfo.append(_msg);
|
||||
}
|
||||
//dest_port check end
|
||||
//direction check start
|
||||
Integer direction=value.getDirection();
|
||||
if(direction==null){
|
||||
errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("direction"))+";");
|
||||
}else{
|
||||
boolean has=false;
|
||||
for(SysDataDictionaryItem directionItem:directionList){
|
||||
if(Integer.parseInt(directionItem.getItemCode())==direction.intValue()){
|
||||
has=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("direction"))+";");
|
||||
}
|
||||
}
|
||||
//direction check end
|
||||
//protocol check start
|
||||
Integer protocol= value.getProtocol();
|
||||
if(protocol==null){
|
||||
errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("protocol"))+";");
|
||||
}else{
|
||||
if(specialItem!=null&&("ipsec".equals(specialItem)||"tunnel".equals(specialItem))){
|
||||
if("ipsec".equals(specialItem)){
|
||||
if(action==Constants.DROP_ACTION.intValue()) {
|
||||
boolean has=false;
|
||||
for(SysDataDictionaryItem protocolItem:ipsecProrocolList){
|
||||
if(Integer.parseInt(protocolItem.getItemCode())==protocol.intValue()){
|
||||
has=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("protocol"))+";");
|
||||
}
|
||||
}else {
|
||||
if(protocol!=0) {
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("protocol"))+";");
|
||||
}
|
||||
}
|
||||
}else if("tunnel".equals(specialItem)){
|
||||
for(SysDataDictionaryItem protocolItem:tunnelProrocolList){
|
||||
if("default".equals(protocolItem.getItemValue())){
|
||||
if(protocol.intValue()!=Integer.parseInt(protocolItem.getItemCode())){
|
||||
errInfo.append(String.format(prop.getProperty("must_be"), prop.getProperty("protocol"),Integer.parseInt(protocolItem.getItemCode()))+";");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
boolean has=false;
|
||||
for(SysDataDictionaryItem protocolItem:protocolList){
|
||||
if(Integer.parseInt(protocolItem.getItemCode())==protocol.intValue()){
|
||||
has=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("protocol"))+";");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//protocol check end
|
||||
// requestId check start
|
||||
Integer requestId=value.getRequestId();
|
||||
if(requestId==null){
|
||||
if("whitelistip".equals(specialItem)) {
|
||||
value.setRequestId(0);
|
||||
}else {
|
||||
errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("letter"))+";");
|
||||
}
|
||||
|
||||
}else{//查询数据库是否存在ID
|
||||
if("whitelistip".equals(specialItem)) {
|
||||
value.setRequestId(0);
|
||||
}else {
|
||||
RequestInfo info=requestInfoService.getRequestInfoById((long)requestId.intValue());
|
||||
if(info==null){
|
||||
errInfo.append(String.format(prop.getProperty("id_not_exists"),requestId, prop.getProperty("letter"))+";");
|
||||
}else if(info.getIsValid()==Constants.VALID_NO||info.getIsValid()==Constants.VALID_DEL){
|
||||
errInfo.append(String.format(prop.getProperty("id_not_valid"),requestId, prop.getProperty("letter"))+";");
|
||||
}
|
||||
}
|
||||
}
|
||||
// requestId check end
|
||||
//classification check start
|
||||
String classification=value.getClassify();
|
||||
if(StringUtils.isNotBlank(classification)){
|
||||
try{
|
||||
for(String classify:classification.split(",")){
|
||||
if(StringUtils.isNotBlank(classify)){
|
||||
int c=Integer.parseInt(classify);
|
||||
ServiceDictInfo dict=serviceDictInfoService.getDictById(c);
|
||||
if(dict==null){
|
||||
errInfo.append(String.format(prop.getProperty("id_not_exists"),classify, prop.getProperty("classification"))+";");
|
||||
}else if(dict.getIsValid()==Constants.VALID_NO||dict.getIsValid()==Constants.VALID_DEL){
|
||||
errInfo.append(String.format(prop.getProperty("id_not_valid"),classify, prop.getProperty("classification"))+";");
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
errInfo.append(String.format(prop.getProperty("num_split_by_comma"), prop.getProperty("classification"))+";");
|
||||
}
|
||||
}
|
||||
//classification check end
|
||||
//attribute check start
|
||||
String attributes=value.getAttribute();
|
||||
if(StringUtils.isNotBlank(attributes)){
|
||||
try{
|
||||
for(String attribute:attributes.split(",")){
|
||||
if(StringUtils.isNotBlank(attribute)){
|
||||
int c=Integer.parseInt(attribute);
|
||||
ServiceDictInfo dict=serviceDictInfoService.getDictById(c);
|
||||
if(dict==null){
|
||||
errInfo.append(String.format(prop.getProperty("id_not_exists"),attribute, prop.getProperty("attribute"))+";");
|
||||
}else if(dict.getIsValid()==Constants.VALID_NO||dict.getIsValid()==Constants.VALID_DEL){
|
||||
errInfo.append(String.format(prop.getProperty("id_not_valid"),attribute, prop.getProperty("attribute"))+";");
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
errInfo.append(String.format(prop.getProperty("num_split_by_comma"), prop.getProperty("attribute"))+";");
|
||||
}
|
||||
}
|
||||
//attribute check end
|
||||
//attribute check start
|
||||
String labels=value.getLable();
|
||||
if(StringUtils.isNotBlank(labels)){
|
||||
try{
|
||||
for(String label:labels.split(",")){
|
||||
if(StringUtils.isNotBlank(label)){
|
||||
int c=Integer.parseInt(label);
|
||||
ServiceDictInfo dict=serviceDictInfoService.getDictById(c);
|
||||
if(dict==null){
|
||||
errInfo.append(String.format(prop.getProperty("id_not_exists"),label, prop.getProperty("label"))+";");
|
||||
}else if(dict.getIsValid()==Constants.VALID_NO||dict.getIsValid()==Constants.VALID_DEL){
|
||||
errInfo.append(String.format(prop.getProperty("id_not_valid"),label, prop.getProperty("label"))+";");
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
errInfo.append(String.format(prop.getProperty("num_split_by_comma"), prop.getProperty("label"))+";");
|
||||
}
|
||||
}
|
||||
//group and ir_type check start
|
||||
if("ipmulitiplex".equals(specialItem)) {
|
||||
Integer irType= value.getIrType();
|
||||
if(irType==null) {
|
||||
errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("ir_type"))+";");
|
||||
}else {
|
||||
boolean has=false;
|
||||
for(SysDataDictionaryItem irTypeItem:irTypeList){
|
||||
if(Integer.parseInt(irTypeItem.getItemCode())==irType.intValue()){
|
||||
has=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("ir_type"))+";");
|
||||
}
|
||||
}
|
||||
Integer dnsStrategyId=value.getDnsStrategyId();
|
||||
if(dnsStrategyId==null) {
|
||||
errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("group_name"))+";");
|
||||
}else {
|
||||
PolicyGroupInfo group=policyGroupInfoService.getById(dnsStrategyId.intValue());
|
||||
if(group==null) {
|
||||
errInfo.append(String.format(prop.getProperty("id_not_exists"),dnsStrategyId, prop.getProperty("group_name"))+";");
|
||||
}else if(group.getIsValid()==Constants.VALID_DEL||group.getIsValid()==Constants.VALID_NO) {
|
||||
errInfo.append(String.format(prop.getProperty("id_not_valid"),dnsStrategyId, prop.getProperty("group_name"))+";");
|
||||
}
|
||||
}
|
||||
}
|
||||
if("ipratelimit".equals(specialItem)) {
|
||||
String ratelimit=value.getRatelimit();
|
||||
if(ratelimit==null) {
|
||||
errInfo.append(String.format(prop.getProperty("can_not_null"), prop.getProperty("ratelimit"))+";");
|
||||
}else {
|
||||
try {
|
||||
if(Double.parseDouble(ratelimit)<0||Double.parseDouble(ratelimit)>1) {
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("ratelimit_limit"))+";");
|
||||
}
|
||||
}catch (Exception e) {
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("ratelimit_limit"))+";");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//attribute check end
|
||||
if(StringUtils.isNotBlank(errInfo.toString())){
|
||||
msg.append(lineStart).append(errInfo);
|
||||
if(line<list.size()){
|
||||
msg.append("<br/>");
|
||||
}
|
||||
}
|
||||
//group and ir_type check end
|
||||
line++;
|
||||
}
|
||||
if(StringUtils.isNotBlank(msg.toString())){
|
||||
throw new MaatConvertException(prop.getProperty("save_failed")+"<br/>"+msg.toString());
|
||||
}*/
|
||||
}
|
||||
|
||||
public void checkIpCfg(int action,int functionId ,List<IpCfgTemplate> list) throws ServiceException{
|
||||
Properties prop=this.getMsgProp();
|
||||
List<SysDataDictionaryItem> ipTypeList = DictUtils.getDictList("IP_TYPE");
|
||||
@@ -1562,4 +2137,97 @@ public class BaseController {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 多域导入
|
||||
* @param redirectAttributes
|
||||
* @param files
|
||||
* @param serviceDictId
|
||||
* @param regionDictIds
|
||||
* @param requestId
|
||||
*/
|
||||
public void _import(RedirectAttributes redirectAttributes,MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
,String regionDictIds
|
||||
,Integer requestId) {
|
||||
try {
|
||||
FunctionServiceDict serviceDict=DictUtils.getFunctionServiceDict(serviceDictId);
|
||||
List<BaseIpCfg> ipPortCfgs=new ArrayList<BaseIpCfg>();
|
||||
List<CfgIndexInfo> cfgIndexInfos=new ArrayList<CfgIndexInfo>();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
MultipartFile file = files[i];
|
||||
ImportExcel ei = new ImportExcel(file, 0, 0);
|
||||
|
||||
FunctionRegionDict regionDict=DictUtils.getFunctionRegionDict(Integer.parseInt(regionDictIds.split(",")[i]));
|
||||
|
||||
if(regionDict.getIsMaat().equals(1)){
|
||||
if(regionDict.getRegionType().equals(1)){
|
||||
List<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class);
|
||||
ipPortCfgs=this.checkIpCfg(serviceDict,regionDict,list);
|
||||
Date date=new Date();
|
||||
for(BaseIpCfg cfg : ipPortCfgs){
|
||||
CfgIndexInfo cfgIndexInfo=new CfgIndexInfo();
|
||||
cfg.setAction(serviceDict.getAction());
|
||||
cfg.setAuditorId(UserUtils.getUser().getId());
|
||||
cfg.setAuditTime(date);
|
||||
cfg.setCfgRegionCode(regionDict.getConfigRegionCode());
|
||||
cfg.setCfgType(regionDict.getConfigRegionValue());
|
||||
cfg.setCreateTime(date);
|
||||
cfg.setCreatorId(UserUtils.getUser().getId());
|
||||
cfg.setDoLog(1);
|
||||
cfg.setFunctionId(regionDict.getFunctionId());
|
||||
cfg.setIsAudit(0);
|
||||
cfg.setIsValid(0);
|
||||
cfg.setIsAreaEffective(0);
|
||||
cfg.setAttribute("0");
|
||||
cfg.setClassify("0");
|
||||
cfg.setLable("0");
|
||||
cfg.setRequestId(StringUtil.isEmpty(requestId) ? 0:requestId);
|
||||
cfg.setServiceId(serviceDict.getServiceId());
|
||||
cfg.setTableName("ip_port_cfg");
|
||||
cfg.setCompileId(ipCfgService.getCompileId());
|
||||
|
||||
BeanUtils.copyProperties(cfg, cfgIndexInfo);
|
||||
cfgIndexInfos.add(cfgIndexInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ipCfgService.saveBatch(ipPortCfgs, IpCfgDao.class);
|
||||
ipCfgService.saveCfgIndexOf(cfgIndexInfos);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
addMessage(redirectAttributes, e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 多域配置导出
|
||||
* @param columns
|
||||
* @param model
|
||||
* @param request
|
||||
* @param response
|
||||
* @param entity
|
||||
* @param ids
|
||||
* @param redirectAttributes
|
||||
*/
|
||||
public void _export(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes
|
||||
,String functionName
|
||||
,List<String> titleList,Map<String, Class<?>> classMap,Map<String,List> dataMap
|
||||
,Map<String, String> noExportMap) throws Exception{
|
||||
//获取国际化配置
|
||||
Properties msgProp = getMsgProp();
|
||||
//获取分类、性质、标签
|
||||
List<ServiceDictInfo> fls=serviceDictInfoService.findAllFlDict();
|
||||
List<ServiceDictInfo> xzs=serviceDictInfoService.findAllXzDict();
|
||||
List<ServiceDictInfo> labels=serviceDictInfoService.findAllLableDict();
|
||||
Map<Object, Object> map=new HashMap<Object, Object>();
|
||||
map.put("fls", fls);
|
||||
map.put("xzs", xzs);
|
||||
map.put("labels", labels);
|
||||
|
||||
String fileName = msgProp.getProperty(functionName, functionName)+"_"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
|
||||
new ExportExcel(msgProp,titleList,noExportMap,classMap,1).setDataList(msgProp,dataMap,map).write(response, fileName).dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ package com.nis.web.controller.configuration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
@@ -18,26 +19,38 @@ import java.util.Properties;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.axis2.databinding.types.soapencoding.Array;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.HttpBodyCfg;
|
||||
import com.nis.domain.configuration.HttpReqHeadCfg;
|
||||
import com.nis.domain.configuration.HttpResHeadCfg;
|
||||
import com.nis.domain.configuration.HttpUrlCfg;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.IpCfgTemplate;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ExportExcel;
|
||||
import com.nis.util.excel.ImportExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.dao.configuration.IpCfgDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
/**
|
||||
* @ClassName: CommonController.java
|
||||
@@ -213,8 +226,7 @@ public class CommonController extends BaseController {
|
||||
addMessage(redirectAttributes, "audit_failed");
|
||||
}
|
||||
}
|
||||
public void _importIp(String cfgName,RedirectAttributes redirectAttributes,MultipartFile file,IpPortCfg ipCfg) {
|
||||
redirectAttributes.addAttribute("cfgName", cfgName);
|
||||
public void _importIp(RedirectAttributes redirectAttributes,MultipartFile file,IpPortCfg ipCfg) {
|
||||
try {
|
||||
ImportExcel ei = new ImportExcel(file, 0, 0);
|
||||
List<IpCfgTemplate> list = ei.getDataList(IpCfgTemplate.class);
|
||||
|
||||
@@ -2,7 +2,9 @@ package com.nis.web.controller.configuration.ntc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -18,18 +20,27 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.SysDataDictionaryItem;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.template.IpAddrTemplate;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.IpsecTemplate;
|
||||
import com.nis.domain.configuration.template.TunnelIpTemplate;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
import com.nis.util.excel.ExportExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.controller.configuration.CommonController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@@ -40,7 +51,7 @@ import com.nis.web.security.UserUtils;
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/ntc/iplist")
|
||||
public class IpController extends CommonController{
|
||||
public class IpController extends BaseController{
|
||||
@RequestMapping(value = {"list"})
|
||||
// @RequiresPermissions(value={"iplist:config","iplist:confirm"},logical=Logical.OR)
|
||||
public String list(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
@@ -140,7 +151,7 @@ public class IpController extends CommonController{
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+functionId;
|
||||
}
|
||||
//ip配置导入
|
||||
/*//ip配置导入
|
||||
@RequestMapping(value = "import", method=RequestMethod.POST)
|
||||
public String importIp(String cfgName,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("file") MultipartFile file,IpPortCfg cfg) {
|
||||
@@ -198,5 +209,137 @@ public class IpController extends CommonController{
|
||||
public void exportIp(String columns,Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")IpPortCfg entity,String ids,RedirectAttributes redirectAttributes){
|
||||
this._exportIp(columns,model, request, response, entity, ids, redirectAttributes);
|
||||
}*/
|
||||
|
||||
//模板下载
|
||||
@RequestMapping(value = "import/template")
|
||||
public void importFileTemplate(HttpServletRequest request,HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes
|
||||
,Integer serviceDictId
|
||||
,Integer regionDictId
|
||||
,Integer requestId
|
||||
) {
|
||||
try {
|
||||
FunctionRegionDict regionDict=DictUtils.getFunctionRegionDict(regionDictId);
|
||||
FunctionServiceDict serviceDict=DictUtils.getFunctionServiceDict(serviceDictId);
|
||||
exportTemplate(request,response,redirectAttributes,regionDict,serviceDict,requestId);
|
||||
} catch (Exception e) {
|
||||
logger.error("export_failed", e);
|
||||
}
|
||||
|
||||
}
|
||||
public void exportTemplate(HttpServletRequest request,HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes
|
||||
,FunctionRegionDict regionDict
|
||||
,FunctionServiceDict serviceDict
|
||||
,Integer requestId) throws Exception{
|
||||
String fileName = "test.xlsx";
|
||||
//maat导入模板
|
||||
if(regionDict.getIsMaat().equals(1)){
|
||||
//ip类模板
|
||||
if(regionDict.getRegionType().equals(1)){
|
||||
List<IpAllTemplate> classList=new ArrayList<IpAllTemplate>();
|
||||
ExportExcel excel=new ExportExcel(regionDict,this.getMsgProp(),null, IpAllTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}
|
||||
//str类模板
|
||||
if(regionDict.getRegionType().equals(2)){
|
||||
/*List<IpAllTemplate> classList=new ArrayList<IpAllTemplate>();
|
||||
ExportExcel excel=new ExportExcel(this.getMsgProp(),null, IpAllTemplate.class, 2,regionDict);
|
||||
excel.setDataList(this.getMsgProp(),classList,null).
|
||||
write(request,response, fileName).dispose();*/
|
||||
}
|
||||
//district类模板
|
||||
if(regionDict.getRegionType().equals(2)){
|
||||
/*ExportExcel excel=new ExportExcel(this.getMsgProp(),null, IpAllTemplate.class, 2,regionDict);
|
||||
excel.setDataList(this.getMsgProp(),classList,null).
|
||||
write(request,response, fileName).dispose();*/
|
||||
}
|
||||
}else{
|
||||
//非maat导入模板
|
||||
}
|
||||
}
|
||||
|
||||
//ip配置导入
|
||||
@RequestMapping(value = "import", method=RequestMethod.POST)
|
||||
public String importIp(RedirectAttributes redirectAttributes,
|
||||
@RequestParam("files") MultipartFile[] files
|
||||
,Integer serviceDictId
|
||||
,Integer requestId
|
||||
,String regionDictIds) {
|
||||
this._import(redirectAttributes, files,serviceDictId,regionDictIds,requestId);
|
||||
|
||||
return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+5;
|
||||
}
|
||||
|
||||
//ip配置导出
|
||||
@RequestMapping(value = "exportIpAddr")
|
||||
public void exportIp(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")CfgIndexInfo entity,String ids,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
|
||||
|
||||
/*//导出选中记录
|
||||
* if(!StringUtil.isEmpty(ids)){
|
||||
for(String id:ids.split(",")){
|
||||
Long.parseLong(id);
|
||||
}
|
||||
//List<CfgIndexInfo> list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids);
|
||||
}else{*/
|
||||
//条件导出数据大于最大导出数,只导出最大导出条数
|
||||
entity.setTableName(IpPortCfg.getTablename());
|
||||
Page<CfgIndexInfo> pageInfo=new Page<CfgIndexInfo>(request, response,"a");
|
||||
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 = ipCfgService.getIpCfgList(pageInfo, entity);
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("ip_addr");
|
||||
titleList.add("asn_policy");
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
classMap.put("ip_port_cfg", IpPortCfg.class);
|
||||
classMap.put("asn_policy", ConfigGroupInfo.class);
|
||||
String cfgIndexInfoNoExport=",group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortInfoNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
String asnGroupInfoNoExport="";
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
noExportMap.put("ip_addr", ipPortInfoNoExport);
|
||||
noExportMap.put("asn_policy", asnGroupInfoNoExport);
|
||||
List<IpPortCfg> ipList=new ArrayList<IpPortCfg>();
|
||||
List<ConfigGroupInfo> groupInfoList=new ArrayList<ConfigGroupInfo>();
|
||||
for (CfgIndexInfo cfg : page.getList()) {
|
||||
CfgIndexInfo cfgIndexInfo=ipCfgService.exportIpInfo(cfg);
|
||||
ipList.addAll(cfgIndexInfo.getIpPortList());
|
||||
if(!StringUtil.isEmpty(cfgIndexInfo.getAsnIpGroupName())){
|
||||
ConfigGroupInfo group=new ConfigGroupInfo();
|
||||
group.setCompileId(cfgIndexInfo.getCompileId());
|
||||
group.setGroupName(cfgIndexInfo.getAsnIpGroupName());
|
||||
groupInfoList.add(group);
|
||||
}
|
||||
}
|
||||
dataMap.put(entity.getMenuNameCode(), page.getList());
|
||||
dataMap.put("ip_addr", ipList);
|
||||
dataMap.put("asn_policy", groupInfoList);
|
||||
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("ip addr export failed",e);
|
||||
addMessage(redirectAttributes, "export_failed");
|
||||
}
|
||||
//return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,9 @@ package com.nis.web.controller.configuration.ntc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -19,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
@@ -26,6 +29,7 @@ import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.DnsResStrategy;
|
||||
import com.nis.domain.configuration.ComplexStringCfgTemplate;
|
||||
import com.nis.domain.configuration.template.IpCfgTemplate;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.domain.configuration.StringCfgTemplate;
|
||||
import com.nis.domain.configuration.HttpBodyCfg;
|
||||
import com.nis.domain.configuration.HttpReqHeadCfg;
|
||||
@@ -35,6 +39,8 @@ import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.util.excel.ImportExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
@@ -511,4 +517,128 @@ public class WebsiteController extends BaseController{
|
||||
return "redirect:" + adminPath +"/ntc/website/httpList?functionId="+cfgIndex.getFunctionId();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//ip配置导出
|
||||
@RequestMapping(value = "exportHttp")
|
||||
public String exportIp(Model model,HttpServletRequest request,HttpServletResponse response,
|
||||
@ModelAttribute("cfg")CfgIndexInfo entity,String ids,RedirectAttributes redirectAttributes){
|
||||
try {
|
||||
//export data info
|
||||
List<String> titleList=new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap=new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
Map<String, String> noExportMap=new HashMap<String, String>();
|
||||
|
||||
List<FunctionRegionDict> regionList = DictUtils.getFunctionRegionDictList(entity.getFunctionId());
|
||||
|
||||
/*//导出选中记录
|
||||
if(!StringUtil.isEmpty(ids)){
|
||||
for(String id:ids.split(",")){
|
||||
Long.parseLong(id);
|
||||
}
|
||||
//List<CfgIndexInfo> list=ipCfgService.getListByCfgIdWithName(IpPortCfg.getTablename(), entity.getFunctionId(), ids);
|
||||
}else{*/
|
||||
//条件导出数据大于最大导出数,只导出最大导出条数
|
||||
Page<CfgIndexInfo> pageInfo=new Page<CfgIndexInfo>(request, response,"a");
|
||||
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 = websiteCfgService.getWebsiteList(pageInfo, entity);
|
||||
|
||||
titleList.add(entity.getMenuNameCode());
|
||||
titleList.add("NTC_HTTP_URL");
|
||||
titleList.add("NTC_HTTP_REQ_HDR");
|
||||
titleList.add("NTC_HTTP_RES_HDR");
|
||||
titleList.add("NTC_HTTP_REQ_BODY");
|
||||
titleList.add("NTC_HTTP_RES_BODY");
|
||||
titleList.add("NTC_UNIVERSAL_IP");
|
||||
titleList.add("NTC_SUBSCRIBE_ID");
|
||||
classMap.put(entity.getMenuNameCode(), CfgIndexInfo.class);
|
||||
classMap.put("NTC_HTTP_URL", HttpUrlCfg.class);
|
||||
classMap.put("NTC_HTTP_REQ_HDR", HttpReqHeadCfg.class);
|
||||
classMap.put("NTC_HTTP_RES_HDR", HttpResHeadCfg.class);
|
||||
classMap.put("NTC_HTTP_REQ_BODY", HttpBodyCfg.class);
|
||||
classMap.put("NTC_HTTP_RES_BODY", HttpBodyCfg.class);
|
||||
classMap.put("NTC_UNIVERSAL_IP", IpPortCfg.class);
|
||||
classMap.put("NTC_SUBSCRIBE_ID", NtcSubscribeIdCfg.class);
|
||||
String cfgIndexInfoNoExport=",group_name,userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String httpUrlCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String httpReqHeadCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String httpResHeadCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String httpReqBodyCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String httpResBodyCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
String ipPortCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,ir_type,group_name,";
|
||||
String ntcSubscribeIdCfgNoExport=",do_log,action,config_describe,valid_identifier,is_audit,creator,creator"
|
||||
+ ",config_time,editor,edit_time,auditor,audit_time"
|
||||
+",letter,whether_area_block,classification,attribute,label"
|
||||
+",userregion1,userregion2,userregion3,userregion4,userregion5,";
|
||||
noExportMap.put(entity.getMenuNameCode(),cfgIndexInfoNoExport);
|
||||
noExportMap.put("NTC_HTTP_URL", httpUrlCfgNoExport);
|
||||
noExportMap.put("NTC_HTTP_REQ_HDR", httpReqHeadCfgNoExport);
|
||||
noExportMap.put("NTC_HTTP_RES_HDR", httpResHeadCfgNoExport);
|
||||
noExportMap.put("NTC_HTTP_REQ_BODY", httpReqBodyCfgNoExport);
|
||||
noExportMap.put("NTC_HTTP_RES_BODY", httpResBodyCfgNoExport);
|
||||
noExportMap.put("NTC_UNIVERSAL_IP", ipPortCfgNoExport);
|
||||
noExportMap.put("NTC_SUBSCRIBE_ID", ntcSubscribeIdCfgNoExport);
|
||||
|
||||
List<HttpUrlCfg> httpUrlList = new ArrayList<>();
|
||||
List<HttpReqHeadCfg> httpReqHdrList = new ArrayList<>();
|
||||
List<HttpResHeadCfg> httpResHdrList = new ArrayList<>();
|
||||
List<HttpBodyCfg> httpReqBodyList = new ArrayList<>();
|
||||
List<HttpBodyCfg> httpResBodyList = new ArrayList<>();
|
||||
List<IpPortCfg> ipPortList = new ArrayList<>();
|
||||
List<NtcSubscribeIdCfg> subscribeIdList = new ArrayList<>();
|
||||
for (CfgIndexInfo cfg : page.getList()) {
|
||||
Map<String, List> maps=websiteCfgService.exportHttpCfg(cfg);
|
||||
httpUrlList.addAll(maps.get("NTC_HTTP_URL"));
|
||||
httpReqHdrList.addAll(maps.get("NTC_HTTP_REQ_HDR"));
|
||||
httpResHdrList.addAll(maps.get("NTC_HTTP_RES_HDR"));
|
||||
httpReqBodyList.addAll(maps.get("NTC_HTTP_REQ_BODY"));
|
||||
httpResBodyList.addAll(maps.get("NTC_HTTP_RES_BODY"));
|
||||
ipPortList.addAll(maps.get("NTC_UNIVERSAL_IP"));
|
||||
subscribeIdList.addAll(maps.get("NTC_SUBSCRIBE_ID"));
|
||||
}
|
||||
|
||||
dataMap.put(entity.getMenuNameCode(), page.getList());
|
||||
dataMap.put("NTC_HTTP_URL", httpUrlList);
|
||||
dataMap.put("NTC_HTTP_REQ_HDR", httpReqHdrList);
|
||||
dataMap.put("NTC_HTTP_RES_HDR", httpResHdrList);
|
||||
dataMap.put("NTC_HTTP_REQ_BODY", httpReqBodyList);
|
||||
dataMap.put("NTC_HTTP_RES_BODY", httpResBodyList);
|
||||
dataMap.put("NTC_UNIVERSAL_IP", ipPortList);
|
||||
dataMap.put("NTC_SUBSCRIBE_ID",subscribeIdList);
|
||||
|
||||
/*}*/
|
||||
this._export(model, request, response, redirectAttributes,entity.getMenuNameCode(),titleList,classMap,dataMap,noExportMap);
|
||||
} catch (Exception e) {
|
||||
logger.error("http export failed",e);
|
||||
addMessage(redirectAttributes, "export_failed");
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/website/httpList?functionId="+entity.getFunctionId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public class ControlController extends CommonController {
|
||||
@RequestMapping(value = "/ip/import", method=RequestMethod.POST)
|
||||
public String importIp(String cfgName,RedirectAttributes redirectAttributes,
|
||||
@RequestParam("file") MultipartFile file,IpPortCfg cfg) {
|
||||
this._importIp(cfgName,redirectAttributes, file,cfg);
|
||||
//this._importIp(cfgName,redirectAttributes, file,cfg);
|
||||
redirectAttributes.addAttribute("urlPrefix","/proxy/control/ip");
|
||||
redirectAttributes.addAttribute("requiresPermissionPrefix","control:ip");
|
||||
return "redirect:" + adminPath +"/proxy/control/ip/list?functionId="+cfg.getFunctionId();
|
||||
|
||||
@@ -895,6 +895,15 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
public CfgIndexInfo exportIpInfo(CfgIndexInfo entity){
|
||||
List<IpPortCfg> ipPortList = ipCfgDao.getIpPortList(entity);
|
||||
entity.setIpPortList(ipPortList);
|
||||
if(StringUtils.isNotBlank(entity.getUserRegion4())) {
|
||||
ConfigGroupInfo info=specificServiceCfgDao.getConfigGroupInfoByGroupId(Integer.parseInt(entity.getUserRegion4().trim()));
|
||||
entity.setAsnIpGroupName(info.getGroupName());
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
public BaseIpCfg getIpCfgById(String tableName,long id){
|
||||
return ipCfgDao.getById(tableName, id);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.nis.web.service.configuration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -10,6 +11,7 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
@@ -76,6 +78,27 @@ public class WebsiteCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo> {
|
||||
entity.setNtcSubscribeIdCfgList(subscribeIdList);
|
||||
return entity;
|
||||
}
|
||||
public Map<String, List> exportHttpCfg(CfgIndexInfo entity){
|
||||
Map<String, List> dataMap=new HashMap<String, List>();
|
||||
List<IpPortCfg> ipPortList = websiteCfgDao.getIpPortList(entity);
|
||||
List<HttpUrlCfg> httpUrlList = websiteCfgDao.getHttpUrlList(entity);
|
||||
List<HttpReqHeadCfg> httpReqHdrList = websiteCfgDao.getHttpReqHdrList(entity);
|
||||
List<HttpResHeadCfg> httpResHdrList = websiteCfgDao.getHttpResHdrList(entity);
|
||||
List<NtcSubscribeIdCfg> subscribeIdList = stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity);
|
||||
entity.setCfgType(Constants.HTTP_REQ_BODY_REGION);
|
||||
List<HttpBodyCfg> httpReqBodyList = websiteCfgDao.getHttpReqBodyList(entity);
|
||||
entity.setCfgType(Constants.HTTP_RES_BODY_REGION);
|
||||
List<HttpBodyCfg> httpResBodyList = websiteCfgDao.getHttpResBodyList(entity);
|
||||
dataMap.put("NTC_UNIVERSAL_IP", ipPortList);
|
||||
dataMap.put("NTC_HTTP_URL", httpUrlList);
|
||||
dataMap.put("NTC_HTTP_REQ_HDR", httpReqHdrList);
|
||||
dataMap.put("NTC_HTTP_RES_HDR", httpResHdrList);
|
||||
dataMap.put("NTC_HTTP_REQ_BODY", httpReqBodyList);
|
||||
dataMap.put("NTC_HTTP_RES_BODY", httpResBodyList);
|
||||
dataMap.put("NTC_SUBSCRIBE_ID", subscribeIdList);
|
||||
|
||||
return dataMap;
|
||||
}
|
||||
public CfgIndexInfo getSslCfg(Long cfgId){
|
||||
CfgIndexInfo entity = websiteCfgDao.getCfgIndexInfo(cfgId);
|
||||
List<IpPortCfg> ipPortList = websiteCfgDao.getIpPortList(entity);
|
||||
|
||||
@@ -417,7 +417,7 @@ voip_file_type=,mp3,mp4,flv,ivf,mp2v,jpg,
|
||||
voip_single_file_max_size=10485760
|
||||
|
||||
#digest File Types
|
||||
digest_file_type=,txt,doc,img,docx,pptx,xlsx,xls,ppt,
|
||||
digest_file_type=,txt,doc,img,docx,pptx,xlsx,xls,ppt,mp4,flv,asf,wmv,avi,mpeg,mov,dat,m4v,m4p,m4b,webm,ogv,wav,mp3,
|
||||
#digest File Size 10M 10485760\uff08single\uff09
|
||||
digest_single_file_max_size=10485760
|
||||
#digest File Size 12M 12582912\uff08total\uff09
|
||||
|
||||
@@ -28,7 +28,7 @@ DELETE FROM av_sign_sample_cfg;
|
||||
INSERT INTO `av_sign_sample_cfg` VALUES ('10022', '1', '1', '0', '0', '16', '1', null, '0', '2018-09-06 15:56:53', null, null, '158', '2018-09-13 16:43:54', '266', '0', '0', '0', '0', '0', '0', '0', '33', '0', '0');
|
||||
DELETE FROM complex_keyword_cfg;
|
||||
#慎重清理config_group_info! 特定服务新增的时候会预制组号,清理之后组号找不到会影响下发
|
||||
#DELETE FROM config_group_info;
|
||||
DELETE FROM config_group_info;
|
||||
DELETE FROM ddos_ip_cfg;
|
||||
DELETE FROM dns_domain_cfg;
|
||||
DELETE FROM dns_ip_cfg;
|
||||
|
||||
162
src/main/webapp/WEB-INF/include/excel/importModal.jsp
Normal file
162
src/main/webapp/WEB-INF/include/excel/importModal.jsp
Normal file
@@ -0,0 +1,162 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8"%>
|
||||
<%@ include file="/WEB-INF/include/taglib.jsp"%>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
//console.log("调用须知:调用本页面函数在common.js里,并且需要配置字典MAAT_SERVICE中的项")
|
||||
});
|
||||
</script>
|
||||
<div class="modal fade" id="import_modal" tabindex="-1" role="dialog" aria-labelledby="mo" aria-hidden="true">
|
||||
<form id="importForm1" action="${ctx}/ntc/iplist/import" method="post" enctype="multipart/form-data" class="form-horizontal"
|
||||
onsubmit="loading('<spring:message code='loading'/>');">
|
||||
|
||||
<div class="modal-dialog" role="document" style="width:700px;">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel">
|
||||
<spring:message code="import" />
|
||||
</h5>
|
||||
<button type="button" class="close" data-dismiss="modal"
|
||||
aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="alert alert-error hide">
|
||||
<button class="close" data-dismiss="alert"></button>
|
||||
<span></span>
|
||||
</div>
|
||||
<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}">
|
||||
<c:forEach items="${fns:getDictList('MAAT_SERVICE')}" var="serviceC">
|
||||
<c:if test="${service.serviceId==serviceC.itemCode}">
|
||||
<span class="${serviceC.itemValue}">
|
||||
<input type="radio" name="serviceDictId" <c:if test="${serviceList.size() eq 1}">checked</c:if>
|
||||
serviceId="${service.serviceId }"
|
||||
functionId="${service.functionId }"
|
||||
cfgRegionCodeS="${service.regionCode }"
|
||||
protocolId="${service.protocolId }"
|
||||
action="${service.action }"
|
||||
value="${service.dictId }" class="required action">
|
||||
<c:forEach items="${fns:getDictList('SERVICE_ACTION') }" var="dict">
|
||||
<c:if test="${dict.itemCode eq service.action}">
|
||||
<spring:message code="${dict.itemValue }"/>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</span>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:if>
|
||||
</label>
|
||||
</c:forEach>
|
||||
</div>
|
||||
<div for="action"></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"> <spring:message
|
||||
code="cfg_type" />
|
||||
</label>
|
||||
<div class="col-md-6">
|
||||
<c:forEach items="${regionList}" var="region"
|
||||
varStatus="satus">
|
||||
<label class="radio-inline">
|
||||
<c:if test="${cfg.functionId eq region.functionId}">
|
||||
<span>
|
||||
<input type="radio" name="regionDictIds" class="required"
|
||||
value="${region.dictId }"
|
||||
regionValue="${region.configRegionValue }"
|
||||
regionType="${region.regionType }"
|
||||
isMaat="${region.isMaat }"
|
||||
cfgRegionCodeR="${region.configRegionCode }"
|
||||
configServiceType="${region.configServiceType }"
|
||||
configMultiKeywords="${region.configMultiKeywords }"
|
||||
configHex="${region.configHex }"
|
||||
configIpPortShow="${region.configIpPortShow}"
|
||||
configIpType="${region.configIpType}"
|
||||
configIpPattern="${region.configIpPattern}"
|
||||
configPortPattern="${region.configPortPattern}"
|
||||
configDirection="${region.configDirection}"
|
||||
configProtocol="${region.configProtocol}"
|
||||
<c:if test="${regionList.size() eq 1}">checked</c:if>
|
||||
>
|
||||
<spring:message code="${region.configRegionValue }"/>
|
||||
</span>
|
||||
</c:if>
|
||||
</label>
|
||||
</c:forEach>
|
||||
</div>
|
||||
<div for="action"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="letter"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="requestId" data-live-search="true" data-live-search-placeholder="search" class="selectpicker form-control required">
|
||||
<option value=""><spring:message code="select"/></option>
|
||||
<c:forEach items="${requestInfos}" var="requestInfo" varStatus="status">
|
||||
<c:if test="${requestInfo.isValid!=0 and requestInfo.isAudit!=3}">
|
||||
<option value="${requestInfo.id}"
|
||||
<c:if test="${status.index==0 }">selected</c:if>>${requestInfo.requestTitle}</option>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
<div for="requestId"></div>
|
||||
</div>
|
||||
</br>
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label" style="margin-top:5px;"><spring:message
|
||||
code="chooseFile" />:</label>
|
||||
<div class="controls">
|
||||
|
||||
<div class="fileupload fileupload-new"
|
||||
data-provides="fileupload">
|
||||
|
||||
<div class="input-append">
|
||||
|
||||
<div class="uneditable-input">
|
||||
<i class="fa fa-fa fa-file"></i> <span
|
||||
class="fileupload-preview"></span>
|
||||
</div>
|
||||
<span class="btn btn-file ">
|
||||
<button type="button" class="btn fileupload-new">
|
||||
<spring:message code="add" />
|
||||
</button>
|
||||
<button type="button" class="btn fileupload-exists">
|
||||
<spring:message code="edit" />
|
||||
</button> <input type="file" class="default" id="uploadFile"
|
||||
name="files" /> <input type="hidden" name="flag"
|
||||
value="${flag }" />
|
||||
</span>
|
||||
<button type="button" class="btn red fileupload-exists"
|
||||
data-dismiss="fileupload" style="margin-left:-1px;">
|
||||
<spring:message code="remove" />
|
||||
</a>
|
||||
<button type="button" onclick="downLoadTemplate('${ctx}')"
|
||||
class="btn black" style="margin-left:-1px">
|
||||
<spring:message code="download" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn red" onclick="importCfg()">
|
||||
<spring:message code="ok" />
|
||||
</button>
|
||||
<button type="button" class="btn" data-dismiss="modal">
|
||||
<spring:message code="close" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -92,6 +92,8 @@
|
||||
<script src="${pageContext.request.contextPath}/static/global/plugins/jquery-validation/1.11.0/localization/messages_en.js"></script>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
<script src="${pageContext.request.contextPath}/static/pages/scripts/importExcel.js" type="text/javascript"></script>
|
||||
|
||||
<script src="${pageContext.request.contextPath}/static/global/scripts/common.js" type="text/javascript"></script>
|
||||
<script src="${pageContext.request.contextPath}/static/global/scripts/jquery.tagsinput.js" type="text/javascript"></script>
|
||||
<script src="${pageContext.request.contextPath}/static/global/scripts/app.js" type="text/javascript"></script>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<%@ include file="/WEB-INF/include/taglib.jsp"%>
|
||||
<%@ attribute name="id" type="java.lang.String" required="true"%>
|
||||
<%@ attribute name="url" type="java.lang.String" required="true"%>
|
||||
<%@ attribute name="searchUrl" 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>
|
||||
@@ -25,7 +26,7 @@
|
||||
<a href="javascript:void(0);" onclick="cancelPassOpt('${url}')"><i class="fa fa-undo"></i> <spring:message code="cancel_approved"/></a>
|
||||
</c:when>
|
||||
<c:when test="${label eq 'export'}">
|
||||
<a href="javascript:void(0);" class="btn btn-default" onclick="exportData('${url}',${maxRow })" data-toggle="tooltip" data-placement="top">
|
||||
<a href="javascript:void(0);" class="btn btn-default" onclick="exportData('${url}',100000,'${searchUrl}')" data-toggle="tooltip" data-placement="top">
|
||||
<i class="fa fa-download"> <spring:message code="export"/></i>
|
||||
</a>
|
||||
</c:when>
|
||||
@@ -250,12 +251,12 @@ var checkboxes=$("#${id} ${value} tbody tr td input.i-checks:checkbox");
|
||||
});
|
||||
return flag;
|
||||
}
|
||||
//删除
|
||||
function exportData(url,maxRow){
|
||||
//导出
|
||||
function exportData(url,maxRow,searchUrl){
|
||||
var column=[];
|
||||
$("#${id} ${value} thead tr th").each(function(){
|
||||
if($(this).attr("exportColumn")){
|
||||
column.push($(this).attr("exportColumn"));
|
||||
if($(this).is(":visible")){
|
||||
column.push($(this).text().trim());
|
||||
}
|
||||
});
|
||||
if(column){
|
||||
@@ -280,6 +281,7 @@ var checkboxes=$("#${id} ${value} tbody tr td input.i-checks:checkbox");
|
||||
$("#searchForm").attr("action",url);
|
||||
$("#searchForm").submit();
|
||||
closeTip();
|
||||
$("#searchForm").attr("action",searchUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,11 +154,10 @@
|
||||
<form:select path="seltype" class="selectpicker select2 input-small" >
|
||||
<form:option value="cfgDesc"><spring:message code="config_describe"></spring:message></form:option>
|
||||
<form:option value="compileId"><spring:message code="cfg_id"/></form:option>
|
||||
<form:option value="voipIp.srcIpAddress"><spring:message code="client_ip"/></form:option>
|
||||
<form:option value="voipIp.srcPort"><spring:message code="client_port"/></form:option>
|
||||
<form:option value="voipAccount.cfgKeywords"><spring:message code="av_voip_account_control"/></form:option>
|
||||
<%--<form:option value="voipIp.srcIpAddress"><spring:message code="client_ip"/></form:option>
|
||||
<form:option value="voipIp.srcPort"><spring:message code="client_port"/></form:option>--> <form:option value="voipAccount.cfgKeywords"><spring:message code="av_voip_account_control"/></form:option>--%>
|
||||
<form:option value="action"><spring:message code="block_type"></spring:message></form:option>
|
||||
<form:option value="ntcSubscribeIdCfg.cfgKeywords"><spring:message code="NTC_SUBSCRIBE_ID"/></form:option>
|
||||
<%--<form:option value="ntcSubscribeIdCfg.cfgKeywords"><spring:message code="NTC_SUBSCRIBE_ID"/></form:option>--%>
|
||||
<form:option value="isValid"><spring:message code="valid_identifier"></spring:message></form:option>
|
||||
</form:select>
|
||||
|
||||
|
||||
@@ -143,7 +143,10 @@
|
||||
<form:select id="actionSelect" path="action" class="selectpicker select2 input-small" >
|
||||
<form:option value=""><spring:message code="select"/></form:option>
|
||||
<c:forEach items="${serviceList}" var="service">
|
||||
<form:option value="${service.action }"><spring:message code="${service.serviceName}"/></form:option>
|
||||
<c:if test="${service.serviceId ne 37 && service.serviceId ne 149}">
|
||||
<form:option value="${service.action }"><spring:message code="action_${service.actionCode }"/></form:option>
|
||||
</c:if>
|
||||
|
||||
</c:forEach>
|
||||
</form:select>
|
||||
<form:select path="isValid" class="selectpicker select2 input-small" >
|
||||
@@ -163,6 +166,7 @@
|
||||
<shiro:hasPermission name="iplist:config">
|
||||
<sys:delRow url="${ctx}/ntc/iplist/form" id="contentTable" label="update"></sys:delRow>
|
||||
<sys:delRow url="${ctx}/ntc/iplist/updateValid?isValid=-1&functionId=${cfg.functionId }" id="contentTable" label="delete"></sys:delRow>
|
||||
<%-- <sys:delRow url="${ctx}/ntc/iplist/exportIpAddr?functionId=${cfg.functionId }" searchUrl="${ctx}/ntc/iplist/list?functionId=${cfg.functionId}" id="contentTable" maxRow="10000" label="export"></sys:delRow> --%>
|
||||
</shiro:hasPermission>
|
||||
<shiro:hasPermission name="iplist:confirm">
|
||||
<div class="btn-group">
|
||||
|
||||
@@ -326,6 +326,7 @@
|
||||
<shiro:hasPermission name="website:http:config">
|
||||
<sys:delRow url="${ctx}/ntc/website/httpForm" 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/website/exportHttp?functionId=${cfg.functionId }" id="contentTable" searchUrl="${ctx}/ntc/website/httpList?functionId=${cfg.functionId}" label="export"></sys:delRow> --%>
|
||||
</shiro:hasPermission>
|
||||
<shiro:hasPermission name="website:http:confirm">
|
||||
<div class="btn-group">
|
||||
@@ -336,7 +337,7 @@
|
||||
<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/website/auditHttpCfg?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/website/auditHttpCfg?isAudit=3&isValid=0&functionId=${cfg.functionId }" searchUrl="${ctx}/ntc/website/httpList?functionId=${cfg.functionId}" maxRow="10000" id="contentTable" label="cancelPass"></sys:delRow></li>
|
||||
</ul>
|
||||
</div>
|
||||
</shiro:hasPermission>
|
||||
|
||||
@@ -52,11 +52,11 @@
|
||||
<form:option value=""><spring:message code="action"/></form:option>
|
||||
<c:forEach items="${serviceList}" var="service"
|
||||
varStatus="satus">
|
||||
<%-- <c:forEach items="${fns:getDictList('SERVICE_ACTION') }" var="dict"> --%>
|
||||
<c:if test="${(service.action ne 128) && (service.action ne 32) && (service.action ne 96)}">
|
||||
<form:option value="${service.serviceId}"><spring:message code="${service.serviceName}"/></form:option>
|
||||
<c:forEach items="${fns:getDictList('SERVICE_ACTION') }" var="dict">
|
||||
<c:if test="${(dict.itemCode eq service.action) && (service.action ne 128) && (service.action ne 32) && (service.action ne 96) && (service.serviceId ne 37)&& (service.serviceId ne 149) }">
|
||||
<form:option value="${dict.itemCode}"><spring:message code="${dict.itemValue}"/></form:option>
|
||||
</c:if>
|
||||
<%-- </c:forEach> --%>
|
||||
</c:forEach>
|
||||
</c:forEach>
|
||||
</form:select>
|
||||
</div>
|
||||
|
||||
@@ -365,24 +365,14 @@ function customColumnClick(){
|
||||
<%-- <c:forEach items="${fns:getDictList('SERVICE_ACTION')}" var="action"> --%>
|
||||
<c:forEach items="${serviceList}" var="service" varStatus="status">
|
||||
<%-- <c:if test="${service.functionId eq bean.functionId and action.itemCode eq service.action}"> --%>
|
||||
<c:if test="${service.serviceId ne 5}">
|
||||
<c:if test="${(service.action ne 128) && (service.action ne 32) && (service.action ne 96)}" >
|
||||
<c:if test="${(service.action ne 128) && (service.action ne 32) && (service.action ne 96) && (service.serviceId ne 37) && (service.serviceId ne 149)}" >
|
||||
<div data-service="${service.serviceId}" class="service btn">
|
||||
<spring:message code="${service.serviceName}"/>
|
||||
<spring:message code="log_total"/>
|
||||
<%-- <spring:message code="log_total"/> --%>
|
||||
<span>0</span>
|
||||
</div>
|
||||
</c:if>
|
||||
</c:if>
|
||||
<c:if test="${service.serviceId eq 5}">
|
||||
<c:if test="${(service.action ne 128) && (service.action ne 96)}" >
|
||||
<div data-service="${service.serviceId}" class="service btn">
|
||||
<spring:message code="${service.serviceName}"/>
|
||||
<spring:message code="log_total"/>
|
||||
<span>0</span>
|
||||
</div>
|
||||
</c:if>
|
||||
</c:if>
|
||||
|
||||
<%-- </c:if> --%>
|
||||
</c:forEach>
|
||||
<%-- </c:forEach> --%>
|
||||
|
||||
29
src/main/webapp/static/pages/scripts/importExcel.js
Normal file
29
src/main/webapp/static/pages/scripts/importExcel.js
Normal file
@@ -0,0 +1,29 @@
|
||||
$(function(){
|
||||
//打开导入modal
|
||||
$(".import").click(function(){
|
||||
$("#import_modal").modal({
|
||||
backdrop:"static",
|
||||
keyboard:false,
|
||||
show:true
|
||||
});
|
||||
});
|
||||
$("input[name='serviceDictId']").click(function(){
|
||||
});
|
||||
$("input[name='regionDictIds']").click(function(){
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 模板下载
|
||||
* TODO 后期修改为传入regionDictId
|
||||
* */
|
||||
function downLoadTemplate(path){
|
||||
var obj={
|
||||
"regionDictId":$("input[name='regionDictIds']:checked").val()
|
||||
,"serviceDictId":$("input[name='serviceDictId']:checked").val()
|
||||
,"requestId":$("select[name='requestId']").val()
|
||||
};
|
||||
var params = $.param(obj);
|
||||
document.location.href = path+'/ntc/iplist/import/template?' + params;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user