1:为通联关系查询添加asn的条件

2:修改traffic的查询bug
This commit is contained in:
renkaige
2018-12-18 06:46:27 +06:00
parent bfefa4af32
commit baf0a08058
4 changed files with 51 additions and 23 deletions

View File

@@ -21,6 +21,9 @@ public class NtcAsnRecord implements Serializable {
private String bps;
private String pps;
private String asn;
private String searchAsn;
private String searchFoundStartTime;// 开始发现时间
private String searchFoundEndTime;// 结束发现时间
@@ -50,6 +53,15 @@ public class NtcAsnRecord implements Serializable {
this.asn = asn;
}
@JsonIgnore
public String getSearchAsn() {
return searchAsn;
}
public void setSearchAsn(String searchAsn) {
this.searchAsn = searchAsn;
}
@JsonIgnore
public String getSearchAsnType() {
return searchAsnType;

View File

@@ -75,7 +75,8 @@
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" />
<result column="connCount" jdbcType="BIGINT"
property="connCount" />
</resultMap>
<resultMap id="NtcRadiusReportMap"
@@ -97,7 +98,8 @@
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="area_type" jdbcType="VARCHAR"
property="areaType" />
<result column="desc_detail" jdbcType="VARCHAR" property="desc" />
</resultMap>
@@ -850,7 +852,8 @@
<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
SELECT
ip_start,ip_end,ip_start_num,ip_end_num,ip_sub,country,area_type,desc_detail
FROM
traffic_ip_identify
<where>
@@ -861,7 +864,7 @@
<![CDATA[AND country= #{searchCountry} ]]>
</if>
<if test="searchIp != null and searchIp !=''">
<![CDATA[AND ip_start_num>= #{searchIp} and ip_end_num<=#{searchIp}]]>
<![CDATA[AND ip_end_num>=#{searchIp} and ip_start_num<= #{searchIp} ]]>
</if>
<if test="searchDesc != null and searchDesc !=''">
<![CDATA[AND desc_detail= #{searchDesc} ]]>
@@ -877,7 +880,8 @@
VALUES
<foreach collection="list" item="ipRange" separator=",">
(#{ipRange.ipStart}, #{ipRange.ipEnd},
#{ipRange.ipStartNum}, #{ipRange.ipEndNum},
#{ipRange.ipStartNum},
#{ipRange.ipEndNum},
#{ipRange.ipSub}, #{ipRange.areaType},
#{ipRange.country})
</foreach>

View File

@@ -123,7 +123,7 @@ FROM
</select>
<!--获取域名 -->
<select id="getTrafficHttpDomain" resultType="java.util.HashMap">
select web_id webId, unique_num uniqueNum,entrance_id entranceId,SUM(c2s_byte_len + s2c_byte_len) byteCount,
select web_id webId, max(unique_num) uniqueNum,entrance_id entranceId,SUM(c2s_byte_len + s2c_byte_len) byteCount,
sum(c2s_pkt_num + s2c_pkt_num) pktCount from traffic_http_focus_statistic t where
<![CDATA[ stat_time>= #{beginDate} and stat_time< #{endDate}]]>
<if test="domain!=null">
@@ -135,12 +135,14 @@ FROM
group by web_id order by unique_num
</select>
<select id="getDomainTrans" resultType="com.nis.domain.restful.dashboard.TrafficHttpFocusStatistic">
select stat_time time, unique_num count from traffic_http_focus_statistic t where
select stat_time time, max(unique_num)count from traffic_http_focus_statistic t where
<![CDATA[ stat_time>= #{beginDate} and stat_time< #{endDate}]]>
and web_id=#{domain}
<if test="entranceId!=null">
and entrance_id=#{entranceId}
</if>
group by stat_time
order by stat_time
</select>
</mapper>

View File

@@ -90,8 +90,7 @@ public class LogDataService {
RestBusinessCode.param_formate_error.getValue());
}
String searchAsn = ntcAsnRecord.getSearchAsn();
String asn = "s_asn ";
if (ntcAsnRecord.getSearchAsnType().trim().equals("1")) {
asn = "d_asn ";
@@ -110,16 +109,27 @@ public class LogDataService {
sql.append(startTime);
sql.append(" and found_time< ");
sql.append(endTime);
if (searchAsn != null && !searchAsn.equals("")) {
sql.append(" and " + asn + "='" + searchAsn + "'");
}
StringBuffer countSql = new StringBuffer();
countSql.append("select count(1) from (");
countSql.append(sql);
countSql.append(" ) group by ");
countSql.append(asn+")");
Integer startNum = (page.getPageNo() - 1) * page.getPageSize();
Integer limitCount = startNum + page.getPageSize();
sql.append(" limit " + limitCount + " ) group by "+asn+" order by bps desc,pps desc limit " + startNum + "," + page.getPageSize());
countSql.append(" ) ");
if (searchAsn != null && !searchAsn.equals("")) {
countSql.append(" and " + asn + "='" + searchAsn + "'");
}
countSql.append("group by ");
countSql.append(asn + ")");
Integer startNum = 0;
Integer limitCount = startNum + 20;
sql.append(" limit " + limitCount + " ) ");
if (searchAsn != null && !searchAsn.equals("")) {
sql.append(" and " + asn + "='" + searchAsn + "'");
}
sql.append("group by " + asn + " order by bps desc,pps desc limit " + startNum + "," + 20);
localLogJDBCByDruid.getCount(page, countSql.toString());
page.setList(localLogJDBCByDruid.getNtcAsnRecordData(sql.toString()));