|
@@ -4,8 +4,10 @@ package com.fdkankan.fusion.service.impl;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fdkankan.fusion.common.ResultCode;
|
|
|
+import com.fdkankan.fusion.common.util.SceneTypeUtil;
|
|
|
import com.fdkankan.fusion.entity.*;
|
|
|
import com.fdkankan.fusion.exception.BusinessException;
|
|
|
import com.fdkankan.fusion.common.PageInfo;
|
|
@@ -74,120 +76,56 @@ public class SceneCommonService implements ISceneCommonService {
|
|
|
return listAll;
|
|
|
}
|
|
|
|
|
|
+ @Autowired
|
|
|
+ ISceneService sceneService;
|
|
|
@Override
|
|
|
public PageInfo pageList(ScenePram param) {
|
|
|
if(param.getType() == null){
|
|
|
throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
}
|
|
|
|
|
|
- if(StringUtils.isNotBlank(param.getDeptId())){
|
|
|
- List<String> deptIds = new ArrayList<>();
|
|
|
- if(param.getSearchType() == 0){
|
|
|
- List<TmDepartment> sonByDeptId = tmDepartmentService.getSonByDeptId(param.getDeptId());
|
|
|
- deptIds = sonByDeptId.stream().map(TmDepartment::getId).collect(Collectors.toList());
|
|
|
- }
|
|
|
- deptIds.add(param.getDeptId());
|
|
|
- List<TmCamera> tmCameras = tmCameraService.getByDeptIds(deptIds);
|
|
|
- Set<String> snCodeSet = tmCameras.parallelStream().map(TmCamera::getCameraSn).collect(Collectors.toSet());
|
|
|
- List<String> snCodes = param.getSnCodes();
|
|
|
- if(snCodes == null){
|
|
|
- snCodes = new ArrayList<>(snCodeSet);
|
|
|
- }else {
|
|
|
- snCodes = snCodes.stream().filter(snCodeSet::contains).collect(Collectors.toList());
|
|
|
- }
|
|
|
- param.setSnCodes(snCodes);
|
|
|
+ LambdaQueryWrapper<Scene> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ if(StringUtils.isNotBlank(param.getSceneName())){
|
|
|
+ wrapper.like(Scene::getTitle,param.getSceneName());
|
|
|
}
|
|
|
-// if(StringUtils.isNotBlank(param.getSnCode())){
|
|
|
-// List<String> snCodes = param.getSnCodes();
|
|
|
-// List<String> snCodes1 = new ArrayList<>();
|
|
|
-// snCodes1.add(param.getSnCode());
|
|
|
-// if(snCodes == null){
|
|
|
-// snCodes = snCodes1;
|
|
|
-// }else {
|
|
|
-// snCodes = snCodes.stream().filter(snCodes1::contains).collect(Collectors.toList());
|
|
|
-// }
|
|
|
-// param.setSnCodes(snCodes);
|
|
|
-// }
|
|
|
- if(param.getCaseId() !=null){
|
|
|
- String deptId = caseService.getDeptId(param.getCaseId());
|
|
|
- List<TmCamera> tmCameras = tmCameraService.getByDeptIds(Arrays.asList(deptId));
|
|
|
- List<String> snCodes = param.getSnCodes();
|
|
|
- List<String> snCodes1 = tmCameras.stream().map(TmCamera::getCameraSn).collect(Collectors.toList());
|
|
|
- snCodes1.add(param.getSnCode());
|
|
|
- if(snCodes == null){
|
|
|
- snCodes = snCodes1;
|
|
|
- }else {
|
|
|
- snCodes = snCodes.stream().filter(snCodes1::contains).collect(Collectors.toList());
|
|
|
- }
|
|
|
- param.setSnCodes(snCodes);
|
|
|
+ wrapper.eq(Scene::getSceneSource, SceneTypeUtil.getSceneSource(param.getType()));
|
|
|
+ if(SceneTypeUtil.isLaserMesh(param.getType())){
|
|
|
+ param.setIsLaserMesh(true);
|
|
|
}
|
|
|
- if(CollectionUtil.isEmpty(param.getSnCodes()) && CollectionUtil.isEmpty(param.getNumList())){
|
|
|
- return PageInfo.PageInfoEmpty();
|
|
|
+ if(param.getIsLaserMesh()){
|
|
|
+ wrapper.notIn(Scene::getBuildObjStatus,0);
|
|
|
}
|
|
|
- List<SceneVo> sceneVoList = new ArrayList<>();
|
|
|
- long total = 0;
|
|
|
- if(param.getType() == 0 || param.getType() == 1 || param.getType() == 4 || param.getType() == 6 || param.getType() == 7){ //看看,看见 ,深时obj
|
|
|
- //获取四维(看看,看见)场景数据
|
|
|
- FdkkResponse fdkkResponse = fdKKClient.sceneList(param);
|
|
|
- if(fdkkResponse.getCode() !=0){
|
|
|
- throw new BusinessException(fdkkResponse.getCode(),fdkkResponse.getMsg());
|
|
|
- }
|
|
|
- PageInfo pageInfo = JSONObject.parseObject(JSONObject.toJSONString(fdkkResponse.getData()), PageInfo.class);
|
|
|
- total = pageInfo.getTotal();
|
|
|
- JSONArray list = JSONArray.parseArray(JSONObject.toJSONString( pageInfo.getList()));
|
|
|
- sceneVoList = overSceneVo(list,param.getType());
|
|
|
|
|
|
+ Page<Scene> page = sceneService.page(new Page<>(param.getPageNum(), param.getPageSize()), wrapper);
|
|
|
+ List<SceneVo> sceneVoList = new ArrayList<>();
|
|
|
+ for (Scene scene : page.getRecords()) {
|
|
|
+ SceneVo vo = new SceneVo();
|
|
|
+ vo.setId(scene.getId());
|
|
|
+ vo.setBuildObjStatus(scene.getBuildObjStatus());
|
|
|
+ vo.setCreateTime(scene.getCreateTime());
|
|
|
+ vo.setName(scene.getTitle());
|
|
|
+ vo.setNum(scene.getSceneCode());
|
|
|
+ vo.setPayStatus(1);
|
|
|
+ vo.setSceneName(scene.getTitle());
|
|
|
+ vo.setSnCode(scene.getSnCode());
|
|
|
+ vo.setStatus(scene.getStatus());
|
|
|
+ vo.setThumb(scene.getInitPic());
|
|
|
+ vo.setTitle(scene.getTitle());
|
|
|
+ vo.setViewCount(scene.getViewCount());
|
|
|
+ vo.setIsLaser(SceneTypeUtil.isLaser(param.getType()));
|
|
|
+ vo.setType(param.getType());
|
|
|
+ vo.setPhone(scene.getUserName());
|
|
|
+ vo.setBind(true);
|
|
|
+ vo.setLocation(scene.getLocation());
|
|
|
+ vo.setInFusion(false);
|
|
|
+ //vo.setOrientation();
|
|
|
+ //vo.setRtkLocation();
|
|
|
+ sceneVoList.add(vo);
|
|
|
}
|
|
|
- if(param.getType() == 2 || param.getType() == 5){ //深时
|
|
|
- //获取激光(深时)场景数据
|
|
|
- LaserSceneParam laserSceneParam = new LaserSceneParam();
|
|
|
- laserSceneParam.setPageNum(param.getPageNum());
|
|
|
- laserSceneParam.setPageSize(param.getPageSize());
|
|
|
- laserSceneParam.setStatus(param.getStatus());
|
|
|
- laserSceneParam.setSnCode(param.getSnCode());
|
|
|
- laserSceneParam.setSnCodes(param.getSnCodes());
|
|
|
- if(param.getType() == 5){
|
|
|
- laserSceneParam.setSceneSource(5);
|
|
|
- }
|
|
|
- if(StringUtils.isNotBlank(param.getSceneName())){
|
|
|
- laserSceneParam.setTitle(param.getSceneName());
|
|
|
- }
|
|
|
- if(param.getNumList() != null && param.getNumList().size() >0){
|
|
|
- laserSceneParam.setSceneCodes(param.getNumList());
|
|
|
- }
|
|
|
- FdkkResponse fdkkResponse = laserClient.sceneList(laserSceneParam);
|
|
|
- if(fdkkResponse.getCode() !=200){
|
|
|
- throw new BusinessException(fdkkResponse.getCode(),fdkkResponse.getMsg());
|
|
|
- }
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(fdkkResponse.getData()));
|
|
|
- JSONArray list = jsonObject.getJSONArray("list");
|
|
|
- total =jsonObject.getLong("total");
|
|
|
- for (Object o : list) {
|
|
|
- String res = JSONObject.toJSONString(o);
|
|
|
- SceneVo vo = JSONObject.parseObject(res,SceneVo.class);
|
|
|
- if( StringUtils.isEmpty(vo.getPhone())){
|
|
|
- vo.setBind(false);
|
|
|
- }
|
|
|
- if(vo.getStatus() == 4){ //4生成OBJ中设置为计算中
|
|
|
- vo.setStatus(0);
|
|
|
- }
|
|
|
- vo.setType(param.getType());
|
|
|
- sceneVoList.add(vo);
|
|
|
- }
|
|
|
- }
|
|
|
- Set<String> snCodes = sceneVoList.stream().map(SceneVo::getSnCode).collect(Collectors.toSet());
|
|
|
|
|
|
- HashMap<String, TmDepartment> map = tmCameraService.getMapBySnCodes(snCodes);
|
|
|
- for (SceneVo sceneVo : sceneVoList) {
|
|
|
- TmDepartment tmDepartment = map.get(sceneVo.getSnCode().toUpperCase());
|
|
|
- if(tmDepartment != null){
|
|
|
- sceneVo.setDeptId(tmDepartment.getId());
|
|
|
- sceneVo.setDeptName(tmDepartment.getName());
|
|
|
- }
|
|
|
- }
|
|
|
Page<SceneVo> voPage = new Page<>(param.getPageNum(),param.getPageSize());
|
|
|
voPage.setRecords(sceneVoList);
|
|
|
- voPage.setTotal(total);
|
|
|
+ voPage.setTotal(page.getTotal());
|
|
|
return PageInfo.PageInfo(voPage);
|
|
|
}
|
|
|
|