diff --git a/tongran-modules/tongran-system/src/main/java/com/tongran/system/controller/EpsInitialTrafficDataController.java b/tongran-modules/tongran-system/src/main/java/com/tongran/system/controller/EpsInitialTrafficDataController.java index 1d22c0b..8e7c1b6 100644 --- a/tongran-modules/tongran-system/src/main/java/com/tongran/system/controller/EpsInitialTrafficDataController.java +++ b/tongran-modules/tongran-system/src/main/java/com/tongran/system/controller/EpsInitialTrafficDataController.java @@ -23,7 +23,7 @@ import static com.tongran.common.core.web.domain.AjaxResult.success; @RestController @RequestMapping("/epsTrafficData") @RequiredArgsConstructor -@RequiresPermissions("rocketmq:traffic") +@RequiresPermissions("rocketmq:trafficAnalysis") public class EpsInitialTrafficDataController { private final EpsInitialTrafficDataService epsInitialTrafficDataService; diff --git a/tongran-rocketmq/src/main/java/com/tongran/rocketmq/consumer/RocketMsgListener.java b/tongran-rocketmq/src/main/java/com/tongran/rocketmq/consumer/RocketMsgListener.java index 4bfa1aa..d14fb99 100644 --- a/tongran-rocketmq/src/main/java/com/tongran/rocketmq/consumer/RocketMsgListener.java +++ b/tongran-rocketmq/src/main/java/com/tongran/rocketmq/consumer/RocketMsgListener.java @@ -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(); diff --git a/tongran-rocketmq/src/main/java/com/tongran/rocketmq/service/impl/InitialBandwidthTrafficServiceImpl.java b/tongran-rocketmq/src/main/java/com/tongran/rocketmq/service/impl/InitialBandwidthTrafficServiceImpl.java index be4b918..1c90930 100644 --- a/tongran-rocketmq/src/main/java/com/tongran/rocketmq/service/impl/InitialBandwidthTrafficServiceImpl.java +++ b/tongran-rocketmq/src/main/java/com/tongran/rocketmq/service/impl/InitialBandwidthTrafficServiceImpl.java @@ -253,8 +253,12 @@ public class InitialBandwidthTrafficServiceImpl implements IInitialBandwidthTraf // 展示关系 Map 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 sortedShowRealation = EchartsMoreDataUtils.sortInterfaceMap(showRealation, name, hasSubInterface); @@ -434,8 +438,12 @@ public class InitialBandwidthTrafficServiceImpl implements IInitialBandwidthTraf // 展示关系 Map 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 sortedShowRealation = EchartsMoreDataUtils.sortInterfaceMap(showRealation, name, hasSubInterface); resultMap.put("showRealation", sortedShowRealation); @@ -514,8 +523,12 @@ public class InitialBandwidthTrafficServiceImpl implements IInitialBandwidthTraf // 展示关系 Map 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 sortedShowRealation = EchartsMoreDataUtils.sortInterfaceMap(showRealation, name, hasSubInterface); resultMap.put("showRealation", sortedShowRealation); @@ -647,8 +660,12 @@ public class InitialBandwidthTrafficServiceImpl implements IInitialBandwidthTraf // 展示关系 Map 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 sortedShowRealation = EchartsMoreDataUtils.sortInterfaceMap(showRealation, name, hasSubInterface); resultMap.put("showRealation", sortedShowRealation); diff --git a/tongran-rocketmq/src/main/java/com/tongran/rocketmq/service/impl/RmPppoeConfigMainServiceImpl.java b/tongran-rocketmq/src/main/java/com/tongran/rocketmq/service/impl/RmPppoeConfigMainServiceImpl.java index 58eb71f..3263b49 100644 --- a/tongran-rocketmq/src/main/java/com/tongran/rocketmq/service/impl/RmPppoeConfigMainServiceImpl.java +++ b/tongran-rocketmq/src/main/java/com/tongran/rocketmq/service/impl/RmPppoeConfigMainServiceImpl.java @@ -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 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 subList = rmPppoeConfigMain.getSubList(); + List 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 voList = subList.stream() - .map(RmPppoeConfigSub::toVo) - .collect(Collectors.toList()); pppoeVo.setSubList(voList); String pppoeStr = JSONObject.toJSONString(pppoeVo); PolicyTypeVo policyTypeVo = new PolicyTypeVo(); diff --git a/tongran-rocketmq/src/main/resources/mapper/rocketmq/RmNetworkInterfaceChildMapper.xml b/tongran-rocketmq/src/main/resources/mapper/rocketmq/RmNetworkInterfaceChildMapper.xml index cb742d1..025519b 100644 --- a/tongran-rocketmq/src/main/resources/mapper/rocketmq/RmNetworkInterfaceChildMapper.xml +++ b/tongran-rocketmq/src/main/resources/mapper/rocketmq/RmNetworkInterfaceChildMapper.xml @@ -35,7 +35,7 @@ and client_id = #{clientId} - and parent_interface = #{parentInterface} + and parent_interface = #{parentInterface} and ipv4_address != '' and ipv4_address != 'N/A' and isp = #{isp} and province = #{province} and city = #{city} diff --git a/tongran-rocketmq/src/main/resources/mapper/rocketmq/RmPppoeConfigSubMapper.xml b/tongran-rocketmq/src/main/resources/mapper/rocketmq/RmPppoeConfigSubMapper.xml index b3aa8a4..a787509 100644 --- a/tongran-rocketmq/src/main/resources/mapper/rocketmq/RmPppoeConfigSubMapper.xml +++ b/tongran-rocketmq/src/main/resources/mapper/rocketmq/RmPppoeConfigSubMapper.xml @@ -37,9 +37,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" a.update_time updateTime, a.create_by createBy, a.update_by updateBy, - a.status status, - b.mac_address macAddress, - b.status virStatus + b.status status, + b.mac_address macAddress FROM rm_pppoe_config_sub a LEFT JOIN