Pārlūkot izejas kodu

去掉球幕视频接口

dengsixing 3 gadi atpakaļ
vecāks
revīzija
1efb0fa4d4

+ 34 - 34
src/main/java/com/fdkankan/scene/controller/SceneEditController.java

@@ -464,40 +464,40 @@ public class SceneEditController extends BaseController {
     }
 
 
-    /**
-     * <p>
-        下载视频
-     * </p>
-     * @author dengsixing
-     * @date 2022/2/23
-     * @param param
-     * @return com.fdkankan.scene.vo.DownloadVO
-     **/
-    @CheckPermit
-    @PostMapping(value = "/downloadBallScreenVideo")
-    public DownloadVO downloadBallScreenVideo(@RequestBody @Validated BallScreenVideoParamVO param){
-        return sceneEditInfoService.downloadBallScreenVideo(param);
-    }
-
-    /**
-     * <p>
-            上传视频
-     * </p>
-     * @author dengsixing
-     * @date 2022/2/23
-     * @param num
-     * @param fileName
-     * @param file
-     * @return com.fdkankan.web.response.ResultData
-     **/
-    @CheckPermit
-    @PostMapping(value = "/uploadBallScreenVideo")
-    public ResultData uploadBallScreenVideo(
-            @RequestParam("num") String num,
-            @RequestParam("fileName") String fileName,
-            @RequestParam("file") MultipartFile file) throws Exception {
-        return sceneEditInfoService.uploadBallScreenVideo(num, fileName, file);
-    }
+//    /**
+//     * <p>
+//        下载视频
+//     * </p>
+//     * @author dengsixing
+//     * @date 2022/2/23
+//     * @param param
+//     * @return com.fdkankan.scene.vo.DownloadVO
+//     **/
+//    @CheckPermit
+//    @PostMapping(value = "/downloadBallScreenVideo")
+//    public DownloadVO downloadBallScreenVideo(@RequestBody @Validated BallScreenVideoParamVO param){
+//        return sceneEditInfoService.downloadBallScreenVideo(param);
+//    }
+//
+//    /**
+//     * <p>
+//            上传视频
+//     * </p>
+//     * @author dengsixing
+//     * @date 2022/2/23
+//     * @param num
+//     * @param fileName
+//     * @param file
+//     * @return com.fdkankan.web.response.ResultData
+//     **/
+//    @CheckPermit
+//    @PostMapping(value = "/uploadBallScreenVideo")
+//    public ResultData uploadBallScreenVideo(
+//            @RequestParam("num") String num,
+//            @RequestParam("fileName") String fileName,
+//            @RequestParam("file") MultipartFile file) throws Exception {
+//        return sceneEditInfoService.uploadBallScreenVideo(num, fileName, file);
+//    }
 
     /**
      * <p>

+ 3 - 3
src/main/java/com/fdkankan/scene/service/ISceneEditInfoService.java

@@ -73,9 +73,9 @@ public interface ISceneEditInfoService extends IService<SceneEditInfo> {
 
     ResultData deleteBoxPhoto(DeleteSidParamVO param) throws Exception;
 
-    DownloadVO downloadBallScreenVideo(BallScreenVideoParamVO param);
-
-    ResultData uploadBallScreenVideo(String num,String fileName,MultipartFile file) throws Exception;
+//    DownloadVO downloadBallScreenVideo(BallScreenVideoParamVO param);
+//
+//    ResultData uploadBallScreenVideo(String num,String fileName,MultipartFile file) throws Exception;
 
     void upgradeVersionToSceneJson(String num, String bucket) throws Exception;
 

+ 104 - 104
src/main/java/com/fdkankan/scene/service/impl/SceneEditInfoServiceImpl.java

@@ -524,20 +524,20 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         ScenePlusExt scenePlusExt = scenePlusExtService
             .getScenePlusExtByPlusId(scenePlus.getId());
         String bucket = scenePlusExt.getYunFileBucket();
-        String path = scenePlusExt.getDataSource();
+//        String path = scenePlusExt.getDataSource();
 
         //户型图上传
-        String  userEditPath = UploadFilePath.USER_EDIT_PATH + "floor-cad-%s.%s";
-        String floorCadPath = path + "/results/floorplan_cad";
-        List<String> floorCadList = FileUtils.getFileList(floorCadPath);
-        if(CollUtil.isNotEmpty(floorCadList)){
-            floorCadList.stream().forEach(str->{
-                String substring = str.substring(str.lastIndexOf(File.separator) + 1);
-                String[] arr = substring.split("floor");
-                String[] arr2 = arr[1].split("\\.");
-                ossUtil.uploadFile(String.format(userEditPath, num, arr2[0], arr2[1]), str, false);
-            });
-        }
+//        String  userEditPath = UploadFilePath.USER_EDIT_PATH + "floor-cad-%s.%s";
+//        String floorCadPath = path + "/results/floorplan_cad";
+//        List<String> floorCadList = FileUtils.getFileList(floorCadPath);
+//        if(CollUtil.isNotEmpty(floorCadList)){
+//            floorCadList.stream().forEach(str->{
+//                String substring = str.substring(str.lastIndexOf(File.separator) + 1);
+//                String[] arr = substring.split("floor");
+//                String[] arr2 = arr[1].split("\\.");
+//                ossUtil.uploadFile(String.format(userEditPath, num, arr2[0], arr2[1]), str, false);
+//            });
+//        }
 
         //根据floorplan_cad.json生成houseType.json
         this.uploadHouseTypeJson(num, bucket);
@@ -1188,98 +1188,98 @@ public class SceneEditInfoServiceImpl extends ServiceImpl<ISceneEditInfoMapper,
         return ResultData.ok();
     }
 
-    @Override
-    public DownloadVO downloadBallScreenVideo(BallScreenVideoParamVO param) {
-        String videoPath = String.format(UploadFilePath.VIDEOS_VIEW_PATH, param.getNum()) + param.getFileName();
-        String url = videoPath;
-        return DownloadVO.builder()
-            .fileName(param.getFileName())
-            .url(url)
-            .build();
-    }
-
-    @Override
-    public ResultData uploadBallScreenVideo(String num, String fileName, MultipartFile file) throws Exception {
-
-        //校验格式
-        if(!fileName.endsWith(".mp4")){
-            throw new BusinessException(ErrorCode.FAILURE_CODE_7016);
-        }
-        String videosViewPath = String.format(UploadFilePath.VIDEOS_VIEW_PATH, num);
-
-        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
-        if(scenePlus == null){
-            throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
-        }
-        ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
-        String bucket = scenePlusExt.getYunFileBucket();
-
-        String path = scenePlusExt.getDataSource();
-        //校验文件名
-        String videos = scenePlusExt.getVideos();
-        if(StrUtil.isEmpty(videos)){
-            throw new BusinessException(ErrorCode.FAILURE_CODE_7012);
-        }
-        JSONObject videosJson = JSON.parseObject(videos);
-        JSONArray dataArr = videosJson.getJSONArray("data");
-        boolean exists = false;
-        for (Object o : dataArr) {
-            JSONObject jsonObject =  (JSONObject)o;
-            if(jsonObject.getString("id").equals(fileName.replace(".mp4", ""))){
-                exists = true;
-                break;
-            }
-        }
-        if(!exists){
-            throw new BusinessException(ErrorCode.FAILURE_CODE_7012);
-        }
-
-        if(path != null && !"".equals(path) && path.startsWith("http")){
-            path = ConstantFilePath.BUILD_MODEL_PATH + File.separator + path.split("/")[path.split("/").length - 2];
-        }
-
-        String target = path + "_images";
-
-        String filePath = target + File.separator + "extras/video" + File.separator + fileName;
-
-        File targetFile = new File(filePath);
-        if(!targetFile.getParentFile().exists()){
-            targetFile.getParentFile().mkdirs();
-        }
-
-        //保存视频到本地
-        file.transferTo(targetFile);
-
-        File video = new File(target + File.separator + "extras/video");
-        //如果文件夹或者文件不存在,跳出
-        if(!video.exists() || video.listFiles() == null || video.listFiles().length == 0){
-            throw new BusinessException(ErrorCode.FAILURE_CODE_7009);
-        }
-
-        for(String videoName : video.list()){
-            log.info("球幕视频名称:{}", 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"));
-
-            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,
-                path + File.separator + "caches/videos/" + videoName, true);
-
-        }
-        FileUtils.deleteDirectory(target + File.separator + "extras/video/");
-
-        SceneEditInfo sceneEditInfo = this.getByScenePlusId(scenePlus.getId());
-        this.upgradeVersionById(sceneEditInfo.getId());
-
-        //更新scenejson缓存和oss文件版本号
-        this.upgradeSceneJsonVersion(num, sceneEditInfo.getVersion() + 1, null, bucket);
-
-        return ResultData.ok();
-    }
+//    @Override
+//    public DownloadVO downloadBallScreenVideo(BallScreenVideoParamVO param) {
+//        String videoPath = String.format(UploadFilePath.VIDEOS_VIEW_PATH, param.getNum()) + param.getFileName();
+//        String url = videoPath;
+//        return DownloadVO.builder()
+//            .fileName(param.getFileName())
+//            .url(url)
+//            .build();
+//    }
+//
+//    @Override
+//    public ResultData uploadBallScreenVideo(String num, String fileName, MultipartFile file) throws Exception {
+//
+//        //校验格式
+//        if(!fileName.endsWith(".mp4")){
+//            throw new BusinessException(ErrorCode.FAILURE_CODE_7016);
+//        }
+//        String videosViewPath = String.format(UploadFilePath.VIDEOS_VIEW_PATH, num);
+//
+//        ScenePlus scenePlus = scenePlusService.getScenePlusByNum(num);
+//        if(scenePlus == null){
+//            throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
+//        }
+//        ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
+//        String bucket = scenePlusExt.getYunFileBucket();
+//
+//        String path = scenePlusExt.getDataSource();
+//        //校验文件名
+//        String videos = scenePlusExt.getVideos();
+//        if(StrUtil.isEmpty(videos)){
+//            throw new BusinessException(ErrorCode.FAILURE_CODE_7012);
+//        }
+//        JSONObject videosJson = JSON.parseObject(videos);
+//        JSONArray dataArr = videosJson.getJSONArray("data");
+//        boolean exists = false;
+//        for (Object o : dataArr) {
+//            JSONObject jsonObject =  (JSONObject)o;
+//            if(jsonObject.getString("id").equals(fileName.replace(".mp4", ""))){
+//                exists = true;
+//                break;
+//            }
+//        }
+//        if(!exists){
+//            throw new BusinessException(ErrorCode.FAILURE_CODE_7012);
+//        }
+//
+//        if(path != null && !"".equals(path) && path.startsWith("http")){
+//            path = ConstantFilePath.BUILD_MODEL_PATH + File.separator + path.split("/")[path.split("/").length - 2];
+//        }
+//
+//        String target = path + "_images";
+//
+//        String filePath = target + File.separator + "extras/video" + File.separator + fileName;
+//
+//        File targetFile = new File(filePath);
+//        if(!targetFile.getParentFile().exists()){
+//            targetFile.getParentFile().mkdirs();
+//        }
+//
+//        //保存视频到本地
+//        file.transferTo(targetFile);
+//
+//        File video = new File(target + File.separator + "extras/video");
+//        //如果文件夹或者文件不存在,跳出
+//        if(!video.exists() || video.listFiles() == null || video.listFiles().length == 0){
+//            throw new BusinessException(ErrorCode.FAILURE_CODE_7009);
+//        }
+//
+//        for(String videoName : video.list()){
+//            log.info("球幕视频名称:{}", 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"));
+//
+//            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,
+//                path + File.separator + "caches/videos/" + videoName, true);
+//
+//        }
+//        FileUtils.deleteDirectory(target + File.separator + "extras/video/");
+//
+//        SceneEditInfo sceneEditInfo = this.getByScenePlusId(scenePlus.getId());
+//        this.upgradeVersionById(sceneEditInfo.getId());
+//
+//        //更新scenejson缓存和oss文件版本号
+//        this.upgradeSceneJsonVersion(num, sceneEditInfo.getVersion() + 1, null, bucket);
+//
+//        return ResultData.ok();
+//    }
 
     @Override
     public void upgradeVersionToSceneJson(String num, String bucket) throws Exception{