优化pppoe数据处理
流量图改为只保留有ipv4的流量网卡流量。 流量图增加显示对应的ipv4。
This commit is contained in:
@@ -16,6 +16,7 @@ import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -45,7 +46,8 @@ public class RocketMsgListener implements MessageListenerConcurrently {
|
||||
//获取topic
|
||||
for (MessageExt messageExt : list) {
|
||||
// 解析消息内容
|
||||
String body = new String(messageExt.getBody());
|
||||
// 明确指定UTF-8编码
|
||||
String body = new String(messageExt.getBody(), StandardCharsets.UTF_8);
|
||||
log.info("接受到的消息为:{}", body);
|
||||
String tags = messageExt.getTags();
|
||||
String topic = messageExt.getTopic();
|
||||
|
||||
+45
-28
@@ -253,8 +253,12 @@ public class InitialBandwidthTrafficServiceImpl implements IInitialBandwidthTraf
|
||||
// 展示关系
|
||||
Map<String, String> showRealation = new HashMap<>();
|
||||
interfaceDataMap.put(name, mainList);
|
||||
showRealation.put(name+"netInTraffic", name+"入站流量");
|
||||
showRealation.put(name+"netOutTraffic", name+"出站流量");
|
||||
String ipv4 = "";
|
||||
if(mainList != null && !mainList.isEmpty()){
|
||||
ipv4 = mainList.get(0).getIpV4();
|
||||
}
|
||||
showRealation.put(name+"netInTraffic", name+"入站流量" + " IPv4: "+ipv4);
|
||||
showRealation.put(name+"netOutTraffic", name+"出站流量" + " IPv4: "+ipv4);
|
||||
boolean hasSubInterface = false;
|
||||
boolean needAddIpv4Ipv6 = false; // 标记是否需要添加IPv4和IPv6数据
|
||||
|
||||
@@ -274,17 +278,17 @@ public class InitialBandwidthTrafficServiceImpl implements IInitialBandwidthTraf
|
||||
|
||||
if(childTrafficList != null && !childTrafficList.isEmpty()){
|
||||
interfaceDataMap.put(child.getInterfaceName(), childTrafficList);
|
||||
showRealation.put(child.getInterfaceName()+"netInTraffic", child.getInterfaceName()+"入站流量");
|
||||
showRealation.put(child.getInterfaceName()+"netOutTraffic", child.getInterfaceName()+"出站流量");
|
||||
showRealation.put(child.getInterfaceName()+"netInTraffic", child.getInterfaceName() + "入站流量" + " IPv4: "+child.getIpv4Address());
|
||||
showRealation.put(child.getInterfaceName()+"netOutTraffic", child.getInterfaceName() + "出站流量" + " IPv4: "+child.getIpv4Address());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 将ipv4和ipv6的线也集合过来 - 只有在没有子网卡时才添加
|
||||
needAddIpv4Ipv6 = true;
|
||||
showRealation.put(name+"netInTrafficIPv4", name+"IPv4入站流量");
|
||||
showRealation.put(name+"netOutTrafficIPv4", name+"IPv4出站流量");
|
||||
showRealation.put(name+"netInTrafficIPv6", name+"IPv6入站流量");
|
||||
showRealation.put(name+"netOutTrafficIPv6", name+"IPv6出站流量");
|
||||
showRealation.put(name+"netInTrafficIPv4", name+"IPv4入站流量" + " IPv4: "+ipv4);
|
||||
showRealation.put(name+"netOutTrafficIPv4", name+"IPv4出站流量" + " IPv4: "+ipv4);
|
||||
showRealation.put(name+"netInTrafficIPv6", name+"IPv6入站流量" + " IPv4: "+ipv4);
|
||||
showRealation.put(name+"netOutTrafficIPv6", name+"IPv6出站流量" + " IPv4: "+ipv4);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,8 +381,8 @@ public class InitialBandwidthTrafficServiceImpl implements IInitialBandwidthTraf
|
||||
}
|
||||
|
||||
if(!showRealation.isEmpty() && hasSubInterface){
|
||||
showRealation.put("totalNetInTraffic", name+"总入站流量");
|
||||
showRealation.put("totalNetOutTraffic", name+"总出站流量");
|
||||
showRealation.put("totalNetInTraffic", name+"总入站流量" + " IPv4: "+ipv4);
|
||||
showRealation.put("totalNetOutTraffic", name+"总出站流量" + " IPv4: "+ipv4);
|
||||
}
|
||||
|
||||
Map<String, String> sortedShowRealation = EchartsMoreDataUtils.sortInterfaceMap(showRealation, name, hasSubInterface);
|
||||
@@ -434,8 +438,12 @@ public class InitialBandwidthTrafficServiceImpl implements IInitialBandwidthTraf
|
||||
// 展示关系
|
||||
Map<String, String> showRealation = new HashMap<>();
|
||||
interfaceDataMap.put(name, mainList);
|
||||
showRealation.put(name + "netInTraffic", name + "IPv4入站流量");
|
||||
showRealation.put(name + "netOutTraffic", name + "IPv4出站流量");
|
||||
String ipv4 = "";
|
||||
if(mainList != null && !mainList.isEmpty()){
|
||||
ipv4 = mainList.get(0).getIpV4();
|
||||
}
|
||||
showRealation.put(name + "netInTraffic", name + "IPv4入站流量" + " IPv4: "+ipv4);
|
||||
showRealation.put(name + "netOutTraffic", name + "IPv4出站流量" + " IPv4: "+ipv4);
|
||||
boolean hasSubInterface = false;
|
||||
|
||||
// 如果是Ethernet类型,查询子网卡
|
||||
@@ -454,8 +462,9 @@ public class InitialBandwidthTrafficServiceImpl implements IInitialBandwidthTraf
|
||||
|
||||
if (childTrafficList != null && !childTrafficList.isEmpty()) {
|
||||
interfaceDataMap.put(child.getInterfaceName(), childTrafficList);
|
||||
showRealation.put(child.getInterfaceName() + "netInTraffic", child.getInterfaceName() + "IPv4入站流量");
|
||||
showRealation.put(child.getInterfaceName() + "netOutTraffic", child.getInterfaceName() + "IPv4出站流量");
|
||||
showRealation.put(child.getInterfaceName() + "netInTraffic", child.getInterfaceName() + "IPv4入站流量" + " IPv4: "+child.getIpv4Address());
|
||||
showRealation.put(child.getInterfaceName() + "netOutTraffic", child.getInterfaceName() + "IPv4出站流量" + " IPv4: "+child.getIpv4Address());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -484,8 +493,8 @@ public class InitialBandwidthTrafficServiceImpl implements IInitialBandwidthTraf
|
||||
|
||||
resultMap.put("unit", unit);
|
||||
if (!showRealation.isEmpty() && hasSubInterface) {
|
||||
showRealation.put("totalNetInTraffic", name + "IPv4总入站流量");
|
||||
showRealation.put("totalNetOutTraffic", name + "IPv4总出站流量");
|
||||
showRealation.put("totalNetInTraffic", name + "IPv4总入站流量" + " IPv4: "+ipv4);
|
||||
showRealation.put("totalNetOutTraffic", name + "IPv4总出站流量" + " IPv4: "+ipv4);
|
||||
}
|
||||
Map<String, String> sortedShowRealation = EchartsMoreDataUtils.sortInterfaceMap(showRealation, name, hasSubInterface);
|
||||
resultMap.put("showRealation", sortedShowRealation);
|
||||
@@ -514,8 +523,12 @@ public class InitialBandwidthTrafficServiceImpl implements IInitialBandwidthTraf
|
||||
// 展示关系
|
||||
Map<String, String> showRealation = new HashMap<>();
|
||||
interfaceDataMap.put(name, mainList);
|
||||
showRealation.put(name + "netInTraffic", name + "IPv6入站流量");
|
||||
showRealation.put(name + "netOutTraffic", name + "IPv6出站流量");
|
||||
String ipv4 = "";
|
||||
if(mainList != null && !mainList.isEmpty()){
|
||||
ipv4 = mainList.get(0).getIpV4();
|
||||
}
|
||||
showRealation.put(name + "netInTraffic", name + "IPv6入站流量" + " IPv4: "+ipv4);
|
||||
showRealation.put(name + "netOutTraffic", name + "IPv6出站流量" + " IPv4: "+ipv4);
|
||||
boolean hasSubInterface = false;
|
||||
|
||||
// 如果是Ethernet类型,查询子网卡
|
||||
@@ -534,8 +547,8 @@ public class InitialBandwidthTrafficServiceImpl implements IInitialBandwidthTraf
|
||||
|
||||
if (childTrafficList != null && !childTrafficList.isEmpty()) {
|
||||
interfaceDataMap.put(child.getInterfaceName(), childTrafficList);
|
||||
showRealation.put(child.getInterfaceName() + "netInTraffic", child.getInterfaceName() + "IPv6入站流量");
|
||||
showRealation.put(child.getInterfaceName() + "netOutTraffic", child.getInterfaceName() + "IPv6出站流量");
|
||||
showRealation.put(child.getInterfaceName() + "netInTraffic", child.getInterfaceName() + "IPv6入站流量" + " IPv4: "+child.getIpv4Address());
|
||||
showRealation.put(child.getInterfaceName() + "netOutTraffic", child.getInterfaceName() + "IPv6出站流量" + " IPv4: "+child.getIpv4Address());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -564,8 +577,8 @@ public class InitialBandwidthTrafficServiceImpl implements IInitialBandwidthTraf
|
||||
|
||||
resultMap.put("unit", unit);
|
||||
if (!showRealation.isEmpty() && hasSubInterface) {
|
||||
showRealation.put("totalNetInTraffic", name + "IPv6总入站流量");
|
||||
showRealation.put("totalNetOutTraffic", name + "IPv6总出站流量");
|
||||
showRealation.put("totalNetInTraffic", name + "IPv6总入站流量" + " IPv4: "+ipv4);
|
||||
showRealation.put("totalNetOutTraffic", name + "IPv6总出站流量" + " IPv4: "+ipv4);
|
||||
}
|
||||
Map<String, String> sortedShowRealation = EchartsMoreDataUtils.sortInterfaceMap(showRealation, name, hasSubInterface);
|
||||
resultMap.put("showRealation", sortedShowRealation);
|
||||
@@ -647,8 +660,12 @@ public class InitialBandwidthTrafficServiceImpl implements IInitialBandwidthTraf
|
||||
// 展示关系
|
||||
Map<String, String> showRealation = new HashMap<>();
|
||||
interfaceDataMap.put(name, mainList);
|
||||
showRealation.put(name + "netInTraffic", name + "入站流量");
|
||||
showRealation.put(name + "netOutTraffic", name + "出站流量");
|
||||
String ipv4 = "";
|
||||
if(mainList != null && !mainList.isEmpty()){
|
||||
ipv4 = mainList.get(0).getIpV4();
|
||||
}
|
||||
showRealation.put(name + "netInTraffic", name + "入站流量" + " IPv4: "+ipv4);
|
||||
showRealation.put(name + "netOutTraffic", name + "出站流量" + " IPv4: "+ipv4);
|
||||
boolean hasSubInterface = false;
|
||||
|
||||
// 如果是Ethernet类型,查询子网卡
|
||||
@@ -667,8 +684,8 @@ public class InitialBandwidthTrafficServiceImpl implements IInitialBandwidthTraf
|
||||
|
||||
if (childTrafficList != null && !childTrafficList.isEmpty()) {
|
||||
interfaceDataMap.put(child.getInterfaceName(), childTrafficList);
|
||||
showRealation.put(child.getInterfaceName() + "netInTraffic", child.getInterfaceName() + "入站流量");
|
||||
showRealation.put(child.getInterfaceName() + "netOutTraffic", child.getInterfaceName() + "出站流量");
|
||||
showRealation.put(child.getInterfaceName() + "netInTraffic", child.getInterfaceName() + "入站流量" + " IPv4: "+child.getIpv4Address());
|
||||
showRealation.put(child.getInterfaceName() + "netOutTraffic", child.getInterfaceName() + "出站流量" + " IPv4: "+child.getIpv4Address());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -697,8 +714,8 @@ public class InitialBandwidthTrafficServiceImpl implements IInitialBandwidthTraf
|
||||
|
||||
resultMap.put("unit", unit);
|
||||
if (!showRealation.isEmpty() && hasSubInterface) {
|
||||
showRealation.put("totalNetInTraffic", name + "总入站流量");
|
||||
showRealation.put("totalNetOutTraffic", name + "总出站流量");
|
||||
showRealation.put("totalNetInTraffic", name + "总入站流量" + " IPv4: "+ipv4);
|
||||
showRealation.put("totalNetOutTraffic", name + "总出站流量" + " IPv4: "+ipv4);
|
||||
}
|
||||
Map<String, String> sortedShowRealation = EchartsMoreDataUtils.sortInterfaceMap(showRealation, name, hasSubInterface);
|
||||
resultMap.put("showRealation", sortedShowRealation);
|
||||
|
||||
+5
-10
@@ -18,6 +18,7 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -48,13 +49,6 @@ public class RmPppoeConfigMainServiceImpl implements IRmPppoeConfigMainService
|
||||
RmPppoeConfigSub rmPppoeConfigSub = new RmPppoeConfigSub();
|
||||
rmPppoeConfigSub.setClientId(rmPppoeConfigMain.getClientId());
|
||||
List<RmPppoeConfigSub> subList = rmPppoeConfigSubMapper.selectRmPppoeConfigSubList(rmPppoeConfigSub);
|
||||
if(subList != null && !subList.isEmpty()){
|
||||
for (RmPppoeConfigSub pppoeConfigSub : subList) {
|
||||
if(pppoeConfigSub.getStatus() == null){
|
||||
pppoeConfigSub.setStatus(pppoeConfigSub.getVirStatus());
|
||||
}
|
||||
}
|
||||
}
|
||||
pppoeConfigMain.setSubList(subList);
|
||||
return pppoeConfigMain;
|
||||
}
|
||||
@@ -83,6 +77,7 @@ public class RmPppoeConfigMainServiceImpl implements IRmPppoeConfigMainService
|
||||
rmPppoeConfigMain.setCreateTime(DateUtils.getNowDate());
|
||||
int rows = rmPppoeConfigMainMapper.insertRmPppoeConfigMain(rmPppoeConfigMain);
|
||||
List<RmPppoeConfigSub> subList = rmPppoeConfigMain.getSubList();
|
||||
List<RmPppoeConfigSubVo> voList = new ArrayList<>();
|
||||
if(subList != null && !subList.isEmpty()){
|
||||
for (RmPppoeConfigSub rmPppoeConfigSub : subList) {
|
||||
rmPppoeConfigSub.setClientId(rmPppoeConfigMain.getClientId());
|
||||
@@ -93,13 +88,13 @@ public class RmPppoeConfigMainServiceImpl implements IRmPppoeConfigMainService
|
||||
rmPppoeConfigSubMapper.deleteRmPppoeConfigSubByClientId(rmPppoeConfigMain.getClientId());
|
||||
// 批量新增
|
||||
rmPppoeConfigSubMapper.batchInsertRmPppoeConfigSub(subList);
|
||||
voList = subList.stream()
|
||||
.map(RmPppoeConfigSub::toVo)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
// 构建pppoe策略
|
||||
PppoeVo pppoeVo = new PppoeVo();
|
||||
BeanUtils.copyProperties(rmPppoeConfigMain, pppoeVo);
|
||||
List<RmPppoeConfigSubVo> voList = subList.stream()
|
||||
.map(RmPppoeConfigSub::toVo)
|
||||
.collect(Collectors.toList());
|
||||
pppoeVo.setSubList(voList);
|
||||
String pppoeStr = JSONObject.toJSONString(pppoeVo);
|
||||
PolicyTypeVo policyTypeVo = new PolicyTypeVo();
|
||||
|
||||
Reference in New Issue
Block a user