diff --git a/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/industrial/IpcSysStatusController.java b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/industrial/IpcSysStatusController.java index ba2b65f..d16622a 100644 --- a/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/industrial/IpcSysStatusController.java +++ b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/industrial/IpcSysStatusController.java @@ -45,9 +45,9 @@ public class IpcSysStatusController extends BaseController * 系统信息 */ @GetMapping("/getSysStatus") - public AjaxResult getSysStatus(@RequestParam("equipName")String equipName) + public AjaxResult getSysStatus() { - return AjaxResult.success(ipcSysStatusService.selectLatestIpcSysStatusByEquipName(equipName)); + return AjaxResult.success(ipcSysStatusService.selectLatestIpcSysStatus()); } /** diff --git a/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IpcDataProcess.java b/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IpcDataProcess.java index f4d10bf..cb25988 100644 --- a/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IpcDataProcess.java +++ b/zfipc-server/zfipc-datasyn/src/main/java/com/inspur/datasyn/modbus/IpcDataProcess.java @@ -314,7 +314,7 @@ public class IpcDataProcess implements Runnable { ipcRunningStatusRecordService.insertIpcRunningStatusRecord(ipcRunningStatusRecord); //修改系统状态时间 IIpcSysStatusService ipcSysStatusService = SpringUtils.getBean(IIpcSysStatusService.class); - IpcSysStatus sysStatus = ipcSysStatusService.selectIpcSysStatusList(null).get(0); + IpcSysStatus sysStatus = ipcSysStatusService.selectLatestIpcSysStatus(); //0:停机维护,1:运行,2:待机,3:试运行 switch(status) { case "0" : diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/MonitorInfo.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/MonitorInfo.java index a8ba8c1..9472517 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/MonitorInfo.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/domain/MonitorInfo.java @@ -7,6 +7,10 @@ package com.inspur.industrial.domain; */ public class MonitorInfo { + /** + * 设备id + */ + String equipId; /** * 设备名 */ @@ -32,6 +36,14 @@ public class MonitorInfo { */ String onlineTime; + public String getEquipId() { + return equipId; + } + + public void setEquipId(String equipId) { + this.equipId = equipId; + } + public String getEquipName() { return equipName; } diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcSysStatusMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcSysStatusMapper.java index d91fd45..2bed75c 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcSysStatusMapper.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcSysStatusMapper.java @@ -32,7 +32,7 @@ public interface IpcSysStatusMapper * @param equipId 设备id * @return 最新一条状态信息 */ - public IpcSysStatus selectLatestIpcSysStatusByEquipId(String equipId); + public IpcSysStatus selectLatestIpcSysStatus(); /** * 新增系统状态 diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcSysStatusService.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcSysStatusService.java index 8a65cff..3c3fdf6 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcSysStatusService.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcSysStatusService.java @@ -33,7 +33,7 @@ public interface IIpcSysStatusService * @param equipName 设备名 * @return 最新一条状态信息 */ - public IpcSysStatus selectLatestIpcSysStatusByEquipName(String equipName); + public IpcSysStatus selectLatestIpcSysStatus(); /** * 根据设备名查询监控信息 diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcSysStatusServiceImpl.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcSysStatusServiceImpl.java index 3fd487a..1767f23 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcSysStatusServiceImpl.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcSysStatusServiceImpl.java @@ -60,16 +60,8 @@ public class IpcSysStatusServiceImpl implements IIpcSysStatusService * @param equipId 设备id * @return 最新一条状态信息 */ - public IpcSysStatus selectLatestIpcSysStatusByEquipName(String equipName){ - - IpcEquipInfo queryEquipInfo = new IpcEquipInfo(); - queryEquipInfo.setEquipName(equipName); - List equipInfoList = ipcEquipInfoService.selectIpcEquipInfoList(queryEquipInfo); - if (equipInfoList.size() == 0){ - return null; - } - String equipId = equipInfoList.get(0).getId(); - return ipcSysStatusMapper.selectLatestIpcSysStatusByEquipId(equipId); + public IpcSysStatus selectLatestIpcSysStatus(){ + return ipcSysStatusMapper.selectLatestIpcSysStatus(); } /** @@ -83,12 +75,13 @@ public class IpcSysStatusServiceImpl implements IIpcSysStatusService if (equipInfo == null){ return null; } + monitorInfo.setEquipId(equipInfo.getId()); monitorInfo.setEquipName(equipInfo.getEquipName()); monitorInfo.setEquipNum(equipInfo.getEquipNum()); LocalDateTime now = LocalDateTime.now(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); monitorInfo.setNowTime(now.format(formatter)); - IpcSysStatus sysStatus = selectLatestIpcSysStatusByEquipName(equipName); + IpcSysStatus sysStatus = selectLatestIpcSysStatus(); monitorInfo.setStartTime(sysStatus == null ? null : sysStatus.getTrialTime().format(formatter)); //运行时间 if(sysStatus != null && sysStatus.getTrialTime() != null) { diff --git a/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcSysStatusMapper.xml b/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcSysStatusMapper.xml index 347575c..2453c9c 100644 --- a/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcSysStatusMapper.xml +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcSysStatusMapper.xml @@ -29,10 +29,10 @@ - - - where equip_id = #{equipId} order by id desc limit 1 + order by id desc limit 1