|
@@ -82,6 +82,7 @@ public class FileStorageUtil {
|
|
* @return 返回包含协议名的地址,数据库直接存储用 如:upyun-1://student_photo/001.jpg
|
|
* @return 返回包含协议名的地址,数据库直接存储用 如:upyun-1://student_photo/001.jpg
|
|
*/
|
|
*/
|
|
private static YunPathInfo saveFile(String siteId, FileStoragePathEnvInfo env, InputStream in, FileStorageType fsType,String md5) {
|
|
private static YunPathInfo saveFile(String siteId, FileStoragePathEnvInfo env, InputStream in, FileStorageType fsType,String md5) {
|
|
|
|
+
|
|
if (siteId == null) {
|
|
if (siteId == null) {
|
|
throw new StatusException("1000", "siteId是空");
|
|
throw new StatusException("1000", "siteId是空");
|
|
}
|
|
}
|
|
@@ -91,6 +92,7 @@ public class FileStorageUtil {
|
|
if (env == null) {
|
|
if (env == null) {
|
|
throw new StatusException("1002", "文件上传路径信息是空");
|
|
throw new StatusException("1002", "文件上传路径信息是空");
|
|
}
|
|
}
|
|
|
|
+ env.setTimeMillis(String.valueOf(System.currentTimeMillis()));
|
|
FileStorage fs = SpringContextHolder.getBean(fsType.name().toLowerCase() + beanSuff, FileStorage.class);
|
|
FileStorage fs = SpringContextHolder.getBean(fsType.name().toLowerCase() + beanSuff, FileStorage.class);
|
|
return fs.saveFile(siteId, env, in,md5);
|
|
return fs.saveFile(siteId, env, in,md5);
|
|
}
|
|
}
|
|
@@ -114,6 +116,7 @@ public class FileStorageUtil {
|
|
if (env == null) {
|
|
if (env == null) {
|
|
throw new StatusException("2002", "文件上传路径信息是空");
|
|
throw new StatusException("2002", "文件上传路径信息是空");
|
|
}
|
|
}
|
|
|
|
+ env.setTimeMillis(String.valueOf(System.currentTimeMillis()));
|
|
FileStorage fs = SpringContextHolder.getBean(fsType.name().toLowerCase() + beanSuff, FileStorage.class);
|
|
FileStorage fs = SpringContextHolder.getBean(fsType.name().toLowerCase() + beanSuff, FileStorage.class);
|
|
return fs.saveFile(siteId, env, file,md5);
|
|
return fs.saveFile(siteId, env, file,md5);
|
|
}
|
|
}
|
|
@@ -294,6 +297,7 @@ public class FileStorageUtil {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public static YunHttpRequest getSignature(FileStorageType fsType,String siteId, FileStoragePathEnvInfo env, String md5) {
|
|
public static YunHttpRequest getSignature(FileStorageType fsType,String siteId, FileStoragePathEnvInfo env, String md5) {
|
|
|
|
+ env.setTimeMillis(String.valueOf(System.currentTimeMillis()));
|
|
// 获取对应的处理类
|
|
// 获取对应的处理类
|
|
FileStorage fs = SpringContextHolder.getBean(fsType.name().toLowerCase() + beanSuff, FileStorage.class);
|
|
FileStorage fs = SpringContextHolder.getBean(fsType.name().toLowerCase() + beanSuff, FileStorage.class);
|
|
return fs.getSignature(siteId, env, md5);
|
|
return fs.getSignature(siteId, env, md5);
|