|
@@ -450,4 +450,62 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
|
|
|
|
|
|
return ResultData.ok(fYunFileConfig.getHost().concat(usesZipOssPath));
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResultData getSceneVideo(String sceneCode, Long userId) {
|
|
|
+ ScenePlus scenePlus = this.getByNumAndUserId(userId, sceneCode);
|
|
|
+ if (Objects.isNull(scenePlus)) {
|
|
|
+ scenePlus = sceneCooperationService.getCooperaSceneByUserIdAndNum(userId, sceneCode);
|
|
|
+ if(Objects.isNull(scenePlus)){
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(Objects.isNull(scenePlus.getCameraId())){
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_7010);
|
|
|
+ }
|
|
|
+ CameraDetail cameraDetail = cameraDetailService.getByCameraId(scenePlus.getCameraId());
|
|
|
+ Integer cameraType = cameraDetail.getType();
|
|
|
+ if(laserCamTypeList.contains(cameraType)){
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_4004);
|
|
|
+ }
|
|
|
+
|
|
|
+ String userOssPath = String.format(UploadFilePath.VIDEOS_VIEW_PATH, scenePlus.getNum());
|
|
|
+ List<String> userFileList = fYunFileService.listRemoteFiles(userOssPath);
|
|
|
+ if(CollUtil.isEmpty(userFileList)){
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5027);
|
|
|
+ }
|
|
|
+ String userDowbloadPath = String.format(ConstantFilePath.OPENAPI_DOWNLOAD_PATH, scenePlus.getNum());
|
|
|
+ String userLocalPath = userDowbloadPath.concat("video");
|
|
|
+ String zipName = scenePlus.getNum().concat("_video.zip");
|
|
|
+ String usesZipPath = userDowbloadPath.concat(zipName);
|
|
|
+ fYunFileService.downloadFileByCommand(userLocalPath, userOssPath);
|
|
|
+ String dataViewPath = String.format(UploadFilePath.DATA_VIEW_PATH, sceneCode);
|
|
|
+ if(fYunFileService.fileExist(dataViewPath.concat("Up.xml"))){
|
|
|
+ fYunFileService.downloadFile(dataViewPath.concat("Up.xml"), userLocalPath.concat("Up.xml"));
|
|
|
+ }
|
|
|
+ if(fYunFileService.fileExist(dataViewPath.concat("Up2.xml"))){
|
|
|
+ fYunFileService.downloadFile(dataViewPath.concat("Up2.xml"), userLocalPath.concat("Up2.xml"));
|
|
|
+ }
|
|
|
+ if(fYunFileService.fileExist(dataViewPath.concat("Up.txt"))){
|
|
|
+ fYunFileService.downloadFile(dataViewPath.concat("Up.txt"), userLocalPath.concat("Up.txt"));
|
|
|
+ }
|
|
|
+ if(fYunFileService.fileExist(dataViewPath.concat("Up2.txt"))){
|
|
|
+ fYunFileService.downloadFile(dataViewPath.concat("Up2.txt"), userLocalPath.concat("Up2.txt"));
|
|
|
+ }
|
|
|
+ String sceneJson = redisUtil.get(String.format(RedisKey.SCENE_JSON, sceneCode));
|
|
|
+ if(StrUtil.isEmpty(sceneJson)){
|
|
|
+ sceneJson = fYunFileService.getFileContent(dataViewPath.concat("scene.json"));
|
|
|
+ }
|
|
|
+ SceneJsonBean sceneJsonBean = JSON.parseObject(sceneJson, SceneJsonBean.class);
|
|
|
+ if(StrUtil.isEmpty(sceneJsonBean.getVideos())){
|
|
|
+ sceneJsonBean.setVideos("{}");
|
|
|
+ }
|
|
|
+ FileUtil.writeUtf8String(sceneJsonBean.getVideos(), userLocalPath.concat("mapping.json"));
|
|
|
+
|
|
|
+ ZipUtil.zip(userLocalPath, usesZipPath);
|
|
|
+ String usesZipOssPath = String.format("downloads/scene/%s/video/", scenePlus.getNum()).concat(zipName);
|
|
|
+ fYunFileService.uploadFileByCommand(usesZipPath, usesZipOssPath);
|
|
|
+
|
|
|
+ return ResultData.ok(fYunFileConfig.getHost().concat(usesZipOssPath));
|
|
|
+ }
|
|
|
}
|