改进系统信息,增加位置数据、增加CPU型号名称
This commit is contained in:
parent
805bd34381
commit
fef6ce9ecd
@ -10,6 +10,7 @@ public class BaseDetail {
|
||||
String osName;
|
||||
String osVersion;
|
||||
int osBit;
|
||||
String cpuName;
|
||||
int cpuCore;
|
||||
double memory;
|
||||
double disk;
|
||||
|
@ -4,9 +4,9 @@ import com.example.entity.data.BaseDetail;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import oshi.SystemInfo;
|
||||
import oshi.hardware.HWDiskStore;
|
||||
import oshi.hardware.HardwareAbstractionLayer;
|
||||
import oshi.hardware.NetworkIF;
|
||||
import oshi.hardware.HWDiskStore;
|
||||
import oshi.software.os.OperatingSystem;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -42,6 +42,7 @@ public class MonitorUtils {
|
||||
.setOsArch(properties.getProperty("os.arch"))
|
||||
.setOsVersion(os.getVersionInfo().getVersion())
|
||||
.setOsName(os.getFamily())
|
||||
.setCpuName(hardware.getProcessor().getProcessorIdentifier().getName())
|
||||
.setCpuCore(hardware.getProcessor().getLogicalProcessorCount())
|
||||
.setMemory(memory)
|
||||
.setDisk(diskSize)
|
||||
|
@ -16,5 +16,6 @@ public class Client implements BaseData {
|
||||
Integer id;
|
||||
String name;
|
||||
String token;
|
||||
String location;
|
||||
Date registerTime;
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ public class ClientDetail {
|
||||
String osName;
|
||||
String osVersion;
|
||||
int osBit;
|
||||
String cpuName;
|
||||
int cpuCore;
|
||||
double memory;
|
||||
double disk;
|
||||
|
@ -14,6 +14,8 @@ public class ClientDetailVO {
|
||||
@NotNull
|
||||
int osBit;
|
||||
@NotNull
|
||||
String cpuName;
|
||||
@NotNull
|
||||
int cpuCore;
|
||||
@NotNull
|
||||
double memory;
|
||||
|
@ -55,7 +55,7 @@ public class ClientServiceImpl extends ServiceImpl<ClientMapper, Client> impleme
|
||||
public synchronized boolean verifyAndRegister(String token) {
|
||||
if(this.registerToken.equals(token)) {
|
||||
int id = this.randomClientId();
|
||||
Client client = new Client(id, "未命名主机", token, new Date());
|
||||
Client client = new Client(id, "未命名主机", token, "cn", new Date());
|
||||
if(this.save(client)) {
|
||||
registerToken = this.generateNewToken();
|
||||
this.addClientCache(client);
|
||||
|
Loading…
x
Reference in New Issue
Block a user