|
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fdkankan.agent.common.OssPath;
|
|
|
import com.fdkankan.agent.common.PageInfo;
|
|
|
import com.fdkankan.agent.common.ResultCode;
|
|
|
+import com.fdkankan.agent.common.ResultData;
|
|
|
import com.fdkankan.agent.entity.*;
|
|
|
import com.fdkankan.agent.exception.BusinessException;
|
|
|
import com.fdkankan.agent.httpClient.client.FdKKClient;
|
|
@@ -85,54 +86,22 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
|
|
|
if(param.getType() == 3){ //双目lite
|
|
|
return sceneService.pageList(param);
|
|
|
}
|
|
|
- //优化查询,去掉left join
|
|
|
- //snCode 查询,userName 查询,companyId查询
|
|
|
- //snCode回显,userName回显
|
|
|
- if(StringUtils.isNotBlank(param.getSnCode())){
|
|
|
- List<Camera> cameraList = cameraService.getLikeBySnCode(param.getSnCode());
|
|
|
- List<Long> cameraIds = cameraList.stream().map(Camera::getId).collect(Collectors.toList());
|
|
|
- param.setCameraIds(cameraIds);
|
|
|
- }
|
|
|
if(StringUtils.isNotBlank(param.getUserName())){
|
|
|
List<User> userList = userService.getLikeByUserName(param.getUserName());
|
|
|
List<Long> userIds = userList.stream().map(User::getId).collect(Collectors.toList());
|
|
|
param.setUserIds(userIds);
|
|
|
}
|
|
|
|
|
|
- if(param.getAgentNew().getParentId() != null){ //分销商
|
|
|
- AgentNew agentNew = agentNewService.getById(param.getAgentNew().getParentId());
|
|
|
- param.setSubAgentId(param.getAgentId());
|
|
|
- param.setAgentId(agentNew.getId());
|
|
|
- }
|
|
|
-
|
|
|
List<CameraDetail> details = cameraDetailService.getListByAgentId(param.getAgentId());
|
|
|
List<Long> cameraIds = details.stream().map(CameraDetail::getCameraId).collect(Collectors.toList());
|
|
|
- if(param.getCameraIds() == null ){
|
|
|
- param.setCameraIds(cameraIds);
|
|
|
- }else {
|
|
|
- if(param.getCameraIds().isEmpty()){
|
|
|
- return PageInfo.PageInfo(new Page(param.getPageNum(),param.getPageSize()));
|
|
|
- }
|
|
|
- List<Long> intersection = cameraIds.stream().filter(param.getCameraIds()::contains).collect(Collectors.toList());
|
|
|
- param.setCameraIds(intersection);
|
|
|
- }
|
|
|
- if((param.getCameraIds() != null && param.getCameraIds().size()<=0) || (param.getUserIds() != null && param.getUserIds().size()<=0)){
|
|
|
- return PageInfo.PageInfo(new Page(param.getPageNum(),param.getPageSize()));
|
|
|
+
|
|
|
+ List<Long> authCameraIds = agentNewCameraService.getBySubAgent(param.getAgentId());
|
|
|
+ if(!authCameraIds.isEmpty()) {
|
|
|
+ cameraIds.addAll(authCameraIds);
|
|
|
}
|
|
|
- if(param.getSubAgentId() != null){ //指定分销商查询
|
|
|
- List<Long> subCameraIds = agentNewCameraService.getBySubAgent(param.getSubAgentId());
|
|
|
- if(subCameraIds.isEmpty()){
|
|
|
- return PageInfo.PageInfo(new Page(param.getPageNum(),param.getPageSize()));
|
|
|
- }
|
|
|
- if(param.getCameraIds() != null && !param.getCameraIds().isEmpty()){
|
|
|
- List<Long> newCameraIds = param.getCameraIds().stream().filter(subCameraIds::contains).collect(Collectors.toList());
|
|
|
- param.setCameraIds(newCameraIds);
|
|
|
- if(newCameraIds.isEmpty()){
|
|
|
- return PageInfo.PageInfo(new Page(param.getPageNum(),param.getPageSize()));
|
|
|
- }
|
|
|
- }else {
|
|
|
- param.setCameraIds(subCameraIds);
|
|
|
- }
|
|
|
+
|
|
|
+ if(cameraIds.isEmpty()){
|
|
|
+ return PageInfo.PageInfo(new Page<>(param.getPageNum(),param.getPageSize()));
|
|
|
}
|
|
|
|
|
|
Page<SceneVo> page = this.getBaseMapper().pageList(new Page<>(param.getPageNum(),param.getPageSize()),param);
|