Przeglądaj źródła

本地化改造

dengsixing 3 lat temu
rodzic
commit
3afd9bf310

+ 8 - 0
src/main/java/com/fdkankan/scene/controller/SceneController.java

@@ -2,6 +2,7 @@ package com.fdkankan.scene.controller;
 
 
 import com.fdkankan.common.constant.SceneInfoReqType;
+import com.fdkankan.scene.vo.InitSceneParamVO;
 import com.fdkankan.web.response.ResultData;
 import com.fdkankan.scene.service.ISceneEditInfoService;
 import com.fdkankan.scene.service.IScenePlusService;
@@ -78,5 +79,12 @@ public class SceneController extends BaseController {
         return scenePlusService.downLoadZSData(param);
     }
 
+    @PostMapping("/initScene")
+    public ResultData initScene(@RequestBody InitSceneParamVO param){
+        return scenePlusService.initScene(param.getNum(), param.getTitle(), param.getDes(),
+            param.getSceneSource(), param.getDataSource(), param.getSceneScheme(),
+            param.getSceneResolution(), param.getSceneFrom());
+    }
+
 }
 

+ 24 - 8
src/main/java/com/fdkankan/scene/oss/OssUtil.java

@@ -311,10 +311,16 @@ public class OssUtil {
 
 
     public Object downloadFile(String pathKey, String file) {
-        if (FdkkLaserConfig.isLocalization()) {
-            return minioOssTemplate.downloadFile(pathKey, file);
-        } else {
-            return aliyunOssTemplate.downloadFile(pathKey, file);
+        if (FdkkLaserConfig.isIsBucket()) {
+            if (FdkkLaserConfig.isLocalization()) {
+                return minioOssTemplate.downloadFile(pathKey, file);
+            } else {
+                return aliyunOssTemplate.downloadFile(pathKey, file);
+            }
+        }else{
+            File copy = FileUtil.copy(new File(FdkkLaserConfig.getProfile() + File.separator + pathKey),
+                    new File(file), true);
+            return copy.exists();
         }
     }
 
@@ -329,10 +335,16 @@ public class OssUtil {
 
 
     public Boolean copyObject(String oldPath, String newPath) {
-        if (FdkkLaserConfig.isLocalization()) {
-            return minioOssTemplate.copyObject(oldPath, newPath);
-        } else {
-            return aliyunOssTemplate.copyObject(oldPath, newPath);
+        if (FdkkLaserConfig.isIsBucket()) {
+            if (FdkkLaserConfig.isLocalization()) {
+                return minioOssTemplate.copyObject(oldPath, newPath);
+            } else {
+                return aliyunOssTemplate.copyObject(oldPath, newPath);
+            }
+        }else{
+            File copy = FileUtil.copy(FdkkLaserConfig.getProfile() + File.separator + oldPath,
+                FdkkLaserConfig.getProfile() + File.separator + newPath, true);
+            return copy.exists();
         }
     }
 
@@ -418,4 +430,8 @@ public class OssUtil {
             return FdkkLaserConfig.getProfile() + File.separator + keyName;
         }
     }
+
+    public String getFileContent(String pathKey) {
+        return FileUtil.readUtf8String(FdkkLaserConfig.getProfile() + File.separator + pathKey);
+    }
 }

+ 1 - 1
src/main/java/com/fdkankan/scene/service/ISceneEditService.java

@@ -20,7 +20,7 @@ public interface ISceneEditService {
 
     SceneAuthVO getAuth(String num, SSOUser ssoUser);
 
-    ResultData locales(LocalesParamVO param) throws Exception;
+//    ResultData locales(LocalesParamVO param) throws Exception;
 
     ResultData saveTour(BaseDataParamVO param) throws IOException;
 

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

@@ -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

+ 13 - 14
src/main/java/com/fdkankan/scene/service/impl/SceneEditServiceImpl.java

@@ -20,6 +20,7 @@ import com.fdkankan.scene.entity.ScenePlusExt;
 import com.fdkankan.scene.entity.SceneResource;
 import com.fdkankan.scene.entity.User;
 import com.fdkankan.scene.entity.UserIncrement;
+import com.fdkankan.scene.oss.OssUtil;
 import com.fdkankan.scene.service.ICameraDetailService;
 import com.fdkankan.scene.service.ICameraService;
 import com.fdkankan.scene.service.ISceneCooperationService;
@@ -40,6 +41,7 @@ import com.fdkankan.scene.vo.SceneAuthVO;
 import com.fdkankan.web.response.ResultData;
 import com.fdkankan.web.user.SSOUser;
 import java.io.IOException;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -82,6 +84,8 @@ public class SceneEditServiceImpl implements ISceneEditService {
     private ISceneResourceService sceneResourceService;
     @Autowired
     private IScenePlusExtService scenePlusExtService;
+    @Autowired
+    private OssUtil ossUtil;
 
     @Override
     public SceneAuthVO getAuth(String num, SSOUser ssoUser){
@@ -205,13 +209,12 @@ public class SceneEditServiceImpl implements ISceneEditService {
         return sceneAuthVO;
     }
 
-    @Override
-    public ResultData locales(LocalesParamVO param) throws Exception {
-        String key = "v4/www/locales/" + param.getFile();
-// TODO: 2022/8/22  
-        //        fYunFileService.uploadFile(JSON.toJSONBytes(param.getData()), key);
-        return ResultData.ok();
-    }
+//    @Override
+//    public ResultData locales(LocalesParamVO param) throws Exception {
+//        String key = "v4/www/locales/" + param.getFile();
+//        fYunFileService.uploadFile(JSON.toJSONBytes(param.getData()), key);
+//        return ResultData.ok();
+//    }
 
     @Override
     public ResultData saveTour(BaseDataParamVO param) throws IOException {
@@ -221,8 +224,7 @@ public class SceneEditServiceImpl implements ISceneEditService {
         }
         ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
         String key = String.format(UploadFilePath.USER_EDIT_PATH, param.getNum()) + "tour.json";
-// TODO: 2022/8/22  
-        //        fYunFileService.uploadFile(scenePlusExt.getYunFileBucket(), param.getData().getBytes(StandardCharsets.UTF_8), key);
+        ossUtil.uploadFileBytes(key, param.getData().getBytes(StandardCharsets.UTF_8));
 
         sceneEditInfoExtService.updateToursByNum(
             param.getNum(), Integer.valueOf(CommonStatus.YES.code()));
@@ -239,9 +241,7 @@ public class SceneEditServiceImpl implements ISceneEditService {
         ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
         String userEditPath = String.format(UploadFilePath.USER_EDIT_PATH, param.getNum());
         String tourJsonPath = userEditPath + "tour.json";
-// TODO: 2022/8/22  
-        String tourJson = null;
-            //String tourJson = fYunFileService.getFileContent(scenePlusExt.getYunFileBucket(), tourJsonPath);
+        String tourJson = ossUtil.getFileContent(tourJsonPath);
         JSONArray tours = JSON.parseArray(tourJson);
         if(CollUtil.isNotEmpty(tours)){
             List<String> fileNames = new ArrayList<>();
@@ -279,8 +279,7 @@ public class SceneEditServiceImpl implements ISceneEditService {
             }
         }
         //删除tour.json文件
-        // TODO: 2022/8/22  
-//        fYunFileService.deleteFile(scenePlusExt.getYunFileBucket(), tourJsonPath);
+        ossUtil.deleteObject(tourJsonPath);
 
         sceneEditInfoExtService.updateToursByNum(
             param.getNum(), Integer.valueOf(CommonStatus.NO.code()));

+ 5 - 3
src/main/java/com/fdkankan/scene/service/impl/ScenePlusServiceImpl.java

@@ -19,6 +19,7 @@ import com.fdkankan.model.constants.UploadFilePath;
 import com.fdkankan.scene.bean.SceneJsonBean;
 import com.fdkankan.scene.entity.SceneEditControls;
 import com.fdkankan.scene.entity.SceneEditInfoExt;
+import com.fdkankan.scene.oss.OssUtil;
 import com.fdkankan.scene.service.ISceneEditControlsService;
 import com.fdkankan.scene.service.ISceneEditInfoExtService;
 import com.fdkankan.scene.vo.SceneEditControlsVO;
@@ -73,6 +74,8 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
     private ISceneEditInfoExtService sceneEditInfoExtService;
     @Autowired
     private ISceneEditControlsService sceneEditControlsService;
+    @Autowired
+    private OssUtil ossUtil;
 
     @Override
     public ScenePlus getScenePlusByNum(String num) {
@@ -183,7 +186,7 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
 
     /**
      * <p>
-            TODO
+     *     初始化场景数据
      * </p>
      * @author dengsixing
      * @date 2022/8/22
@@ -257,8 +260,7 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
 
         //本地写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));
 
         return ResultData.ok();
     }

+ 15 - 22
src/main/java/com/fdkankan/scene/service/impl/SceneProServiceImpl.java

@@ -28,6 +28,7 @@ import com.fdkankan.scene.entity.ScenePlus;
 import com.fdkankan.scene.entity.ScenePlusExt;
 import com.fdkankan.scene.entity.ScenePro;
 import com.fdkankan.scene.mapper.ISceneProMapper;
+import com.fdkankan.scene.oss.OssUtil;
 import com.fdkankan.scene.service.ISceneDataDownloadService;
 import com.fdkankan.scene.service.ISceneEditControlsService;
 import com.fdkankan.scene.service.ISceneEditInfoService;
@@ -108,6 +109,8 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
     private IScenePlusExtService scenePlusExtService;
     @Autowired
     private ISceneUploadService sceneUploadService;
+    @Autowired
+    private OssUtil ossUtil;
 
     @Transactional
     @Override
@@ -120,9 +123,8 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         ScenePlusExt scenePlusExt = scenePlusExtService.getScenePlusExtByPlusId(scenePlus.getId());
 
         //更新缩略图url
-        // TODO: 2022/8/22
-//        String thumbUrl = this.ossUrlPrefix + String.format(UploadFilePath.USER_EDIT_PATH, param.getNum()) + param.getFileName();
-//        scenePlusExt.setThumb(thumbUrl);
+        String thumbUrl = String.format(UploadFilePath.USER_EDIT_PATH, param.getNum()) + param.getFileName();
+        scenePlusExt.setThumb(thumbUrl);
         scenePlusExtService.updateById(scenePlusExt);
 
         SceneEditInfo sceneEditInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
@@ -497,18 +499,15 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
                 String fileType = jsonObject.getString("media");
                 if(fileType.contains("photo"))
                 {
-                    // TODO: 2022/8/22
-//                    fYunFileService.deleteFile(bucket,userDataPath + "hot"+sid+".jpg");
+                    ossUtil.deleteObject(userDataPath + "hot"+sid+".jpg");
                 }
                 if(fileType.contains("audio") || fileType.contains("voice"))
                 {
-                    // TODO: 2022/8/22
-//                    fYunFileService.deleteFile(bucket,userDataPath + "hot"+sid+".mp3");
+                    ossUtil.deleteObject(userDataPath + "hot"+sid+".mp3");
                 }
                 if(fileType.contains("video"))
                 {
-                    // TODO: 2022/8/22
-//                    fYunFileService.deleteFile(bucket,userDataPath + "hot"+sid+".mp4");
+                    ossUtil.deleteObject(userDataPath + "hot"+sid+".mp4");
                 }
             }
         }
@@ -594,8 +593,8 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
             directory.mkdirs();
         }
         //如果是云存储,将vision.modeldata下载到本地,如果是本地存储,场景计算完就已经将这个文件拷贝到编辑目录了存在这个文件了,不需要再下载
-        // TODO: 2022/8/22
-//        fYunFileService.downloadFile(bucket, viewImagesPath + "vision.modeldata", localDataPath + "vision.modeldata");
+        String viewImagesPath = String.format(UploadFilePath.IMG_VIEW_PATH, param.getNum());
+        ossUtil.downloadFile(viewImagesPath + "vision.modeldata", localDataPath + "vision.modeldata");
 
         //检查vision.modeldata本地是否存在,不存在抛出异常
         File file = new File(localDataPath + "vision.modeldata");
@@ -625,8 +624,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         FileUtils.deleteFile(localDataPath + "vision.modeldata");
         FileUtils.writeFile(localDataPath + "vision.json", json.toString());
         ConvertUtils.convertTxtToVisionModelData(localDataPath + "vision.json", localDataPath + "vision.modeldata");
-// TODO: 2022/8/22
-        //        fYunFileService.uploadFile(bucket, localDataPath + "vision.modeldata", viewImagesPath + "vision.modeldata");
+        ossUtil.uploadFile(viewImagesPath + "vision.modeldata", localDataPath + "vision.modeldata", false);
 
         //更新版本号
         SceneEditInfo editInfo = sceneEditInfoService.getByScenePlusId(scenePlus.getId());
@@ -757,7 +755,6 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         map.put(path + File.separator + "results" +File.separator+ConstantFileName.modelUUID+"_50k.dam.lzma", imgViewPath +ConstantFileName.modelUUID+"_50k.dam.lzma");
         map.put(path + File.separator + "results" +File.separator+ConstantFileName.modelUUID+"_50k.dam", imgViewPath+ConstantFileName.modelUUID+"_50k.dam");
 
-// TODO: 2022/8/22
         //        fYunFileService.uploadMulFiles(bucket, map);
     }
 
@@ -899,8 +896,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
 //            //打包
 //            ZipUtil.zip(newData, zipPath);
 //            //上传压缩包
-//// TODO: 2022/8/22
-////            fYunFileService.uploadFile(bucket, zipPath, "downloads/extras/" + zipName);
+//            fYunFileService.uploadFile(bucket, zipPath, "downloads/extras/" + zipName);
 //            String url = ossUrlPrefix + "downloads/extras/" + zipName + "?t=" + Calendar.getInstance().getTimeInMillis();
 //            return ResultData.ok(url);
 //        }
@@ -945,8 +941,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
 //                //打包
 //                ZipUtil.zip(meshPath, zipPath);
 //                //上传压缩包
-//// TODO: 2022/8/22
-////                fYunFileService.uploadFile(bucket, zipPath, "downloads/extras/" + zipName);
+//                fYunFileService.uploadFile(bucket, zipPath, "downloads/extras/" + zipName);
 //                String url = ossUrlPrefix + "downloads/extras/" + zipName + "?t=" + Calendar.getInstance().getTimeInMillis();
 ////                FileUtil.del(zipPath);
 //                return ResultData.ok(url);
@@ -971,8 +966,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
 //
 //            ZipUtil.zip(editData, zipPath);
 //            //上传压缩包
-//// TODO: 2022/8/22
-////            fYunFileService.uploadFile(bucket, zipPath, "downloads/extras/" + zipName);
+//            fYunFileService.uploadFile(bucket, zipPath, "downloads/extras/" + zipName);
 //            String url = ossUrlPrefix + "downloads/extras/" + zipName + "?t=" + Calendar.getInstance().getTimeInMillis();
 //            return ResultData.ok(url);
 //        }
@@ -996,8 +990,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
 //
 //        ZipUtil.zip(dataPath, zipPath);
 //        //上传压缩包
-//// TODO: 2022/8/22
-//        // fYunFileService.uploadFile(bucket, zipPath, "downloads/extras/" + zipName);
+//         fYunFileService.uploadFile(bucket, zipPath, "downloads/extras/" + zipName);
 //        String url = ossUrlPrefix + "downloads/extras/" + zipName + "?t=" + Calendar.getInstance().getTimeInMillis();
 //        return ResultData.ok(url);
 //    }

+ 7 - 8
src/main/java/com/fdkankan/scene/service/impl/SceneUploadServiceImpl.java

@@ -11,6 +11,7 @@ import com.fdkankan.common.constant.ServerCode;
 import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.model.constants.UploadFilePath;
 import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.scene.oss.OssUtil;
 import com.fdkankan.web.response.ResultData;
 import com.fdkankan.web.util.BASE64DecodedMultipartFile;
 import com.fdkankan.scene.entity.ScenePlus;
@@ -58,6 +59,8 @@ public class SceneUploadServiceImpl extends ServiceImpl<ISceneUploadMapper, Scen
     private IScenePlusService scenePlusService;
     @Autowired
     private IScenePlusExtService scenePlusExtService;
+    @Autowired
+    private OssUtil ossUtil;
 
     @Override
     public String uploads(String imgData,String fileName,String blzType,MultipartFile[] files,
@@ -94,8 +97,7 @@ public class SceneUploadServiceImpl extends ServiceImpl<ISceneUploadMapper, Scen
             hasDelete.add(fileName);
             String key = userEditPath + fileName;
             filePaths.add(key);
-// TODO: 2022/8/22
-            //            fYunFileService.deleteFile(scenePlusExt.getYunFileBucket(), key);
+            ossUtil.deleteObject(key);
         }
 
         this.update(new LambdaUpdateWrapper<SceneUpload>()
@@ -142,8 +144,7 @@ public class SceneUploadServiceImpl extends ServiceImpl<ISceneUploadMapper, Scen
 
             String ossPath = StrUtil.isNotBlank(uploadPath) ? uploadPath : (String.format(UploadFilePath.USER_EDIT_PATH ,num) + realFileName);
             try {
-// TODO: 2022/8/22
-//                                fYunFileService.uploadFile(bucket, newFile.getPath(), ossPath);
+                ossUtil.uploadFile(ossPath, newFile.getPath(), false);
             }catch (Exception e){
                 log.error(ossPath+"上传文件失败"+e);
                 throw new BusinessException(ErrorCode.FAILURE_CODE_7013);
@@ -173,8 +174,7 @@ public class SceneUploadServiceImpl extends ServiceImpl<ISceneUploadMapper, Scen
         if(list != null && list.size() >0){
             for (SceneUpload sceneUpload : list) {
                 try {
-// TODO: 2022/8/22
-                    //                    fYunFileService.deleteFile(bucket, sceneUpload.getFilePath());
+                    ossUtil.deleteObject(sceneUpload.getFilePath());
                     this.removeEntity(sceneUpload);
                 }catch (Exception e){
                     log.error(sceneUpload.getFilePath()+"删除oss文件失败",e);
@@ -212,8 +212,7 @@ public class SceneUploadServiceImpl extends ServiceImpl<ISceneUploadMapper, Scen
 //
 //        File tempFile = File.createTempFile(UUID.randomUUID().toString(), suffix);
 //        cn.hutool.core.io.FileUtil.writeString(param.getContent(), tempFile, StandardCharsets.UTF_8);
-//// TODO: 2022/8/22
-//        //        fYunFileService.uploadFile(param.getBucket(), tempFile.getPath(), param.getOssPath());
+//        fYunFileService.uploadFile(param.getBucket(), tempFile.getPath(), param.getOssPath());
 //        tempFile.deleteOnExit();
 //
 //        return this.ossUrlPrefix + param.getOssPath();

+ 77 - 0
src/main/java/com/fdkankan/scene/util/StreamGobblerLine.java

@@ -0,0 +1,77 @@
+package com.fdkankan.scene.util;
+
+import lombok.extern.slf4j.Slf4j;
+
+import java.io.*;
+
+@Slf4j
+public class StreamGobblerLine extends Thread {
+
+    private final InputStream is;
+    private final String type;
+    private final OutputStream os;
+    private final Integer lineSize;  // 多少行打印日志一次
+
+    StreamGobblerLine(InputStream is, String type) {
+        this(is, type, null, null);
+    }
+
+    StreamGobblerLine(InputStream is, String type, Integer lineSize) {
+        this(is, type, null, lineSize);
+    }
+
+    private StreamGobblerLine(InputStream is, String type, OutputStream redirect, Integer lineSize) {
+        this.is = is;
+        this.type = type;
+        os = redirect;
+        this.lineSize = lineSize;
+    }
+
+    @Override
+    public void run() {
+        StreamGobblerLine.log.info("run StreamGobblerLine");
+
+        InputStreamReader isr = null;
+        BufferedReader br = null;
+        PrintWriter pw = null;
+        try {
+            if (os != null)
+                pw = new PrintWriter(os);
+
+            isr = new InputStreamReader(is);
+            br = new BufferedReader(isr);
+            String line = null;
+            int i = 1;
+            while ((line = br.readLine()) != null) {
+                if (lineSize != null) {
+                    if (i % lineSize == 0) {
+                        StreamGobblerLine.log.info(type + "," + i + " : >" + line);
+                    }
+                } else {
+                    StreamGobblerLine.log.info(type + "," + i + " : >" + line);
+                }
+                i++;
+
+            }
+
+            if (pw != null)
+                pw.flush();
+        } catch (IOException ioe) {
+            ioe.printStackTrace();
+        } finally {
+            try {
+                if (pw != null) {
+                    pw.close();
+                }
+                if (br != null) {
+                    br.close();
+                }
+                if (isr != null) {
+                    isr.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+}

+ 26 - 0
src/main/java/com/fdkankan/scene/vo/InitSceneParamVO.java

@@ -0,0 +1,26 @@
+package com.fdkankan.scene.vo;
+
+import lombok.Data;
+
+/**
+ * <p>
+ * TODO
+ * </p>
+ *
+ * @author dengsixing
+ * @since 2022/8/23
+ **/
+@Data
+public class InitSceneParamVO {
+
+    private String num;
+    private String title;
+    private String des;
+    private Integer sceneSource;
+    private String dataSource;
+    private Integer sceneScheme;
+    private String sceneResolution;
+    private String sceneFrom;
+
+
+}

+ 21 - 0
src/main/resources/application.yml

@@ -19,6 +19,26 @@ fdkk:
   isActiveJobStatus: false
   #是否使用软连接
   isLink: false
+aliyun:
+  oss:
+    env: dev
+    endpoint: "1"
+    internal-endpoint: "1"
+    access-key-id: "1"
+    access-key-secret: "1"
+    bucket: laser-data
+    bucket-custom-domain:
+      laser-data: 1
+minio:
+  oss:
+    env: dev
+    minio-url: 1
+    internal-minio-url: 1
+    minio-name: 1
+    minio-pass: 1
+    bucket: laser-data
+    bucket-custom-domain:
+      laser-data: 1
 server:
   port: 8085
   servlet:
@@ -82,3 +102,4 @@ scene:
       url: smg.html?m=
 
 
+