流量统计app趋势跟apptop100增加isp运营商查询条件
This commit is contained in:
@@ -13,6 +13,10 @@ public class AppConnRecordStatistic extends AppTrendEntity{
|
|||||||
protected String logPercent;
|
protected String logPercent;
|
||||||
protected String searchQuota="1"; //统计指标 1:连接数 2:包数 3:字节数
|
protected String searchQuota="1"; //统计指标 1:连接数 2:包数 3:字节数
|
||||||
|
|
||||||
|
private String searchIspCode;// 运营商
|
||||||
|
private String ispName;// 运营商
|
||||||
|
private String ispNum;// device_id ,entrance_id 拼接
|
||||||
|
|
||||||
public AppConnRecordStatistic() {
|
public AppConnRecordStatistic() {
|
||||||
super();
|
super();
|
||||||
// TODO Auto-generated constructor stub
|
// TODO Auto-generated constructor stub
|
||||||
@@ -20,7 +24,7 @@ public class AppConnRecordStatistic extends AppTrendEntity{
|
|||||||
|
|
||||||
public AppConnRecordStatistic(String ipAddr, Double pktNum,
|
public AppConnRecordStatistic(String ipAddr, Double pktNum,
|
||||||
String pktPercent, Double byteNum, String bytePercent,
|
String pktPercent, Double byteNum, String bytePercent,
|
||||||
Double logNum, String logPercent) {
|
Double logNum, String logPercent,String ispName) {
|
||||||
super();
|
super();
|
||||||
this.ipAddr = ipAddr;
|
this.ipAddr = ipAddr;
|
||||||
this.pktNum = pktNum;
|
this.pktNum = pktNum;
|
||||||
@@ -29,6 +33,7 @@ public class AppConnRecordStatistic extends AppTrendEntity{
|
|||||||
this.bytePercent = bytePercent;
|
this.bytePercent = bytePercent;
|
||||||
this.logNum = logNum;
|
this.logNum = logNum;
|
||||||
this.logPercent = logPercent;
|
this.logPercent = logPercent;
|
||||||
|
this.ispName = ispName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIpAddr() {
|
public String getIpAddr() {
|
||||||
@@ -95,4 +100,28 @@ public class AppConnRecordStatistic extends AppTrendEntity{
|
|||||||
this.searchQuota = searchQuota;
|
this.searchQuota = searchQuota;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSearchIspCode() {
|
||||||
|
return searchIspCode;
|
||||||
|
}
|
||||||
|
@JsonIgnore
|
||||||
|
public void setSearchIspCode(String searchIspCode) {
|
||||||
|
this.searchIspCode = searchIspCode;
|
||||||
|
}
|
||||||
|
@JsonIgnore
|
||||||
|
public String getIspNum() {
|
||||||
|
return ispNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIspNum(String ispNum) {
|
||||||
|
this.ispNum = ispNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIspName() {
|
||||||
|
return ispName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIspName(String ispName) {
|
||||||
|
this.ispName = ispName;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,92 @@
|
|||||||
|
package com.nis.domain.restful.dashboard;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class SysDeviceInfo implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 2642565275696732948L;
|
||||||
|
private Long id;
|
||||||
|
private String deviceType;// '设备类型',
|
||||||
|
private String ipAddr;// 通信运营商编码,
|
||||||
|
private Integer deviceId;//'设备ID,相同设备可对应多个运营商',
|
||||||
|
private Integer linkId;//'链路号索引',
|
||||||
|
private Integer isp;//'运营商编码,例如ktel-mxpe:1001',
|
||||||
|
private Integer entranceId;// '地域 1-astana 2-alamty',
|
||||||
|
private Integer status;// '0-未接入 1-接入 2-部分接入',
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
private String ispNum;
|
||||||
|
private String ispName;//'运营商',
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
public String getDeviceType() {
|
||||||
|
return deviceType;
|
||||||
|
}
|
||||||
|
public void setDeviceType(String deviceType) {
|
||||||
|
this.deviceType = deviceType;
|
||||||
|
}
|
||||||
|
public String getIpAddr() {
|
||||||
|
return ipAddr;
|
||||||
|
}
|
||||||
|
public void setIpAddr(String ipAddr) {
|
||||||
|
this.ipAddr = ipAddr;
|
||||||
|
}
|
||||||
|
public Integer getDeviceId() {
|
||||||
|
return deviceId;
|
||||||
|
}
|
||||||
|
public void setDeviceId(Integer deviceId) {
|
||||||
|
this.deviceId = deviceId;
|
||||||
|
}
|
||||||
|
public Integer getLinkId() {
|
||||||
|
return linkId;
|
||||||
|
}
|
||||||
|
public void setLinkId(Integer linkId) {
|
||||||
|
this.linkId = linkId;
|
||||||
|
}
|
||||||
|
public Integer getIsp() {
|
||||||
|
return isp;
|
||||||
|
}
|
||||||
|
public void setIsp(Integer isp) {
|
||||||
|
this.isp = isp;
|
||||||
|
}
|
||||||
|
public Integer getEntranceId() {
|
||||||
|
return entranceId;
|
||||||
|
}
|
||||||
|
public void setEntranceId(Integer entranceId) {
|
||||||
|
this.entranceId = entranceId;
|
||||||
|
}
|
||||||
|
public Integer getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
public void setStatus(Integer status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
public String getIspNum() {
|
||||||
|
return ispNum;
|
||||||
|
}
|
||||||
|
public void setIspNum(String ispNum) {
|
||||||
|
this.ispNum = ispNum;
|
||||||
|
}
|
||||||
|
public String getIspName() {
|
||||||
|
return ispName;
|
||||||
|
}
|
||||||
|
public void setIspName(String ispName) {
|
||||||
|
this.ispName = ispName;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,12 +2,17 @@ package com.nis.domain.restful.dashboard;
|
|||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
|
||||||
public class TrafficAppFocusStatistic extends AppTrendEntity{
|
public class TrafficAppFocusStatistic extends AppTrendEntity{
|
||||||
|
|
||||||
private Date time;
|
private Date time;
|
||||||
private Long sipNum;
|
private Long sipNum;
|
||||||
private Long dipNum;
|
private Long dipNum;
|
||||||
|
|
||||||
|
private String searchIspCode;// 运营商
|
||||||
|
private String ispNum;// device_id ,entrance_id 拼接
|
||||||
|
|
||||||
public Date getTime() {
|
public Date getTime() {
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
@@ -26,4 +31,18 @@ public class TrafficAppFocusStatistic extends AppTrendEntity{
|
|||||||
public void setDipNum(Long dipNum) {
|
public void setDipNum(Long dipNum) {
|
||||||
this.dipNum = dipNum;
|
this.dipNum = dipNum;
|
||||||
}
|
}
|
||||||
|
public String getSearchIspCode() {
|
||||||
|
return searchIspCode;
|
||||||
|
}
|
||||||
|
public void setSearchIspCode(String searchIspCode) {
|
||||||
|
this.searchIspCode = searchIspCode;
|
||||||
|
}
|
||||||
|
@JsonIgnore
|
||||||
|
public String getIspNum() {
|
||||||
|
return ispNum;
|
||||||
|
}
|
||||||
|
public void setIspNum(String ispNum) {
|
||||||
|
this.ispNum = ispNum;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import com.nis.domain.restful.NtcConnNumReport;
|
|||||||
import com.nis.domain.restful.NtcRadiusReport;
|
import com.nis.domain.restful.NtcRadiusReport;
|
||||||
import com.nis.domain.restful.dashboard.AppConnRecordStatistic;
|
import com.nis.domain.restful.dashboard.AppConnRecordStatistic;
|
||||||
import com.nis.domain.restful.dashboard.AppTrendEntity;
|
import com.nis.domain.restful.dashboard.AppTrendEntity;
|
||||||
|
import com.nis.domain.restful.dashboard.SysDeviceInfo;
|
||||||
import com.nis.domain.restful.dashboard.TrafficAppFocusStatistic;
|
import com.nis.domain.restful.dashboard.TrafficAppFocusStatistic;
|
||||||
import com.nis.domain.restful.dashboard.TrafficAsnStatistic;
|
import com.nis.domain.restful.dashboard.TrafficAsnStatistic;
|
||||||
import com.nis.restful.RestBusinessCode;
|
import com.nis.restful.RestBusinessCode;
|
||||||
@@ -1018,6 +1019,10 @@ public class DashboardServiceController extends BaseRestController {
|
|||||||
entity.setSearchStartTime(map.get("startTime"));
|
entity.setSearchStartTime(map.get("startTime"));
|
||||||
entity.setSearchEndTime(map.get("endTime"));
|
entity.setSearchEndTime(map.get("endTime"));
|
||||||
}
|
}
|
||||||
|
if(StringUtils.isNotBlank(entity.getSearchIspCode())){
|
||||||
|
String ispNum = dashboardService.getIspNum(entity.getSearchIspCode());
|
||||||
|
entity.setIspNum(ispNum);
|
||||||
|
}
|
||||||
//将数据源切换到本地clickhouse
|
//将数据源切换到本地clickhouse
|
||||||
CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_B);
|
CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_B);
|
||||||
resultMap = dashboardService.getAppTrend(entity);
|
resultMap = dashboardService.getAppTrend(entity);
|
||||||
@@ -1070,9 +1075,28 @@ public class DashboardServiceController extends BaseRestController {
|
|||||||
entity.setSearchStartTime(map.get("startTime"));
|
entity.setSearchStartTime(map.get("startTime"));
|
||||||
entity.setSearchEndTime(map.get("endTime"));
|
entity.setSearchEndTime(map.get("endTime"));
|
||||||
}
|
}
|
||||||
|
// 查询运营商编码所对应的设备号跟出入口编号
|
||||||
|
String ispNum="";
|
||||||
|
if(StringUtils.isNotBlank(entity.getSearchIspCode())){
|
||||||
|
ispNum = dashboardService.getIspNum(entity.getSearchIspCode());
|
||||||
|
entity.setIspNum(ispNum);
|
||||||
|
}
|
||||||
|
List<SysDeviceInfo> sysDeviceInfo =dashboardService.getIspListByIspNum(ispNum);
|
||||||
CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_B);
|
CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_B);
|
||||||
list = dashboardService.appConnRecordTop100(entity);
|
list = dashboardService.appConnRecordTop100(entity);
|
||||||
|
// 设置运营商编码
|
||||||
|
if(list!=null&&list.size()>0&&sysDeviceInfo!=null&&sysDeviceInfo.size()>0){
|
||||||
|
for (AppConnRecordStatistic app : list) {
|
||||||
|
for (SysDeviceInfo device : sysDeviceInfo) {
|
||||||
|
if((app.getIspNum().trim()).equals(device.getIspNum().trim())){
|
||||||
|
app.setIspName(device.getIspName());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
CustomerContextHolder.clearCustomerType();
|
CustomerContextHolder.clearCustomerType();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
auditLogThread.setExceptionInfo("App通联关系Top100数据检索失败:" + e.getMessage());
|
auditLogThread.setExceptionInfo("App通联关系Top100数据检索失败:" + e.getMessage());
|
||||||
logger.error("App通联关系Top100检索失败:" + ExceptionUtil.getExceptionMsg(e));
|
logger.error("App通联关系Top100检索失败:" + ExceptionUtil.getExceptionMsg(e));
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import com.nis.domain.restful.dashboard.SysDeviceInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @ClassName:IspInfoDao
|
* @ClassName:IspInfoDao
|
||||||
@@ -16,4 +18,6 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
public interface IspInfoDao {
|
public interface IspInfoDao {
|
||||||
|
|
||||||
List<String> getIspNum(@Param("ispCode") String ispCode);
|
List<String> getIspNum(@Param("ispCode") String ispCode);
|
||||||
|
|
||||||
|
List<SysDeviceInfo> getIspListByIspNum(@Param("ispNum")String ispNum);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,15 @@
|
|||||||
<mapper namespace="com.nis.web.dao.IspInfoDao">
|
<mapper namespace="com.nis.web.dao.IspInfoDao">
|
||||||
<select id="getIspNum" resultType="java.lang.String">
|
<select id="getIspNum" resultType="java.lang.String">
|
||||||
select distinct concat(entrance_id,device_id) as ispNum from ui_sys_device_info where
|
select distinct concat(entrance_id,device_id) as ispNum from ui_sys_device_info where
|
||||||
isp=#{ispCode}
|
isp in (${ispCode})
|
||||||
|
</select>
|
||||||
|
<select id="getIspListByIspNum" resultType="com.nis.domain.restful.dashboard.SysDeviceInfo">
|
||||||
|
select distinct d.isp isp ,concat(d.entrance_id,d.device_id) ispNum,isp_key_name ispName from ui_sys_device_info d
|
||||||
|
left join ui_sys_isp_info s on d.isp=s.isp_key_code
|
||||||
|
<where>
|
||||||
|
<if test="ispNum!=null and ispNum!=''">
|
||||||
|
concat(entrance_id,device_id) in (${ispNum})
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -53,19 +53,25 @@
|
|||||||
<if test="searchEntranceId !=null and searchEntranceId != ''">
|
<if test="searchEntranceId !=null and searchEntranceId != ''">
|
||||||
<![CDATA[and entrance_id=toInt64(#{searchEntranceId}) ]]>
|
<![CDATA[and entrance_id=toInt64(#{searchEntranceId}) ]]>
|
||||||
</if>
|
</if>
|
||||||
|
<if test="ispNum !=null and ispNum != ''">
|
||||||
|
<![CDATA[and concat(toString(entrance_id),toString(device_id)) in (${ispNum})]]>
|
||||||
|
</if>
|
||||||
group by stat_time
|
group by stat_time
|
||||||
order by stat_time
|
order by stat_time
|
||||||
</select>
|
</select>
|
||||||
<!-- App 活跃IP Top100 -->
|
<!-- App 活跃IP Top100 -->
|
||||||
<select id="appConnRecordTop100" parameterType="com.nis.domain.restful.dashboard.AppConnRecordStatistic" resultType="com.nis.domain.restful.dashboard.AppConnRecordStatistic">
|
<select id="appConnRecordTop100" parameterType="com.nis.domain.restful.dashboard.AppConnRecordStatistic" resultType="com.nis.domain.restful.dashboard.AppConnRecordStatistic">
|
||||||
select s_ip ipAddr, sum(c2s_byte_num + s2c_byte_num) byteNum, sum(c2s_pkt_num + s2c_pkt_num) pktNum, count(s_ip) logNum
|
select s_ip ipAddr,concat(toString(entrance_id),toString(device_id)) ispNum, sum(c2s_byte_num + s2c_byte_num) byteNum, sum(c2s_pkt_num + s2c_pkt_num) pktNum, count(s_ip) logNum
|
||||||
from tbs_ods_ntc_conn_record_log t where
|
from tbs_ods_ntc_conn_record_log t where
|
||||||
<![CDATA[ found_time>= toDateTime(#{searchStartTime}) and found_time< toDateTime(#{searchEndTime})
|
<![CDATA[ found_time>= toDateTime(#{searchStartTime}) and found_time< toDateTime(#{searchEndTime})
|
||||||
and app_id=toInt64(#{searchAppId}) ]]>
|
and app_id=toInt64(#{searchAppId}) ]]>
|
||||||
<if test="searchEntranceId !=null and searchEntranceId != ''">
|
<if test="searchEntranceId !=null and searchEntranceId != ''">
|
||||||
<![CDATA[and entrance_id=toInt64(#{searchEntranceId}) ]]>
|
<![CDATA[and entrance_id=toInt64(#{searchEntranceId}) ]]>
|
||||||
</if>
|
</if>
|
||||||
group by s_ip
|
<if test="ispNum !=null and ispNum != ''">
|
||||||
|
<![CDATA[and concat(toString(entrance_id),toString(device_id)) in (${ispNum})]]>
|
||||||
|
</if>
|
||||||
|
group by s_ip,entrance_id,device_id
|
||||||
order by
|
order by
|
||||||
<choose>
|
<choose>
|
||||||
<when test="searchQuota !=null and searchQuota != '' and searchQuota == 2 ">
|
<when test="searchQuota !=null and searchQuota != '' and searchQuota == 2 ">
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import com.nis.domain.restful.NtcConnNumReport;
|
|||||||
import com.nis.domain.restful.NtcEntranceReport;
|
import com.nis.domain.restful.NtcEntranceReport;
|
||||||
import com.nis.domain.restful.dashboard.AppConnRecordStatistic;
|
import com.nis.domain.restful.dashboard.AppConnRecordStatistic;
|
||||||
import com.nis.domain.restful.dashboard.NtcTotalReport;
|
import com.nis.domain.restful.dashboard.NtcTotalReport;
|
||||||
|
import com.nis.domain.restful.dashboard.SysDeviceInfo;
|
||||||
import com.nis.domain.restful.dashboard.TrafficAppFocusStatistic;
|
import com.nis.domain.restful.dashboard.TrafficAppFocusStatistic;
|
||||||
import com.nis.domain.restful.dashboard.TrafficAppStatistic;
|
import com.nis.domain.restful.dashboard.TrafficAppStatistic;
|
||||||
import com.nis.domain.restful.dashboard.TrafficAsnStatistic;
|
import com.nis.domain.restful.dashboard.TrafficAsnStatistic;
|
||||||
@@ -41,6 +42,7 @@ import com.nis.restful.RestServiceException;
|
|||||||
import com.nis.util.Constants;
|
import com.nis.util.Constants;
|
||||||
import com.nis.util.DateUtils;
|
import com.nis.util.DateUtils;
|
||||||
import com.nis.util.StringUtils;
|
import com.nis.util.StringUtils;
|
||||||
|
import com.nis.web.dao.IspInfoDao;
|
||||||
import com.nis.web.dao.dashboard.NtcTotalReportDao;
|
import com.nis.web.dao.dashboard.NtcTotalReportDao;
|
||||||
import com.nis.web.dao.dashboard.TrafficAppStatisticDao;
|
import com.nis.web.dao.dashboard.TrafficAppStatisticDao;
|
||||||
import com.nis.web.dao.dashboard.TrafficAsnStatisticDao;
|
import com.nis.web.dao.dashboard.TrafficAsnStatisticDao;
|
||||||
@@ -71,6 +73,8 @@ public class DashboardService extends BaseService {
|
|||||||
public TrafficAsnStatisticDao trafficAsnStatisticDao;
|
public TrafficAsnStatisticDao trafficAsnStatisticDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
public TrafficPortActiveStatisticDao trafficPortActiveStatisticDao;
|
public TrafficPortActiveStatisticDao trafficPortActiveStatisticDao;
|
||||||
|
@Autowired
|
||||||
|
private IspInfoDao ispInfoDao;
|
||||||
//ip地址类型
|
//ip地址类型
|
||||||
private final String[] addrTypes = {"4","6"} ;
|
private final String[] addrTypes = {"4","6"} ;
|
||||||
//tcp udp
|
//tcp udp
|
||||||
@@ -1773,4 +1777,29 @@ public class DashboardService extends BaseService {
|
|||||||
ntcAsnRecord.setPage(page);
|
ntcAsnRecord.setPage(page);
|
||||||
page.setList(trafficAsnStatisticDao.getTrafficAsnStatisticList(ntcAsnRecord));
|
page.setList(trafficAsnStatisticDao.getTrafficAsnStatisticList(ntcAsnRecord));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 根据ispcode获取当前运营商下所有的entrance_id,device_id,link_id组合
|
||||||
|
*
|
||||||
|
* @param ispCode
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getIspNum(String ispCode) {
|
||||||
|
List<String> ispNum = ispInfoDao.getIspNum(ispCode);
|
||||||
|
if (ispNum != null && ispNum.size() > 0) {
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
for (String ispNumStr : ispNum) {
|
||||||
|
sb.append("'");
|
||||||
|
sb.append(ispNumStr);
|
||||||
|
sb.append("'");
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
return sb.substring(0, sb.length() - 1);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SysDeviceInfo> getIspListByIspNum(String ispNum) {
|
||||||
|
|
||||||
|
return ispInfoDao.getIspListByIspNum(ispNum);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user