fastdfs fix upload bug、升级小版本
This commit is contained in:
parent
938fc7d088
commit
407b7e526f
2
pom.xml
2
pom.xml
|
|
@ -25,7 +25,7 @@
|
|||
<spring-boot.mybatis>2.1.4</spring-boot.mybatis>
|
||||
<swagger.fox.version>3.0.0</swagger.fox.version>
|
||||
<swagger.core.version>1.6.2</swagger.core.version>
|
||||
<tobato.version>1.26.5</tobato.version>
|
||||
<tobato.version>1.26.7</tobato.version>
|
||||
<kaptcha.version>2.3.2</kaptcha.version>
|
||||
<pagehelper.boot.version>1.3.1</pagehelper.boot.version>
|
||||
<druid.version>1.2.6</druid.version>
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ import org.springframework.context.annotation.Configuration;
|
|||
* @author dazer
|
||||
* @see FastDfsServiceImpl
|
||||
* FastDFS配置 其他参数见:{@link PooledConnectionFactory}
|
||||
*
|
||||
* 使用: Docker部署FastDFS(附示例代码) https://www.cnblogs.com/cao-lei/p/13470695.html
|
||||
*/
|
||||
@RefreshScope
|
||||
@Configuration
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.file.service;
|
||||
|
||||
import com.github.tobato.fastdfs.domain.fdfs.MetaData;
|
||||
import com.github.tobato.fastdfs.exception.FdfsUnsupportStorePathException;
|
||||
import com.ruoyi.common.core.exception.CustomException;
|
||||
import com.ruoyi.file.config.FastDfsConfig;
|
||||
|
|
@ -8,11 +9,15 @@ 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;
|
||||
import com.github.tobato.fastdfs.domain.fdfs.StorePath;
|
||||
import com.github.tobato.fastdfs.service.FastFileStorageClient;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* FastDFS 文件存储
|
||||
* @author ruoyi
|
||||
|
|
@ -38,7 +43,7 @@ public class FastDfsServiceImpl implements IDfsService
|
|||
@Override
|
||||
public String uploadFile(MultipartFile file) throws Exception
|
||||
{
|
||||
return this.uploadFile(file);
|
||||
return this.uploadFile(file, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -46,8 +51,11 @@ public class FastDfsServiceImpl implements IDfsService
|
|||
// fastdsf 这里的 modules 没用
|
||||
validateModule(file, modules);
|
||||
|
||||
Set<MetaData> metaDataSet = new HashSet<>(1);
|
||||
metaDataSet.add(new MetaData("groupName", "group1"));
|
||||
|
||||
StorePath storePath = storageClient.uploadFile(file.getInputStream(), file.getSize(),
|
||||
FilenameUtils.getExtension(file.getOriginalFilename()), null);
|
||||
FilenameUtils.getExtension(file.getOriginalFilename()), metaDataSet);
|
||||
|
||||
/// fileUrl = "http://127.0.0.1:22122/" + storePath.getFullPath();
|
||||
return fastDfsConfig.getDomain() + "/" + storePath.getFullPath();
|
||||
|
|
|
|||
|
|
@ -17,11 +17,9 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
namespace: 72b686a1-d9f6-499f-8275-e481b664779e
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 127.0.0.1:8848
|
||||
namespace: 72b686a1-d9f6-499f-8275-e481b664779e
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
@ -37,7 +35,7 @@ file:
|
|||
|
||||
# 文件服务器之2 ftp
|
||||
ftp:
|
||||
host-name: 118.31.2.53
|
||||
endpoint: 118.31.2.53
|
||||
port: 21
|
||||
user-name: lanjinjun
|
||||
password:
|
||||
|
|
@ -57,14 +55,16 @@ minio:
|
|||
secretKey: QyVqGnhIQQE734UYSUFlGOZViE6+ZlDEfUG3NjhJ
|
||||
bucketName: appt-file
|
||||
domain: https://yq666.bj.gov.cn
|
||||
expiry-duration: 32400
|
||||
|
||||
# 文件服务器之5 aliyun oss
|
||||
aliyun-oss:
|
||||
access-key-id: LTAI4GDQSbwgmbsRxxbDXnKT
|
||||
access-key-secret: I1xYosCsIf4YgHeFbWUOU4faImeWD2
|
||||
access-key: LTAI4GDQSbwgmbsRxxbDXnKT
|
||||
secret-key: I1xYosCsIf4YgHeFbWUOU4faImeWD2
|
||||
bucket-name: react-yuebaoxiao-pro
|
||||
endpoint: oss-cn-shanghai.aliyuncs.com
|
||||
domain: https://react-yuebaoxiao-pro.oss-cn-shanghai.aliyuncs.com
|
||||
expiry-duration: 32400
|
||||
|
||||
# 文件服务器之6 qiniu 七牛 kodo
|
||||
qiniu:
|
||||
|
|
@ -72,3 +72,4 @@ qiniu:
|
|||
secret-key: CwTEh1kSLBdxBhIWfFz6h1GgDSokx97CYEV0cC1O
|
||||
bucket-name: guangdong-oss
|
||||
domain: http://guangdong-oss.ityun.ltd
|
||||
expiry-duration: 32400
|
||||
|
|
|
|||
Loading…
Reference in New Issue