1:修改线上配置文件applicationContext-redis.xml.astana中哨兵的名称masterName,及jdbc中mysql的地址
2:修改ip范围统计的sql,及解决ip范围统计使用linkedlist速度很慢的原因 3:新增asn统计接口(ntcAsnRecord)从mysql查询,老的接口(从clickhouse中查询)改为ntcAsnRecordold
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package com.nis.web.dao.dashboard;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.nis.domain.restful.dashboard.TrafficAsnStatistic;
|
||||
import com.nis.web.dao.MyBatisDao;
|
||||
|
||||
@MyBatisDao
|
||||
public interface TrafficAsnStatisticDao {
|
||||
|
||||
List<TrafficAsnStatistic> getTrafficAsnStatisticList(TrafficAsnStatistic trafficAsnStatistic);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?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.dashboard.TrafficAsnStatisticDao">
|
||||
<resultMap id="BaseResultMap"
|
||||
type="com.nis.domain.restful.dashboard.TrafficAsnStatistic">
|
||||
<id column="bps" jdbcType="VARCHAR" property="bps" />
|
||||
<result column="pps" jdbcType="VARCHAR" property="pps" />
|
||||
<result column="asn" jdbcType="VARCHAR" property="asn" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="getTrafficAsnStatisticList"
|
||||
parameterType="com.nis.domain.restful.dashboard.TrafficAsnStatistic"
|
||||
resultMap="BaseResultMap">
|
||||
SELECT
|
||||
TRUNCATE(packets / 3600 ,0)AS pps,
|
||||
TRUNCATE(bytes * 8 / 1024 / 1024 / 1024 / 3600,2) AS bps,asn
|
||||
FROM
|
||||
traffic_asn_statistic t
|
||||
WHERE
|
||||
<![CDATA[
|
||||
stat_time>=#{searchFoundStartTime} and stat_time<#{searchFoundEndTime} ]]>
|
||||
<if test="searchAsnType !=null and searchAsnType != ''">
|
||||
<![CDATA[and asn_type=#{searchAsnType}]]>
|
||||
</if>
|
||||
ORDER BY
|
||||
bps DESC,
|
||||
pps DESC
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -26,10 +26,9 @@ import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.restful.NtcAsnRecord;
|
||||
import com.nis.domain.restful.NtcConnRecordPercent;
|
||||
import com.nis.domain.restful.dashboard.TrafficAsnStatistic;
|
||||
import com.nis.web.service.SpringContextHolder;
|
||||
import com.zdjizhi.utils.CommonUtil;
|
||||
import com.zdjizhi.utils.StringUtil;
|
||||
|
||||
/**
|
||||
@@ -181,8 +180,8 @@ public class LocalLogJDBCByDruid {
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<NtcAsnRecord> getNtcAsnRecordData(String sql) throws Exception {
|
||||
List<NtcAsnRecord> list = new LinkedList<>();
|
||||
public List<TrafficAsnStatistic> getNtcAsnRecordData(String sql) throws Exception {
|
||||
List<TrafficAsnStatistic> list = new LinkedList<>();
|
||||
try {
|
||||
conn = getConnection();
|
||||
logger.info("连接数据中心日志库成功--------------------------");
|
||||
@@ -191,7 +190,7 @@ public class LocalLogJDBCByDruid {
|
||||
rs = st.executeQuery(sql);
|
||||
num.setMinimumFractionDigits(2);// 保留两位小数
|
||||
while (rs.next()) {
|
||||
NtcAsnRecord ntcAsnRecord = new NtcAsnRecord();
|
||||
TrafficAsnStatistic ntcAsnRecord = new TrafficAsnStatistic();
|
||||
String bps = rs.getString("bps");
|
||||
String pps = rs.getString("pps");
|
||||
String ppsNum =pps;
|
||||
@@ -212,10 +211,10 @@ public class LocalLogJDBCByDruid {
|
||||
}
|
||||
|
||||
public List<String> getAllIp(Integer frontier) throws Exception {
|
||||
List<String> list = new LinkedList<>();
|
||||
List<String> list = new ArrayList<>();
|
||||
try {
|
||||
// String sql = "select distinct ip from ip_location_database_local where ip like '145%' and frontier='"+frontier+"'";
|
||||
String sql = "select distinct ip from ip_location_database_local where frontier='"+frontier+"'";
|
||||
String sql = "select distinct ip from (select ip,frontier from ip_location_database ) where frontier='"+frontier+"'";
|
||||
conn = getConnection();
|
||||
logger.info("连接数据中心日志库成功--------------------------");
|
||||
st = conn.createStatement();
|
||||
|
||||
Reference in New Issue
Block a user