|
@@ -42,6 +42,7 @@ import com.fdkankan.scene.entity.SceneEditInfoExt;
|
|
|
import com.fdkankan.scene.entity.ScenePlus;
|
|
|
import com.fdkankan.scene.entity.ScenePlusExt;
|
|
|
import com.fdkankan.scene.mapper.ISceneEditInfoMapper;
|
|
|
+import com.fdkankan.scene.oss.OssUtil;
|
|
|
import com.fdkankan.scene.service.ICameraDetailService;
|
|
|
import com.fdkankan.scene.service.ICompanyService;
|
|
|
import com.fdkankan.scene.service.ISceneDataDownloadService;
|
|
@@ -75,6 +76,7 @@ import com.google.common.collect.Lists;
|
|
|
import com.google.errorprone.annotations.Var;
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Calendar;
|
|
|
import java.util.Collection;
|
|
@@ -95,8 +97,6 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
-
|
|
|
/**
|
|
|
* <p>
|
|
|
* 服务实现类
|
|
@@ -136,6 +136,10 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
private ICameraDetailService cameraDetailService;
|
|
|
@Autowired
|
|
|
private ICompanyService companyService;
|
|
|
+ @Autowired
|
|
|
+ private OssUtil ossUtil;
|
|
|
+
|
|
|
+
|
|
|
@Transactional
|
|
|
@Override
|
|
|
public SceneEditInfoVO saveScene(SceneEditInfoParamVO param) {
|
|
@@ -262,8 +266,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
FileUtils.writeFile(localSceneJsonPath, JSON.toJSONString(sceneJson));
|
|
|
//上传sceneJson文件
|
|
|
String sceneJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH+"scene.json", num);
|
|
|
- // TODO: 2022/8/22
|
|
|
-// fYunFileService.uploadFile(bucket, JSON.toJSONBytes(sceneJson), sceneJsonPath);
|
|
|
+ ossUtil.uploadFileBytes(sceneJsonPath, JSON.toJSONBytes(sceneJson));
|
|
|
|
|
|
//sceneJson放入缓存
|
|
|
String key = String.format(RedisKey.SCENE_JSON, num);
|
|
@@ -271,14 +274,12 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
|
|
|
//删除发布数据中的user目录
|
|
|
String publicUserPath = String.format(UploadFilePath.USER_VIEW_PATH, num);
|
|
|
- // TODO: 2022/8/22
|
|
|
-// fYunFileService.deleteFile(bucket, publicUserPath);
|
|
|
+ ossUtil.deleteObject(publicUserPath);
|
|
|
|
|
|
//复制编辑目录到发布目录
|
|
|
String editPath = String.format(UploadFilePath.USER_EDIT_PATH, param.getNum());
|
|
|
String viewPath = String.format(UploadFilePath.USER_VIEW_PATH, param.getNum());
|
|
|
- // TODO: 2022/8/22
|
|
|
-// fYunFileService.copyFileBetweenBucket(bucket, editPath, bucket, viewPath);
|
|
|
+ ossUtil.copyObject(editPath, viewPath);
|
|
|
|
|
|
//入库
|
|
|
if(sceneEditInfo.getId() == null){
|
|
@@ -310,13 +311,11 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
linkPanArr.add(JSON.parseObject(linkPan));
|
|
|
});
|
|
|
String linkScenePath = userEditPath + "links.json";
|
|
|
- // TODO: 2022/8/22
|
|
|
-// fYunFileService.uploadFile(bucket, linkPanArr.toString().getBytes(), linkScenePath);
|
|
|
+ ossUtil.uploadFileBytes(linkScenePath, linkPanArr.toString().getBytes());
|
|
|
|
|
|
//拷贝编辑目录到发布目录
|
|
|
- // TODO: 2022/8/22
|
|
|
-// fYunFileService.deleteFile(bucket,imgViewPath + "panorama");
|
|
|
-// fYunFileService.copyFileBetweenBucket(bucket, imgEditPath + "panorama", bucket, imgViewPath + "panorama");
|
|
|
+ ossUtil.deleteObject(imgViewPath + "panorama");
|
|
|
+ ossUtil.copyObject(imgEditPath + "panorama", imgViewPath + "panorama");
|
|
|
|
|
|
}
|
|
|
|
|
@@ -335,8 +334,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
jsonhots.add(JSONObject.parseObject(hot));
|
|
|
});
|
|
|
String hotJsonPath = String.format(UploadFilePath.USER_EDIT_PATH, sceneNum) + "hot.json";
|
|
|
- // TODO: 2022/8/22
|
|
|
-// fYunFileService.uploadFile(bucket, jsonhots.toString().getBytes(), hotJsonPath);
|
|
|
+ ossUtil.uploadFileBytes(hotJsonPath, jsonhots.toString().getBytes());
|
|
|
|
|
|
//修改tags状态为是,标识有热点数据
|
|
|
this.saveTagsToSceneEditInfo(sceneNum, sceneEditInfo);
|
|
@@ -509,16 +507,14 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
//处理户型图数据
|
|
|
//上传floorplan_user.json文件
|
|
|
FileUtils.writeFile(localDataPath + "floorplan_user.json", floorJsonData);
|
|
|
- // TODO: 2022/8/22
|
|
|
- // fYunFileService.uploadFile(bucket, localDataPath + "floorplan_user.json", editUserPath + "floorplan_user.json");
|
|
|
+ ossUtil.uploadFile(editUserPath + "floorplan_user.json", localDataPath + "floorplan_user.json", false);
|
|
|
|
|
|
//写入数据库
|
|
|
Byte floorPlanUser = null;
|
|
|
if(StrUtil.isNotEmpty(floorJsonData)){
|
|
|
JSONObject houseTypeJson = CreateHouseJsonUtil
|
|
|
.createHouseTypeJsonByUser(localDataPath + "floorplan_user.json");
|
|
|
- // TODO: 2022/8/22
|
|
|
- // fYunFileService.uploadFile(bucket, houseTypeJson.toJSONString().getBytes(), editUserPath + "houseType.json");
|
|
|
+ ossUtil.uploadFileBytes(editUserPath + "houseType.json", houseTypeJson.toJSONString().getBytes());
|
|
|
|
|
|
floorPlanUser = CommonStatus.YES.code();
|
|
|
}
|
|
@@ -576,8 +572,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
String substring = str.substring(str.lastIndexOf(File.separator) + 1);
|
|
|
String[] arr = substring.split("floor");
|
|
|
String[] arr2 = arr[1].split("\\.");
|
|
|
- // TODO: 2022/8/22
|
|
|
-// fYunFileService.uploadFile(bucket, str, String.format(userEditPath, num, arr2[0], arr2[1]));
|
|
|
+ ossUtil.uploadFile(String.format(userEditPath, num, arr2[0], arr2[1]), str, false);
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -620,9 +615,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
result.put("version", "2.1");
|
|
|
|
|
|
String floorplanCadPath = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "floorplan_cad.json";
|
|
|
-// TODO: 2022/8/22
|
|
|
- String floorcadStr = null;
|
|
|
- //floorcadStr = fYunFileService.getFileContent(bucket, floorplanCadPath);
|
|
|
+ String floorcadStr = ossUtil.getFileContent(floorplanCadPath);
|
|
|
|
|
|
JSONObject floorcadObj = JSON.parseObject(floorcadStr);
|
|
|
JSONArray floors = floorcadObj.getJSONArray("floors");
|
|
@@ -641,8 +634,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
}
|
|
|
|
|
|
String hourseTypeJsonPath = String.format(UploadFilePath.USER_EDIT_PATH, num) + "houseType.json";
|
|
|
- // TODO: 2022/8/22
|
|
|
- // fYunFileService.uploadFile(bucket, result.toJSONString().getBytes(), hourseTypeJsonPath);
|
|
|
+ ossUtil.uploadFileBytes(hourseTypeJsonPath, result.toJSONString().getBytes());
|
|
|
}
|
|
|
|
|
|
private JSONArray[] createHouseTypeJsonHandler(JSONObject floor){
|
|
@@ -733,9 +725,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
String bucket = scenePlusExt.getYunFileBucket();
|
|
|
|
|
|
String key = String.format(UploadFilePath.DATA_VIEW_PATH, param.getNum()) + "floorplan_cad.json";
|
|
|
-// TODO: 2022/8/22
|
|
|
- String floorplanCadJson = null;
|
|
|
- //floorplanCadJson = fYunFileService.getFileContent(bucket, key);
|
|
|
+ String floorplanCadJson = ossUtil.getFileContent(key);
|
|
|
if(StrUtil.isEmpty(floorplanCadJson)){
|
|
|
return ResultData.ok();
|
|
|
}
|
|
@@ -760,8 +750,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
}
|
|
|
item.put("name", name);
|
|
|
}
|
|
|
- // TODO: 2022/8/22
|
|
|
-// fYunFileService.uploadFile(bucket, jsonObject.toJSONString().getBytes(), key);
|
|
|
+ ossUtil.uploadFileBytes(key, jsonObject.toJSONString().getBytes());
|
|
|
return ResultData.ok();
|
|
|
}
|
|
|
|
|
@@ -817,16 +806,14 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
|
|
|
//更新oss scene.json版本号
|
|
|
String sceneJsonPath = String.format(UploadFilePath.DATA_VIEW_PATH, num) + "scene.json";
|
|
|
-// TODO: 2022/8/22
|
|
|
- // sceneJson= fYunFileService.getFileContent(bucket, sceneJsonPath);
|
|
|
+ sceneJson = ossUtil.getFileContent(sceneJsonPath);
|
|
|
if(StrUtil.isNotEmpty(sceneJson)){
|
|
|
SceneJsonBean sceneJsonBean = JSON.parseObject(sceneJson, SceneJsonBean.class);
|
|
|
sceneJsonBean.setVersion(version);
|
|
|
if(Objects.nonNull(imgVersion)){
|
|
|
sceneJsonBean.setImgVersion(imgVersion + 1);
|
|
|
}
|
|
|
- // TODO: 2022/8/22
|
|
|
-// fYunFileService.uploadFile(bucket, JSON.toJSONString(sceneJsonBean).getBytes(StandardCharsets.UTF_8), sceneJsonPath);
|
|
|
+ ossUtil.uploadFileBytes(sceneJsonPath, JSON.toJSONString(sceneJsonBean).getBytes(StandardCharsets.UTF_8));
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -935,8 +922,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
// Map<String, String> map = new HashMap<>();
|
|
|
//
|
|
|
// String imgViewPath = String.format(UploadFilePath.IMG_VIEW_PATH, num);
|
|
|
-//// TODO: 2022/8/22
|
|
|
-// // fYunFileService.downloadFile(bucket, imgViewPath + "vision.modeldata", target + File.separator + "extras" + File.separator + "vision.modeldata");
|
|
|
+// fYunFileService.downloadFile(bucket, imgViewPath + "vision.modeldata", target + File.separator + "extras" + File.separator + "vision.modeldata");
|
|
|
// CreateObjUtil.convertVisionmodeldataToTxt(target + File.separator + "extras" + File.separator + "vision.modeldata",
|
|
|
// target + File.separator + "extras" + File.separator + "vision.txt");
|
|
|
//
|
|
@@ -1097,8 +1083,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
// if(!cn.hutool.core.io.FileUtil.exist(localFilePath)){
|
|
|
// throw new BusinessException(ErrorCode.FAILURE_CODE_5063);
|
|
|
// }
|
|
|
-// // TODO: 2022/8/22
|
|
|
-//// fYunFileService.uploadFile(bucket, localFilePath, ossFilePath);
|
|
|
+// fYunFileService.uploadFile(bucket, localFilePath, ossFilePath);
|
|
|
// url = ossUrlPrefix + ossFilePath;
|
|
|
// downloadName = fileName;
|
|
|
// }else{
|
|
@@ -1115,8 +1100,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
// long end1 = Calendar.getInstance().getTimeInMillis();
|
|
|
// log.info("打包耗时:" + (end1 - start));
|
|
|
// //上传压缩包
|
|
|
-// // TODO: 2022/8/22
|
|
|
-//// fYunFileService.uploadFileByCommand(bucket, zipPath, String.format(cacheFormat, num) + downloadName);
|
|
|
+// fYunFileService.uploadFileByCommand(bucket, zipPath, String.format(cacheFormat, num) + downloadName);
|
|
|
// url = ossUrlPrefix + String.format(cacheFormat, num) + downloadName;
|
|
|
// long end2 = Calendar.getInstance().getTimeInMillis();
|
|
|
// log.info("上传耗时:" + (end2 - end1));
|
|
@@ -1244,9 +1228,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
@Override
|
|
|
public DownloadVO downloadBallScreenVideo(BallScreenVideoParamVO param) {
|
|
|
String videoPath = String.format(UploadFilePath.VIDEOS_VIEW_PATH, param.getNum()) + param.getFileName();
|
|
|
- // TODO: 2022/8/22
|
|
|
- String url = null;
|
|
|
- // String url = ossUrlPrefix + videoPath + "?t=" + System.currentTimeMillis();
|
|
|
+ String url = videoPath;
|
|
|
return DownloadVO.builder()
|
|
|
.fileName(param.getFileName())
|
|
|
.url(url)
|
|
@@ -1313,14 +1295,12 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
|
|
|
for(String videoName : video.list()){
|
|
|
log.info("球幕视频名称:{}", videoName);
|
|
|
- // TODO: 2022/8/22
|
|
|
-// fYunFileService.uploadFile(bucket, target + File.separator + "extras/video/" + videoName,videosViewPath + videoName);
|
|
|
+ ossUtil.uploadFile(videosViewPath + videoName, target + File.separator + "extras/video/", false);
|
|
|
|
|
|
CreateObjUtil.mp4ToFlv(target + File.separator + "extras/video/" + videoName,
|
|
|
target + File.separator + "extras/video/" + videoName.replace("mp4", "flv"));
|
|
|
|
|
|
- // TODO: 2022/8/22
|
|
|
-// fYunFileService.uploadFile(bucket, target + File.separator + "extras/video/" + videoName.replace("mp4", "flv"),videosViewPath + videoName.replace("mp4", "flv"));
|
|
|
+ ossUtil.uploadFile(videosViewPath + videoName.replace("mp4", "flv"), target + File.separator + "extras/video/" + videoName.replace("mp4", "flv"), false);
|
|
|
|
|
|
//覆盖原始视频资源
|
|
|
FileUtils.copyFile(target + File.separator + "extras/video/" + videoName,
|
|
@@ -1342,13 +1322,10 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
public void upgradeVersionToSceneJson(String num, String bucket) throws Exception{
|
|
|
String key = String.format(RedisKey.SCENE_JSON, num);
|
|
|
String objectName = String.format(ConstantFilePath.SCENE_VIEW_DATA_DATA_SCENEJSON, num);
|
|
|
-// TODO: 2022/8/22
|
|
|
- String objectContent = null;
|
|
|
- // String objectContent = fYunFileService.getFileContent(bucket, objectName);
|
|
|
+ String objectContent = ossUtil.getFileContent(objectName);
|
|
|
SceneJsonBean sceneJsonBean = JSON.parseObject(objectContent, SceneJsonBean.class);
|
|
|
sceneJsonBean.setVersion(sceneJsonBean.getVersion() +1);
|
|
|
-// TODO: 2022/8/22
|
|
|
- // fYunFileService.uploadFile(bucket, JSON.toJSONString(sceneJsonBean).getBytes(), objectName);
|
|
|
+ ossUtil.uploadFileBytes(objectName, JSON.toJSONString(sceneJsonBean).getBytes());
|
|
|
redisUtil.set(key, JSON.toJSONString(sceneJsonBean));
|
|
|
}
|
|
|
|
|
@@ -1494,8 +1471,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
// }
|
|
|
// String fileMD5 = FileMd5Util.getFileMD5(new File(zipPath));
|
|
|
//
|
|
|
-// // TODO: 2022/8/22
|
|
|
-//// fYunFileService.uploadFile(bucket, zipPath, "data_download/" + num + ".zip");
|
|
|
+// fYunFileService.uploadFile(bucket, zipPath, "data_download/" + num + ".zip");
|
|
|
//
|
|
|
// SceneDataDownload sceneDataDownload = sceneDataDownloadService.findBySceneNum(num);
|
|
|
// if(sceneDataDownload == null){
|
|
@@ -1531,8 +1507,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
SceneJsonBean sceneJsonBean = null;
|
|
|
String sceneJson = redisUtil.get(String.format(RedisKey.SCENE_JSON, param.getNum()));
|
|
|
if(StrUtil.isEmpty(sceneJson)){
|
|
|
- // TODO: 2022/8/22
|
|
|
- //sceneJson = fYunFileService.getFileContent(bucket,String.format(UploadFilePath.DATA_VIEW_PATH, param.getNum()) + "scene.json");
|
|
|
+ sceneJson = ossUtil.getFileContent(String.format(UploadFilePath.DATA_VIEW_PATH, param.getNum()) + "scene.json");
|
|
|
}
|
|
|
sceneJsonBean = JSON.parseObject(sceneJson, SceneJsonBean.class);
|
|
|
|
|
@@ -1889,8 +1864,7 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
//删除oss文件
|
|
|
String imgEditPath = String.format(UploadFilePath.IMG_EDIT_PATH, num);
|
|
|
deleteSidList.stream().forEach(sid->{
|
|
|
-// TODO: 2022/8/22
|
|
|
- //fYunFileService.deleteFolder(bucket, imgEditPath + "panorama_edit/" + sid);
|
|
|
+ ossUtil.deleteObject(imgEditPath + "panorama_edit/" + sid);
|
|
|
});
|
|
|
|
|
|
}
|
|
@@ -2391,16 +2365,14 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
|
|
|
|
|
|
//从用户编辑目录中下载视频到本地
|
|
|
String filePath = userEditPath + fileName;
|
|
|
- // TODO: 2022/8/22
|
|
|
- // fYunFileService.downloadFile(bucket, filePath, localImagesPath + fileName);
|
|
|
+ ossUtil.downloadFile(localImagesPath + fileName, filePath);
|
|
|
|
|
|
//视频格式转换
|
|
|
CreateObjUtil.mp4ToFlv(localFilePath, localFilePath.replace("mp4", "flv"));
|
|
|
|
|
|
//上传
|
|
|
String flvFileName = fileName.replace("mp4", "flv");
|
|
|
- // TODO: 2022/8/22
|
|
|
- // fYunFileService.uploadFile(bucket, localFilePath.replace("mp4", "flv"), userEditPath+flvFileName);
|
|
|
+ ossUtil.uploadFile(userEditPath+flvFileName, localFilePath.replace("mp4", "flv"), false);
|
|
|
}
|
|
|
|
|
|
@Override
|