|
@@ -16,17 +16,20 @@ import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* OSS文件管理接口
|
|
|
+ *
|
|
|
* @Author xiexiang
|
|
|
* @Date 2024/4/1
|
|
|
*/
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
@RequiredArgsConstructor
|
|
|
-public class File2OssService implements IFileFactory{
|
|
|
+public class File2OssService implements IFileFactory {
|
|
|
private final FileUtils fileUtils;
|
|
|
+ private final OssService ossService;
|
|
|
|
|
|
/**
|
|
|
* 上传文件
|
|
|
+ *
|
|
|
* @param files
|
|
|
* @param configSettingVO 根据传入的id,选择的配置类,选择的上传路径以及上传方法
|
|
|
* @return
|
|
@@ -54,11 +57,26 @@ public class File2OssService implements IFileFactory{
|
|
|
|
|
|
@Override
|
|
|
public SystemFileDTO replaceFile(String fileGuid, MultipartFile file, ConfigSettingVO configSettingVO) {
|
|
|
+ try {
|
|
|
+ String directoryName = fileUtils.getDirectoryName();
|
|
|
+ SystemFileDTO systemFileDTO = ossService.upload(configSettingVO.getFilePath() + directoryName, file, configSettingVO);
|
|
|
+ //服务器存储目录位置(1.本地project/pas/prod/file 2.本地project/rms/prod/file 3.生产project/pas/prod/file 4.生产project/rms/prod/file)
|
|
|
+ systemFileDTO.setPType(configSettingVO.getId());
|
|
|
+ //FSS
|
|
|
+ systemFileDTO.setSourceId(configSettingVO.getSourceId());
|
|
|
+ systemFileDTO.setOriginalName(file.getOriginalFilename());
|
|
|
+ systemFileDTO.setGUID(fileGuid);
|
|
|
+ systemFileDTO.setFilePath(configSettingVO.getFilePath() + directoryName + "/" + systemFileDTO.getFileName());
|
|
|
+ return systemFileDTO;
|
|
|
+ } catch (Exception e) {
|
|
|
+
|
|
|
+ }
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 下载文件
|
|
|
+ *
|
|
|
* @param downloadSysFileDTO
|
|
|
* @param configSettingVO
|
|
|
* @return
|
|
@@ -75,6 +93,7 @@ public class File2OssService implements IFileFactory{
|
|
|
|
|
|
/**
|
|
|
* 删除文件
|
|
|
+ *
|
|
|
* @param filePath
|
|
|
* @param configSettingVO
|
|
|
*/
|