|
@@ -985,7 +985,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
String zipTargetFilePath = targetImagesPath + file.getOriginalFilename();
|
|
|
|
|
|
//判断全景图缓存是否存在,如果不存在,从计算目录中拷贝到缓存目录
|
|
|
- this.cachePanorama(path, num);
|
|
|
+// this.cachePanorama(path, num);
|
|
|
|
|
|
//先删除本地文件
|
|
|
FileUtils.deleteDirectory(targetImagesPath);
|
|
@@ -1037,11 +1037,11 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
}
|
|
|
|
|
|
//比对图片列表,不存在的要返回名称集合
|
|
|
- String visionPath = path + "/results/vision.txt";
|
|
|
+ String visionPath = fYunFileService.getFileContent(bucket, String.format(UploadFilePath.IMG_VIEW_PATH, num) + "vision.txt");
|
|
|
List<String> panoramaImageList = SceneUtil.getPanoramaImageList(visionPath);
|
|
|
List<String> notExistFileList = uploadFileList.stream().filter(filePath -> {
|
|
|
filePath = filePath.substring(filePath.lastIndexOf(File.separator) + 1);
|
|
|
- if(panoramaImageList.contains(filePath)){
|
|
|
+ if(CollUtil.isEmpty(panoramaImageList) || panoramaImageList.contains(filePath)){
|
|
|
return false;
|
|
|
}
|
|
|
return true;
|
|
@@ -1073,8 +1073,9 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
CreateObjUtil.convertVisionmodeldataToTxt(target + File.separator + "extras" + File.separator + "vision.modeldata",
|
|
|
target + File.separator + "extras" + File.separator + "vision.txt");
|
|
|
|
|
|
- FileUtils.copyFile(path + File.separator + "data.json", target + File.separator+"data.json", true);
|
|
|
- FileUtils.copyFile(path + File.separator + "project.json", target + File.separator+"project.json", true);
|
|
|
+ String ossResultPath = String.format(UploadFilePath.scene_result_data_path, num);
|
|
|
+ fYunFileService.downloadFile(bucket, ossResultPath + "data.json", target + File.separator+"data.json");
|
|
|
+ fYunFileService.downloadFile(bucket, ossResultPath + "project.json", target + File.separator+"project.json");
|
|
|
|
|
|
//data.json增加extras为执行重建算法
|
|
|
String data = FileUtils.readFile(target + File.separator+"data.json");
|
|
@@ -1108,10 +1109,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
if(new File(target + File.separator + "results").exists()){
|
|
|
FileUtils.delAllFile(target + File.separator + "results");
|
|
|
}
|
|
|
-// if(FYunTypeEnum.AWS.code().equals(fyunType)){
|
|
|
-// //亚马逊保持旧方式,超链接capture
|
|
|
-// CreateObjUtil.createSoftConnection(path + File.separator + "capture", target + File.separator + "capture");
|
|
|
-// }
|
|
|
+
|
|
|
fYunFileService.downloadFile(ConstantFilePath.OSS_PREFIX + path.replace(ConstantFilePath.BUILD_MODEL_PATH, "") + "/data.fdage", target + File.separator + "capture/data.fdage");
|
|
|
|
|
|
//如果部分成功,则需要返回成功数量和失败列表
|
|
@@ -1237,16 +1235,17 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
- if(map.size()>0) {
|
|
|
- fYunFileService.uploadMulFiles(bucket, map);
|
|
|
- }
|
|
|
|
|
|
- //拷贝修改后的全景图到缓存目录
|
|
|
- String cachedImagesPath = String.format(ConstantFilePath.SCENE_CACHE_IMAGES, num);
|
|
|
+ //用户上传的全景图上传到ossresult目录
|
|
|
+ String ossCachesImagesPath = String.format(UploadFilePath.scene_result_data_path, num) + "caches/images/";
|
|
|
uploadFileList.stream().forEach(srcPath->{
|
|
|
- cn.hutool.core.io.FileUtil.copy(srcPath, srcPath.replace(targetImagesPath, cachedImagesPath), true);
|
|
|
+ map.put(srcPath, srcPath.replace(targetImagesPath, ossCachesImagesPath));
|
|
|
});
|
|
|
|
|
|
+ if(map.size()>0) {
|
|
|
+ fYunFileService.uploadMulFiles(bucket, map);
|
|
|
+ }
|
|
|
+
|
|
|
//更新数据库版本号
|
|
|
ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
|
|
|
SceneEditInfo sceneEditInfo = this.getByScenePlusId(scenePlus.getId());
|
|
@@ -1283,29 +1282,27 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
String cacheImageFormat = "downloads/scene/%s/caches/images/";
|
|
|
|
|
|
//判断全景图缓存是否存在,如果不存在,从计算目录中拷贝到缓存目录
|
|
|
- this.cachePanorama(scenePlusExt.getDataSource(), num);
|
|
|
+// this.cachePanorama(scenePlusExt.getDataSource(), num);
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
|
//标记是否是异步操作,默认是同步操作
|
|
|
//如果入参文件名不为空,则是单个文件下载,不需要打包
|
|
|
+ String ossResultPath = String.format(UploadFilePath.scene_result_data_path, num) + "caches/images/";
|
|
|
if(StrUtil.isNotEmpty(fileName)){
|
|
|
//如果是单张图片,直接提供oss url
|
|
|
- String localFilePath = localImagesPath + fileName;
|
|
|
- String ossFilePath = imgCachePath + fileName;
|
|
|
- if(!cn.hutool.core.io.FileUtil.exist(localFilePath)){
|
|
|
+ if(!fYunFileService.fileExist(bucket, ossResultPath + fileName)){
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5063);
|
|
|
}
|
|
|
- fYunFileService.uploadFile(bucket, localFilePath, ossFilePath);
|
|
|
- String url = ossUrlPrefix + ossFilePath;
|
|
|
+ String url = ossUrlPrefix + ossResultPath + fileName;
|
|
|
String downloadName = fileName;
|
|
|
map.put("asyn", CommonStatus.NO.code());
|
|
|
map.put("fileUrl", url + "?t=" + System.currentTimeMillis());
|
|
|
map.put("fileName", downloadName);
|
|
|
return ResultData.ok(map);
|
|
|
}else{
|
|
|
- if(!cn.hutool.core.io.FileUtil.exist(localImagesPath)
|
|
|
- || cn.hutool.core.io.FileUtil.isDirEmpty(new File(localImagesPath))){
|
|
|
+ //判断全景图目录是否存在
|
|
|
+ if(!fYunFileService.fileExist(bucket, ossResultPath)){
|
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_5063);
|
|
|
}
|
|
|
|
|
@@ -1328,6 +1325,11 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
sceneAsynOperLog.setVersion(sceneEditInfo.getImgVersion());
|
|
|
sceneAsynOperLogService.save(sceneAsynOperLog);
|
|
|
try {
|
|
|
+
|
|
|
+ //下载到本地目录
|
|
|
+ FileUtil.del(localImagesPath);
|
|
|
+ fYunFileService.downloadFileByCommand(bucket, localImagesPath, ossResultPath);
|
|
|
+
|
|
|
String downloadName = num + "_images.zip";
|
|
|
long start = Calendar.getInstance().getTimeInMillis();
|
|
|
//打包
|
|
@@ -1919,7 +1921,6 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
|
|
|
String bucket = scenePlusExt.getYunFileBucket();
|
|
|
|
|
|
- String localDataPath = String.format(ConstantFilePath.DATABUFFER_FORMAT, num);
|
|
|
String localImagesPath = String.format(ConstantFilePath.IMAGESBUFFER_FORMAT, num);
|
|
|
String path = scenePlusExt.getDataSource();
|
|
|
String target = localImagesPath + "panorama/" + sid;
|
|
@@ -1934,8 +1935,9 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
file.transferTo(targetFile);
|
|
|
|
|
|
//调用算法切全景图
|
|
|
- FileUtils.copyFile(path + File.separator + "data.json", target + File.separator+"data.json", true);
|
|
|
- FileUtils.copyFile(path + File.separator + "project.json", target + File.separator+"project.json", true);
|
|
|
+ String ossResultPath = String.format(UploadFilePath.scene_result_data_path, num);
|
|
|
+ fYunFileService.downloadFile(bucket, ossResultPath + "data.json", target + File.separator+"data.json");
|
|
|
+ fYunFileService.downloadFile(bucket, ossResultPath + "project.json", target + File.separator+"project.json");
|
|
|
JSONObject visionJson = new JSONObject();
|
|
|
JSONArray visionArray = new JSONArray();
|
|
|
visionJson.put("uuid", sid);
|
|
@@ -1944,9 +1946,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
visionArray.add(visionJson);
|
|
|
JSONObject vision = new JSONObject();
|
|
|
vision.put("sweepLocations", visionArray);
|
|
|
- cn.hutool.core.io.FileUtil.writeString(vision.toString(),
|
|
|
- target + "/extras" + File.separator + "vision.txt",
|
|
|
- StandardCharsets.UTF_8);
|
|
|
+ cn.hutool.core.io.FileUtil.writeString(vision.toString(), target + "/extras" + File.separator + "vision.txt", StandardCharsets.UTF_8);
|
|
|
|
|
|
//data.json增加extras为执行重建算法
|
|
|
String type = "4k";
|
|
@@ -1974,8 +1974,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
}
|
|
|
dataJson.put("skybox_type", skyboxType);
|
|
|
|
|
|
- cn.hutool.core.io.FileUtil.writeString(dataJson.toString(),
|
|
|
- target + File.separator+"data.json", StandardCharsets.UTF_8);
|
|
|
+ cn.hutool.core.io.FileUtil.writeString(dataJson.toString(), target + File.separator+"data.json", StandardCharsets.UTF_8);
|
|
|
}
|
|
|
|
|
|
//创建文件夹软连接并且复制data.json和project.json
|
|
@@ -1990,10 +1989,6 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
cn.hutool.core.io.FileUtil.del(resultPath);
|
|
|
}
|
|
|
//下载data.fdage
|
|
|
-// if(FYunTypeEnum.AWS.code().equals(this.fyunType)){
|
|
|
-// //亚马逊保持旧方式,超链接capture
|
|
|
-// CreateObjUtil.createSoftConnection(path + File.separator + "capture", capturePath);
|
|
|
-// }
|
|
|
fYunFileService.downloadFile(ConstantFilePath.OSS_PREFIX + path.replace(ConstantFilePath.BUILD_MODEL_PATH, "") + "/data.fdage", capturePath + "/data.fdage");
|
|
|
CreateObjUtil.build3dModel(target , "1");
|
|
|
|