diff --git a/mes/hd/nladmin-system/pom.xml b/mes/hd/nladmin-system/pom.xml
index b04ae6d5..5fcd9017 100644
--- a/mes/hd/nladmin-system/pom.xml
+++ b/mes/hd/nladmin-system/pom.xml
@@ -15,7 +15,7 @@
0.11.1
- 5.5.0
+ 5.9.0
1.31.0
diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/system/controller/monitor/MonitorController.java b/mes/hd/nladmin-system/src/main/java/org/nl/system/controller/monitor/MonitorController.java
new file mode 100644
index 00000000..d9e957b8
--- /dev/null
+++ b/mes/hd/nladmin-system/src/main/java/org/nl/system/controller/monitor/MonitorController.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2019-2020 Zheng Jie
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.nl.system.controller.monitor;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.nl.system.service.monitor.MonitorService;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author Zheng Jie
+ * @date 2020-05-02
+ */
+@RestController
+@RequiredArgsConstructor
+@Api(tags = "系统-服务监控管理")
+@RequestMapping("/api/monitor")
+public class MonitorController {
+
+ private final MonitorService serverService;
+
+ @GetMapping
+ @ApiOperation("查询服务监控")
+// @SaCheckPermission("monitor:list")
+ public ResponseEntity query() {
+ return new ResponseEntity<>(serverService.getServers(),HttpStatus.OK);
+ }
+}
diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/system/controller/param/SysParamController.java b/mes/hd/nladmin-system/src/main/java/org/nl/system/controller/param/SysParamController.java
index 9301713d..062b3e42 100644
--- a/mes/hd/nladmin-system/src/main/java/org/nl/system/controller/param/SysParamController.java
+++ b/mes/hd/nladmin-system/src/main/java/org/nl/system/controller/param/SysParamController.java
@@ -72,11 +72,11 @@ class SysParamController {
return new ResponseEntity<>(HttpStatus.OK);
}
- @PostMapping("/getValueByCode/{code}")
+ @PostMapping("/getValueByCode")
@Log("根据编码获取值")
@ApiOperation("根据编码获取值")
@SaIgnore
- public ResponseEntity getValueByCode(@PathVariable String code) {
+ public ResponseEntity getValueByCode(@RequestBody String code) {
return new ResponseEntity<>(paramService.findByCode(code), HttpStatus.CREATED);
}
diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/system/service/monitor/MonitorService.java b/mes/hd/nladmin-system/src/main/java/org/nl/system/service/monitor/MonitorService.java
new file mode 100644
index 00000000..d0573f97
--- /dev/null
+++ b/mes/hd/nladmin-system/src/main/java/org/nl/system/service/monitor/MonitorService.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2019-2020 Zheng Jie
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.nl.system.service.monitor;
+
+import java.util.Map;
+
+/**
+ * @author Zheng Jie
+ * @date 2020-05-02
+ */
+public interface MonitorService {
+
+ /**
+ * 查询数据分页
+ * @return Map
+ */
+ Map getServers();
+}
diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/system/service/monitor/impl/MonitorServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/system/service/monitor/impl/MonitorServiceImpl.java
new file mode 100644
index 00000000..661513c0
--- /dev/null
+++ b/mes/hd/nladmin-system/src/main/java/org/nl/system/service/monitor/impl/MonitorServiceImpl.java
@@ -0,0 +1,189 @@
+/*
+ * Copyright 2019-2020 Zheng Jie
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.nl.system.service.monitor.impl;
+
+import cn.hutool.core.date.BetweenFormatter;
+import cn.hutool.core.date.DateUtil;
+import org.nl.modules.common.utils.ElAdminConstant;
+import org.nl.modules.common.utils.FileUtil;
+import org.nl.modules.common.utils.StringUtils;
+import org.nl.system.service.monitor.MonitorService;
+import org.springframework.stereotype.Service;
+import oshi.SystemInfo;
+import oshi.hardware.CentralProcessor;
+import oshi.hardware.GlobalMemory;
+import oshi.hardware.HardwareAbstractionLayer;
+import oshi.hardware.VirtualMemory;
+import oshi.software.os.FileSystem;
+import oshi.software.os.OSFileStore;
+import oshi.software.os.OperatingSystem;
+import oshi.util.FormatUtil;
+import oshi.util.Util;
+
+import java.lang.management.ManagementFactory;
+import java.text.DecimalFormat;
+import java.util.Date;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Zheng Jie
+ * @date 2020-05-02
+ */
+@Service
+public class MonitorServiceImpl implements MonitorService {
+
+ private final DecimalFormat df = new DecimalFormat("0.00");
+
+ @Override
+ public Map getServers(){
+ Map resultMap = new LinkedHashMap<>(8);
+ try {
+ SystemInfo si = new SystemInfo();
+ OperatingSystem os = si.getOperatingSystem();
+ HardwareAbstractionLayer hal = si.getHardware();
+ // 系统信息
+ resultMap.put("sys", getSystemInfo(os));
+ // cpu 信息
+ resultMap.put("cpu", getCpuInfo(hal.getProcessor()));
+ // 内存信息
+ resultMap.put("memory", getMemoryInfo(hal.getMemory()));
+ // 交换区信息
+ resultMap.put("swap", getSwapInfo(hal.getMemory()));
+ // 磁盘
+ resultMap.put("disk", getDiskInfo(os));
+ resultMap.put("time", DateUtil.format(new Date(), "HH:mm:ss"));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return resultMap;
+ }
+
+ /**
+ * 获取磁盘信息
+ * @return /
+ */
+ private Map getDiskInfo(OperatingSystem os) {
+ Map diskInfo = new LinkedHashMap<>();
+ FileSystem fileSystem = os.getFileSystem();
+ List fsArray = fileSystem.getFileStores();
+ String osName = System.getProperty("os.name");
+ long available = 0, total = 0;
+ for (OSFileStore fs : fsArray){
+ // windows 需要将所有磁盘分区累加,linux 和 mac 直接累加会出现磁盘重复的问题,待修复
+ if(osName.toLowerCase().startsWith(ElAdminConstant.WIN)) {
+ available += fs.getUsableSpace();
+ total += fs.getTotalSpace();
+ } else {
+ available = fs.getUsableSpace();
+ total = fs.getTotalSpace();
+ break;
+ }
+ }
+ long used = total - available;
+ diskInfo.put("total", total > 0 ? FileUtil.getSize(total) : "?");
+ diskInfo.put("available", FileUtil.getSize(available));
+ diskInfo.put("used", FileUtil.getSize(used));
+ diskInfo.put("usageRate", df.format(used/(double)total * 100));
+ return diskInfo;
+ }
+
+ /**
+ * 获取交换区信息
+ * @param memory /
+ * @return /
+ */
+ private Map getSwapInfo(GlobalMemory memory) {
+ Map swapInfo = new LinkedHashMap<>();
+ VirtualMemory virtualMemory = memory.getVirtualMemory();
+ long total = virtualMemory.getSwapTotal();
+ long used = virtualMemory.getSwapUsed();
+ swapInfo.put("total", FormatUtil.formatBytes(total));
+ swapInfo.put("used", FormatUtil.formatBytes(used));
+ swapInfo.put("available", FormatUtil.formatBytes(total - used));
+ if(used == 0){
+ swapInfo.put("usageRate", 0);
+ } else {
+ swapInfo.put("usageRate", df.format(used/(double)total * 100));
+ }
+ return swapInfo;
+ }
+
+ /**
+ * 获取内存信息
+ * @param memory /
+ * @return /
+ */
+ private Map getMemoryInfo(GlobalMemory memory) {
+ Map memoryInfo = new LinkedHashMap<>();
+ memoryInfo.put("total", FormatUtil.formatBytes(memory.getTotal()));
+ memoryInfo.put("available", FormatUtil.formatBytes(memory.getAvailable()));
+ memoryInfo.put("used", FormatUtil.formatBytes(memory.getTotal() - memory.getAvailable()));
+ memoryInfo.put("usageRate", df.format((memory.getTotal() - memory.getAvailable())/(double)memory.getTotal() * 100));
+ return memoryInfo;
+ }
+
+ /**
+ * 获取Cpu相关信息
+ * @param processor /
+ * @return /
+ */
+ private Map getCpuInfo(CentralProcessor processor) {
+ Map cpuInfo = new LinkedHashMap<>();
+ cpuInfo.put("name", processor.getProcessorIdentifier().getName());
+ cpuInfo.put("package", processor.getPhysicalPackageCount() + "个物理CPU");
+ cpuInfo.put("core", processor.getPhysicalProcessorCount() + "个物理核心");
+ cpuInfo.put("coreNumber", processor.getPhysicalProcessorCount());
+ cpuInfo.put("logic", processor.getLogicalProcessorCount() + "个逻辑CPU");
+ // CPU信息
+ long[] prevTicks = processor.getSystemCpuLoadTicks();
+ // 等待1秒...
+ Util.sleep(1000);
+ long[] ticks = processor.getSystemCpuLoadTicks();
+ long user = ticks[CentralProcessor.TickType.USER.getIndex()] - prevTicks[CentralProcessor.TickType.USER.getIndex()];
+ long nice = ticks[CentralProcessor.TickType.NICE.getIndex()] - prevTicks[CentralProcessor.TickType.NICE.getIndex()];
+ long sys = ticks[CentralProcessor.TickType.SYSTEM.getIndex()] - prevTicks[CentralProcessor.TickType.SYSTEM.getIndex()];
+ long idle = ticks[CentralProcessor.TickType.IDLE.getIndex()] - prevTicks[CentralProcessor.TickType.IDLE.getIndex()];
+ long iowait = ticks[CentralProcessor.TickType.IOWAIT.getIndex()] - prevTicks[CentralProcessor.TickType.IOWAIT.getIndex()];
+ long irq = ticks[CentralProcessor.TickType.IRQ.getIndex()] - prevTicks[CentralProcessor.TickType.IRQ.getIndex()];
+ long softirq = ticks[CentralProcessor.TickType.SOFTIRQ.getIndex()] - prevTicks[CentralProcessor.TickType.SOFTIRQ.getIndex()];
+ long steal = ticks[CentralProcessor.TickType.STEAL.getIndex()] - prevTicks[CentralProcessor.TickType.STEAL.getIndex()];
+ long totalCpu = user + nice + sys + idle + iowait + irq + softirq + steal;
+ cpuInfo.put("used", df.format(100d * user / totalCpu + 100d * sys / totalCpu));
+ cpuInfo.put("idle", df.format(100d * idle / totalCpu));
+ return cpuInfo;
+ }
+
+ /**
+ * 获取系统相关信息,系统、运行天数、系统IP
+ * @param os /
+ * @return /
+ */
+ private Map getSystemInfo(OperatingSystem os){
+ Map systemInfo = new LinkedHashMap<>();
+ // jvm 运行时间
+ long time = ManagementFactory.getRuntimeMXBean().getStartTime();
+ Date date = new Date(time);
+ // 计算项目运行时间 5.4.3:BetweenFormater, 5.7.14改名为BetweenFormatter
+ String formatBetween = DateUtil.formatBetween(date, new Date(), BetweenFormatter.Level.HOUR);
+ // 系统信息
+ systemInfo.put("os", os.toString());
+ systemInfo.put("day", formatBetween);
+ systemInfo.put("ip", StringUtils.getLocalIp());
+ return systemInfo;
+ }
+}
diff --git a/mes/qd/src/assets/images/dark.svg b/mes/qd/src/assets/images/dark.svg
new file mode 100644
index 00000000..fffb76c1
--- /dev/null
+++ b/mes/qd/src/assets/images/dark.svg
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mes/qd/src/assets/images/light.svg b/mes/qd/src/assets/images/light.svg
new file mode 100644
index 00000000..ab7cc088
--- /dev/null
+++ b/mes/qd/src/assets/images/light.svg
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mes/qd/src/components/TopNav/index.vue b/mes/qd/src/components/TopNav/index.vue
new file mode 100644
index 00000000..c3b10a21
--- /dev/null
+++ b/mes/qd/src/components/TopNav/index.vue
@@ -0,0 +1,198 @@
+
+
+
+
+ {{ item.meta.title }}
+
+
+
+
+ 更多菜单
+
+
+ {{ item.meta.title }}
+
+
+
+
+
+
+
+
diff --git a/mes/qd/src/layout/components/Navbar.vue b/mes/qd/src/layout/components/Navbar.vue
index 1568d7d5..563af5a7 100644
--- a/mes/qd/src/layout/components/Navbar.vue
+++ b/mes/qd/src/layout/components/Navbar.vue
@@ -1,16 +1,16 @@
-
-
+
+