|
@ -1,8 +1,8 @@ |
|
|
/** |
|
|
/** |
|
|
* Copyright (c) 2018 人人开源 All rights reserved. |
|
|
* Copyright (c) 2018 人人开源 All rights reserved. |
|
|
* |
|
|
* <p> |
|
|
* https://www.renren.io
|
|
|
* https://www.renren.io
|
|
|
* |
|
|
* <p> |
|
|
* 版权所有,侵权必究! |
|
|
* 版权所有,侵权必究! |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
@ -13,9 +13,6 @@ import com.elink.esua.epdc.commons.tools.utils.SpringContextUtils; |
|
|
import com.elink.esua.epdc.exception.ModuleErrorCode; |
|
|
import com.elink.esua.epdc.exception.ModuleErrorCode; |
|
|
import com.github.tobato.fastdfs.domain.StorePath; |
|
|
import com.github.tobato.fastdfs.domain.StorePath; |
|
|
import com.github.tobato.fastdfs.service.DefaultGenerateStorageClient; |
|
|
import com.github.tobato.fastdfs.service.DefaultGenerateStorageClient; |
|
|
import com.elink.esua.epdc.commons.tools.exception.RenException; |
|
|
|
|
|
import com.elink.esua.epdc.commons.tools.utils.SpringContextUtils; |
|
|
|
|
|
import com.elink.esua.epdc.exception.ModuleErrorCode; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.ByteArrayInputStream; |
|
|
import java.io.ByteArrayInputStream; |
|
|
import java.io.InputStream; |
|
|
import java.io.InputStream; |
|
@ -32,7 +29,7 @@ public class FastDFSCloudStorageService extends AbstractCloudStorageService { |
|
|
defaultGenerateStorageClient = (DefaultGenerateStorageClient) SpringContextUtils.getBean("defaultGenerateStorageClient"); |
|
|
defaultGenerateStorageClient = (DefaultGenerateStorageClient) SpringContextUtils.getBean("defaultGenerateStorageClient"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public FastDFSCloudStorageService(CloudStorageConfig config){ |
|
|
public FastDFSCloudStorageService(CloudStorageConfig config) { |
|
|
this.config = config; |
|
|
this.config = config; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -45,8 +42,8 @@ public class FastDFSCloudStorageService extends AbstractCloudStorageService { |
|
|
public String upload(InputStream inputStream, String suffix) { |
|
|
public String upload(InputStream inputStream, String suffix) { |
|
|
StorePath storePath; |
|
|
StorePath storePath; |
|
|
try { |
|
|
try { |
|
|
storePath = defaultGenerateStorageClient.uploadFile("group1", inputStream, inputStream.available(), suffix); |
|
|
storePath = defaultGenerateStorageClient.uploadFile("epdc-pic", inputStream, inputStream.available(), suffix); |
|
|
}catch (Exception ex){ |
|
|
} catch (Exception ex) { |
|
|
throw new RenException(ModuleErrorCode.OSS_UPLOAD_FILE_ERROR, ex, ex.getMessage()); |
|
|
throw new RenException(ModuleErrorCode.OSS_UPLOAD_FILE_ERROR, ex, ex.getMessage()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|