|
@@ -2,6 +2,8 @@ package com.fdkankan.openApi.service.www.impl;
|
|
|
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.core.io.FileUtil;
|
|
import cn.hutool.core.util.ZipUtil;
|
|
import cn.hutool.core.util.ZipUtil;
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
import com.fdkankan.common.util.CmdUtils;
|
|
import com.fdkankan.common.util.CmdUtils;
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
@@ -26,11 +28,19 @@ public class MatterportServiceImpl implements IMatterportService {
|
|
public ResultData download(BaseSceneParamVo param) throws Exception {
|
|
public ResultData download(BaseSceneParamVo param) throws Exception {
|
|
String cmdStr = MatterportConstant.cmd_matterport_download.replace("@num@", param.getSceneCode());
|
|
String cmdStr = MatterportConstant.cmd_matterport_download.replace("@num@", param.getSceneCode());
|
|
CmdUtils.callLine(cmdStr);
|
|
CmdUtils.callLine(cmdStr);
|
|
- String logJsonPath = MatterportConstant.workPath + param.getSceneCode() + "/log.json";
|
|
|
|
|
|
+ String logJsonPath = MatterportConstant.workPath + "scenes" + param.getSceneCode() + "/log.json";
|
|
boolean success = ComputerUtil.checkComputeCompleted(logJsonPath, 5, 300);
|
|
boolean success = ComputerUtil.checkComputeCompleted(logJsonPath, 5, 300);
|
|
if(!success){
|
|
if(!success){
|
|
return ResultData.error(ErrorCode.FAILURE_CODE_5063, "没有生成文件:" + logJsonPath);
|
|
return ResultData.error(ErrorCode.FAILURE_CODE_5063, "没有生成文件:" + logJsonPath);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ String logJsonStr = FileUtil.readUtf8String(logJsonPath);
|
|
|
|
+ JSONObject jsonObject = JSON.parseObject(logJsonStr);
|
|
|
|
+ String status = jsonObject.getString("status");
|
|
|
|
+ if(!"ok".equals(status)){
|
|
|
|
+ return ResultData.error(ErrorCode.FAILURE_CODE_5063, "status:" + status);
|
|
|
|
+ }
|
|
|
|
+
|
|
FileUtil.del(logJsonPath);
|
|
FileUtil.del(logJsonPath);
|
|
String zipPath = MatterportConstant.workPath + "scenes/" + param.getSceneCode() + ".zip";
|
|
String zipPath = MatterportConstant.workPath + "scenes/" + param.getSceneCode() + ".zip";
|
|
ZipUtil.zip(MatterportConstant.workPath + "scenes/" + param.getSceneCode(), zipPath);
|
|
ZipUtil.zip(MatterportConstant.workPath + "scenes/" + param.getSceneCode(), zipPath);
|