|
|
@@ -4,8 +4,6 @@ import com.github.tobato.fastdfs.domain.StorePath;
|
|
|
import com.github.tobato.fastdfs.service.FastFileStorageClient;
|
|
|
import com.usoftchina.smartschool.file.storage.FileMetadata;
|
|
|
import com.usoftchina.smartschool.file.storage.FileStorageClient;
|
|
|
-import com.usoftchina.smartschool.file.storage.util.FileType;
|
|
|
-import com.usoftchina.smartschool.file.storage.util.FileTypeUtils;
|
|
|
import org.apache.commons.io.IOUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
@@ -24,16 +22,8 @@ public class FdfsFileStorageClient implements FileStorageClient{
|
|
|
|
|
|
@Override
|
|
|
public String uploadFile(InputStream inputStream, FileMetadata metadata) {
|
|
|
- FileType type = FileTypeUtils.getFileType(metadata.getMime(), metadata.getExt());
|
|
|
- StorePath storePath;
|
|
|
- if (FileType.IMAGE == type) {
|
|
|
- // 保存图片 + 生成缩略图
|
|
|
- storePath = storageClient.uploadImageAndCrtThumbImage(inputStream, metadata.getSize(),
|
|
|
- metadata.getExt(), null);
|
|
|
- } else {
|
|
|
- storePath = storageClient.uploadFile(inputStream, metadata.getSize(),
|
|
|
- metadata.getExt(), null);
|
|
|
- }
|
|
|
+ StorePath storePath = storageClient.uploadFile(inputStream, metadata.getSize(),
|
|
|
+ metadata.getExt(), null);
|
|
|
return storePath.getFullPath();
|
|
|
}
|
|
|
|