优化实时95值计算流量科学计数法、服务器底层流量所有业务网卡流量求和

This commit is contained in:
gaoyutao
2025-11-11 10:55:21 +08:00
parent 80533dc1a3
commit 5c3b6df591
2 changed files with 46 additions and 41 deletions
@@ -87,6 +87,7 @@ public class EpsTaskStatisticsServiceImpl implements IEpsTaskStatisticsService
taskStatistics.setTimeRange(timeRange); taskStatistics.setTimeRange(timeRange);
// 处理包含资源 // 处理包含资源
String resources = taskStatistics.getIncludedResources(); String resources = taskStatistics.getIncludedResources();
if("2".equals(taskStatistics.getResourceType())){
String result = Arrays.stream(resources.split(",")) String result = Arrays.stream(resources.split(","))
.map(msg -> msg.split(";")) .map(msg -> msg.split(";"))
.filter(resource -> resource.length >= 4) .filter(resource -> resource.length >= 4)
@@ -94,6 +95,7 @@ public class EpsTaskStatisticsServiceImpl implements IEpsTaskStatisticsService
.collect(Collectors.joining("\n")); .collect(Collectors.joining("\n"));
taskStatistics.setIncludedResources(result); taskStatistics.setIncludedResources(result);
} }
}
return epsTaskStatisticsList; return epsTaskStatisticsList;
} }
@@ -181,54 +181,57 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- 条件查询 --> <!-- 条件查询 -->
<select id="selectByCondition" resultType="EpsInitialTrafficData"> <select id="selectByCondition" resultType="EpsInitialTrafficData">
SELECT SELECT
id, a.id,
`name` AS name, a.`name` AS name,
`mac` AS mac, a.`mac` AS mac,
`status` AS status, a.`status` AS status,
`type` AS type, a.`type` AS type,
`ipV4` AS ipV4, a.`ipV4` AS ipV4,
`in_dropped` AS inDropped, a.`in_dropped` AS inDropped,
`out_dropped` AS outDropped, a.`out_dropped` AS outDropped,
CAST(sum(ifnull(`in_speed`,0)) AS DECIMAL(20,0)) AS inSpeed, CAST(sum(ifnull(a.`in_speed`,0)) AS DECIMAL(20,0)) AS inSpeed,
CAST(sum(ifnull(`out_speed`,0)) AS DECIMAL(20,0)) AS outSpeed, CAST(sum(ifnull(a.`out_speed`,0)) AS DECIMAL(20,0)) AS outSpeed,
CAST(sum(ifnull(`total_in_speed`,0)) AS DECIMAL(20,0)) AS totalInSpeed, CAST(sum(ifnull(a.`total_in_speed`,0)) AS DECIMAL(20,0)) AS totalInSpeed,
CAST(sum(ifnull(`total_out_speed`,0)) AS DECIMAL(20,0)) AS totalOutSpeed, CAST(sum(ifnull(a.`total_out_speed`,0)) AS DECIMAL(20,0)) AS totalOutSpeed,
`machine_flow` AS machineFlow, a.`machine_flow` AS machineFlow,
`speed` AS speed, a.`speed` AS speed,
`duplex` AS duplex, a.`duplex` AS duplex,
business_id AS businessId, a.business_id AS businessId,
business_name AS businessName, a.business_name AS businessName,
service_sn AS serviceSn, a.service_sn AS serviceSn,
node_name AS nodeName, a.node_name AS nodeName,
revenue_method AS revenueMethod, a.revenue_method AS revenueMethod,
package_bandwidth AS packageBandwidth, a.package_bandwidth AS packageBandwidth,
create_time AS createTime, a.create_time AS createTime,
update_time AS updateTime, a.update_time AS updateTime,
create_by AS createBy, a.create_by AS createBy,
update_by AS updateBy, a.update_by AS updateBy,
client_id AS clientId a.client_id AS clientId
FROM ${tableName} FROM ${tableName} a
INNER JOIN rm_network_interface b ON a.client_id = b.client_id and and a.mac=b.mac_address
AND (b.bind_ip = 1 OR b.bind_ip = 3)
AND b.new_flag = 1
<where> <where>
<if test="serviceSn != '' and serviceSn != null"> <if test="serviceSn != '' and serviceSn != null">
and service_sn = #{serviceSn} and a.service_sn = #{serviceSn}
</if> </if>
<if test="businessId != '' and businessId != null"> <if test="businessId != '' and businessId != null">
and business_id = #{businessId} and a.business_id = #{businessId}
</if> </if>
<if test="clientId != '' and clientId != null"> <if test="clientId != '' and clientId != null">
and client_id = #{clientId} and a.client_id = #{clientId}
</if> </if>
<if test="startTime != null"> <if test="startTime != null">
and create_time &gt;= #{startTime} and a.create_time &gt;= #{startTime}
</if> </if>
<if test="endTime != null"> <if test="endTime != null">
and create_time &lt;= #{endTime} and a.create_time &lt;= #{endTime}
</if> </if>
<if test="revenueMethod != null"> <if test="revenueMethod != null">
and revenue_method = #{revenueMethod} and a.revenue_method = #{revenueMethod}
</if> </if>
</where> </where>
group BY create_time desc GROUP BY a.create_time DESC
</select> </select>
<!-- 条件查询 --> <!-- 条件查询 -->
@@ -270,7 +273,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getTrafficListByClientIds" resultType="EpsInitialTrafficData"> <select id="getTrafficListByClientIds" resultType="EpsInitialTrafficData">
SELECT SELECT
sum(ifnull(out_speed,0)) AS outSpeed, CAST(sum(ifnull(out_speed,0)) AS DECIMAL(20,0)) AS outSpeed,
create_time AS createTime create_time AS createTime
FROM ${tableName} FROM ${tableName}
<where> <where>