|
@@ -6,17 +6,21 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fdkankan.manage.common.CacheUtil;
|
|
|
import com.fdkankan.manage.common.PageInfo;
|
|
|
import com.fdkankan.manage.common.Result;
|
|
|
+import com.fdkankan.manage.common.ResultCode;
|
|
|
import com.fdkankan.manage.entity.Camera;
|
|
|
import com.fdkankan.manage.entity.CameraDetail;
|
|
|
import com.fdkankan.manage.entity.User;
|
|
|
+import com.fdkankan.manage.exception.BusinessException;
|
|
|
import com.fdkankan.manage.httpClient.client.LaserClient;
|
|
|
import com.fdkankan.manage.httpClient.param.LaserSceneMoveParam;
|
|
|
import com.fdkankan.manage.httpClient.param.LaserSceneParam;
|
|
|
+import com.fdkankan.manage.httpClient.param.SSDownSceneParam;
|
|
|
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.vo.request.SceneParam;
|
|
|
+import com.fdkankan.manage.vo.response.SSDownSceneVo;
|
|
|
import com.fdkankan.manage.vo.response.SceneVo;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -47,48 +51,56 @@ public class LaserService {
|
|
|
|
|
|
|
|
|
public PageInfo pageList(SceneParam param) {
|
|
|
- if( !CacheUtil.uploadType.equals("oss")){
|
|
|
- return PageInfo.PageInfoEmpty(param.getPageNum(),param.getPageSize());
|
|
|
- }
|
|
|
- LaserSceneParam laserSceneParam = getLaserSceneParam(param);
|
|
|
- if(laserSceneParam == null ){
|
|
|
- return PageInfo.PageInfoEmpty(param.getPageNum(),param.getPageSize());
|
|
|
- }
|
|
|
- FdkkResponse response = laserClient.sceneList(laserSceneParam);
|
|
|
- JSONObject jsonObject =response.getData();
|
|
|
- if(jsonObject == null){
|
|
|
- return PageInfo.PageInfoEmpty(param.getPageNum(),param.getPageSize());
|
|
|
- }
|
|
|
- JSONArray list = jsonObject.getJSONArray("list");
|
|
|
- long total =jsonObject.getLong("total");
|
|
|
-
|
|
|
- List<SceneVo> sceneVoList = new ArrayList<>();
|
|
|
- String newBasePath = basePath;
|
|
|
- newBasePath = newBasePath.contains("dev")? newBasePath + "/dev" : newBasePath;
|
|
|
- newBasePath = newBasePath.contains("uat")? newBasePath + "/uat" : newBasePath;
|
|
|
- newBasePath = newBasePath.replace("/backend","");
|
|
|
- for (Object o : list) {
|
|
|
- String res = JSONObject.toJSONString(o);
|
|
|
- SceneVo vo = JSONObject.parseObject(res,SceneVo.class);
|
|
|
- //深时状态,-1:场景被删 0:计算中 1计算失败 2计算成功 3封存 4生成OBJ中
|
|
|
- JSONObject obj = (JSONObject) o;
|
|
|
- vo.setStatusString(getLaserStatus(vo.getStatus()));
|
|
|
- vo.setStatus(toFdStatus(vo.getStatus()));
|
|
|
- if(vo.getStatus() == -3){
|
|
|
- vo.setPayStatus(-1);
|
|
|
- }else {
|
|
|
+ try {
|
|
|
+ if( !CacheUtil.uploadType.equals("oss")){
|
|
|
+ return PageInfo.PageInfoEmpty(param.getPageNum(),param.getPageSize());
|
|
|
+ }
|
|
|
+ LaserSceneParam laserSceneParam = getLaserSceneParam(param);
|
|
|
+ if(laserSceneParam == null ){
|
|
|
+ return PageInfo.PageInfoEmpty(param.getPageNum(),param.getPageSize());
|
|
|
+ }
|
|
|
+ FdkkResponse response = laserClient.sceneList(laserSceneParam);
|
|
|
+ JSONObject jsonObject =response.getData();
|
|
|
+ if(jsonObject == null){
|
|
|
+ return PageInfo.PageInfoEmpty(param.getPageNum(),param.getPageSize());
|
|
|
+ }
|
|
|
+ JSONArray list = jsonObject.getJSONArray("list");
|
|
|
+ long total =jsonObject.getLong("total");
|
|
|
+
|
|
|
+ List<SceneVo> sceneVoList = new ArrayList<>();
|
|
|
+ String newBasePath = basePath;
|
|
|
+ newBasePath = newBasePath.contains("dev")? newBasePath + "/dev" : newBasePath;
|
|
|
+ newBasePath = newBasePath.contains("uat")? newBasePath + "/uat" : newBasePath;
|
|
|
+ newBasePath = newBasePath.replace("/backend","");
|
|
|
+ for (Object o : list) {
|
|
|
+ String res = JSONObject.toJSONString(o);
|
|
|
+ SceneVo vo = JSONObject.parseObject(res,SceneVo.class);
|
|
|
+ //深时状态,-1:场景被删 0:计算中 1计算失败 2计算成功 3封存 4生成OBJ中
|
|
|
+ JSONObject obj = (JSONObject) o;
|
|
|
+ vo.setStatusString(getLaserStatus(vo.getStatus()));
|
|
|
+ vo.setStatus(toFdStatus(vo.getStatus()));
|
|
|
+ if(vo.getStatus() == -3){
|
|
|
+ vo.setPayStatus(-1);
|
|
|
+ }else {
|
|
|
+ vo.setPayStatus(1);
|
|
|
+ }
|
|
|
+ vo.setSceneName(obj.getString("title"));
|
|
|
+ vo.setUserName(obj.getString("phone"));
|
|
|
+ vo.setThumb(newBasePath +"/index.html?m="+vo.getNum() );
|
|
|
vo.setPayStatus(1);
|
|
|
+ vo.setIsObj(obj.getInteger("buildObjStatus"));
|
|
|
+ sceneVoList.add(vo);
|
|
|
}
|
|
|
- vo.setSceneName(obj.getString("title"));
|
|
|
- vo.setUserName(obj.getString("phone"));
|
|
|
- vo.setThumb(newBasePath +"/index.html?m="+vo.getNum() );
|
|
|
- vo.setPayStatus(1);
|
|
|
- sceneVoList.add(vo);
|
|
|
- }
|
|
|
|
|
|
+ Page<SceneVo> voPage = new Page<>(param.getPageNum(),param.getPageSize());
|
|
|
+ voPage.setRecords(sceneVoList);
|
|
|
+ voPage.setTotal(total);
|
|
|
+ return PageInfo.PageInfo(voPage);
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("访问深时失败:",e);
|
|
|
+ //throw new BusinessException(ResultCode.SS_GET_ERROR);
|
|
|
+ }
|
|
|
Page<SceneVo> voPage = new Page<>(param.getPageNum(),param.getPageSize());
|
|
|
- voPage.setRecords(sceneVoList);
|
|
|
- voPage.setTotal(total);
|
|
|
return PageInfo.PageInfo(voPage);
|
|
|
}
|
|
|
|
|
@@ -103,15 +115,35 @@ public class LaserService {
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(param.getUserName())){
|
|
|
List<CameraDetail> cameraDetails = cameraDetailService.getByUserName(param.getUserName());
|
|
|
- param.setSnCodes(this.setSnCodes(cameraDetails));
|
|
|
+ List<String> snCodes = this.setSnCodes(cameraDetails);
|
|
|
+ if(param.getCompanyId() == null){
|
|
|
+ param.setSnCodes(snCodes);
|
|
|
+ }else {
|
|
|
+ if(snCodes == null || snCodes.size() <=0){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ //取交集
|
|
|
+ List<String> intersection = param.getSnCodes().stream().filter(snCodes::contains).collect(Collectors.toList());
|
|
|
+ param.setSnCodes(intersection);
|
|
|
+ }
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(param.getUserName()) && StringUtils.isBlank(param.getSnCode()) &&
|
|
|
(param.getSnCodes() == null || param.getSnCodes().size() <=0)){
|
|
|
param.setSnCode("phoneEmptySelect");
|
|
|
}
|
|
|
-
|
|
|
+ if(StringUtils.isNotBlank(param.getNum())){
|
|
|
+ newParam.setSceneCodes(Arrays.asList(param.getNum()));
|
|
|
+ }
|
|
|
BeanUtils.copyProperties(param,newParam);
|
|
|
newParam.setTitle(param.getSceneName());
|
|
|
+
|
|
|
+ if(StringUtils.isNotBlank(param.getField()) && param.getField().equals("create_time")){
|
|
|
+ newParam.setOrderBy("shoot_time");
|
|
|
+ }else {
|
|
|
+ newParam.setOrderBy(param.getField());
|
|
|
+ }
|
|
|
+ newParam.setSortBy(param.getOrder());
|
|
|
+
|
|
|
return newParam;
|
|
|
}
|
|
|
|
|
@@ -152,11 +184,18 @@ public class LaserService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void move(String num, String snCode, String toSnCode) {
|
|
|
+ public void move(String num, String snCode, String toSnCode,Long userId) {
|
|
|
LaserSceneMoveParam param = new LaserSceneMoveParam();
|
|
|
param.setSceneCode(num);
|
|
|
param.setSnCode(snCode);
|
|
|
param.setToSnCode(toSnCode);
|
|
|
+ param.setUserId(userId);
|
|
|
+ if(userId != null){
|
|
|
+ User user = userService.getById(userId);
|
|
|
+ if(user != null){
|
|
|
+ param.setPhone(user.getUserName());
|
|
|
+ }
|
|
|
+ }
|
|
|
laserClient.migrate(param);
|
|
|
}
|
|
|
|
|
@@ -218,5 +257,41 @@ public class LaserService {
|
|
|
laserClient.cooperationDisable(params);
|
|
|
}
|
|
|
|
|
|
+ public SSDownSceneVo downOfflineSceneStatus(String num) {
|
|
|
+ try {
|
|
|
+ SSDownSceneVo vo ;
|
|
|
+ SSDownSceneParam param = new SSDownSceneParam();
|
|
|
+ param.setSceneCode(num);
|
|
|
+ Result responseEntity = laserClient.downOfflineSceneStatus(param);
|
|
|
+ if( responseEntity.getCode() != HttpStatus.OK.value()){
|
|
|
+ log.error("downOfflineSceneStatus-根据场景码获取激光转台下载状态失败:{}",responseEntity);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ vo = JSONObject.parseObject(JSONObject.toJSONString(responseEntity.getData()), SSDownSceneVo.class);
|
|
|
+ return vo;
|
|
|
+
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("downOfflineSceneStatus-根据场景码获取激光转台下载状态失败!",e);
|
|
|
+ }
|
|
|
+ return null ;
|
|
|
+ }
|
|
|
+
|
|
|
+ public SSDownSceneVo downOfflineScene(String num) {
|
|
|
+ try {
|
|
|
+ SSDownSceneVo vo ;
|
|
|
+ SSDownSceneParam param = new SSDownSceneParam();
|
|
|
+ param.setSceneCode(num);
|
|
|
+ Result responseEntity = laserClient.downOfflineScene(param);
|
|
|
+ if( responseEntity.getCode() != HttpStatus.OK.value()){
|
|
|
+ log.error("downOfflineScene-根据场景码获取激光转台下载失败:{}",responseEntity);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ vo = JSONObject.parseObject(JSONObject.toJSONString(responseEntity.getData()), SSDownSceneVo.class);
|
|
|
+ return vo ;
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("downOfflineScene-根据场景码获取激光转台下载状态失败!",e);
|
|
|
+ }
|
|
|
+ return null ;
|
|
|
+ }
|
|
|
|
|
|
}
|