Browse Source

v3场景copy删除软连接

lyhzzz 2 years ago
parent
commit
212d275977

+ 17 - 0
src/main/java/com/fdkankan/ucenter/service/impl/SceneCommonService.java

@@ -220,4 +220,21 @@ public class SceneCommonService {
         }
 
     }
+
+    public void delLink(String path) {
+        String panPath = path +"/panorama";
+        File file = new File(panPath);
+        if(file.exists()){
+            File[] files = file.listFiles();
+            if(files == null || files.length == 0){
+                return;
+            }
+            for (File file1 : files) {
+                String linkPath =file1.getPath() + "/capture";
+                if(new File(linkPath).exists()){
+                    org.apache.commons.io.FileUtils.deleteQuietly(new File(linkPath));
+                }
+            }
+        }
+    }
 }

+ 1 - 0
src/main/java/com/fdkankan/ucenter/service/impl/ScenePlusServiceImpl.java

@@ -304,6 +304,7 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
         String oldPath = SceneResourcePath.nasBasePath + oldNum;
         String newPath = SceneResourcePath.nasBasePath + newNum;
         if(new File(oldPath).exists()){
+            sceneCommonService.delLink(oldPath);
             FileUtil.copyContent(new File(oldPath), new File(newPath),true);
         }
         String oldPath_v4 = SceneResourcePath.nasBasePath_v4 + oldNum;

+ 1 - 0
src/main/java/com/fdkankan/ucenter/service/impl/SceneProServiceImpl.java

@@ -844,6 +844,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         fYunFileServiceInterface.copyFileInBucket(sourcePath,targetPath);
         File fileData = new File(SceneResourcePath.nasBasePath + sourcePath);
         if(fileData.exists()){
+            sceneCommonService.delLink(fileData.getPath());
             cn.hutool.core.io.FileUtil.copyContent(fileData,new File(SceneResourcePath.nasBasePath + targetPath),true);
         }
     }