(1)app domain导入提交
(2)asn no字段扩展为long类型,数据库对应字段扩展为bigint
This commit is contained in:
@@ -22,7 +22,7 @@ public class PolicyGroupInfo extends BaseCfg<PolicyGroupInfo> implements Seriali
|
|||||||
private Integer groupType;
|
private Integer groupType;
|
||||||
private Integer serviceGroupId;
|
private Integer serviceGroupId;
|
||||||
private String description;
|
private String description;
|
||||||
private Integer asnNo;
|
private Long asnNo;
|
||||||
|
|
||||||
public Integer getServiceGroupId() {
|
public Integer getServiceGroupId() {
|
||||||
return serviceGroupId;
|
return serviceGroupId;
|
||||||
@@ -66,10 +66,10 @@ public class PolicyGroupInfo extends BaseCfg<PolicyGroupInfo> implements Seriali
|
|||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
public Integer getAsnNo() {
|
public Long getAsnNo() {
|
||||||
return asnNo;
|
return asnNo;
|
||||||
}
|
}
|
||||||
public void setAsnNo(Integer asnNo) {
|
public void setAsnNo(Long asnNo) {
|
||||||
this.asnNo = asnNo;
|
this.asnNo = asnNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,14 @@ public class BaseStringCfg<T> extends BaseCfg<T> {
|
|||||||
protected Integer appCode;//仅用于copy属性使用
|
protected Integer appCode;//仅用于copy属性使用
|
||||||
protected Integer behavCode;//仅用于copy属性使用
|
protected Integer behavCode;//仅用于copy属性使用
|
||||||
protected Integer specServiceId;//仅用于copy属性使用
|
protected Integer specServiceId;//仅用于copy属性使用
|
||||||
|
protected String domain;//仅用于copy属性使用
|
||||||
|
|
||||||
|
public String getDomain() {
|
||||||
|
return domain;
|
||||||
|
}
|
||||||
|
public void setDomain(String domain) {
|
||||||
|
this.domain = domain;
|
||||||
|
}
|
||||||
public Integer getAppCode() {
|
public Integer getAppCode() {
|
||||||
return appCode;
|
return appCode;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
/**
|
||||||
|
*@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导入字符串类配置
|
||||||
|
*/
|
||||||
|
public class AppDomainTemplate {
|
||||||
|
private String cfgDesc;
|
||||||
|
private String cfgKeywords;
|
||||||
|
private Integer matchMethod ;
|
||||||
|
private Integer isHex;
|
||||||
|
private Integer isCaseInsenstive;
|
||||||
|
|
||||||
|
@ExcelField(title="config_describe",align=2,sort=1)
|
||||||
|
public String getCfgDesc() {
|
||||||
|
return cfgDesc;
|
||||||
|
}
|
||||||
|
public void setCfgDesc(String cfgDesc) {
|
||||||
|
this.cfgDesc = cfgDesc;
|
||||||
|
}
|
||||||
|
@ExcelField(title="domain_name",sort=2)
|
||||||
|
public String getCfgKeywords() {
|
||||||
|
return cfgKeywords;
|
||||||
|
}
|
||||||
|
public void setCfgKeywords(String cfgKeywords) {
|
||||||
|
this.cfgKeywords = cfgKeywords;
|
||||||
|
}
|
||||||
|
@ExcelField(title="match_method",dictType="MATCH_METHOD",sort=13)
|
||||||
|
public Integer getMatchMethod() {
|
||||||
|
return matchMethod;
|
||||||
|
}
|
||||||
|
public void setMatchMethod(Integer matchMethod) {
|
||||||
|
this.matchMethod = matchMethod;
|
||||||
|
}
|
||||||
|
@ExcelField(title="is_hex",dictType="IS_HEX",sort=14)
|
||||||
|
public Integer getIsHex() {
|
||||||
|
return isHex;
|
||||||
|
}
|
||||||
|
public void setIsHex(Integer isHex) {
|
||||||
|
this.isHex = isHex;
|
||||||
|
}
|
||||||
|
@ExcelField(title="is_case_insenstive",dictType="CASE_INSENSTIVE",sort=15)
|
||||||
|
public Integer getIsCaseInsenstive() {
|
||||||
|
return isCaseInsenstive;
|
||||||
|
}
|
||||||
|
public void setIsCaseInsenstive(Integer isCaseInsenstive) {
|
||||||
|
this.isCaseInsenstive = isCaseInsenstive;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,12 +16,12 @@ public class ConfigGroupInfo {
|
|||||||
private Integer groupType;
|
private Integer groupType;
|
||||||
@ExcelField(title="cfg_id",sort=301)
|
@ExcelField(title="cfg_id",sort=301)
|
||||||
private Integer compileId;
|
private Integer compileId;
|
||||||
private Integer asnId;
|
private Long asnId;
|
||||||
|
|
||||||
public Integer getAsnId() {
|
public Long getAsnId() {
|
||||||
return asnId;
|
return asnId;
|
||||||
}
|
}
|
||||||
public void setAsnId(Integer asnId) {
|
public void setAsnId(Long asnId) {
|
||||||
this.asnId = asnId;
|
this.asnId = asnId;
|
||||||
}
|
}
|
||||||
public Integer getCompileId() {
|
public Integer getCompileId() {
|
||||||
|
|||||||
@@ -56,6 +56,10 @@ public final class Constants {
|
|||||||
* 配置审核下发的类型 回调类型
|
* 配置审核下发的类型 回调类型
|
||||||
*/
|
*/
|
||||||
public static final int CALLBACK_TYPE=2;
|
public static final int CALLBACK_TYPE=2;
|
||||||
|
/**
|
||||||
|
* 域名验证正则
|
||||||
|
*/
|
||||||
|
public static final String DOMAIN_REGEXP=Configurations.getStringProperty("domain_regexp", "*");
|
||||||
/**
|
/**
|
||||||
* IP验证正则
|
* IP验证正则
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -17,11 +17,14 @@ import java.util.List;
|
|||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.hadoop.hbase.protobuf.generated.CellProtos.CellType;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFDataFormatter;
|
||||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||||
import org.apache.poi.ss.usermodel.Cell;
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
import org.apache.poi.ss.usermodel.DateUtil;
|
import org.apache.poi.ss.usermodel.DateUtil;
|
||||||
import org.apache.poi.ss.usermodel.Row;
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
|
import org.apache.poi.ss.usermodel.Row.MissingCellPolicy;
|
||||||
import org.apache.poi.ss.usermodel.Sheet;
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
@@ -219,6 +222,35 @@ public class ImportExcel {
|
|||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 获取单元格值
|
||||||
|
* @param row 获取的行
|
||||||
|
* @param column 获取单元格列号
|
||||||
|
* @return 单元格值
|
||||||
|
*/
|
||||||
|
public Object getStringCellValue(Row row, int column){
|
||||||
|
Object val = "";
|
||||||
|
try{
|
||||||
|
Cell cell = row.getCell(column);
|
||||||
|
if (cell != null){
|
||||||
|
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC){
|
||||||
|
HSSFDataFormatter dataFormatter = new HSSFDataFormatter();
|
||||||
|
val = dataFormatter.formatCellValue(cell);
|
||||||
|
}else if (cell.getCellType() == Cell.CELL_TYPE_STRING){
|
||||||
|
val = cell.getStringCellValue();
|
||||||
|
}else if (cell.getCellType() == Cell.CELL_TYPE_FORMULA){
|
||||||
|
val = cell.getCellFormula();
|
||||||
|
}else if (cell.getCellType() == Cell.CELL_TYPE_BOOLEAN){
|
||||||
|
val = cell.getBooleanCellValue();
|
||||||
|
}else if (cell.getCellType() == Cell.CELL_TYPE_ERROR){
|
||||||
|
val = cell.getErrorCellValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch (Exception e) {
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* //递归获取cls实体对象及父级对象的属性
|
* //递归获取cls实体对象及父级对象的属性
|
||||||
* wx:修改,子类覆盖父类的同名方法
|
* wx:修改,子类覆盖父类的同名方法
|
||||||
@@ -786,7 +818,8 @@ public class ImportExcel {
|
|||||||
Row row = this.getRow(i);
|
Row row = this.getRow(i);
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for (Object[] os : annotationList){
|
for (Object[] os : annotationList){
|
||||||
Object val = this.getCellValue(row, column++);
|
// Object val = this.getCellValue(row, column++);
|
||||||
|
Object val = this.getStringCellValue(row, column++);
|
||||||
if (val != null){
|
if (val != null){
|
||||||
ExcelField ef = (ExcelField)os[0];
|
ExcelField ef = (ExcelField)os[0];
|
||||||
// If is dict type, get dict value
|
// If is dict type, get dict value
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ import com.nis.domain.configuration.DnsResStrategy;
|
|||||||
import com.nis.domain.configuration.IpPortCfg;
|
import com.nis.domain.configuration.IpPortCfg;
|
||||||
import com.nis.domain.configuration.RequestInfo;
|
import com.nis.domain.configuration.RequestInfo;
|
||||||
import com.nis.domain.configuration.StringCfgTemplate;
|
import com.nis.domain.configuration.StringCfgTemplate;
|
||||||
|
import com.nis.domain.configuration.template.AppDomainTemplate;
|
||||||
import com.nis.domain.configuration.template.AsnIpTemplate;
|
import com.nis.domain.configuration.template.AsnIpTemplate;
|
||||||
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
|
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
|
||||||
import com.nis.domain.configuration.template.DdosIpTemplate;
|
import com.nis.domain.configuration.template.DdosIpTemplate;
|
||||||
@@ -857,6 +858,7 @@ public class BaseController {
|
|||||||
}
|
}
|
||||||
StringBuffer errTip = new StringBuffer();
|
StringBuffer errTip = new StringBuffer();
|
||||||
Pattern pattern = Pattern.compile("\t|\r|\n|\b|\f");
|
Pattern pattern = Pattern.compile("\t|\r|\n|\b|\f");
|
||||||
|
Pattern domainPattern = Pattern.compile(Constants.DOMAIN_REGEXP);
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
StringBuffer errInfo = new StringBuffer();
|
StringBuffer errInfo = new StringBuffer();
|
||||||
BaseStringCfg baseStringCfg = new BaseStringCfg();
|
BaseStringCfg baseStringCfg = new BaseStringCfg();
|
||||||
@@ -880,47 +882,71 @@ public class BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
String keyword = baseStringCfg.getCfgKeywords();
|
String keyword = baseStringCfg.getCfgKeywords();
|
||||||
if (StringUtils.isBlank(keyword)) {
|
if (!regionDict.getFunctionId().equals(403)) {
|
||||||
errInfo.append(
|
if (StringUtils.isBlank(keyword)) {
|
||||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("key_word") + " ") + ";");
|
|
||||||
}
|
|
||||||
if (mulityKeywordsP.equals("0")) {
|
|
||||||
if (keyword.indexOf("\n") > -1) {
|
|
||||||
errInfo.append(
|
errInfo.append(
|
||||||
String.format(prop.getProperty("not_multiple"), prop.getProperty("key_word")) + ";");
|
String.format(prop.getProperty("can_not_null"), prop.getProperty("key_word") + " ") + ";");
|
||||||
}
|
}
|
||||||
Matcher m = pattern.matcher(keyword);
|
if (mulityKeywordsP.equals("0")) {
|
||||||
if (m.find()) {
|
if (keyword.indexOf("\n") > -1) {
|
||||||
errInfo.append(String.format(prop.getProperty("has_invisible_char"),
|
errInfo.append(
|
||||||
prop.getProperty("key_word") + " '" + keyword + "'") + ";");
|
String.format(prop.getProperty("not_multiple"), prop.getProperty("key_word")) + ";");
|
||||||
}
|
}
|
||||||
} else {
|
Matcher m = pattern.matcher(keyword);
|
||||||
boolean has = false;
|
|
||||||
Set<String> keywordSet=Sets.newHashSet();
|
|
||||||
for (String key : keyword.split("\n")) {
|
|
||||||
Matcher m = pattern.matcher(key);
|
|
||||||
if (m.find()) {
|
if (m.find()) {
|
||||||
has = true;
|
|
||||||
errInfo.append(String.format(prop.getProperty("has_invisible_char"),
|
errInfo.append(String.format(prop.getProperty("has_invisible_char"),
|
||||||
prop.getProperty("key_word") + " '" + key + "'") + ";");
|
prop.getProperty("key_word") + " '" + keyword + "'") + ";");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if(!keywordSet.contains(key)) {
|
} else {
|
||||||
keywordSet.add(key);
|
boolean has = false;
|
||||||
}else {
|
Set<String> keywordSet=Sets.newHashSet();
|
||||||
errInfo.append(prop.getProperty("key_word") + " '" + key + "'"+" "+prop.getProperty("repeat") + ";");
|
for (String key : keyword.split("\n")) {
|
||||||
|
Matcher m = pattern.matcher(key);
|
||||||
|
if (m.find()) {
|
||||||
|
has = true;
|
||||||
|
errInfo.append(String.format(prop.getProperty("has_invisible_char"),
|
||||||
|
prop.getProperty("key_word") + " '" + key + "'") + ";");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(!keywordSet.contains(key)) {
|
||||||
|
keywordSet.add(key);
|
||||||
|
}else {
|
||||||
|
errInfo.append(prop.getProperty("key_word") + " '" + key + "'"+" "+prop.getProperty("repeat") + ";");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!has) {
|
||||||
|
if(keyword.replaceAll("\n","").length()>1024) {
|
||||||
|
errInfo.append(String.format(prop.getProperty("most_keywords"),
|
||||||
|
prop.getProperty("key_word")) + ";");
|
||||||
|
}else {
|
||||||
|
String reWord = keyword.replaceAll("\n", Constants.KEYWORD_EXPR);
|
||||||
|
baseStringCfg.setCfgKeywords(reWord);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!has) {
|
}else {
|
||||||
if(keyword.replaceAll("\n","").length()>1024) {
|
if (StringUtils.isBlank(keyword)) {
|
||||||
errInfo.append(String.format(prop.getProperty("most_keywords"),
|
errInfo.append(
|
||||||
prop.getProperty("key_word")) + ";");
|
String.format(prop.getProperty("can_not_null"), prop.getProperty("domain_name") + " ") + ";");
|
||||||
|
}else {
|
||||||
|
Matcher m = pattern.matcher(keyword);
|
||||||
|
if (m.find()) {
|
||||||
|
errInfo.append(String.format(prop.getProperty("has_invisible_char"),
|
||||||
|
prop.getProperty("domain_name") + " '" + keyword + "'") + ";");
|
||||||
}else {
|
}else {
|
||||||
String reWord = keyword.replaceAll("\n", Constants.KEYWORD_EXPR);
|
m = domainPattern.matcher(keyword);
|
||||||
baseStringCfg.setCfgKeywords(reWord);
|
if(!m.matches()) {
|
||||||
|
errInfo.append(String.format(prop.getProperty("not_valid_domain"),
|
||||||
|
prop.getProperty("domain_name") + " '" + keyword + "'") + ";");
|
||||||
|
}else {
|
||||||
|
baseStringCfg.setDomain(keyword);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer exprType = baseStringCfg.getExprType();
|
Integer exprType = baseStringCfg.getExprType();
|
||||||
boolean has = false;
|
boolean has = false;
|
||||||
if (exprType == null) {
|
if (exprType == null) {
|
||||||
@@ -1474,7 +1500,7 @@ public class BaseController {
|
|||||||
+ ";");
|
+ ";");
|
||||||
}else {
|
}else {
|
||||||
try {
|
try {
|
||||||
Integer.parseInt(userRegion1);
|
Long asnNo=Long.parseLong(userRegion1);
|
||||||
/*ConfigGroupInfo configGroupInfo=asnIpCfgService.getConfigGroupInfoByAsnNo(asnNo);
|
/*ConfigGroupInfo configGroupInfo=asnIpCfgService.getConfigGroupInfoByAsnNo(asnNo);
|
||||||
if(configGroupInfo==null) {//不存在则新增
|
if(configGroupInfo==null) {//不存在则新增
|
||||||
PolicyGroupInfo info=new PolicyGroupInfo();
|
PolicyGroupInfo info=new PolicyGroupInfo();
|
||||||
@@ -1486,6 +1512,11 @@ public class BaseController {
|
|||||||
configGroupInfo=asnIpCfgService.getConfigGroupInfoByAsnNo(asnNo);
|
configGroupInfo=asnIpCfgService.getConfigGroupInfoByAsnNo(asnNo);
|
||||||
}
|
}
|
||||||
baseIpCfg.setAsnIpGroup(configGroupInfo.getGroupId());*/
|
baseIpCfg.setAsnIpGroup(configGroupInfo.getGroupId());*/
|
||||||
|
if(asnNo.longValue()>4294967295l||asnNo.longValue()<1) {
|
||||||
|
errInfo.append(prop.getProperty("asn_no")+" "+
|
||||||
|
String.format(prop.getProperty("must_between"),"1","4294967295" )
|
||||||
|
+ ";");
|
||||||
|
}
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
errInfo.append(
|
errInfo.append(
|
||||||
@@ -3272,6 +3303,10 @@ public class BaseController {
|
|||||||
List<P2pHashStringTemplate> list = ei.getDataList(P2pHashStringTemplate.class,
|
List<P2pHashStringTemplate> list = ei.getDataList(P2pHashStringTemplate.class,
|
||||||
this.getMsgProp(),regionDict,serviceDict);
|
this.getMsgProp(),regionDict,serviceDict);
|
||||||
stringCfgs = this.checkStringCfg(serviceDict, regionDict, list);
|
stringCfgs = this.checkStringCfg(serviceDict, regionDict, list);
|
||||||
|
}else if (regionDict.getFunctionId().equals(403)) {
|
||||||
|
List<AppDomainTemplate> list = ei.getDataList(AppDomainTemplate.class,
|
||||||
|
this.getMsgProp(),regionDict,serviceDict);
|
||||||
|
stringCfgs = this.checkStringCfg(serviceDict, regionDict, list);
|
||||||
} else {
|
} else {
|
||||||
List<StringAllTemplate> list = ei.getDataList(StringAllTemplate.class, this.getMsgProp(),regionDict,serviceDict);
|
List<StringAllTemplate> list = ei.getDataList(StringAllTemplate.class, this.getMsgProp(),regionDict,serviceDict);
|
||||||
stringCfgs = this.checkStringCfg(serviceDict, regionDict, list);
|
stringCfgs = this.checkStringCfg(serviceDict, regionDict, list);
|
||||||
@@ -3307,6 +3342,7 @@ public class BaseController {
|
|||||||
|| serviceDict.getServiceId().intValue() == 148
|
|| serviceDict.getServiceId().intValue() == 148
|
||||||
|| serviceDict.getServiceId().intValue() == 1028// app ip
|
|| serviceDict.getServiceId().intValue() == 1028// app ip
|
||||||
|| serviceDict.getServiceId().intValue() == 1024//app http
|
|| serviceDict.getServiceId().intValue() == 1024//app http
|
||||||
|
|| serviceDict.getServiceId().intValue() == 1026//app domain
|
||||||
)) {
|
)) {
|
||||||
if (StringUtils.isNotBlank(specServiceId)) {
|
if (StringUtils.isNotBlank(specServiceId)) {
|
||||||
specificServiceCfg = specificServiceCfgService
|
specificServiceCfg = specificServiceCfgService
|
||||||
@@ -3507,9 +3543,12 @@ public class BaseController {
|
|||||||
appPolicyCfgs.add(appPolicyCfg);
|
appPolicyCfgs.add(appPolicyCfg);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
if(!regionDict.getFunctionId().equals(403)) {
|
||||||
BeanUtils.copyProperties(cfg, cfgIndexInfo, new String[] {"cfgId"});
|
CfgIndexInfo cfgIndexInfo = new CfgIndexInfo();
|
||||||
cfgIndexInfos.add(cfgIndexInfo);
|
BeanUtils.copyProperties(cfg, cfgIndexInfo, new String[] {"cfgId"});
|
||||||
|
cfgIndexInfos.add(cfgIndexInfo);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
ind++;
|
ind++;
|
||||||
}
|
}
|
||||||
@@ -3547,6 +3586,9 @@ public class BaseController {
|
|||||||
if(regionDict.getDictId().intValue()==16){
|
if(regionDict.getDictId().intValue()==16){
|
||||||
avContentCfgService.saveVoIpAccountCfg(stringCfgs);
|
avContentCfgService.saveVoIpAccountCfg(stringCfgs);
|
||||||
}
|
}
|
||||||
|
if(regionDict.getDictId().intValue()==64){
|
||||||
|
appCfgService.saveAppDomainCfg(stringCfgs);
|
||||||
|
}
|
||||||
} else if (regionDict.getRegionType().equals(3)) {
|
} else if (regionDict.getRegionType().equals(3)) {
|
||||||
List<Integer> compileIds=Lists.newArrayList();
|
List<Integer> compileIds=Lists.newArrayList();
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import com.nis.domain.SysDataDictionaryItem;
|
|||||||
import com.nis.domain.configuration.CfgIndexInfo;
|
import com.nis.domain.configuration.CfgIndexInfo;
|
||||||
import com.nis.domain.configuration.IpPortCfg;
|
import com.nis.domain.configuration.IpPortCfg;
|
||||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||||
|
import com.nis.domain.configuration.template.AppDomainTemplate;
|
||||||
import com.nis.domain.configuration.template.AsnIpTemplate;
|
import com.nis.domain.configuration.template.AsnIpTemplate;
|
||||||
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
|
import com.nis.domain.configuration.template.ComplexStringAllTemplate;
|
||||||
import com.nis.domain.configuration.template.DdosIpTemplate;
|
import com.nis.domain.configuration.template.DdosIpTemplate;
|
||||||
@@ -309,6 +310,11 @@ public class IpController extends BaseController{
|
|||||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, P2pHashStringTemplate.class, 2);
|
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, P2pHashStringTemplate.class, 2);
|
||||||
excel.setDataList(this.getMsgProp(),classList,null).
|
excel.setDataList(this.getMsgProp(),classList,null).
|
||||||
write(request,response, fileName).dispose();
|
write(request,response, fileName).dispose();
|
||||||
|
}else if(regionDict.getFunctionId().equals(403)) {//app domain
|
||||||
|
List<AppDomainTemplate> classList=new ArrayList<AppDomainTemplate>();
|
||||||
|
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, AppDomainTemplate.class, 2);
|
||||||
|
excel.setDataList(this.getMsgProp(),classList,null).
|
||||||
|
write(request,response, fileName).dispose();
|
||||||
}else{
|
}else{
|
||||||
List<StringAllTemplate> classList=new ArrayList<StringAllTemplate>();
|
List<StringAllTemplate> classList=new ArrayList<StringAllTemplate>();
|
||||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, StringAllTemplate.class, 2);
|
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, StringAllTemplate.class, 2);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public interface AsnIpCfgDao extends CrudDao<AsnIpCfg>{
|
|||||||
// public List<ConfigGroupInfo> findPolicyGroupInfosByType(@Param("groupId")Integer groupId);
|
// public List<ConfigGroupInfo> findPolicyGroupInfosByType(@Param("groupId")Integer groupId);
|
||||||
public List<Integer> findOtherIps(@Param("groupId")Integer groupId,@Param("cfgId")Integer cfgId);
|
public List<Integer> findOtherIps(@Param("groupId")Integer groupId,@Param("cfgId")Integer cfgId);
|
||||||
public List<Integer> countValidIPs(@Param("groups")String groups,@Param("ids")String ids);
|
public List<Integer> countValidIPs(@Param("groups")String groups,@Param("ids")String ids);
|
||||||
public ConfigGroupInfo getInfoByAsnNo(@Param("asnId")Integer asnNo);
|
public ConfigGroupInfo getInfoByAsnNo(@Param("asnId")Long asnNo);
|
||||||
public List<AsnIpCfg> getByAsnGroup(@Param("groupId")Integer groupId,@Param("asnId")Integer asnNo);
|
public List<AsnIpCfg> getByAsnGroup(@Param("groupId")long groupId,@Param("asnId")long asnNo);
|
||||||
public void deleteByAsnGroup(@Param("groupId")Integer groupId,@Param("asnId")Integer asnNo);
|
public void deleteByAsnGroup(@Param("groupId")long groupId,@Param("asnId")long asnNo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -206,7 +206,7 @@
|
|||||||
from asn_ip_cfg r
|
from asn_ip_cfg r
|
||||||
where r.cfg_id in (${ids}) and is_valid !=-1
|
where r.cfg_id in (${ids}) and is_valid !=-1
|
||||||
</select>
|
</select>
|
||||||
<select id="getByAsnGroup" resultMap="asnIpCfgMap" parameterType="java.lang.Integer" >
|
<select id="getByAsnGroup" resultMap="asnIpCfgMap" parameterType="java.lang.Long" >
|
||||||
select
|
select
|
||||||
<include refid="columns"></include>
|
<include refid="columns"></include>
|
||||||
from asn_ip_cfg r where r.is_valid!=-1 and r.asn_ip_group=#{groupId} and r.user_region1=#{asnId}
|
from asn_ip_cfg r where r.is_valid!=-1 and r.asn_ip_group=#{groupId} and r.user_region1=#{asnId}
|
||||||
@@ -399,7 +399,7 @@
|
|||||||
<!-- <update id="deleteByAsnGroup" parameterType="java.lang.Integer" >
|
<!-- <update id="deleteByAsnGroup" parameterType="java.lang.Integer" >
|
||||||
update asn_ip_cfg set is_valid=-1 where asn_ip_group=#{groupId} and user_region1=#{asnId}
|
update asn_ip_cfg set is_valid=-1 where asn_ip_group=#{groupId} and user_region1=#{asnId}
|
||||||
</update> -->
|
</update> -->
|
||||||
<delete id="deleteByAsnGroup" parameterType="java.lang.Integer" >
|
<delete id="deleteByAsnGroup" parameterType="java.lang.Long" >
|
||||||
delete from asn_ip_cfg where asn_ip_group=#{groupId} and user_region1=#{asnId}
|
delete from asn_ip_cfg where asn_ip_group=#{groupId} and user_region1=#{asnId}
|
||||||
</delete>
|
</delete>
|
||||||
<select id="findOtherIps" resultType="java.lang.Integer" parameterType="java.lang.Integer">
|
<select id="findOtherIps" resultType="java.lang.Integer" parameterType="java.lang.Integer">
|
||||||
@@ -411,7 +411,7 @@
|
|||||||
<select id="countValidIPs" resultType="java.lang.Integer" parameterType="java.lang.String">
|
<select id="countValidIPs" resultType="java.lang.Integer" parameterType="java.lang.String">
|
||||||
select count(1) from asn_ip_cfg where is_valid !=-1 and asn_ip_group in(${groups}) and cfg_id not in(${ids}) GROUP BY asn_ip_group;
|
select count(1) from asn_ip_cfg where is_valid !=-1 and asn_ip_group in(${groups}) and cfg_id not in(${ids}) GROUP BY asn_ip_group;
|
||||||
</select>
|
</select>
|
||||||
<select id="getInfoByAsnNo" resultType="com.nis.domain.specific.ConfigGroupInfo" parameterType="java.lang.Integer">
|
<select id="getInfoByAsnNo" resultType="com.nis.domain.specific.ConfigGroupInfo" parameterType="java.lang.Long">
|
||||||
select id,group_id,group_name,is_issued,insert_time,update_time,group_type,compile_id,asn_id
|
select id,group_id,group_name,is_issued,insert_time,update_time,group_type,compile_id,asn_id
|
||||||
from config_group_info c where c.asn_id= #{asnId} and c.group_type=4
|
from config_group_info c where c.asn_id= #{asnId} and c.group_type=4
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
|
<result column="creator_id" property="creatorId" jdbcType="INTEGER" />
|
||||||
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
|
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
|
||||||
<result column="service_group_id" property="serviceGroupId" jdbcType="INTEGER" />
|
<result column="service_group_id" property="serviceGroupId" jdbcType="INTEGER" />
|
||||||
<result column="asn_no" property="asnNo" jdbcType="INTEGER" />
|
<result column="asn_no" property="asnNo" jdbcType="BIGINT" />
|
||||||
<result column="description" property="description" jdbcType="VARCHAR" />
|
<result column="description" property="description" jdbcType="VARCHAR" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="PolicyGroupInfoColumns">
|
<sql id="PolicyGroupInfoColumns">
|
||||||
|
|||||||
@@ -93,11 +93,11 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
|||||||
List<AsnIpCfg> toSaveAsnIpCfgs=Lists.newArrayList();
|
List<AsnIpCfg> toSaveAsnIpCfgs=Lists.newArrayList();
|
||||||
List<SysDataDictionaryItem> isImportAll=DictUtils.getDictList("IS_ASN_IP_IMPORT_ALL");
|
List<SysDataDictionaryItem> isImportAll=DictUtils.getDictList("IS_ASN_IP_IMPORT_ALL");
|
||||||
for(Entry<String,List<AsnIpCfg>> entry:cfgs.entrySet()) {
|
for(Entry<String,List<AsnIpCfg>> entry:cfgs.entrySet()) {
|
||||||
Integer asnNo=Integer.parseInt(entry.getKey());
|
Long asnNo=Long.parseLong(entry.getKey());
|
||||||
ConfigGroupInfo configGroupInfo=this.getConfigGroupInfoByAsnNo(asnNo);
|
ConfigGroupInfo configGroupInfo=this.getConfigGroupInfoByAsnNo(asnNo);
|
||||||
if(configGroupInfo==null) {//不存在则新增
|
if(configGroupInfo==null) {//不存在则新增
|
||||||
PolicyGroupInfo info=new PolicyGroupInfo();
|
PolicyGroupInfo info=new PolicyGroupInfo();
|
||||||
info.setAsnNo(Integer.parseInt(entry.getKey()));
|
info.setAsnNo(Long.parseLong(entry.getKey()));
|
||||||
info.setDescription("Create by import excel");
|
info.setDescription("Create by import excel");
|
||||||
info.setGroupName("Import"+asnNo);
|
info.setGroupName("Import"+asnNo);
|
||||||
info.setGroupType(4);
|
info.setGroupType(4);
|
||||||
@@ -281,19 +281,19 @@ public class AsnIpCfgService extends CrudService<CrudDao<AsnIpCfg>, AsnIpCfg> {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public ConfigGroupInfo getConfigGroupInfoByAsnNo(Integer asnNo) {
|
public ConfigGroupInfo getConfigGroupInfoByAsnNo(Long asnNo) {
|
||||||
return asnIpCfgDao.getInfoByAsnNo(asnNo);
|
return asnIpCfgDao.getInfoByAsnNo(asnNo);
|
||||||
}
|
}
|
||||||
public List<AsnIpCfg> getByAsnGroup(Integer groupId,Integer asnNo) {
|
public List<AsnIpCfg> getByAsnGroup(Integer groupId,Long asnNo) {
|
||||||
if(groupId==null||asnNo==null) {
|
if(groupId==null||asnNo==null) {
|
||||||
throw new RuntimeException("groupId or asnNo is null!");
|
throw new RuntimeException("groupId or asnNo is null!");
|
||||||
}
|
}
|
||||||
return asnIpCfgDao.getByAsnGroup(groupId,asnNo);
|
return asnIpCfgDao.getByAsnGroup(groupId.longValue(),asnNo.longValue());
|
||||||
}
|
}
|
||||||
public void deleteByAsnGroup(Integer groupId,Integer asnNo) {
|
public void deleteByAsnGroup(Integer groupId,Long asnNo) {
|
||||||
if(groupId==null||asnNo==null) {
|
if(groupId==null||asnNo==null) {
|
||||||
throw new RuntimeException("groupId or asnNo is null!");
|
throw new RuntimeException("groupId or asnNo is null!");
|
||||||
}
|
}
|
||||||
asnIpCfgDao.deleteByAsnGroup(groupId,asnNo);
|
asnIpCfgDao.deleteByAsnGroup(groupId.longValue(),asnNo.longValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import com.nis.domain.configuration.AppTcpCfg;
|
|||||||
import com.nis.domain.configuration.AppTopicDomainCfg;
|
import com.nis.domain.configuration.AppTopicDomainCfg;
|
||||||
import com.nis.domain.configuration.AreaIpCfg;
|
import com.nis.domain.configuration.AreaIpCfg;
|
||||||
import com.nis.domain.configuration.BaseIpCfg;
|
import com.nis.domain.configuration.BaseIpCfg;
|
||||||
|
import com.nis.domain.configuration.BaseStringCfg;
|
||||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||||
import com.nis.domain.configuration.IpPortCfg;
|
import com.nis.domain.configuration.IpPortCfg;
|
||||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||||
@@ -512,7 +513,15 @@ public class AppCfgService extends BaseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@Transactional(readOnly = false, rollbackFor = RuntimeException.class)
|
||||||
|
public void saveAppDomainCfg(List<BaseStringCfg<?>> cfgs) throws Exception {
|
||||||
|
for(BaseStringCfg cfg:cfgs) {
|
||||||
|
AppDomainCfg entity=new AppDomainCfg();
|
||||||
|
BeanUtils.copyProperties(cfg, entity);
|
||||||
|
appCfgDao.insertAppDomainCfg(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@Transactional(readOnly = false, rollbackFor = RuntimeException.class)
|
@Transactional(readOnly = false, rollbackFor = RuntimeException.class)
|
||||||
public void saveOrUpdateAppDomainCfg(AppDomainCfg entity) throws Exception {
|
public void saveOrUpdateAppDomainCfg(AppDomainCfg entity) throws Exception {
|
||||||
// 设置区域运营商信息
|
// 设置区域运营商信息
|
||||||
|
|||||||
@@ -1326,4 +1326,5 @@ traffic_user_behavior=Traffic Account Behavior
|
|||||||
user_behavior_data=Account statistics
|
user_behavior_data=Account statistics
|
||||||
ip_behavior_data=IP statistics
|
ip_behavior_data=IP statistics
|
||||||
p2p_eMule_keywords=eMule Search Keywords
|
p2p_eMule_keywords=eMule Search Keywords
|
||||||
p2p_hash_keywords=File Marking Keywords
|
p2p_hash_keywords=File Marking Keywords
|
||||||
|
not_valid_domain=%s is not a valid domain
|
||||||
@@ -1315,4 +1315,5 @@ traffic_user_behavior=Traffic Account Behavior
|
|||||||
user_behavior_data=Account statistics
|
user_behavior_data=Account statistics
|
||||||
ip_behavior_data=IP statistics
|
ip_behavior_data=IP statistics
|
||||||
p2p_eMule_keywords=eMule Search Keywords
|
p2p_eMule_keywords=eMule Search Keywords
|
||||||
p2p_hash_keywords=File Marking Keywords
|
p2p_hash_keywords=File Marking Keywords
|
||||||
|
not_valid_domain=%s\u4E0D\u662F\u4E00\u4E2A\u5408\u6CD5\u57DF\u540D
|
||||||
@@ -1316,4 +1316,5 @@ p2p_eMule_keywords=eMule\u641C\u7D22\u5173\u952E\u5B57
|
|||||||
p2p_hash_keywords=\u6587\u4EF6\u6807\u8BC6\u5173\u952E\u5B57
|
p2p_hash_keywords=\u6587\u4EF6\u6807\u8BC6\u5173\u952E\u5B57
|
||||||
traffic_user_behavior=\u7528\u6237\u884C\u4E3A\u7EDF\u8BA1
|
traffic_user_behavior=\u7528\u6237\u884C\u4E3A\u7EDF\u8BA1
|
||||||
user_behavior_data=\u7528\u6237\u7EDF\u8BA1
|
user_behavior_data=\u7528\u6237\u7EDF\u8BA1
|
||||||
ip_behavior_data=\u7528\u6237IP\u7EDF\u8BA1
|
ip_behavior_data=\u7528\u6237IP\u7EDF\u8BA1
|
||||||
|
not_valid_domain=%s\u4E0D\u662F\u4E00\u4E2A\u5408\u6CD5\u57DF\u540D
|
||||||
@@ -541,4 +541,5 @@ cert_validate_file=x509
|
|||||||
cert_validate_success_info=Successful
|
cert_validate_success_info=Successful
|
||||||
#ipv4 range新格式0.0.0.1-2
|
#ipv4 range新格式0.0.0.1-2
|
||||||
ipv4_ip_range_regexp_new=^(0|1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|[1-9])\\.(0|1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\.(0|1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\.(0|1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)-(0|1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)$
|
ipv4_ip_range_regexp_new=^(0|1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|[1-9])\\.(0|1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\.(0|1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\.(0|1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)-(0|1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)$
|
||||||
ipv4_ip_subnet_regexp_original=^(0|1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|[1-9])\\.(0|1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\.(0|1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\.(0|1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)/(3[0-2]|1[0-9]|2[0-9]|[0-9])$
|
ipv4_ip_subnet_regexp_original=^(0|1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|[1-9])\\.(0|1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\.(0|1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)\\.(0|1\\d{2}|2[0-4]\\d|25[0-5]|[1-9]\\d|\\d)/(3[0-2]|1[0-9]|2[0-9]|[0-9])$
|
||||||
|
domain_regexp=^(?=^.{3,255}$)[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+$
|
||||||
2
src/main/resources/sql/20181105/change_asn_no_range.sql
Normal file
2
src/main/resources/sql/20181105/change_asn_no_range.sql
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE config_group_info MODIFY COLUMN asn_id BIGINT(20) NULL COMMENT 'asn 组对应的asn号';
|
||||||
|
ALTER TABLE policy_group_info MODIFY COLUMN asn_no BIGINT(20) NULL COMMENT 'asn号';
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
UPDATE function_region_dict SET is_import=1 WHERE function_id=403 AND is_valid=1;
|
||||||
|
UPDATE function_service_dict SET is_import=1 WHERE function_id=403 AND is_valid=1;
|
||||||
@@ -53,6 +53,23 @@
|
|||||||
onClick="javascript:window.location='${ctx}/app/domainCfgForm?functionId=${cfg.functionId}'">
|
onClick="javascript:window.location='${ctx}/app/domainCfgForm?functionId=${cfg.functionId}'">
|
||||||
<i class="fa fa-plus"></i>
|
<i class="fa fa-plus"></i>
|
||||||
<spring:message code="add"></spring:message></button>
|
<spring:message code="add"></spring:message></button>
|
||||||
|
<c:set var="serviceImport" value="false"></c:set>
|
||||||
|
<c:set var="regionImport" value="false"></c:set>
|
||||||
|
<c:forEach items="${serviceList}" var="service" >
|
||||||
|
<c:if test="${(cfg.functionId eq service.functionId) && service.isImport eq 1}">
|
||||||
|
<c:set var="serviceImport" value="true"></c:set>
|
||||||
|
</c:if>
|
||||||
|
</c:forEach>
|
||||||
|
<c:forEach items="${regionList}" var="region" >
|
||||||
|
<c:if test="${(cfg.functionId eq region.functionId) && region.isImport eq 1}">
|
||||||
|
<c:set var="regionImport" value="true"></c:set>
|
||||||
|
</c:if>
|
||||||
|
</c:forEach>
|
||||||
|
<c:if test="${serviceImport eq 'true' && regionImport eq 'true'}">
|
||||||
|
<button type="button" class="btn btn-primary import" >
|
||||||
|
<i class="fa fa-plus"></i>
|
||||||
|
<spring:message code="import"></spring:message></button>
|
||||||
|
</c:if>
|
||||||
</shiro:hasPermission>
|
</shiro:hasPermission>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -440,6 +457,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<c:set var="importPath" value="/app/domainCfgList?functionId=${cfg.functionId}"/>
|
||||||
|
<!-- 模板导入,start -->
|
||||||
|
<%@include file="/WEB-INF/include/excel/importModal.jsp" %>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user