Merge branch 'develop' of http://10.0.6.99/gwall/gwall.git into develop
This commit is contained in:
@@ -0,0 +1,162 @@
|
||||
/**
|
||||
*@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;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* @Description: excel导入增强字符串类配置
|
||||
*/
|
||||
public class ComplexStringCfgTemplate {
|
||||
|
||||
/**
|
||||
* @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么)
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
|
||||
private String cfgKeywords;
|
||||
private String district;
|
||||
private Integer exprType ;
|
||||
private Integer matchMethod ;
|
||||
private Integer isHexbin;
|
||||
private Long cfgId;
|
||||
private String cfgDesc;
|
||||
private Integer requestId;
|
||||
private String requestName;
|
||||
private Integer isAreaEffective;
|
||||
private String classify;
|
||||
private String attribute;
|
||||
private String lable;
|
||||
private String classifyName;
|
||||
private String attributeName;
|
||||
private String lableName;
|
||||
private String areaEffectiveIds ;
|
||||
|
||||
@ExcelField(title="expression_type",align=2,sort=20)
|
||||
public Integer getExprType() {
|
||||
return exprType;
|
||||
}
|
||||
public void setExprType(Integer exprType) {
|
||||
this.exprType = exprType;
|
||||
}
|
||||
@ExcelField(title="match_method",align=2,sort=30)
|
||||
public Integer getMatchMethod() {
|
||||
return matchMethod;
|
||||
}
|
||||
public void setMatchMethod(Integer matchMethod) {
|
||||
this.matchMethod = matchMethod;
|
||||
}
|
||||
@ExcelField(title="whether_hexbinary",align=2,sort=40)
|
||||
public Integer getIsHexbin() {
|
||||
return isHexbin;
|
||||
}
|
||||
public void setIsHexbin(Integer isHexbin) {
|
||||
this.isHexbin = isHexbin;
|
||||
}
|
||||
@ExcelField(title="keywords",align=2,sort=10)
|
||||
public String getCfgKeywords() {
|
||||
return cfgKeywords;
|
||||
}
|
||||
public void setCfgKeywords(String cfgKeywords) {
|
||||
this.cfgKeywords = cfgKeywords;
|
||||
}
|
||||
public Long getCfgId() {
|
||||
return cfgId;
|
||||
}
|
||||
public void setCfgId(Long cfgId) {
|
||||
this.cfgId = cfgId;
|
||||
}
|
||||
@ExcelField(title="config_describe",align=2,sort=12)
|
||||
public String getCfgDesc() {
|
||||
return cfgDesc;
|
||||
}
|
||||
public void setCfgDesc(String cfgDesc) {
|
||||
this.cfgDesc = cfgDesc;
|
||||
}
|
||||
@ExcelField(title="letter",align=2,sort=13)
|
||||
public Integer getRequestId() {
|
||||
return requestId;
|
||||
}
|
||||
public void setRequestId(Integer requestId) {
|
||||
this.requestId = requestId;
|
||||
}
|
||||
public String getRequestName() {
|
||||
return requestName;
|
||||
}
|
||||
public void setRequestName(String requestName) {
|
||||
this.requestName = requestName;
|
||||
}
|
||||
public Integer getIsAreaEffective() {
|
||||
return isAreaEffective;
|
||||
}
|
||||
public void setIsAreaEffective(Integer isAreaEffective) {
|
||||
this.isAreaEffective = isAreaEffective;
|
||||
}
|
||||
@ExcelField(title="classification",align=2,sort=71)
|
||||
public String getClassify() {
|
||||
return classify;
|
||||
}
|
||||
public void setClassify(String classify) {
|
||||
this.classify = classify;
|
||||
}
|
||||
@ExcelField(title="attribute",align=2,sort=72)
|
||||
public String getAttribute() {
|
||||
return attribute;
|
||||
}
|
||||
public void setAttribute(String attribute) {
|
||||
this.attribute = attribute;
|
||||
}
|
||||
@ExcelField(title="label",align=2,sort=73)
|
||||
public String getLable() {
|
||||
return lable;
|
||||
}
|
||||
public void setLable(String lable) {
|
||||
this.lable = lable;
|
||||
}
|
||||
public String getClassifyName() {
|
||||
return classifyName;
|
||||
}
|
||||
public void setClassifyName(String classifyName) {
|
||||
this.classifyName = classifyName;
|
||||
}
|
||||
public String getAttributeName() {
|
||||
return attributeName;
|
||||
}
|
||||
public void setAttributeName(String attributeName) {
|
||||
this.attributeName = attributeName;
|
||||
}
|
||||
public String getLableName() {
|
||||
return lableName;
|
||||
}
|
||||
public void setLableName(String lableName) {
|
||||
this.lableName = lableName;
|
||||
}
|
||||
// @ExcelField(title="area_effective",align=2,sort=70)
|
||||
public String getAreaEffectiveIds() {
|
||||
return areaEffectiveIds;
|
||||
}
|
||||
public void setAreaEffectiveIds(String areaEffectiveIds) {
|
||||
this.areaEffectiveIds = areaEffectiveIds;
|
||||
}
|
||||
@ExcelField(title="district",align=2,sort=11)
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
public void setDistrict(String district) {
|
||||
this.district = district;
|
||||
}
|
||||
}
|
||||
195
src/main/java/com/nis/domain/configuration/IpCfgTemplate.java
Normal file
195
src/main/java/com/nis/domain/configuration/IpCfgTemplate.java
Normal file
@@ -0,0 +1,195 @@
|
||||
/**
|
||||
*@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;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* @Description: excel导入IP类配置
|
||||
*/
|
||||
public class IpCfgTemplate {
|
||||
|
||||
/**
|
||||
* @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么)
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
|
||||
|
||||
private Long cfgId;
|
||||
private Integer ipType;
|
||||
private Integer ipPattern;
|
||||
private String srcIpAddress;
|
||||
private String destIpAddress;
|
||||
private Integer portPattern;
|
||||
private String srcPort;
|
||||
private String destPort;
|
||||
private Integer protocol;
|
||||
protected Integer direction ;
|
||||
private String cfgDesc;
|
||||
private Integer requestId;
|
||||
private String requestName;
|
||||
private Integer isAreaEffective;
|
||||
private String classify;
|
||||
private String attribute;
|
||||
private String lable;
|
||||
private String classifyName;
|
||||
private String attributeName;
|
||||
private String lableName;
|
||||
private String areaEffectiveIds ;
|
||||
|
||||
@ExcelField(title="ip_type",align=2,sort=1)
|
||||
public Integer getIpType() {
|
||||
return ipType;
|
||||
}
|
||||
public void setIpType(Integer ipType) {
|
||||
this.ipType = ipType;
|
||||
}
|
||||
@ExcelField(title="ip_pattern",align=2,sort=2)
|
||||
public Integer getIpPattern() {
|
||||
return ipPattern;
|
||||
}
|
||||
public void setIpPattern(Integer ipPattern) {
|
||||
this.ipPattern = ipPattern;
|
||||
}
|
||||
@ExcelField(title="client_ip",align=2,sort=3)
|
||||
public String getSrcIpAddress() {
|
||||
return srcIpAddress;
|
||||
}
|
||||
public void setSrcIpAddress(String srcIpAddress) {
|
||||
this.srcIpAddress = srcIpAddress;
|
||||
}
|
||||
@ExcelField(title="server_ip",align=2,sort=4)
|
||||
public String getDestIpAddress() {
|
||||
return destIpAddress;
|
||||
}
|
||||
public void setDestIpAddress(String destIpAddress) {
|
||||
this.destIpAddress = destIpAddress;
|
||||
}
|
||||
@ExcelField(title="port_pattern",align=2,sort=5)
|
||||
public Integer getPortPattern() {
|
||||
return portPattern;
|
||||
}
|
||||
public void setPortPattern(Integer portPattern) {
|
||||
this.portPattern = portPattern;
|
||||
}
|
||||
@ExcelField(title="client_port",align=2,sort=6)
|
||||
public String getSrcPort() {
|
||||
return srcPort;
|
||||
}
|
||||
public void setSrcPort(String srcPort) {
|
||||
this.srcPort = srcPort;
|
||||
}
|
||||
@ExcelField(title="server_port",align=2,sort=7)
|
||||
public String getDestPort() {
|
||||
return destPort;
|
||||
}
|
||||
public void setDestPort(String destPort) {
|
||||
this.destPort = destPort;
|
||||
}
|
||||
public Long getCfgId() {
|
||||
return cfgId;
|
||||
}
|
||||
public void setCfgId(Long cfgId) {
|
||||
this.cfgId = cfgId;
|
||||
}
|
||||
@ExcelField(title="direction",align=2,sort=8)
|
||||
public Integer getDirection() {
|
||||
return direction;
|
||||
}
|
||||
public void setDirection(Integer direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
@ExcelField(title="config_describe",align=2,sort=11)
|
||||
public String getCfgDesc() {
|
||||
return cfgDesc;
|
||||
}
|
||||
public void setCfgDesc(String cfgDesc) {
|
||||
this.cfgDesc = cfgDesc;
|
||||
}
|
||||
@ExcelField(title="letter",align=2,sort=13)
|
||||
public Integer getRequestId() {
|
||||
return requestId;
|
||||
}
|
||||
public void setRequestId(Integer requestId) {
|
||||
this.requestId = requestId;
|
||||
}
|
||||
public String getRequestName() {
|
||||
return requestName;
|
||||
}
|
||||
public void setRequestName(String requestName) {
|
||||
this.requestName = requestName;
|
||||
}
|
||||
public Integer getIsAreaEffective() {
|
||||
return isAreaEffective;
|
||||
}
|
||||
public void setIsAreaEffective(Integer isAreaEffective) {
|
||||
this.isAreaEffective = isAreaEffective;
|
||||
}
|
||||
@ExcelField(title="classification",align=2,sort=71)
|
||||
public String getClassify() {
|
||||
return classify;
|
||||
}
|
||||
public void setClassify(String classify) {
|
||||
this.classify = classify;
|
||||
}
|
||||
@ExcelField(title="attribute",align=2,sort=72)
|
||||
public String getAttribute() {
|
||||
return attribute;
|
||||
}
|
||||
public void setAttribute(String attribute) {
|
||||
this.attribute = attribute;
|
||||
}
|
||||
@ExcelField(title="label",align=2,sort=73)
|
||||
public String getLable() {
|
||||
return lable;
|
||||
}
|
||||
public void setLable(String lable) {
|
||||
this.lable = lable;
|
||||
}
|
||||
public String getClassifyName() {
|
||||
return classifyName;
|
||||
}
|
||||
public void setClassifyName(String classifyName) {
|
||||
this.classifyName = classifyName;
|
||||
}
|
||||
public String getAttributeName() {
|
||||
return attributeName;
|
||||
}
|
||||
public void setAttributeName(String attributeName) {
|
||||
this.attributeName = attributeName;
|
||||
}
|
||||
public String getLableName() {
|
||||
return lableName;
|
||||
}
|
||||
public void setLableName(String lableName) {
|
||||
this.lableName = lableName;
|
||||
}
|
||||
// @ExcelField(title="area_effective",align=2,sort=70)
|
||||
public String getAreaEffectiveIds() {
|
||||
return areaEffectiveIds;
|
||||
}
|
||||
public void setAreaEffectiveIds(String areaEffectiveIds) {
|
||||
this.areaEffectiveIds = areaEffectiveIds;
|
||||
}
|
||||
@ExcelField(title="protocol",align=2,sort=9)
|
||||
public Integer getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
public void setProtocol(Integer protocol) {
|
||||
this.protocol = protocol;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
/**
|
||||
*@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;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* @Description: excel导入字符串类配置
|
||||
*/
|
||||
public class StringCfgTemplate {
|
||||
|
||||
/**
|
||||
* @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么)
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
|
||||
private String cfgKeywords;
|
||||
private Integer exprType ;
|
||||
private Integer matchMethod ;
|
||||
private Integer isHexbin;
|
||||
private Long cfgId;
|
||||
private String cfgDesc;
|
||||
private Integer requestId;
|
||||
private String requestName;
|
||||
private Integer isAreaEffective;
|
||||
private String classify;
|
||||
private String attribute;
|
||||
private String lable;
|
||||
private String classifyName;
|
||||
private String attributeName;
|
||||
private String lableName;
|
||||
private String areaEffectiveIds ;
|
||||
|
||||
@ExcelField(title="expression_type",align=2,sort=20)
|
||||
public Integer getExprType() {
|
||||
return exprType;
|
||||
}
|
||||
public void setExprType(Integer exprType) {
|
||||
this.exprType = exprType;
|
||||
}
|
||||
@ExcelField(title="match_method",align=2,sort=30)
|
||||
public Integer getMatchMethod() {
|
||||
return matchMethod;
|
||||
}
|
||||
public void setMatchMethod(Integer matchMethod) {
|
||||
this.matchMethod = matchMethod;
|
||||
}
|
||||
@ExcelField(title="whether_hexbinary",align=2,sort=40)
|
||||
public Integer getIsHexbin() {
|
||||
return isHexbin;
|
||||
}
|
||||
public void setIsHexbin(Integer isHexbin) {
|
||||
this.isHexbin = isHexbin;
|
||||
}
|
||||
@ExcelField(title="keywords",align=2,sort=11)
|
||||
public String getCfgKeywords() {
|
||||
return cfgKeywords;
|
||||
}
|
||||
public void setCfgKeywords(String cfgKeywords) {
|
||||
this.cfgKeywords = cfgKeywords;
|
||||
}
|
||||
public Long getCfgId() {
|
||||
return cfgId;
|
||||
}
|
||||
public void setCfgId(Long cfgId) {
|
||||
this.cfgId = cfgId;
|
||||
}
|
||||
@ExcelField(title="config_describe",align=2,sort=10)
|
||||
public String getCfgDesc() {
|
||||
return cfgDesc;
|
||||
}
|
||||
public void setCfgDesc(String cfgDesc) {
|
||||
this.cfgDesc = cfgDesc;
|
||||
}
|
||||
@ExcelField(title="letter",align=2,sort=12)
|
||||
public Integer getRequestId() {
|
||||
return requestId;
|
||||
}
|
||||
public void setRequestId(Integer requestId) {
|
||||
this.requestId = requestId;
|
||||
}
|
||||
public String getRequestName() {
|
||||
return requestName;
|
||||
}
|
||||
public void setRequestName(String requestName) {
|
||||
this.requestName = requestName;
|
||||
}
|
||||
public Integer getIsAreaEffective() {
|
||||
return isAreaEffective;
|
||||
}
|
||||
public void setIsAreaEffective(Integer isAreaEffective) {
|
||||
this.isAreaEffective = isAreaEffective;
|
||||
}
|
||||
@ExcelField(title="classification",align=2,sort=71)
|
||||
public String getClassify() {
|
||||
return classify;
|
||||
}
|
||||
public void setClassify(String classify) {
|
||||
this.classify = classify;
|
||||
}
|
||||
@ExcelField(title="attribute",align=2,sort=72)
|
||||
public String getAttribute() {
|
||||
return attribute;
|
||||
}
|
||||
public void setAttribute(String attribute) {
|
||||
this.attribute = attribute;
|
||||
}
|
||||
@ExcelField(title="label",align=2,sort=73)
|
||||
public String getLable() {
|
||||
return lable;
|
||||
}
|
||||
public void setLable(String lable) {
|
||||
this.lable = lable;
|
||||
}
|
||||
public String getClassifyName() {
|
||||
return classifyName;
|
||||
}
|
||||
public void setClassifyName(String classifyName) {
|
||||
this.classifyName = classifyName;
|
||||
}
|
||||
public String getAttributeName() {
|
||||
return attributeName;
|
||||
}
|
||||
public void setAttributeName(String attributeName) {
|
||||
this.attributeName = attributeName;
|
||||
}
|
||||
public String getLableName() {
|
||||
return lableName;
|
||||
}
|
||||
public void setLableName(String lableName) {
|
||||
this.lableName = lableName;
|
||||
}
|
||||
// @ExcelField(title="area_effective",align=2,sort=70)
|
||||
public String getAreaEffectiveIds() {
|
||||
return areaEffectiveIds;
|
||||
}
|
||||
public void setAreaEffectiveIds(String areaEffectiveIds) {
|
||||
this.areaEffectiveIds = areaEffectiveIds;
|
||||
}
|
||||
}
|
||||
@@ -264,7 +264,7 @@ public class ExportExcel {
|
||||
t = ss[0];
|
||||
}
|
||||
}
|
||||
headerList.add(msgProp.getProperty(t));
|
||||
headerList.add(msgProp.getProperty(t)==null?t:msgProp.getProperty(t));
|
||||
}
|
||||
initialize(title, headerList);
|
||||
}
|
||||
|
||||
@@ -167,7 +167,12 @@ public class ImportExcel {
|
||||
* @return
|
||||
*/
|
||||
public int getLastDataRowNum(){
|
||||
return this.sheet.getLastRowNum()+headerNum;
|
||||
if(headerNum==0){
|
||||
return this.sheet.getLastRowNum()+getDataRowNum();
|
||||
}else{
|
||||
return this.sheet.getLastRowNum()+headerNum;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
@@ -23,6 +24,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.ServiceConfigInfo;
|
||||
@@ -36,15 +38,19 @@ import com.nis.domain.configuration.BaseCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexStringCfgTemplate;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.IpCfgTemplate;
|
||||
import com.nis.domain.configuration.NumBoundaryCfg;
|
||||
import com.nis.domain.configuration.RequestInfo;
|
||||
import com.nis.domain.configuration.StringCfgTemplate;
|
||||
import com.nis.util.Configurations;
|
||||
//import com.nis.main.ConvertTool;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DateUtils;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.JsonMapper;
|
||||
import com.nis.util.excel.ExportExcel;
|
||||
import com.nis.web.service.ArchiveServcie;
|
||||
import com.nis.web.service.AreaService;
|
||||
import com.nis.web.service.DictService;
|
||||
@@ -432,4 +438,36 @@ public class BaseController {
|
||||
}
|
||||
return msgProp;
|
||||
}
|
||||
public void importCfgTemplate(HttpServletRequest request,HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes,Integer functionId,Integer cfgRegionCode){
|
||||
Properties msgProp = getMsgProp();
|
||||
try {
|
||||
List<FunctionRegionDict> dictList = DictUtils.getFunctionRegionDictList(functionId);
|
||||
for(FunctionRegionDict dict:dictList){
|
||||
if(dict.getConfigRegionCode()==cfgRegionCode){
|
||||
String fileName = dict.getConfigRegionValue()+".xlsx";
|
||||
if(dict.getRegionType()==1){
|
||||
List<IpCfgTemplate> list = Lists.newArrayList();
|
||||
list.add(new IpCfgTemplate());
|
||||
new ExportExcel(msgProp,null, IpCfgTemplate.class, 2).setDataList(list).
|
||||
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(list).
|
||||
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(list).
|
||||
write(request,response, fileName).dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
msgProp = null;
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,39 +2,38 @@ 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;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authz.annotation.Logical;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
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.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.DnsDomainCfg;
|
||||
import com.nis.domain.configuration.ComplexStringCfgTemplate;
|
||||
import com.nis.domain.configuration.IpCfgTemplate;
|
||||
import com.nis.domain.configuration.StringCfgTemplate;
|
||||
import com.nis.domain.configuration.HttpBodyCfg;
|
||||
import com.nis.domain.configuration.HttpReqHeadCfg;
|
||||
import com.nis.domain.configuration.HttpResHeadCfg;
|
||||
import com.nis.domain.configuration.HttpUrlCfg;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.SslKeywordCfg;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.excel.ImportExcel;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@@ -364,4 +363,117 @@ public class WebsiteController extends BaseController{
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/website/dnsList?functionId="+functionId;
|
||||
}
|
||||
//下载导入模板
|
||||
@RequestMapping(value = "import/template")
|
||||
public void importFileTemplate(HttpServletRequest request,HttpServletResponse response,
|
||||
RedirectAttributes redirectAttributes,Integer functionId,Integer cfgRegionCode) {
|
||||
this.importCfgTemplate(request, response, redirectAttributes, functionId, cfgRegionCode);
|
||||
}
|
||||
//http配置导入
|
||||
@RequestMapping(value = "importHttp", method=RequestMethod.POST)
|
||||
public String importHttpFile(HttpServletRequest request,Model model,HttpServletResponse response, RedirectAttributes redirectAttributes,
|
||||
@RequestParam("file") MultipartFile file,CfgIndexInfo cfgIndex,Integer protocolId) {
|
||||
try {
|
||||
ImportExcel ei = new ImportExcel(file, 0, 0);
|
||||
if(cfgIndex.getCfgType().equals(Constants.HTTP_IP_REGION)){
|
||||
List<IpCfgTemplate> list = ei.getDataList(IpCfgTemplate.class);
|
||||
for(IpCfgTemplate cfg : list){
|
||||
List<IpPortCfg> ipList = new ArrayList();
|
||||
BeanUtils.copyProperties(cfg, cfgIndex);
|
||||
IpPortCfg ip = new IpPortCfg();
|
||||
BeanUtils.copyProperties(cfg, ip);
|
||||
ip.setProtocolId(protocolId);
|
||||
ip.setCfgRegionCode(cfgIndex.getCfgRegionCode());
|
||||
ip.setCfgType(cfgIndex.getCfgType());
|
||||
ipList.add(ip);
|
||||
cfgIndex.setIpPortList(ipList);
|
||||
cfgIndex.setIsAreaEffective(0);
|
||||
websiteCfgService.saveHttpCfg(cfgIndex);
|
||||
}
|
||||
|
||||
}else if(cfgIndex.getCfgType().equals(Constants.HTTP_URL_REGION)){
|
||||
List<StringCfgTemplate> list = ei.getDataList(StringCfgTemplate.class);
|
||||
for(StringCfgTemplate cfg : list){
|
||||
List<HttpUrlCfg> urlList = new ArrayList();
|
||||
BeanUtils.copyProperties(cfg, cfgIndex);
|
||||
HttpUrlCfg url = new HttpUrlCfg();
|
||||
BeanUtils.copyProperties(cfg, url);
|
||||
url.setCfgRegionCode(cfgIndex.getCfgRegionCode());
|
||||
url.setCfgType(cfgIndex.getCfgType());
|
||||
urlList.add(url);
|
||||
cfgIndex.setHttpUrlList(urlList);
|
||||
cfgIndex.setIsAreaEffective(0);
|
||||
websiteCfgService.saveHttpCfg(cfgIndex);
|
||||
}
|
||||
|
||||
}else if(cfgIndex.getCfgType().equals(Constants.HTTP_REQ_HEAD_REGION)){
|
||||
List<ComplexStringCfgTemplate> list = ei.getDataList(ComplexStringCfgTemplate.class);
|
||||
for(ComplexStringCfgTemplate cfg : list){
|
||||
List<HttpReqHeadCfg> headList = new ArrayList();
|
||||
BeanUtils.copyProperties(cfg, cfgIndex);
|
||||
HttpReqHeadCfg head = new HttpReqHeadCfg();
|
||||
BeanUtils.copyProperties(cfg, head);
|
||||
head.setCfgRegionCode(cfgIndex.getCfgRegionCode());
|
||||
head.setCfgType(cfgIndex.getCfgType());
|
||||
headList.add(head);
|
||||
cfgIndex.setHttpReqHdrList(headList);
|
||||
cfgIndex.setIsAreaEffective(0);
|
||||
websiteCfgService.saveHttpCfg(cfgIndex);
|
||||
}
|
||||
|
||||
}else if(cfgIndex.getCfgType().equals(Constants.HTTP_REQ_BODY_REGION)){
|
||||
List<StringCfgTemplate> list = ei.getDataList(StringCfgTemplate.class);
|
||||
for(StringCfgTemplate cfg : list){
|
||||
List<HttpBodyCfg> bodyList = new ArrayList();
|
||||
BeanUtils.copyProperties(cfg, cfgIndex);
|
||||
HttpBodyCfg body = new HttpBodyCfg();
|
||||
BeanUtils.copyProperties(cfg, body);
|
||||
body.setCfgRegionCode(cfgIndex.getCfgRegionCode());
|
||||
body.setCfgType(cfgIndex.getCfgType());
|
||||
bodyList.add(body);
|
||||
cfgIndex.setHttpReqBodyList(bodyList);
|
||||
cfgIndex.setIsAreaEffective(0);
|
||||
websiteCfgService.saveHttpCfg(cfgIndex);
|
||||
}
|
||||
|
||||
}else if(cfgIndex.getCfgType().equals(Constants.HTTP_RES_HEAD_REGION)){
|
||||
List<ComplexStringCfgTemplate> list = ei.getDataList(ComplexStringCfgTemplate.class);
|
||||
for(ComplexStringCfgTemplate cfg : list){
|
||||
List<HttpResHeadCfg> headList = new ArrayList();
|
||||
BeanUtils.copyProperties(cfg, cfgIndex);
|
||||
HttpResHeadCfg head = new HttpResHeadCfg();
|
||||
BeanUtils.copyProperties(cfg, head);
|
||||
head.setCfgRegionCode(cfgIndex.getCfgRegionCode());
|
||||
head.setCfgType(cfgIndex.getCfgType());
|
||||
headList.add(head);
|
||||
cfgIndex.setHttpResHdrList(headList);
|
||||
cfgIndex.setIsAreaEffective(0);
|
||||
websiteCfgService.saveHttpCfg(cfgIndex);
|
||||
}
|
||||
|
||||
}else if(cfgIndex.getCfgType().equals(Constants.HTTP_RES_BODY_REGION)){
|
||||
List<StringCfgTemplate> list = ei.getDataList(StringCfgTemplate.class);
|
||||
for(StringCfgTemplate cfg : list){
|
||||
List<HttpBodyCfg> bodyList = new ArrayList();
|
||||
BeanUtils.copyProperties(cfg, cfgIndex);
|
||||
HttpBodyCfg body = new HttpBodyCfg();
|
||||
BeanUtils.copyProperties(cfg, body);
|
||||
body.setCfgRegionCode(cfgIndex.getCfgRegionCode());
|
||||
body.setCfgType(cfgIndex.getCfgType());
|
||||
bodyList.add(body);
|
||||
cfgIndex.setHttpResBodyList(bodyList);
|
||||
cfgIndex.setIsAreaEffective(0);
|
||||
websiteCfgService.saveHttpCfg(cfgIndex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
addMessage(redirectAttributes, e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/website/httpList?functionId="+cfgIndex.getFunctionId();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user