月均日95值计算方式新增1024,资源监控模块接口新增
This commit is contained in:
		@@ -89,8 +89,10 @@ public class TableScheduleConfig {
 | 
				
			|||||||
                .thenRun(() -> calculateServerMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1024"))
 | 
					                .thenRun(() -> calculateServerMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1024"))
 | 
				
			||||||
                .thenRun(() -> calculateSwitchMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1000"))
 | 
					                .thenRun(() -> calculateSwitchMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1000"))
 | 
				
			||||||
                .thenRun(() -> calculateSwitchMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1024"))
 | 
					                .thenRun(() -> calculateSwitchMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1024"))
 | 
				
			||||||
                .thenRun(() -> calculateServerAvgMonthlyBandwidth(monthlyStartTime, monthlyEndTime))
 | 
					                .thenRun(() -> calculateServerAvgMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1000"))
 | 
				
			||||||
                .thenRun(() -> calculateSwitchAvgMonthlyBandwidth(monthlyStartTime, monthlyEndTime))
 | 
					                .thenRun(() -> calculateServerAvgMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1024"))
 | 
				
			||||||
 | 
					                .thenRun(() -> calculateSwitchAvgMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1000"))
 | 
				
			||||||
 | 
					                .thenRun(() -> calculateSwitchAvgMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1024"))
 | 
				
			||||||
                .exceptionally(e -> {
 | 
					                .exceptionally(e -> {
 | 
				
			||||||
                    log.error("月度带宽计算链执行异常", e); // 仅保留最终异常捕获
 | 
					                    log.error("月度带宽计算链执行异常", e); // 仅保留最终异常捕获
 | 
				
			||||||
                    return null;
 | 
					                    return null;
 | 
				
			||||||
@@ -145,7 +147,7 @@ public class TableScheduleConfig {
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 计算服务器月平均95带宽值
 | 
					     * 计算服务器月平均95带宽值
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private void calculateServerAvgMonthlyBandwidth(String monthlyStartTime, String monthlyEndTime) {
 | 
					    private void calculateServerAvgMonthlyBandwidth(String monthlyStartTime, String monthlyEndTime, String calculationMode) {
 | 
				
			||||||
        log.info("开始计算服务器月平均95带宽值...");
 | 
					        log.info("开始计算服务器月平均95带宽值...");
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            EpsNodeBandwidth epsNodeBandwidth = new EpsNodeBandwidth();
 | 
					            EpsNodeBandwidth epsNodeBandwidth = new EpsNodeBandwidth();
 | 
				
			||||||
@@ -154,7 +156,7 @@ public class TableScheduleConfig {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            List<AllInterfaceName> snList = allInterfaceNameService.getAllDeviceSn(new AllInterfaceName());
 | 
					            List<AllInterfaceName> snList = allInterfaceNameService.getAllDeviceSn(new AllInterfaceName());
 | 
				
			||||||
            for (AllInterfaceName allInterfaceName : snList) {
 | 
					            for (AllInterfaceName allInterfaceName : snList) {
 | 
				
			||||||
                processServerAvgBandwidth(epsNodeBandwidth, allInterfaceName);
 | 
					                processServerAvgBandwidth(epsNodeBandwidth, allInterfaceName, calculationMode);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            log.info("服务器月平均95带宽值计算完成");
 | 
					            log.info("服务器月平均95带宽值计算完成");
 | 
				
			||||||
        } catch (Exception e) {
 | 
					        } catch (Exception e) {
 | 
				
			||||||
@@ -165,7 +167,7 @@ public class TableScheduleConfig {
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 处理单个服务器的平均带宽计算
 | 
					     * 处理单个服务器的平均带宽计算
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private void processServerAvgBandwidth(EpsNodeBandwidth epsNodeBandwidth, AllInterfaceName allInterfaceName) {
 | 
					    private void processServerAvgBandwidth(EpsNodeBandwidth epsNodeBandwidth, AllInterfaceName allInterfaceName, String calculationMode) {
 | 
				
			||||||
        final String deviceSn = allInterfaceName.getDeviceSn();
 | 
					        final String deviceSn = allInterfaceName.getDeviceSn();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
@@ -216,6 +218,7 @@ public class TableScheduleConfig {
 | 
				
			|||||||
                        // 创建业务带宽对象
 | 
					                        // 创建业务带宽对象
 | 
				
			||||||
                        EpsNodeBandwidth bandwidthWithBiz = new EpsNodeBandwidth();
 | 
					                        EpsNodeBandwidth bandwidthWithBiz = new EpsNodeBandwidth();
 | 
				
			||||||
                        bandwidthWithBiz.setHardwareSn(deviceSn);
 | 
					                        bandwidthWithBiz.setHardwareSn(deviceSn);
 | 
				
			||||||
 | 
					                        bandwidthWithBiz.setCalculationMode(calculationMode);
 | 
				
			||||||
                        bandwidthWithBiz.setNodeName(serverConfig.getNodeName());
 | 
					                        bandwidthWithBiz.setNodeName(serverConfig.getNodeName());
 | 
				
			||||||
                        bandwidthWithBiz.setStartTime(epsNodeBandwidth.getStartTime());
 | 
					                        bandwidthWithBiz.setStartTime(epsNodeBandwidth.getStartTime());
 | 
				
			||||||
                        bandwidthWithBiz.setEndTime(epsNodeBandwidth.getEndTime());
 | 
					                        bandwidthWithBiz.setEndTime(epsNodeBandwidth.getEndTime());
 | 
				
			||||||
@@ -244,6 +247,7 @@ public class TableScheduleConfig {
 | 
				
			|||||||
            // 5. 处理正常情况(无业务变更或无需处理变更)
 | 
					            // 5. 处理正常情况(无业务变更或无需处理变更)
 | 
				
			||||||
            EpsNodeBandwidth normalBandwidth = new EpsNodeBandwidth();
 | 
					            EpsNodeBandwidth normalBandwidth = new EpsNodeBandwidth();
 | 
				
			||||||
            normalBandwidth.setHardwareSn(deviceSn);
 | 
					            normalBandwidth.setHardwareSn(deviceSn);
 | 
				
			||||||
 | 
					            normalBandwidth.setCalculationMode(calculationMode);
 | 
				
			||||||
            normalBandwidth.setNodeName(serverConfig.getNodeName());
 | 
					            normalBandwidth.setNodeName(serverConfig.getNodeName());
 | 
				
			||||||
            normalBandwidth.setStartTime(epsNodeBandwidth.getStartTime());
 | 
					            normalBandwidth.setStartTime(epsNodeBandwidth.getStartTime());
 | 
				
			||||||
            normalBandwidth.setEndTime(epsNodeBandwidth.getEndTime());
 | 
					            normalBandwidth.setEndTime(epsNodeBandwidth.getEndTime());
 | 
				
			||||||
@@ -260,7 +264,7 @@ public class TableScheduleConfig {
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 计算交换机月平均95带宽值
 | 
					     * 计算交换机月平均95带宽值
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private void calculateSwitchAvgMonthlyBandwidth(String monthlyStartTime, String monthlyEndTime) {
 | 
					    private void calculateSwitchAvgMonthlyBandwidth(String monthlyStartTime, String monthlyEndTime, String calculationMode) {
 | 
				
			||||||
        log.info("开始计算交换机月平均95带宽值...");
 | 
					        log.info("开始计算交换机月平均95带宽值...");
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            EpsNodeBandwidth epsNodeBandwidth = new EpsNodeBandwidth();
 | 
					            EpsNodeBandwidth epsNodeBandwidth = new EpsNodeBandwidth();
 | 
				
			||||||
@@ -269,7 +273,7 @@ public class TableScheduleConfig {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            List<AllInterfaceName> switchSnList = allInterfaceNameService.getAllSwitchSn(new AllInterfaceName());
 | 
					            List<AllInterfaceName> switchSnList = allInterfaceNameService.getAllSwitchSn(new AllInterfaceName());
 | 
				
			||||||
            for (AllInterfaceName switchSnMsg : switchSnList) {
 | 
					            for (AllInterfaceName switchSnMsg : switchSnList) {
 | 
				
			||||||
                processSwitchAvgBandwidth(epsNodeBandwidth, switchSnMsg);
 | 
					                processSwitchAvgBandwidth(epsNodeBandwidth, switchSnMsg, calculationMode);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            log.info("交换机月平均95带宽值计算完成");
 | 
					            log.info("交换机月平均95带宽值计算完成");
 | 
				
			||||||
        } catch (Exception e) {
 | 
					        } catch (Exception e) {
 | 
				
			||||||
@@ -280,7 +284,7 @@ public class TableScheduleConfig {
 | 
				
			|||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 处理单个交换机的平均带宽计算
 | 
					     * 处理单个交换机的平均带宽计算
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private void processSwitchAvgBandwidth(EpsNodeBandwidth epsNodeBandwidth, AllInterfaceName switchSnMsg) {
 | 
					    private void processSwitchAvgBandwidth(EpsNodeBandwidth epsNodeBandwidth, AllInterfaceName switchSnMsg, String calculationMode) {
 | 
				
			||||||
        final String switchSn = switchSnMsg.getSwitchSn();
 | 
					        final String switchSn = switchSnMsg.getSwitchSn();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
@@ -346,6 +350,7 @@ public class TableScheduleConfig {
 | 
				
			|||||||
                            // 创建业务带宽对象
 | 
					                            // 创建业务带宽对象
 | 
				
			||||||
                            EpsNodeBandwidth bandwidthWithBiz = new EpsNodeBandwidth();
 | 
					                            EpsNodeBandwidth bandwidthWithBiz = new EpsNodeBandwidth();
 | 
				
			||||||
                            bandwidthWithBiz.setSwitchSn(switchSn);
 | 
					                            bandwidthWithBiz.setSwitchSn(switchSn);
 | 
				
			||||||
 | 
					                            bandwidthWithBiz.setCalculationMode(calculationMode);
 | 
				
			||||||
                            bandwidthWithBiz.setInterfaceName(topology.getInterfaceName());
 | 
					                            bandwidthWithBiz.setInterfaceName(topology.getInterfaceName());
 | 
				
			||||||
                            bandwidthWithBiz.setHardwareSn(serverSn);
 | 
					                            bandwidthWithBiz.setHardwareSn(serverSn);
 | 
				
			||||||
                            bandwidthWithBiz.setNodeName(topology.getServerName());
 | 
					                            bandwidthWithBiz.setNodeName(topology.getServerName());
 | 
				
			||||||
@@ -377,6 +382,7 @@ public class TableScheduleConfig {
 | 
				
			|||||||
                    // 5. 处理普通情况(无变更记录)
 | 
					                    // 5. 处理普通情况(无变更记录)
 | 
				
			||||||
                    EpsNodeBandwidth normalBandwidth = new EpsNodeBandwidth();
 | 
					                    EpsNodeBandwidth normalBandwidth = new EpsNodeBandwidth();
 | 
				
			||||||
                    normalBandwidth.setSwitchSn(switchSn);
 | 
					                    normalBandwidth.setSwitchSn(switchSn);
 | 
				
			||||||
 | 
					                    normalBandwidth.setCalculationMode(calculationMode);
 | 
				
			||||||
                    normalBandwidth.setInterfaceName(topology.getInterfaceName());
 | 
					                    normalBandwidth.setInterfaceName(topology.getInterfaceName());
 | 
				
			||||||
                    normalBandwidth.setHardwareSn(topology.getServerSn());
 | 
					                    normalBandwidth.setHardwareSn(topology.getServerSn());
 | 
				
			||||||
                    normalBandwidth.setNodeName(topology.getServerName());
 | 
					                    normalBandwidth.setNodeName(topology.getServerName());
 | 
				
			||||||
@@ -394,6 +400,7 @@ public class TableScheduleConfig {
 | 
				
			|||||||
            // 5. 处理机房出口情况
 | 
					            // 5. 处理机房出口情况
 | 
				
			||||||
            EpsNodeBandwidth normalBandwidth = new EpsNodeBandwidth();
 | 
					            EpsNodeBandwidth normalBandwidth = new EpsNodeBandwidth();
 | 
				
			||||||
            normalBandwidth.setSwitchSn(switchSn);
 | 
					            normalBandwidth.setSwitchSn(switchSn);
 | 
				
			||||||
 | 
					            normalBandwidth.setCalculationMode(calculationMode);
 | 
				
			||||||
            normalBandwidth.setInterfaceName(topology.getInterfaceName());
 | 
					            normalBandwidth.setInterfaceName(topology.getInterfaceName());
 | 
				
			||||||
            normalBandwidth.setInterfaceLinkDeviceType(topology.getConnectedDeviceType());
 | 
					            normalBandwidth.setInterfaceLinkDeviceType(topology.getConnectedDeviceType());
 | 
				
			||||||
            normalBandwidth.setStartTime(epsNodeBandwidth.getStartTime());
 | 
					            normalBandwidth.setStartTime(epsNodeBandwidth.getStartTime());
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,67 @@
 | 
				
			|||||||
 | 
					package com.ruoyi.system.controller;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.ruoyi.common.core.web.controller.BaseController;
 | 
				
			||||||
 | 
					import com.ruoyi.common.core.web.domain.AjaxResult;
 | 
				
			||||||
 | 
					import com.ruoyi.common.core.web.page.PageDomain;
 | 
				
			||||||
 | 
					import com.ruoyi.common.core.web.page.TableDataInfo;
 | 
				
			||||||
 | 
					import com.ruoyi.system.domain.RmResourceGroup;
 | 
				
			||||||
 | 
					import com.ruoyi.system.domain.RmResourceRegistration;
 | 
				
			||||||
 | 
					import com.ruoyi.system.service.EpsInitialTrafficDataService;
 | 
				
			||||||
 | 
					import com.ruoyi.system.service.IRmResourceGroupService;
 | 
				
			||||||
 | 
					import com.ruoyi.system.service.IRmResourceRegistrationService;
 | 
				
			||||||
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 资源监控API
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @author gyt
 | 
				
			||||||
 | 
					 * @date 2025-08-25
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@RestController
 | 
				
			||||||
 | 
					@RequestMapping("/resourceMonitor")
 | 
				
			||||||
 | 
					public class ResourceMonitorController extends BaseController
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    @Autowired
 | 
				
			||||||
 | 
					    private EpsInitialTrafficDataService epsInitialTrafficDataService;
 | 
				
			||||||
 | 
					    @Autowired
 | 
				
			||||||
 | 
					    private IRmResourceGroupService rmResourceGroupService;
 | 
				
			||||||
 | 
					    @Autowired
 | 
				
			||||||
 | 
					    private IRmResourceRegistrationService rmResourceRegistrationService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 获取资源分组列表
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @GetMapping("resourceGroupList")
 | 
				
			||||||
 | 
					    public AjaxResult resourceGroupList(){
 | 
				
			||||||
 | 
					        RmResourceGroup rmResourceGroup = new RmResourceGroup();
 | 
				
			||||||
 | 
					        return success(rmResourceGroupService.selectRmResourceGroupList(rmResourceGroup));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 服务器整体发送带宽利用率
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @GetMapping("trafficRateByServer")
 | 
				
			||||||
 | 
					    public AjaxResult trafficRateByServer(){
 | 
				
			||||||
 | 
					        return success(epsInitialTrafficDataService.trafficRateByServer());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 获取资源列表
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @PostMapping("getRegisterListByGroupId")
 | 
				
			||||||
 | 
					    public TableDataInfo getRegisterListByGroupId(@RequestBody RmResourceGroup rmResourceGroup){
 | 
				
			||||||
 | 
					        // 拿到注册信息
 | 
				
			||||||
 | 
					        PageDomain pageDomain = new PageDomain();
 | 
				
			||||||
 | 
					        pageDomain.setPageNum(rmResourceGroup.getPageNum());
 | 
				
			||||||
 | 
					        pageDomain.setPageSize(rmResourceGroup.getPageSize());
 | 
				
			||||||
 | 
					        startPage(pageDomain);
 | 
				
			||||||
 | 
					        List<RmResourceRegistration> list = rmResourceGroupService.getRegisterList(rmResourceGroup);
 | 
				
			||||||
 | 
					        return getDataTable(list);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -329,6 +329,24 @@ public class EpsNodeBandwidthServiceImpl implements IEpsNodeBandwidthService
 | 
				
			|||||||
            ));
 | 
					            ));
 | 
				
			||||||
            mapList.add(nodeData);
 | 
					            mapList.add(nodeData);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					        if("2".equals(epsNodeBandwidth.getResourceType())){
 | 
				
			||||||
 | 
					            // 按interfaceName 升序(处理 null 值)
 | 
				
			||||||
 | 
					            mapList.sort((map1, map2) -> {
 | 
				
			||||||
 | 
					                // 按 interfaceName 升序(处理 null 值)
 | 
				
			||||||
 | 
					                String interfaceName1 = (String) map1.get("interfaceName");
 | 
				
			||||||
 | 
					                String interfaceName2 = (String) map2.get("interfaceName");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (interfaceName1 == null && interfaceName2 == null) {
 | 
				
			||||||
 | 
					                    return 0; // 两者都为 null,视为相等
 | 
				
			||||||
 | 
					                } else if (interfaceName1 == null) {
 | 
				
			||||||
 | 
					                    return -1; // null 排在前面(升序)
 | 
				
			||||||
 | 
					                } else if (interfaceName2 == null) {
 | 
				
			||||||
 | 
					                    return 1; // null 排在前面(升序)
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    return interfaceName1.compareTo(interfaceName2); // 正常比较
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        return mapList;
 | 
					        return mapList;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -457,6 +457,7 @@ public class InitialSwitchInfoDetailsServiceImpl implements IInitialSwitchInfoDe
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                if("2".equals(rmEpsTopologyManagement.getConnectedDeviceType())){
 | 
					                if("2".equals(rmEpsTopologyManagement.getConnectedDeviceType())){
 | 
				
			||||||
 | 
					                    queryParam.setServerSn(null);
 | 
				
			||||||
                    calculateNormalSwitchBandwidth(queryParam, dailyStartTime, dailyEndTime, calculationMode);
 | 
					                    calculateNormalSwitchBandwidth(queryParam, dailyStartTime, dailyEndTime, calculationMode);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -248,6 +248,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
				
			|||||||
            <if test="businessId != '' and businessId != null">
 | 
					            <if test="businessId != '' and businessId != null">
 | 
				
			||||||
                and business_id = #{businessId}
 | 
					                and business_id = #{businessId}
 | 
				
			||||||
            </if>
 | 
					            </if>
 | 
				
			||||||
 | 
					            <if test="calculationMode != '' and calculationMode != null">
 | 
				
			||||||
 | 
					                and calculation_mode = #{calculationMode}
 | 
				
			||||||
 | 
					            </if>
 | 
				
			||||||
        </where>
 | 
					        </where>
 | 
				
			||||||
    </select>
 | 
					    </select>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.*;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import javax.servlet.http.HttpServletResponse;
 | 
					import javax.servlet.http.HttpServletResponse;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 初始带宽流量Controller
 | 
					 * 初始带宽流量Controller
 | 
				
			||||||
@@ -94,4 +95,40 @@ public class InitialBandwidthTrafficController extends BaseController
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        return toAjax(initialBandwidthTrafficService.deleteInitialBandwidthTrafficByIds(ids));
 | 
					        return toAjax(initialBandwidthTrafficService.deleteInitialBandwidthTrafficByIds(ids));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 网络接口基础信息
 | 
				
			||||||
 | 
					     * @param initialBandwidthTraffic
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:traffic:list")
 | 
				
			||||||
 | 
					    @PostMapping("/netInterfaceDetailsMsg")
 | 
				
			||||||
 | 
					    public AjaxResult netInterfaceDetailsMsg(@RequestBody InitialBandwidthTraffic initialBandwidthTraffic) {
 | 
				
			||||||
 | 
					        InitialBandwidthTraffic netInterfaceDetailsMsg = initialBandwidthTrafficService.getNetInterfaceDetailsMsg(initialBandwidthTraffic);
 | 
				
			||||||
 | 
					        return success(netInterfaceDetailsMsg);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询eth0流量信息并封装为多折线ECharts图表数据
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:traffic:list")
 | 
				
			||||||
 | 
					    @PostMapping("/netInterfaceTrafficEcharts")
 | 
				
			||||||
 | 
					    public AjaxResult netInterfaceTrafficEcharts(@RequestBody InitialBandwidthTraffic initialBandwidthTraffic) {
 | 
				
			||||||
 | 
					        Map<String, Object> echartsData = initialBandwidthTrafficService.netInterfaceTrafficEcharts(initialBandwidthTraffic);
 | 
				
			||||||
 | 
					        return success(echartsData);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * eth0丢包数
 | 
				
			||||||
 | 
					     * @param initialBandwidthTraffic
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:traffic:list")
 | 
				
			||||||
 | 
					    @PostMapping("/netInterfaceDroppedEcharts")
 | 
				
			||||||
 | 
					    public AjaxResult netInterfaceDroppedEcharts(@RequestBody InitialBandwidthTraffic initialBandwidthTraffic) {
 | 
				
			||||||
 | 
					        Map<String, Object> echartsData = initialBandwidthTrafficService.netInterfaceDroppedEcharts(initialBandwidthTraffic);
 | 
				
			||||||
 | 
					        return success(echartsData);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,5 @@
 | 
				
			|||||||
package com.ruoyi.rocketmq.controller;
 | 
					package com.ruoyi.rocketmq.controller;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.ruoyi.common.core.utils.DateUtils;
 | 
					 | 
				
			||||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
 | 
					import com.ruoyi.common.core.utils.poi.ExcelUtil;
 | 
				
			||||||
import com.ruoyi.common.core.web.controller.BaseController;
 | 
					import com.ruoyi.common.core.web.controller.BaseController;
 | 
				
			||||||
import com.ruoyi.common.core.web.domain.AjaxResult;
 | 
					import com.ruoyi.common.core.web.domain.AjaxResult;
 | 
				
			||||||
@@ -15,8 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			|||||||
import org.springframework.web.bind.annotation.*;
 | 
					import org.springframework.web.bind.annotation.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import javax.servlet.http.HttpServletResponse;
 | 
					import javax.servlet.http.HttpServletResponse;
 | 
				
			||||||
import java.util.*;
 | 
					import java.util.List;
 | 
				
			||||||
import java.util.stream.Collectors;
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * CPU监控信息Controller
 | 
					 * CPU监控信息Controller
 | 
				
			||||||
@@ -108,40 +107,16 @@ public class InitialCpuInfoController extends BaseController
 | 
				
			|||||||
    @RequiresPermissions("rocketmq:cpuInfo:list")
 | 
					    @RequiresPermissions("rocketmq:cpuInfo:list")
 | 
				
			||||||
    @PostMapping("/cpuLoadEcharts")
 | 
					    @PostMapping("/cpuLoadEcharts")
 | 
				
			||||||
    public AjaxResult cpuLoadEcharts(@RequestBody InitialCpuInfo initialCpuInfo) {
 | 
					    public AjaxResult cpuLoadEcharts(@RequestBody InitialCpuInfo initialCpuInfo) {
 | 
				
			||||||
        // 1. 查询原始CPU监控数据并按时间排序
 | 
					        Map<String, Object> echartsData = initialCpuInfoService.cupLoadEcharts(initialCpuInfo);
 | 
				
			||||||
        List<InitialCpuInfo> list = initialCpuInfoService.selectInitialCpuInfoList(initialCpuInfo)
 | 
					        return success(echartsData);
 | 
				
			||||||
                .stream()
 | 
					    }
 | 
				
			||||||
                .sorted(Comparator.comparing(InitialCpuInfo::getCreateTime))
 | 
					    /**
 | 
				
			||||||
                .collect(Collectors.toList());
 | 
					     * 查询CPU监控信息列表并封装为多折线ECharts图表数据
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
        // 2. 封装为ECharts图表数据格式
 | 
					    @RequiresPermissions("rocketmq:cpuInfo:list")
 | 
				
			||||||
        Map<String, Object> echartsData = new HashMap<>();
 | 
					    @PostMapping("/cpuTimeEcharts")
 | 
				
			||||||
 | 
					    public AjaxResult cpuTimeEcharts(@RequestBody InitialCpuInfo initialCpuInfo) {
 | 
				
			||||||
        // 确保X轴和Y轴数据顺序一致的处理
 | 
					        Map<String, Object> echartsData = initialCpuInfoService.cpuTimeEcharts(initialCpuInfo);
 | 
				
			||||||
        List<String> xAxisData = new ArrayList<>();
 | 
					 | 
				
			||||||
        List<Long> load1Data = new ArrayList<>();
 | 
					 | 
				
			||||||
        List<Long> load5Data = new ArrayList<>();
 | 
					 | 
				
			||||||
        List<Long> load15Data = new ArrayList<>();
 | 
					 | 
				
			||||||
        List<Long> utiData = new ArrayList<>();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        for (InitialCpuInfo info : list) {
 | 
					 | 
				
			||||||
            xAxisData.add(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", info.getCreateTime()));
 | 
					 | 
				
			||||||
            load1Data.add(info.getAvg1());
 | 
					 | 
				
			||||||
            load5Data.add(info.getAvg5());
 | 
					 | 
				
			||||||
            load15Data.add(info.getAvg15());
 | 
					 | 
				
			||||||
            utiData.add(info.getUti());
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // 构建Y轴数据
 | 
					 | 
				
			||||||
        Map<String, Object> yData = new HashMap<>();
 | 
					 | 
				
			||||||
        yData.put("load1Data", load1Data);
 | 
					 | 
				
			||||||
        yData.put("load5Data", load5Data);
 | 
					 | 
				
			||||||
        yData.put("load15Data", load15Data);
 | 
					 | 
				
			||||||
        yData.put("utiData", utiData);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        echartsData.put("xData", xAxisData);
 | 
					 | 
				
			||||||
        echartsData.put("yData", yData);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return success(echartsData);
 | 
					        return success(echartsData);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import javax.servlet.http.HttpServletResponse;
 | 
					import javax.servlet.http.HttpServletResponse;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 内存监控信息Controller
 | 
					 * 内存监控信息Controller
 | 
				
			||||||
@@ -99,4 +100,55 @@ public class InitialMemoryInfoController extends BaseController
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        return toAjax(initialMemoryInfoService.deleteInitialMemoryInfoByIds(ids));
 | 
					        return toAjax(initialMemoryInfoService.deleteInitialMemoryInfoByIds(ids));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询交换空间可用量监控数据
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:systemInfo:list")
 | 
				
			||||||
 | 
					    @PostMapping("/swapSizeFreeEcharts")
 | 
				
			||||||
 | 
					    public AjaxResult swapSizeFreeEcharts(@RequestBody InitialMemoryInfo initialMemoryInfo) {
 | 
				
			||||||
 | 
					        Map<String, Object> echartsData = initialMemoryInfoService.swapSizeFreeEcharts(initialMemoryInfo);
 | 
				
			||||||
 | 
					        return AjaxResult.success(echartsData);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询内存利用率监控数据
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:systemInfo:list")
 | 
				
			||||||
 | 
					    @PostMapping("/untilzationEcharts")
 | 
				
			||||||
 | 
					    public AjaxResult untilzationEcharts(@RequestBody InitialMemoryInfo initialMemoryInfo) {
 | 
				
			||||||
 | 
					        Map<String, Object> echartsData = initialMemoryInfoService.untilzationEcharts(initialMemoryInfo);
 | 
				
			||||||
 | 
					        return AjaxResult.success(echartsData);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询内存可用量监控数据(KB)
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:systemInfo:list")
 | 
				
			||||||
 | 
					    @PostMapping("/availableMemoryEcharts")
 | 
				
			||||||
 | 
					    public AjaxResult availableMemoryEcharts(@RequestBody InitialMemoryInfo initialMemoryInfo) {
 | 
				
			||||||
 | 
					        Map<String, Object> echartsData = initialMemoryInfoService.availableMemoryEcharts(initialMemoryInfo);
 | 
				
			||||||
 | 
					        return AjaxResult.success(echartsData);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询交换空间百分比监控数据
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:systemInfo:list")
 | 
				
			||||||
 | 
					    @PostMapping("/swapSizePercentEcharts")
 | 
				
			||||||
 | 
					    public AjaxResult swapSizePercentEcharts(@RequestBody InitialMemoryInfo initialMemoryInfo) {
 | 
				
			||||||
 | 
					        Map<String, Object> echartsData = initialMemoryInfoService.swapSizePercentEcharts(initialMemoryInfo);
 | 
				
			||||||
 | 
					        return AjaxResult.success(echartsData);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询可用内存百分比监控数据
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:systemInfo:list")
 | 
				
			||||||
 | 
					    @PostMapping("/percentEcharts")
 | 
				
			||||||
 | 
					    public AjaxResult percentEcharts(@RequestBody InitialMemoryInfo initialMemoryInfo) {
 | 
				
			||||||
 | 
					        Map<String, Object> echartsData = initialMemoryInfoService.percentEcharts(initialMemoryInfo);
 | 
				
			||||||
 | 
					        return AjaxResult.success(echartsData);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import javax.servlet.http.HttpServletResponse;
 | 
					import javax.servlet.http.HttpServletResponse;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 挂载点监控信息Controller
 | 
					 * 挂载点监控信息Controller
 | 
				
			||||||
@@ -99,4 +100,35 @@ public class InitialMountPointInfoController extends BaseController
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        return toAjax(initialMountPointInfoService.deleteInitialMountPointInfoByIds(ids));
 | 
					        return toAjax(initialMountPointInfoService.deleteInitialMountPointInfoByIds(ids));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 获取挂载点监控信息详细信息
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:mountPointInfo:query")
 | 
				
			||||||
 | 
					    @PostMapping(value = "/pointDetailsMsg")
 | 
				
			||||||
 | 
					    public AjaxResult pointDetailsMsg(@RequestBody InitialMountPointInfo initialMountPointInfo)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        InitialMountPointInfo mountPointInfo = initialMountPointInfoService.pointDetailsMsg(initialMountPointInfo);
 | 
				
			||||||
 | 
					        return success(mountPointInfo);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 获取挂载文件系统/的空间图形
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:mountPointInfo:query")
 | 
				
			||||||
 | 
					    @PostMapping(value = "/spaceEcharts")
 | 
				
			||||||
 | 
					    public AjaxResult spaceEcharts(@RequestBody InitialMountPointInfo initialMountPointInfo)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        Map<String, Object> echartsData = initialMountPointInfoService.spaceEcharts(initialMountPointInfo);
 | 
				
			||||||
 | 
					        return success(echartsData);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 获取挂载文件系统/的空间利用率图形
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:mountPointInfo:query")
 | 
				
			||||||
 | 
					    @PostMapping(value = "/spaceRateEcharts")
 | 
				
			||||||
 | 
					    public AjaxResult spaceRateEcharts(@RequestBody InitialMountPointInfo initialMountPointInfo)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        Map<String, Object> echartsData = initialMountPointInfoService.spaceRateEcharts(initialMountPointInfo);
 | 
				
			||||||
 | 
					        return success(echartsData);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,12 +9,14 @@ import com.ruoyi.common.log.annotation.Log;
 | 
				
			|||||||
import com.ruoyi.common.log.enums.BusinessType;
 | 
					import com.ruoyi.common.log.enums.BusinessType;
 | 
				
			||||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
 | 
					import com.ruoyi.common.security.annotation.RequiresPermissions;
 | 
				
			||||||
import com.ruoyi.rocketmq.domain.InitialSystemInfo;
 | 
					import com.ruoyi.rocketmq.domain.InitialSystemInfo;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.domain.vo.SystemMsgVo;
 | 
				
			||||||
import com.ruoyi.rocketmq.service.IInitialSystemInfoService;
 | 
					import com.ruoyi.rocketmq.service.IInitialSystemInfoService;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.web.bind.annotation.*;
 | 
					import org.springframework.web.bind.annotation.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import javax.servlet.http.HttpServletResponse;
 | 
					import javax.servlet.http.HttpServletResponse;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 系统监控信息Controller
 | 
					 * 系统监控信息Controller
 | 
				
			||||||
@@ -99,4 +101,39 @@ public class InitialSystemInfoController extends BaseController
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        return toAjax(initialSystemInfoService.deleteInitialSystemInfoByIds(ids));
 | 
					        return toAjax(initialSystemInfoService.deleteInitialSystemInfoByIds(ids));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询系统进程监控信息列表并封装为多折线ECharts图表数据
 | 
				
			||||||
 | 
					     * @param initialSystemInfo
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:systemInfo:list")
 | 
				
			||||||
 | 
					    @PostMapping("/systemProcessEcharts")
 | 
				
			||||||
 | 
					    public AjaxResult systemProcessEcharts(@RequestBody InitialSystemInfo initialSystemInfo) {
 | 
				
			||||||
 | 
					        Map<String, Object> echartsData = initialSystemInfoService.systemProcessEcharts(initialSystemInfo);
 | 
				
			||||||
 | 
					        return success(echartsData);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询系统登陆用户数(个)监控信息列表并封装为多折线ECharts图表数据
 | 
				
			||||||
 | 
					     * @param initialSystemInfo
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:systemInfo:list")
 | 
				
			||||||
 | 
					    @PostMapping("/systemUserNumEcharts")
 | 
				
			||||||
 | 
					    public AjaxResult systemUserNumEcharts(@RequestBody InitialSystemInfo initialSystemInfo) {
 | 
				
			||||||
 | 
					        Map<String, Object> echartsData = initialSystemInfoService.systemUserNumEcharts(initialSystemInfo);
 | 
				
			||||||
 | 
					        return success(echartsData);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 系统基础信息
 | 
				
			||||||
 | 
					     * @param initialSystemInfo
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:systemInfo:list")
 | 
				
			||||||
 | 
					    @PostMapping("/systemDetailsMsg")
 | 
				
			||||||
 | 
					    public AjaxResult systemDetailsMsg(@RequestBody InitialSystemInfo initialSystemInfo) {
 | 
				
			||||||
 | 
					        SystemMsgVo systemDetailsMsg = initialSystemInfoService.getSystemDetailsMsg(initialSystemInfo);
 | 
				
			||||||
 | 
					        return success(systemDetailsMsg);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -68,5 +68,9 @@ public class InitialBandwidthTraffic extends BaseEntity
 | 
				
			|||||||
    private String duplex;
 | 
					    private String duplex;
 | 
				
			||||||
    /** 协商速度 */
 | 
					    /** 协商速度 */
 | 
				
			||||||
    private String speed;
 | 
					    private String speed;
 | 
				
			||||||
 | 
					    /** 开始时间 */
 | 
				
			||||||
 | 
					    private String startTime;
 | 
				
			||||||
 | 
					    /** 结束时间 */
 | 
				
			||||||
 | 
					    private String endTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,30 @@
 | 
				
			|||||||
 | 
					package com.ruoyi.rocketmq.domain.vo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.math.BigDecimal;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Data
 | 
				
			||||||
 | 
					public class SystemMsgVo {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** 总内存(GB) */
 | 
				
			||||||
 | 
					    private Long memoryTotal;
 | 
				
			||||||
 | 
					    /** 操作系统 */
 | 
				
			||||||
 | 
					    private String os;
 | 
				
			||||||
 | 
					    /** 操作系统架构 */
 | 
				
			||||||
 | 
					    private String arch;
 | 
				
			||||||
 | 
					    /** 最大进程数 */
 | 
				
			||||||
 | 
					    private Long maxProc;
 | 
				
			||||||
 | 
					    /** 硬盘总可用空间(GB) */
 | 
				
			||||||
 | 
					    private BigDecimal diskSizeTotal;
 | 
				
			||||||
 | 
					    /** 系统启动时间(Unix时间戳) */
 | 
				
			||||||
 | 
					    private Long bootTime;
 | 
				
			||||||
 | 
					    /** 系统描述(如Linux 5.4.0-80-generic) */
 | 
				
			||||||
 | 
					    private String uname;
 | 
				
			||||||
 | 
					    /** 系统本地时间(如2023-08-15 14:30:00) */
 | 
				
			||||||
 | 
					    private String localTime;
 | 
				
			||||||
 | 
					    /** 系统正常运行时间(秒) */
 | 
				
			||||||
 | 
					    private Long upTime;
 | 
				
			||||||
 | 
					    /** cpu数量 */
 | 
				
			||||||
 | 
					    private Long num;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -71,4 +71,16 @@ public interface InitialBandwidthTrafficMapper
 | 
				
			|||||||
     * @param data 流量数据实体类
 | 
					     * @param data 流量数据实体类
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    int batchInsert(InitialBandwidthTraffic data);
 | 
					    int batchInsert(InitialBandwidthTraffic data);
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 网络接口基础信息
 | 
				
			||||||
 | 
					     * @param initialBandwidthTraffic
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    InitialBandwidthTraffic getNetInterfaceDetailsMsg(InitialBandwidthTraffic initialBandwidthTraffic);
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询eth0流量信息并封装为多折线ECharts图表数据
 | 
				
			||||||
 | 
					     * @param condition
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    List<InitialBandwidthTraffic> getNetTrafficList(InitialBandwidthTraffic condition);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -67,4 +67,6 @@ public interface InitialCpuInfoMapper
 | 
				
			|||||||
     * @return 结果
 | 
					     * @return 结果
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public int batchInsertInitialCpuInfo(@Param("list") List<InitialCpuInfo> list);
 | 
					    public int batchInsertInitialCpuInfo(@Param("list") List<InitialCpuInfo> list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    InitialCpuInfo getCpuInfoByClientId(String clientId);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -68,4 +68,11 @@ public interface InitialMemoryInfoMapper
 | 
				
			|||||||
     * @return 结果
 | 
					     * @return 结果
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public int batchInsertInitialMemoryInfo(@Param("list") List<InitialMemoryInfo> list);
 | 
					    public int batchInsertInitialMemoryInfo(@Param("list") List<InitialMemoryInfo> list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 根据唯一id获取内存信息
 | 
				
			||||||
 | 
					     * @param clientId
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public InitialMemoryInfo getMemoryInfoByClientId(String clientId);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -67,4 +67,11 @@ public interface InitialMountPointInfoMapper
 | 
				
			|||||||
     * @return 结果
 | 
					     * @return 结果
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public int batchInsertInitialMountPointInfo(@Param("list") List<InitialMountPointInfo> list);
 | 
					    public int batchInsertInitialMountPointInfo(@Param("list") List<InitialMountPointInfo> list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 挂载文件系统基础信息
 | 
				
			||||||
 | 
					     * @param clientId
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    InitialMountPointInfo pointDetailsMsg(String clientId);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,7 @@
 | 
				
			|||||||
package com.ruoyi.rocketmq.mapper;
 | 
					package com.ruoyi.rocketmq.mapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.ruoyi.rocketmq.domain.InitialSystemInfo;
 | 
					import com.ruoyi.rocketmq.domain.InitialSystemInfo;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.domain.vo.SystemMsgVo;
 | 
				
			||||||
import org.springframework.data.repository.query.Param;
 | 
					import org.springframework.data.repository.query.Param;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
@@ -67,4 +68,6 @@ public interface InitialSystemInfoMapper
 | 
				
			|||||||
     * @return 结果
 | 
					     * @return 结果
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    int batchInsertInitialSystemInfo(@Param("list") List<InitialSystemInfo> list);
 | 
					    int batchInsertInitialSystemInfo(@Param("list") List<InitialSystemInfo> list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    SystemMsgVo getSystemMsgByClientId(String clientId);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,6 +3,7 @@ package com.ruoyi.rocketmq.service;
 | 
				
			|||||||
import com.ruoyi.rocketmq.domain.InitialBandwidthTraffic;
 | 
					import com.ruoyi.rocketmq.domain.InitialBandwidthTraffic;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 初始带宽流量Service接口
 | 
					 * 初始带宽流量Service接口
 | 
				
			||||||
@@ -70,5 +71,24 @@ public interface IInitialBandwidthTrafficService
 | 
				
			|||||||
     * @param data 流量数据
 | 
					     * @param data 流量数据
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    void batchInsert(InitialBandwidthTraffic data);
 | 
					    void batchInsert(InitialBandwidthTraffic data);
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 网络接口基础信息
 | 
				
			||||||
 | 
					     * @param initialBandwidthTraffic
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    InitialBandwidthTraffic getNetInterfaceDetailsMsg(InitialBandwidthTraffic initialBandwidthTraffic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询eth0流量信息并封装为多折线ECharts图表数据
 | 
				
			||||||
 | 
					     * @param initialBandwidthTraffic
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    Map<String, Object> netInterfaceTrafficEcharts(InitialBandwidthTraffic initialBandwidthTraffic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询eth0流量信息丢包数并封装为折线ECharts图表数据
 | 
				
			||||||
 | 
					     * @param initialBandwidthTraffic
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    Map<String, Object> netInterfaceDroppedEcharts(InitialBandwidthTraffic initialBandwidthTraffic);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,6 +3,7 @@ package com.ruoyi.rocketmq.service;
 | 
				
			|||||||
import com.ruoyi.rocketmq.domain.InitialCpuInfo;
 | 
					import com.ruoyi.rocketmq.domain.InitialCpuInfo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * CPU监控信息Service接口
 | 
					 * CPU监控信息Service接口
 | 
				
			||||||
@@ -66,4 +67,8 @@ public interface IInitialCpuInfoService
 | 
				
			|||||||
     * @return 结果
 | 
					     * @return 结果
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public int batchInsertInitialCpuInfo(List<InitialCpuInfo> list);
 | 
					    public int batchInsertInitialCpuInfo(List<InitialCpuInfo> list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Map<String, Object> cupLoadEcharts(InitialCpuInfo initialCpuInfo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Map<String, Object> cpuTimeEcharts(InitialCpuInfo initialCpuInfo);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,6 +3,7 @@ package com.ruoyi.rocketmq.service;
 | 
				
			|||||||
import com.ruoyi.rocketmq.domain.InitialMemoryInfo;
 | 
					import com.ruoyi.rocketmq.domain.InitialMemoryInfo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 内存监控信息Service接口
 | 
					 * 内存监控信息Service接口
 | 
				
			||||||
@@ -66,4 +67,27 @@ public interface IInitialMemoryInfoService
 | 
				
			|||||||
     * @return 结果
 | 
					     * @return 结果
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public int batchInsertInitialMemoryInfo(List<InitialMemoryInfo> list);
 | 
					    public int batchInsertInitialMemoryInfo(List<InitialMemoryInfo> list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 内存信息echarts图
 | 
				
			||||||
 | 
					     * @param initialMemoryInfo
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    Map<String, Object> swapSizeFreeEcharts(InitialMemoryInfo initialMemoryInfo);
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询内存利用率监控数据
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    Map<String, Object> untilzationEcharts(InitialMemoryInfo initialMemoryInfo);
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询内存可用量监控数据(KB)
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    Map<String, Object> availableMemoryEcharts(InitialMemoryInfo initialMemoryInfo);
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询交换空间百分比监控数据
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    Map<String, Object> swapSizePercentEcharts(InitialMemoryInfo initialMemoryInfo);
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询可用内存百分比监控数据
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    Map<String, Object> percentEcharts(InitialMemoryInfo initialMemoryInfo);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,6 +4,7 @@ import com.ruoyi.rocketmq.domain.InitialMountPointInfo;
 | 
				
			|||||||
import org.springframework.data.repository.query.Param;
 | 
					import org.springframework.data.repository.query.Param;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 挂载点监控信息Service接口
 | 
					 * 挂载点监控信息Service接口
 | 
				
			||||||
@@ -67,4 +68,19 @@ public interface IInitialMountPointInfoService
 | 
				
			|||||||
     * @return 结果
 | 
					     * @return 结果
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public int batchInsertInitialMountPointInfo(@Param("list") List<InitialMountPointInfo> list);
 | 
					    public int batchInsertInitialMountPointInfo(@Param("list") List<InitialMountPointInfo> list);
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 获取挂载点监控信息详细信息
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    InitialMountPointInfo pointDetailsMsg(InitialMountPointInfo initialMountPointInfo);
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 获取挂载点监控信息的空间图形
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    Map<String, Object> spaceEcharts(InitialMountPointInfo initialMountPointInfo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 获取挂载文件/的空间利用率
 | 
				
			||||||
 | 
					     * @param initialMountPointInfo
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    Map<String, Object> spaceRateEcharts(InitialMountPointInfo initialMountPointInfo);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,8 +1,10 @@
 | 
				
			|||||||
package com.ruoyi.rocketmq.service;
 | 
					package com.ruoyi.rocketmq.service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.ruoyi.rocketmq.domain.InitialSystemInfo;
 | 
					import com.ruoyi.rocketmq.domain.InitialSystemInfo;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.domain.vo.SystemMsgVo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 系统监控信息Service接口
 | 
					 * 系统监控信息Service接口
 | 
				
			||||||
@@ -67,4 +69,25 @@ public interface IInitialSystemInfoService
 | 
				
			|||||||
     * @return 结果
 | 
					     * @return 结果
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public int batchInsertInitialSystemInfo(List<InitialSystemInfo> initialSystemInfo);
 | 
					    public int batchInsertInitialSystemInfo(List<InitialSystemInfo> initialSystemInfo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 系统进程(个)
 | 
				
			||||||
 | 
					     * @param initialSystemInfo
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    Map<String, Object> systemProcessEcharts(InitialSystemInfo initialSystemInfo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 登录用户数(个)
 | 
				
			||||||
 | 
					     * @param initialSystemInfo
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    Map<String, Object> systemUserNumEcharts(InitialSystemInfo initialSystemInfo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 系统基础信息
 | 
				
			||||||
 | 
					     * @param initialSystemInfo
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    SystemMsgVo getSystemDetailsMsg(InitialSystemInfo initialSystemInfo);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,6 +4,7 @@ import com.ruoyi.common.core.utils.DateUtils;
 | 
				
			|||||||
import com.ruoyi.rocketmq.domain.InitialBandwidthTraffic;
 | 
					import com.ruoyi.rocketmq.domain.InitialBandwidthTraffic;
 | 
				
			||||||
import com.ruoyi.rocketmq.mapper.InitialBandwidthTrafficMapper;
 | 
					import com.ruoyi.rocketmq.mapper.InitialBandwidthTrafficMapper;
 | 
				
			||||||
import com.ruoyi.rocketmq.service.IInitialBandwidthTrafficService;
 | 
					import com.ruoyi.rocketmq.service.IInitialBandwidthTrafficService;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.utils.EchartsDataUtils;
 | 
				
			||||||
import com.ruoyi.rocketmq.utils.TableRouterUtil;
 | 
					import com.ruoyi.rocketmq.utils.TableRouterUtil;
 | 
				
			||||||
import lombok.extern.slf4j.Slf4j;
 | 
					import lombok.extern.slf4j.Slf4j;
 | 
				
			||||||
import org.springframework.beans.BeanUtils;
 | 
					import org.springframework.beans.BeanUtils;
 | 
				
			||||||
@@ -14,10 +15,8 @@ import org.springframework.transaction.annotation.Transactional;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import java.time.LocalDateTime;
 | 
					import java.time.LocalDateTime;
 | 
				
			||||||
import java.time.ZoneId;
 | 
					import java.time.ZoneId;
 | 
				
			||||||
import java.util.Date;
 | 
					import java.util.*;
 | 
				
			||||||
import java.util.LinkedHashMap;
 | 
					import java.util.function.Function;
 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
import java.util.Map;
 | 
					 | 
				
			||||||
import java.util.stream.Collectors;
 | 
					import java.util.stream.Collectors;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@@ -175,5 +174,81 @@ public class InitialBandwidthTrafficServiceImpl implements IInitialBandwidthTraf
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 网络接口基础信息
 | 
				
			||||||
 | 
					     * @param initialBandwidthTraffic
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public InitialBandwidthTraffic getNetInterfaceDetailsMsg(InitialBandwidthTraffic initialBandwidthTraffic) {
 | 
				
			||||||
 | 
					        if (initialBandwidthTraffic.getCreateTime() == null) {
 | 
				
			||||||
 | 
					            initialBandwidthTraffic.setCreateTime(DateUtils.getNowDate());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        LocalDateTime createTime = initialBandwidthTraffic.getCreateTime().toInstant()
 | 
				
			||||||
 | 
					                .atZone(ZoneId.systemDefault())
 | 
				
			||||||
 | 
					                .toLocalDateTime();
 | 
				
			||||||
 | 
					        initialBandwidthTraffic.setTableName(TableRouterUtil.getTableName(createTime));
 | 
				
			||||||
 | 
					        InitialBandwidthTraffic detailsMsg = initialBandwidthTrafficMapper.getNetInterfaceDetailsMsg(initialBandwidthTraffic);
 | 
				
			||||||
 | 
					        return detailsMsg;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 分表查询需要的信息
 | 
				
			||||||
 | 
					     * @param initialBandwidthTraffic
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public List<InitialBandwidthTraffic> getListByTableName(InitialBandwidthTraffic initialBandwidthTraffic){
 | 
				
			||||||
 | 
					        // 获取涉及的表名
 | 
				
			||||||
 | 
					        Set<String> tableNames = TableRouterUtil.getTableNamesBetween(initialBandwidthTraffic.getStartTime(), initialBandwidthTraffic.getEndTime());
 | 
				
			||||||
 | 
					        // 并行查询各表
 | 
				
			||||||
 | 
					        List<InitialBandwidthTraffic> list =  tableNames.parallelStream()
 | 
				
			||||||
 | 
					                .flatMap(tableName -> {
 | 
				
			||||||
 | 
					                    InitialBandwidthTraffic condition = new InitialBandwidthTraffic();
 | 
				
			||||||
 | 
					                    condition.setTableName(tableName);
 | 
				
			||||||
 | 
					                    condition.setStartTime(initialBandwidthTraffic.getStartTime());
 | 
				
			||||||
 | 
					                    condition.setEndTime(initialBandwidthTraffic.getEndTime());
 | 
				
			||||||
 | 
					                    return initialBandwidthTrafficMapper.getNetTrafficList(condition).stream();
 | 
				
			||||||
 | 
					                })
 | 
				
			||||||
 | 
					                .collect(Collectors.toList());
 | 
				
			||||||
 | 
					        return list;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询eth0流量信息并封装为多折线ECharts图表数据
 | 
				
			||||||
 | 
					     * @param initialBandwidthTraffic
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public Map<String, Object> netInterfaceTrafficEcharts(InitialBandwidthTraffic initialBandwidthTraffic) {
 | 
				
			||||||
 | 
					        // 流量信息
 | 
				
			||||||
 | 
					        List<InitialBandwidthTraffic> list = getListByTableName(initialBandwidthTraffic);
 | 
				
			||||||
 | 
					        Map<String, Function<InitialBandwidthTraffic, ?>> extractors = new LinkedHashMap<>();
 | 
				
			||||||
 | 
					        extractors.put("inSpeedData", info -> safeConvertToKB(info.getInSpeed()));
 | 
				
			||||||
 | 
					        extractors.put("outSpeedData", info -> safeConvertToKB(info.getOutSpeed()));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return EchartsDataUtils.buildEchartsData(list, InitialBandwidthTraffic::getCreateTime, extractors);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    // 安全转换方法(处理可能的NumberFormatException)
 | 
				
			||||||
 | 
					    private Double safeConvertToKB(String byteValue) {
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            return byteValue == null ? 0.0 : Double.parseDouble(byteValue) / 1024.0;
 | 
				
			||||||
 | 
					        } catch (NumberFormatException e) {
 | 
				
			||||||
 | 
					            return 0.0; // 或根据业务需求返回null/抛出异常
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询eth0流量信息丢包数并封装为折线ECharts图表数据
 | 
				
			||||||
 | 
					     * @param initialBandwidthTraffic
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public Map<String, Object> netInterfaceDroppedEcharts(InitialBandwidthTraffic initialBandwidthTraffic) {
 | 
				
			||||||
 | 
					        // 流量信息
 | 
				
			||||||
 | 
					        List<InitialBandwidthTraffic> list = getListByTableName(initialBandwidthTraffic);
 | 
				
			||||||
 | 
					        Map<String, Function<InitialBandwidthTraffic, ?>> extractors = new LinkedHashMap<>();
 | 
				
			||||||
 | 
					        extractors.put("inDroppedData", info -> info.getInDropped());
 | 
				
			||||||
 | 
					        extractors.put("outDroppedData", info -> info.getOutDropped());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return EchartsDataUtils.buildEchartsData(list, InitialBandwidthTraffic::getCreateTime, extractors);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,13 +4,19 @@ import com.ruoyi.common.core.utils.DateUtils;
 | 
				
			|||||||
import com.ruoyi.rocketmq.domain.InitialCpuInfo;
 | 
					import com.ruoyi.rocketmq.domain.InitialCpuInfo;
 | 
				
			||||||
import com.ruoyi.rocketmq.mapper.InitialCpuInfoMapper;
 | 
					import com.ruoyi.rocketmq.mapper.InitialCpuInfoMapper;
 | 
				
			||||||
import com.ruoyi.rocketmq.service.IInitialCpuInfoService;
 | 
					import com.ruoyi.rocketmq.service.IInitialCpuInfoService;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.utils.EchartsDataUtils;
 | 
				
			||||||
import lombok.extern.slf4j.Slf4j;
 | 
					import lombok.extern.slf4j.Slf4j;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
import org.springframework.transaction.annotation.Isolation;
 | 
					import org.springframework.transaction.annotation.Isolation;
 | 
				
			||||||
import org.springframework.transaction.annotation.Transactional;
 | 
					import org.springframework.transaction.annotation.Transactional;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.LinkedHashMap;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					import java.util.function.Function;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import static com.ruoyi.rocketmq.utils.EchartsDataUtils.convertMicrosecondsToSeconds;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * CPU监控信息Service业务层处理
 | 
					 * CPU监控信息Service业务层处理
 | 
				
			||||||
@@ -115,4 +121,43 @@ public class InitialCpuInfoServiceImpl implements IInitialCpuInfoService
 | 
				
			|||||||
            throw new RuntimeException("批量保存失败",e);
 | 
					            throw new RuntimeException("批量保存失败",e);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * cpu负载
 | 
				
			||||||
 | 
					     * @param initialCpuInfo
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public Map<String, Object> cupLoadEcharts(InitialCpuInfo initialCpuInfo) {
 | 
				
			||||||
 | 
					        // 查询原始CPU监控数据并按时间排序
 | 
				
			||||||
 | 
					        List<InitialCpuInfo> list = initialCpuInfoMapper.selectInitialCpuInfoList(initialCpuInfo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Map<String, Function<InitialCpuInfo, ?>> extractors = new LinkedHashMap<>();
 | 
				
			||||||
 | 
					        extractors.put("load1Data", InitialCpuInfo::getAvg1);
 | 
				
			||||||
 | 
					        extractors.put("load5Data", InitialCpuInfo::getAvg5);
 | 
				
			||||||
 | 
					        extractors.put("load15Data", InitialCpuInfo::getAvg15);
 | 
				
			||||||
 | 
					        extractors.put("utiData", InitialCpuInfo::getUti);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return EchartsDataUtils.buildEchartsData(list, InitialCpuInfo::getCreateTime, extractors);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * cpu时间(s)
 | 
				
			||||||
 | 
					     * @param initialCpuInfo
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public Map<String, Object> cpuTimeEcharts(InitialCpuInfo initialCpuInfo) {
 | 
				
			||||||
 | 
					        List<InitialCpuInfo> list = initialCpuInfoMapper.selectInitialCpuInfoList(initialCpuInfo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Map<String, Function<InitialCpuInfo, ?>> extractors = new LinkedHashMap<>();
 | 
				
			||||||
 | 
					        extractors.put("normalData", info -> convertMicrosecondsToSeconds(info.getNormal()));
 | 
				
			||||||
 | 
					        extractors.put("idleData", info -> convertMicrosecondsToSeconds(info.getIdle()));
 | 
				
			||||||
 | 
					        extractors.put("iowaitData", InitialCpuInfo::getIowait);
 | 
				
			||||||
 | 
					        extractors.put("systemData", info -> convertMicrosecondsToSeconds(info.getSystem()));
 | 
				
			||||||
 | 
					        extractors.put("norespData", InitialCpuInfo::getNoresp);
 | 
				
			||||||
 | 
					        extractors.put("userpData", info -> convertMicrosecondsToSeconds(info.getUser()));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return EchartsDataUtils.buildEchartsData(list,InitialCpuInfo::getCreateTime, extractors);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,13 +4,17 @@ import com.ruoyi.common.core.utils.DateUtils;
 | 
				
			|||||||
import com.ruoyi.rocketmq.domain.InitialMemoryInfo;
 | 
					import com.ruoyi.rocketmq.domain.InitialMemoryInfo;
 | 
				
			||||||
import com.ruoyi.rocketmq.mapper.InitialMemoryInfoMapper;
 | 
					import com.ruoyi.rocketmq.mapper.InitialMemoryInfoMapper;
 | 
				
			||||||
import com.ruoyi.rocketmq.service.IInitialMemoryInfoService;
 | 
					import com.ruoyi.rocketmq.service.IInitialMemoryInfoService;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.utils.EchartsDataUtils;
 | 
				
			||||||
import lombok.extern.slf4j.Slf4j;
 | 
					import lombok.extern.slf4j.Slf4j;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
import org.springframework.transaction.annotation.Isolation;
 | 
					import org.springframework.transaction.annotation.Isolation;
 | 
				
			||||||
import org.springframework.transaction.annotation.Transactional;
 | 
					import org.springframework.transaction.annotation.Transactional;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.LinkedHashMap;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					import java.util.function.Function;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 内存监控信息Service业务层处理
 | 
					 * 内存监控信息Service业务层处理
 | 
				
			||||||
@@ -115,4 +119,68 @@ public class InitialMemoryInfoServiceImpl implements IInitialMemoryInfoService
 | 
				
			|||||||
            throw new RuntimeException("批量保存失败",e);
 | 
					            throw new RuntimeException("批量保存失败",e);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 交换卷/文件的可用空间(字节)
 | 
				
			||||||
 | 
					     * @param initialMemoryInfo
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public Map<String, Object> swapSizeFreeEcharts(InitialMemoryInfo initialMemoryInfo) {
 | 
				
			||||||
 | 
					        List<InitialMemoryInfo> list = initialMemoryInfoMapper.selectInitialMemoryInfoList(initialMemoryInfo);
 | 
				
			||||||
 | 
					        Map<String, Function<InitialMemoryInfo, ?>> extractors = new LinkedHashMap<>();
 | 
				
			||||||
 | 
					        extractors.put("swapSizeFreeData", InitialMemoryInfo::getSwapSizeFree);
 | 
				
			||||||
 | 
					        return EchartsDataUtils.buildEchartsData(list, InitialMemoryInfo::getCreateTime, extractors);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 内存利用率
 | 
				
			||||||
 | 
					     * @param initialMemoryInfo
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public Map<String, Object> untilzationEcharts(InitialMemoryInfo initialMemoryInfo) {
 | 
				
			||||||
 | 
					        List<InitialMemoryInfo> list = initialMemoryInfoMapper.selectInitialMemoryInfoList(initialMemoryInfo);
 | 
				
			||||||
 | 
					        Map<String, Function<InitialMemoryInfo, ?>> extractors = new LinkedHashMap<>();
 | 
				
			||||||
 | 
					        extractors.put("untilzationData", InitialMemoryInfo::getUntilzation);
 | 
				
			||||||
 | 
					        return EchartsDataUtils.buildEchartsData(list, InitialMemoryInfo::getCreateTime, extractors);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 可用内存(KB)
 | 
				
			||||||
 | 
					     * @param initialMemoryInfo
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public Map<String, Object> availableMemoryEcharts(InitialMemoryInfo initialMemoryInfo) {
 | 
				
			||||||
 | 
					        List<InitialMemoryInfo> list = initialMemoryInfoMapper.selectInitialMemoryInfoList(initialMemoryInfo);
 | 
				
			||||||
 | 
					        Map<String, Function<InitialMemoryInfo, ?>> extractors = new LinkedHashMap<>();
 | 
				
			||||||
 | 
					        extractors.put("availableData", info -> info.getAvailable() / 1024.0);
 | 
				
			||||||
 | 
					        return EchartsDataUtils.buildEchartsData(list, InitialMemoryInfo::getCreateTime, extractors);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 可用交换空间百分比(%)
 | 
				
			||||||
 | 
					     * @param initialMemoryInfo
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public Map<String, Object> swapSizePercentEcharts(InitialMemoryInfo initialMemoryInfo) {
 | 
				
			||||||
 | 
					        List<InitialMemoryInfo> list = initialMemoryInfoMapper.selectInitialMemoryInfoList(initialMemoryInfo);
 | 
				
			||||||
 | 
					        Map<String, Function<InitialMemoryInfo, ?>> extractors = new LinkedHashMap<>();
 | 
				
			||||||
 | 
					        extractors.put("swapSizePercentData", InitialMemoryInfo::getSwapSizePercent);
 | 
				
			||||||
 | 
					        return EchartsDataUtils.buildEchartsData(list, InitialMemoryInfo::getCreateTime, extractors);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 可用内存百分比(%)
 | 
				
			||||||
 | 
					     * @param initialMemoryInfo
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public Map<String, Object> percentEcharts(InitialMemoryInfo initialMemoryInfo) {
 | 
				
			||||||
 | 
					        List<InitialMemoryInfo> list = initialMemoryInfoMapper.selectInitialMemoryInfoList(initialMemoryInfo);
 | 
				
			||||||
 | 
					        Map<String, Function<InitialMemoryInfo, ?>> extractors = new LinkedHashMap<>();
 | 
				
			||||||
 | 
					        extractors.put("percentData", InitialMemoryInfo::getPercent);
 | 
				
			||||||
 | 
					        return EchartsDataUtils.buildEchartsData(list, InitialMemoryInfo::getCreateTime, extractors);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,13 +4,17 @@ import com.ruoyi.common.core.utils.DateUtils;
 | 
				
			|||||||
import com.ruoyi.rocketmq.domain.InitialMountPointInfo;
 | 
					import com.ruoyi.rocketmq.domain.InitialMountPointInfo;
 | 
				
			||||||
import com.ruoyi.rocketmq.mapper.InitialMountPointInfoMapper;
 | 
					import com.ruoyi.rocketmq.mapper.InitialMountPointInfoMapper;
 | 
				
			||||||
import com.ruoyi.rocketmq.service.IInitialMountPointInfoService;
 | 
					import com.ruoyi.rocketmq.service.IInitialMountPointInfoService;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.utils.EchartsDataUtils;
 | 
				
			||||||
import lombok.extern.slf4j.Slf4j;
 | 
					import lombok.extern.slf4j.Slf4j;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
import org.springframework.transaction.annotation.Isolation;
 | 
					import org.springframework.transaction.annotation.Isolation;
 | 
				
			||||||
import org.springframework.transaction.annotation.Transactional;
 | 
					import org.springframework.transaction.annotation.Transactional;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.LinkedHashMap;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					import java.util.function.Function;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 挂载点监控信息Service业务层处理
 | 
					 * 挂载点监控信息Service业务层处理
 | 
				
			||||||
@@ -114,4 +118,36 @@ public class InitialMountPointInfoServiceImpl implements IInitialMountPointInfoS
 | 
				
			|||||||
            throw new RuntimeException("批量保存失败",e);
 | 
					            throw new RuntimeException("批量保存失败",e);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public InitialMountPointInfo pointDetailsMsg(InitialMountPointInfo initialMountPointInfo) {
 | 
				
			||||||
 | 
					        return initialMountPointInfoMapper.pointDetailsMsg(initialMountPointInfo.getClientId());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 获取挂载点监控信息的空间图形
 | 
				
			||||||
 | 
					     * @param initialMountPointInfo
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public Map<String, Object> spaceEcharts(InitialMountPointInfo initialMountPointInfo) {
 | 
				
			||||||
 | 
					        List<InitialMountPointInfo> list = initialMountPointInfoMapper.selectInitialMountPointInfoList(initialMountPointInfo);
 | 
				
			||||||
 | 
					        Map<String, Function<InitialMountPointInfo, ?>> extractors = new LinkedHashMap<>();
 | 
				
			||||||
 | 
					        extractors.put("vfsFreeData", info -> info.getVfsFree() / 1024.0);
 | 
				
			||||||
 | 
					        extractors.put("vfsTotalData", info -> info.getVfsTotal() / 1024.0);
 | 
				
			||||||
 | 
					        return EchartsDataUtils.buildEchartsData(list,InitialMountPointInfo::getCreateTime, extractors);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 获取挂载文件/的空间利用率
 | 
				
			||||||
 | 
					     * @param initialMountPointInfo
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public Map<String, Object> spaceRateEcharts(InitialMountPointInfo initialMountPointInfo) {
 | 
				
			||||||
 | 
					        List<InitialMountPointInfo> list = initialMountPointInfoMapper.selectInitialMountPointInfoList(initialMountPointInfo);
 | 
				
			||||||
 | 
					        Map<String, Function<InitialMountPointInfo, ?>> extractors = new LinkedHashMap<>();
 | 
				
			||||||
 | 
					        extractors.put("vfsUtilData", InitialMountPointInfo::getVfsUtil);
 | 
				
			||||||
 | 
					        return EchartsDataUtils.buildEchartsData(list,InitialMountPointInfo::getCreateTime, extractors);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,16 +1,25 @@
 | 
				
			|||||||
package com.ruoyi.rocketmq.service.impl;
 | 
					package com.ruoyi.rocketmq.service.impl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.ruoyi.common.core.utils.DateUtils;
 | 
					import com.ruoyi.common.core.utils.DateUtils;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.domain.InitialCpuInfo;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.domain.InitialMemoryInfo;
 | 
				
			||||||
import com.ruoyi.rocketmq.domain.InitialSystemInfo;
 | 
					import com.ruoyi.rocketmq.domain.InitialSystemInfo;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.domain.vo.SystemMsgVo;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.mapper.InitialCpuInfoMapper;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.mapper.InitialMemoryInfoMapper;
 | 
				
			||||||
import com.ruoyi.rocketmq.mapper.InitialSystemInfoMapper;
 | 
					import com.ruoyi.rocketmq.mapper.InitialSystemInfoMapper;
 | 
				
			||||||
import com.ruoyi.rocketmq.service.IInitialSystemInfoService;
 | 
					import com.ruoyi.rocketmq.service.IInitialSystemInfoService;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.utils.EchartsDataUtils;
 | 
				
			||||||
import lombok.extern.slf4j.Slf4j;
 | 
					import lombok.extern.slf4j.Slf4j;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
import org.springframework.transaction.annotation.Isolation;
 | 
					import org.springframework.transaction.annotation.Isolation;
 | 
				
			||||||
import org.springframework.transaction.annotation.Transactional;
 | 
					import org.springframework.transaction.annotation.Transactional;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.LinkedHashMap;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					import java.util.function.Function;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 系统监控信息Service业务层处理
 | 
					 * 系统监控信息Service业务层处理
 | 
				
			||||||
@@ -24,6 +33,10 @@ public class InitialSystemInfoServiceImpl implements IInitialSystemInfoService
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    @Autowired
 | 
					    @Autowired
 | 
				
			||||||
    private InitialSystemInfoMapper initialSystemInfoMapper;
 | 
					    private InitialSystemInfoMapper initialSystemInfoMapper;
 | 
				
			||||||
 | 
					    @Autowired
 | 
				
			||||||
 | 
					    private InitialMemoryInfoMapper initialMemoryInfoMapper;
 | 
				
			||||||
 | 
					    @Autowired
 | 
				
			||||||
 | 
					    private InitialCpuInfoMapper initialCpuInfoMapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 查询系统监控信息
 | 
					     * 查询系统监控信息
 | 
				
			||||||
@@ -115,4 +128,51 @@ public class InitialSystemInfoServiceImpl implements IInitialSystemInfoService
 | 
				
			|||||||
            throw new RuntimeException("批量保存失败",e);
 | 
					            throw new RuntimeException("批量保存失败",e);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 系统进程(个)
 | 
				
			||||||
 | 
					     * @param initialSystemInfo
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public Map<String, Object> systemProcessEcharts(InitialSystemInfo initialSystemInfo) {
 | 
				
			||||||
 | 
					        List<InitialSystemInfo> list = initialSystemInfoMapper.selectInitialSystemInfoList(initialSystemInfo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Map<String, Function<InitialSystemInfo, ?>> extractors = new LinkedHashMap<>();
 | 
				
			||||||
 | 
					        extractors.put("runProcNumData", InitialSystemInfo::getRunProcNum);
 | 
				
			||||||
 | 
					        extractors.put("procNumData", InitialSystemInfo::getProcNum);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return EchartsDataUtils.buildEchartsData(list,InitialSystemInfo::getCreateTime, extractors);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 登录用户数(个)
 | 
				
			||||||
 | 
					     * @param initialSystemInfo
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public Map<String, Object> systemUserNumEcharts(InitialSystemInfo initialSystemInfo) {
 | 
				
			||||||
 | 
					        List<InitialSystemInfo> list = initialSystemInfoMapper.selectInitialSystemInfoList(initialSystemInfo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Map<String, Function<InitialSystemInfo, ?>> extractors = new LinkedHashMap<>();
 | 
				
			||||||
 | 
					        extractors.put("usersNumData", InitialSystemInfo::getUsersNum);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return EchartsDataUtils.buildEchartsData(list,InitialSystemInfo::getCreateTime, extractors);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 系统基础信息
 | 
				
			||||||
 | 
					     * @param initialSystemInfo
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public SystemMsgVo getSystemDetailsMsg(InitialSystemInfo initialSystemInfo) {
 | 
				
			||||||
 | 
					        // 获取总内存信息
 | 
				
			||||||
 | 
					        InitialMemoryInfo memoryInfo = initialMemoryInfoMapper.getMemoryInfoByClientId(initialSystemInfo.getClientId());
 | 
				
			||||||
 | 
					        // 获取cpu数量
 | 
				
			||||||
 | 
					        InitialCpuInfo cpuInfo = initialCpuInfoMapper.getCpuInfoByClientId(initialSystemInfo.getClientId());
 | 
				
			||||||
 | 
					        // 获取系统信息
 | 
				
			||||||
 | 
					        SystemMsgVo systemMsgVo = initialSystemInfoMapper.getSystemMsgByClientId(initialSystemInfo.getClientId());
 | 
				
			||||||
 | 
					        systemMsgVo.setNum(cpuInfo.getNum());
 | 
				
			||||||
 | 
					        systemMsgVo.setMemoryTotal(memoryInfo.getTotal());
 | 
				
			||||||
 | 
					        return systemMsgVo;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,53 @@
 | 
				
			|||||||
 | 
					package com.ruoyi.rocketmq.utils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.ruoyi.common.core.utils.DateUtils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.*;
 | 
				
			||||||
 | 
					import java.util.function.Function;
 | 
				
			||||||
 | 
					import java.util.stream.Collectors;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class EchartsDataUtils {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 构建ECharts图表数据
 | 
				
			||||||
 | 
					     * @param list 原始数据列表
 | 
				
			||||||
 | 
					     * @param timeExtractor 时间字段提取函数
 | 
				
			||||||
 | 
					     * @param dataExtractors 数据提取器Map (key: 数据名称, value: 数据提取函数)
 | 
				
			||||||
 | 
					     * @param <T> 数据类型泛型
 | 
				
			||||||
 | 
					     * @return 包含xData和yData的Map
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public static <T> Map<String, Object> buildEchartsData(
 | 
				
			||||||
 | 
					            List<T> list,
 | 
				
			||||||
 | 
					            Function<T, Date> timeExtractor,
 | 
				
			||||||
 | 
					            Map<String, Function<T, ?>> dataExtractors) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // 按时间排序
 | 
				
			||||||
 | 
					        List<T> sortedList = list.stream()
 | 
				
			||||||
 | 
					                .sorted(Comparator.comparing(timeExtractor))
 | 
				
			||||||
 | 
					                .collect(Collectors.toList());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // 准备X轴数据
 | 
				
			||||||
 | 
					        List<String> xAxisData = sortedList.stream()
 | 
				
			||||||
 | 
					                .map(item -> DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", timeExtractor.apply(item)))
 | 
				
			||||||
 | 
					                .collect(Collectors.toList());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // 准备Y轴数据
 | 
				
			||||||
 | 
					        Map<String, Object> yData = new LinkedHashMap<>();
 | 
				
			||||||
 | 
					        dataExtractors.forEach((name, extractor) -> {
 | 
				
			||||||
 | 
					            yData.put(name, sortedList.stream().map(extractor).collect(Collectors.toList()));
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // 构建返回结果
 | 
				
			||||||
 | 
					        Map<String, Object> result = new HashMap<>();
 | 
				
			||||||
 | 
					        result.put("xData", xAxisData);
 | 
				
			||||||
 | 
					        result.put("yData", yData);
 | 
				
			||||||
 | 
					        return result;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 微秒转秒
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public static double convertMicrosecondsToSeconds(long microseconds) {
 | 
				
			||||||
 | 
					        return microseconds / 1_000_000.0;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -7,14 +7,16 @@ import java.util.Set;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public class TableRouterUtil {
 | 
					public class TableRouterUtil {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // 日期格式
 | 
				
			||||||
 | 
					    private static final DateTimeFormatter YEAR_MONTH_FORMAT =
 | 
				
			||||||
 | 
					            DateTimeFormatter.ofPattern("yyyy_MM");
 | 
				
			||||||
 | 
					    private static final DateTimeFormatter DATE_TIME_FORMATTER =
 | 
				
			||||||
 | 
					            DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
 | 
				
			||||||
    // 表名前缀
 | 
					    // 表名前缀
 | 
				
			||||||
    private static final String TABLE_PREFIX = "eps_initial_traffic";
 | 
					    private static final String TABLE_PREFIX = "eps_initial_traffic";
 | 
				
			||||||
    // 表名前缀
 | 
					    // 表名前缀
 | 
				
			||||||
    private static final String TABLE_PREFIX_INITIAL = "initial_bandwidth_traffic";
 | 
					    private static final String TABLE_PREFIX_INITIAL = "initial_bandwidth_traffic";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 日期格式
 | 
					 | 
				
			||||||
    private static final DateTimeFormatter YEAR_MONTH_FORMAT =
 | 
					 | 
				
			||||||
            DateTimeFormatter.ofPattern("yyyy_MM");
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 根据创建时间获取表名
 | 
					     * 根据创建时间获取表名
 | 
				
			||||||
@@ -43,24 +45,36 @@ public class TableRouterUtil {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 获取时间范围内涉及的所有表名
 | 
					     * 获取时间范围内涉及的所有表名
 | 
				
			||||||
     * @param startTime 开始时间(包含)
 | 
					     * @param startTime 开始时间 (格式: "yyyy-MM-dd HH:mm:ss")
 | 
				
			||||||
     * @param endTime 结束时间(包含)
 | 
					     * @param endTime 结束时间 (格式: "yyyy-MM-dd HH:mm:ss")
 | 
				
			||||||
     * @return 按时间顺序排列的表名集合
 | 
					     * @return 按时间顺序排列的表名集合
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static Set<String> getTableNamesBetween(LocalDateTime startTime, LocalDateTime endTime) {
 | 
					    public static Set<String> getTableNamesBetween(String startTime, String endTime) {
 | 
				
			||||||
        validateTimeRange(startTime, endTime);
 | 
					        LocalDateTime start = parseDateTime(startTime);
 | 
				
			||||||
 | 
					        LocalDateTime end = parseDateTime(endTime);
 | 
				
			||||||
 | 
					        validateTimeRange(start, end);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Set<String> tableNames = new LinkedHashSet<>();
 | 
					        Set<String> tableNames = new LinkedHashSet<>();
 | 
				
			||||||
        LocalDateTime current = startTime.withHour(0).withMinute(0).withSecond(0);
 | 
					        LocalDateTime current = start.withHour(0).withMinute(0).withSecond(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        while (!current.isAfter(endTime)) {
 | 
					        while (!current.isAfter(end)) {
 | 
				
			||||||
            tableNames.add(getTableName(current));
 | 
					            tableNames.add(getTableName(current));
 | 
				
			||||||
            current = current.plusDays(1);
 | 
					            current = current.plusDays(1);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return tableNames;
 | 
					        return tableNames;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    // 解析字符串为LocalDateTime
 | 
				
			||||||
 | 
					    private static LocalDateTime parseDateTime(String dateTimeStr) {
 | 
				
			||||||
 | 
					        if (dateTimeStr == null || dateTimeStr.trim().isEmpty()) {
 | 
				
			||||||
 | 
					            throw new IllegalArgumentException("时间字符串不能为空");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            return LocalDateTime.parse(dateTimeStr, DATE_TIME_FORMATTER);
 | 
				
			||||||
 | 
					        } catch (Exception e) {
 | 
				
			||||||
 | 
					            throw new IllegalArgumentException("时间格式必须为: yyyy-MM-dd HH:mm:ss", e);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 获取日期区间
 | 
					    // 获取日期区间
 | 
				
			||||||
    private static String getDayRange(int day) {
 | 
					    private static String getDayRange(int day) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,6 +20,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
				
			|||||||
        <result property="createBy" column="create_by"/>
 | 
					        <result property="createBy" column="create_by"/>
 | 
				
			||||||
        <result property="updateBy" column="update_by"/>
 | 
					        <result property="updateBy" column="update_by"/>
 | 
				
			||||||
        <result property="clientId" column="client_id"/>
 | 
					        <result property="clientId" column="client_id"/>
 | 
				
			||||||
 | 
					        <result property="speed" column="speed"/>
 | 
				
			||||||
 | 
					        <result property="duplex" column="duplex"/>
 | 
				
			||||||
    </resultMap>
 | 
					    </resultMap>
 | 
				
			||||||
    <sql id="selectInitialBandwidthTrafficVo"> select id, name, mac, status, type, ipV4, in_dropped, out_dropped, in_speed, out_speed, create_time, update_time, create_by, update_by, client_id from initial_bandwidth_traffic </sql>
 | 
					    <sql id="selectInitialBandwidthTrafficVo"> select id, name, mac, status, type, ipV4, in_dropped, out_dropped, in_speed, out_speed, create_time, update_time, create_by, update_by, client_id from initial_bandwidth_traffic </sql>
 | 
				
			||||||
    <select id="selectInitialBandwidthTrafficList" parameterType="InitialBandwidthTraffic" resultMap="InitialBandwidthTrafficResult">
 | 
					    <select id="selectInitialBandwidthTrafficList" parameterType="InitialBandwidthTraffic" resultMap="InitialBandwidthTrafficResult">
 | 
				
			||||||
@@ -124,4 +126,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
				
			|||||||
        </foreach>
 | 
					        </foreach>
 | 
				
			||||||
    </insert>
 | 
					    </insert>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <select id="getNetInterfaceDetailsMsg" parameterType="InitialBandwidthTraffic" resultMap="InitialBandwidthTrafficResult">
 | 
				
			||||||
 | 
					        select id, `name`, mac, status, `type`, ipV4, in_dropped, out_dropped, in_speed, out_speed,
 | 
				
			||||||
 | 
					               create_time, update_time, create_by, update_by, client_id, duplex, speed
 | 
				
			||||||
 | 
					        from ${tableName}
 | 
				
			||||||
 | 
					        where client_id = #{clientId} and `name` like 'eth0%'
 | 
				
			||||||
 | 
					        limit 1
 | 
				
			||||||
 | 
					    </select>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</mapper>
 | 
					</mapper>
 | 
				
			||||||
@@ -179,4 +179,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
				
			|||||||
            )
 | 
					            )
 | 
				
			||||||
        </foreach>
 | 
					        </foreach>
 | 
				
			||||||
    </insert>
 | 
					    </insert>
 | 
				
			||||||
 | 
					    <select id="getCpuInfoByClientId" parameterType="String" resultMap="InitialCpuInfoResult">
 | 
				
			||||||
 | 
					        <include refid="selectInitialCpuInfoVo"/>
 | 
				
			||||||
 | 
					        where client_id = #{clientId}
 | 
				
			||||||
 | 
					        limit 1
 | 
				
			||||||
 | 
					    </select>
 | 
				
			||||||
</mapper>
 | 
					</mapper>
 | 
				
			||||||
@@ -141,4 +141,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
				
			|||||||
            )
 | 
					            )
 | 
				
			||||||
        </foreach>
 | 
					        </foreach>
 | 
				
			||||||
    </insert>
 | 
					    </insert>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <select id="getMemoryInfoByClientId" parameterType="String" resultMap="InitialMemoryInfoResult">
 | 
				
			||||||
 | 
					        <include refid="selectInitialMemoryInfoVo"/>
 | 
				
			||||||
 | 
					        where client_id = #{clientId}
 | 
				
			||||||
 | 
					        limit 1
 | 
				
			||||||
 | 
					    </select>
 | 
				
			||||||
</mapper>
 | 
					</mapper>
 | 
				
			||||||
@@ -135,4 +135,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
				
			|||||||
            )
 | 
					            )
 | 
				
			||||||
        </foreach>
 | 
					        </foreach>
 | 
				
			||||||
    </insert>
 | 
					    </insert>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <select id="pointDetailsMsg" parameterType="String" resultMap="InitialMountPointInfoResult">
 | 
				
			||||||
 | 
					        <include refid="selectInitialMountPointInfoVo"/>
 | 
				
			||||||
 | 
					        where client_id = #{clientId} and mount='/'
 | 
				
			||||||
 | 
					        limit 1
 | 
				
			||||||
 | 
					    </select>
 | 
				
			||||||
</mapper>
 | 
					</mapper>
 | 
				
			||||||
@@ -34,6 +34,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
				
			|||||||
        <include refid="selectInitialSystemInfoVo"/>
 | 
					        <include refid="selectInitialSystemInfoVo"/>
 | 
				
			||||||
        <where>  
 | 
					        <where>  
 | 
				
			||||||
            <if test="clientId != null  and clientId != ''"> and client_id = #{clientId}</if>
 | 
					            <if test="clientId != null  and clientId != ''"> and client_id = #{clientId}</if>
 | 
				
			||||||
 | 
					            <if test="startTime != null  and startTime != ''"> and create_time >= #{startTime}</if>
 | 
				
			||||||
 | 
					            <if test="endTime != null  and endTime != ''"> and create_time <= #{endTime}</if>
 | 
				
			||||||
        </where>
 | 
					        </where>
 | 
				
			||||||
        order by create_time desc
 | 
					        order by create_time desc
 | 
				
			||||||
    </select>
 | 
					    </select>
 | 
				
			||||||
@@ -182,4 +184,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
				
			|||||||
            )
 | 
					            )
 | 
				
			||||||
        </foreach>
 | 
					        </foreach>
 | 
				
			||||||
    </insert>
 | 
					    </insert>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <select id="getSystemMsgByClientId" parameterType="String" resultType="SystemMsgVo">
 | 
				
			||||||
 | 
					        select os os,arch arch,max_proc maxProc,disk_size_total diskSizeTotal,boot_time bootTime,uname uname,local_time `localTime`,up_time upTime from initial_system_info
 | 
				
			||||||
 | 
					        where client_id = #{clientId}
 | 
				
			||||||
 | 
					        limit 1
 | 
				
			||||||
 | 
					    </select>
 | 
				
			||||||
</mapper>
 | 
					</mapper>
 | 
				
			||||||
		Reference in New Issue
	
	Block a user