|
@@ -71,44 +71,41 @@ public class SceneService implements ISceneService {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public PageInfo pageList(ScenePram param) {
|
|
public PageInfo pageList(ScenePram param) {
|
|
|
-
|
|
|
|
|
String deptId = tmDepartmentService.getDeptId();
|
|
String deptId = tmDepartmentService.getDeptId();
|
|
|
-
|
|
|
|
|
HashMap<String,SceneDeptShare> shareHashMap = new HashMap<>();
|
|
HashMap<String,SceneDeptShare> shareHashMap = new HashMap<>();
|
|
|
- if(param.getSearchType() == 0){ //当前组织下场景
|
|
|
|
|
- List<TmCamera> tmCameraList = tmCameraService.getByDeptIds(Arrays.asList(deptId));
|
|
|
|
|
- List<String> collect = tmCameraList.stream().map(TmCamera::getCameraSn).collect(Collectors.toList());
|
|
|
|
|
- param.setSnCodes(collect);
|
|
|
|
|
- }
|
|
|
|
|
- if(param.getSearchType() == 1){ //下级共享给上级场景
|
|
|
|
|
- List<SceneDeptShare> numList = sceneDeptShareService.getNumListByDeptId(deptId,param.getIsObj());
|
|
|
|
|
- if(numList == null || numList.isEmpty()){
|
|
|
|
|
- return PageInfo.PageInfoEmpty();
|
|
|
|
|
|
|
+ List<String> deptIds = new ArrayList<>();
|
|
|
|
|
+ if(StringUtils.isNotBlank(param.getDeptId())){
|
|
|
|
|
+ deptIds.add(param.getDeptId());
|
|
|
|
|
+ }else {
|
|
|
|
|
+ if(param.getSearchType() == 0){ //当前组织下场景
|
|
|
|
|
+ deptIds.add(deptId);
|
|
|
}
|
|
}
|
|
|
- numList.forEach(e -> shareHashMap.put(e.getNum()+e.getIsObj(),e));
|
|
|
|
|
- param.setNumList(numList.stream().map(SceneDeptShare::getNum).collect(Collectors.toList()));
|
|
|
|
|
- List<TmDepartment> sonByDeptId = tmDepartmentService.getSonByDeptId(deptId);
|
|
|
|
|
- List<String> sonDeptIds = sonByDeptId.stream().map(TmDepartment::getId).collect(Collectors.toList());
|
|
|
|
|
- if(sonDeptIds.isEmpty()){
|
|
|
|
|
- return PageInfo.PageInfoEmpty();
|
|
|
|
|
|
|
+ if(param.getSearchType() == 1){ //下级共享给上级场景
|
|
|
|
|
+ List<SceneDeptShare> numList = sceneDeptShareService.getNumListByDeptId(deptId,param.getIsObj());
|
|
|
|
|
+ if(numList == null || numList.isEmpty()){
|
|
|
|
|
+ return PageInfo.PageInfoEmpty();
|
|
|
|
|
+ }
|
|
|
|
|
+ numList.forEach(e -> shareHashMap.put(e.getNum()+e.getIsObj(),e));
|
|
|
|
|
+ param.setNumList(numList.stream().map(SceneDeptShare::getNum).collect(Collectors.toList()));
|
|
|
|
|
+ List<TmDepartment> sonByDeptId = tmDepartmentService.getSonByDeptId(deptId);
|
|
|
|
|
+ deptIds = sonByDeptId.stream().map(TmDepartment::getId).collect(Collectors.toList());
|
|
|
|
|
+ if(deptIds.isEmpty()){
|
|
|
|
|
+ return PageInfo.PageInfoEmpty();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- List<TmCamera> tmCameraList = tmCameraService.getByDeptIds(sonDeptIds);
|
|
|
|
|
- List<String> collect = tmCameraList.stream().map(TmCamera::getCameraSn).collect(Collectors.toList());
|
|
|
|
|
- param.setSnCodes(collect);
|
|
|
|
|
- }
|
|
|
|
|
- if(param.getSearchType() == 2){ //当前组织及下级组织的数据
|
|
|
|
|
- List<String> deptIds = new ArrayList<>();
|
|
|
|
|
- if(StringUtils.isNotBlank(param.getDeptId())){
|
|
|
|
|
- deptIds.add(param.getDeptId());
|
|
|
|
|
- }else {
|
|
|
|
|
|
|
+ if(param.getSearchType() == 2){ //当前组织及下级组织的数据
|
|
|
List<TmDepartment> sonByDeptId = tmDepartmentService.getSonByDeptId(deptId);
|
|
List<TmDepartment> sonByDeptId = tmDepartmentService.getSonByDeptId(deptId);
|
|
|
deptIds.add(deptId);
|
|
deptIds.add(deptId);
|
|
|
deptIds.addAll(sonByDeptId.stream().map(TmDepartment::getId).collect(Collectors.toList()));
|
|
deptIds.addAll(sonByDeptId.stream().map(TmDepartment::getId).collect(Collectors.toList()));
|
|
|
}
|
|
}
|
|
|
- List<TmCamera> tmCameraList = tmCameraService.getByDeptIds(deptIds);
|
|
|
|
|
- List<String> collect = tmCameraList.stream().map(TmCamera::getCameraSn).collect(Collectors.toList());
|
|
|
|
|
- param.setSnCodes(collect);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ if(deptIds.isEmpty()){
|
|
|
|
|
+ return PageInfo.PageInfoEmpty();
|
|
|
|
|
+ }
|
|
|
|
|
+ List<TmCamera> tmCameraList = tmCameraService.getByDeptIds(deptIds);
|
|
|
|
|
+ List<String> collect = tmCameraList.stream().map(TmCamera::getCameraSn).collect(Collectors.toList());
|
|
|
|
|
+ param.setSnCodes(collect);
|
|
|
|
|
+
|
|
|
if(param.getSnCodes().isEmpty() ){
|
|
if(param.getSnCodes().isEmpty() ){
|
|
|
return PageInfo.PageInfoEmpty();
|
|
return PageInfo.PageInfoEmpty();
|
|
|
}
|
|
}
|