OCT 1. 更新部分语法检查问题

This commit is contained in:
黄昕 2024-02-26 14:09:49 +08:00
parent 6d228b0448
commit 4eabd13d41
3 changed files with 5 additions and 12 deletions

View File

@ -15,7 +15,7 @@ import oshi.hardware.Firmware;
@Mapper @Mapper
public interface IStructConvert { public interface IStructConvert {
IStructConvert INSTINCT = Mappers.getMapper(IStructConvert.class); IStructConvert INSTANCE = Mappers.getMapper(IStructConvert.class);
@Mappings({ @Mappings({
@Mapping(expression = "java(f.getName())", target = "name"), @Mapping(expression = "java(f.getName())", target = "name"),
@ -27,7 +27,7 @@ public interface IStructConvert {
HwFirmware toHwFirmware(Firmware f); HwFirmware toHwFirmware(Firmware f);
@Mappings({ @Mappings({
@Mapping(expression = "java(b.getVersion())", target = "version"), @Mapping(expression = "java(b.getVersion().trim())", target = "version"),
@Mapping(expression = "java(b.getManufacturer())", target = "manufacturer"), @Mapping(expression = "java(b.getManufacturer())", target = "manufacturer"),
@Mapping(expression = "java(b.getModel())", target = "model"), @Mapping(expression = "java(b.getModel())", target = "model"),
@Mapping(expression = "java(b.getSerialNumber())", target = "serialNumber") @Mapping(expression = "java(b.getSerialNumber())", target = "serialNumber")

View File

@ -1,15 +1,9 @@
package com.cmhi.cf.restapi.pojo.po; package com.cmhi.cf.restapi.pojo.po;
import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
@Data @Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonPropertyOrder({"cpuVendor", "cpuName", "processorId", "cpuIdentifier", "microArchitecture", "cpu64bit", "cpuVendorFreq", @JsonPropertyOrder({"cpuVendor", "cpuName", "processorId", "cpuIdentifier", "microArchitecture", "cpu64bit", "cpuVendorFreq",
"physicalCpus", "physicalCores", "logicalCpu"}) "physicalCpus", "physicalCores", "logicalCpu"})
public class ProcessorInfo { public class ProcessorInfo {

View File

@ -25,14 +25,13 @@ public class SystemInfoServiceImpl implements SystemInfoService {
@Override @Override
public ProcessorInfo getProcessInfo() { public ProcessorInfo getProcessInfo() {
CentralProcessor proc = si.getHardware().getProcessor(); CentralProcessor proc = si.getHardware().getProcessor();
CentralProcessor.ProcessorIdentifier pi = proc.getProcessorIdentifier(); return IStructConvert.INSTANCE.toProcessorInfo(proc, proc.getProcessorIdentifier());
return IStructConvert.INSTINCT.toProcessorInfo(proc, pi);
} }
@Override @Override
public HwInfo getHardwareInfo() { public HwInfo getHardwareInfo() {
ComputerSystem cs = si.getHardware().getComputerSystem(); ComputerSystem cs = si.getHardware().getComputerSystem();
return IStructConvert.INSTINCT.toHwInfo(cs); return IStructConvert.INSTANCE.toHwInfo(cs);
} }
} }