|
@@ -0,0 +1,41 @@
|
|
|
|
+package com.fdkankan.openApi.service.www.impl;
|
|
|
|
+
|
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
|
+import cn.hutool.core.util.ZipUtil;
|
|
|
|
+import com.fdkankan.common.constant.ErrorCode;
|
|
|
|
+import com.fdkankan.common.util.CmdUtils;
|
|
|
|
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
|
+import com.fdkankan.model.utils.ComputerUtil;
|
|
|
|
+import com.fdkankan.openApi.constant.MatterportConstant;
|
|
|
|
+import com.fdkankan.openApi.service.www.IMatterportService;
|
|
|
|
+import com.fdkankan.openApi.vo.BaseSceneParamVo;
|
|
|
|
+import com.fdkankan.web.response.ResultData;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+
|
|
|
|
+@Slf4j
|
|
|
|
+@Service
|
|
|
|
+public class MatterportServiceImpl implements IMatterportService {
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private FYunFileServiceInterface fYunFileService;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ResultData download(BaseSceneParamVo param) throws Exception {
|
|
|
|
+ String cmdStr = MatterportConstant.cmd_matterport_download.replace("@num@", param.getSceneCode());
|
|
|
|
+ CmdUtils.callLine(cmdStr);
|
|
|
|
+ String logJsonPath = MatterportConstant.workPath + param.getSceneCode() + "/log.json";
|
|
|
|
+ boolean success = ComputerUtil.checkComputeCompleted(logJsonPath, 3, 3);
|
|
|
|
+ if(!success){
|
|
|
|
+ return ResultData.error(ErrorCode.FAILURE_CODE_5063, "没有生成文件:" + logJsonPath);
|
|
|
|
+ }
|
|
|
|
+ FileUtil.del(logJsonPath);
|
|
|
|
+ String zipPath = MatterportConstant.workPath + "scenes/" + param.getSceneCode() + ".zip";
|
|
|
|
+ ZipUtil.zip(MatterportConstant.workPath + "scenes/" + param.getSceneCode(), zipPath);
|
|
|
|
+
|
|
|
|
+ String key = "matterport_download/" + param.getSceneCode() + ".zip";
|
|
|
|
+ return ResultData.ok(fYunFileService.uploadFile(zipPath, key));
|
|
|
|
+ }
|
|
|
|
+}
|