|
|
@@ -1,17 +1,13 @@
|
|
|
-package com.fdkankan.scene.service.impl;
|
|
|
+package com.fdkankan.manage.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
|
import com.fdkankan.common.constant.HttpCode;
|
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
|
-import com.fdkankan.scene.service.IFdkkLaserService;
|
|
|
-import com.fdkankan.scene.vo.SceneBySnCodeVo;
|
|
|
-import com.fdkankan.scene.vo.SceneNumVo;
|
|
|
+import com.fdkankan.manage.service.IFdkkLaserService;
|
|
|
import lombok.Data;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.http.HttpEntity;
|
|
|
-import org.springframework.http.HttpHeaders;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -34,7 +30,7 @@ public class IFdkkLaserServiceImpl implements IFdkkLaserService {
|
|
|
private final String GET_LASER_SCENE_CODE_URL="/laser/4dage/scene/getScenesBySnCode";
|
|
|
private final String GET_LASER_SCENE_CNT_URL="/laser/4dage/scene/getSceneNumByCamera";
|
|
|
|
|
|
- @Value("${4dkk.laserService.host}")
|
|
|
+ @Value("${4dkk.laserService.host:https://uat-laser.4dkankan.com}")
|
|
|
private String laserHost;
|
|
|
|
|
|
private RestTemplate restTemplate = new RestTemplate();
|
|
|
@@ -90,60 +86,6 @@ public class IFdkkLaserServiceImpl implements IFdkkLaserService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 根据用户获取激光相机数量
|
|
|
- * @param token
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Override
|
|
|
- public SceneNumVo getLaserSceneNumByUser(String token) {
|
|
|
- SceneNumVo sceneNumVo = new SceneNumVo();
|
|
|
- try {
|
|
|
- String url = laserHost + GET_LASER_SCENE_USER_URL;
|
|
|
- HttpHeaders headers = new HttpHeaders();
|
|
|
- headers.add("fdToken", token);
|
|
|
- HttpEntity<Object> formEntity = new HttpEntity<>( headers);
|
|
|
- log.info("获取激光转台相机场景数,url:{},fdToken:{}",GET_LASER_SCENE_USER_URL,token);
|
|
|
- ResponseEntity<Result> responseEntity = restTemplate.postForEntity(url,formEntity, Result.class);
|
|
|
- log.info("获取激光转台相机场景数,url:{},fdToken:{},结果:{}",url,token,JSONObject.toJSONString(responseEntity.getBody()));
|
|
|
- if(responseEntity.getStatusCode() != HttpStatus.OK || responseEntity.getBody().getCode() != HttpStatus.OK.value()){
|
|
|
- log.error("自研激光转台相机协作失败!");
|
|
|
- return sceneNumVo;
|
|
|
- }
|
|
|
- sceneNumVo = JSONObject.parseObject(JSONObject.toJSONString(responseEntity.getBody().getData()), SceneNumVo.class);
|
|
|
- sceneNumVo.setTotalNum(sceneNumVo.getSceneNum() + sceneNumVo.getCooperationSceneNum());
|
|
|
- }catch (Exception e){
|
|
|
- log.error("自研激光转台相机协作失败!",e);
|
|
|
- }
|
|
|
- return sceneNumVo ;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 根据相机编码获取激光场景
|
|
|
- */
|
|
|
- public List<SceneBySnCodeVo> getScenesBySnCode(String snCode, String token) {
|
|
|
- List<SceneBySnCodeVo> sceneVo = new ArrayList<>();
|
|
|
- try {
|
|
|
- String url = laserHost + GET_LASER_SCENE_CODE_URL;
|
|
|
- Map<String, String> param = new HashMap<>();
|
|
|
- param.put("snCode",snCode);
|
|
|
- HttpHeaders headers = new HttpHeaders();
|
|
|
- headers.add("fdToken", token);
|
|
|
- HttpEntity<Object> formEntity = new HttpEntity<>(param, headers);
|
|
|
- log.info("获取激光转台场景,url:{},param:{},fdToken:{}",GET_LASER_SCENE_USER_URL,param,token);
|
|
|
- ResponseEntity<Result> responseEntity = restTemplate.postForEntity(url,formEntity, Result.class);
|
|
|
- log.info("获取激光转台场景,url:{},param:{},fdToken:{},结果:{}",url,param,token,JSONObject.toJSONString(responseEntity.getBody()));
|
|
|
- if(responseEntity.getStatusCode() != HttpStatus.OK || responseEntity.getBody().getCode() != HttpStatus.OK.value()){
|
|
|
- log.error("自研激光转台相机协作失败!");
|
|
|
- return sceneVo;
|
|
|
- }
|
|
|
- sceneVo = JSONObject.parseObject(JSONObject.toJSONString(responseEntity.getBody().getData()), List.class);
|
|
|
- }catch (Exception e){
|
|
|
- log.error("自研激光转台相机协作失败!",e);
|
|
|
- }
|
|
|
- return sceneVo ;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
* 根据 snCode 获取激光场景场景数量
|
|
|
*/
|
|
|
public Integer getLaserSceneNum(String snCode){
|
|
|
@@ -163,6 +105,7 @@ public class IFdkkLaserServiceImpl implements IFdkkLaserService {
|
|
|
}
|
|
|
return 0;
|
|
|
}
|
|
|
+
|
|
|
@Data
|
|
|
public static class Result<T> implements Serializable {
|
|
|
private static final long serialVersionUID = -1491499610244557029L;
|