增加流量统计协议详情统计接口
This commit is contained in:
@@ -137,6 +137,31 @@ public class DashboardServiceController extends BaseRestController {
|
|||||||
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "协议统计图表数据检索成功",
|
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "协议统计图表数据检索成功",
|
||||||
list, 0);
|
list, 0);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 协议统计详情图与表
|
||||||
|
*/
|
||||||
|
@RequestMapping(value="trafficProtocolList", method = RequestMethod.GET)
|
||||||
|
@ApiOperation(value = "协议统计占比与报表", httpMethod = "GET", notes = "对应协议统计详情占比与报表")
|
||||||
|
public Map<String,?> trafficProtocolList(Model model, HttpServletRequest request, HttpServletResponse response){
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
AuditLogThread auditLogThread = super.saveRequestLog(servicesRequestLogService, Constants.OPACTION_GET, request, null);
|
||||||
|
List<HashMap> list = new ArrayList<HashMap>();
|
||||||
|
try {
|
||||||
|
List<Map> ipActiveList = dashboardService.getProtocolList();
|
||||||
|
if (ipActiveList.size() > 0) {
|
||||||
|
String jsonString = JsonMapper.toJsonString(ipActiveList);
|
||||||
|
list = (java.util.List<HashMap>) JsonMapper.fromJsonList(jsonString,HashMap.class);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
auditLogThread.setExceptionInfo(e.getMessage() + " " + e.getCause());
|
||||||
|
logger.error("协议统计图表数据检索失败:"+ExceptionUtil.getExceptionMsg(e));
|
||||||
|
throw new ServiceRuntimeException(auditLogThread, System.currentTimeMillis() - start,
|
||||||
|
"协议统计图表数据检索失败:" + e.getMessage(), RestBusinessCode.service_runtime_error.getValue());
|
||||||
|
}
|
||||||
|
return serviceLogResponse(auditLogThread, System.currentTimeMillis() - start, request, "协议统计图表数据检索成功",
|
||||||
|
list, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -13,4 +13,5 @@ public interface TrafficProtocolStatisticDao {
|
|||||||
|
|
||||||
TrafficProtocolStatistic getMaxStatTime();
|
TrafficProtocolStatistic getMaxStatTime();
|
||||||
List<Map> protocolChart(@Param("statTime")Date statTime);
|
List<Map> protocolChart(@Param("statTime")Date statTime);
|
||||||
|
List<Map> getProtocolList(@Param("statTime")Date statTime);
|
||||||
}
|
}
|
||||||
@@ -23,4 +23,12 @@
|
|||||||
SELECT proto_type protoType, SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_protocol_statistic WHERE proto_type != 0
|
SELECT proto_type protoType, SUM(c2s_byte_len+s2c_byte_len) count FROM traffic_protocol_statistic WHERE proto_type != 0
|
||||||
AND stat_time = #{statTime} GROUP BY proto_type ORDER BY count DESC LIMIT 0, 10
|
AND stat_time = #{statTime} GROUP BY proto_type ORDER BY count DESC LIMIT 0, 10
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getProtocolList" resultType="java.util.HashMap">
|
||||||
|
SELECT c.protocol_type protocolType,p.proto_type protoType,p.link_num linkNum, p.packets packets, p.GByte GByte FROM (
|
||||||
|
SELECT proto_type,SUM(link_num) AS link_num,SUM(c2s_pkt_num+s2c_pkt_num) AS packets,
|
||||||
|
(SUM(c2s_byte_len+s2c_byte_len)/1024/1024/1024) AS GByte
|
||||||
|
FROM traffic_protocol_statistic WHERE stat_time=#{statTime} GROUP BY proto_type ) p
|
||||||
|
LEFT JOIN ui_code_protocol_type_dic c ON p.proto_type=c.view_code ORDER BY p.GByte DESC
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -219,6 +219,10 @@ public class DashboardService extends BaseService{
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 协议统计
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public List<Map> protocolChart() {
|
public List<Map> protocolChart() {
|
||||||
TrafficProtocolStatistic maxStatTime = trafficProtocolStatisticDao.getMaxStatTime();
|
TrafficProtocolStatistic maxStatTime = trafficProtocolStatisticDao.getMaxStatTime();
|
||||||
List<Map> list=new ArrayList<Map>();
|
List<Map> list=new ArrayList<Map>();
|
||||||
@@ -235,6 +239,19 @@ public class DashboardService extends BaseService{
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 协议统计报表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<Map> getProtocolList(){
|
||||||
|
TrafficProtocolStatistic maxStatTime = trafficProtocolStatisticDao.getMaxStatTime();
|
||||||
|
List<Map> list=new ArrayList<Map>();
|
||||||
|
if(maxStatTime!=null&&maxStatTime.getStatTime()!=null) {
|
||||||
|
Date statTime = maxStatTime.getStatTime();
|
||||||
|
list = trafficProtocolStatisticDao.getProtocolList(statTime);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
public List<Map> appChart() {
|
public List<Map> appChart() {
|
||||||
List<Map> list=new ArrayList<Map>();
|
List<Map> list=new ArrayList<Map>();
|
||||||
TrafficAppStatistic maxStatTime = trafficAppStatisticDao.getMaxStatTime();
|
TrafficAppStatistic maxStatTime = trafficAppStatisticDao.getMaxStatTime();
|
||||||
|
|||||||
Reference in New Issue
Block a user