项目初始化
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package com.jeesite.modules.apps.Module;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class ChartInfo implements Serializable {
|
||||
|
||||
private String key;
|
||||
private String label;
|
||||
private double value;
|
||||
private String color;
|
||||
private String remark;
|
||||
|
||||
public ChartInfo() {
|
||||
}
|
||||
|
||||
public ChartInfo(String key, String label, double value, String color,String remark) {
|
||||
this.key = key;
|
||||
this.label = label;
|
||||
this.value = value;
|
||||
this.color = color;
|
||||
this.remark = remark;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.jeesite.modules.apps.Module;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class HostInfo implements Serializable {
|
||||
private Integer cpuNum;
|
||||
|
||||
|
||||
public HostInfo(){}
|
||||
|
||||
public HostInfo(Integer cpuNum){
|
||||
this.cpuNum = cpuNum;
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,5 @@ public class Start {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,39 @@
|
||||
package com.jeesite.modules.apps.web;
|
||||
|
||||
import cn.hutool.system.SystemUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.system.oshi.CpuInfo;
|
||||
import cn.hutool.system.oshi.OshiUtil;
|
||||
import com.jeesite.modules.apps.Module.ChartInfo;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/sys/analysis")
|
||||
public class SysAnalysisController {
|
||||
|
||||
public void sss(){
|
||||
SystemUtil.getJvmInfo();
|
||||
@RequestMapping(value = "getHostInfo")
|
||||
@ResponseBody
|
||||
public List<ChartInfo> getHostInfo() {
|
||||
List<ChartInfo> chartInfoList = new ArrayList<>();
|
||||
CpuInfo cpuInfo = OshiUtil.getCpuInfo();
|
||||
long uptimeMs = OshiUtil.getOs().getSystemUptime();
|
||||
String runTime = DateUtil.formatBetween(uptimeMs);
|
||||
// 系统使用率(红色)
|
||||
chartInfoList.add(new ChartInfo("sys", "系统使用率", cpuInfo.getSys(), "#F43F5E", runTime));
|
||||
// 用户使用率(蓝色)
|
||||
chartInfoList.add(new ChartInfo("user", "用户使用率", cpuInfo.getUser(), "#3B82F6", runTime));
|
||||
// CPU等待率(橙色)
|
||||
chartInfoList.add(new ChartInfo("wait", "CPU等待率", cpuInfo.getWait(), "#F97316", runTime));
|
||||
// CPU空闲率(绿色)
|
||||
chartInfoList.add(new ChartInfo("free", "CPU空闲率", cpuInfo.getFree(), "#10B981", runTime));
|
||||
// CPU总使用率(粉色)
|
||||
chartInfoList.add(new ChartInfo("used", "CPU总使用率", cpuInfo.getUsed(), "#EC4899", runTime));
|
||||
// 系统运行时间(紫色)
|
||||
chartInfoList.add(new ChartInfo("time", "系统运行时间", 0, "#8B5CF6", runTime));
|
||||
return chartInfoList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,6 +167,9 @@ public class MyNoticeTodoController extends BaseController {
|
||||
@RequestMapping(value = "fileList")
|
||||
@ResponseBody
|
||||
public List<FileList> fileList(MyNoticeTodo myNoticeTodo) {
|
||||
MyNoticeTodo noticeTodo = myNoticeTodoService.get(myNoticeTodo);
|
||||
noticeTodo.setReadFlag("1");
|
||||
myNoticeTodoService.save(noticeTodo);
|
||||
List<FileList> fileLists = new ArrayList<>();
|
||||
List<FileUpload> fileUploadList = FileUploadUtils.findFileUpload(myNoticeTodo.getId(), "myNoticeTodo_file");
|
||||
for (FileUpload fileUpload : fileUploadList) {
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.jeesite.modules.utils;
|
||||
|
||||
import cn.hutool.system.oshi.CpuInfo;
|
||||
import cn.hutool.system.oshi.OshiUtil;
|
||||
import com.jeesite.modules.apps.Module.HostInfo;
|
||||
|
||||
public class HostUtils {
|
||||
|
||||
|
||||
public static HostInfo getHostInfo() {
|
||||
|
||||
// return "CpuInfo{CPU核心数=" + this.cpuNum + ", CPU总的使用率=" + this.toTal + ",
|
||||
// CPU系统使用率=" + this.sys + ", CPU用户使用率=" + this.user + ", CPU当前等待率=" + this.wait + ",
|
||||
// CPU当前空闲率=" + this.free + ", CPU利用率=" + this.getUsed() + ", CPU型号信息='" + this.cpuModel + '\'' + '}';
|
||||
CpuInfo cpuInfo = OshiUtil.getCpuInfo();
|
||||
|
||||
System.out.println(cpuInfo);
|
||||
|
||||
System.out.println("================");
|
||||
System.out.println(cpuInfo.getCpuNum());
|
||||
System.out.println(cpuInfo.getToTal());
|
||||
System.out.println(cpuInfo.getSys());
|
||||
System.out.println(cpuInfo.getUser());
|
||||
System.out.println(cpuInfo.getWait());
|
||||
System.out.println(cpuInfo.getFree());
|
||||
System.out.println(cpuInfo.getUsed());
|
||||
return new HostInfo();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
getHostInfo();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user