|
@@ -1,8 +1,5 @@
|
|
package com.fdkankan.manage_jp.service.impl;
|
|
package com.fdkankan.manage_jp.service.impl;
|
|
-import java.util.Arrays;
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Set;
|
|
|
|
|
|
+import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
@@ -215,11 +212,20 @@ public class CameraServiceImpl extends MPJBaseServiceImpl<ICameraMapper, Camera>
|
|
throw new BusinessException(ResultCode.USER_NOT_EXIST);
|
|
throw new BusinessException(ResultCode.USER_NOT_EXIST);
|
|
}
|
|
}
|
|
Integer cameraType = CameraTypeUtils.getCameraType(param.getType());
|
|
Integer cameraType = CameraTypeUtils.getCameraType(param.getType());
|
|
- List<CameraDetail> cameraDetails = cameraDetailService.getByCompanyAndType(user.getCompanyId(),cameraType);
|
|
|
|
|
|
+ Set<Long> roleIds = userRoleService.getByUser(user);
|
|
|
|
+ List<CameraDetail> cameraDetails = new ArrayList<>();
|
|
|
|
+ if(roleIds.contains(5L)){
|
|
|
|
+ cameraDetails = cameraDetailService.getByCompanyAndType(null,cameraType);
|
|
|
|
+ }else if(roleIds.contains(6L)){
|
|
|
|
+ cameraDetails = cameraDetailService.getByCompanyAndType(user.getCompanyId(),cameraType);
|
|
|
|
+ }else {
|
|
|
|
+ cameraDetails = cameraDetailService.getByUserIdAndType(user.getId(),cameraType);
|
|
|
|
+ }
|
|
|
|
+
|
|
if(cameraDetails.isEmpty()){
|
|
if(cameraDetails.isEmpty()){
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
List<Long> cameraIds = cameraDetails.stream().map(CameraDetail::getCameraId).collect(Collectors.toList());
|
|
List<Long> cameraIds = cameraDetails.stream().map(CameraDetail::getCameraId).collect(Collectors.toList());
|
|
return this.listByIds(cameraIds);
|
|
return this.listByIds(cameraIds);
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+}
|