新增业务流量入库方法。
增加自动创建业务流量分表方法
This commit is contained in:
+2
@@ -82,4 +82,6 @@ public interface EpsInitialTrafficDataMapper {
|
||||
void createMountPointInfo(String tableName);
|
||||
|
||||
void createDockerInfo(String tableName);
|
||||
|
||||
void createNetBusinessInfo(String tableName);
|
||||
}
|
||||
|
||||
+10
@@ -82,6 +82,8 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
createMountPointInfo(year, month);
|
||||
// 创建容器信息表
|
||||
createDockerInfo(year, month);
|
||||
// 创建业务流量信息表
|
||||
createNetBusinessInfo(year, month);
|
||||
}
|
||||
public void createNextMonthTables(Long plusMonth) {
|
||||
LocalDate nextMonth = LocalDate.now().plusMonths(plusMonth);
|
||||
@@ -110,6 +112,8 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
createMountPointInfo(year, month);
|
||||
// 创建容器信息表
|
||||
createDockerInfo(year, month);
|
||||
// 创建业务流量表
|
||||
createNetBusinessInfo(year, month);
|
||||
}
|
||||
private void createTrafficDetailsTable(int year, int month) {
|
||||
createRangeTables(year, month, "eps_traffic_details", (tableName) -> {
|
||||
@@ -171,6 +175,12 @@ public class EpsInitialTrafficDataServiceImpl implements EpsInitialTrafficDataSe
|
||||
});
|
||||
}
|
||||
|
||||
private void createNetBusinessInfo(int year, int month) {
|
||||
createRangeTables(year, month, "initial_net_business_traffic", (tableName) -> {
|
||||
epsInitialTrafficDataMapper.createNetBusinessInfo(tableName);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用创建表方法
|
||||
* @param year 年份
|
||||
|
||||
+23
-1
@@ -291,7 +291,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
UNIQUE INDEX `idx_unique_key`(`client_id`, `mount`, `create_time`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT = '挂载点监控信息表';
|
||||
</update>
|
||||
|
||||
<update id="createNetBusinessInfo">
|
||||
CREATE TABLE ${tableName} (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`client_id` varchar(255) comment '客户端唯一标识',
|
||||
`mac` varchar(255) comment 'mac地址',
|
||||
`name` varchar(255) DEFAULT NULL COMMENT '网卡名称',
|
||||
`pid` int(11) DEFAULT NULL COMMENT '进程ID',
|
||||
`process_name` varchar(255) DEFAULT NULL COMMENT '进程名',
|
||||
`in_speed` varchar(50) DEFAULT NULL COMMENT '累计接收字节数',
|
||||
`out_speed` varchar(50) DEFAULT NULL COMMENT '累计发送字节数',
|
||||
`connection_count` int(11) DEFAULT NULL COMMENT '当前连接数',
|
||||
`ipv4_in_speed` varchar(50) DEFAULT NULL COMMENT 'IPv4接收流量',
|
||||
`ipv4_out_speed` varchar(50) DEFAULT NULL COMMENT 'IPv4发送流量',
|
||||
`ipv6_in_speed` varchar(50) DEFAULT NULL COMMENT 'IPv6接收流量',
|
||||
`ipv6_out_speed` varchar(50) DEFAULT NULL COMMENT 'IPv6发送流量',
|
||||
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(64) DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='网络业务流量监控表';
|
||||
</update>
|
||||
<!-- 单条插入语句 -->
|
||||
<insert id="insert">
|
||||
INSERT INTO ${tableName} (
|
||||
|
||||
Reference in New Issue
Block a user