Merge branch 'develop' of http://192.168.10.125/k18_web/NFS.git into develop
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
@@ -38,14 +39,14 @@ public class IpAllTemplate {
|
||||
public void setCfgDesc(String cfgDesc) {
|
||||
this.cfgDesc = cfgDesc;
|
||||
}
|
||||
@ExcelField(title="client_ip",align=2,sort=2)
|
||||
@ExcelField(title="client_ip",align=2,sort=11)
|
||||
public String getSrcIpAddress() {
|
||||
return srcIpAddress;
|
||||
}
|
||||
public void setSrcIpAddress(String srcIpAddress) {
|
||||
this.srcIpAddress = srcIpAddress;
|
||||
}
|
||||
@ExcelField(title="server_ip",align=2,sort=3)
|
||||
@ExcelField(title="server_ip",align=2,sort=12)
|
||||
public String getDestIpAddress() {
|
||||
return destIpAddress;
|
||||
}
|
||||
@@ -53,14 +54,14 @@ public class IpAllTemplate {
|
||||
this.destIpAddress = destIpAddress;
|
||||
}
|
||||
|
||||
@ExcelField(title="client_port",align=2,sort=4)
|
||||
@ExcelField(title="client_port",align=2,sort=13)
|
||||
public String getSrcPort() {
|
||||
return srcPort;
|
||||
}
|
||||
public void setSrcPort(String srcPort) {
|
||||
this.srcPort = srcPort;
|
||||
}
|
||||
@ExcelField(title="server_port",align=2,sort=5)
|
||||
@ExcelField(title="server_port",align=2,sort=14)
|
||||
public String getDestPort() {
|
||||
return destPort;
|
||||
}
|
||||
@@ -68,18 +69,19 @@ public class IpAllTemplate {
|
||||
this.destPort = destPort;
|
||||
}
|
||||
|
||||
@ExcelField(title="protocol",align=2,sort=6)
|
||||
@ExcelField(title="protocol",align=2,sort=15)
|
||||
public Integer getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
public void setProtocol(Integer protocol) {
|
||||
this.protocol = protocol;
|
||||
}
|
||||
@ExcelField(title="direction",align=2,sort=7)
|
||||
@ExcelField(title="direction",align=2,sort=16)
|
||||
public Integer getDirection() {
|
||||
return direction;
|
||||
}
|
||||
public void setDirection(Integer direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* EXCEL IPPayload导入替换模板
|
||||
*
|
||||
*/
|
||||
public class IpPayloadTemplate extends IpAllTemplate {
|
||||
|
||||
private String userRegion1;
|
||||
private String userRegion2;
|
||||
private String userRegion3;
|
||||
|
||||
@ExcelField(title="replace_zone",dictType="INTERCEPT_REPLACE_ZONE",align=2,sort=2)
|
||||
public String getUserRegion1() {
|
||||
return userRegion1;
|
||||
}
|
||||
public void setUserRegion1(String userRegion1) {
|
||||
this.userRegion1 = userRegion1;
|
||||
}
|
||||
@ExcelField(title="replaced_content",align=2,sort=2)
|
||||
public String getUserRegion2() {
|
||||
return userRegion2;
|
||||
}
|
||||
public void setUserRegion2(String userRegion1) {
|
||||
this.userRegion2 = userRegion2;
|
||||
}
|
||||
@ExcelField(title="replace_content",align=2,sort=2)
|
||||
public String getUserRegion3() {
|
||||
return userRegion3;
|
||||
}
|
||||
public void setUserRegion3(String userRegion1) {
|
||||
this.userRegion3 = userRegion3;
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,19 @@
|
||||
package com.nis.domain.configuration.template;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
|
||||
/**
|
||||
* wx 将部分字段的标题改变,或者不需要的字段隐藏
|
||||
* 隐藏方法,对于不需要的字段或者方法,Override该字段方法,但是@ExcelField注解不需要加上了
|
||||
* @author dell
|
||||
* EXCEL IP导入限速模板
|
||||
*
|
||||
*/
|
||||
public class IpRateLimitTemplate extends IpCfgTemplate {
|
||||
public class IpRateLimitTemplate extends IpAllTemplate {
|
||||
|
||||
|
||||
@Override
|
||||
public Integer getIrType() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getIrType();
|
||||
private String userRegion1;
|
||||
@ExcelField(title="rate_limte",align=2,sort=2)
|
||||
public String getUserRegion1() {
|
||||
return userRegion1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getDnsStrategyId() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getDnsStrategyId();
|
||||
public void setUserRegion1(String userRegion1) {
|
||||
this.userRegion1 = userRegion1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
*@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 IpWhitelistTemplate {
|
||||
|
||||
/**
|
||||
* @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么)
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
|
||||
|
||||
|
||||
private String cfgDesc;
|
||||
private String srcIpAddress;
|
||||
private String destIpAddress;
|
||||
private String srcPort;
|
||||
private String destPort;
|
||||
|
||||
@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=11)
|
||||
public String getSrcIpAddress() {
|
||||
return srcIpAddress;
|
||||
}
|
||||
public void setSrcIpAddress(String srcIpAddress) {
|
||||
this.srcIpAddress = srcIpAddress;
|
||||
}
|
||||
@ExcelField(title="server_ip",align=2,sort=12)
|
||||
public String getDestIpAddress() {
|
||||
return destIpAddress;
|
||||
}
|
||||
public void setDestIpAddress(String destIpAddress) {
|
||||
this.destIpAddress = destIpAddress;
|
||||
}
|
||||
|
||||
@ExcelField(title="client_port",align=2,sort=13)
|
||||
public String getSrcPort() {
|
||||
return srcPort;
|
||||
}
|
||||
public void setSrcPort(String srcPort) {
|
||||
this.srcPort = srcPort;
|
||||
}
|
||||
@ExcelField(title="server_port",align=2,sort=14)
|
||||
public String getDestPort() {
|
||||
return destPort;
|
||||
}
|
||||
public void setDestPort(String destPort) {
|
||||
this.destPort = destPort;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gson.annotations.Expose;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.nis.domain.maat.MaatCfg.IpCfg;
|
||||
import com.nis.domain.maat.MaatCfg.NumBoundaryCfg;
|
||||
import com.nis.domain.maat.MaatCfg.StringCfg;
|
||||
@@ -13,7 +14,15 @@ import com.nis.domain.maat.MaatCfg.StringCfg;
|
||||
*
|
||||
*/
|
||||
public class GroupReuseCfg implements Serializable {
|
||||
|
||||
@Expose
|
||||
@SerializedName("service")
|
||||
private Integer serviceId;
|
||||
public Integer getServiceId() {
|
||||
return serviceId;
|
||||
}
|
||||
public void setServiceId(Integer serviceId) {
|
||||
this.serviceId = serviceId;
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -258,6 +258,15 @@ public class MaatCfg implements Serializable {
|
||||
@Expose
|
||||
@SerializedName("opTime")
|
||||
private Date auditTime;
|
||||
@Expose
|
||||
private String userRegion;
|
||||
|
||||
public String getUserRegion() {
|
||||
return userRegion;
|
||||
}
|
||||
public void setUserRegion(String userRegion) {
|
||||
this.userRegion = userRegion;
|
||||
}
|
||||
public Integer getRegionId() {
|
||||
return regionId;
|
||||
}
|
||||
|
||||
@@ -686,4 +686,7 @@ public final class Constants {
|
||||
// 区域/运营商配置下发时tag值
|
||||
public static final String AREA_TAG=Configurations.getStringProperty("area_tag","location");
|
||||
public static final String ISP_TAG=Configurations.getStringProperty("isp_tag","isp");
|
||||
|
||||
//音视频样例时长限制,单位秒
|
||||
public static final int AV_DURATION_LIMIT=Configurations.getIntProperty("av_duration_limit", 120);
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.SysDataDictionaryItem;
|
||||
import com.nis.domain.basics.ServiceDictInfo;
|
||||
import com.nis.util.DictUtils;
|
||||
@@ -130,7 +131,7 @@ public class ExportExcel {
|
||||
getFields(list,cls.getSuperclass());
|
||||
}
|
||||
}
|
||||
public String[] validRegionFieldAndSetComment(String headerStr,String commentStr,FunctionRegionDict region,Properties msgProp){
|
||||
public String[] validRegionFieldAndSetComment(String headerStr,String commentStr,FunctionRegionDict region,FunctionServiceDict service,Properties msgProp){
|
||||
String[] titleInfo=new String[2];
|
||||
if(region.getIsMaat().equals(1)){//maat
|
||||
if(region.getRegionType().equals(1)){//IP配置
|
||||
@@ -237,21 +238,54 @@ public class ExportExcel {
|
||||
}
|
||||
//导入的Protocol
|
||||
if("protocol".equals(headerStr)){
|
||||
if(StringUtil.isEmpty(region.getConfigProtocol())){
|
||||
headerStr="";
|
||||
commentStr="";
|
||||
}else{
|
||||
if(service.getFunctionId().equals(5) ){
|
||||
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";
|
||||
if(service.getAction().equals(16) && sysDataDictionaryItem.getItemCode().equals(6)){
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
|
||||
}
|
||||
if(service.getAction().equals(1) &&
|
||||
(sysDataDictionaryItem.getItemCode().equals(6)
|
||||
|| sysDataDictionaryItem.getItemCode().equals(17)
|
||||
|| sysDataDictionaryItem.getItemCode().equals(0) )){
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
|
||||
}
|
||||
if(service.getAction().equals(32) &&
|
||||
(sysDataDictionaryItem.getItemCode().equals(6)
|
||||
|| sysDataDictionaryItem.getItemCode().equals(17)
|
||||
|| sysDataDictionaryItem.getItemCode().equals(1)
|
||||
|| sysDataDictionaryItem.getItemCode().equals(15)
|
||||
|| sysDataDictionaryItem.getItemCode().equals(51)
|
||||
|| sysDataDictionaryItem.getItemCode().equals(50))){
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
|
||||
}
|
||||
if(service.getAction().equals(64) &&
|
||||
(sysDataDictionaryItem.getItemCode().equals(6)
|
||||
|| sysDataDictionaryItem.getItemCode().equals(17) )){
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+":"+sysDataDictionaryItem.getItemValue()+"\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
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";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -419,7 +453,7 @@ public class ExportExcel {
|
||||
* @param type 导出类型(1:导出数据;2:导出模板)
|
||||
* @param groups 导入分组
|
||||
*/
|
||||
public ExportExcel(FunctionRegionDict region,Properties msgProp,String title, Class<?> cls, int type, int... groups){
|
||||
public ExportExcel(FunctionServiceDict service,FunctionRegionDict region,Properties msgProp,String title, Class<?> cls, int type, int... groups){
|
||||
List<Field> list=new ArrayList<Field>();
|
||||
// Get annotation field
|
||||
//递归获取cls实体对象及父级对象的属性
|
||||
@@ -496,7 +530,7 @@ public class ExportExcel {
|
||||
commentStr="";
|
||||
}else{
|
||||
//判断此业务导出模板内容,设置导入提示信息
|
||||
String[] titleInfo=validRegionFieldAndSetComment(titleStr,commentStr,region,msgProp);
|
||||
String[] titleInfo=validRegionFieldAndSetComment(titleStr,commentStr,region,service,msgProp);
|
||||
titleStr=titleInfo[0];
|
||||
commentStr=titleInfo[1];
|
||||
}
|
||||
@@ -1180,7 +1214,7 @@ public class ExportExcel {
|
||||
List<Field> list=new ArrayList<Field>();
|
||||
// Get annotation field
|
||||
//递归获取cls实体对象及父级对象的属性
|
||||
getFields(list, clsMap.get(title));
|
||||
getFields(list, clsMap.get(title).getClass());
|
||||
if(!StringUtil.isEmpty(list)){
|
||||
for (Field f : list){
|
||||
ExcelField ef = f.getAnnotation(ExcelField.class);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.nis.web.controller;
|
||||
import java.beans.PropertyEditorSupport;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
@@ -49,6 +50,7 @@ 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.configuration.template.IpRateLimitTemplate;
|
||||
import com.nis.domain.log.BaseLogEntity;
|
||||
import com.nis.domain.log.SearchReport;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
@@ -614,17 +616,17 @@ public class BaseController {
|
||||
if(dict.getRegionType()==1){
|
||||
List<IpCfgTemplate> list = Lists.newArrayList();
|
||||
list.add(new IpCfgTemplate());
|
||||
new ExportExcel(new FunctionRegionDict(),msgProp,null, IpCfgTemplate.class, 2).setDataList(msgProp,list,null).
|
||||
new ExportExcel(new FunctionServiceDict(),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(new FunctionRegionDict(),msgProp,null, StringCfgTemplate.class, 2).setDataList(msgProp,list,null).
|
||||
new ExportExcel(new FunctionServiceDict(),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(new FunctionRegionDict(),msgProp,null, ComplexStringCfgTemplate.class, 2).setDataList(msgProp,list,null).
|
||||
new ExportExcel(new FunctionServiceDict(),new FunctionRegionDict(),msgProp,null, ComplexStringCfgTemplate.class, 2).setDataList(msgProp,list,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}
|
||||
}
|
||||
@@ -646,17 +648,17 @@ public class BaseController {
|
||||
if(dict.getRegionType()==1){
|
||||
List<IpCfgTemplate> list = Lists.newArrayList();
|
||||
list.add((IpCfgTemplate)clazz.newInstance());
|
||||
new ExportExcel(new FunctionRegionDict(),msgProp,null, clazz, 2).setDataList(msgProp,list,null).
|
||||
new ExportExcel(new FunctionServiceDict(),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(new FunctionRegionDict(),msgProp,null, clazz, 2).setDataList(msgProp,list,null).
|
||||
new ExportExcel(new FunctionServiceDict(),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(new FunctionRegionDict(),msgProp,null, clazz, 2).setDataList(msgProp,list,null).
|
||||
new ExportExcel(new FunctionServiceDict(),new FunctionRegionDict(),msgProp,null, clazz, 2).setDataList(msgProp,list,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}
|
||||
}
|
||||
@@ -788,53 +790,51 @@ public class BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
public List<BaseIpCfg> checkIpCfg(FunctionServiceDict serviceDict,FunctionRegionDict regionDict,List<IpAllTemplate> list) throws ServiceException{
|
||||
public List<BaseIpCfg> checkIpCfg(FunctionServiceDict serviceDict,FunctionRegionDict regionDict,List<?> 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)){
|
||||
BeanUtils.copyProperties(list.get(i), baseIpCfg);
|
||||
if(regionDict.getRegionType().equals(1)){
|
||||
boolean srcIpEmpty=false;
|
||||
boolean srcPortEmpty=false;
|
||||
if(StringUtil.isEmpty(ipCfg.getSrcIpAddress())){
|
||||
if(StringUtil.isEmpty(baseIpCfg.getSrcIpAddress())){
|
||||
srcIpEmpty=true;
|
||||
}
|
||||
if(StringUtil.isEmpty(ipCfg.getDestIpAddress())){
|
||||
if(StringUtil.isEmpty(baseIpCfg.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());
|
||||
if(baseIpCfg.getSrcIpAddress().indexOf(":") > -1){
|
||||
if(baseIpCfg.getSrcIpAddress().indexOf("-") > -1){
|
||||
baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
|
||||
baseIpCfg.setDestIpAddress("::-::");
|
||||
baseIpCfg.setIpPattern(2);
|
||||
}else if(ipCfg.getSrcIpAddress().indexOf("/") > -1){
|
||||
baseIpCfg.setSrcIpAddress(ipCfg.getSrcIpAddress());
|
||||
}else if(baseIpCfg.getSrcIpAddress().indexOf("/") > -1){
|
||||
baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
|
||||
baseIpCfg.setDestIpAddress("::/128");
|
||||
baseIpCfg.setIpPattern(1);
|
||||
}else{
|
||||
baseIpCfg.setSrcIpAddress(ipCfg.getSrcIpAddress());
|
||||
baseIpCfg.setSrcIpAddress(baseIpCfg.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]);
|
||||
if(baseIpCfg.getSrcIpAddress().indexOf("-") > -1){
|
||||
baseIpCfg.setSrcIpAddress("0.0.0.0-"+baseIpCfg.getSrcIpAddress().split("-")[0].substring(0,baseIpCfg.getSrcIpAddress().indexOf("-")+1)+baseIpCfg.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());
|
||||
}else if(baseIpCfg.getSrcIpAddress().indexOf("/") > -1){
|
||||
baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
|
||||
baseIpCfg.setDestIpAddress("0.0.0.0/16");
|
||||
baseIpCfg.setIpPattern(1);
|
||||
}else{
|
||||
baseIpCfg.setSrcIpAddress(ipCfg.getSrcIpAddress());
|
||||
baseIpCfg.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
|
||||
baseIpCfg.setDestIpAddress("0.0.0.0");
|
||||
baseIpCfg.setIpPattern(3);
|
||||
}
|
||||
@@ -843,48 +843,50 @@ public class BaseController {
|
||||
}
|
||||
} else{
|
||||
if(srcIpEmpty){
|
||||
if(ipCfg.getDestIpAddress().indexOf(":") > -1){
|
||||
if(ipCfg.getDestIpAddress().indexOf("-") > -1){
|
||||
baseIpCfg.setDestIpAddress(ipCfg.getDestIpAddress());
|
||||
if(baseIpCfg.getDestIpAddress().indexOf(":") > -1){
|
||||
if(baseIpCfg.getDestIpAddress().indexOf("-") > -1){
|
||||
baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
|
||||
baseIpCfg.setSrcIpAddress("::-::");
|
||||
baseIpCfg.setIpPattern(2);
|
||||
}else if(ipCfg.getDestIpAddress().indexOf("/") > -1){
|
||||
baseIpCfg.setDestIpAddress(ipCfg.getDestIpAddress());
|
||||
}else if(baseIpCfg.getDestIpAddress().indexOf("/") > -1){
|
||||
baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
|
||||
baseIpCfg.setSrcIpAddress("::/128");
|
||||
baseIpCfg.setIpPattern(1);
|
||||
}else{
|
||||
baseIpCfg.setDestIpAddress(ipCfg.getDestIpAddress());
|
||||
baseIpCfg.setDestIpAddress(baseIpCfg.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]);
|
||||
if(baseIpCfg.getDestIpAddress().indexOf("-") > -1){
|
||||
baseIpCfg.setDestIpAddress("0.0.0.0-"+baseIpCfg.getDestIpAddress().split("-")[0]
|
||||
.substring(0,baseIpCfg.getDestIpAddress().indexOf("-")+1)
|
||||
+baseIpCfg.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());
|
||||
}else if(baseIpCfg.getDestIpAddress().indexOf("/") > -1){
|
||||
baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
|
||||
baseIpCfg.setSrcIpAddress("0.0.0.0/16");
|
||||
baseIpCfg.setIpPattern(1);
|
||||
}else{
|
||||
baseIpCfg.setDestIpAddress(ipCfg.getDestIpAddress());
|
||||
baseIpCfg.setDestIpAddress(baseIpCfg.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.setSrcIpAddress(baseIpCfg.getSrcIpAddress());
|
||||
baseIpCfg.setDestIpAddress(baseIpCfg.getDestIpAddress());
|
||||
if(baseIpCfg.getSrcIpAddress().indexOf(":") > -1){
|
||||
baseIpCfg.setIpType(6);
|
||||
}else{
|
||||
baseIpCfg.setIpType(4);
|
||||
}
|
||||
if(ipCfg.getSrcIpAddress().indexOf("-") > -1){
|
||||
if(baseIpCfg.getSrcIpAddress().indexOf("-") > -1){
|
||||
baseIpCfg.setIpPattern(2);
|
||||
}else if(ipCfg.getSrcIpAddress().indexOf("/") > -1){
|
||||
}else if(baseIpCfg.getSrcIpAddress().indexOf("/") > -1){
|
||||
baseIpCfg.setIpPattern(1);
|
||||
}else{
|
||||
baseIpCfg.setIpPattern(3);
|
||||
@@ -895,49 +897,49 @@ public class BaseController {
|
||||
//TODO 判断源IP和目的IP的值
|
||||
//TODO 判断源IP和目的IP格式
|
||||
|
||||
if(StringUtil.isEmpty(ipCfg.getSrcPort())){
|
||||
if(StringUtil.isEmpty(baseIpCfg.getSrcPort())){
|
||||
srcPortEmpty=true;
|
||||
}
|
||||
if(StringUtil.isEmpty(ipCfg.getDestPort())){
|
||||
if(StringUtil.isEmpty(baseIpCfg.getDestPort())){
|
||||
if(srcPortEmpty){
|
||||
baseIpCfg.setSrcPort("0");
|
||||
baseIpCfg.setDestPort("0");
|
||||
baseIpCfg.setPortPattern(1);
|
||||
}else{
|
||||
if(ipCfg.getSrcPort().indexOf("/") > -1){
|
||||
if(baseIpCfg.getSrcPort().indexOf("/") > -1){
|
||||
baseIpCfg.setDestPort("0/0");
|
||||
baseIpCfg.setPortPattern(2);
|
||||
}else{
|
||||
baseIpCfg.setDestPort("0");
|
||||
baseIpCfg.setPortPattern(1);
|
||||
}
|
||||
baseIpCfg.setSrcPort(ipCfg.getSrcPort());
|
||||
baseIpCfg.setSrcPort(baseIpCfg.getSrcPort());
|
||||
}
|
||||
}else{
|
||||
if(srcPortEmpty){
|
||||
if(ipCfg.getDestPort().indexOf("/") > -1){
|
||||
if(baseIpCfg.getDestPort().indexOf("/") > -1){
|
||||
baseIpCfg.setSrcPort("0/0");
|
||||
baseIpCfg.setPortPattern(2);
|
||||
}else{
|
||||
baseIpCfg.setSrcPort("0");
|
||||
baseIpCfg.setPortPattern(1);
|
||||
}
|
||||
baseIpCfg.setDestPort(ipCfg.getSrcPort());
|
||||
baseIpCfg.setDestPort(baseIpCfg.getSrcPort());
|
||||
}else{
|
||||
if(ipCfg.getSrcPort().indexOf("/") > -1){
|
||||
if(baseIpCfg.getSrcPort().indexOf("/") > -1){
|
||||
baseIpCfg.setPortPattern(2);
|
||||
}else{
|
||||
baseIpCfg.setPortPattern(1);
|
||||
}
|
||||
baseIpCfg.setSrcPort(ipCfg.getSrcPort());
|
||||
baseIpCfg.setDestPort(ipCfg.getDestPort());
|
||||
baseIpCfg.setSrcPort(baseIpCfg.getSrcPort());
|
||||
baseIpCfg.setDestPort(baseIpCfg.getDestPort());
|
||||
|
||||
}
|
||||
}
|
||||
//TODO 判断源端口和目的端口格式
|
||||
//TODO 判断源和目的端口的值
|
||||
|
||||
if(StringUtil.isEmpty(ipCfg.getProtocol())){
|
||||
if(StringUtil.isEmpty(baseIpCfg.getProtocol())){
|
||||
if(StringUtil.isEmpty(regionDict.getConfigProtocol())){
|
||||
baseIpCfg.setProtocol(0);
|
||||
}else{
|
||||
@@ -945,24 +947,23 @@ public class BaseController {
|
||||
}
|
||||
baseIpCfg.setProtocolId(serviceDict.getProtocolId());
|
||||
}else{
|
||||
baseIpCfg.setProtocol(ipCfg.getProtocol());
|
||||
baseIpCfg.setProtocol(baseIpCfg.getProtocol());
|
||||
baseIpCfg.setProtocolId(serviceDict.getProtocolId());
|
||||
}
|
||||
//TODO 判断Protocol的值
|
||||
|
||||
if(StringUtil.isEmpty(ipCfg.getDirection())){
|
||||
if(StringUtil.isEmpty(baseIpCfg.getDirection())){
|
||||
if(StringUtil.isEmpty(regionDict.getConfigDirection())){
|
||||
baseIpCfg.setDirection(0);
|
||||
}else{
|
||||
baseIpCfg.setDirection(Integer.parseInt(regionDict.getConfigDirection().split(",")[0]));
|
||||
}
|
||||
}else{
|
||||
baseIpCfg.setDirection(ipCfg.getDirection());
|
||||
baseIpCfg.setDirection(baseIpCfg.getDirection());
|
||||
}
|
||||
|
||||
//TODO 判断Direction的值
|
||||
}
|
||||
}
|
||||
ipList.add(baseIpCfg);
|
||||
}
|
||||
return ipList;
|
||||
@@ -2159,40 +2160,48 @@ public class BaseController {
|
||||
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);
|
||||
if(regionDict.getFunctionId().equals(5) ){
|
||||
if(serviceDict.getAction().equals(64)){//ip
|
||||
if(regionDict.getRegionType().equals(1)){
|
||||
List<IpRateLimitTemplate> list = ei.getDataList(IpRateLimitTemplate.class);
|
||||
ipPortCfgs=this.checkIpCfg(serviceDict,regionDict,list);
|
||||
}
|
||||
}else{
|
||||
if(regionDict.getRegionType().equals(1)){
|
||||
List<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class);
|
||||
ipPortCfgs=this.checkIpCfg(serviceDict,regionDict,list);
|
||||
}
|
||||
}
|
||||
}else 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);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,11 @@ import com.nis.util.StringUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
import it.sauronsoftware.jave.AudioInfo;
|
||||
import it.sauronsoftware.jave.Encoder;
|
||||
import it.sauronsoftware.jave.MultimediaInfo;
|
||||
import it.sauronsoftware.jave.VideoInfo;
|
||||
|
||||
/**
|
||||
* 处理音视频业务
|
||||
* @author zhangwei
|
||||
@@ -157,11 +162,33 @@ public class AvController extends BaseController {
|
||||
|
||||
// entity.setSrcMd5(srcMd5);
|
||||
// entity.setSampleMd5(sampleMd5);
|
||||
//验证音视频文件时长
|
||||
Encoder encoder = new Encoder();
|
||||
String length = "";
|
||||
try {
|
||||
MultimediaInfo m = encoder.getInfo(uploadSrcFile);
|
||||
long ls = m.getDuration()/1000;
|
||||
int hour = (int) (ls/3600);
|
||||
int minute = (int) (ls%3600)/60;
|
||||
int second = (int) (ls-hour*3600-minute*60);
|
||||
length = hour+"'"+minute+"''"+second+"'''";
|
||||
logger.info(uploadSrcFile.getName()+"时长:"+length);
|
||||
if(ls>0 && second>Constants.AV_DURATION_LIMIT){
|
||||
addMessage(redirectAttributes,"exceeds_duration_limit");
|
||||
logger.error("The duration of uploaded files exceeds the limit("+Constants.AV_DURATION_LIMIT+"s).");
|
||||
return "redirect:" + adminPath +"/ntc/av/sample/fileSampleList?functionId="+entity.getFunctionId();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
addMessage(redirectAttributes,"save_failed");
|
||||
return "redirect:" + adminPath +"/ntc/av/sample/fileSampleList?functionId="+entity.getFunctionId();
|
||||
}
|
||||
}
|
||||
|
||||
avCfgService.saveOrUpdateAvFileSample(entity, srcFile);
|
||||
addMessage(redirectAttributes,"save_success");
|
||||
|
||||
|
||||
}catch(Exception e){
|
||||
logger.error("文件上传失败",e);
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.template.IpAllTemplate;
|
||||
import com.nis.domain.configuration.template.IpRateLimitTemplate;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.Constants;
|
||||
@@ -226,32 +227,41 @@ public class IpController extends BaseController{
|
||||
,FunctionRegionDict regionDict
|
||||
,FunctionServiceDict serviceDict
|
||||
,Integer requestId) throws Exception{
|
||||
String fileName = "test.xlsx";
|
||||
//maat导入模板
|
||||
if(regionDict.getIsMaat().equals(1)){
|
||||
String fileName = "template.xlsx";
|
||||
//ip类模板
|
||||
if(regionDict.getRegionType().equals(1)){
|
||||
if(regionDict.getFunctionId().equals(5)){
|
||||
if(regionDict.getRegionType().equals(1)){
|
||||
if(serviceDict.getAction().equals(64)){//ip限速
|
||||
List<IpRateLimitTemplate> classList=new ArrayList<IpRateLimitTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, IpRateLimitTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}else{
|
||||
List<IpAllTemplate> classList=new ArrayList<IpAllTemplate>();
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, IpAllTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}
|
||||
}
|
||||
}else if(regionDict.getRegionType().equals(1)){
|
||||
List<IpAllTemplate> classList=new ArrayList<IpAllTemplate>();
|
||||
ExportExcel excel=new ExportExcel(regionDict,this.getMsgProp(),null, IpAllTemplate.class, 2);
|
||||
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, IpAllTemplate.class, 2);
|
||||
excel.setDataList(this.getMsgProp(),classList,null).
|
||||
write(request,response, fileName).dispose();
|
||||
}
|
||||
//str类模板
|
||||
/*//str类模板
|
||||
if(regionDict.getRegionType().equals(2)){
|
||||
/*List<IpAllTemplate> classList=new ArrayList<IpAllTemplate>();
|
||||
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();*/
|
||||
write(request,response, fileName).dispose();
|
||||
}
|
||||
//district类模板
|
||||
if(regionDict.getRegionType().equals(2)){
|
||||
/*ExportExcel excel=new ExportExcel(this.getMsgProp(),null, IpAllTemplate.class, 2,regionDict);
|
||||
ExportExcel excel=new ExportExcel(this.getMsgProp(),null, IpAllTemplate.class, 2,regionDict);
|
||||
excel.setDataList(this.getMsgProp(),classList,null).
|
||||
write(request,response, fileName).dispose();*/
|
||||
}
|
||||
}else{
|
||||
//非maat导入模板
|
||||
}
|
||||
write(request,response, fileName).dispose();
|
||||
}*/
|
||||
}
|
||||
|
||||
//ip配置导入
|
||||
|
||||
@@ -758,6 +758,8 @@ public abstract class BaseService {
|
||||
BeanUtils.copyProperties(baseIpCfg, cfg);
|
||||
cfg.setGroupId(groupId);
|
||||
cfg.setRegionId(Integer.parseInt(appIpCfg.getUserRegion1()));
|
||||
String userRegion = "APP_ID=" + appIpCfg.getAppCode();
|
||||
cfg.setUserRegion(userRegion);
|
||||
}
|
||||
cfg.setIsValid(isValid);
|
||||
cfg = ipConvert(cfg,baseIpCfg);
|
||||
|
||||
@@ -1161,6 +1161,8 @@ public class AppCfgService extends BaseService {
|
||||
GroupReuseAddBean maatBean = new GroupReuseAddBean();
|
||||
List<GroupReuseCfg> groupReuseList=new ArrayList<>();
|
||||
GroupReuseCfg groupReuseCfg=new GroupReuseCfg();
|
||||
/*groupReuseCfg.setUserRegion(userRegion);*/
|
||||
groupReuseCfg.setServiceId(entitys.get(0).getServiceId());
|
||||
ipRegionList.addAll(groupReuseCfgAddRemoveConvert(entitys,Constants.VALID_YES,groupId));
|
||||
groupReuseCfg.setIpRegionList(ipRegionList);
|
||||
groupReuseCfg.setStrRegionList(strRegionList);
|
||||
|
||||
Reference in New Issue
Block a user