shikeyin
2024-01-11 65da8373531677b1c37a98f53eaa30c892f35e5a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package com.iplatform.base;
 
import com.walker.file.FileInfo;
import com.walker.file.FileStoreType;
 
import java.io.InputStream;
import java.util.List;
 
/**
 * 文件操作提供者定义,由第三方实现文件管理功能,包括:上传、下载、获取文件信息等。
 * @author 时克英
 * @date 2023-02-15
 */
public interface FileOperateSpi {
 
    /**
     * 清除给定文件地址的CDN前缀。如:https://qnyun.com/oss/12345678
     * <pre>
     *     去掉前缀后,只剩下"12345678"
     * </pre>
     * @param path 给定的文件资源地址
     * @return
     * @date 2023-05-17
     */
    String clearCdnPrefix(String path);
 
    /**
     * 获取上传文件的CDN地址,根据使用的不同第三方服务从配置中查找。
     * @return
     * @date 2023-05-17
     */
    String getCdnUrl();
 
    FileInfo uploadFileToLocal(InputStream inputStream
            , String fileName, String groupId, long fileSize, Integer businessType, String owner) throws Exception;
    FileInfo[] uploadFileToLocal(InputStream[] inputStream
            , String[] fileName, String groupId, long[] fileSize, Integer businessType, String owner) throws Exception;
 
    FileInfo uploadFileToFtp(InputStream inputStream
            , String fileName, String groupId, long fileSize, Integer businessType, String owner) throws Exception;
    FileInfo[] uploadFileToFtp(InputStream[] inputStream
            , String[] fileName, String groupId, long[] fileSize, Integer businessType, String owner) throws Exception;
 
    FileInfo uploadFileToOss(InputStream inputStream
            , String fileName, String groupId, long fileSize, Integer businessType, String owner, FileStoreType ossType) throws Exception;
    FileInfo[] uploadFileToOss(InputStream[] inputStream
            , String[] fileName, String groupId, long[] fileSize, Integer businessType, String owner, FileStoreType ossType) throws Exception;
 
    @Deprecated
    FileInfo uploadFileToSystem(InputStream inputStream, String fileName, String groupId, long fileSize) throws Exception;
 
    @Deprecated
    FileInfo uploadFileToFtp(InputStream inputStream, String fileName, String groupId, long fileSize) throws Exception;
 
    FileInfo getFileInfo(long id);
 
    List<FileInfo> getFileInfoList(List<String> ids);
 
    /**
     * 返回本地文件系统存储根目录,如: d:/tmp/
     * @return
     * @date 2023-02-15
     */
    String getFileRootConfig();
 
    /**
     * 调用远程上传文件,是否按照本地方式处理。
     * <pre>
     *     1)该选项为了适应没有FTP等服务的情况,特别是在开发过程,如果设置为:true 则调用远程上传方法后文件仍然保存在本地。
     *     2)如果生产环境存在合适的文件存储服务,则需要设置为:false
     * </pre>
     * @return
     * @date 2023-07-03
     */
    boolean isRemoteAsLocal();
}