|
|
@@ -296,25 +296,28 @@ public class ProtectionServiceImpl extends ServiceImpl<ProtectionMapper, IotAlar
|
|
|
|
|
|
@Override
|
|
|
public int checkExitDevice(Long orgId, Long deviceId) {
|
|
|
- /* LambdaQueryWrapper<IotAlarmSubsystem> wrapper=new LambdaQueryWrapper<>();
|
|
|
- wrapper.eq(IotAlarmSubsystem::getOrgId,orgId);
|
|
|
- wrapper.eq(IotAlarmSubsystem::getDeleted,0);
|
|
|
+
|
|
|
+ LambdaQueryWrapper<IotAlarmSubsystem> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(IotAlarmSubsystem::getOrgId, orgId);
|
|
|
+ wrapper.eq(IotAlarmSubsystem::getDeleted, 0);
|
|
|
final List<IotAlarmSubsystem> subsystemList = baseMapper.selectList(wrapper);
|
|
|
- if (subsystemList.isEmpty()){
|
|
|
+ if (subsystemList.isEmpty()) {
|
|
|
return 0;
|
|
|
}
|
|
|
final boolean match = subsystemList.stream().anyMatch(r -> ObjectUtil.equal(r.getSource(), 1));
|
|
|
- if (!match){
|
|
|
+ if (!match) {
|
|
|
+ //说明没有从主机同步过来的设备
|
|
|
+ return 0;
|
|
|
+ }else {
|
|
|
+ if (deviceId != null) {
|
|
|
+ Integer exit = baseMapper.checkDeviceBySync(orgId, deviceId);
|
|
|
+ if (ObjectUtil.equal(1, exit)) {
|
|
|
+ //说明这个设备是通过主机同步的
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
return 1;
|
|
|
}
|
|
|
- return lambdaQuery()
|
|
|
- .eq(IotAlarmSubsystem::getOrgId, orgId)
|
|
|
- .ne(ObjectUtil.isNotNull(deviceId), IotAlarmSubsystem::getDeviceId, deviceId)
|
|
|
- .eq(IotAlarmSubsystem::getSource, 1)
|
|
|
- .eq(IotAlarmSubsystem::getDeleted, 0)
|
|
|
- .count()
|
|
|
- .intValue();*/
|
|
|
- return baseMapper.checkExitDevice(orgId,deviceId);
|
|
|
}
|
|
|
|
|
|
@Override
|