重命名 文件服务的 接口名称
This commit is contained in:
parent
60a71a3146
commit
7a5df92dfb
|
|
@ -1,12 +1,12 @@
|
|||
package com.ruoyi.file.config;
|
||||
|
||||
import com.ruoyi.file.service.CephDfsServiceImpl;
|
||||
import com.ruoyi.file.service.CephSysFileServiceImpl;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @see CephDfsServiceImpl
|
||||
* @see CephSysFileServiceImpl
|
||||
* @author dazer
|
||||
*/
|
||||
@RefreshScope
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package com.ruoyi.file.config;
|
|||
|
||||
import com.github.tobato.fastdfs.FdfsClientConstants;
|
||||
import com.github.tobato.fastdfs.domain.conn.PooledConnectionFactory;
|
||||
import com.ruoyi.file.service.FastDfsServiceImpl;
|
||||
import com.ruoyi.file.service.FastSysFileServiceImpl;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
|
@ -10,7 +10,7 @@ import org.springframework.context.annotation.Configuration;
|
|||
/**
|
||||
* 阿里 fastdfs 配置
|
||||
* @author dazer
|
||||
* @see FastDfsServiceImpl
|
||||
* @see FastSysFileServiceImpl
|
||||
* FastDFS配置 其他参数见:{@link PooledConnectionFactory}
|
||||
*
|
||||
* 使用: Docker部署FastDFS(附示例代码) https://www.cnblogs.com/cao-lei/p/13470695.html
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package com.ruoyi.file.config;
|
||||
|
||||
import com.ruoyi.file.service.MinioDfsServiceImpl;
|
||||
import com.ruoyi.file.service.MinioSysFileServiceImpl;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
|
@ -13,7 +13,7 @@ import org.springframework.stereotype.Component;
|
|||
* Minio 配置信息
|
||||
*
|
||||
* @author ruoyi
|
||||
* @see MinioDfsServiceImpl 实现
|
||||
* @see MinioSysFileServiceImpl 实现
|
||||
*/
|
||||
@RefreshScope
|
||||
@Component
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package com.ruoyi.file.config;
|
|||
|
||||
import com.qiniu.storage.Region;
|
||||
import com.qiniu.storage.UploadManager;
|
||||
import com.ruoyi.file.service.QiniuDfsServiceImpl;
|
||||
import com.ruoyi.file.service.QiniuSysFileServiceImpl;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
|
@ -14,7 +14,7 @@ import org.springframework.context.annotation.Configuration;
|
|||
* @see UploadManager 上传核心类
|
||||
* @see Region 区域 or endpoint 【可选】
|
||||
* @see com.qiniu.storage.Configuration 配置类,可以配置 上传区域; 【可选】
|
||||
* @see QiniuDfsServiceImpl 实现
|
||||
* @see QiniuSysFileServiceImpl 实现
|
||||
*/
|
||||
@RefreshScope
|
||||
@Configuration
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
package com.ruoyi.file.controller;
|
||||
|
||||
import com.ruoyi.file.service.IDfsService;
|
||||
import com.ruoyi.file.service.ISysFileService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
|
@ -27,7 +26,7 @@ public class SysFileController {
|
|||
private static final Logger log = LoggerFactory.getLogger(SysFileController.class);
|
||||
|
||||
@Autowired
|
||||
private IDfsService dfsService;
|
||||
private ISysFileService dfsService;
|
||||
|
||||
/**
|
||||
* 文件上传请求
|
||||
|
|
@ -90,4 +89,4 @@ public class SysFileController {
|
|||
@ApiParam("需要访问的url,字段名:fileUrl,必填;不要带有?后面的参数") @RequestParam(value = "fileUrl") String fileUrl) {
|
||||
return R.ok(dfsService.presignedUrl(fileUrl), "获取成功");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ import java.util.concurrent.TimeUnit;
|
|||
*/
|
||||
@Primary
|
||||
@Service()
|
||||
public class AliyunOssDsfServiceImpl implements IDfsService {
|
||||
public class AliyunOssDsfServiceImpl implements ISysFileService {
|
||||
private static final Logger log = LoggerFactory.getLogger(AliyunOssDsfServiceImpl.class);
|
||||
@Autowired
|
||||
private AliyunOssConfig aliyunOssConfig;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import java.math.BigDecimal;
|
|||
import java.net.URL;
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* @author dazer
|
||||
|
|
@ -41,8 +40,8 @@ import java.util.function.Consumer;
|
|||
* 3:使用docker 搭建 ceph 开发环境,使用aws sdk 存储数据 https://blog.csdn.net/freewebsys/article/details/79553386
|
||||
*/
|
||||
@Service()
|
||||
public class CephDfsServiceImpl implements IDfsService {
|
||||
private static final Logger log = LoggerFactory.getLogger(CephDfsServiceImpl.class);
|
||||
public class CephSysFileServiceImpl implements ISysFileService {
|
||||
private static final Logger log = LoggerFactory.getLogger(CephSysFileServiceImpl.class);
|
||||
@Autowired
|
||||
private CephConfig cephConfig;
|
||||
|
||||
|
|
@ -9,7 +9,6 @@ import org.csource.fastdfs.ProtoCommon;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.github.tobato.fastdfs.domain.fdfs.StorePath;
|
||||
|
|
@ -23,9 +22,9 @@ import com.github.tobato.fastdfs.service.FastFileStorageClient;
|
|||
*/
|
||||
//@Primary
|
||||
@Service()
|
||||
public class FastDfsServiceImpl implements IDfsService
|
||||
public class FastSysFileServiceImpl implements ISysFileService
|
||||
{
|
||||
private final Logger logger = LoggerFactory.getLogger(FastDfsServiceImpl.class);
|
||||
private final Logger logger = LoggerFactory.getLogger(FastSysFileServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private FastFileStorageClient storageClient;
|
||||
|
|
@ -34,7 +33,7 @@ public class FastDfsServiceImpl implements IDfsService
|
|||
|
||||
/**
|
||||
* FastDfs文件上传接口
|
||||
*
|
||||
*
|
||||
* @param file 上传的文件
|
||||
* @return 访问地址
|
||||
* @throws Exception
|
||||
|
|
@ -17,7 +17,7 @@ import java.io.IOException;
|
|||
* @author dazer
|
||||
*/
|
||||
@Service()
|
||||
public class FtpFileServiceImpl implements IDfsService {
|
||||
public class FtpFileServiceImpl implements ISysFileService {
|
||||
@Autowired
|
||||
private FtpConfig ftpConfig;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import static com.ruoyi.file.utils.FileUploadUtils.*;
|
|||
* 6: CEPH 分布式大数据文件存储系统 http://docs.ceph.org.cn/
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface IDfsService
|
||||
public interface ISysFileService
|
||||
{
|
||||
/**
|
||||
* 允许上传文件存放的目录
|
||||
|
|
@ -41,7 +41,7 @@ public interface IDfsService
|
|||
|
||||
/**
|
||||
* 文件上传接口
|
||||
*
|
||||
*
|
||||
* @param file 上传的文件
|
||||
* @return 访问地址
|
||||
* @throws Exception
|
||||
|
|
@ -4,7 +4,6 @@ import cn.hutool.core.io.FileUtil;
|
|||
import com.ruoyi.common.core.exception.CustomException;
|
||||
import com.ruoyi.file.config.LocalFileConfig;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.ruoyi.file.utils.FileUploadUtils;
|
||||
|
|
@ -13,11 +12,11 @@ import java.io.File;
|
|||
|
||||
/**
|
||||
* 本地文件存储
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service()
|
||||
public class LocalFileServiceImpl implements IDfsService
|
||||
public class LocalFileServiceImpl implements ISysFileService
|
||||
{
|
||||
private final LocalFileConfig localFileConfig;
|
||||
|
||||
|
|
@ -27,7 +26,7 @@ public class LocalFileServiceImpl implements IDfsService
|
|||
|
||||
/**
|
||||
* 本地文件上传接口
|
||||
*
|
||||
*
|
||||
* @param file 上传的文件
|
||||
* @return 访问地址
|
||||
* @throws Exception
|
||||
|
|
|
|||
|
|
@ -7,9 +7,6 @@ import io.minio.http.Method;
|
|||
import io.minio.messages.Item;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.ruoyi.file.config.MinioConfig;
|
||||
|
|
@ -24,7 +21,7 @@ import java.util.function.Consumer;
|
|||
|
||||
/**
|
||||
* Minio 文件存储
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* 官网博客: http://docs.minio.org.cn/docs/master/java-client-quickstart-guidec
|
||||
* 在springboot中使用Minio8 https://springboot.io/t/topic/3109
|
||||
|
|
@ -38,7 +35,7 @@ import java.util.function.Consumer;
|
|||
*/
|
||||
//@Primary
|
||||
@Service()
|
||||
public class MinioDfsServiceImpl implements IDfsService
|
||||
public class MinioSysFileServiceImpl implements ISysFileService
|
||||
{
|
||||
@Autowired
|
||||
private MinioConfig minioConfig;
|
||||
|
|
@ -47,7 +44,7 @@ public class MinioDfsServiceImpl implements IDfsService
|
|||
|
||||
/**
|
||||
* 本地文件上传接口
|
||||
*
|
||||
*
|
||||
* @param file 上传的文件
|
||||
* @return 访问地址
|
||||
* @throws Exception
|
||||
|
|
@ -16,7 +16,6 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
|
@ -34,8 +33,8 @@ import java.io.InputStream;
|
|||
*/
|
||||
//@Primary
|
||||
@Service()
|
||||
public class QiniuDfsServiceImpl implements IDfsService {
|
||||
private static final Logger log = LoggerFactory.getLogger(QiniuDfsServiceImpl.class);
|
||||
public class QiniuSysFileServiceImpl implements ISysFileService {
|
||||
private static final Logger log = LoggerFactory.getLogger(QiniuSysFileServiceImpl.class);
|
||||
@Autowired
|
||||
private QiniuKodoConfig qiniuKodoConfig;
|
||||
|
||||
|
|
@ -9,7 +9,6 @@ import com.qcloud.cos.model.*;
|
|||
import com.ruoyi.common.core.exception.CustomException;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.file.config.TencentCosConfig;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
|
@ -25,7 +24,7 @@ import java.util.List;
|
|||
*/
|
||||
//@Primary
|
||||
@Service()
|
||||
public class TencentCosServiceImpl implements IDfsService {
|
||||
public class TencentCosServiceImpl implements ISysFileService {
|
||||
private final COSClient cosClient;
|
||||
private final TencentCosConfig config;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue