diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json
index 91defe9a..78ba0008 100644
--- a/ruoyi-ui/package.json
+++ b/ruoyi-ui/package.json
@@ -40,7 +40,7 @@
"axios": "0.24.0",
"clipboard": "2.0.8",
"core-js": "3.19.1",
- "echarts": "4.9.0",
+ "echarts": "^5.1.2",
"element-ui": "2.15.6",
"file-saver": "2.0.5",
"fuse.js": "6.4.3",
diff --git a/ruoyi-ui/src/api/business/monitor/performance/performancemonitor.js b/ruoyi-ui/src/api/business/monitor/performance/performancemonitor.js
new file mode 100644
index 00000000..fcfa1c20
--- /dev/null
+++ b/ruoyi-ui/src/api/business/monitor/performance/performancemonitor.js
@@ -0,0 +1,9 @@
+import request from '@/utils/request'
+
+// 查询性能监控信息
+export function getPerformance() {
+ return request({
+ url: '/monitor/performancemonitor',
+ method: 'get'
+ })
+}
diff --git a/ruoyi-ui/src/views/business/monitor/performance/index.vue b/ruoyi-ui/src/views/business/monitor/performance/index.vue
new file mode 100644
index 00000000..a78deb6b
--- /dev/null
+++ b/ruoyi-ui/src/views/business/monitor/performance/index.vue
@@ -0,0 +1,290 @@
+
+
+
+
+
+
+
+ 系统:{{ data.sys.os }}
+
+
+ IP:{{ data.sys.ip }}
+
+
+ 项目已不间断运行:{{ data.sys.day }}
+
+
+
+
+
+
+ 状态
+
+
+
+ CPU使用率
+
+
+
+ {{ data.cpu.name }}
+
+
+ {{ data.cpu.package }}
+
+
+ {{ data.cpu.core }}
+
+
+ {{ data.cpu.logic }}
+
+
+
+
+
+
+
+
+
+ 内存使用率
+
+
+
+ 总量:{{ data.memory.total }}
+
+
+ 已使用:{{ data.memory.used }}
+
+
+ 空闲:{{ data.memory.available }}
+
+
+
+
+
+
+
+
+
+ 交换区使用率
+
+
+
+ 总量:{{ data.swap.total }}
+
+
+ 已使用:{{ data.swap.used }}
+
+
+ 空闲:{{ data.swap.available }}
+
+
+
+
+
+
+
+
+
+ 磁盘使用率
+
+
+
+
+ 总量:{{ data.disk.total }}
+
+
+ 空闲:{{ data.disk.available }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CPU使用率监控
+
+
+
+
+
+
+
+
+
+ 内存使用率监控
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ruoyi-ui/vue.config.js b/ruoyi-ui/vue.config.js
index 7fcea564..312cce24 100644
--- a/ruoyi-ui/vue.config.js
+++ b/ruoyi-ui/vue.config.js
@@ -131,5 +131,9 @@ module.exports = {
}
}
)
- }
+ },
+ transpileDependencies: [
+ 'vue-echarts',
+ 'resize-detector'
+ ]
}
diff --git a/xjs-business/xjs-business-common/src/main/java/com/xjs/utils/CloseUtils.java b/xjs-business/xjs-business-common/src/main/java/com/xjs/utils/CloseUtils.java
new file mode 100644
index 00000000..9b747b7b
--- /dev/null
+++ b/xjs-business/xjs-business-common/src/main/java/com/xjs/utils/CloseUtils.java
@@ -0,0 +1,33 @@
+
+package com.xjs.utils;
+
+import java.io.Closeable;
+
+/**
+ * @author meteor
+ *
+ * @description 用于关闭各种连接,缺啥补啥
+ * @date 2021-03-05
+ **/
+public class CloseUtils {
+
+ public static void close(Closeable closeable) {
+ if (null != closeable) {
+ try {
+ closeable.close();
+ } catch (Exception e) {
+ // 静默关闭
+ }
+ }
+ }
+
+ public static void close(AutoCloseable closeable) {
+ if (null != closeable) {
+ try {
+ closeable.close();
+ } catch (Exception e) {
+ // 静默关闭
+ }
+ }
+ }
+}
diff --git a/xjs-business/xjs-business-common/src/main/java/com/xjs/utils/FileUtils.java b/xjs-business/xjs-business-common/src/main/java/com/xjs/utils/FileUtils.java
new file mode 100644
index 00000000..2ea3ad53
--- /dev/null
+++ b/xjs-business/xjs-business-common/src/main/java/com/xjs/utils/FileUtils.java
@@ -0,0 +1,365 @@
+
+package com.xjs.utils;
+
+import ch.qos.logback.core.util.CloseUtil;
+import cn.hutool.core.io.IoUtil;
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.poi.excel.BigExcelWriter;
+import cn.hutool.poi.excel.ExcelUtil;
+import com.xjs.exception.BusinessException;
+import org.apache.poi.util.IOUtils;
+import org.apache.poi.xssf.streaming.SXSSFSheet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.security.MessageDigest;
+import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * File工具类,扩展 hutool 工具包
+ *
+ * @author meteor
+ * @date 2021-12-27
+ */
+public class FileUtils extends cn.hutool.core.io.FileUtil {
+
+ private static final Logger log = LoggerFactory.getLogger(FileUtils.class);
+
+ /**
+ * 系统临时目录
+ *
+ * windows 包含路径分割符,但Linux 不包含,
+ * 在windows \\==\ 前提下,
+ * 为安全起见 同意拼装 路径分割符,
+ *
+ * java.io.tmpdir
+ * windows : C:\Users/xxx\AppData\Local\Temp\
+ * linux: /temp
+ *
+ */
+ public static final String SYS_TEM_DIR = System.getProperty("java.io.tmpdir") + File.separator;
+ /**
+ * 定义GB的计算常量
+ */
+ private static final int GB = 1024 * 1024 * 1024;
+ /**
+ * 定义MB的计算常量
+ */
+ private static final int MB = 1024 * 1024;
+ /**
+ * 定义KB的计算常量
+ */
+ private static final int KB = 1024;
+
+ /**
+ * 格式化小数
+ */
+ private static final DecimalFormat DF = new DecimalFormat("0.00");
+
+ public static final String IMAGE = "图片";
+ public static final String TXT = "文档";
+ public static final String MUSIC = "音乐";
+ public static final String VIDEO = "视频";
+ public static final String OTHER = "其他";
+
+
+ /**
+ * MultipartFile转File
+ */
+ public static File toFile(MultipartFile multipartFile) {
+ // 获取文件名
+ String fileName = multipartFile.getOriginalFilename();
+ // 获取文件后缀
+ String prefix = "." + getExtensionName(fileName);
+ File file = null;
+ try {
+ // 用uuid作为文件名,防止生成的临时文件重复
+ file = new File(SYS_TEM_DIR + IdUtil.simpleUUID() + prefix);
+ // MultipartFile to File
+ multipartFile.transferTo(file);
+ } catch (IOException e) {
+ log.error(e.getMessage(), e);
+ }
+ return file;
+ }
+
+ /**
+ * 获取文件扩展名,不带 .
+ */
+ public static String getExtensionName(String filename) {
+ if ((filename != null) && (filename.length() > 0)) {
+ int dot = filename.lastIndexOf('.');
+ if ((dot > -1) && (dot < (filename.length() - 1))) {
+ return filename.substring(dot + 1);
+ }
+ }
+ return filename;
+ }
+
+ /**
+ * Java文件操作 获取不带扩展名的文件名
+ */
+ public static String getFileNameNoEx(String filename) {
+ if ((filename != null) && (filename.length() > 0)) {
+ int dot = filename.lastIndexOf('.');
+ if ((dot > -1) && (dot < (filename.length()))) {
+ return filename.substring(0, dot);
+ }
+ }
+ return filename;
+ }
+
+ /**
+ * 文件大小转换
+ */
+ public static String getSize(long size) {
+ String resultSize;
+ if (size / GB >= 1) {
+ //如果当前Byte的值大于等于1GB
+ resultSize = DF.format(size / (float) GB) + "GB ";
+ } else if (size / MB >= 1) {
+ //如果当前Byte的值大于等于1MB
+ resultSize = DF.format(size / (float) MB) + "MB ";
+ } else if (size / KB >= 1) {
+ //如果当前Byte的值大于等于1KB
+ resultSize = DF.format(size / (float) KB) + "KB ";
+ } else {
+ resultSize = size + "B ";
+ }
+ return resultSize;
+ }
+
+ /**
+ * inputStream 转 File
+ */
+ static File inputStreamToFile(InputStream ins, String name){
+ File file = new File(SYS_TEM_DIR + name);
+ if (file.exists()) {
+ return file;
+ }
+ OutputStream os = null;
+ try {
+ os = new FileOutputStream(file);
+ int bytesRead;
+ int len = 8192;
+ byte[] buffer = new byte[len];
+ while ((bytesRead = ins.read(buffer, 0, len)) != -1) {
+ os.write(buffer, 0, bytesRead);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ CloseUtils.close(os);
+ CloseUtils.close(ins);
+ }
+ return file;
+ }
+
+ /**
+ * 将文件名解析成文件的上传路径
+ */
+ public static File upload(MultipartFile file, String filePath) {
+ Date date = new Date();
+ SimpleDateFormat format = new SimpleDateFormat("yyyyMMddhhmmssS");
+ String name = getFileNameNoEx(file.getOriginalFilename());
+ String suffix = getExtensionName(file.getOriginalFilename());
+ String nowStr = "-" + format.format(date);
+ try {
+ String fileName = name + nowStr + "." + suffix;
+ String path = filePath + fileName;
+ // getCanonicalFile 可解析正确各种路径
+ File dest = new File(path).getCanonicalFile();
+ // 检测是否存在目录
+ if (!dest.getParentFile().exists()) {
+ if (!dest.getParentFile().mkdirs()) {
+ System.out.println("was not successful.");
+ }
+ }
+ // 文件写入
+ file.transferTo(dest);
+ return dest;
+ } catch (Exception e) {
+ log.error(e.getMessage(), e);
+ }
+ return null;
+ }
+
+ /**
+ * 导出excel
+ */
+ public static void downloadExcel(List