Kaynağa Gözat

删除源文件

lyhzzz 2 yıl önce
ebeveyn
işleme
7ee81ec4c3

+ 11 - 5
src/main/java/com/fdkankan/fusion/service/impl/ModelServiceImpl.java

@@ -125,6 +125,8 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
                 File newObjFile = null;
                 File objPathFile = null;
                 File mntFile = null;
+                File b3dmFile = null;
+                File osgbFile = null;
                 try {
                     String fileName = UUID.randomUUID().toString().replace("-","") +".zip";
                     String objPath = String.format(FilePath.OBJ_LOCAL_PATH,environment , "modelId_"+model.getModelId()) ;
@@ -206,18 +208,16 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
 
                         redisUtil.set(RedisKeyUtil.modelUpload+model.getModelId(),"60");
                         String localPath = OBJToGLBUtil.OsgbToB3dm(objPathFile);
-
+                        osgbFile = new File(localPath.replace("b3dm","osgb"));
+                        b3dmFile = new File(localPath);
                         String jsonPath = null;
-                        jsonPath =  FileWriterUtil.checkB3dmTileset(new File(localPath));
+                        jsonPath =  FileWriterUtil.checkB3dmTileset(b3dmFile);
                         if(jsonPath == null){
                             throw new BusinessException(-1,"缺少tileset.json文件");
-
                         }
-
                         redisUtil.set(RedisKeyUtil.modelUpload+model.getModelId(),"80");
                         ShellUtil.yunUpload(localPath,b3dmPath);
                         model.setModelGlbUrl((JSONArray.toJSONString(Arrays.asList(queryPath +  jsonPath.replace(FilePath.LOCAL_BASE_PATH,"fusion/")))));
-                        FileUtil.del(localPath);
                     }
                     if(name.contains(".b3dm") && b3dmJsonPath != null){
                         model.setModelDateType("b3dm");
@@ -243,6 +243,12 @@ public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implement
                     if(mntFile!=null){
                        FileUtil.del(mntFile.getParentFile());
                     }
+                    if(b3dmFile != null){
+                        FileUtil.del(b3dmFile);
+                    }
+                    if(osgbFile != null){
+                        FileUtil.del(osgbFile);
+                    }
                 }
             }, executor).whenComplete((reslut, e) -> {
                 log.info("uploadObj--ThreadEnd-modeId:{}",model.getModelId());