重构代码 rename 和 若依 原始 类名称相同

pull/84/head
duandazhi 4 years ago
parent 7a5df92dfb
commit 553415d9cd

@ -14,7 +14,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
* @author ruoyi
*/
@EnableConfigurationProperties(value = {
LocalFileConfig.class,
ResourcesConfig.class,
FtpConfig.class,
FastDfsConfig.class,
AliyunOssConfig.class,

@ -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.FastSysFileServiceImpl;
import com.ruoyi.file.service.FastDfsSysFileServiceImpl;
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 FastSysFileServiceImpl
* @see FastDfsSysFileServiceImpl
* FastDFS {@link PooledConnectionFactory}
*
* 使: DockerFastDFS https://www.cnblogs.com/cao-lei/p/13470695.html

@ -2,7 +2,7 @@ package com.ruoyi.file.config;
import java.io.File;
import com.ruoyi.file.service.LocalFileServiceImpl;
import com.ruoyi.file.service.LocalSysFileServiceImpl;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;
@ -12,15 +12,16 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
*
*
* local file config = ResourcesConfig
*
* @see LocalFileServiceImpl
* @see LocalSysFileServiceImpl
*
* @author ruoyi
*/
@RefreshScope
@Configuration
@ConfigurationProperties(prefix = LocalFileConfig.PREFIX)
public class LocalFileConfig implements WebMvcConfigurer
@ConfigurationProperties(prefix = ResourcesConfig.PREFIX)
public class ResourcesConfig implements WebMvcConfigurer
{
public static final String PREFIX = "file";
/**

@ -22,9 +22,9 @@ import com.github.tobato.fastdfs.service.FastFileStorageClient;
*/
//@Primary
@Service()
public class FastSysFileServiceImpl implements ISysFileService
public class FastDfsSysFileServiceImpl implements ISysFileService
{
private final Logger logger = LoggerFactory.getLogger(FastSysFileServiceImpl.class);
private final Logger logger = LoggerFactory.getLogger(FastDfsSysFileServiceImpl.class);
@Autowired
private FastFileStorageClient storageClient;

@ -2,7 +2,7 @@ package com.ruoyi.file.service;
import cn.hutool.core.io.FileUtil;
import com.ruoyi.common.core.exception.CustomException;
import com.ruoyi.file.config.LocalFileConfig;
import com.ruoyi.file.config.ResourcesConfig;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
@ -16,12 +16,12 @@ import java.io.File;
* @author ruoyi
*/
@Service()
public class LocalFileServiceImpl implements ISysFileService
public class LocalSysFileServiceImpl implements ISysFileService
{
private final LocalFileConfig localFileConfig;
private final ResourcesConfig resourcesConfig;
public LocalFileServiceImpl(LocalFileConfig localFileConfig) {
this.localFileConfig = localFileConfig;
public LocalSysFileServiceImpl(ResourcesConfig resourcesConfig) {
this.resourcesConfig = resourcesConfig;
}
/**
@ -39,9 +39,9 @@ public class LocalFileServiceImpl implements ISysFileService
@Override
public String uploadFile(MultipartFile file, String modules) throws Exception {
String localFilePath = localFileConfig.getPath();
String domain = localFileConfig.getDomain();
String localFilePrefix = localFileConfig.getPrefix();
String localFilePath = resourcesConfig.getPath();
String domain = resourcesConfig.getDomain();
String localFilePrefix = resourcesConfig.getPrefix();
if (StringUtils.isBlank(localFilePath) ||
StringUtils.isBlank(localFilePath) ||
StringUtils.isBlank(localFilePath) ) {
@ -58,7 +58,7 @@ public class LocalFileServiceImpl implements ISysFileService
throw new CustomException("fileUrl不能为空");
}
String key = this.getStorePath(fileUrl);
String localFilePath = localFileConfig.getPath();
String localFilePath = resourcesConfig.getPath();
String filePath = localFilePath + "/" + key;
File file = new File(filePath);
@ -74,7 +74,7 @@ public class LocalFileServiceImpl implements ISysFileService
@Override
public String objectsCapacityStr() {
String localFilePath = localFileConfig.getPath();
String localFilePath = resourcesConfig.getPath();
File file = new File(localFilePath);
long total = file.getTotalSpace();
long free = file.getFreeSpace();
@ -96,14 +96,14 @@ public class LocalFileServiceImpl implements ISysFileService
*/
private String getStorePath(String filePath) {
// 使用方式1
String domain = localFileConfig.getDomain();
String localFilePrefix = localFileConfig.getPrefix();
String domain = resourcesConfig.getDomain();
String localFilePrefix = resourcesConfig.getPrefix();
String publicPath1 = domain + localFilePrefix;
String key = filePath.replace(publicPath1, "");
if (key.equals(filePath)) {
// 使用方式2
String group = localFileConfig.getPrefix();
String group = resourcesConfig.getPrefix();
// 获取group起始位置
int pathStartPos = filePath.indexOf(group) + group.length() + 1;
key = filePath.substring(pathStartPos, filePath.length());
Loading…
Cancel
Save