mitao
2025-01-20 93fec20f3cf9d7801eeaa10acef4687ed110d435
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
package com.zzg.system.service.system;
 
import cn.hutool.core.lang.Dict;
import com.zzg.system.domain.AttachFile;
import lombok.NonNull;
import org.springframework.web.multipart.MultipartFile;
 
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
 
public interface IFileService {
 
    /**
     * 保存文件方法
     *
     * @param inputStream 输入流
     * @param file        文件
     */
    void saveFile(@NonNull InputStream inputStream, @NonNull File file);
 
    /**
     * @param inputStream 输入流
     * @param filename    文件名
     * @see #saveFile(InputStream, File)
     */
    void saveFile(@NonNull InputStream inputStream, @NonNull String filename);
 
    /**
     * 上传至临时目录(单文件)
     *
     * @param multipartFile
     * @return
     */
    String upload2Temp(MultipartFile multipartFile, HttpServletRequest req);
 
    /**
     * 上传至临时目录(单个或多个文件)
     *
     * @param multipartFiles
     * @return
     */
    List<Dict> upload2Temp(List<MultipartFile> multipartFiles, HttpServletRequest req);
 
 
    /**
     * 文件移动
     *
     * @param sourcePath
     * @param destPath
     * @return java.lang.String
     * @author gf
     * @date 9:45 2024/3/12
     **/
    void moveFile(String sourcePath, String destPath);
 
    /**
     * @param * @param filePath
     * @return void
     * @author gf
     * @date 10:03 2024/3/12
     **/
    void deleteFile(String filePath);
 
    /**
     * 文件下载:单文件直接输出
     * 多文件打包下载
     *
     * @param fileNames
     * @throws IOException
     */
//    void downloadFile(List<String> fileNames) throws IOException;
 
    /**
     * 单个文件下载
     *
     * @param filePath 文件绝对路
     */
//    void download(String filePath, HttpServletResponse response) throws IOException;
 
    /**
     * 将指定文件从临时目录复制到持久目录
     *
     * @param fileNames
     * @param destDir
     * @throws IOException
     */
    void synFiles(List<String> fileNames, String destDir) throws IOException;
 
 
    /**
     * 将选择的文件同步到upload路径下
     *
     * @param fileNames 文件
     * @throws IOException
     */
    void synFiles2Upload(List<String> fileNames) throws IOException;
 
    /**
     * 将选择的文件同步到upload路径下(去除日期)
     *
     * @param fileNames 文件
     * @throws IOException
     */
    List<File> synFiles2UploadMoveDate(List<String> fileNames) throws IOException;
 
    void synFiles2Upload(Map<String, String> fileNames) throws IOException;
 
    /**
     * 每天晚上12:00删除临时目录里面的过期文件,保存最近七天的文件
     */
//    void refreshTemp();
 
//    String upload2Word(List<MultipartFile> asList, HttpServletRequest req);
 
    /**
     * 上传模板文件
     *
     * @param projectId
     * @param noticeType
     * @param multipartFile
     */
    Integer uploadTemplateFile(String projectId, Integer noticeType, MultipartFile multipartFile);
 
    /**
     * 上传附件到upload目录
     *
     */
    void upload2uploadPath(List<AttachFile> familyAttachFiles);
 
    List<String> uploadFile2uploadPath(List<MultipartFile> fileList);
 
//    List<String> uploadFile(List<MultipartFile> fileList);
 
    /**
     * 获取模板文件的真实路径
     *
     * @return 模板文件真实路径
     */
    String getTemplateFilePath();
 
    /**
     * 获取临时文件的真实路径
     *
     * @return 模板文件真实路径
     */
//    public String getTempFilePath();
 
    /**
     * 获取下载文件的真实路径
     *
     * @return 下载文件真实路径
     */
//    public String getUploadFilePath();
 
}