This commit is contained in:
wangwenrui
2018-12-18 00:38:26 +08:00
20 changed files with 1810 additions and 877 deletions

View File

@@ -5,6 +5,7 @@ import java.util.List;
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;
@@ -36,4 +37,7 @@ public interface NtcReportDao extends CrudDao {
List<NtcRadiusReport> findAccounList(NtcRadiusReport pz);
List<NtcRadiusReport> findNasIpList(NtcRadiusReport pz);
List<NtcRadiusReport> findNtcRadiusReport(NtcRadiusReport pz);
List<NtcIpRangeReport> findNtcIpRangeReport(NtcIpRangeReport pz);
}

View File

@@ -87,6 +87,19 @@
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" />
</resultMap>
<sql id="commonPorperty">
SERVICE,SUM,REPORT_TIME
</sql>
@@ -835,4 +848,20 @@
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
FROM traffic_ip_identify
<where>
<if test="searchType != null and searchType !=''">
<![CDATA[AND areaType = #{searchType}]]>
</if>
<if test="searchCountry != null and searchCountry !=''">
<![CDATA[AND country= #{searchCountry ]]>
</if>
</where>
</select>
</mapper>

View File

@@ -72,7 +72,7 @@
<!-- 获取近一小时的带宽根据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<=#{endDate} and stat_time>=#{beginDate}]]>
where <![CDATA[stat_time>=#{beginDate} and stat_time<=#{endDate} ]]>
<if test="addrType != null">
and addr_type=#{addrType}
</if>

View File

@@ -18,19 +18,13 @@ public interface TrafficHttpStatisticDao {
// 获取域名分类之后属于的网站
List<Map> getDomainByWebsiteList(@Param("statTime") Date statTime, @Param("endTime") Date endTime);
List<Map> preWebsiteListCount(@Param("statTime") Date statTime, @Param("endTime") Date endTime);
List<Map> getDomainByWebsiteServiceId(@Param("webIdList") List webIdList,@Param("statTime") Date statTime, @Param("endTime") Date endTime);
Map websiteDomainOthers(@Param("webIdList") List webIdList, @Param("statTime") Date statTime,
@Param("endTime") Date endTime);
List<Map> getDomainByTopicList(@Param("statTime") Date statTime, @Param("endTime") Date endTime);
List<Map> getDomainByTopicId(@Param("statTime") Date statTime, @Param("endTime") Date endTime);
List<Map> getHttpStatisticNoLinkAndPkt(@Param("statTime") Date statTime, @Param("endTime") Date endTime);
List<Map> getTrafficHttpStatistic(@Param("statTime") Date statTime, @Param("endTime") Date endTime);
List getIdByWebSiteId(@Param("websiteId") Integer websiteId);
List<Map> getDomainList(@Param("beginDate")Date beginDate, @Param("endDate") Date endDate);
}

View File

@@ -59,10 +59,19 @@
</select>
<!--获取上个时间段该网站站域名流量的数据量 -->
<select id="preWebsiteListCount" resultType="java.util.HashMap">
select web_id webId,SUM(c2s_byte_len + s2c_byte_len) count from
<select id="getHttpStatisticNoLinkAndPkt" resultType="java.util.HashMap">
select web_id webId,
SUM(c2s_byte_len + s2c_byte_len) byteCount from
traffic_http_statistic t where
<![CDATA[ stat_time>= #{statTime} and stat_time< #{endTime} group by t.web_id ]]>
</select>
<select id="getTrafficHttpStatistic" resultType="java.util.HashMap">
select web_id webId,
SUM(c2s_byte_len + s2c_byte_len) byteCount,
sum(c2s_pkt_num + s2c_pkt_num) pktCount,
link_num linkNum from
traffic_http_statistic t where
<![CDATA[ stat_time>= #{statTime} and stat_time< #{endTime} group by t.web_id,link_num]]>
</select>
@@ -96,23 +105,6 @@ FROM
SELECT
distinct id FROM ui_website_domain_topic where website_service_id= #{websiteId}
</select>
<!-- 根据主题分组获取子域名 -->
<select id="getDomainByTopicId" resultType="java.util.HashMap">
select web_id webId,link_num linkNum,SUM(c2s_pkt_num+s2c_pkt_num) packets,sum(c2s_byte_len + s2c_byte_len) count from
traffic_http_statistic t where
<![CDATA[ stat_time>= #{statTime} and stat_time< #{endTime} group by t.web_id]]>
</select>
<!-- 获取域名列表 -->
<select id="getDomainList" resultType="java.util.HashMap">
select web_id webId,link_num linkNum,SUM(c2s_pkt_num+s2c_pkt_num) packets,sum(c2s_byte_len + s2c_byte_len) count from
traffic_http_statistic t where
<![CDATA[ stat_time>= #{beginDate} and stat_time< #{endDate} group by t.web_id order by count]]>
</select>
<!-- 指定网站下的TOP10之外为others -->
<select id="websiteDomainOthers" resultType="java.util.HashMap">

View File

@@ -202,6 +202,29 @@ public class LocalLogJDBCByDruid {
return list;
}
public List<String> getAllIp(String 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+"'";
conn = getConnection();
logger.info("连接数据中心日志库成功--------------------------");
st = conn.createStatement();
logger.info("开始执行日志查询语句sql={}", sql);
rs = st.executeQuery(sql);
num.setMinimumFractionDigits(2);// 保留两位小数
while (rs.next()) {
String bps = rs.getString("ip");
if(bps!=null&&!bps.trim().equals("")) {
list.add(bps);
}
}
logger.info("执行日志查询语句成功,sql={}", sql);
} finally {
closeConn();
}
return list;
}
/**
* 截取字符串后两位
*