lyhzzz před 1 týdnem
rodič
revize
4ae122e3d3

+ 0 - 19
src/main/java/com/fdkankan/fusion/down/CaseDownService.java

@@ -507,25 +507,6 @@ public class CaseDownService {
 
     @Value("${upload.query-path}")
     private String queryPath;
-   public void downZip(Integer type ,String uri,String kkzipPath,String kknumPath,String sszipPath,String ssNumPath){
-       try {
-           if(type != 2 && type != 5){ //深时点云
-               if(uri.contains("?")){
-                   uri = uri.split("[?]")[0];
-               }
-               ShellUtil.yunDownload(uri.replace(queryPath, ""), kkzipPath);
-               ShellUtil.unZip(kkzipPath,kknumPath);
-               FileUtil.del(kkzipPath);
-           }else {
-               ShellUtil.yunDownloadSs(uri.replace(queryPath, ""), sszipPath);
-               ShellUtil.unZip(sszipPath,ssNumPath);
-               FileUtil.del(sszipPath);
-           }
-       }catch (Exception e){
-            log.info("下载场景离线包失败:{}",uri,e);
-       }
-
-   }
     public void downModel(Integer caseId, String modelGlbUrl,String offPath) {
         String path = offPath +FilePath.OFFLINE_OSS_PATH;
 

+ 0 - 19
src/main/java/com/fdkankan/fusion/down/FusionDownService.java

@@ -433,25 +433,6 @@ public class FusionDownService {
 
     @Value("${upload.query-path}")
     private String queryPath;
-   public void downZip(Integer type ,String uri,String kkzipPath,String kknumPath,String sszipPath,String ssNumPath){
-       try {
-           if(type != 2 && type != 5){ //深时点云
-               if(uri.contains("?")){
-                   uri = uri.split("[?]")[0];
-               }
-               ShellUtil.yunDownload(uri.replace(queryPath, ""), kkzipPath);
-               ShellUtil.unZip(kkzipPath,kknumPath);
-               FileUtil.del(kkzipPath);
-           }else {
-               ShellUtil.yunDownloadSs(uri.replace(queryPath, ""), sszipPath);
-               ShellUtil.unZip(sszipPath,ssNumPath);
-               FileUtil.del(sszipPath);
-           }
-       }catch (Exception e){
-            log.info("下载场景离线包失败:{}",uri,e);
-       }
-
-   }
     public void downModel( String modelGlbUrl,String offPath) {
         String path = offPath +FilePath.OFFLINE_OSS_PATH;
 

+ 14 - 6
src/main/java/com/fdkankan/fusion/service/impl/ModelServiceImpl.java

@@ -17,6 +17,7 @@ import com.fdkankan.fusion.common.PageInfo;
 import com.fdkankan.fusion.common.util.*;
 import com.fdkankan.fusion.common.FilePath;
 import com.fdkankan.fusion.common.ResultCode;
+import com.fdkankan.fusion.config.CacheUtil;
 import com.fdkankan.fusion.entity.*;
 import com.fdkankan.fusion.exception.BusinessException;
 import com.fdkankan.fusion.mapper.IModelMapper;
@@ -68,6 +69,8 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
     ITmCameraService tmCameraService;
     @Autowired
     ThreadService threadService;
+    @Autowired
+    ISceneService sceneService;
 
     @Value("${upload.query-path}")
     private String queryPath;
@@ -258,8 +261,12 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
         model.setCreateStatus(1);
         model.setIsObj(isObj);
         if(isObj == 1){           //看看,看见
-            String mesh3DtilesPath  = String.format(FilePath.OBJ_OSS_PATH,num) + "/images/3dtiles/tileset.json";
-            String sizePath = String.format(FilePath.OBJ_OSS_PATH,num) + "/images/3dtiles";
+            Scene scene = sceneService.getByNum(num);
+            if(scene == null){
+                throw new BusinessException(ResultCode.SCENE_NOT_EXIST);
+            }
+            String mesh3DtilesPath  = scene.getWebPath() + String.format(FilePath.OBJ_OSS_PATH,num) + "/images/3dtiles/tileset.json";
+            String sizePath = scene.getWebPath() + String.format(FilePath.OBJ_OSS_PATH,num) + "/images/3dtiles";
             if(localToOssUtil.existKey(mesh3DtilesPath)){
                 model.setModelDateType("b3dm");
                 model.setModelType("b3dm");
@@ -267,7 +274,7 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
                 model.setModelSize(FileWriterUtil.setFileSize(localToOssUtil.getSize( sizePath)));
             }else {
                 model.setModelObjUrl(String.format(FilePath.OBJ_LOCAL_PATH,environment ,num) +"/mesh.obj");
-                model.setModelGlbUrl(getGlbUrl(type,num,model));
+                model.setModelGlbUrl(getGlbUrl(type,num,model,scene.getWebPath()));
                 model.setModelType("glb");
             }
 
@@ -363,10 +370,11 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
 
 
 
-    private String getGlbUrl(Integer type, String num,Model model) {
+    private String getGlbUrl(Integer type, String num,Model model,String scenePath) {
         if(type == 0 || type == 1 || type == 4 || type == 6 || type == 7){ //看看,看见
-            String objPath = String.format(FilePath.OBJ_LOCAL_PATH ,environment,num);
-            ShellUtil.yunDownload(String.format(FilePath.OBJ_OSS_PATH, num)+"/data/mesh" ,objPath);
+//            String objPath = String.format(FilePath.OBJ_LOCAL_PATH ,environment,num);
+//            ShellUtil.yunDownload(String.format(FilePath.OBJ_OSS_PATH, num)+"/data/mesh" ,objPath);
+            String objPath = scenePath + String.format(FilePath.OBJ_OSS_PATH, num)+"/data/mesh";
             List<String> localGlbPaths = new ArrayList<>();
             List<String> ossGlbPaths = new ArrayList<>();
             File localFile = new File(objPath);

+ 0 - 55
src/main/java/com/fdkankan/fusion/service/impl/ThreadService.java

@@ -209,62 +209,7 @@ public class ThreadService {
         }
     }
 
-    @Async
-    public void objToB3dm(String num,Integer type) {
-        String objPath = String.format(FilePath.OBJ_LOCAL_PATH ,environment,num);
-        ShellUtil.yunDownload(String.format(FilePath.OBJ_OSS_PATH, num)+"/data/mesh" ,objPath);
-        List<String> localGlbPaths = new ArrayList<>();
-        List<String> ossGlbPaths = new ArrayList<>();
-        File localFile = new File(objPath);
-        HashMap<String,Long> sizeMap = new HashMap<>();
-        sizeMap.put("size",0L);
-        this.toGlB(localFile, localGlbPaths,sizeMap);
-        String sizeStr = FileWriterUtil.setFileSize(sizeMap.get("size"));
-        if(!localGlbPaths.isEmpty()){
-            for (String localGlbPath : localGlbPaths) {
-                String ossPath = localGlbPath.replace("/mnt/","");
-                ShellUtil.yunUpload(localGlbPath,ossPath);
-                ossGlbPaths.add(queryPath +ossPath+"/tileset.json");
-            }
-            log.info("转换完成修改数据库:{}:{}:{}",ossGlbPaths,num,type);
-            String ossGlbPath =  JSONArray.toJSONString(ossGlbPaths);
-            LambdaUpdateWrapper<Model> wrapper = new LambdaUpdateWrapper<>();
-            wrapper.eq(Model::getType,type);
-            wrapper.eq(Model::getNum,num);
-            wrapper.set(Model::getModelGlbUrl,ossGlbPath);
-            wrapper.set(Model::getModelDateType,"b3dm");
-            wrapper.set(Model::getModelType,"b3dm");
-            wrapper.set(Model::getCreateStatus,1);
-            wrapper.set(Model::getModelSize,sizeStr);
-            modelService.update(wrapper);
-        }
-    }
-
 
-    private void toGlB(File localFile, List<String> localGlbPath, HashMap<String,Long> sizeMap ) {
-        File[] files = localFile.listFiles();
-        for (File file : files) {
-            if(file.getPath().contains(".temp")){
-                continue;
-            }
-            if(file.isDirectory()){
-                toGlB(file,localGlbPath,sizeMap);
-            }
-            if(file.getPath().contains("lod_")){
-                if(file.getPath().contains("lod_0") && file.getName().contains(".obj")){
-                    String glbPath =  OBJToGLBUtil.objToB3dm(file.getPath(),file.getParentFile().getPath()+"/b3dm");
-                    sizeMap.put("size",sizeMap.get("size") + file.length());
-                    localGlbPath.add(glbPath);
-                }
-                continue;
-            }
 
-            if(file.getName().contains(".obj")){
-                String glbPath =  OBJToGLBUtil.objToB3dm(file.getPath(),file.getParentFile().getPath()+"/b3dm");
-                sizeMap.put("size",sizeMap.get("size") + file.length());
-                localGlbPath.add(glbPath);
-            }
-        }
-    }
 
 }