1:更新642的表达式结构,及添加opTime字段

2:为0x401  APP载荷特征表添加数值类表APP_TCP_SESSION_BYTE
3:更新urlreport接口
4:更新asnreport接口
5:添加iprange统计入库
6:修改配置入库时,先打印错误信息在回滚事务
7:修改配置入库打印的日志信息
8:更改通联关系app_label的数据类型为varchar
9:提交洪庆发来的trafficIpActiveStatisticDao.xml
This commit is contained in:
renkaige
2018-12-17 22:48:15 +06:00
parent 60a85266de
commit 9f8fb67584
23 changed files with 392 additions and 694 deletions

View File

@@ -1517,7 +1517,7 @@
<result column="inner_dmac" jdbcType="VARCHAR" property="innerDmac" />
<result column="app_label" jdbcType="BIGINT" property="appLabel" />
<result column="app_label" jdbcType="VARCHAR" property="appLabel" />
<result column="c2s_pkt_num" jdbcType="VARCHAR" property="c2sPktNum" />
<result column="s2c_pkt_num" jdbcType="VARCHAR" property="s2cPktNum" />
<result column="c2s_byte_num" jdbcType="VARCHAR" property="c2sByteNum" />

View File

@@ -6,14 +6,13 @@ 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.NtcIpURLReport;
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.NtcURLReport;
import com.nis.domain.restful.NtcURLIpReport;
/**
*
@@ -26,18 +25,32 @@ import com.nis.domain.restful.NtcURLReport;
@MyBatisDao
public interface NtcReportDao 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<NtcIpURLReport> findNtcIpURLReport(NtcURLReport 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();
}

View File

@@ -71,11 +71,12 @@
property="reportTime" />
</resultMap>
<resultMap id="NtcIpURLReportMap"
type="com.nis.domain.restful.NtcIpURLReport">
<resultMap id="NtcURLIpReportMap"
type="com.nis.domain.restful.NtcURLIpReport">
<result column="url" jdbcType="VARCHAR" property="url" />
<result column="SUM" jdbcType="BIGINT" property="sum" />
<result column="ip_addr" jdbcType="VARCHAR" property="ipAddr" />
<result column="ipCount" jdbcType="BIGINT" property="ipCount" />
<result column="connCount" jdbcType="BIGINT" property="connCount" />
<result column="reportTime" jdbcType="TIMESTAMP" property="reportTime" />
</resultMap>
<resultMap id="NtcRadiusReportMap"
@@ -744,8 +745,8 @@
</select>
<select id="findNtcIpURLReport"
parameterType="com.nis.domain.restful.NtcURLReport"
resultMap="NtcIpURLReportMap">
parameterType="com.nis.domain.restful.NtcURLIpReport"
resultMap="NtcURLIpReportMap">
SELECT
<choose>
<when
@@ -753,10 +754,13 @@
${page.fields}
</when>
<otherwise>
url, ip_addr,SUM
url, ipCount,connCount,reportTime
</otherwise>
</choose>
FROM (SELECT url, SUM(SUM) SUM ,ip_addr
FROM (SELECT url,
count(distinct ip_addr) ipCount,
sum(sum) connCount,
stat_time reportTime
FROM ntc_reject_url_statistic
<where>
@@ -772,7 +776,7 @@
AND url = #{searchUrl}
</if>
</where>
GROUP BY url,ip_addr
GROUP BY url,stat_time
) ntc_reject_url_statistic
<choose>
<when
@@ -853,7 +857,8 @@
parameterType="com.nis.domain.restful.NtcIpRangeReport"
resultMap="NtcIpRangeReportMap">
SELECT ip_start,ip_end,ip_start_num,ip_end_num,ip_sub
FROM traffic_ip_identify
FROM
traffic_ip_identify
<where>
<if test="searchType != null and searchType !=''">
<![CDATA[AND areaType = #{searchType}]]>
@@ -864,4 +869,21 @@
</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>
</mapper>

View File

@@ -50,7 +50,7 @@
<select id="ipActiveFiveMinute" resultMap="BaseResultMap">
select SUM(c2s_byte_len+s2c_byte_len) count ,stat_time time from traffic_ip_active_statistic
WHERE ip_addr=#{ipAddr} and
<![CDATA[ stat_time> #{beginDate} and stat_time<=#{endDate}]]>
<![CDATA[ stat_time> #{beginDate} and stat_time<=#{endDate} GROUP BY stat_time]]>
</select>
<!-- IP流量统计一小时-->
<select id="ipActiveOneHour" resultType="java.util.HashMap">

View File

@@ -191,8 +191,7 @@ public class LocalLogJDBCByDruid {
String pps = rs.getString("pps");
ntcAsnRecord.setBps(subStr(bps));
ntcAsnRecord.setPps(subStr(pps));
ntcAsnRecord.setdAsn(rs.getString("d_asn"));
ntcAsnRecord.setsAsn(rs.getString("s_asn"));
ntcAsnRecord.setAsn(rs.getString("asn"));
list.add(ntcAsnRecord);
}
logger.info("执行日志查询语句成功,sql={}", sql);
@@ -202,10 +201,11 @@ public class LocalLogJDBCByDruid {
return list;
}
public List<String> getAllIp(String frontier) throws Exception {
public List<String> getAllIp(Integer frontier) throws Exception {
List<String> list = new LinkedList<>();
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 ip like '145%' and frontier='"+frontier+"'";
String sql = "select distinct ip from ip_location_database_local where frontier='"+frontier+"'";
conn = getConnection();
logger.info("连接数据中心日志库成功--------------------------");
st = conn.createStatement();