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();
|
|
}
|