lyhzzz 11 hónapja
szülő
commit
ddc5f9364d

+ 5 - 0
src/main/java/com/fdkankan/ucenter/common/constants/ResultCode.java

@@ -39,4 +39,9 @@ public class ResultCode {
     public static final int FAILURE_CODE_400014  = 400014 ;
     public static final String FAILURE_MSG_400014  = "原始数据不存在" ;
 
+    public static final int FAILURE_CODE_400015  = 400015 ;
+    public static final String FAILURE_MSG_400015 = "场景计算中或生成obj中" ;
+
+    public static final int FAILURE_CODE_400016  = 400016 ;
+    public static final String FAILURE_MSG_400016 = "生成失败" ;
 }

+ 3 - 0
src/main/java/com/fdkankan/ucenter/httpClient/client/LaserClient.java

@@ -83,6 +83,9 @@ public interface LaserClient {
     @Post("/laser/4dage/managerSceneList")
     Result sceneList(@JSONBody LaserSceneParam param);
 
+    @Post("/laser/4dage/scene/sceneInfo/{sceneCode}")
+    Result laserSceneInfo(@Var("sceneCode")String sceneCode);
+
     @Post("/laser/4dage/downE57Status")
     Result downE57Status(@JSONBody SSDownSceneParam param);
 

+ 21 - 0
src/main/java/com/fdkankan/ucenter/httpClient/service/LaserService.java

@@ -24,6 +24,7 @@ import com.fdkankan.ucenter.httpClient.param.SSDownSceneParam;
 import com.fdkankan.ucenter.httpClient.param.SsBindParam;
 import com.fdkankan.ucenter.httpClient.vo.LaserSceneParam;
 import com.fdkankan.ucenter.httpClient.vo.SSDownSceneVo;
+import com.fdkankan.ucenter.httpClient.vo.SceneStatusInfoDTO;
 import com.fdkankan.ucenter.service.ICameraService;
 import com.fdkankan.ucenter.service.ICameraTypeService;
 import com.fdkankan.ucenter.service.IUserService;
@@ -415,4 +416,24 @@ public class LaserService {
         }
         return null ;
     }
+    public SceneStatusInfoDTO laserSceneInfo(String num) {
+        try {
+            SceneStatusInfoDTO vo ;
+            Result responseEntity = laserClient.laserSceneInfo(num);
+            if( responseEntity.getCode() != HttpStatus.OK.value()){
+                log.error("LaserSceneInfo-根据场景码获取激光转台下载失败:{}",responseEntity);
+                return null;
+            }
+            if(responseEntity.getCode() == 407){
+                throw new BusinessException(ResultCode.FAILURE_CODE_400011,ResultCode.FAILURE_MSG_400011);
+            }
+            vo = JSONObject.parseObject(JSONObject.toJSONString(responseEntity.getData()), SceneStatusInfoDTO.class);
+            return vo ;
+        }catch (BusinessException e){
+            throw new BusinessException(ResultCode.FAILURE_CODE_400011,ResultCode.FAILURE_MSG_400011);
+        }catch (Exception e){
+            log.error("LaserSceneInfo-根据场景码获取激光转台下载状态失败!",e);
+        }
+        return null ;
+    }
 }

+ 15 - 0
src/main/java/com/fdkankan/ucenter/httpClient/vo/SceneStatusInfoDTO.java

@@ -0,0 +1,15 @@
+package com.fdkankan.ucenter.httpClient.vo;
+
+import lombok.Data;
+
+@Data
+public class SceneStatusInfoDTO {
+    //@ApiModelProperty(value = "状态,-1:场景被删 0:计算中 1计算失败 2计算成功 3封存 4重算中")
+    private Integer status;
+
+    //@ApiModelProperty(value = "生成OBJ状态,0,未生成 1完成,2计算中")
+    private int buildObjStatus;
+
+   // @ApiModelProperty(value = "生成E57状态-1失败,0,未生成 1完成,2计算中")
+    private int buildE57Status;
+}

+ 13 - 2
src/main/java/com/fdkankan/ucenter/service/impl/DownService.java

@@ -17,6 +17,7 @@ import com.fdkankan.ucenter.constant.LoginConstant;
 import com.fdkankan.ucenter.entity.*;
 import com.fdkankan.ucenter.httpClient.service.LaserService;
 import com.fdkankan.ucenter.httpClient.vo.SSDownSceneVo;
+import com.fdkankan.ucenter.httpClient.vo.SceneStatusInfoDTO;
 import com.fdkankan.ucenter.service.*;
 import com.fdkankan.ucenter.vo.response.DownVo;
 import com.fdkankan.ucenter.vo.response.DownloadProcessVo;
@@ -393,7 +394,7 @@ public class DownService implements IDownService {
             downVo.setDownloadStatus(1);
         }
         if(vo.getStatus() == -1){
-            downVo.setDownloadStatus(-1);
+            throw new BusinessException(ResultCode.FAILURE_CODE_400016,ResultCode.FAILURE_MSG_400016);
         }
         return downVo;
     }
@@ -423,7 +424,6 @@ public class DownService implements IDownService {
         if(!cameraDetail.getUserId().equals(user.getId())){
             throw new BusinessException(ResultCode.FAILURE_CODE_400012,ResultCode.FAILURE_MSG_400012);
         }
-
         SceneColdStorage sceneColdStorage = sceneColdStorageService.getByNum(num);
         if(sceneColdStorage != null && sceneColdStorage.getState() == 1){
             throw new BusinessException(ResultCode.FAILURE_CODE_400013,ResultCode.FAILURE_MSG_400013);
@@ -433,6 +433,14 @@ public class DownService implements IDownService {
         if(!fYunFileServiceInterface.fileExist(dataSource.replace("/mnt/data","home")+"/data.fdage")){
             throw new BusinessException(ResultCode.FAILURE_CODE_400014,ResultCode.FAILURE_MSG_400014);
         }
+        SceneStatusInfoDTO dto = laserService.laserSceneInfo(num);
+        if(dto == null){
+            throw new BusinessException(ResultCode.FAILURE_CODE_400003,ResultCode.FAILURE_MSG_400003);
+        }
+        if(dto.getStatus()!=2 || dto.getBuildObjStatus() == 2 || dto.getBuildE57Status() == 2){
+            throw new BusinessException(ResultCode.FAILURE_CODE_400015,ResultCode.FAILURE_MSG_400015);
+
+        }
 
     }
 
@@ -460,6 +468,9 @@ public class DownService implements IDownService {
         if(vo == null){
             throw new BusinessException(ResultCode.FAILURE_CODE_400003,ResultCode.FAILURE_MSG_400003);
         }
+        if(vo.getStatus() ==-1){
+            throw new BusinessException(ResultCode.FAILURE_CODE_400016,ResultCode.FAILURE_MSG_400016);
+        }
         downVo.setStatus(1003);
         if(vo.getStatus() == 0 || vo.getStatus() == 2 || vo.getStatus() == 3){    //下载中
             ssNumProcessNumE57Map.merge(num, 1, Integer::sum);