Ver código fonte

优化门禁_设备信息表-我的门禁接口,去除throw逻辑

james 1 dia atrás
pai
commit
7da1fc2b00

+ 18 - 15
service-eg/service-eg-biz/src/main/java/com/usky/eg/service/impl/EgDeviceServiceImpl.java

@@ -106,24 +106,27 @@ public class EgDeviceServiceImpl extends AbstractCrudService<EgDeviceMapper, EgD
         long userId = SecurityUtils.getUserId();
         //人员设备权限校验,校验通过,可以下发命令控制设备
         Integer fid = baseMapper.getMeetingFaceData(userId);
-        if(fid == null){
-            throw new BusinessException("人脸卡号信息未注册");
-        }
+//        if(fid == null){
+//            throw new BusinessException("人脸卡号信息未注册");
+//        }
         Integer[] deviceFid = baseMapper.getMeetingFaceDeviceList(fid);
-        if(deviceFid.length == 0){
-            throw new BusinessException("人员未绑定设备,请检查");
-        }
+//        if(deviceFid.length == 0){
+//            throw new BusinessException("人员未绑定设备,请检查");
+//        }
 
         IPage<EgDevice> page = new Page<>(requestVO.getCurrent(),requestVO.getSize());
-        LambdaQueryWrapper<EgDevice> queryWrapper = Wrappers.lambdaQuery();
-        queryWrapper.like(StringUtils.isNotBlank(requestVO.getDeviceName()),EgDevice::getDeviceName,requestVO.getDeviceName())
-                .like(StringUtils.isNotBlank(requestVO.getInstallAddress()),EgDevice::getInstallAddress,requestVO.getInstallAddress())
-                .eq(null != requestVO.getServiceStatus(),EgDevice::getServiceStatus,requestVO.getServiceStatus())
-                .eq(null != requestVO.getId(),EgDevice::getId,requestVO.getId())
-                .in(EgDevice::getId,deviceFid)
-                .eq(EgDevice::getTenantId,SecurityUtils.getTenantId())
-                .orderByDesc(EgDevice::getId);
-        page = this.page(page,queryWrapper);
+        if(deviceFid.length > 0){
+            LambdaQueryWrapper<EgDevice> queryWrapper = Wrappers.lambdaQuery();
+            queryWrapper.like(StringUtils.isNotBlank(requestVO.getDeviceName()),EgDevice::getDeviceName,requestVO.getDeviceName())
+                    .like(StringUtils.isNotBlank(requestVO.getInstallAddress()),EgDevice::getInstallAddress,requestVO.getInstallAddress())
+                    .eq(null != requestVO.getServiceStatus(),EgDevice::getServiceStatus,requestVO.getServiceStatus())
+                    .eq(null != requestVO.getId(),EgDevice::getId,requestVO.getId())
+                    .in(EgDevice::getId,deviceFid)
+                    .eq(EgDevice::getTenantId,SecurityUtils.getTenantId())
+                    .orderByDesc(EgDevice::getId);
+            page = this.page(page,queryWrapper);
+        }
+
 
         return new CommonPage<>(page.getRecords(),page.getTotal(),requestVO.getSize(),requestVO.getCurrent());
     }