|
@@ -3,13 +3,8 @@ package com.fdkankan.manage.httpClient.service;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
-import com.fdkankan.manage.common.ResultCode;
|
|
|
|
-import com.fdkankan.common.constant.HttpCode;
|
|
|
|
-import com.fdkankan.manage.exception.BusinessException;
|
|
|
|
import com.fdkankan.common.response.PageInfo;
|
|
import com.fdkankan.common.response.PageInfo;
|
|
import com.fdkankan.common.response.Result;
|
|
import com.fdkankan.common.response.Result;
|
|
-import com.fdkankan.common.util.DateUtil;
|
|
|
|
-import com.fdkankan.manage.common.CameraTypeEnum;
|
|
|
|
import com.fdkankan.manage.entity.Camera;
|
|
import com.fdkankan.manage.entity.Camera;
|
|
import com.fdkankan.manage.entity.CameraDetail;
|
|
import com.fdkankan.manage.entity.CameraDetail;
|
|
import com.fdkankan.manage.entity.User;
|
|
import com.fdkankan.manage.entity.User;
|
|
@@ -17,6 +12,8 @@ import com.fdkankan.manage.httpClient.client.LaserClient;
|
|
import com.fdkankan.manage.httpClient.param.LaserSceneMoveParam;
|
|
import com.fdkankan.manage.httpClient.param.LaserSceneMoveParam;
|
|
import com.fdkankan.manage.httpClient.param.LaserSceneParam;
|
|
import com.fdkankan.manage.httpClient.param.LaserSceneParam;
|
|
import com.fdkankan.manage.httpClient.vo.FdkkResponse;
|
|
import com.fdkankan.manage.httpClient.vo.FdkkResponse;
|
|
|
|
+import com.fdkankan.manage.service.ICameraDetailService;
|
|
|
|
+import com.fdkankan.manage.service.ICameraService;
|
|
import com.fdkankan.manage.service.IUserService;
|
|
import com.fdkankan.manage.service.IUserService;
|
|
import com.fdkankan.manage.vo.request.SceneParam;
|
|
import com.fdkankan.manage.vo.request.SceneParam;
|
|
import com.fdkankan.manage.vo.response.SceneVo;
|
|
import com.fdkankan.manage.vo.response.SceneVo;
|
|
@@ -26,16 +23,11 @@ import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.HttpStatus;
|
|
-import org.springframework.http.ResponseEntity;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
-import org.springframework.util.ObjectUtils;
|
|
|
|
-import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@Slf4j
|
|
@Slf4j
|
|
@@ -47,15 +39,15 @@ public class LaserService {
|
|
private String basePath;
|
|
private String basePath;
|
|
@Autowired
|
|
@Autowired
|
|
IUserService userService;
|
|
IUserService userService;
|
|
|
|
+ @Autowired
|
|
|
|
+ ICameraDetailService cameraDetailService;
|
|
|
|
+ @Autowired
|
|
|
|
+ ICameraService cameraService;
|
|
|
|
|
|
|
|
|
|
public PageInfo pageList(SceneParam param) {
|
|
public PageInfo pageList(SceneParam param) {
|
|
- LaserSceneParam newParam = new LaserSceneParam();
|
|
|
|
- BeanUtils.copyProperties(param,newParam);
|
|
|
|
- newParam.setTitle(param.getSceneName());
|
|
|
|
- newParam.setPhone(param.getUserName());
|
|
|
|
- FdkkResponse response = laserClient.sceneList(newParam);
|
|
|
|
-
|
|
|
|
|
|
+ LaserSceneParam laserSceneParam = getLaserSceneParam(param);
|
|
|
|
+ FdkkResponse response = laserClient.sceneList(laserSceneParam);
|
|
JSONObject jsonObject =response.getData();
|
|
JSONObject jsonObject =response.getData();
|
|
if(jsonObject == null){
|
|
if(jsonObject == null){
|
|
Page<SceneVo> voPage = new Page<>(param.getPageNum(),param.getPageSize());
|
|
Page<SceneVo> voPage = new Page<>(param.getPageNum(),param.getPageSize());
|
|
@@ -95,6 +87,34 @@ public class LaserService {
|
|
return PageInfo.PageInfo(voPage);
|
|
return PageInfo.PageInfo(voPage);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private LaserSceneParam getLaserSceneParam(SceneParam param) {
|
|
|
|
+ if(param.getCompanyId()!= null){ //客户场景
|
|
|
|
+ List<CameraDetail> cameraDetails = cameraDetailService.getListByCompanyId(param.getCompanyId());
|
|
|
|
+ param.setSnCodes(this.setSnCodes(cameraDetails));
|
|
|
|
+ }
|
|
|
|
+ if(StringUtils.isNotBlank(param.getUserName())){
|
|
|
|
+ List<CameraDetail> cameraDetails = cameraDetailService.getByUserName(param.getUserName());
|
|
|
|
+ param.setSnCodes(this.setSnCodes(cameraDetails));
|
|
|
|
+ }
|
|
|
|
+ LaserSceneParam newParam = new LaserSceneParam();
|
|
|
|
+ BeanUtils.copyProperties(param,newParam);
|
|
|
|
+ newParam.setTitle(param.getSceneName());
|
|
|
|
+ newParam.setPhone(param.getUserName());
|
|
|
|
+ return newParam;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private List<String> setSnCodes(List<CameraDetail> cameraDetails) {
|
|
|
|
+ if(cameraDetails != null && cameraDetails.size() >0){
|
|
|
|
+ Set<Long> cameraIds = cameraDetails.stream()
|
|
|
|
+ .filter(entity -> entity.getGoodsId() == 10).map(CameraDetail::getCameraId).collect(Collectors.toSet());
|
|
|
|
+ if(cameraIds.size() >0){
|
|
|
|
+ List<Camera> cameraList = cameraService.listByIds(cameraIds);
|
|
|
|
+ return cameraList.stream().map(Camera::getSnCode).collect(Collectors.toList());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
private Integer toFdStatus(Integer status) {
|
|
private Integer toFdStatus(Integer status) {
|
|
//深时状态,-1:场景被删 0:计算中 1计算失败 2计算成功 3封存 4生成OBJ中
|
|
//深时状态,-1:场景被删 0:计算中 1计算失败 2计算成功 3封存 4生成OBJ中
|
|
switch (status){
|
|
switch (status){
|