REM:
1.修正数据库设备信息和缓存设备信息同步
This commit is contained in:
chenlinghy 2021-02-03 10:38:46 +08:00
parent 16bdcdb66a
commit 76696205b0
3 changed files with 22 additions and 3 deletions

View File

@ -56,6 +56,12 @@ public interface DisposeDeviceManager {
*/
List<DisposeDevice> getAllNormalDisposeDevices();
/**
* Gets all dispose devices.
*
* @return the all dispose devices
*/
List<DisposeDevice> getAllDisposeDevices();
/**
* Gets dispose device by id.
*

View File

@ -290,6 +290,16 @@ public class DisposeDeviceManagerImpl implements DisposeDeviceManager {
.collect(Collectors.toList());
}
/**
* Gets all dispose devices.
*
* @return the all dispose devices
*/
@Override
public List<DisposeDevice> getAllDisposeDevices(){
return disposeDeviceMapper.selectAll();
}
/**
* Gets dispose device by id.
*

View File

@ -57,7 +57,8 @@ public class DisposeAbilityRouterServiceImpl implements DisposeAbilityRouterServ
*/
@PostConstruct
private void initDisposeAbility() {
List<DisposeDevice> devList = disposeDeviceManager.getAllNormalDisposeDevices();
//List<DisposeDevice> devList = disposeDeviceManager.getAllNormalDisposeDevices();
List<DisposeDevice> 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)) {
if(!v.getDev().getStatus().equals(ObjectStatus.DELETED)){
// 如果数据库中设备不存在那么删除该设备
v.getDev().setStatus(ObjectStatus.DELETED);
}
} else {
v.getDev().setStatus(ObjectStatus.NORMAL);