dengsixing 2 月之前
父节点
当前提交
39688a0f85

+ 1 - 1
4dkankan-utils-fyun-local/src/main/java/com/fdkankan/fyun/local/LocalFileService.java

@@ -83,7 +83,7 @@ public class LocalFileService extends AbstractFYunFileService {
     @Override
     public void downloadFileByCommand(String bucket, String filePath, String remoteFilePath) {
         try {
-            String optType = FileUtil.isFile(remoteFilePath) ? "file" : "folder";
+            String optType = remoteFilePath.contains(".") ? "file" : "folder";
             String command = String.format(fYunConstants.DOWNLOAD_SH, bucket, remoteFilePath, filePath, FYunTypeEnum.LOCAL.code(), optType);
             log.info("开始下载文件, ossPath:{}, srcPath:{}", remoteFilePath, filePath);
             callshell(command);

+ 5 - 0
4dkankan-utils-fyun-obs/src/main/java/com/fdkankan/fyun/oss/ObsFileService.java

@@ -63,6 +63,11 @@ public class ObsFileService extends AbstractFYunFileService {
     }
 
     @Override
+    public void downloadByCommand(String bucket, String filePath, String remoteFilePath, boolean isDir) {
+
+    }
+
+    @Override
     public String uploadFile(String bucket, String filePath, String remoteFilePath, Map<String, String> headers) {
         try {
             File file = new File(filePath);

+ 13 - 0
4dkankan-utils-fyun-s3/src/main/java/com/fdkankan/fyun/s3/S3FileService.java

@@ -144,6 +144,19 @@ public class S3FileService extends AbstractFYunFileService {
     }
 
     @Override
+    public void downloadByCommand(String bucket, String filePath, String remoteFilePath, boolean isDir) {
+        try {
+            String optType = isDir ? "folder" : "file";
+            String command = String.format(fYunConstants.DOWNLOAD_SH, bucket, remoteFilePath, filePath, FYunTypeEnum.AWS.code(), optType);
+            log.info("开始下载文件, ossPath:{}, srcPath:{}", remoteFilePath, filePath);
+            callshell(command);
+        } catch (Exception e) {
+            log.error("上传文件失败, ossPath:{}, srcPath:{}", remoteFilePath, filePath);
+            e.printStackTrace();
+        }
+    }
+
+    @Override
     public void deleteFile(String bucket, String remoteFilePath){
         if (remoteFilePath.startsWith("/")) {
             remoteFilePath = remoteFilePath.substring(1);