1、所有流量表新增字段ping丢包率。

2、开发ping丢包率图形接口。
This commit is contained in:
gaoyutao
2026-01-19 18:17:23 +08:00
parent 4ed1a66466
commit 14a750a736
8 changed files with 56 additions and 15 deletions
@@ -158,4 +158,13 @@ public class InitialBandwidthTrafficController extends BaseController
return success(echartsData);
}
/**
* 查询eth0 Ping丢包率信息并封装为多折线ECharts图表数据
*/
@PostMapping("/pingDroppedEcharts")
public AjaxResult pingDroppedEcharts(@RequestBody InitialBandwidthTraffic initialBandwidthTraffic) {
Map<String, Object> echartsData = initialBandwidthTrafficService.pingDroppedEcharts(initialBandwidthTraffic);
return success(echartsData);
}
}
@@ -1,5 +1,6 @@
package com.tongran.rocketmq.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.tongran.common.core.annotation.Excel;
import com.tongran.common.core.web.domain.BaseEntity;
import lombok.Data;
@@ -15,6 +16,7 @@ import java.util.Map;
* @date 2025-08-20
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class InitialBandwidthTraffic extends BaseEntity
{
private static final long serialVersionUID = 1L;
@@ -103,6 +105,8 @@ public class InitialBandwidthTraffic extends BaseEntity
private String totalIpv6InSpeed;
/** IPv6发送总流量 */
private String totalIpv6OutSpeed;
/** ping丢包率 */
private Double pingDropped;
/** 多个clientId */
private Map<String, List<String>> clientInterfaces;
}
@@ -119,4 +119,6 @@ public interface IInitialBandwidthTrafficService
* @return
*/
Map<String, Object> serverDetails(InitialBandwidthTraffic initialBandwidthTraffic);
Map<String, Object> pingDroppedEcharts(InitialBandwidthTraffic initialBandwidthTraffic);
}
@@ -636,6 +636,19 @@ public class InitialBandwidthTrafficServiceImpl implements IInitialBandwidthTraf
return resultMap;
}
@Override
public Map<String, Object> pingDroppedEcharts(InitialBandwidthTraffic initialBandwidthTraffic) {
// 流量信息
List<InitialBandwidthTraffic> list = getListByTableName(initialBandwidthTraffic);
Map<String, Function<InitialBandwidthTraffic, ?>> extractors = new LinkedHashMap<>();
extractors.put("pingDropped", info -> info.getPingDropped());
return EchartsDataUtils.buildEchartsDataAutoPadding(
list, InitialBandwidthTraffic::getCreateTime, extractors,
initialBandwidthTraffic.getStartTime(), initialBandwidthTraffic.getEndTime()
);
}
/**
* 构建支持子网卡的批量echarts图表数据
* @param initialBandwidthTraffic
@@ -146,11 +146,11 @@
a.create_time as createTime,
a.update_time as updateTime,
b.serial,
b.total,
b.write_speed as writeSpeed,
b.read_speed as readSpeed,
TRUNCATE(IFNULL(b.total,0)/(1024 * 1024 * 1024), 0) as total,
TRUNCATE(IFNULL(b.write_speed,0)/1024, 0) as writeSpeed,
TRUNCATE(IFNULL(b.read_speed,0)/1024, 0) as readSpeed,
b.type,
b.used_space as usedSpace
TRUNCATE(IFNULL(b.used_space,0)/(1024 * 1024 * 1024), 0) as usedSpace
FROM all_disk_name a
LEFT JOIN (
SELECT client_id, name, MAX(create_time) as max_create_time
@@ -112,14 +112,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
create_by, update_by, client_id, create_time,
ipv4_in_speed, ipv4_out_speed, ipv6_in_speed, ipv6_out_speed,
total_ipv4_in_speed, total_ipv4_out_speed, total_ipv6_in_speed, total_ipv6_out_speed,
ipV6
ipV6, ping_dropped
) VALUES (
#{name}, #{mac}, #{status}, #{type}, #{ipV4}, #{inDropped}, #{outDropped},
#{inSpeed}, #{outSpeed}, #{totalInSpeed}, #{totalOutSpeed}, #{duplex}, #{speed},
#{createBy}, #{updateBy}, #{clientId}, #{createTime},
#{ipv4InSpeed}, #{ipv4OutSpeed}, #{ipv6InSpeed}, #{ipv6OutSpeed},
#{totalIpv4InSpeed}, #{totalIpv4OutSpeed}, #{totalIpv6InSpeed}, #{totalIpv6OutSpeed},
#{ipV6}
#{ipV6}, #{pingDropped}
)
</insert>
@@ -130,7 +130,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
create_by, update_by, client_id, create_time,
ipv4_in_speed, ipv4_out_speed, ipv6_in_speed, ipv6_out_speed,
total_ipv4_in_speed, total_ipv4_out_speed, total_ipv6_in_speed, total_ipv6_out_speed,
ipV6
ipV6, ping_dropped
) VALUES
<foreach collection="list" item="item" separator=",">
(
@@ -139,7 +139,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item.createBy}, #{item.updateBy}, #{item.clientId}, #{item.createTime},
#{item.ipv4InSpeed}, #{item.ipv4OutSpeed}, #{item.ipv6InSpeed}, #{item.ipv6OutSpeed},
#{item.totalIpv4InSpeed}, #{item.totalIpv4OutSpeed}, #{item.totalIpv6InSpeed}, #{item.totalIpv6OutSpeed},
#{item.ipV6}
#{item.ipV6}, #{item.pingDropped}
)
</foreach>
</insert>
@@ -173,7 +173,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
total_ipv4_out_speed as totalIpv4OutSpeed,
total_ipv6_in_speed as totalIpv6InSpeed,
total_ipv6_out_speed as totalIpv6OutSpeed,
ipV6
ipV6,
ping_dropped as pingDropped
from ${tableName}
<where>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
@@ -212,7 +213,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
total_ipv4_out_speed as totalIpv4OutSpeed,
total_ipv6_in_speed as totalIpv6InSpeed,
total_ipv6_out_speed as totalIpv6OutSpeed,
ipV6
ipV6,
ping_dropped as pingDropped
from ${tableName}
<where>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>