|
@@ -1,5 +1,6 @@
|
|
|
package com.gis.oss.util;
|
|
|
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.extra.spring.SpringUtil;
|
|
|
import com.fdkankan.filestorage.FileStorageTemplate;
|
|
|
import com.gis.common.util.StreamGobblerLine;
|
|
@@ -49,19 +50,19 @@ public class OssShUtil {
|
|
|
* //@param fyunType oss or aws
|
|
|
*/
|
|
|
public static void yunUpload(String srcPath,String destPath){
|
|
|
- String opType = srcPath.contains(".")? "file":"folder" ;
|
|
|
+ String opType = FileUtil.isFile(srcPath) ? "file":"folder" ;
|
|
|
FileStorageTemplate bean = SpringUtil.getBean(FileStorageTemplate.class);
|
|
|
String cmd = String.format(CmdConstant.FYUN_UPLOAD, bean.getBucket(),srcPath,destPath,bean.getActive(),opType);
|
|
|
callLineSh(cmd);
|
|
|
}
|
|
|
public static void yunUpload(String srcPath,String destPath,String bucket,String active){
|
|
|
- String opType = srcPath.contains(".")? "file":"folder" ;
|
|
|
+ String opType = FileUtil.isFile(srcPath) ? "file":"folder" ;
|
|
|
FileStorageTemplate bean = SpringUtil.getBean(FileStorageTemplate.class);
|
|
|
String cmd = String.format(CmdConstant.FYUN_UPLOAD,bucket,srcPath,destPath,active,opType);
|
|
|
callLineSh(cmd);
|
|
|
}
|
|
|
public static void yunDownload(String srcPath,String destPath){
|
|
|
- String opType = srcPath.contains(".")? "file":"folder" ;
|
|
|
+ String opType = FileUtil.isFile(srcPath) ? "file":"folder" ;
|
|
|
FileStorageTemplate bean = SpringUtil.getBean(FileStorageTemplate.class);
|
|
|
if("/".equals(srcPath.substring(0,1))){
|
|
|
srcPath = srcPath.substring(1);
|
|
@@ -70,7 +71,7 @@ public class OssShUtil {
|
|
|
callLineSh(cmd);
|
|
|
}
|
|
|
public static void yunDownloadOther(String srcPath,String destPath,String bucket,String active){
|
|
|
- String opType = srcPath.contains(".")? "file":"folder" ;
|
|
|
+ String opType = FileUtil.isFile(srcPath) ? "file":"folder" ;
|
|
|
FileStorageTemplate bean = SpringUtil.getBean(FileStorageTemplate.class);
|
|
|
if("/".equals(srcPath.substring(0,1))){
|
|
|
srcPath = srcPath.substring(1);
|
|
@@ -79,7 +80,7 @@ public class OssShUtil {
|
|
|
callLineSh(cmd);
|
|
|
}
|
|
|
public static void yunDownload(String bucket,String srcPath,String destPath){
|
|
|
- String opType = srcPath.contains(".")? "file":"folder" ;
|
|
|
+ String opType = FileUtil.isFile(srcPath) ? "file":"folder" ;
|
|
|
if("/".equals(srcPath.substring(0,1))){
|
|
|
srcPath = srcPath.substring(1);
|
|
|
}
|