版本管理 和 版本文件上传
This commit is contained in:
@@ -43,6 +43,25 @@ public abstract class AbstractCloudStorageService {
|
||||
return path + "." + suffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件路径
|
||||
* @param prefix 前缀
|
||||
* @param fileName 文件名
|
||||
* @param suffix 后缀
|
||||
* @return 返回上传路径
|
||||
*/
|
||||
public String getPath(String prefix,String suffix, String fileName) {
|
||||
//文件路径
|
||||
// String path = DateUtils.getDays() + "/" + fileName;
|
||||
String path = "version/" + fileName;
|
||||
|
||||
if(StringUtils.isNotBlank(prefix)){
|
||||
path = prefix + "/" + path;
|
||||
}
|
||||
|
||||
return path + "." + suffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
* @param data 文件字节数组
|
||||
@@ -58,6 +77,7 @@ public abstract class AbstractCloudStorageService {
|
||||
* @return 返回http地址
|
||||
*/
|
||||
public abstract String uploadSuffix(byte[] data, String suffix) throws Exception;
|
||||
public abstract String uploadFileName(byte[] data, String suffix,String fileName) throws Exception;
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
|
||||
@@ -49,6 +49,11 @@ public class AliyunCloudStorageService extends AbstractCloudStorageService {
|
||||
return upload(data, getPath(config.getPrefix(), suffix));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadFileName(byte[] data, String suffix,String fileName) throws Exception {
|
||||
return upload(data, getPath(config.getPrefix(), suffix,fileName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadSuffix(InputStream inputStream, String suffix) throws Exception {
|
||||
return upload(inputStream, getPath(config.getPrefix(), suffix));
|
||||
|
||||
@@ -35,6 +35,11 @@ public class HuaweiCloudStorageService extends AbstractCloudStorageService {
|
||||
return config.getUrl() + "/" + path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadFileName(byte[] data, String suffix,String fileName) throws Exception {
|
||||
return upload(data, getPath(config.getPrefix(), suffix,fileName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadSuffix(InputStream inputStream, String suffix) throws Exception {
|
||||
return upload(inputStream, getPath(config.getPrefix(), suffix));
|
||||
|
||||
@@ -82,4 +82,9 @@ public class QcloudCloudStorageService extends AbstractCloudStorageService {
|
||||
public String uploadSuffix(InputStream inputStream, String suffix) throws Exception {
|
||||
return upload(inputStream, getPath(config.getPrefix(), suffix));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadFileName(byte[] data, String suffix,String fileName) throws Exception {
|
||||
return upload(data, getPath(config.getPrefix(), suffix,fileName));
|
||||
}
|
||||
}
|
||||
@@ -75,4 +75,9 @@ public class QiniuCloudStorageService extends AbstractCloudStorageService {
|
||||
public String uploadSuffix(InputStream inputStream, String suffix) throws Exception {
|
||||
return upload(inputStream, getPath(config.getPrefix(), suffix));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadFileName(byte[] data, String suffix,String fileName) throws Exception {
|
||||
return upload(data, getPath(config.getPrefix(), suffix,fileName));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user