1、增加对象存储初始模块

2、优化出省流量统计展示。
This commit is contained in:
gaoyutao
2026-02-10 18:19:22 +08:00
parent 5b28479625
commit 8cc321bf14
18 changed files with 780 additions and 24 deletions
@@ -43,7 +43,6 @@ import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.Consumer;
@@ -251,11 +250,6 @@ public class MessageHandler {
BigDecimal v4TotalRate = BigDecimal.ZERO;
BigDecimal v6TotalRate = BigDecimal.ZERO;
BigDecimal totalRate = BigDecimal.ZERO;
// 添加时间戳
content.append("时间:").append(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())).append("\n");
int insertPosition = content.length();
int insertPositionV6 = content.length();
// 处理IPv4统计
if (!ipTypeMap.get("IPv4").isEmpty()) {
content.append("##### V4 统计 ##### ##\n");
@@ -296,8 +290,6 @@ public class MessageHandler {
v4TotalRate = v4TotalRate.add(percentage);
}
// 在记录的位置插入总计信息
content.insert(insertPosition, "IPv4总计占比: " + v4TotalRate + "%\n");
insertPositionV6 += ("IPv4总计占比: " + v4TotalRate + "%\n").length(); // 更新插入位置
totalRate = totalRate.add(v4TotalRate);
}
@@ -340,12 +332,8 @@ public class MessageHandler {
content.append(entry.getKey()).append(": ").append(percentage).append("%\n");
v6TotalRate = v6TotalRate.add(percentage);
}
// 在更新后的位置插入IPv6总计
content.insert(insertPositionV6, "IPv6总计占比: " + v6TotalRate + "%\n");
totalRate = totalRate.add(v6TotalRate);
}
// 在更新后的位置插入IPv6总计
content.insert(insertPosition, "总占比: " + totalRate + "%\n");
// 添加总占比
RmResourceRegistrationRemote updateData = new RmResourceRegistrationRemote();
updateData.setClientId(message.getClientId());
@@ -353,6 +341,9 @@ public class MessageHandler {
remoteRevenueConfigService.innerUpdateRegist(updateData, SecurityConstants.INNER);
RmOutboundTrafficStatistics insertData = new RmOutboundTrafficStatistics();
insertData.setClientId(message.getClientId());
insertData.setTotalRate(totalRate);
insertData.setIpv4Rate(v4TotalRate);
insertData.setIpv6Rate(v6TotalRate);
insertData.setDescription(content.toString());
rmOutboundTrafficStatisticsService.insertRmOutboundTrafficStatistics(insertData);
// 查询告警阈值