测试环境配置、新增mtr探测丢包率结果存储方法

This commit is contained in:
gaoyutao
2025-11-20 18:10:17 +08:00
parent 947d60f788
commit 3391b949c8
25 changed files with 934 additions and 49 deletions
@@ -16,6 +16,12 @@ public interface EpsInitialTrafficDataMapper {
* @param tableName 表名
*/
void createEpsInitialTrafficTable(@Param("tableName") String tableName);
/**
* 创建置顶名称的mtr探测结果表
* @param tableName
*/
void createMtrProbeResultTable(@Param("tableName") String tableName);
/**
* 单条插入数据
* @param data 流量数据
@@ -49,4 +55,5 @@ public interface EpsInitialTrafficDataMapper {
int updateMachineTraffic(EpsInitialTrafficData epsInitialTrafficData);
List<EpsInitialTrafficData> getTrafficListByClientIds(EpsInitialTrafficData condition);
}
@@ -64,6 +64,8 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
createTrafficDetailsTable(year, month);
// 创建流量初始表
createTrafficStatsTable(year, month);
// 创建mtr探测丢包结果表
createMtrProbeResultTable(year, month);
}
private void createTrafficDetailsTable(int year, int month) {
@@ -78,6 +80,12 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
});
}
private void createMtrProbeResultTable(int year, int month) {
createRangeTables(year, month, "rm_mtr_probe_result", (tableName) -> {
epsInitialTrafficDataMapper.createMtrProbeResultTable(tableName);
});
}
/**
* 通用创建表方法
@@ -13,17 +13,19 @@ spring:
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848
server-addr: 172.16.15.52:8848
# 服务注册地址
# server-addr: 172.16.15.103:8848
# username: ${spring.cloud.nacos.config.username}
# password: ${spring.cloud.nacos.config.password}
namespace: ${spring.cloud.nacos.config.namespace}
username: ${spring.cloud.nacos.config.username}
password: ${spring.cloud.nacos.config.password}
config:
server-addr: 127.0.0.1:8848
server-addr: 172.16.15.52:8848
# 配置中心地址
# server-addr: 172.16.15.103:8848
# username: nacos
# password: nacos
namespace: saas-local
username: nacos
password: nacos
# 配置文件格式
file-extension: yml
# 共享配置
@@ -66,6 +66,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
INDEX idx_name_time (`name`,create_time)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='初始带宽流量表';
</update>
<update id="createMtrProbeResultTable">
CREATE TABLE IF NOT EXISTS ${tableName} (
id BIGINT(20) AUTO_INCREMENT COMMENT '主键ID',
mtr_client_id VARCHAR(200) COMMENT 'MTR客户端ID',
client_id VARCHAR(200) COMMENT '客户端ID',
public_ip VARCHAR(45) COMMENT '公网IP地址',
packet_loss_rate DECIMAL(5,2) COMMENT '丢包率(%)',
create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
create_by VARCHAR(64) COMMENT '创建人',
update_by VARCHAR(64) COMMENT '更新人',
PRIMARY KEY (id),
UNIQUE KEY uk_probe_record (mtr_client_id, client_id, create_time),
INDEX idx_mtr_client_id (mtr_client_id, create_time)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='网络mtr探测结果表';
</update>
<!-- 单条插入语句 -->
<insert id="insert">