1:新增webFocusDb业务
2:修改编译配置对doblacklist,exprType的校验值 3:新增从clickhouse查询流量统计的controller,service,dao等 4:新增对maat类配置支持停启用
This commit is contained in:
@@ -0,0 +1,89 @@
|
|||||||
|
/**
|
||||||
|
* @Title: DfConfigCompile.java
|
||||||
|
* @Package com.nis.domain.restful
|
||||||
|
* @Description: TODO(用一句话描述该文件做什么)
|
||||||
|
* @author (darnell)
|
||||||
|
* @date 2016年8月29日 下午9:36:28
|
||||||
|
* @version V1.0
|
||||||
|
*/
|
||||||
|
package com.nis.domain.restful;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
|
import com.nis.util.JsonDateDeserializer;
|
||||||
|
import com.wordnik.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName: ConfigCompileStartStop
|
||||||
|
* @Description: TODO(这里用一句话描述这个类的作用)
|
||||||
|
* @author (rkg)
|
||||||
|
* @date 2018年12月22日 下午4:36:28
|
||||||
|
* @version V1.0
|
||||||
|
*/
|
||||||
|
public class ConfigCompileStartStop implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 546753235262247839L;
|
||||||
|
@ApiModelProperty(value = "配置ID", required = true)
|
||||||
|
private Long compileId;
|
||||||
|
@ApiModelProperty(value = "有效标志", required = true)
|
||||||
|
private Integer isValid;
|
||||||
|
@ApiModelProperty(value = "业务类型", required = true)
|
||||||
|
private Integer service;
|
||||||
|
@ApiModelProperty(value = "操作时间", required = true)
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date opTime;
|
||||||
|
|
||||||
|
public Long getCompileId() {
|
||||||
|
return compileId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompileId(Long compileId) {
|
||||||
|
this.compileId = compileId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return isValid
|
||||||
|
*/
|
||||||
|
public Integer getIsValid() {
|
||||||
|
return isValid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isValid 要设置的 isValid
|
||||||
|
*/
|
||||||
|
public void setIsValid(Integer isValid) {
|
||||||
|
this.isValid = isValid;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Integer getService() {
|
||||||
|
return service;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setService(Integer service) {
|
||||||
|
this.service = service;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return opTime
|
||||||
|
*/
|
||||||
|
@JsonDeserialize(using = JsonDateDeserializer.class)
|
||||||
|
public Date getOpTime() {
|
||||||
|
return opTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param opTime 要设置的 opTime
|
||||||
|
*/
|
||||||
|
@JsonDeserialize(using = JsonDateDeserializer.class)
|
||||||
|
public void setOpTime(Date opTime) {
|
||||||
|
this.opTime = opTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
114
src/main/java/com/nis/domain/restful/ConfigSourceStartStop.java
Normal file
114
src/main/java/com/nis/domain/restful/ConfigSourceStartStop.java
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
/**
|
||||||
|
* @Title: ConfigSource.java
|
||||||
|
* @Package com.nis.domain.restful
|
||||||
|
* @Description: TODO(用一句话描述该文件做什么)
|
||||||
|
* @author (darnell)
|
||||||
|
* @date 2016年8月29日 下午9:31:24
|
||||||
|
* @version V1.0
|
||||||
|
*/
|
||||||
|
package com.nis.domain.restful;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.nis.util.JsonDateDeserializer;
|
||||||
|
import com.nis.util.JsonDateSerializer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName: ConfigSourceStartStop
|
||||||
|
* @Description: TODO(这里用一句话描述这个类的作用)
|
||||||
|
* @author (darnell)
|
||||||
|
* @date 2016年8月31日 下午8:32:43
|
||||||
|
* @version V1.0
|
||||||
|
*/
|
||||||
|
public class ConfigSourceStartStop extends ConfigCommonSource {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private static final String DEFAULT_VERSION = "2.0";
|
||||||
|
private List<ConfigCompile> configCompileStartStopList; // 编译配置列表
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Title:
|
||||||
|
* @Description: TODO
|
||||||
|
* @param
|
||||||
|
*/
|
||||||
|
public ConfigSourceStartStop() {
|
||||||
|
this.version = DEFAULT_VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConfigSourceStartStop(String Version) {
|
||||||
|
this.version = Version;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return version
|
||||||
|
*/
|
||||||
|
public String getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param version 要设置的 version
|
||||||
|
*/
|
||||||
|
public void setVersion(String version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return operator
|
||||||
|
*/
|
||||||
|
public String getOperator() {
|
||||||
|
return operator;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param operator 要设置的 operator
|
||||||
|
*/
|
||||||
|
public void setOperator(String operator) {
|
||||||
|
this.operator = operator;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return opTime
|
||||||
|
*/
|
||||||
|
@JsonSerialize(using = JsonDateSerializer.class)
|
||||||
|
public Date getOpTime() {
|
||||||
|
return opTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param opTime 要设置的 opTime
|
||||||
|
*/
|
||||||
|
@JsonDeserialize(using = JsonDateDeserializer.class)
|
||||||
|
public void setOpTime(Date opTime) {
|
||||||
|
this.opTime = opTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return opAction
|
||||||
|
*/
|
||||||
|
public Integer getOpAction() {
|
||||||
|
return opAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param opAction 要设置的 opAction
|
||||||
|
*/
|
||||||
|
public void setOpAction(Integer opAction) {
|
||||||
|
this.opAction = opAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ConfigCompile> getConfigCompileStartStopList() {
|
||||||
|
return configCompileStartStopList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConfigCompileStartStopList(List<ConfigCompile> configCompileStartStopList) {
|
||||||
|
this.configCompileStartStopList = configCompileStartStopList;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,14 +3,17 @@ package com.nis.domain.restful;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlTransient;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.nis.domain.Page;
|
||||||
import com.nis.util.JsonDateSerializer;
|
import com.nis.util.JsonDateSerializer;
|
||||||
import com.wordnik.swagger.annotations.ApiModelProperty;
|
import com.wordnik.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
public class NtcRadiusReport implements Serializable{
|
public class NtcRadiusReport<T> implements Serializable{
|
||||||
|
|
||||||
private static final long serialVersionUID = 7635016645942704971L;
|
private static final long serialVersionUID = 7635016645942704971L;
|
||||||
@JsonInclude(value = Include.NON_NULL)
|
@JsonInclude(value = Include.NON_NULL)
|
||||||
@@ -39,6 +42,9 @@ public class NtcRadiusReport implements Serializable{
|
|||||||
protected String searchAccount;
|
protected String searchAccount;
|
||||||
protected String groupType;
|
protected String groupType;
|
||||||
|
|
||||||
|
|
||||||
|
protected Page<T> page;
|
||||||
|
|
||||||
public String getNasIp() {
|
public String getNasIp() {
|
||||||
return nasIp;
|
return nasIp;
|
||||||
}
|
}
|
||||||
@@ -136,4 +142,17 @@ public class NtcRadiusReport implements Serializable{
|
|||||||
this.groupType = groupType;
|
this.groupType = groupType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
@XmlTransient
|
||||||
|
public Page<T> getPage() {
|
||||||
|
if (page == null) {
|
||||||
|
page = new Page<T>();
|
||||||
|
}
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Page<T> setPage(Page<T> page) {
|
||||||
|
this.page = page;
|
||||||
|
return page;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ public class TrafficNetflowPortInfo implements Serializable {
|
|||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
private long stat_id;
|
private long stat_id;
|
||||||
private long port;
|
private long port;
|
||||||
|
private long entranceId;
|
||||||
private String nodeName;
|
private String nodeName;
|
||||||
private String nodeIp;
|
private String nodeIp;
|
||||||
private String portDesc;
|
private String portDesc;
|
||||||
@@ -45,6 +46,14 @@ public class TrafficNetflowPortInfo implements Serializable {
|
|||||||
this.port = port;
|
this.port = port;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getEntranceId() {
|
||||||
|
return entranceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEntranceId(long entranceId) {
|
||||||
|
this.entranceId = entranceId;
|
||||||
|
}
|
||||||
|
|
||||||
public String getNodeName() {
|
public String getNodeName() {
|
||||||
return nodeName;
|
return nodeName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class DataSourceBInterceptor implements HandlerInterceptor {
|
|||||||
public boolean preHandle(HttpServletRequest request,
|
public boolean preHandle(HttpServletRequest request,
|
||||||
HttpServletResponse response, Object handler) throws Exception {
|
HttpServletResponse response, Object handler) throws Exception {
|
||||||
logger.info("开启数据源配置操作库---");
|
logger.info("开启数据源配置操作库---");
|
||||||
CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_B);//开启数据源B
|
CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_B);//开启数据源B(我们自己的clickhouse)
|
||||||
logger.info("mysql日志数据源开启成功---"+System.currentTimeMillis());
|
logger.info("mysql日志数据源开启成功---"+System.currentTimeMillis());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -901,8 +901,8 @@ public class CompileVal {
|
|||||||
"编译配置id为" + compileId + "的配置中service的值为" + configCompile.getService() + "时action只能为" + action,
|
"编译配置id为" + compileId + "的配置中service的值为" + configCompile.getService() + "时action只能为" + action,
|
||||||
RestBusinessCode.ServiceUnmatchAction.getValue());
|
RestBusinessCode.ServiceUnmatchAction.getValue());
|
||||||
}
|
}
|
||||||
if (configCompile.getDoBlacklist() != 1) {
|
if (configCompile.getDoBlacklist() != 1&&configCompile.getDoBlacklist() != 0) {
|
||||||
throw new RestServiceException("编译配置id为" + compileId + "的配置中doBlacklist的值只能是1",
|
throw new RestServiceException("编译配置id为" + compileId + "的配置中doBlacklist的值只能是1或0",
|
||||||
RestBusinessCode.DoBlacklistIsWrongRange.getValue());
|
RestBusinessCode.DoBlacklistIsWrongRange.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -926,9 +926,9 @@ public class CompileVal {
|
|||||||
Integer exprType= strRegion.getExprType();
|
Integer exprType= strRegion.getExprType();
|
||||||
Integer matchMethod = strRegion.getMatchMethod();
|
Integer matchMethod = strRegion.getMatchMethod();
|
||||||
Integer isHexbin = strRegion.getIsHexbin();
|
Integer isHexbin = strRegion.getIsHexbin();
|
||||||
if (exprType != 0 && exprType != 1) {
|
if (exprType != 0 && exprType != 1 && exprType != 3) {
|
||||||
throw new RestServiceException("编译配置id为" + compileId + "的配置中strRegionList中regionId为"
|
throw new RestServiceException("编译配置id为" + compileId + "的配置中strRegionList中regionId为"
|
||||||
+ strRegion.getRegionId() + "的域配置exprType的值只能是0(无表达式)或者1(与表达式)",
|
+ strRegion.getRegionId() + "的域配置exprType的值只能是0(无表达式)或者1(与表达式)或者3(偏移表达式)",
|
||||||
RestBusinessCode.ExprTypeIsWrongRange.getValue());
|
RestBusinessCode.ExprTypeIsWrongRange.getValue());
|
||||||
}
|
}
|
||||||
if (matchMethod != 0 && matchMethod != 1 && matchMethod != 2 && matchMethod != 3) {
|
if (matchMethod != 0 && matchMethod != 1 && matchMethod != 2 && matchMethod != 3) {
|
||||||
|
|||||||
@@ -233,4 +233,11 @@ public final class Constants {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//阀门库db
|
||||||
|
public static final int TAPREDISDB = Configurations.getIntProperty("tapRedisDb", 5);
|
||||||
|
//webfocus库db
|
||||||
|
public static final int WEBFOCUSREDISDB = Configurations.getIntProperty("webFocusDb", 7);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,19 +6,18 @@ import java.util.List;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import redis.clients.jedis.Jedis;
|
|
||||||
import redis.clients.jedis.JedisPool;
|
|
||||||
import redis.clients.jedis.JedisSentinelPool;
|
|
||||||
import redis.clients.jedis.exceptions.JedisException;
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.nis.restful.RestBusinessCode;
|
import com.nis.restful.RestBusinessCode;
|
||||||
import com.nis.restful.ServiceRuntimeException;
|
import com.nis.restful.ServiceRuntimeException;
|
||||||
import com.nis.web.service.SpringContextHolder;
|
import com.nis.web.service.SpringContextHolder;
|
||||||
|
|
||||||
|
import redis.clients.jedis.Jedis;
|
||||||
|
import redis.clients.jedis.JedisSentinelPool;
|
||||||
|
import redis.clients.jedis.exceptions.JedisException;
|
||||||
|
|
||||||
public class JedisUtils {
|
public class JedisUtils {
|
||||||
private static Logger logger = LoggerFactory.getLogger(JedisUtils.class);
|
private static Logger logger = LoggerFactory.getLogger(JedisUtils.class);
|
||||||
private static final JedisPool jedisPool = SpringContextHolder.getBean(JedisPool.class);
|
|
||||||
/**
|
/**
|
||||||
* 获取缓存
|
* 获取缓存
|
||||||
*
|
*
|
||||||
@@ -213,13 +212,15 @@ public class JedisUtils {
|
|||||||
* @throws JedisException
|
* @throws JedisException
|
||||||
*/
|
*/
|
||||||
public static Jedis getResource(int redisDb) throws JedisException {
|
public static Jedis getResource(int redisDb) throws JedisException {
|
||||||
Jedis jedis = null;
|
JedisSentinelPool jedisSentinelPool = SpringContextHolder.getBean(JedisSentinelPool.class);
|
||||||
if (jedisPool == null) {
|
|
||||||
|
if (jedisSentinelPool == null) {
|
||||||
throw new ServiceRuntimeException("redis连接池为空,请联系管理员检查程序",
|
throw new ServiceRuntimeException("redis连接池为空,请联系管理员检查程序",
|
||||||
RestBusinessCode.CannotConnectionRedis.getValue());
|
RestBusinessCode.CannotConnectionRedis.getValue());
|
||||||
}
|
}
|
||||||
|
Jedis jedis = null;
|
||||||
try {
|
try {
|
||||||
jedis = jedisPool.getResource();
|
jedis = jedisSentinelPool.getResource();
|
||||||
jedis.select(redisDb);
|
jedis.select(redisDb);
|
||||||
} catch (JedisException e) {
|
} catch (JedisException e) {
|
||||||
returnBrokenResource(jedis);
|
returnBrokenResource(jedis);
|
||||||
|
|||||||
@@ -57,10 +57,13 @@ public class ServiceAndRDBIndexReal {
|
|||||||
*/
|
*/
|
||||||
private static Map<Integer, Map<String, String[]>> maatToValveMap = new HashMap<Integer, Map<String, String[]>>();
|
private static Map<Integer, Map<String, String[]>> maatToValveMap = new HashMap<Integer, Map<String, String[]>>();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 阀门保存的redis数据库Index,在nis.properties中定义
|
* 保存maat分发到webFocus需要添加到域的属性:maat2WebFocus
|
||||||
|
* Map<service,Map<regionType,fields>>
|
||||||
*/
|
*/
|
||||||
private static Integer valveDBIndex = Configurations.getIntProperty("tapRedisDb", 5);
|
private static Map<Integer, Map<String, String[]>> maatToWebFocusMap = new HashMap<Integer, Map<String, String[]>>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
||||||
String unMaatService = Configurations.getStringProperty("unMaatService", "");
|
String unMaatService = Configurations.getStringProperty("unMaatService", "");
|
||||||
@@ -154,6 +157,29 @@ public class ServiceAndRDBIndexReal {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
String maat2WebFocus = Configurations.getStringProperty("maat2WebFocus", "");
|
||||||
|
if (maat2WebFocus != null && !maat2WebFocus.trim().equals("")) {
|
||||||
|
String[] maat2ValveAry = maat2WebFocus.split(";");
|
||||||
|
for (String maat2ValveStr : maat2ValveAry) {
|
||||||
|
String[] serviceAndRegion = maat2ValveStr.split(":");
|
||||||
|
if (serviceAndRegion != null && serviceAndRegion.length == 2) {
|
||||||
|
String[] regionAndFields = serviceAndRegion[1].split("@");
|
||||||
|
Map<String, String[]> fieldMap = new HashMap<String, String[]>();
|
||||||
|
String[] fields = regionAndFields[1].split("&");
|
||||||
|
// 同一service有不同的域类型,多个之间用“|”分隔
|
||||||
|
if (regionAndFields[0].contains("|")) {
|
||||||
|
String[] regionTypeAry = regionAndFields[0].split("\\|");
|
||||||
|
for (String regionType : regionTypeAry) {
|
||||||
|
fieldMap.put(regionType, fields);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fieldMap.put(regionAndFields[0], fields);
|
||||||
|
}
|
||||||
|
maatToWebFocusMap.put(Integer.parseInt(serviceAndRegion[0]), fieldMap);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String serviceRepeatedReal = Configurations.getStringProperty("serviceRepeatedReal", "");
|
String serviceRepeatedReal = Configurations.getStringProperty("serviceRepeatedReal", "");
|
||||||
if (!StringUtil.isEmpty(serviceRepeatedReal)) {
|
if (!StringUtil.isEmpty(serviceRepeatedReal)) {
|
||||||
@@ -351,6 +377,7 @@ public class ServiceAndRDBIndexReal {
|
|||||||
return isValve;
|
return isValve;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据业务类型获取unmaat配置表名
|
* 根据业务类型获取unmaat配置表名
|
||||||
* @param service
|
* @param service
|
||||||
@@ -391,20 +418,20 @@ public class ServiceAndRDBIndexReal {
|
|||||||
ServiceAndRDBIndexReal.maatToValveMap = maatToValveMap;
|
ServiceAndRDBIndexReal.maatToValveMap = maatToValveMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param valveDBIndex the valveDBIndex to set
|
|
||||||
*/
|
|
||||||
public static void setValveDBIndex(Integer valveDBIndex) {
|
|
||||||
ServiceAndRDBIndexReal.valveDBIndex = valveDBIndex;
|
public static Map<Integer, Map<String, String[]>> getMaatToWebFocusMap() {
|
||||||
|
return maatToWebFocusMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public static void setMaatToWebFocusMap(Map<Integer, Map<String, String[]>> maatToWebFocusMap) {
|
||||||
* @return the valveDBIndex
|
ServiceAndRDBIndexReal.maatToWebFocusMap = maatToWebFocusMap;
|
||||||
*/
|
|
||||||
public static Integer getValveDBIndex() {
|
|
||||||
return valveDBIndex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static Map<Integer, String> getUnMaatSercieNameMap() {
|
public static Map<Integer, String> getUnMaatSercieNameMap() {
|
||||||
return unMaatSercieNameMap;
|
return unMaatSercieNameMap;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,6 @@ import java.util.UUID;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import com.zdjizhi.utils.StringUtil;
|
|
||||||
import net.sf.json.JSONObject;
|
|
||||||
|
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
@@ -23,7 +20,9 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import com.nis.domain.restful.ConfigCompile;
|
import com.nis.domain.restful.ConfigCompile;
|
||||||
|
import com.nis.domain.restful.ConfigCompileStartStop;
|
||||||
import com.nis.domain.restful.ConfigSource;
|
import com.nis.domain.restful.ConfigSource;
|
||||||
|
import com.nis.domain.restful.ConfigSourceStartStop;
|
||||||
import com.nis.domain.restful.FileDesc;
|
import com.nis.domain.restful.FileDesc;
|
||||||
import com.nis.domain.restful.GroupReuse;
|
import com.nis.domain.restful.GroupReuse;
|
||||||
import com.nis.domain.restful.GroupReuseSource;
|
import com.nis.domain.restful.GroupReuseSource;
|
||||||
@@ -45,6 +44,9 @@ import com.nis.web.service.restful.ConfigSourcesService;
|
|||||||
import com.wordnik.swagger.annotations.Api;
|
import com.wordnik.swagger.annotations.Api;
|
||||||
import com.wordnik.swagger.annotations.ApiOperation;
|
import com.wordnik.swagger.annotations.ApiOperation;
|
||||||
import com.wordnik.swagger.annotations.ApiParam;
|
import com.wordnik.swagger.annotations.ApiParam;
|
||||||
|
import com.zdjizhi.utils.StringUtil;
|
||||||
|
|
||||||
|
import net.sf.json.JSONObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName: ConfigSourcesController
|
* @ClassName: ConfigSourcesController
|
||||||
@@ -121,6 +123,50 @@ public class ConfigSourcesController extends BaseRestController {
|
|||||||
"Maat规则下发成功" + sb.toString(), Constants.IS_DEBUG ? configSource : null);
|
"Maat规则下发成功" + sb.toString(), Constants.IS_DEBUG ? configSource : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/cfg/v2/configStartStop", method = RequestMethod.PUT)
|
||||||
|
@ApiOperation(value = "MAAT规则停用启用接口", httpMethod = "PUT", response = Map.class, notes = "接收MAAT类配置,对配置停用还是启用")
|
||||||
|
@ApiParam(value = "MAAT规则停用启用接口", name = "configStartStop", required = true)
|
||||||
|
public Map configStartStop(@RequestBody ConfigSourceStartStop configSourceStartStop, HttpServletRequest request,
|
||||||
|
HttpServletResponse response) {
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
AuditLogThread thread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_PUT, request,
|
||||||
|
configSourceStartStop);
|
||||||
|
// 分布式锁的标识,谁加锁,谁解锁,如果中间发生了异常则根据失效时间自动失效,默认五分钟失效
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
String requestId = UUID.randomUUID().toString();
|
||||||
|
try {
|
||||||
|
if (getLock(requestId)) {
|
||||||
|
checkOpAction(thread, System.currentTimeMillis() - start, configSourceStartStop.getOpAction(),
|
||||||
|
Constants.OPACTION_PUT);
|
||||||
|
|
||||||
|
configSourcesService.updateConfigSources(thread, start, configSourceStartStop.getConfigCompileStartStopList(),
|
||||||
|
configSourceStartStop.getOpTime(), sb,true);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
thread.setExceptionInfo("Maat 规则停启用异常:" + ExceptionUtil.getExceptionMsg(e));
|
||||||
|
logger.error("Maat 规则停启用异常:" + ExceptionUtil.getExceptionMsg(e));
|
||||||
|
if (e instanceof RestServiceException) {
|
||||||
|
throw new RestServiceException(thread, System.currentTimeMillis() - start,
|
||||||
|
"Maat 规则停启用异常:" + ExceptionUtil.getExceptionMsg(e), ((RestServiceException) e).getErrorCode());
|
||||||
|
} else if (e instanceof ServiceRuntimeException) {
|
||||||
|
throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start,
|
||||||
|
"Maat 规则停启用异常:" + ExceptionUtil.getExceptionMsg(e),
|
||||||
|
((ServiceRuntimeException) e).getErrorCode());
|
||||||
|
} else {
|
||||||
|
throw new ServiceRuntimeException(thread, System.currentTimeMillis() - start,
|
||||||
|
"Maat 规则停启用异常:" + ExceptionUtil.getExceptionMsg(e),
|
||||||
|
RestBusinessCode.service_runtime_error.getValue());
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
deblocking(requestId);
|
||||||
|
}
|
||||||
|
return compileServiceResponse(thread, System.currentTimeMillis() - start, request, response,
|
||||||
|
"Maat规则停启用成功" + sb.toString(), Constants.IS_DEBUG ? configSourceStartStop : null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/cfg/v1/configSources", method = RequestMethod.PUT)
|
@RequestMapping(value = "/cfg/v1/configSources", method = RequestMethod.PUT)
|
||||||
@ApiOperation(value = "MAAT规则状态更新接口", httpMethod = "PUT", response = Map.class, notes = "接收Maat规则,对其状态置为失效")
|
@ApiOperation(value = "MAAT规则状态更新接口", httpMethod = "PUT", response = Map.class, notes = "接收Maat规则,对其状态置为失效")
|
||||||
@ApiParam(value = "MAAT规则对象", name = "configSource", required = true)
|
@ApiParam(value = "MAAT规则对象", name = "configSource", required = true)
|
||||||
@@ -145,7 +191,7 @@ public class ConfigSourcesController extends BaseRestController {
|
|||||||
}
|
}
|
||||||
checkOpAction(thread, System.currentTimeMillis() - start, opAction, 2);
|
checkOpAction(thread, System.currentTimeMillis() - start, opAction, 2);
|
||||||
configSourcesService.updateConfigSources(thread, start, configSource.getConfigCompileList(),
|
configSourcesService.updateConfigSources(thread, start, configSource.getConfigCompileList(),
|
||||||
configSource.getOpTime(), sb);
|
configSource.getOpTime(), sb,false);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new RestServiceException("Maat规则不能为空" + sb.toString(),
|
throw new RestServiceException("Maat规则不能为空" + sb.toString(),
|
||||||
|
|||||||
@@ -0,0 +1,205 @@
|
|||||||
|
package com.nis.web.controller.restful;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.nis.domain.Page;
|
||||||
|
import com.nis.domain.restful.NtcRadiusReport;
|
||||||
|
import com.nis.restful.RestBusinessCode;
|
||||||
|
import com.nis.restful.RestServiceException;
|
||||||
|
import com.nis.restful.ServiceRuntimeException;
|
||||||
|
import com.nis.util.Constants;
|
||||||
|
import com.nis.util.DateUtils;
|
||||||
|
import com.nis.util.ExceptionUtil;
|
||||||
|
import com.nis.util.StringUtils;
|
||||||
|
import com.nis.web.controller.BaseRestController;
|
||||||
|
import com.nis.web.service.AuditLogThread;
|
||||||
|
import com.nis.web.service.ServicesRequestLogService;
|
||||||
|
import com.nis.web.service.restful.TrafficReportService;
|
||||||
|
import com.wordnik.swagger.annotations.Api;
|
||||||
|
import com.wordnik.swagger.annotations.ApiOperation;
|
||||||
|
import com.zdjizhi.utils.StringUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* Title: SingleDimensionReport
|
||||||
|
* </p>
|
||||||
|
* <p>
|
||||||
|
* Description:首页流量统计查询controller,改为从clickhouse中获取
|
||||||
|
* </p>
|
||||||
|
* <p>
|
||||||
|
* Company: IIE
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author rkg
|
||||||
|
* @date 2018年12月20日
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("${servicePath}/ckLog/v1")
|
||||||
|
@Api(value = "TrafficeReportController", description = "流量统计查询报表controller")
|
||||||
|
public class TrafficeReportController extends BaseRestController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
protected ServicesRequestLogService servicesRequestLogService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
protected TrafficReportService trafficReportService;
|
||||||
|
|
||||||
|
@RequestMapping(value = "/ntcRadiusReport", method = RequestMethod.GET)
|
||||||
|
@ApiOperation(value = "用户行为统计查询服务", httpMethod = "GET", notes = "用户行为统计查询服务,基于用户名或接入IP维度聚合")
|
||||||
|
public Map<String, ?> ntcRadiusReport(Page page, NtcRadiusReport ntcRadiusReport, Model model,
|
||||||
|
HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
AuditLogThread saveLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
|
||||||
|
null);
|
||||||
|
|
||||||
|
try {
|
||||||
|
resetReportTime(ntcRadiusReport, true);
|
||||||
|
trafficReportService.checkNtcRadiusReportCondition(saveLogThread, start, ntcRadiusReport);
|
||||||
|
trafficReportService.findNtcRadiusReport(page, ntcRadiusReport);
|
||||||
|
} catch (Exception e) {
|
||||||
|
saveLogThread.setExceptionInfo("用户行为统计查询失败:" + e.getMessage());
|
||||||
|
logger.error("用户行为统计查询失败:" + ExceptionUtil.getExceptionMsg(e));
|
||||||
|
if (e instanceof RestServiceException) {
|
||||||
|
throw new RestServiceException(saveLogThread, System.currentTimeMillis() - start,
|
||||||
|
"用户行为统计查询失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode());
|
||||||
|
} else if (e instanceof ServiceRuntimeException) {
|
||||||
|
throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start,
|
||||||
|
"用户行为统计查询失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode());
|
||||||
|
} else {
|
||||||
|
throw new ServiceRuntimeException(saveLogThread, System.currentTimeMillis() - start,
|
||||||
|
"用户行为统计查询失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return serviceLogResponse(saveLogThread, System.currentTimeMillis() - start, request, "用户行为统计查询成功", page, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ip46,协议tcp,udp查询带宽
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "trafficBandwidthTransThree", method = RequestMethod.GET)
|
||||||
|
@ApiOperation(value = "带宽根据ip46,协议tcp,udp查询详情", httpMethod = "GET", notes = "对应带宽根据IPv4,6,协议tcp,udp统计数据显示")
|
||||||
|
public Map<String, ?> trafficBandwidthTransThree(@RequestParam String beginDate, @RequestParam String endDate,
|
||||||
|
Model model, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
String[] addrTypes = { "4", "6" };// ipv4,ipv6是固定的不会变
|
||||||
|
String[] transTypes = { "6", "17" };// 传输层协议,tcp,udp
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request,
|
||||||
|
null);
|
||||||
|
Map<String, List<HashMap>> resultMap = new HashMap<String, List<HashMap>>();
|
||||||
|
try {
|
||||||
|
if (StringUtils.isEmpty(beginDate) && StringUtils.isEmpty(endDate)) {
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
cal.setTime(new Date());
|
||||||
|
endDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(cal.getTime());// 获取到完整的时间
|
||||||
|
cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) - 1);
|
||||||
|
beginDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(cal.getTime());
|
||||||
|
}
|
||||||
|
String addrType = null;
|
||||||
|
Integer transType = null;
|
||||||
|
if (addrTypes != null) {
|
||||||
|
for (int i = 0; i < addrTypes.length; i++) {
|
||||||
|
addrType = addrTypes[i];
|
||||||
|
List<HashMap> resultList = trafficReportService.getBandwidthTrans(addrType, transType, beginDate,
|
||||||
|
endDate);
|
||||||
|
if (resultList != null && resultList.size() > 0) {
|
||||||
|
resultMap.put("ipv" + addrType + "Type1", resultList);
|
||||||
|
}
|
||||||
|
|
||||||
|
resultList = trafficReportService.getBandwidthTrans2(addrType, transType, beginDate, endDate);
|
||||||
|
if (resultList != null && resultList.size() > 0) {
|
||||||
|
resultMap.put("ipv" + addrType + "Type2", resultList);
|
||||||
|
}
|
||||||
|
addrType = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (transTypes != null) {
|
||||||
|
for (int i = 0; i < transTypes.length; i++) {
|
||||||
|
transType = Integer.valueOf(transTypes[i]);
|
||||||
|
List<HashMap> resultList = trafficReportService.getBandwidthTrans(addrType, transType, beginDate,
|
||||||
|
endDate);
|
||||||
|
if (resultList != null && resultList.size() > 0) {
|
||||||
|
resultMap.put("trans" + transType + "Type1", resultList);
|
||||||
|
}
|
||||||
|
resultList = trafficReportService.getBandwidthTrans2(addrType, transType, beginDate, endDate);
|
||||||
|
if (resultList != null && resultList.size() > 0) {
|
||||||
|
resultMap.put("trans" + transType + "Type2", resultList);
|
||||||
|
}
|
||||||
|
transType = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
auditLogThread.setExceptionInfo("带宽实时统计数据检索失败:" + e.getMessage());
|
||||||
|
logger.error("带宽实时统计数据检索失败:" + ExceptionUtil.getExceptionMsg(e));
|
||||||
|
if (e instanceof RestServiceException) {
|
||||||
|
throw new RestServiceException(auditLogThread, System.currentTimeMillis() - start,
|
||||||
|
"带宽实时统计数据检索失败:" + e.getMessage(), ((RestServiceException) e).getErrorCode());
|
||||||
|
} else if (e instanceof ServiceRuntimeException) {
|
||||||
|
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
|
||||||
|
"带宽实时统计数据检索失败:" + e.getMessage(), ((ServiceRuntimeException) e).getErrorCode());
|
||||||
|
} else {
|
||||||
|
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
|
||||||
|
"带宽实时统计数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "带宽实时统计数据检索成功",
|
||||||
|
resultMap, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @author (zdx)
|
||||||
|
* @date 2018年7月12日 上午11:01:30
|
||||||
|
* @param entity
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public void resetReportTime(NtcRadiusReport entity, Boolean isTotal) throws Exception {
|
||||||
|
// 日志总量统计查询全部
|
||||||
|
// if ("1".equals(entity.getSearchBusinessType()) && isTotal) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
if (StringUtil.isEmpty(entity.getSearchReportStartTime())
|
||||||
|
&& StringUtil.isEmpty(entity.getSearchReportEndTime())) {
|
||||||
|
String dateType = "hour"; // 默认为分钟
|
||||||
|
if (!isTotal) {
|
||||||
|
if (entity.getSearchBusinessType().equals("2")) {
|
||||||
|
dateType = "hour";
|
||||||
|
} else if (entity.getSearchBusinessType().equals("3")) {
|
||||||
|
dateType = "daily";
|
||||||
|
} else if (entity.getSearchBusinessType().equals("4")) {
|
||||||
|
dateType = "month";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (entity.getSearchBusinessType().equals("3")) {
|
||||||
|
dateType = "hour";
|
||||||
|
} else if (entity.getSearchBusinessType().equals("4")) {
|
||||||
|
dateType = "daily";
|
||||||
|
} else if (entity.getSearchBusinessType().equals("5")) {
|
||||||
|
dateType = "month";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Map<String, String> map = DateUtils.getLocalTime(entity.getSearchReportStartTime(),
|
||||||
|
entity.getSearchReportEndTime(), Constants.PZ_REPORT_TIME, dateType);
|
||||||
|
entity.setSearchReportStartTime(map.get("startTime"));
|
||||||
|
entity.setSearchReportEndTime(map.get("endTime"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,7 +14,8 @@
|
|||||||
OUTOCTETS_SPEED ,
|
OUTOCTETS_SPEED ,
|
||||||
INPKTS_SPEED ,
|
INPKTS_SPEED ,
|
||||||
OUTPKTS_SPEED ,
|
OUTPKTS_SPEED ,
|
||||||
RECV_TIME
|
RECV_TIME,
|
||||||
|
ENTRANCE_ID
|
||||||
) VALUES (
|
) VALUES (
|
||||||
#{port},
|
#{port},
|
||||||
#{nodeName},
|
#{nodeName},
|
||||||
@@ -27,6 +28,7 @@
|
|||||||
#{outoctetsSpeed},
|
#{outoctetsSpeed},
|
||||||
#{inpktsSpeed},
|
#{inpktsSpeed},
|
||||||
#{outpktsSpeed},
|
#{outpktsSpeed},
|
||||||
#{recvTime})
|
#{recvTime},
|
||||||
|
#{entranceId})
|
||||||
</insert>
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
79
src/main/java/com/nis/web/dao/TrafficReportDao.java
Normal file
79
src/main/java/com/nis/web/dao/TrafficReportDao.java
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
package com.nis.web.dao;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import com.nis.domain.restful.NtcAttrTypeReport;
|
||||||
|
import com.nis.domain.restful.NtcDestipCountryReport;
|
||||||
|
import com.nis.domain.restful.NtcEntranceReport;
|
||||||
|
import com.nis.domain.restful.NtcIpRangeReport;
|
||||||
|
import com.nis.domain.restful.NtcLwhhReport;
|
||||||
|
import com.nis.domain.restful.NtcPzReport;
|
||||||
|
import com.nis.domain.restful.NtcRadiusReport;
|
||||||
|
import com.nis.domain.restful.NtcServiceReport;
|
||||||
|
import com.nis.domain.restful.NtcSrcipDomesticReport;
|
||||||
|
import com.nis.domain.restful.NtcTagReport;
|
||||||
|
import com.nis.domain.restful.NtcURLIpReport;
|
||||||
|
import com.nis.domain.restful.dashboard.NtcTotalReport;
|
||||||
|
import com.nis.domain.restful.dashboard.TrafficTransStatistic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @ClassName:NtcReportDao
|
||||||
|
* @Description:TODO(这里用一句话描述这个类的作用)
|
||||||
|
* @author (zdx)
|
||||||
|
* @date 2018年7月11日 下午5:47:55
|
||||||
|
* @version V1.0
|
||||||
|
*/
|
||||||
|
@MyBatisDao
|
||||||
|
public interface TrafficReportDao extends CrudDao {
|
||||||
|
List<NtcPzReport> findNtcPzReport(NtcPzReport pz);
|
||||||
|
|
||||||
|
List<NtcServiceReport> findNtcServiceReport(NtcServiceReport pz);
|
||||||
|
|
||||||
|
List<NtcTagReport> findNtcTagReport(NtcTagReport pz);
|
||||||
|
|
||||||
|
List<NtcAttrTypeReport> findNtcAttrTypeReport(NtcAttrTypeReport pz);
|
||||||
|
|
||||||
|
List<NtcLwhhReport> findNtcLwhhReport(NtcLwhhReport pz);
|
||||||
|
|
||||||
|
List<NtcSrcipDomesticReport> findNtcSrcipDomesticReport(NtcSrcipDomesticReport pz);
|
||||||
|
|
||||||
|
List<NtcDestipCountryReport> findNtcDestipCountryReport(NtcDestipCountryReport pz);
|
||||||
|
|
||||||
|
List<NtcEntranceReport> findNtcEntranceReport(NtcEntranceReport pz);
|
||||||
|
|
||||||
|
List<NtcURLIpReport> findNtcIpURLReport(NtcURLIpReport pz);
|
||||||
|
|
||||||
|
List<NtcRadiusReport> findAccounList(NtcRadiusReport pz);
|
||||||
|
|
||||||
|
List<NtcRadiusReport> findNasIpList(NtcRadiusReport pz);
|
||||||
|
|
||||||
|
List<NtcRadiusReport> findNtcRadiusReport(NtcRadiusReport pz);
|
||||||
|
|
||||||
|
List<NtcIpRangeReport> findNtcIpRangeReport(NtcIpRangeReport pz);
|
||||||
|
|
||||||
|
void insertNtcIpRangeBatch(List<NtcIpRangeReport> list);
|
||||||
|
|
||||||
|
void truncateNtcIpRange();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
NtcTotalReport getMaxReportTime();
|
||||||
|
Map getMaxStatTime();
|
||||||
|
List<Map> getTotalReportList(@Param("reportTime") Date reportTime);
|
||||||
|
List<Map> getNetFlowPortInfoNew(@Param("statTime") Date statTime);
|
||||||
|
List<TrafficTransStatistic> getBandwidthTrans(@Param("entranceId") Integer entranceId,@Param("beginDate") String beginDate,@Param("endDate") String endDate,@Param("addrType") String addrType,@Param("transType") Integer transType);
|
||||||
|
List<TrafficTransStatistic> getBandwidthTrans2(@Param("beginDate") String beginDate,@Param("endDate") String endDate);
|
||||||
|
Map getEntranceMaxReportTime();
|
||||||
|
List<NtcEntranceReport> getActionTrans(@Param("beginDate") String beginDate,@Param("endDate") String endDate ,@Param("entranceId") Integer entranceId,@Param("serviceSql") String serviceSql);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
995
src/main/java/com/nis/web/dao/TrafficReportDao.xml
Normal file
995
src/main/java/com/nis/web/dao/TrafficReportDao.xml
Normal file
@@ -0,0 +1,995 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.nis.web.dao.TrafficReportDao">
|
||||||
|
<resultMap id="NtcPzReportMap"
|
||||||
|
type="com.nis.domain.restful.NtcPzReport">
|
||||||
|
<result column="CFG_ID" jdbcType="BIGINT" property="cfgId" />
|
||||||
|
<result column="SERVICE" jdbcType="INTEGER" property="service" />
|
||||||
|
<result column="SUM" jdbcType="BIGINT" property="sum" />
|
||||||
|
<result column="REPORT_TIME" jdbcType="TIMESTAMP"
|
||||||
|
property="reportTime" />
|
||||||
|
</resultMap>
|
||||||
|
<resultMap id="NtcServiceReportMap"
|
||||||
|
type="com.nis.domain.restful.NtcServiceReport">
|
||||||
|
<result column="SERVICE" jdbcType="INTEGER" property="service" />
|
||||||
|
<result column="SUM" jdbcType="BIGINT" property="sum" />
|
||||||
|
<result column="REPORT_TIME" jdbcType="TIMESTAMP"
|
||||||
|
property="reportTime" />
|
||||||
|
</resultMap>
|
||||||
|
<resultMap id="NtcTagReportMap"
|
||||||
|
type="com.nis.domain.restful.NtcTagReport">
|
||||||
|
<result column="TAG" jdbcType="INTEGER" property="tag" />
|
||||||
|
<result column="SERVICE" jdbcType="INTEGER" property="service" />
|
||||||
|
<result column="SUM" jdbcType="BIGINT" property="sum" />
|
||||||
|
<result column="REPORT_TIME" jdbcType="TIMESTAMP"
|
||||||
|
property="reportTime" />
|
||||||
|
</resultMap>
|
||||||
|
<resultMap id="NtcAttrTypeReportMap"
|
||||||
|
type="com.nis.domain.restful.NtcAttrTypeReport">
|
||||||
|
<result column="ATTR_TYPE" jdbcType="INTEGER"
|
||||||
|
property="attrType" />
|
||||||
|
<result column="SERVICE" jdbcType="INTEGER" property="service" />
|
||||||
|
<result column="SUM" jdbcType="BIGINT" property="sum" />
|
||||||
|
<result column="REPORT_TIME" jdbcType="TIMESTAMP"
|
||||||
|
property="reportTime" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="NtcLwhhReportMap"
|
||||||
|
type="com.nis.domain.restful.NtcLwhhReport">
|
||||||
|
<result column="LWHH" jdbcType="INTEGER" property="lwhh" />
|
||||||
|
<result column="SERVICE" jdbcType="INTEGER" property="service" />
|
||||||
|
<result column="SUM" jdbcType="BIGINT" property="sum" />
|
||||||
|
<result column="REPORT_TIME" jdbcType="TIMESTAMP"
|
||||||
|
property="reportTime" />
|
||||||
|
</resultMap>
|
||||||
|
<resultMap id="NtcSrcipDomesticReportMap"
|
||||||
|
type="com.nis.domain.restful.NtcSrcipDomesticReport">
|
||||||
|
<result column="SERVICE" jdbcType="INTEGER" property="service" />
|
||||||
|
<result column="SRC_PROVINCE" jdbcType="VARCHAR"
|
||||||
|
property="srcProvince" />
|
||||||
|
<result column="SRC_CITY" jdbcType="VARCHAR" property="srcCity" />
|
||||||
|
<result column="SUM" jdbcType="BIGINT" property="sum" />
|
||||||
|
<result column="REPORT_TIME" jdbcType="TIMESTAMP"
|
||||||
|
property="reportTime" />
|
||||||
|
</resultMap>
|
||||||
|
<resultMap id="NtcDestipCountryReportMap"
|
||||||
|
type="com.nis.domain.restful.NtcDestipCountryReport">
|
||||||
|
<result column="SERVICE" jdbcType="INTEGER" property="service" />
|
||||||
|
<result column="DEST_COUNTRY" jdbcType="VARCHAR"
|
||||||
|
property="destCountry" />
|
||||||
|
<result column="SUM" jdbcType="BIGINT" property="sum" />
|
||||||
|
<result column="REPORT_TIME" jdbcType="TIMESTAMP"
|
||||||
|
property="reportTime" />
|
||||||
|
</resultMap>
|
||||||
|
<resultMap id="NtcEntranceReportMap"
|
||||||
|
type="com.nis.domain.restful.NtcEntranceReport">
|
||||||
|
<result column="SERVICE" jdbcType="INTEGER" property="service" />
|
||||||
|
<result column="ENTRANCE_ID" jdbcType="INTEGER"
|
||||||
|
property="entranceId" />
|
||||||
|
<result column="SUM" jdbcType="BIGINT" property="sum" />
|
||||||
|
<result column="REPORT_TIME" jdbcType="TIMESTAMP"
|
||||||
|
property="reportTime" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="NtcURLIpReportMap"
|
||||||
|
type="com.nis.domain.restful.NtcURLIpReport">
|
||||||
|
<result column="url" jdbcType="VARCHAR" property="url" />
|
||||||
|
<result column="ipCount" jdbcType="BIGINT" property="ipCount" />
|
||||||
|
<result column="connCount" jdbcType="BIGINT"
|
||||||
|
property="connCount" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="NtcRadiusReportMap"
|
||||||
|
type="com.nis.domain.restful.NtcRadiusReport">
|
||||||
|
<result column="account" jdbcType="VARCHAR" property="account" />
|
||||||
|
<result column="nas_ip" jdbcType="VARCHAR" property="nasIp" />
|
||||||
|
<result column="sum" jdbcType="BIGINT" property="sum" />
|
||||||
|
<result column="report_time" jdbcType="TIMESTAMP"
|
||||||
|
property="reportTime" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="NtcIpRangeReportMap"
|
||||||
|
type="com.nis.domain.restful.NtcIpRangeReport">
|
||||||
|
<result column="ip_start" jdbcType="VARCHAR" property="ipStart" />
|
||||||
|
<result column="ip_end" jdbcType="VARCHAR" property="ipEnd" />
|
||||||
|
<result column="ip_start_num" jdbcType="BIGINT"
|
||||||
|
property="ipStartNum" />
|
||||||
|
<result column="ip_end_num" jdbcType="BIGINT"
|
||||||
|
property="ipEndNum" />
|
||||||
|
<result column="ip_sub" jdbcType="VARCHAR" property="ipSub" />
|
||||||
|
<result column="country" jdbcType="VARCHAR" property="country" />
|
||||||
|
<result column="area_type" jdbcType="VARCHAR"
|
||||||
|
property="areaType" />
|
||||||
|
<result column="desc_detail" jdbcType="VARCHAR" property="desc" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
<sql id="commonPorperty">
|
||||||
|
SERVICE,SUM,REPORT_TIME
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="findNtcPzReport"
|
||||||
|
parameterType="com.nis.domain.restful.NtcPzReport"
|
||||||
|
resultMap="NtcPzReportMap">
|
||||||
|
SELECT
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 1 ">
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="page !=null and page.fields != null and page.fields != ''">
|
||||||
|
${page.fields}
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
CFG_ID,SERVICE,SUM
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
FROM (SELECT CFG_ID,SERVICE,SUM(SUM) SUM
|
||||||
|
FROM
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="page !=null and page.fields != null and page.fields != ''">
|
||||||
|
${page.fields}
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
CFG_ID,
|
||||||
|
<include refid="commonPorperty" />
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
FROM (SELECT CFG_ID, SERVICE, SUM(SUM) SUM ,REPORT_TIME
|
||||||
|
FROM
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
|
||||||
|
NTC_PZ_STAT_HOUR
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
|
||||||
|
NTC_PZ_STAT_DAILY
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 5 ">
|
||||||
|
NTC_PZ_STAT_MONTH
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
NTC_PZ_REPORT
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
|
||||||
|
<where>
|
||||||
|
<if test="searchCfgId != null and searchCfgId !=''">
|
||||||
|
<![CDATA[AND CFG_ID in (${searchCfgId})]]>
|
||||||
|
</if>
|
||||||
|
<if test="searchService != null and searchService !=''">
|
||||||
|
<![CDATA[AND SERVICE in (${searchService})]]>
|
||||||
|
</if>
|
||||||
|
<if
|
||||||
|
test="searchReportStartTime != null and searchReportStartTime !=''">
|
||||||
|
<![CDATA[AND REPORT_TIME > STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]>
|
||||||
|
</if>
|
||||||
|
<if
|
||||||
|
test="searchReportEndTime != null and searchReportEndTime !=''">
|
||||||
|
<![CDATA[AND REPORT_TIME <= STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 1 ">
|
||||||
|
GROUP BY CFG_ID,SERVICE
|
||||||
|
)
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
GROUP BY CFG_ID,SERVICE,REPORT_TIME
|
||||||
|
)
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
|
||||||
|
NTC_PZ_STAT_HOUR
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
|
||||||
|
NTC_PZ_STAT_DAILY
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 5 ">
|
||||||
|
NTC_PZ_STAT_MONTH
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
NTC_PZ_REPORT
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||||||
|
ORDER BY ${page.orderBy}
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</select>
|
||||||
|
<select id="findNtcServiceReport"
|
||||||
|
parameterType="com.nis.domain.restful.NtcServiceReport"
|
||||||
|
resultMap="NtcServiceReportMap">
|
||||||
|
SELECT
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="page !=null and page.fields != null and page.fields != ''">
|
||||||
|
${page.fields}
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
<include refid="commonPorperty" />
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
FROM (SELECT SERVICE, SUM(SUM) SUM ,REPORT_TIME
|
||||||
|
FROM
|
||||||
|
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
|
||||||
|
NTC_SERVICE_STAT_HOUR
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
|
||||||
|
NTC_SERVICE_STAT_DAILY
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
|
||||||
|
NTC_SERVICE_STAT_MONTH
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
NTC_SERVICE_REPORT
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
<where>
|
||||||
|
<if test="searchService != null and searchService !=''">
|
||||||
|
<![CDATA[AND SERVICE in (${searchService})]]>
|
||||||
|
</if>
|
||||||
|
<if
|
||||||
|
test="searchReportStartTime != null and searchReportStartTime !=''">
|
||||||
|
<![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]>
|
||||||
|
</if>
|
||||||
|
<if
|
||||||
|
test="searchReportEndTime != null and searchReportEndTime !=''">
|
||||||
|
<![CDATA[AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
|
||||||
|
GROUP BY SERVICE,REPORT_TIME
|
||||||
|
)
|
||||||
|
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
|
||||||
|
NTC_SERVICE_STAT_HOUR
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
|
||||||
|
NTC_SERVICE_STAT_DAILY
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
|
||||||
|
NTC_SERVICE_STAT_MONTH
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
NTC_SERVICE_REPORT
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||||||
|
ORDER BY ${page.orderBy}
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findNtcTagReport"
|
||||||
|
parameterType="com.nis.domain.restful.NtcTagReport"
|
||||||
|
resultMap="NtcTagReportMap">
|
||||||
|
SELECT
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="page !=null and page.fields != null and page.fields != ''">
|
||||||
|
${page.fields}
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
TAG,
|
||||||
|
<include refid="commonPorperty" />
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
FROM (SELECT SERVICE,TAG,SUM(SUM) SUM ,REPORT_TIME
|
||||||
|
FROM
|
||||||
|
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
|
||||||
|
NTC_TAG_STAT_HOUR
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
|
||||||
|
NTC_TAG_STAT_DAILY
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
|
||||||
|
NTC_TAG_STAT_MONTH
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
NTC_TAG_REPORT
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
<where>
|
||||||
|
<if test="searchTag != null and searchTag !=''">
|
||||||
|
<![CDATA[AND TAG in (${searchTag})]]>
|
||||||
|
</if>
|
||||||
|
<if test="searchService != null and searchService !=''">
|
||||||
|
<![CDATA[AND SERVICE in (${searchService})]]>
|
||||||
|
</if>
|
||||||
|
<if
|
||||||
|
test="searchReportStartTime != null and searchReportStartTime !=''">
|
||||||
|
<![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]>
|
||||||
|
</if>
|
||||||
|
<if
|
||||||
|
test="searchReportEndTime != null and searchReportEndTime !=''">
|
||||||
|
<![CDATA[AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
|
||||||
|
GROUP BY SERVICE,TAG,REPORT_TIME
|
||||||
|
)
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
|
||||||
|
NTC_TAG_STAT_HOUR
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
|
||||||
|
NTC_TAG_STAT_DAILY
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
|
||||||
|
NTC_TAG_STAT_MONTH
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
NTC_TAG_REPORT
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||||||
|
ORDER BY ${page.orderBy}
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findNtcAttrTypeReport"
|
||||||
|
parameterType="com.nis.domain.restful.NtcAttrTypeReport"
|
||||||
|
resultMap="NtcAttrTypeReportMap">
|
||||||
|
SELECT
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="page !=null and page.fields != null and page.fields != ''">
|
||||||
|
${page.fields}
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
ATTR_TYPE,
|
||||||
|
<include refid="commonPorperty" />
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
FROM (SELECT SERVICE,ATTR_TYPE, SUM(SUM) SUM ,REPORT_TIME
|
||||||
|
FROM
|
||||||
|
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
|
||||||
|
NTC_ATTR_TYPE_STAT_HOUR
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
|
||||||
|
NTC_ATTR_TYPE_STAT_DAILY
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
|
||||||
|
NTC_ATTR_TYPE_STAT_MONTH
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
NTC_ATTR_TYPE_REPORT
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
<where>
|
||||||
|
<if test="searchAttrType != null and searchAttrType !=''">
|
||||||
|
<![CDATA[AND ATTR_TYPE in (${searchAttrType})]]>
|
||||||
|
</if>
|
||||||
|
<if test="searchService != null and searchService !=''">
|
||||||
|
<![CDATA[AND SERVICE in (${searchService})]]>
|
||||||
|
</if>
|
||||||
|
<if
|
||||||
|
test="searchReportStartTime != null and searchReportStartTime !=''">
|
||||||
|
<![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]>
|
||||||
|
</if>
|
||||||
|
<if
|
||||||
|
test="searchReportEndTime != null and searchReportEndTime !=''">
|
||||||
|
<![CDATA[AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
|
||||||
|
GROUP BY SERVICE,ATTR_TYPE,REPORT_TIME
|
||||||
|
)
|
||||||
|
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
|
||||||
|
NTC_ATTR_TYPE_STAT_HOUR
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
|
||||||
|
NTC_ATTR_TYPE_STAT_DAILY
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
|
||||||
|
NTC_ATTR_TYPE_STAT_MONTH
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
NTC_ATTR_TYPE_REPORT
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||||||
|
ORDER BY ${page.orderBy}
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findNtcLwhhReport"
|
||||||
|
parameterType="com.nis.domain.restful.NtcLwhhReport"
|
||||||
|
resultMap="NtcLwhhReportMap">
|
||||||
|
SELECT
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="page !=null and page.fields != null and page.fields != ''">
|
||||||
|
${page.fields}
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
LWHH,
|
||||||
|
<include refid="commonPorperty" />
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
FROM (SELECT SERVICE,LWHH, SUM(SUM) SUM ,REPORT_TIME
|
||||||
|
FROM
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
|
||||||
|
NTC_LWHH_STAT_HOUR
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
|
||||||
|
NTC_LWHH_STAT_DAILY
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
|
||||||
|
NTC_LWHH_STAT_MONTH
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
NTC_LWHH_REPORT
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
<where>
|
||||||
|
<if test="searchLwhh != null and searchLwhh !=''">
|
||||||
|
<![CDATA[AND LWHH in (${searchLwhh})]]>
|
||||||
|
</if>
|
||||||
|
<if test="searchService != null and searchService !=''">
|
||||||
|
<![CDATA[AND SERVICE in (${searchService})]]>
|
||||||
|
</if>
|
||||||
|
<if
|
||||||
|
test="searchReportStartTime != null and searchReportStartTime !=''">
|
||||||
|
<![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]>
|
||||||
|
</if>
|
||||||
|
<if
|
||||||
|
test="searchReportEndTime != null and searchReportEndTime !=''">
|
||||||
|
<![CDATA[AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
|
||||||
|
GROUP BY SERVICE,LWHH,REPORT_TIME
|
||||||
|
)
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
|
||||||
|
NTC_LWHH_STAT_HOUR
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
|
||||||
|
NTC_LWHH_STAT_DAILY
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
|
||||||
|
NTC_LWHH_STAT_MONTH
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
NTC_LWHH_REPORT
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||||||
|
ORDER BY ${page.orderBy}
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</select>
|
||||||
|
<select id="findNtcSrcipDomesticReport"
|
||||||
|
parameterType="com.nis.domain.restful.NtcSrcipDomesticReport"
|
||||||
|
resultMap="NtcSrcipDomesticReportMap">
|
||||||
|
SELECT
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="page !=null and page.fields != null and page.fields != ''">
|
||||||
|
${page.fields}
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
SRC_PROVINCE,SRC_CITY,
|
||||||
|
<include refid="commonPorperty" />
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
FROM (SELECT SERVICE,SRC_PROVINCE,SRC_CITY, SUM(SUM) SUM ,REPORT_TIME
|
||||||
|
FROM
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
|
||||||
|
NTC_SRCIP_DOMESTIC_STAT_HOUR
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
|
||||||
|
NTC_SRCIP_DOMESTIC_STAT_DAILY
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
|
||||||
|
NTC_SRCIP_DOMESTIC_STAT_MONTH
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
NTC_SRCIP_DOMESTIC_REPORT
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
<where>
|
||||||
|
<if test="searchService != null and searchService !=''">
|
||||||
|
<![CDATA[AND SERVICE in (${searchService})]]>
|
||||||
|
</if>
|
||||||
|
<if
|
||||||
|
test="searchReportStartTime != null and searchReportStartTime !=''">
|
||||||
|
<![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]>
|
||||||
|
</if>
|
||||||
|
<if
|
||||||
|
test="searchReportEndTime != null and searchReportEndTime !=''">
|
||||||
|
<![CDATA[AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
|
||||||
|
GROUP BY SERVICE,SRC_PROVINCE,SRC_CITY,REPORT_TIME
|
||||||
|
)
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
|
||||||
|
NTC_SRCIP_DOMESTIC_STAT_HOUR
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
|
||||||
|
NTC_SRCIP_DOMESTIC_STAT_DAILY
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
|
||||||
|
NTC_SRCIP_DOMESTIC_STAT_MONTH
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
NTC_SRCIP_DOMESTIC_REPORT
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||||||
|
ORDER BY ${page.orderBy}
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findNtcDestipCountryReport"
|
||||||
|
parameterType="com.nis.domain.restful.NtcDestipCountryReport"
|
||||||
|
resultMap="NtcDestipCountryReportMap">
|
||||||
|
SELECT
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="page !=null and page.fields != null and page.fields != ''">
|
||||||
|
${page.fields}
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
DEST_COUNTRY,
|
||||||
|
<include refid="commonPorperty" />
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
FROM (SELECT SERVICE,DEST_COUNTRY, SUM(SUM) SUM ,REPORT_TIME
|
||||||
|
FROM
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
|
||||||
|
NTC_DESTIP_COUNTRY_STAT_HOUR
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
|
||||||
|
NTC_DESTIP_COUNTRY_STAT_DAILY
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
|
||||||
|
NTC_DESTIP_COUNTRY_STAT_MONTH
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
NTC_DESTIP_COUNTRY_REPORT
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
<where>
|
||||||
|
<if test="searchService != null and searchService !=''">
|
||||||
|
<![CDATA[AND SERVICE in (${searchService})]]>
|
||||||
|
</if>
|
||||||
|
<if
|
||||||
|
test="searchReportStartTime != null and searchReportStartTime !=''">
|
||||||
|
<![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]>
|
||||||
|
</if>
|
||||||
|
<if
|
||||||
|
test="searchReportEndTime != null and searchReportEndTime !=''">
|
||||||
|
<![CDATA[AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
|
||||||
|
GROUP BY SERVICE,DEST_COUNTRY,REPORT_TIME
|
||||||
|
)
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
|
||||||
|
NTC_DESTIP_COUNTRY_STAT_HOUR
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
|
||||||
|
NTC_DESTIP_COUNTRY_STAT_DAILY
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
|
||||||
|
NTC_DESTIP_COUNTRY_STAT_MONTH
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
NTC_DESTIP_COUNTRY_REPORT
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||||||
|
ORDER BY ${page.orderBy}
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findNtcEntranceReport"
|
||||||
|
parameterType="com.nis.domain.restful.NtcEntranceReport"
|
||||||
|
resultMap="NtcEntranceReportMap">
|
||||||
|
SELECT
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="page !=null and page.fields != null and page.fields != ''">
|
||||||
|
${page.fields}
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
ENTRANCE_ID,
|
||||||
|
<include refid="commonPorperty" />
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
FROM (SELECT SERVICE,ENTRANCE_ID, SUM(SUM) SUM ,REPORT_TIME
|
||||||
|
FROM
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
|
||||||
|
NTC_ENTRANCE_STAT_HOUR
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
|
||||||
|
NTC_ENTRANCE_STAT_DAILY
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
|
||||||
|
NTC_ENTRANCE_STAT_MONTH
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
NTC_ENTRANCE_REPORT
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
<where>
|
||||||
|
|
||||||
|
<if test="searchEntrance != null and searchEntrance !=''">
|
||||||
|
<![CDATA[AND ENTRANCE_ID in (${searchEntrance})]]>
|
||||||
|
</if>
|
||||||
|
<if test="searchService != null and searchService !=''">
|
||||||
|
<![CDATA[AND SERVICE in (${searchService})]]>
|
||||||
|
</if>
|
||||||
|
<if
|
||||||
|
test="searchReportStartTime != null and searchReportStartTime !=''">
|
||||||
|
<![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]>
|
||||||
|
</if>
|
||||||
|
<if
|
||||||
|
test="searchReportEndTime != null and searchReportEndTime !=''">
|
||||||
|
<![CDATA[AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
|
||||||
|
GROUP BY SERVICE,ENTRANCE_ID,REPORT_TIME
|
||||||
|
)
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 ">
|
||||||
|
NTC_ENTRANCE_STAT_HOUR
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 ">
|
||||||
|
NTC_ENTRANCE_STAT_DAILY
|
||||||
|
</when>
|
||||||
|
<when
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 4 ">
|
||||||
|
NTC_ENTRANCE_STAT_MONTH
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
NTC_ENTRANCE_REPORT
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="page !=null and page.orderBy != null and page.orderBy != ''">
|
||||||
|
ORDER BY ${page.orderBy}
|
||||||
|
</when>
|
||||||
|
</choose>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findNtcIpURLReport"
|
||||||
|
parameterType="com.nis.domain.restful.NtcURLIpReport"
|
||||||
|
resultMap="NtcURLIpReportMap">
|
||||||
|
SELECT
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="page !=null and page.fields != null and page.fields != ''">
|
||||||
|
${page.fields}
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
url, ipCount,connCount
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
FROM (SELECT url,
|
||||||
|
count(distinct ip_addr) ipCount,
|
||||||
|
sum(sum) connCount
|
||||||
|
FROM ntc_reject_url_statistic
|
||||||
|
|
||||||
|
<where>
|
||||||
|
<if
|
||||||
|
test="searchReportStartTime != null and searchReportStartTime !=''">
|
||||||
|
<![CDATA[AND STAT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s')]]>
|
||||||
|
</if>
|
||||||
|
<if
|
||||||
|
test="searchReportEndTime != null and searchReportEndTime !=''">
|
||||||
|
<![CDATA[AND STAT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
|
||||||
|
</if>
|
||||||
|
<if test="searchUrl != null and searchUrl !=''">
|
||||||
|
AND url like concat(concat('%',#{searchUrl}),'%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
GROUP BY url
|
||||||
|
) ntc_reject_url_statistic ORDER BY ipcount desc,connCount desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="findNasIpList"
|
||||||
|
parameterType="com.nis.domain.restful.NtcRadiusReport"
|
||||||
|
resultMap="NtcRadiusReportMap">
|
||||||
|
select nas_ip,sum(num) num from ntc_radius_report
|
||||||
|
<where>
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="searchReportStartTime != null and searchReportStartTime !=''">
|
||||||
|
<!-- <![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s') AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]> -->
|
||||||
|
<![CDATA[and report_time>= #{searchReportStartTime} and report_time <#{searchReportEndTime} ]]>
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
and report_time>=DATE_SUB(now(), INTERVAL 1 HOUR)
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
|
||||||
|
</where>
|
||||||
|
group by nas_ip order by num desc
|
||||||
|
</select>
|
||||||
|
<select id="findAccounList"
|
||||||
|
parameterType="com.nis.domain.restful.NtcRadiusReport"
|
||||||
|
resultMap="NtcRadiusReportMap">
|
||||||
|
select account,sum(num) num from ntc_radius_report
|
||||||
|
<where>
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="searchReportStartTime != null and searchReportStartTime !=''">
|
||||||
|
<!-- <![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s') AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]> -->
|
||||||
|
<![CDATA[and report_time >= #{searchReportStartTime} and report_time <#{searchReportEndTime} ]]>
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
and report_time>DATE_SUB(now(), INTERVAL 1 HOUR)
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
|
||||||
|
</where>
|
||||||
|
group by account order by num desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findNtcRadiusReport"
|
||||||
|
parameterType="com.nis.domain.restful.NtcRadiusReport"
|
||||||
|
resultMap="NtcRadiusReportMap">
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM ntc_radius_report
|
||||||
|
<where>
|
||||||
|
<if
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 2 and searchAccount != null and searchAccount !=''">
|
||||||
|
<![CDATA[AND account =#{searchAccount}]]>
|
||||||
|
</if>
|
||||||
|
<if
|
||||||
|
test="searchBusinessType !=null and searchBusinessType != '' and searchBusinessType == 3 and searchNasIp != null and searchNasIp !=''">
|
||||||
|
<![CDATA[AND nas_ip =#{searchNasIp}]]>
|
||||||
|
</if>
|
||||||
|
<choose>
|
||||||
|
<when
|
||||||
|
test="searchReportStartTime != null and searchReportStartTime !=''">
|
||||||
|
<![CDATA[AND REPORT_TIME >= STR_TO_DATE(#{searchReportStartTime},'%Y-%m-%d %H:%i:%s') AND REPORT_TIME < STR_TO_DATE(#{searchReportEndTime},'%Y-%m-%d %H:%i:%s')]]>
|
||||||
|
</when>
|
||||||
|
<otherwise>
|
||||||
|
<![CDATA[AND REPORT_TIME>DATE_SUB(now(), INTERVAL 1 HOUR) ]]>
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
</where>
|
||||||
|
ORDER BY
|
||||||
|
REPORT_TIME ASC
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findNtcIpRangeReport"
|
||||||
|
parameterType="com.nis.domain.restful.NtcIpRangeReport"
|
||||||
|
resultMap="NtcIpRangeReportMap">
|
||||||
|
SELECT
|
||||||
|
ip_start,ip_end,ip_start_num,ip_end_num,ip_sub,country,area_type,desc_detail
|
||||||
|
FROM
|
||||||
|
traffic_ip_identify
|
||||||
|
<where>
|
||||||
|
<if test="searchType != null and searchType !=''">
|
||||||
|
<![CDATA[AND area_Type = #{searchType}]]>
|
||||||
|
</if>
|
||||||
|
<if test="searchCountry != null and searchCountry !=''">
|
||||||
|
<![CDATA[AND country= #{searchCountry} ]]>
|
||||||
|
</if>
|
||||||
|
<if test="searchIp != null and searchIp !=''">
|
||||||
|
<![CDATA[AND ip_end_num>=#{searchIp} and ip_start_num<= #{searchIp} ]]>
|
||||||
|
</if>
|
||||||
|
<if test="searchDesc != null and searchDesc !=''">
|
||||||
|
<![CDATA[AND desc_detail= #{searchDesc} ]]>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<insert id="insertNtcIpRangeBatch"
|
||||||
|
parameterType="com.nis.domain.restful.NtcIpRangeReport">
|
||||||
|
INSERT INTO traffic_ip_identify
|
||||||
|
(ip_start,ip_end,ip_start_num,ip_end_num,ip_sub,area_type,country)
|
||||||
|
VALUES
|
||||||
|
<foreach collection="list" item="ipRange" separator=",">
|
||||||
|
(#{ipRange.ipStart}, #{ipRange.ipEnd},
|
||||||
|
#{ipRange.ipStartNum},
|
||||||
|
#{ipRange.ipEndNum},
|
||||||
|
#{ipRange.ipSub}, #{ipRange.areaType},
|
||||||
|
#{ipRange.country})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="truncateNtcIpRange">
|
||||||
|
truncate table traffic_ip_identify
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<resultMap id="BandwidthResultMap" type="com.nis.domain.restful.dashboard.TrafficTransStatistic">
|
||||||
|
<id column="stat_id" jdbcType="INTEGER" property="statId" />
|
||||||
|
<result column="addr_type" jdbcType="INTEGER" property="addrType" />
|
||||||
|
<result column="trans_type" jdbcType="INTEGER" property="transType" />
|
||||||
|
<result column="entrance_id" jdbcType="INTEGER" property="entranceId" />
|
||||||
|
<result column="link_num" jdbcType="BIGINT" property="linkNum" />
|
||||||
|
<result column="c2s_pkt_num" jdbcType="BIGINT" property="c2sPktNum" />
|
||||||
|
<result column="s2c_pkt_num" jdbcType="BIGINT" property="s2cPktNum" />
|
||||||
|
<result column="c2s_byte_len" jdbcType="BIGINT" property="c2sByteLen" />
|
||||||
|
<result column="s2c_byte_len" jdbcType="BIGINT" property="s2cByteLen" />
|
||||||
|
<result column="stat_time" jdbcType="TIMESTAMP" property="statTime" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 获取取阻断,监测等流量信息最近时间 -->
|
||||||
|
<select id="getMaxReportTime" resultType="com.nis.domain.restful.dashboard.NtcTotalReport">
|
||||||
|
SELECT report_time reportTime FROM ntc_total_report order by report_time desc limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 根据最近的时间获取阻断,监测等流量信息 -->
|
||||||
|
<select id="getTotalReportList" resultType="java.util.HashMap">
|
||||||
|
SELECT SUM(reject_num) rejectNum,SUM(monitor_num) monitorNum,SUM(c2s_pkt_num) c2sPktNum,SUM(s2c_pkt_num) s2cPktNum,SUM(c2s_byte_len) c2sByteLen,SUM(s2c_byte_len) s2cByteLen,SUM(new_uni_conn_num) newUniConnNum,SUM(live_conn_num) liveConnNum,
|
||||||
|
SUM(drop_conn_num) dropConnNum,SUM(loop_conn_num) loopConnNum FROM ntc_total_report
|
||||||
|
where report_time > DATE_SUB(#{reportTime},INTERVAL 1 hour)
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 获取带宽最近时间 -->
|
||||||
|
<select id="getMaxStatTime" resultType="java.util.HashMap">
|
||||||
|
SELECT stat_time statTime FROM traffic_trans_statistic order by stat_time desc limit 1
|
||||||
|
</select>
|
||||||
|
<!-- 根据最近时间条获取带宽,进出口流量 -->
|
||||||
|
<select id="getNetFlowPortInfoNew" resultType="java.util.HashMap">
|
||||||
|
SELECT SUM(total_traffic.inoctets) AS inoctets ,SUM(total_traffic.outoctets) AS outoctets FROM (
|
||||||
|
SELECT IFNULL(SUM(c2s_byte_len),0) inoctets ,IFNULL(SUM(s2c_byte_len),0) outoctets FROM traffic_trans_statistic
|
||||||
|
where stat_time = (SELECT stat_time FROM traffic_trans_statistic WHERE entrance_id=1 ORDER BY stat_time DESC LIMIT 0,1) and entrance_id=1
|
||||||
|
UNION ALL
|
||||||
|
SELECT IFNULL(SUM(c2s_byte_len),0) inoctets ,IFNULL(SUM(s2c_byte_len),0) outoctets FROM traffic_trans_statistic
|
||||||
|
where stat_time = (SELECT stat_time FROM traffic_trans_statistic WHERE entrance_id=2 ORDER BY stat_time DESC LIMIT 0,1) and entrance_id=2
|
||||||
|
) total_traffic
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 获取近一小时的带宽根据ip46,协议 tcp,udp变化 -->
|
||||||
|
<select id="getBandwidthTrans" resultMap="BandwidthResultMap">
|
||||||
|
select IFNULL((SUM(c2s_byte_len+s2c_byte_len)*8)/300/1024/1024/1024,0) gbps,IFNULL(SUM(c2s_pkt_num+s2c_pkt_num)/300,0) pps,IFNULL(SUM(link_num),0) linkNum, stat_time time from traffic_trans_statistic
|
||||||
|
where <![CDATA[stat_time>=#{beginDate} and stat_time<=#{endDate} ]]>
|
||||||
|
<if test="addrType != null">
|
||||||
|
and addr_type=#{addrType}
|
||||||
|
</if>
|
||||||
|
<if test="transType != null">
|
||||||
|
and trans_type=${transType}
|
||||||
|
</if>
|
||||||
|
and entrance_id=#{entranceId}
|
||||||
|
group by stat_time order by stat_time
|
||||||
|
</select>
|
||||||
|
<!-- 获取近一小时的带宽根据ip46,协议 tcp,udp变化 -->
|
||||||
|
<select id="getBandwidthTrans2" resultMap="BandwidthResultMap">
|
||||||
|
select addr_type,trans_type,entrance_id,IFNULL((SUM(c2s_byte_len+s2c_byte_len)*8)/300/1024/1024/1024,0) gbps,IFNULL(SUM(c2s_pkt_num+s2c_pkt_num)/300,0) pps,IFNULL(SUM(link_num),0) linkNum, stat_time time from traffic_trans_statistic
|
||||||
|
where <![CDATA[stat_time<=#{endDate} and stat_time>=#{beginDate}]]>
|
||||||
|
and addr_type !=0
|
||||||
|
and trans_type!=0
|
||||||
|
group by stat_time,addr_type,trans_type order by stat_time
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 获取报表最近时间 -->
|
||||||
|
<select id="getEntranceMaxReportTime" resultType="java.util.HashMap">
|
||||||
|
SELECT report_time reportTime FROM ntc_entrance_report order by report_time desc limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- entrance 1,2 ,动作为阻断,近一小时 间隔5分钟数据 -->
|
||||||
|
<select id="getActionTrans" resultType="com.nis.domain.restful.NtcEntranceReport">
|
||||||
|
select sum(sum) sum,report_time time from ntc_entrance_report r where
|
||||||
|
<![CDATA[${serviceSql} and report_time<=#{endDate} and report_time>=#{beginDate}]]>
|
||||||
|
and entrance_id=#{entranceId}
|
||||||
|
group by report_time order by report_time
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -23,6 +23,7 @@ import com.nis.domain.restful.MaatConfig;
|
|||||||
import com.nis.restful.RestBusinessCode;
|
import com.nis.restful.RestBusinessCode;
|
||||||
import com.nis.restful.ServiceRuntimeException;
|
import com.nis.restful.ServiceRuntimeException;
|
||||||
import com.nis.util.Configurations;
|
import com.nis.util.Configurations;
|
||||||
|
import com.nis.util.Constants;
|
||||||
import com.nis.util.ExceptionUtil;
|
import com.nis.util.ExceptionUtil;
|
||||||
import com.nis.util.File2Redis;
|
import com.nis.util.File2Redis;
|
||||||
import com.nis.util.JedisUtils;
|
import com.nis.util.JedisUtils;
|
||||||
@@ -38,7 +39,7 @@ import redis.clients.jedis.exceptions.JedisConnectionException;
|
|||||||
@Service()
|
@Service()
|
||||||
public class ConfigJedisServiceimpl implements ConfigRedisService {
|
public class ConfigJedisServiceimpl implements ConfigRedisService {
|
||||||
private static Logger logger = LoggerFactory.getLogger(ConfigJedisServiceimpl.class);
|
private static Logger logger = LoggerFactory.getLogger(ConfigJedisServiceimpl.class);
|
||||||
private static final int TAPREDISDB = Configurations.getIntProperty("tapRedisDb", 5);
|
|
||||||
// 用于在实时统计配置后面添加时间,方便读取入库时间
|
// 用于在实时统计配置后面添加时间,方便读取入库时间
|
||||||
private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||||
|
|
||||||
@@ -459,10 +460,10 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
for (MaatConfig maatConfig : maatConfigList) {
|
for (MaatConfig maatConfig : maatConfigList) {
|
||||||
int service = maatConfig.getService();
|
int service = maatConfig.getService();
|
||||||
if (ServiceAndRDBIndexReal.isAddASU(service)) {
|
if (ServiceAndRDBIndexReal.isAddASU(service)) {
|
||||||
if (!keySet.contains(TAPREDISDB)) {
|
if (!keySet.contains(Constants.TAPREDISDB)) {
|
||||||
throw new ServiceRuntimeException(
|
throw new ServiceRuntimeException(
|
||||||
"业务类型:" + service + ",需要向阀门" + TAPREDISDB + "号库分发,但是当前只往" + keySet
|
"业务类型:" + service + ",需要向阀门" + Constants.TAPREDISDB + "号库分发,但是当前只往"
|
||||||
+ "库下发,请检查阀门编号或者当前业务对应的配置文件是否正确",
|
+ keySet + "库下发,请检查阀门编号或者当前业务对应的配置文件是否正确",
|
||||||
RestBusinessCode.PropertiesIsError.getValue());
|
RestBusinessCode.PropertiesIsError.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -624,8 +625,8 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
valStr = valStr.trim().replace("[", "").replace("]", "");
|
valStr = valStr.trim().replace("[", "").replace("]", "");
|
||||||
String val = map.get(valStr);
|
String val = map.get(valStr);
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
if (TAPREDISDB == redisDBIndex && type != 10 && type != 11
|
if ((Constants.TAPREDISDB == redisDBIndex || Constants.WEBFOCUSREDISDB == redisDBIndex)
|
||||||
&& valStr.toLowerCase().equals("op_time")) {// 域配置并且是op_time时在op_time前面添加如下内容
|
&& type != 10 && type != 11 && valStr.toLowerCase().equals("op_time")) {// 域配置并且是op_time时在op_time前面添加如下内容
|
||||||
Map<String, String[]> map2 = ServiceAndRDBIndexReal.getMaatToValveMap()
|
Map<String, String[]> map2 = ServiceAndRDBIndexReal.getMaatToValveMap()
|
||||||
.get(service);
|
.get(service);
|
||||||
if (map2 != null && map2.size() > 0) {
|
if (map2 != null && map2.size() > 0) {
|
||||||
@@ -894,10 +895,19 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<Integer, List<Long>> getCompileIdAndDBReal(List<Long> idList, int service, int idRelaRedisDBIndex) {
|
/**
|
||||||
|
* 根据配置id从关联关系db中获取各个配置实际所在的db
|
||||||
|
*
|
||||||
|
* @param idList
|
||||||
|
* @param service
|
||||||
|
* @param idRelaRedisDBIndex
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Map<Integer, Set<Long>> getCompileIdAndDBReal(List<Long> idList, int service, int idRelaRedisDBIndex) {
|
||||||
// 记录所有需要删除的配置信息key是相同的redisdb,value是需要删除的id集合
|
// 记录所有需要删除的配置信息key是相同的redisdb,value是需要删除的id集合
|
||||||
Map<Integer, List<Long>> idAndDBMap = new HashMap<Integer, List<Long>>();
|
Map<Integer, Set<Long>> idAndDBMap = new HashMap<Integer, Set<Long>>();
|
||||||
for (Long configId : idList) {
|
for (Long configId : idList) {
|
||||||
|
// if(JedisUtils.exists("COMPILEGROUP:" + configId, idRelaRedisDBIndex)){
|
||||||
String compileValStr = JedisUtils.get("COMPILEGROUP:" + configId, idRelaRedisDBIndex);
|
String compileValStr = JedisUtils.get("COMPILEGROUP:" + configId, idRelaRedisDBIndex);
|
||||||
if (compileValStr != null && !compileValStr.trim().equals("")) {
|
if (compileValStr != null && !compileValStr.trim().equals("")) {
|
||||||
String[] keyAndDBArr =
|
String[] keyAndDBArr =
|
||||||
@@ -914,7 +924,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
if (idAndDBMap.containsKey(redisDb)) {
|
if (idAndDBMap.containsKey(redisDb)) {
|
||||||
idAndDBMap.get(redisDb).add(configId);
|
idAndDBMap.get(redisDb).add(configId);
|
||||||
} else {
|
} else {
|
||||||
List<Long> list = new ArrayList<Long>();
|
Set<Long> list = new HashSet<Long>();
|
||||||
list.add(configId);
|
list.add(configId);
|
||||||
idAndDBMap.put(redisDb, list);
|
idAndDBMap.put(redisDb, list);
|
||||||
}
|
}
|
||||||
@@ -931,12 +941,79 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
+ ",对应的redisdb信息,请联系开发人员检查删除逻辑是否正确或redis数据是否出现了异常",
|
+ ",对应的redisdb信息,请联系开发人员检查删除逻辑是否正确或redis数据是否出现了异常",
|
||||||
RestBusinessCode.KeyNotExistsInRedis.getValue());
|
RestBusinessCode.KeyNotExistsInRedis.getValue());
|
||||||
}
|
}
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
return idAndDBMap;
|
return idAndDBMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据编译id,组id,域id
|
||||||
|
*/
|
||||||
|
public void delByCompileGroupRegionId() {
|
||||||
|
Jedis resource = JedisUtils.getResource(0);
|
||||||
|
double version = 3901d;
|
||||||
|
Transaction transaction = resource.multi();
|
||||||
|
transaction.select(2);
|
||||||
|
for (long i = 3143; i <= 13142; i++) {
|
||||||
|
String key = "EFFECTIVE_RULE:NTC_COMPILE," + i;
|
||||||
|
String a = "OBSOLETE_RULE:NTC_COMPILE," + i;
|
||||||
|
transaction.rename(key, a);
|
||||||
|
|
||||||
|
transaction.zadd("MAAT_RULE_TIMER", version, a);
|
||||||
|
transaction.zadd("MAAT_UPDATE_STATUS", version, "DEL,NTC_COMPILE," + i);
|
||||||
|
Long nowTime = new Date().getTime();
|
||||||
|
nowTime = nowTime / 1000l;
|
||||||
|
Double score = nowTime.doubleValue();// 使用redis自带的time,得到当前时间的秒
|
||||||
|
transaction.zadd("MAAT_VERSION_TIMER", score, version + "");
|
||||||
|
}
|
||||||
|
for (long i = 5312; i <= 15311; i++) {
|
||||||
|
String key = "EFFECTIVE_RULE:NTC_IP," + i;
|
||||||
|
String a = "OBSOLETE_RULE:NTC_IP," + i;
|
||||||
|
transaction.rename(key, a);
|
||||||
|
|
||||||
|
transaction.zadd("MAAT_RULE_TIMER", version, a);
|
||||||
|
transaction.zadd("MAAT_UPDATE_STATUS", version, "DEL,NTC_IP," + i);
|
||||||
|
Long nowTime = new Date().getTime();
|
||||||
|
nowTime = nowTime / 1000l;
|
||||||
|
Double score = nowTime.doubleValue();// 使用redis自带的time,得到当前时间的秒
|
||||||
|
transaction.zadd("MAAT_VERSION_TIMER", score, version + "");
|
||||||
|
}
|
||||||
|
int b = 0;
|
||||||
|
for (long i = 3898; i <= 13897; i++) {
|
||||||
|
int id = 3143 + b;
|
||||||
|
String groupId = i + "" + id;
|
||||||
|
String key = "EFFECTIVE_RULE:NTC_GROUP," + groupId;
|
||||||
|
String c = "OBSOLETE_RULE:NTC_GROUP," + groupId;
|
||||||
|
transaction.rename(key, c);
|
||||||
|
b++;
|
||||||
|
transaction.zadd("MAAT_RULE_TIMER", version, c);
|
||||||
|
transaction.zadd("MAAT_UPDATE_STATUS", version, "DEL,NTC_GROUP," + groupId);
|
||||||
|
Long nowTime = new Date().getTime();
|
||||||
|
nowTime = nowTime / 1000l;
|
||||||
|
Double score = nowTime.doubleValue();// 使用redis自带的time,得到当前时间的秒
|
||||||
|
transaction.zadd("MAAT_VERSION_TIMER", score, version + "");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
transaction.set("MAAT_VERSION", "3901");
|
||||||
|
transaction.exec();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据配置id删除数据
|
||||||
|
*/
|
||||||
|
public void delByCompileId() {
|
||||||
|
Map<Integer, List<Long>> serviceConfigMap = new HashMap<Integer, List<Long>>();
|
||||||
|
List<Long> list = new ArrayList<>();
|
||||||
|
for (long i = 13143; i <= 23142; i++) {
|
||||||
|
list.add(i);
|
||||||
|
}
|
||||||
|
serviceConfigMap.put(129, list);
|
||||||
|
delMaatConfig(serviceConfigMap);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean delMaatConfig(Map<Integer, List<Long>> serviceConfigMap) {
|
public boolean delMaatConfig(Map<Integer, List<Long>> serviceConfigMap) {
|
||||||
if (serviceConfigMap != null && serviceConfigMap.size() > 0) {
|
if (serviceConfigMap != null && serviceConfigMap.size() > 0) {
|
||||||
@@ -946,14 +1023,14 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
int idRelaRedisDBIndex = Configurations.getIntProperty("idRelaRedisDBIndex", 15);
|
int idRelaRedisDBIndex = Configurations.getIntProperty("idRelaRedisDBIndex", 15);
|
||||||
if (serviceConfigMap != null && serviceConfigMap.size() > 0) {
|
if (serviceConfigMap != null && serviceConfigMap.size() > 0) {
|
||||||
for (Integer service : serviceConfigMap.keySet()) {
|
for (Integer service : serviceConfigMap.keySet()) {
|
||||||
Map<Integer, List<Long>> compileIdAndDBReal = getCompileIdAndDBReal(
|
Map<Integer, Set<Long>> compileIdAndDBReal = getCompileIdAndDBReal(
|
||||||
serviceConfigMap.get(service), service, idRelaRedisDBIndex);
|
serviceConfigMap.get(service), service, idRelaRedisDBIndex);
|
||||||
for (Integer redisDb : compileIdAndDBReal.keySet()) {
|
for (Integer redisDb : compileIdAndDBReal.keySet()) {
|
||||||
String maatVersionStr = JedisUtils.get("MAAT_VERSION", redisDb);
|
String maatVersionStr = JedisUtils.get("MAAT_VERSION", redisDb);
|
||||||
if (maatVersionStr != null) {
|
if (maatVersionStr != null) {
|
||||||
Double maatVersion = Double.valueOf(maatVersionStr) + 1D;
|
Double maatVersion = Double.valueOf(maatVersionStr) + 1D;
|
||||||
MaatXmlConfig maatXmlConfig = ReadMaatXmlUtil.getMaatConfigByService(service);
|
MaatXmlConfig maatXmlConfig = ReadMaatXmlUtil.getMaatConfigByService(service);
|
||||||
List<Long> list = compileIdAndDBReal.get(redisDb);
|
Set<Long> list = compileIdAndDBReal.get(redisDb);
|
||||||
if (list != null && list.size() > 0) {
|
if (list != null && list.size() > 0) {
|
||||||
for (Long id : list) {
|
for (Long id : list) {
|
||||||
// 按序号选择Redis数据库
|
// 按序号选择Redis数据库
|
||||||
@@ -979,8 +1056,83 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
throw new ServiceRuntimeException("删除maat类配置时,未发现对应的配置信息,请检查配置参数是否正确",
|
throw new ServiceRuntimeException("删除maat类配置时,未发现对应的配置信息,请检查配置参数是否正确",
|
||||||
RestBusinessCode.ConfigSourceIsNull.getValue());
|
RestBusinessCode.ConfigSourceIsNull.getValue());
|
||||||
}
|
}
|
||||||
if (removeMaatRelation(serviceConfigMap, transaction)
|
if (removeMaatRelation(serviceConfigMap, transaction, null)
|
||||||
&& removeStatisticsReal(serviceConfigMap, transaction)) {
|
&& removeStatisticsReal(serviceConfigMap, transaction, null)) {
|
||||||
|
transaction.exec();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
transaction.discard();
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (JedisConnectionException e) {
|
||||||
|
String error = "连接redis异常,删除maat配置失败," + e.getMessage();
|
||||||
|
logger.error(error + " " + ExceptionUtil.getExceptionMsg(e));
|
||||||
|
throw new ServiceRuntimeException(error, RestBusinessCode.CannotConnectionRedis.getValue());
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
int businessCode = RestBusinessCode.service_runtime_error.getValue();
|
||||||
|
if (e instanceof ServiceRuntimeException) {
|
||||||
|
businessCode = ((ServiceRuntimeException) e).getErrorCode();
|
||||||
|
}
|
||||||
|
logger.error("删除maat配置发生了异常" + ExceptionUtil.getExceptionMsg(e));
|
||||||
|
transaction.discard();
|
||||||
|
throw new ServiceRuntimeException("删除maat配置发生了异常," + e.getMessage(), businessCode);
|
||||||
|
} finally {
|
||||||
|
// 释放连接到连接池
|
||||||
|
JedisUtils.returnResource(resource);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
|
||||||
|
{
|
||||||
|
throw new ServiceRuntimeException("Map参数信息不能为空,请检查!", RestBusinessCode.ConfigInfoMapIsNull.getValue());
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean startStopMaatConfig(Map<Integer, List<Long>> serviceConfigMap, boolean isStart) {
|
||||||
|
if (serviceConfigMap != null && serviceConfigMap.size() > 0) {
|
||||||
|
Jedis resource = JedisUtils.getResource(0);
|
||||||
|
Transaction transaction = resource.multi();
|
||||||
|
try {
|
||||||
|
int idRelaRedisDBIndex = Configurations.getIntProperty("idRelaRedisDBIndex", 15);
|
||||||
|
if (serviceConfigMap != null && serviceConfigMap.size() > 0) {
|
||||||
|
for (Integer service : serviceConfigMap.keySet()) {
|
||||||
|
Map<Integer, Set<Long>> compileIdAndDBReal = getCompileIdAndDBReal(
|
||||||
|
serviceConfigMap.get(service), service, idRelaRedisDBIndex);
|
||||||
|
for (Integer redisDb : compileIdAndDBReal.keySet()) {
|
||||||
|
String maatVersionStr = JedisUtils.get("MAAT_VERSION", redisDb);
|
||||||
|
if (maatVersionStr != null) {
|
||||||
|
Double maatVersion = Double.valueOf(maatVersionStr) + 1D;
|
||||||
|
MaatXmlConfig maatXmlConfig = ReadMaatXmlUtil.getMaatConfigByService(service);
|
||||||
|
Set<Long> list = compileIdAndDBReal.get(redisDb);
|
||||||
|
if (list != null && list.size() > 0) {
|
||||||
|
for (Long id : list) {
|
||||||
|
// 按序号选择Redis数据库
|
||||||
|
transaction.select(redisDb);
|
||||||
|
startStopConfig(id, maatXmlConfig, maatVersion, service, transaction, redisDb,
|
||||||
|
idRelaRedisDBIndex, isStart);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new ServiceRuntimeException("删除配置时,未发现对应的配置id信息,请检查配置参数是否正确",
|
||||||
|
RestBusinessCode.ConfigSourceIsNull.getValue());
|
||||||
|
}
|
||||||
|
transaction.incrBy("MAAT_VERSION", 1l);
|
||||||
|
logger.info("向{}号redis数据库更新了MAAT_VERSION,更新后版本是{}", redisDb,
|
||||||
|
Integer.valueOf(maatVersionStr) + 1);
|
||||||
|
} else {
|
||||||
|
throw new ServiceRuntimeException("从" + redisDb
|
||||||
|
+ "号redis库中获取MAAT_VERSION的值为null,redis中不存在该值,请联系开发人员检查删除逻辑是否正确或redis数据是否出现了异常",
|
||||||
|
RestBusinessCode.GetMaatVersionFailure.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new ServiceRuntimeException("删除maat类配置时,未发现对应的配置信息,请检查配置参数是否正确",
|
||||||
|
RestBusinessCode.ConfigSourceIsNull.getValue());
|
||||||
|
}
|
||||||
|
if (removeMaatRelation(serviceConfigMap, transaction, isStart)
|
||||||
|
&& removeStatisticsReal(serviceConfigMap, transaction, isStart)) {
|
||||||
transaction.exec();
|
transaction.exec();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@@ -1044,7 +1196,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
|
|
||||||
// 删除(重命名)编译配置
|
// 删除(重命名)编译配置
|
||||||
removeCompileAndGroupConfig(maatXmlConfig, id + "", 10, maatVersion, service, transaction, redisDBIndex,
|
removeCompileAndGroupConfig(maatXmlConfig, id + "", 10, maatVersion, service, transaction, redisDBIndex,
|
||||||
null);// 10代表是编译配置
|
null, null);// 10代表是编译配置
|
||||||
// 拼接编译与分组关系的Redis Key
|
// 拼接编译与分组关系的Redis Key
|
||||||
String compileStr = "COMPILEGROUP:" + id;
|
String compileStr = "COMPILEGROUP:" + id;
|
||||||
// 获取当前编译配置与分组配置的关联关系
|
// 获取当前编译配置与分组配置的关联关系
|
||||||
@@ -1102,7 +1254,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
// 根据分组与域关联关系找到对应域配置然后删除(重命名)
|
// 根据分组与域关联关系找到对应域配置然后删除(重命名)
|
||||||
removeRegionConfig(maatXmlConfig,
|
removeRegionConfig(maatXmlConfig,
|
||||||
regionKeyArr, maatVersion, service,
|
regionKeyArr, maatVersion, service,
|
||||||
transaction, redisDBIndex);
|
transaction, redisDBIndex, null);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new ServiceRuntimeException("从"
|
throw new ServiceRuntimeException("从"
|
||||||
@@ -1120,7 +1272,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
// 根据分组与编译关联关系找到对应分组配置然后删除(重命名)
|
// 根据分组与编译关联关系找到对应分组配置然后删除(重命名)
|
||||||
removeCompileAndGroupConfig(maatXmlConfig,
|
removeCompileAndGroupConfig(maatXmlConfig,
|
||||||
groupId.replace("GROUPCOMPILE:", ""), 11, maatVersion, service,
|
groupId.replace("GROUPCOMPILE:", ""), 11, maatVersion, service,
|
||||||
transaction, redisDBIndex, id + "");// 11代表是分组配置
|
transaction, redisDBIndex, id + "", null);// 11代表是分组配置
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new ServiceRuntimeException(
|
throw new ServiceRuntimeException(
|
||||||
@@ -1149,6 +1301,115 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void startStopConfig(Long id, MaatXmlConfig maatXmlConfig, Double maatVersion, int service,
|
||||||
|
Transaction transaction, int redisDBIndex, int idRelaRedisDBIndex, boolean isStart) {
|
||||||
|
if (maatXmlConfig != null) {
|
||||||
|
Map<String, String> keyMap = new HashMap<>();
|
||||||
|
// 删除(重命名)编译配置
|
||||||
|
removeCompileAndGroupConfig(maatXmlConfig, id + "", 10, maatVersion, service, transaction, redisDBIndex,
|
||||||
|
null, isStart);// 10代表是编译配置
|
||||||
|
// 拼接编译与分组关系的Redis Key
|
||||||
|
String compileStr = "COMPILEGROUP:" + id;
|
||||||
|
// 获取当前编译配置与分组配置的关联关系
|
||||||
|
String compileStrVal = JedisUtils.get(compileStr, idRelaRedisDBIndex);// 根据编译id获取该编译下的分组关系
|
||||||
|
if (compileStrVal != null && !compileStrVal.trim().equals("")) {
|
||||||
|
String[] compileGroupStrArr = org.apache.commons.lang.StringUtils.split(compileStrVal, ";");
|
||||||
|
for (String compileGroup : compileGroupStrArr) {
|
||||||
|
if (compileGroup != null && !compileGroup.trim().equals("")) {
|
||||||
|
String groupCompileStrs = getRegionInfo(compileGroup);// 获取编译对应的分组信息,去除后面的redisdb信息
|
||||||
|
if (groupCompileStrs != null && !groupCompileStrs.trim().equals("")) {// 遍历编译和分组的信息
|
||||||
|
String[] split = org.apache.commons.lang.StringUtils.split(groupCompileStrs, ";");
|
||||||
|
|
||||||
|
for (String groupId : split) {// GROUPCOMPILE:groupid-redisdb
|
||||||
|
if (groupId != null && !groupId.trim().equals("")) {
|
||||||
|
String groupCompileAndDBStrs = null;
|
||||||
|
if (!keyMap.containsKey(groupId)) {
|
||||||
|
groupCompileAndDBStrs = JedisUtils.get(groupId, idRelaRedisDBIndex);
|
||||||
|
keyMap.put(groupId, groupCompileAndDBStrs);
|
||||||
|
} else {
|
||||||
|
groupCompileAndDBStrs = keyMap.get(groupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] compileGroupArr = org.apache.commons.lang.StringUtils
|
||||||
|
.split(groupCompileAndDBStrs, ";");// 获取组对应的编译id
|
||||||
|
|
||||||
|
for (String groupAndCompileStr : compileGroupArr) {
|
||||||
|
if (groupAndCompileStr != null && !groupAndCompileStr.trim().equals("")) {
|
||||||
|
String compileId = getRegionInfo(groupAndCompileStr);
|
||||||
|
if (compileId != null && !compileId.trim().equals("")) {
|
||||||
|
// 被分组复用的业务,不能将域置为失效
|
||||||
|
if (!ServiceAndRDBIndexReal.serviceIsReuse(service)) {// 如果当前业务不允许被分组复用(普通的maat类配置),则可以将域置为失效,否则不将域置为失效
|
||||||
|
// 如果只有一个编译id且与上面的编译id相同则说明未被分组复用,可以将其下的所有域置失效,否则不处理域配置,只把编译,分组关系置为无效
|
||||||
|
if (compileId.equals(compileStr)) {//
|
||||||
|
String groupRegionKey = groupId.replace("GROUPCOMPILE",
|
||||||
|
"GROUPREGION");// groupregion里面value是region的信息,key是group的信息,所以可以直接将GROUPCOMPILE替换为GROUPREGION
|
||||||
|
String regionStrs = null;
|
||||||
|
if (!keyMap.containsKey(groupRegionKey)) {
|
||||||
|
regionStrs = JedisUtils.get(groupRegionKey,
|
||||||
|
idRelaRedisDBIndex);
|
||||||
|
keyMap.put(groupRegionKey, regionStrs);
|
||||||
|
} else {
|
||||||
|
regionStrs = keyMap.get(groupRegionKey);
|
||||||
|
}
|
||||||
|
if (regionStrs != null && !regionStrs.trim().equals("")) {
|
||||||
|
String[] regionStrArr = regionStrs.split(";");
|
||||||
|
for (String str : regionStrArr) {
|
||||||
|
if (str != null && !str.trim().equals("")) {
|
||||||
|
|
||||||
|
String regionStr = getRegionInfo(str);
|
||||||
|
if (regionStr != null
|
||||||
|
&& !regionStr.trim().equals("")) {
|
||||||
|
String[] regionKeyArr = regionStr.split(";");
|
||||||
|
if (regionKeyArr != null
|
||||||
|
&& regionKeyArr.length > 0) {
|
||||||
|
// 根据分组与域关联关系找到对应域配置然后删除(重命名)
|
||||||
|
removeRegionConfig(maatXmlConfig,
|
||||||
|
regionKeyArr, maatVersion, service,
|
||||||
|
transaction, redisDBIndex, isStart);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new ServiceRuntimeException("从"
|
||||||
|
+ idRelaRedisDBIndex
|
||||||
|
+ "号redis库中无法获取MAAT配置分组与域的关联关系,key为"
|
||||||
|
+ groupRegionKey,
|
||||||
|
RestBusinessCode.KeyNotExistsInRedis
|
||||||
|
.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 根据分组与编译关联关系找到对应分组配置然后删除(重命名)
|
||||||
|
removeCompileAndGroupConfig(maatXmlConfig,
|
||||||
|
groupId.replace("GROUPCOMPILE:", ""), 11, maatVersion, service,
|
||||||
|
transaction, redisDBIndex, id + "", isStart);// 11代表是分组配置
|
||||||
|
|
||||||
|
} else {
|
||||||
|
throw new ServiceRuntimeException(
|
||||||
|
"从" + idRelaRedisDBIndex + "号redis库中无法获取MAAT配置分组与编译的关联关系,key为"
|
||||||
|
+ groupId,
|
||||||
|
RestBusinessCode.KeyNotExistsInRedis.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new ServiceRuntimeException(
|
||||||
|
"从" + idRelaRedisDBIndex + "号redis库中无法获取MAAT配置编译与分组关联关系,key为" + compileStr,
|
||||||
|
RestBusinessCode.KeyNotExistsInRedis.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new ServiceRuntimeException(
|
||||||
|
"无法从applicationConfig-maatRedis.xml配置文件中获取service为" + service + "对应的规则,请检查业务类型是否正确",
|
||||||
|
RestBusinessCode.NotFoundRedisRule.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除maat配置时,对redis进行相关操作,主要是重命名key和记录相关状态
|
* 删除maat配置时,对redis进行相关操作,主要是重命名key和记录相关状态
|
||||||
*
|
*
|
||||||
@@ -1160,7 +1421,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
* @param redisTemplate
|
* @param redisTemplate
|
||||||
*/
|
*/
|
||||||
private void removeCompileAndGroupConfig(MaatXmlConfig maatXmlConfig, String id, int type, Double maatVersion,
|
private void removeCompileAndGroupConfig(MaatXmlConfig maatXmlConfig, String id, int type, Double maatVersion,
|
||||||
int service, Transaction transaction, int redisDBIndex, String compileId) {
|
int service, Transaction transaction, int redisDBIndex, String compileId, Boolean isStart) {
|
||||||
if (maatXmlConfig != null) {
|
if (maatXmlConfig != null) {
|
||||||
List<MaatXmlExpr> expressionList = maatXmlConfig.getExpressionList();
|
List<MaatXmlExpr> expressionList = maatXmlConfig.getExpressionList();
|
||||||
String maatKey = null;
|
String maatKey = null;
|
||||||
@@ -1194,14 +1455,29 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
if (compileId != null) {
|
if (compileId != null) {
|
||||||
oldKey += compileId;
|
oldKey += compileId;
|
||||||
}
|
}
|
||||||
|
if (isStart == null) {// 置为失效
|
||||||
maatKey = oldKey.replace("EFFECTIVE_RULE", "OBSOLETE_RULE");
|
maatKey = oldKey.replace("EFFECTIVE_RULE", "OBSOLETE_RULE");
|
||||||
|
} else if (isStart == true) {// 将失效置为生效
|
||||||
|
maatKey = oldKey;
|
||||||
|
oldKey=oldKey.replace("EFFECTIVE_RULE", "OBSOLETE_RULE");
|
||||||
|
} else {// 将生效变为失效
|
||||||
|
maatKey = oldKey.replace("EFFECTIVE_RULE", "OBSOLETE_RULE");
|
||||||
|
}
|
||||||
|
|
||||||
transaction.rename(oldKey, maatKey.toUpperCase());
|
transaction.rename(oldKey, maatKey.toUpperCase());
|
||||||
logger.info("向{}号redis数据库修改了一条配置,修改前key是{},修改后key是{}", redisDBIndex, oldKey, maatKey.toUpperCase());
|
logger.info("向{}号redis数据库修改了一条配置,修改前key是{},修改后key是{}", redisDBIndex, oldKey, maatKey.toUpperCase());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateMaatInfo(expressionList, maatKey, transaction, maatVersion, redisDBIndex, true);
|
|
||||||
|
if (isStart == null) {
|
||||||
|
updateMaatInfo(expressionList, maatKey, transaction, maatVersion, redisDBIndex, true);// 变成无效
|
||||||
|
} else if (isStart) {
|
||||||
|
updateMaatInfo(expressionList, maatKey, transaction, maatVersion, redisDBIndex, false);// 变成有效
|
||||||
|
} else {
|
||||||
|
updateMaatInfo(expressionList, maatKey, transaction, maatVersion, redisDBIndex, true);// 变成无效
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new ServiceRuntimeException(
|
throw new ServiceRuntimeException(
|
||||||
"无法从applicationConfig-maatRedis.xml配置文件中获取service为" + service + "对应的规则,请检查业务类型是否正确",
|
"无法从applicationConfig-maatRedis.xml配置文件中获取service为" + service + "对应的规则,请检查业务类型是否正确",
|
||||||
@@ -1220,19 +1496,31 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
* @param redisDBIndex
|
* @param redisDBIndex
|
||||||
*/
|
*/
|
||||||
private void removeRegionConfig(MaatXmlConfig maatXmlConfig, String[] regionArr, Double maatVersion, int service,
|
private void removeRegionConfig(MaatXmlConfig maatXmlConfig, String[] regionArr, Double maatVersion, int service,
|
||||||
Transaction transaction, int redisDBIndex) {
|
Transaction transaction, int redisDBIndex, Boolean isStart) {
|
||||||
transaction.select(redisDBIndex);
|
transaction.select(redisDBIndex);
|
||||||
if (maatXmlConfig != null && regionArr != null && regionArr.length > 0) {
|
if (maatXmlConfig != null && regionArr != null && regionArr.length > 0) {
|
||||||
List<MaatXmlExpr> expressionList = maatXmlConfig.getExpressionList();
|
List<MaatXmlExpr> expressionList = maatXmlConfig.getExpressionList();
|
||||||
String maatKey = null;
|
String maatKey = null;
|
||||||
for (String oldKey : regionArr) {
|
for (String oldKey : regionArr) {
|
||||||
if (oldKey != null && !oldKey.trim().equals("")) {
|
if (oldKey != null && !oldKey.trim().equals("")) {
|
||||||
|
if (isStart == null) {// 置为失效
|
||||||
maatKey = oldKey.replace("EFFECTIVE_RULE", "OBSOLETE_RULE");
|
maatKey = oldKey.replace("EFFECTIVE_RULE", "OBSOLETE_RULE");
|
||||||
|
} else if (isStart == true) {// 将失效置为生效
|
||||||
|
maatKey = oldKey.replace("OBSOLETE_RULE", "EFFECTIVE_RULE");
|
||||||
|
} else {// 将生效变为失效
|
||||||
|
maatKey = oldKey.replace("EFFECTIVE_RULE", "OBSOLETE_RULE");
|
||||||
|
}
|
||||||
transaction.rename(oldKey, maatKey.toUpperCase());
|
transaction.rename(oldKey, maatKey.toUpperCase());
|
||||||
logger.info("向{}号redis数据库修改了一条配置,修改前key是{},修改后key是{}", redisDBIndex, oldKey, maatKey.toUpperCase());
|
logger.info("向{}号redis数据库修改了一条配置,修改前key是{},修改后key是{}", redisDBIndex, oldKey, maatKey.toUpperCase());
|
||||||
|
if (isStart == null) {
|
||||||
|
updateMaatInfo(expressionList, maatKey, transaction, maatVersion, redisDBIndex, true);// 变成无效
|
||||||
|
} else if (isStart) {
|
||||||
|
updateMaatInfo(expressionList, maatKey, transaction, maatVersion, redisDBIndex, false);// 变成有效
|
||||||
|
} else {
|
||||||
updateMaatInfo(expressionList, maatKey, transaction, maatVersion, redisDBIndex, true);
|
updateMaatInfo(expressionList, maatKey, transaction, maatVersion, redisDBIndex, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (maatXmlConfig == null) {
|
if (maatXmlConfig == null) {
|
||||||
throw new ServiceRuntimeException(
|
throw new ServiceRuntimeException(
|
||||||
@@ -1246,7 +1534,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
/**
|
/**
|
||||||
* 编译配置用于实时统计 取消分类性质,标签等信息
|
* 编译配置用于实时统计 取消分类性质,标签等信息
|
||||||
*/
|
*/
|
||||||
private boolean removeStatisticsReal(Map<Integer, List<Long>> map, Transaction transaction) {
|
private boolean removeStatisticsReal(Map<Integer, List<Long>> map, Transaction transaction, Boolean isStart) {
|
||||||
if (map != null && map.size() > 0) {
|
if (map != null && map.size() > 0) {
|
||||||
int redisStatisticsRealDBIndex = Configurations.getIntProperty("redisStatisticsRealDBIndex", 14);
|
int redisStatisticsRealDBIndex = Configurations.getIntProperty("redisStatisticsRealDBIndex", 14);
|
||||||
transaction.select(redisStatisticsRealDBIndex);
|
transaction.select(redisStatisticsRealDBIndex);
|
||||||
@@ -1269,8 +1557,11 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
logger.info("向{}号redis数据库修改了一条配置,修改前key是{},修改后key是:{}", redisStatisticsRealDBIndex,
|
logger.info("向{}号redis数据库修改了一条配置,修改前key是{},修改后key是:{}", redisStatisticsRealDBIndex,
|
||||||
effectiveRuleKey.toUpperCase(),
|
effectiveRuleKey.toUpperCase(),
|
||||||
effectiveRuleKey.toUpperCase().replace("EFFECTIVE_RULE", "OBSOLETE_RULE"));
|
effectiveRuleKey.toUpperCase().replace("EFFECTIVE_RULE", "OBSOLETE_RULE"));
|
||||||
|
|
||||||
String zset = effectiveRuleKey.replace("EFFECTIVE_RULE:", "DEL,");
|
String zset = effectiveRuleKey.replace("EFFECTIVE_RULE:", "DEL,");
|
||||||
|
if (isStart == null || isStart == false) {
|
||||||
|
} else if (isStart == true) {
|
||||||
|
zset = effectiveRuleKey.replace("EFFECTIVE_RULE:", "ADD,");
|
||||||
|
}
|
||||||
transaction.zadd("MAAT_UPDATE_STATUS", maatVersion, zset);
|
transaction.zadd("MAAT_UPDATE_STATUS", maatVersion, zset);
|
||||||
logger.info("向{}号redis数据库更新了MAAT_UPDATE_STATUS,内容是{},SCORES是{}", redisStatisticsRealDBIndex,
|
logger.info("向{}号redis数据库更新了MAAT_UPDATE_STATUS,内容是{},SCORES是{}", redisStatisticsRealDBIndex,
|
||||||
zset.toUpperCase(), maatVersion);
|
zset.toUpperCase(), maatVersion);
|
||||||
@@ -1302,7 +1593,7 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
*
|
*
|
||||||
* @param idMap
|
* @param idMap
|
||||||
*/
|
*/
|
||||||
private boolean removeMaatRelation(Map<Integer, List<Long>> map, Transaction transaction) {
|
private boolean removeMaatRelation(Map<Integer, List<Long>> map, Transaction transaction, Boolean isStart) {
|
||||||
if (map != null && map.size() > 0) {
|
if (map != null && map.size() > 0) {
|
||||||
int idRelaRedisDBIndex = Configurations.getIntProperty("idRelaRedisDBIndex", 15);
|
int idRelaRedisDBIndex = Configurations.getIntProperty("idRelaRedisDBIndex", 15);
|
||||||
transaction.select(idRelaRedisDBIndex);
|
transaction.select(idRelaRedisDBIndex);
|
||||||
@@ -1352,7 +1643,22 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
try {
|
try {
|
||||||
// 为了提高效率,不判断了,如果报错直接捕捉异常处理
|
// 为了提高效率,不判断了,如果报错直接捕捉异常处理
|
||||||
// 删除分组与域的关联关系
|
// 删除分组与域的关联关系
|
||||||
|
if (isStart == null) {// 删除
|
||||||
transaction.del(groupRegion);
|
transaction.del(groupRegion);
|
||||||
|
} else if (isStart == true) {// 将失效置为生效
|
||||||
|
String groupRegionVal = JedisUtils.get(groupRegion,
|
||||||
|
idRelaRedisDBIndex);
|
||||||
|
groupRegionVal = groupRegionVal
|
||||||
|
.replace("OBSOLETE_RULE", "EFFECTIVE_RULE");
|
||||||
|
transaction.set(groupRegion, groupRegionVal);
|
||||||
|
} else {// 将生效变为失效
|
||||||
|
String groupRegionVal = JedisUtils.get(groupRegion,
|
||||||
|
idRelaRedisDBIndex);
|
||||||
|
groupRegionVal = groupRegionVal
|
||||||
|
.replace("EFFECTIVE_RULE", "OBSOLETE_RULE");
|
||||||
|
transaction.set(groupRegion, groupRegionVal);
|
||||||
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new ServiceRuntimeException("从"
|
throw new ServiceRuntimeException("从"
|
||||||
+ idRelaRedisDBIndex + "号redis库中删除"
|
+ idRelaRedisDBIndex + "号redis库中删除"
|
||||||
@@ -1383,7 +1689,26 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
try {
|
try {
|
||||||
// 为了提高效率,不判断了,如果报错直接捕捉异常处理
|
// 为了提高效率,不判断了,如果报错直接捕捉异常处理
|
||||||
// 删除当前组所对应的编译
|
// 删除当前组所对应的编译
|
||||||
transaction.del(groupCompile.toUpperCase());
|
|
||||||
|
if (isStart == null) {// 删除
|
||||||
|
transaction.del(groupCompile.toUpperCase());// 删除编译与分组的关联关系
|
||||||
|
} else if (isStart == true) {// 将失效置为生效
|
||||||
|
String groupRegionVal = JedisUtils.get(
|
||||||
|
groupCompile.toUpperCase(),
|
||||||
|
idRelaRedisDBIndex);
|
||||||
|
groupRegionVal = groupRegionVal.replace(
|
||||||
|
"OBSOLETE_RULE", "EFFECTIVE_RULE");
|
||||||
|
transaction.set(groupCompile.toUpperCase(),
|
||||||
|
groupRegionVal);
|
||||||
|
} else {// 将生效变为失效
|
||||||
|
String groupRegionVal = JedisUtils.get(
|
||||||
|
groupCompile.toUpperCase(),
|
||||||
|
idRelaRedisDBIndex);
|
||||||
|
groupRegionVal = groupRegionVal.replace(
|
||||||
|
"EFFECTIVE_RULE", "OBSOLETE_RULE");
|
||||||
|
transaction.set(groupCompile.toUpperCase(),
|
||||||
|
groupRegionVal);
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new ServiceRuntimeException("从"
|
throw new ServiceRuntimeException("从"
|
||||||
+ idRelaRedisDBIndex + "号redis库中删除"
|
+ idRelaRedisDBIndex + "号redis库中删除"
|
||||||
@@ -1423,7 +1748,21 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (isStart == null) {// 删除
|
||||||
transaction.del(compileStr.toUpperCase());// 删除编译与分组的关联关系
|
transaction.del(compileStr.toUpperCase());// 删除编译与分组的关联关系
|
||||||
|
} else if (isStart == true) {// 将失效置为生效
|
||||||
|
String groupRegionVal = JedisUtils.get(compileStr.toUpperCase(),
|
||||||
|
idRelaRedisDBIndex);
|
||||||
|
groupRegionVal = groupRegionVal.replace("OBSOLETE_RULE",
|
||||||
|
"EFFECTIVE_RULE");
|
||||||
|
transaction.set(compileStr.toUpperCase(), groupRegionVal);
|
||||||
|
} else {// 将生效变为失效
|
||||||
|
String groupRegionVal = JedisUtils.get(compileStr.toUpperCase(),
|
||||||
|
idRelaRedisDBIndex);
|
||||||
|
groupRegionVal = groupRegionVal.replace("EFFECTIVE_RULE",
|
||||||
|
"OBSOLETE_RULE");
|
||||||
|
transaction.set(compileStr.toUpperCase(), groupRegionVal);
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new ServiceRuntimeException(
|
throw new ServiceRuntimeException(
|
||||||
"从" + idRelaRedisDBIndex + "号redis关联关系库中删除" + compileStr
|
"从" + idRelaRedisDBIndex + "号redis关联关系库中删除" + compileStr
|
||||||
@@ -1950,13 +2289,13 @@ public class ConfigJedisServiceimpl implements ConfigRedisService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateMaatInfo(List<MaatXmlExpr> list, String maatKey, Transaction transaction, Double maatVersion,
|
private void updateMaatInfo(List<MaatXmlExpr> list, String maatKey, Transaction transaction, Double maatVersion,
|
||||||
int redisDBIndex, boolean idDel) {
|
int redisDBIndex, Boolean idDel) {
|
||||||
if (list != null && list.size() > 0) {
|
if (list != null && list.size() > 0) {
|
||||||
for (MaatXmlExpr maatXmlExpr : list) {
|
for (MaatXmlExpr maatXmlExpr : list) {
|
||||||
if (maatXmlExpr.getKeyExpression().toUpperCase().equals("MAAT_UPDATE_STATUS")) {
|
if (maatXmlExpr.getKeyExpression().toUpperCase().equals("MAAT_UPDATE_STATUS")) {
|
||||||
if (maatKey != null) {
|
if (maatKey != null) {
|
||||||
String zset = null;
|
String zset = null;
|
||||||
if (idDel) {
|
if (idDel == null || idDel) {
|
||||||
zset = maatKey.replace("OBSOLETE_RULE:", "DEL,");
|
zset = maatKey.replace("OBSOLETE_RULE:", "DEL,");
|
||||||
} else {
|
} else {
|
||||||
zset = maatKey.replace("EFFECTIVE_RULE:", "ADD,");
|
zset = maatKey.replace("EFFECTIVE_RULE:", "ADD,");
|
||||||
|
|||||||
@@ -79,6 +79,14 @@ public interface ConfigRedisService {
|
|||||||
* @return 成功返回true,失败返回false或抛出异常
|
* @return 成功返回true,失败返回false或抛出异常
|
||||||
*/
|
*/
|
||||||
public boolean delMaatConfig(Map<Integer, List<Long>> serviceConfigMap);
|
public boolean delMaatConfig(Map<Integer, List<Long>> serviceConfigMap);
|
||||||
|
/**
|
||||||
|
* 停启用maat类配置,key是业务类型,value是配置id集合
|
||||||
|
*
|
||||||
|
* @param serviceConfigMap
|
||||||
|
* @param isStart 是否置位生效,
|
||||||
|
* @return 成功返回true,失败返回false或抛出异常
|
||||||
|
*/
|
||||||
|
public boolean startStopMaatConfig(Map<Integer, List<Long>> serviceConfigMap, boolean isStart);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除分组复用的域配置
|
* 删除分组复用的域配置
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import com.google.gson.JsonObject;
|
|||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
import com.nis.domain.restful.CommonSourceFieldCfg;
|
import com.nis.domain.restful.CommonSourceFieldCfg;
|
||||||
import com.nis.domain.restful.ConfigCompile;
|
import com.nis.domain.restful.ConfigCompile;
|
||||||
|
import com.nis.domain.restful.ConfigCompileStartStop;
|
||||||
import com.nis.domain.restful.ConfigGroupRelation;
|
import com.nis.domain.restful.ConfigGroupRelation;
|
||||||
import com.nis.domain.restful.DigestRegion;
|
import com.nis.domain.restful.DigestRegion;
|
||||||
import com.nis.domain.restful.GroupReuse;
|
import com.nis.domain.restful.GroupReuse;
|
||||||
@@ -225,18 +226,55 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
List<Integer> dbIndexList = ServiceAndRDBIndexReal.getRedisDBByService(service);
|
List<Integer> dbIndexList = ServiceAndRDBIndexReal.getRedisDBByService(service);
|
||||||
if (!StringUtil.isEmpty(dbIndexList) && dbIndexList.size() > 0) {
|
if (!StringUtil.isEmpty(dbIndexList) && dbIndexList.size() > 0) {
|
||||||
for (Integer dbIndex : dbIndexList) {
|
for (Integer dbIndex : dbIndexList) {
|
||||||
|
|
||||||
// 分发到阀门有些业务需要添加编译属性到域配置
|
// 分发到阀门有些业务需要添加编译属性到域配置
|
||||||
List<MaatConfig> newMaatConfigList = new ArrayList<MaatConfig>();
|
List<MaatConfig> newMaatConfigList = new ArrayList<MaatConfig>();
|
||||||
newMaatConfigList.addAll(maatMap.get(service));
|
newMaatConfigList.addAll(maatMap.get(service));
|
||||||
if (dbIndex.intValue() == ServiceAndRDBIndexReal.getValveDBIndex().intValue()) {
|
if (dbIndex.intValue() == Constants.TAPREDISDB) {
|
||||||
Map<Integer, Map<String, String[]>> maatToValueMap = ServiceAndRDBIndexReal.getMaatToValveMap();
|
Map<Integer, Map<String, String[]>> maatToValueMap = ServiceAndRDBIndexReal.getMaatToValveMap();
|
||||||
|
addFieldToValveOrWebFocus(service, newMaatConfigList, maatToValueMap, false);
|
||||||
|
} else if (dbIndex.intValue() == Constants.WEBFOCUSREDISDB) {
|
||||||
|
Map<Integer, Map<String, String[]>> maatToWebFocusMap = ServiceAndRDBIndexReal
|
||||||
|
.getMaatToWebFocusMap();
|
||||||
|
addFieldToValveOrWebFocus(service, newMaatConfigList, maatToWebFocusMap, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (configMap.containsKey(dbIndex)) {
|
||||||
|
configMap.get(dbIndex).addAll(newMaatConfigList);
|
||||||
|
} else {
|
||||||
|
List<MaatConfig> list = new ArrayList<MaatConfig>();
|
||||||
|
list.addAll(newMaatConfigList);
|
||||||
|
configMap.put(dbIndex, list);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new ServiceRuntimeException(RestBusinessCode.ServiceNoFoundDBIndex.getErrorReason(),
|
||||||
|
RestBusinessCode.ServiceNoFoundDBIndex.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logger.info("---------------调用Redis maat配置新增接口---------------------");
|
||||||
|
configRedisService.saveMaatConfig(configMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加额外属性到阀门或者webfocus
|
||||||
|
*
|
||||||
|
* @param maatToValueMap
|
||||||
|
*/
|
||||||
|
private void addFieldToValveOrWebFocus(Integer service, List<MaatConfig> newMaatConfigList,
|
||||||
|
Map<Integer, Map<String, String[]>> maatToValueMap, Boolean isWebFocus) {
|
||||||
|
|
||||||
if (maatToValueMap.containsKey(service)) {
|
if (maatToValueMap.containsKey(service)) {
|
||||||
|
|
||||||
Map<String, String[]> regionAndFiledMap = maatToValueMap.get(service);
|
Map<String, String[]> regionAndFiledMap = maatToValueMap.get(service);
|
||||||
for (int i = 0; i < newMaatConfigList.size(); i++) {
|
for (int i = 0; i < newMaatConfigList.size(); i++) {
|
||||||
MaatConfig maatConfig = newMaatConfigList.get(i);
|
MaatConfig maatConfig = newMaatConfigList.get(i);
|
||||||
MaatConfig newMaatConfig = (MaatConfig) JsonMapper
|
if (isWebFocus && maatConfig.getGroupMapList().size() > 1) {// 如果当前配置需要向webfocus中入,但是groupsize大于1,此时就不入了,只有groupsize=1的时候入
|
||||||
.fromJsonString(JsonMapper.toJsonString(maatConfig), MaatConfig.class);
|
continue;
|
||||||
|
}
|
||||||
|
MaatConfig newMaatConfig = (MaatConfig) JsonMapper.fromJsonString(JsonMapper.toJsonString(maatConfig),
|
||||||
|
MaatConfig.class);
|
||||||
Iterator iterator = regionAndFiledMap.keySet().iterator();
|
Iterator iterator = regionAndFiledMap.keySet().iterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
String regionName = iterator.next().toString();
|
String regionName = iterator.next().toString();
|
||||||
@@ -252,8 +290,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
listMaps.addAll((List<Map<String, String>>) object);
|
listMaps.addAll((List<Map<String, String>>) object);
|
||||||
String[] fields = regionAndFiledMap.get(regionName);
|
String[] fields = regionAndFiledMap.get(regionName);
|
||||||
for (String fieldName : fields) {
|
for (String fieldName : fields) {
|
||||||
String value = newMaatConfig.getCompileMap()
|
String value = newMaatConfig.getCompileMap().get(fieldName.toLowerCase());
|
||||||
.get(fieldName.toLowerCase());
|
|
||||||
if (!StringUtil.isEmpty(value)) {
|
if (!StringUtil.isEmpty(value)) {
|
||||||
for (Map<String, String> map : listMaps) {
|
for (Map<String, String> map : listMaps) {
|
||||||
map.put(fieldName.toLowerCase(), value);
|
map.put(fieldName.toLowerCase(), value);
|
||||||
@@ -275,24 +312,6 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configMap.containsKey(dbIndex)) {
|
|
||||||
configMap.get(dbIndex).addAll(newMaatConfigList);
|
|
||||||
} else {
|
|
||||||
List<MaatConfig> list = new ArrayList<MaatConfig>();
|
|
||||||
list.addAll(newMaatConfigList);
|
|
||||||
configMap.put(dbIndex, list);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new ServiceRuntimeException(RestBusinessCode.ServiceNoFoundDBIndex.getErrorReason(),
|
|
||||||
RestBusinessCode.ServiceNoFoundDBIndex.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
logger.info("---------------调用Redis maat配置新增接口---------------------");
|
|
||||||
configRedisService.saveMaatConfig(configMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<String, String> convertObjectToMap(Object obj, Class clazz) throws Exception {
|
private Map<String, String> convertObjectToMap(Object obj, Class clazz) throws Exception {
|
||||||
Map<String, String> dstMap = new HashMap<String, String>();
|
Map<String, String> dstMap = new HashMap<String, String>();
|
||||||
Field[] fields = obj.getClass().getDeclaredFields();
|
Field[] fields = obj.getClass().getDeclaredFields();
|
||||||
@@ -318,15 +337,18 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateConfigSources(AuditLogThread thread, long start, List<ConfigCompile> compileList, Date opTime,
|
public void updateConfigSources(AuditLogThread thread, long start, List<ConfigCompile> compileList, Date opTime,
|
||||||
StringBuffer sb) throws Exception {
|
StringBuffer sb, boolean isConfigStartStop) throws Exception {
|
||||||
|
// 所有状态更新的配置isValid的值必须相同
|
||||||
|
Map<String, String> validIdMap = new HashMap<String, String>();
|
||||||
|
|
||||||
Map<Integer, List<Long>> compileMap = new HashMap<Integer, List<Long>>();
|
Map<Integer, List<Long>> compileMap = new HashMap<Integer, List<Long>>();
|
||||||
if (null != compileList && compileList.size() > 0) {
|
if (null != compileList && compileList.size() > 0) {
|
||||||
for (ConfigCompile config : compileList) {
|
for (ConfigCompile config : compileList) {
|
||||||
checkCompileOptForUpdate(config);
|
checkCompileOptForUpdate(config, isConfigStartStop);
|
||||||
|
validIdMap.put(config.getIsValid().toString(), config.getIsValid().toString());
|
||||||
if (config.getOpTime() == null) {
|
if (config.getOpTime() == null) {
|
||||||
config.setOpTime(opTime);
|
config.setOpTime(opTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
// compileAllList.add(config);
|
// compileAllList.add(config);
|
||||||
if (compileMap.containsKey(config.getService())) {
|
if (compileMap.containsKey(config.getService())) {
|
||||||
compileMap.get(config.getService()).add(config.getCompileId());
|
compileMap.get(config.getService()).add(config.getCompileId());
|
||||||
@@ -340,35 +362,30 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
} else {
|
} else {
|
||||||
throw new RestServiceException("编译配置不能为空" + sb.toString(), RestBusinessCode.CompileIsNull.getValue());
|
throw new RestServiceException("编译配置不能为空" + sb.toString(), RestBusinessCode.CompileIsNull.getValue());
|
||||||
}
|
}
|
||||||
// Map<DBIndex,Map<Service,List<CompileId>>
|
|
||||||
// Map<Integer, Map<Integer, List<Long>>> restMap = new HashMap<Integer,
|
if (validIdMap.size() > 1) {
|
||||||
// Map<Integer, List<Long>>>();
|
throw new RestServiceException(RestBusinessCode.IsValidNonUniq.getErrorReason(),
|
||||||
// Iterator serviceIterator = compileMap.keySet().iterator();
|
RestBusinessCode.IsValidNonUniq.getValue());
|
||||||
// while (serviceIterator.hasNext()) {
|
}
|
||||||
// Integer service = Integer.valueOf(serviceIterator.next().toString());
|
|
||||||
// List<Integer> dbIndexList =
|
if (!isConfigStartStop) {
|
||||||
// ServiceAndRDBIndexReal.getRedisDBByService(service);
|
|
||||||
// if (!StringUtil.isEmpty(dbIndexList) && dbIndexList.size() > 0) {
|
|
||||||
// for (Integer dbIndex : dbIndexList) {
|
|
||||||
// if (restMap.containsKey(dbIndex)) {
|
|
||||||
// restMap.get(dbIndex).put(service, compileMap.get(service));
|
|
||||||
// } else {
|
|
||||||
// Map<Integer, List<Long>> map = new HashMap<Integer, List<Long>>();
|
|
||||||
// map.put(service, compileMap.get(service));
|
|
||||||
// restMap.put(dbIndex, map);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// ServiceRuntimeException e = new ServiceRuntimeException("service值为" + service
|
|
||||||
// + ",与写入数据库序号映射关系不存在",
|
|
||||||
// RestBusinessCode.ServiceNoFoundDBIndex.getValue());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// 所有的都删除成功返回true
|
// 所有的都删除成功返回true
|
||||||
if (!configRedisService.delMaatConfig(compileMap)) {
|
if (!configRedisService.delMaatConfig(compileMap)) {
|
||||||
throw new ServiceRuntimeException("取消MAAT配置时出现异常,具体原因不详,请联系管理员",
|
throw new ServiceRuntimeException("取消MAAT配置时出现异常,具体原因不详,请联系管理员",
|
||||||
RestBusinessCode.service_runtime_error.getValue());
|
RestBusinessCode.service_runtime_error.getValue());
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
boolean isStart = true;// 置为生效
|
||||||
|
Integer isValid = compileList.get(0).getIsValid();
|
||||||
|
if (isValid == 0) {
|
||||||
|
isStart = false;// 置为失效
|
||||||
|
}
|
||||||
|
if (!configRedisService.startStopMaatConfig(compileMap, isStart)) {
|
||||||
|
throw new ServiceRuntimeException("停启用MAAT配置时出现异常,具体原因不详,请联系管理员",
|
||||||
|
RestBusinessCode.service_runtime_error.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String convertToTimeStamp16(Date date) {
|
private String convertToTimeStamp16(Date date) {
|
||||||
@@ -384,7 +401,7 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
* @param config
|
* @param config
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private void checkCompileOptForUpdate(ConfigCompile config) throws Exception {
|
private void checkCompileOptForUpdate(ConfigCompile config, boolean isConfigStartStop) throws Exception {
|
||||||
|
|
||||||
if (StringUtil.isEmpty(config.getCompileId())) {
|
if (StringUtil.isEmpty(config.getCompileId())) {
|
||||||
throw new RestServiceException(RestBusinessCode.CompileIdIsNull.getErrorReason(),
|
throw new RestServiceException(RestBusinessCode.CompileIdIsNull.getErrorReason(),
|
||||||
@@ -398,11 +415,14 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
throw new RestServiceException("编译配置id为" + config.getCompileId() + "的IsValid字段不能为空",
|
throw new RestServiceException("编译配置id为" + config.getCompileId() + "的IsValid字段不能为空",
|
||||||
RestBusinessCode.IsValidIsNull.getValue());
|
RestBusinessCode.IsValidIsNull.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isConfigStartStop) {
|
||||||
if (config.getIsValid() != 0) {
|
if (config.getIsValid() != 0) {
|
||||||
throw new RestServiceException("编译配置id为" + config.getCompileId() + "的配置在修改时不能为有效",
|
throw new RestServiceException("编译配置id为" + config.getCompileId() + "的配置在修改时不能为有效",
|
||||||
RestBusinessCode.IsValidIsF.getValue());
|
RestBusinessCode.IsValidIsF.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void saveCommonSources(AuditLogThread thread, long start, String jsonString) throws Exception {
|
public void saveCommonSources(AuditLogThread thread, long start, String jsonString) throws Exception {
|
||||||
JsonArray jsonObjectList = null;
|
JsonArray jsonObjectList = null;
|
||||||
@@ -874,7 +894,6 @@ public class ConfigSourcesService extends BaseService {
|
|||||||
list.add(maatConfig);
|
list.add(maatConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 调用接口入redis
|
// 调用接口入redis
|
||||||
logger.info("---------------调用Redis 分组复用配置新增接口---------------------");
|
logger.info("---------------调用Redis 分组复用配置新增接口---------------------");
|
||||||
configRedisService.saveGroupReuseConfig(list);
|
configRedisService.saveGroupReuseConfig(list);
|
||||||
|
|||||||
@@ -0,0 +1,228 @@
|
|||||||
|
package com.nis.web.service.restful;
|
||||||
|
|
||||||
|
import java.beans.PropertyDescriptor;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.nis.domain.Page;
|
||||||
|
import com.nis.domain.restful.NtcRadiusReport;
|
||||||
|
import com.nis.domain.restful.dashboard.TrafficTransStatistic;
|
||||||
|
import com.nis.web.dao.TrafficReportDao;
|
||||||
|
import com.nis.web.dao.dashboard.NtcTotalReportDao;
|
||||||
|
import com.nis.web.service.BaseLogService;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class TrafficReportService extends BaseLogService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
protected TrafficReportDao trafficReportDao;
|
||||||
|
|
||||||
|
|
||||||
|
public Page<NtcRadiusReport> findNtcRadiusReport(Page page,NtcRadiusReport entity) throws Exception {
|
||||||
|
entity.setPage(page);
|
||||||
|
List resultList = null;
|
||||||
|
if ("1".equals(entity.getSearchBusinessType())) {
|
||||||
|
resultList = new ArrayList<Map>();
|
||||||
|
Map<String, List<NtcRadiusReport>> restMap = new HashMap<String, List<NtcRadiusReport>>();
|
||||||
|
List<NtcRadiusReport> accountList = trafficReportDao.findAccounList(entity);
|
||||||
|
restMap.put("accountList", accountList);
|
||||||
|
List<NtcRadiusReport> nasIpList = trafficReportDao.findNasIpList(entity);
|
||||||
|
restMap.put("nasIpList", nasIpList);
|
||||||
|
resultList.add(restMap);
|
||||||
|
} else {
|
||||||
|
resultList = new ArrayList<NtcRadiusReport>();
|
||||||
|
List<NtcRadiusReport> list = trafficReportDao.findNtcRadiusReport(entity);
|
||||||
|
|
||||||
|
String regionName = "nasIp";
|
||||||
|
if ("3".equals(entity.getSearchBusinessType())) {
|
||||||
|
regionName = "account";
|
||||||
|
}
|
||||||
|
PropertyDescriptor pd = new PropertyDescriptor(regionName, NtcRadiusReport.class);
|
||||||
|
Method method = pd.getReadMethod();
|
||||||
|
NtcRadiusReport temp = null;
|
||||||
|
Object tempVal = null;
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
if (i > 0) {
|
||||||
|
NtcRadiusReport obj = list.get(i);
|
||||||
|
Object objVal = method.invoke(obj);
|
||||||
|
if (objVal != null && tempVal != null && !objVal.toString().equals(tempVal.toString())) {
|
||||||
|
temp = obj;
|
||||||
|
tempVal = method.invoke(temp);
|
||||||
|
resultList.add(obj);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
temp = list.get(i);
|
||||||
|
tempVal = method.invoke(temp);
|
||||||
|
resultList.add(list.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
page.setList(resultList);
|
||||||
|
return page;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ip46,协议tcp,udp查询带宽
|
||||||
|
*
|
||||||
|
* @param addrType
|
||||||
|
* @param transType
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<HashMap> getBandwidthTrans(String addrType, Integer transType, String beginDate, String endDate) {
|
||||||
|
ArrayList<HashMap> listMap = new ArrayList<HashMap>();
|
||||||
|
|
||||||
|
HashMap m1 = getBandwidthTransEntrance(addrType, transType, beginDate, endDate, 1);
|
||||||
|
if (m1 != null && m1.size() > 0) {
|
||||||
|
m1.put("entranceId", 1);// 局点1.2 不同来源
|
||||||
|
listMap.add(m1);
|
||||||
|
}
|
||||||
|
return listMap;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ip46,协议tcp,udp查询带宽
|
||||||
|
*
|
||||||
|
* @param addrType
|
||||||
|
* @param transType
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<HashMap> getBandwidthTrans2(String addrType, Integer transType, String beginDate, String endDate) {
|
||||||
|
ArrayList<HashMap> listMap = new ArrayList<HashMap>();
|
||||||
|
|
||||||
|
HashMap m2 = getBandwidthTransEntrance(addrType, transType, beginDate, endDate, 2);
|
||||||
|
if (m2 != null && m2.size() > 0) {
|
||||||
|
m2.put("entranceId", 2);
|
||||||
|
listMap.add(m2);
|
||||||
|
}
|
||||||
|
return listMap;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询单个局点流量的数据信息
|
||||||
|
*
|
||||||
|
* @param addrType
|
||||||
|
* @param transType
|
||||||
|
* @param beginDate
|
||||||
|
* @param endDate
|
||||||
|
* @param entranceId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public HashMap getBandwidthTransEntrance(String addrType, Integer transType, String beginDate, String endDate,
|
||||||
|
Integer entranceId) {
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
ArrayList<HashMap> listMap = new ArrayList<HashMap>();
|
||||||
|
List<TrafficTransStatistic> bandwidthList = new ArrayList<TrafficTransStatistic>();
|
||||||
|
HashMap resulMap = new HashMap();
|
||||||
|
bandwidthList = trafficReportDao.getBandwidthTrans(entranceId, beginDate, endDate, addrType, transType);
|
||||||
|
List timeList = new ArrayList();
|
||||||
|
List linkList = new ArrayList();
|
||||||
|
List gbpsList = new ArrayList();
|
||||||
|
List ppsList = new ArrayList();
|
||||||
|
if (bandwidthList != null && bandwidthList.size() > 0) {
|
||||||
|
Map<String, Comparable> m = new HashMap<String, Comparable>();
|
||||||
|
int inter = 1000 * 60 * 5;// 间隔时间为五分钟
|
||||||
|
// 开始时间,结束时间 时间戳
|
||||||
|
Long b = dateToStamp(beginDate);
|
||||||
|
Long e = dateToStamp(endDate);
|
||||||
|
int num = 0;
|
||||||
|
Long pointTime = b;
|
||||||
|
while (pointTime < e) {
|
||||||
|
Map rm = new HashMap();
|
||||||
|
Long sumL = 0l;
|
||||||
|
Long sumP = 0l;
|
||||||
|
Long sumG = 0l;
|
||||||
|
if (pointTime >= e) {
|
||||||
|
break; // 停止
|
||||||
|
}
|
||||||
|
for (TrafficTransStatistic tt : bandwidthList) {
|
||||||
|
// 实际时间
|
||||||
|
String time = tt.getTime();
|
||||||
|
Long t = dateToStamp(time);
|
||||||
|
if (t >= pointTime && t < pointTime + inter) {
|
||||||
|
// 范围之内分到此pointTime组
|
||||||
|
sumL = sumL + tt.getLinkNum();
|
||||||
|
sumP = sumP + tt.getPps();
|
||||||
|
sumG = sumG + tt.getGbps();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 在结束时间只有当值大于0时才记录数据,防止折线降为0引起误会
|
||||||
|
if (pointTime >= e - inter && sumL > 0) {
|
||||||
|
linkList.add(sumL);
|
||||||
|
}
|
||||||
|
if (pointTime >= e - inter && sumP > 0) {
|
||||||
|
ppsList.add(sumP);
|
||||||
|
}
|
||||||
|
if (pointTime >= e - inter && sumG > 0) {
|
||||||
|
gbpsList.add(sumG);
|
||||||
|
}
|
||||||
|
if (pointTime >= e - inter && (sumL > 0 || sumG > 0 || sumP > 0)) {
|
||||||
|
timeList.add(stampToDate(pointTime));
|
||||||
|
}
|
||||||
|
if (pointTime < e - inter) {
|
||||||
|
timeList.add(stampToDate(pointTime));
|
||||||
|
linkList.add(sumL);
|
||||||
|
gbpsList.add(sumG);
|
||||||
|
ppsList.add(sumP);
|
||||||
|
}
|
||||||
|
|
||||||
|
num = num + 1;
|
||||||
|
pointTime = b + inter * num;
|
||||||
|
}
|
||||||
|
resulMap.put("linkNum", linkList);
|
||||||
|
resulMap.put("gbps", gbpsList);
|
||||||
|
resulMap.put("pps", ppsList);
|
||||||
|
resulMap.put("statTime", timeList);
|
||||||
|
}
|
||||||
|
return resulMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间戳 换成日期格式字符串转
|
||||||
|
*
|
||||||
|
* @param 时间 1544602212000
|
||||||
|
* @param format 如:yyyy-MM-dd HH:mm:ss
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String stampToDate(long timeStamp) {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("MM-dd HH:mm");// 这个是你要转成后的时间的格式
|
||||||
|
String sd = sdf.format(new Date(timeStamp)); // 时间戳转换成时间
|
||||||
|
return sd;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期格式字符串转换成时间戳
|
||||||
|
*
|
||||||
|
* @param date 字符串日期
|
||||||
|
* @param format 如:yyyy-MM-dd HH:mm:ss
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Long dateToStamp(String date_str) {
|
||||||
|
try {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
return sdf.parse(date_str).getTime();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return 0l;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -72,7 +72,7 @@ public class SyncRedisToCluster {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "${syncRedisToClusterCron}")
|
// @Scheduled(cron = "${syncRedisToClusterCron}")
|
||||||
public void syncRedisToCluster() {
|
public void syncRedisToCluster() {
|
||||||
JedisCluster jedisCluster = getResource();
|
JedisCluster jedisCluster = getResource();
|
||||||
String requestId = UUID.randomUUID().toString();
|
String requestId = UUID.randomUUID().toString();
|
||||||
|
|||||||
@@ -338,11 +338,11 @@ unMaatService=3:32;4:96;25:32;28:32;64;65;261:16;262:16;263:16;264:16;265:16;266
|
|||||||
#0x05 DDOS流量丢弃 5:2,5;
|
#0x05 DDOS流量丢弃 5:2,5;
|
||||||
#0x21 APP阻断 33:2,5;
|
#0x21 APP阻断 33:2,5;
|
||||||
#0x200 PXY拦截IP 512:4,5;
|
#0x200 PXY拦截IP 512:4,5;
|
||||||
#0x201 PXY拦截域名 513:4,2,5;
|
#0x201 PXY拦截域名 513:4,2,5,7;
|
||||||
#0x402 APP DOMAIN特征发现 1026:2,5;
|
#0x402 APP DOMAIN特征发现 1026:2,5;
|
||||||
#0x404 APP IP特征 1028:2,5;
|
#0x404 APP IP特征 1028:2,5;
|
||||||
##########
|
##########
|
||||||
serviceDBIndex=1:2,4,5;2:2,4,5;5:2,5;6:2,5;66:2,4,5;16:2;17:2;18:2;19:2;20:2;21:2;22:2;23:2;24:2;26:2;27:2;30:2;31:2;32:2;33:2,5;34:2;35:2;36:2;37:2;38:2;39:2;40:2;128:2;129:2;130:2;131:2;132:2;133:2;134:2;135:2;136:2;137:2;138:2;139:2;140:2;142:2;143:2;144:2;145:2;146:2;147:2;148:2;149:2;150:2;151:2;152:2;256:2;257:2;258:2;259:2;260:2;267:2;271:2;272:2;273:3;274:5;384:2;385:2;386:2;387:2;388:2;395:2;399:3;512:4,5;513:4,2,5;514:4,5;515:4,2,5;517:4,5;518:4,5;520:4;521:4;528:4;544:4;560:4;576:4;592:4;608:4;624:4;625:4;640:4;641:4;642:4;750:4;1024:2;1025:2;1026:2,5;1027:2;1028:2,5;1029:2;1030:2;1040:2,5;1041:2;1042:2;1056:2,5;1152:2;3:5;4:5;25:5;28:5;64:2;65:2;261:3;262:3;263:3;264:3;265:3;266:3;268:3;269:3;270:3;389:3;390:3;391:3;392:3;393:3;394:3;396:3;397:3;398:3;834:6;835:6;836:6
|
serviceDBIndex=1:2,4,5;2:2,4,5;5:2,5;6:2,5;66:2,4,5;16:2;17:2;18:2;19:2;20:2;21:2;22:2;23:2;24:2;26:2;27:2;30:2;31:2;32:2;33:2,5;34:2;35:2;36:2;37:2;38:2;39:2;40:2;128:2;129:2;130:2;131:2;132:2;133:2;134:2;135:2;136:2;137:2;138:2;139:2;140:2;142:2;143:2;144:2;145:2;146:2;147:2;148:2;149:2;150:2;151:2;152:2;256:2;257:2;258:2;259:2;260:2;267:2;271:2;272:2;273:3;274:5;384:2;385:2;386:2;387:2;388:2;395:2;399:3;512:4,5;513:4,2,5,7;514:4,5;515:4,2,5,7;517:4,5;518:4,5;520:4;521:4;528:4;544:4;560:4;576:4;592:4;608:4;624:4;625:4;640:4;641:4;642:4;750:4;1024:2;1025:2;1026:2,5;1027:2;1028:2,5;1029:2;1030:2;1040:2,5;1041:2;1042:2;1056:2,5;1152:2;3:5;4:5;25:5;28:5;64:2;65:2;261:3;262:3;263:3;264:3;265:3;266:3;268:3;269:3;270:3;389:3;390:3;391:3;392:3;393:3;394:3;396:3;397:3;398:3;834:6;835:6;836:6
|
||||||
|
|
||||||
##阀门配置在redisdb的序号
|
##阀门配置在redisdb的序号
|
||||||
tapRedisDb=5
|
tapRedisDb=5
|
||||||
@@ -360,6 +360,13 @@ tapRedisDb=5
|
|||||||
#0x404 APP IP特征 1028
|
#0x404 APP IP特征 1028
|
||||||
maat2Valve=1:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;2:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;33:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;512:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;513:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;514:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;515:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;517:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;518:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1026:strRegion|strStrRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1028:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1040:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1056:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;5:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE&COMPILE_ID;6:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE&COMPILE_ID
|
maat2Valve=1:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;2:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;33:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;512:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;513:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;514:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;515:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;517:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;518:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1026:strRegion|strStrRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1028:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1040:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;1056:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;5:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE&COMPILE_ID;6:ipRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE&COMPILE_ID
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##webfocus配置在redisdb的序号
|
||||||
|
webFocusDb=7
|
||||||
|
maat2WebFocus=513:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;515:strRegion@ACTION&SERVICE&USER_REGION&EFFECTIVE_RANGE;
|
||||||
|
|
||||||
|
|
||||||
##记录哪些service可以被分组复用(只有maat类配置可以被分组复用)
|
##记录哪些service可以被分组复用(只有maat类配置可以被分组复用)
|
||||||
#业务ID:域类型1@表名,表名|域类型2@表名;业务ID:域类型1@表名,表名|域类型2@表名
|
#业务ID:域类型1@表名,表名|域类型2@表名;业务ID:域类型1@表名,表名|域类型2@表名
|
||||||
##域类型:IP域 =ipRegion 字符串域=strRegion 数值域=numRegion
|
##域类型:IP域 =ipRegion 字符串域=strRegion 数值域=numRegion
|
||||||
|
|||||||
@@ -244,12 +244,11 @@
|
|||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<bean id="dynamicDataSource" class="com.nis.datasource.DynamicDataSource">
|
<bean id="dynamicDataSource" class="com.nis.datasource.DynamicDataSource">
|
||||||
<property name="targetDataSources">
|
<property name="targetDataSources">
|
||||||
<map key-type="java.lang.String">
|
<map key-type="java.lang.String">
|
||||||
<entry value-ref="ProductDataSource" key="dataSourceA"></entry>
|
<entry value-ref="ProductDataSource" key="dataSourceA"></entry>
|
||||||
|
<entry value-ref="LocalClickHouseDataSourceByDruid" key="dataSourceB"></entry>
|
||||||
</map>
|
</map>
|
||||||
</property>
|
</property>
|
||||||
<property name="defaultTargetDataSource" ref="ProductDataSource"></property>
|
<property name="defaultTargetDataSource" ref="ProductDataSource"></property>
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ isOpenLogCountAndLast=true
|
|||||||
#redis分布式锁超时时间,默认五分钟,3000秒
|
#redis分布式锁超时时间,默认五分钟,3000秒
|
||||||
redisLockTime=3000
|
redisLockTime=3000
|
||||||
#获取redis分布式锁失败后的尝试获取锁的次数,每次失败暂停一秒钟后再次尝试
|
#获取redis分布式锁失败后的尝试获取锁的次数,每次失败暂停一秒钟后再次尝试
|
||||||
redisRetryNum=5
|
redisRetryNum=500
|
||||||
#ip定位库的地址
|
#ip定位库的地址
|
||||||
#ipLocationLibraryPath=/usr/local/ipLocalLibraay/Kazakhstan.mmdb
|
#ipLocationLibraryPath=/usr/local/ipLocalLibraay/Kazakhstan.mmdb
|
||||||
ipLocationLibraryPath=C:\\ipLocation\\Kazakhstan.mmdb
|
ipLocationLibraryPath=C:\\ipLocation\\Kazakhstan.mmdb
|
||||||
|
|||||||
@@ -216,11 +216,10 @@
|
|||||||
</mvc:interceptor>
|
</mvc:interceptor>
|
||||||
|
|
||||||
<!-- 日志数据源拦截器,该拦截路径下使用数据源C -->
|
<!-- 日志数据源拦截器,该拦截路径下使用数据源C -->
|
||||||
<!-- <mvc:interceptor> -->
|
<mvc:interceptor>
|
||||||
<!-- <mvc:mapping path="/service/log/**" /> -->
|
<mvc:mapping path="/service/ckLog/**" />
|
||||||
<!-- <mvc:mapping path="/log/**"/> -->
|
<bean class="com.nis.interceptor.DataSourceBInterceptor"></bean>
|
||||||
<!-- <bean class="com.nis.interceptor.DataSourceCInterceptor"></bean> -->
|
</mvc:interceptor>
|
||||||
<!-- </mvc:interceptor> -->
|
|
||||||
|
|
||||||
<!-- 数据源拦截器,该拦截路径下使用数据源B -->
|
<!-- 数据源拦截器,该拦截路径下使用数据源B -->
|
||||||
<mvc:interceptor>
|
<mvc:interceptor>
|
||||||
|
|||||||
Reference in New Issue
Block a user