From 76696205b0a369e577cf7f77a4c172461d818461 Mon Sep 17 00:00:00 2001 From: chenlinghy Date: Wed, 3 Feb 2021 10:38:46 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=E4=BF=AE=E6=AD=A3=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E8=AE=BE=E5=A4=87=E4=BF=A1=E6=81=AF=E5=92=8C?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E8=AE=BE=E5=A4=87=E4=BF=A1=E6=81=AF=E5=90=8C?= =?UTF-8?q?=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/dispose/manager/DisposeDeviceManager.java | 6 ++++++ .../dispose/manager/impl/DisposeDeviceManagerImpl.java | 10 ++++++++++ .../service/impl/DisposeAbilityRouterServiceImpl.java | 9 ++++++--- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/dispose/manager/DisposeDeviceManager.java b/src/main/java/com/dispose/manager/DisposeDeviceManager.java index bb18d7cd..cc072f94 100644 --- a/src/main/java/com/dispose/manager/DisposeDeviceManager.java +++ b/src/main/java/com/dispose/manager/DisposeDeviceManager.java @@ -56,6 +56,12 @@ public interface DisposeDeviceManager { */ List getAllNormalDisposeDevices(); + /** + * Gets all dispose devices. + * + * @return the all dispose devices + */ + List getAllDisposeDevices(); /** * Gets dispose device by id. * diff --git a/src/main/java/com/dispose/manager/impl/DisposeDeviceManagerImpl.java b/src/main/java/com/dispose/manager/impl/DisposeDeviceManagerImpl.java index bd5b19c3..46732b7d 100644 --- a/src/main/java/com/dispose/manager/impl/DisposeDeviceManagerImpl.java +++ b/src/main/java/com/dispose/manager/impl/DisposeDeviceManagerImpl.java @@ -290,6 +290,16 @@ public class DisposeDeviceManagerImpl implements DisposeDeviceManager { .collect(Collectors.toList()); } + /** + * Gets all dispose devices. + * + * @return the all dispose devices + */ + @Override + public List getAllDisposeDevices(){ + return disposeDeviceMapper.selectAll(); + } + /** * Gets dispose device by id. * diff --git a/src/main/java/com/dispose/service/impl/DisposeAbilityRouterServiceImpl.java b/src/main/java/com/dispose/service/impl/DisposeAbilityRouterServiceImpl.java index 58b8b2ba..850b82ba 100644 --- a/src/main/java/com/dispose/service/impl/DisposeAbilityRouterServiceImpl.java +++ b/src/main/java/com/dispose/service/impl/DisposeAbilityRouterServiceImpl.java @@ -57,7 +57,8 @@ public class DisposeAbilityRouterServiceImpl implements DisposeAbilityRouterServ */ @PostConstruct private void initDisposeAbility() { - List devList = disposeDeviceManager.getAllNormalDisposeDevices(); + //List devList = disposeDeviceManager.getAllNormalDisposeDevices(); + List devList = disposeDeviceManager.getAllDisposeDevices(); devList.forEach(this::addDisposeAbilityDevice); } @@ -223,8 +224,10 @@ public class DisposeAbilityRouterServiceImpl implements DisposeAbilityRouterServ DisposeDevice dev = disposeDeviceManager.getDisposeDeviceById(v.getDev().getId()); if (dev == null || !dev.getStatus().equals(ObjectStatus.NORMAL)) { - // 如果数据库中设备不存在,那么删除该设备 - v.getDev().setStatus(ObjectStatus.DELETED); + if(!v.getDev().getStatus().equals(ObjectStatus.DELETED)){ + // 如果数据库中设备不存在,那么删除该设备 + v.getDev().setStatus(ObjectStatus.DELETED); + } } else { v.getDev().setStatus(ObjectStatus.NORMAL);