Explorar el Código

http://192.168.0.21/index.php?m=bug&f=view&bugID=31825

dengsixing hace 2 años
padre
commit
6cb900a5de

+ 14 - 1
src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java

@@ -16,6 +16,8 @@ import com.fdkankan.common.constant.ConstantUrl;
 import com.fdkankan.common.constant.ErrorCode;
 import com.fdkankan.common.constant.RecStatus;
 import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.model.utils.ComputerUtil;
+import com.fdkankan.model.utils.SceneUtil;
 import com.fdkankan.scene.entity.SceneDataDownload;
 import com.fdkankan.scene.service.ISceneDataDownloadService;
 import com.fdkankan.web.response.ResultData;
@@ -112,6 +114,10 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
     private String ossPrefixUrl;
     @Value("fyun.type")
     private String ossType;
+    @Value("${ecs.checkFile.maxTimes:5}")
+    private int maxCheckTimes;
+    @Value("${ecs.checkFile.waitTime:5000}")
+    private int waitTime;
 
     @Override
     public ResultData upgradeToV4ResultSync(RequestSceneProV4 param) throws Exception {
@@ -2421,7 +2427,13 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         CreateObjUtil.build3dModel(target , "1");
 
         //读取upload文件,检验需要上传的文件是否存在
-        String uploadData = FileUtils.readFile(target + File.separator + "results" +File.separator+"upload.json");
+        String uploadJsonPath= target + File.separator + "results" +File.separator+"upload.json";
+        Thread.sleep(2000);
+        boolean exist = ComputerUtil.checkComputeCompleted(uploadJsonPath, maxCheckTimes, waitTime);
+        if(!exist){
+            throw new BusinessException(ErrorCode.FAILURE_CODE_7013);
+        }
+        String uploadData = FileUtils.readFile(uploadJsonPath);
         JSONObject uploadJson = null;
         JSONArray array = null;
         if(uploadData!=null) {
@@ -2430,6 +2442,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         }
         if(array == null){
             log.info("计算全景图失败,没有upload.json");
+            throw new BusinessException(ErrorCode.FAILURE_CODE_7013);
         }
         Map<String, String> map = new HashMap<>();
         JSONObject fileJson = null;