Merge branch 'develop' of http://192.168.10.125/k18_web/NFS.git into develop

This commit is contained in:
leijun
2018-10-17 10:26:56 +08:00
27 changed files with 410 additions and 163 deletions

BIN
lib/jave-1.0.2.jar Normal file

Binary file not shown.

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
/**
*
*/

View File

@@ -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;
}

View File

@@ -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);
}

View File

@@ -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,6 +238,38 @@ public class ExportExcel {
}
//导入的Protocol
if("protocol".equals(headerStr)){
if(service.getFunctionId().equals(5) ){
commentStr="";
List<SysDataDictionaryItem> protocol=DictUtils.getDictList("PROTOCOL");
if(protocol !=null && protocol.size()>0){
for (SysDataDictionaryItem sysDataDictionaryItem : protocol) {
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="";
@@ -257,6 +290,7 @@ public class ExportExcel {
}
}
}
}
//导入的Direction
if("direction".equals(headerStr)){
@@ -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);

View File

@@ -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,11 +2160,22 @@ 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.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();
@@ -2190,9 +2202,6 @@ public class BaseController {
BeanUtils.copyProperties(cfg, cfgIndexInfo);
cfgIndexInfos.add(cfgIndexInfo);
}
}
}
ipCfgService.saveBatch(ipPortCfgs, IpCfgDao.class);
ipCfgService.saveCfgIndexOf(cfgIndexInfos);
}

View File

@@ -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();

View File

@@ -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.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(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类模板
}
}else if(regionDict.getRegionType().equals(1)){
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();
}
/*//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配置导入

View File

@@ -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);

View File

@@ -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);

View File

@@ -1246,3 +1246,4 @@ mail_address_monit=Mail Address Monit
mail_address_reject=Mail Address Reject
ipsec_protocol=IPSEC Protocol
intercept_intensity=Intercept Related Domains
exceeds_duration_limit=File upload failure,The duration of uploaded files exceeds the limit.

View File

@@ -1266,3 +1266,4 @@ mail_address_monit=Mail Address Monit
mail_address_reject=Mail Address Reject
ipsec_protocol=IPSEC Protocol
intercept_intensity=Intercept Related Domains
exceeds_duration_limit=File upload failure,The duration of uploaded files exceeds the limit.

View File

@@ -1240,4 +1240,4 @@ mail_address_monit=\u90AE\u4EF6\u5730\u5740\u76D1\u6D4B
mail_address_reject=\u90AE\u4EF6\u5730\u5740\u7BA1\u63A7
ipsec_protocol=IPSEC\u534F\u8BAE
intercept_intensity=\u62E6\u622A\u5F3A\u5EA6
exceeds_duration_limit=\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25,\u6587\u4EF6\u65F6\u957F\u8D85\u51FA\u9650\u5236.

View File

@@ -529,3 +529,5 @@ area_tag=location
isp_tag=isp
mmFileDigestLog=mmFileDigestLogs
ntcStreamMediaLog=ntcStreamMediaLogs
#音视频样例限制时长,单位秒
av_duration_limit=10

View File

@@ -0,0 +1,4 @@
alter table cfg_num_statistics modify column id bigint;
alter table request_num_statistics modify column id bigint;
alter table proc_exec_log modify column id bigint;
alter table sys_log modify column id bigint;

View File

@@ -32,28 +32,26 @@ $(function(){
<div class="col-md-6">
<c:forEach items="${serviceList}" var="service"
varStatus="satus">
<label class="radio-inline">
<c:if test="${cfg.functionId eq service.functionId}">
<c:forEach items="${fns:getDictList('MAAT_SERVICE')}" var="serviceC">
<c:if test="${service.serviceId==serviceC.itemCode}">
<span class="${serviceC.itemValue}">
<input type="radio" name="serviceDictId" <c:if test="${serviceList.size() eq 1}">checked</c:if>
<c:if test="${(service.serviceId ne 37) && (service.serviceId ne 149)}">
<label class="radio-inline"> <c:if
test="${cfg.functionId eq service.functionId}">
<input type="radio" name="serviceDictId"
serviceId="${service.serviceId }"
functionId="${service.functionId }"
cfgRegionCodeS="${service.regionCode }"
protocolId="${service.protocolId }"
action="${service.action }"
value="${service.dictId }" class="required action">
value="${service.dictId }"
class="required action"
<c:if test="${satus.index eq 0}">checked</c:if>>
<c:forEach items="${fns:getDictList('SERVICE_ACTION') }" var="dict">
<c:if test="${dict.itemCode eq service.action}">
<c:if test="${dict.itemCode eq service.action }">
<spring:message code="${dict.itemValue }"/>
</c:if>
</c:forEach>
</span>
</c:if>
</c:forEach>
</c:if>
</label>
</c:if>
</c:forEach>
</div>
<div for="action"></div>

View File

@@ -192,6 +192,7 @@ var delContent = function(contentClassName, addBtnClassName) {
<input class="form-control" type="text" name="userRegion1"
value="${_cfg.userRegion1}">
</div>
<div for="userRegion1"></div>
</div>
</div>
</div>

View File

@@ -88,10 +88,10 @@ function hiddenlevel(){
var action=$("input[name='action']:checked").val();
if(action==16){
$(".leveL").addClass("hidden");
$("input[name='level']").val(0);
$("select[name='level']").val(0);
}else {
$(".leveL").removeClass("hidden");
$("input[name='level']").val(0);
$("select[name='level']").val(0);
}
}
</script>
@@ -215,7 +215,12 @@ function hiddenlevel(){
<div class="form-group ">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="harm_level"/></label>
<div class="col-md-6">
<input class="form-control required number" range="[75,99]" type="text" name="level" value="${_cfg.level }">
<select name="level" data-live-search="true" class="selectpicker form-control required">
<option value="0" ><spring:message code="selected"/></option>
<c:forEach items="${fns:getDictList('CONFIDENCE_INTERVAL')}" var="configdenceC">
<option value="${configdenceC.itemCode}" <c:if test="${_cfg.level==configdenceC.itemCode || (_cfg.level==null && configdenceC.itemCode eq 100)}">selected</c:if>><spring:message code="${configdenceC.itemValue}"/></option>
</c:forEach>
</select>
</div>
<div for="level"></div>
</div>

View File

@@ -41,8 +41,9 @@
<c:if test="${cfg.district==_district}">selected</c:if>>${_district }</option>
</c:forEach>
</select>
<input type="hidden" name="${cfgName}.districtShowName" placeholder="<spring:message code='please_input'/> <spring:message code='custom_region'/>" class="otherValue form-control" value="${cfg.district}"/>
<input type="hidden" name="${cfgName}.districtShowName" placeholder="<spring:message code='please_input'/> <spring:message code='custom_region'/>" class="otherValue form-control invisibleChar" value="${cfg.district}"/>
</div>
<div for="${cfgName}.districtShowName"></div>
<div for="${cfgName}.district"></div>
</div>
</div>

View File

@@ -76,7 +76,7 @@
$(".bandwith").find("input[name='userRegion3']").attr("disabled",true);
}
if(rateLimitType == 1){//带宽
$(".droprate").find("input[name='userRegion2']").attr("disabled",true);
$(".droprate").find("select[name='userRegion2']").attr("disabled",true);
}
}else if(action==80){//替换
$(".monitAction").find("input[name^='userRegion'],select[name^='userRegion']").attr("disabled",true);
@@ -317,7 +317,12 @@
<div class="form-group ">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="ratelimit"/></label>
<div class="col-md-6">
<input class="form-control required number" range="[0,1]" type="text" placeholder="0.001" name="userRegion2" value="${_cfg.userRegion2 }">
<select name="userRegion2" data-live-search="true" class="selectpicker form-control required">
<option value="" ><spring:message code="selected"/></option>
<c:forEach items="${fns:getDictList('RATE_LIMIT')}" var="ratelimitC">
<option value="${ratelimitC.itemCode}" <c:if test="${_cfg.userRegion2==ratelimitC.itemCode || (_cfg.userRegion2==null && ratelimitC.itemCode eq '0.001')}">selected</c:if>><spring:message code="${ratelimitC.itemValue}"/></option>
</c:forEach>
</select>
</div>
<div for="userRegion2"></div>
</div>

View File

@@ -375,7 +375,11 @@
<c:if test="${cfg.functionId ne 212 }">
<td>
<c:if test="${indexCfg.action eq 64}">
${indexCfg.userRegion2 }
<c:forEach items="${fns:getDictList('RATE_LIMIT')}" var="ratelimitC">
<c:if test="${indexCfg.userRegion2==ratelimitC.itemCode}">
<spring:message code="${ratelimitC.itemValue}"/>
</c:if>
</c:forEach>
</c:if>
</td>
<%-- <td>

View File

@@ -337,11 +337,13 @@ var processAction=function(configType,obj){
var rateLimitType=$("input[name='userRegion1']:checked").val();
if(rateLimitType == 0){//丢包率
$(".bandwith").find("input[name='userRegion3']").attr("disabled",true);
$(".droprate").find("input[name='userRegion2']").removeAttr("disabled");
$(".droprate").find("select[name='userRegion2']").removeAttr("disabled");
$(".droprate").find("select[name='userRegion2']").selectpicker("refresh");
}
if(rateLimitType == 1){//带宽
$(".bandwith").find("input[name='userRegion3']").removeAttr("disabled");
$(".droprate").find("input[name='userRegion2']").attr("disabled",true);
$(".droprate").find("select[name='userRegion2']").attr("disabled",true);
$(".droprate").find("select[name='userRegion2']").selectpicker("refresh");
}
}else if(action==1){
//先清空,再添加
@@ -545,7 +547,12 @@ var showHideIPSECProtocol=function(obj){
<div class="form-group ">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="ratelimit"/></label>
<div class="col-md-6">
<input class="form-control required number" range="[0,1]" type="text" placeholder="0.001" name="userRegion2" value="${_cfg.userRegion2 }">
<select name="userRegion2" data-live-search="true" class="selectpicker form-control required">
<option value="" ><spring:message code="selected"/></option>
<c:forEach items="${fns:getDictList('RATE_LIMIT')}" var="ratelimitC">
<option value="${ratelimitC.itemCode}" <c:if test="${_cfg.userRegion2==ratelimitC.itemCode || (_cfg.userRegion2==null && ratelimitC.itemCode eq '0.001')}">selected</c:if>><spring:message code="${ratelimitC.itemValue}"/></option>
</c:forEach>
</select>
</div>
<div for="userRegion2"></div>
</div>

View File

@@ -85,12 +85,17 @@
<body>
<div class="page-content">
<!-- 模板导入start -->
<%@include file="/WEB-INF/include/excel/importModal.jsp" %>
<div class="theme-panel hidden-xs hidden-sm">
<shiro:hasPermission name="iplist:config">
<button type="button" class="btn btn-primary"
onClick="javascript:window.location='${ctx}/ntc/iplist/form?functionId=${cfg.functionId}'">
<i class="fa fa-plus"></i>
<spring:message code="add"></spring:message></button>
<button type="button" class="btn btn-primary import" >
<i class="fa fa-plus"></i>
<spring:message code="import"></spring:message></button>
</shiro:hasPermission>
</div>
@@ -166,7 +171,7 @@
<shiro:hasPermission name="iplist:config">
<sys:delRow url="${ctx}/ntc/iplist/form" id="contentTable" label="update"></sys:delRow>
<sys:delRow url="${ctx}/ntc/iplist/updateValid?isValid=-1&functionId=${cfg.functionId }" id="contentTable" label="delete"></sys:delRow>
<%-- <sys:delRow url="${ctx}/ntc/iplist/exportIpAddr?functionId=${cfg.functionId }" searchUrl="${ctx}/ntc/iplist/list?functionId=${cfg.functionId}" id="contentTable" maxRow="10000" label="export"></sys:delRow> --%>
<sys:delRow url="${ctx}/ntc/iplist/exportIpAddr?functionId=${cfg.functionId }" searchUrl="${ctx}/ntc/iplist/list?functionId=${cfg.functionId}" id="contentTable" maxRow="10000" label="export"></sys:delRow>
</shiro:hasPermission>
<shiro:hasPermission name="iplist:confirm">
<div class="btn-group">
@@ -357,7 +362,13 @@
</c:if>
</c:forEach>
</td>
<td>${indexCfg.userRegion2 }</td>
<td>
<c:forEach items="${fns:getDictList('RATE_LIMIT')}" var="ratelimitC">
<c:if test="${indexCfg.userRegion2==ratelimitC.itemCode}">
<spring:message code="${ratelimitC.itemValue}"/>
</c:if>
</c:forEach>
</td>
<td>
<c:forEach items="${fns:getDictList('DO_LOG') }" var="dict">
<c:if test="${dict.itemCode eq indexCfg.doLog }">