单网卡总流量、ipv4流量、ipv6流量合并到一个图

pppoe状态上报增加
This commit is contained in:
gaoyutao
2025-12-30 18:23:09 +08:00
parent 6e2ca8ac53
commit 08680bb46a
20 changed files with 298 additions and 58 deletions
@@ -101,6 +101,8 @@ public class MessageHandler {
private IRmAlarmPushConfigService rmAlarmPushConfigService;
@Autowired
private IRmFrpcConfigManageService rmFrpcConfigManageService;
@Autowired
private IRmPppoeConfigSubService rmPppoeConfigSubService;
/**
@@ -124,6 +126,28 @@ public class MessageHandler {
registerHandler(MsgEnum.心跳上报.getValue(), this::handleHeartbeatMessage);
registerHandler(MsgEnum.多公网IP探测.getValue(), this::handleNetWorkDelectMessage);
registerHandler(MsgEnum.修改frp配置文件应答.getValue(), this::handleUpdateFrpMessage);
registerHandler(MsgEnum.macvlan状态上报.getValue(), this::handleMacvlanMessage);
}
private void handleMacvlanMessage(DeviceMessage message) {
List<MacVlanRspVo> macVlanRspVoList = JsonDataParser.parseJsonData(message.getData(), MacVlanRspVo.class);
if(!macVlanRspVoList.isEmpty()){
MacVlanRspVo macVlanRspVo = macVlanRspVoList.get(0);
// 时间戳转换
long timestamp = macVlanRspVo.getTimestamp();
long millis = timestamp * 1000;
Date createTime = new Date(millis / 1000 * 1000); // 去除毫秒
List<MacVlanRspVo.MacVlanVo> list = macVlanRspVo.getMacVlans();
for (MacVlanRspVo.MacVlanVo macVlanVo : list) {
RmPppoeConfigSub rmPppoeConfigSub = new RmPppoeConfigSub();
rmPppoeConfigSub.setVlanId(Long.valueOf(macVlanVo.getVlanId()));
rmPppoeConfigSub.setSerialNumber(Long.valueOf(macVlanVo.getMid()));
rmPppoeConfigSub.setClientId(message.getClientId());
rmPppoeConfigSub.setStatus(macVlanVo.getStatus());
rmPppoeConfigSub.setUpdateTime(createTime);
rmPppoeConfigSubService.updateRmPppoeConfigSubByVlan(rmPppoeConfigSub);
}
}
}
private void handleUpdateFrpMessage(DeviceMessage message) {
@@ -1143,6 +1167,7 @@ public class MessageHandler {
}
rmNetworkInterfaceService.insertRmNetworkInterface(insertData);
if(childList != null && !childList.isEmpty()){
rmNetworkInterfaceChildService.deleteRmNetworkInterfaceChildByClientId(clientId);
for (NetworkInfo info : childList) {
RmNetworkInterfaceChild insertChild = new RmNetworkInterfaceChild();
setNetworkInterfaceChildData(insertChild, info, clientId, networkInfo.getName());
@@ -1168,6 +1193,7 @@ public class MessageHandler {
boolean needCreateNew = (!StringUtils.equals(networkInfo.getName(), oldInterfaceMsg.getInterfaceName())
|| !StringUtils.equals(networkInfo.getGateway(), oldInterfaceMsg.getGateway())) && StringUtils.equals(networkInfo.getMac(), oldInterfaceMsg.getMacAddress());
if(childList != null && !childList.isEmpty()){
rmNetworkInterfaceChildService.deleteRmNetworkInterfaceChildByClientId(clientId);
for (NetworkInfo info : childList) {
RmNetworkInterfaceChild insertChild = new RmNetworkInterfaceChild();
setNetworkInterfaceChildData(insertChild, info, clientId, networkInfo.getName());