package com.ruoyi.system.file;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import java.io.File;
|
import java.io.InputStream;
|
|
public interface IFileUploadService {
|
|
/**
|
* 上传本地文件到PHP接口
|
*
|
* @param file 要上传的文件
|
* @param targetPath 目标路径(相对于PHP上传目录)
|
* @return 上传结果
|
*/
|
FileUploadResponse uploadLocalFile(File file, String targetPath);
|
|
/**
|
* 上传MultipartFile到PHP接口
|
*
|
* @param multipartFile 要上传的文件
|
* @param targetPath 目标路径(相对于PHP上传目录)
|
* @return 上传结果
|
*/
|
FileUploadResponse uploadMultipartFile(MultipartFile multipartFile, String targetPath);
|
|
/**
|
* 上传字节数组到PHP接口
|
*
|
* @param fileBytes 文件字节数组
|
* @param fileName 文件名
|
* @param targetPath 目标路径(相对于PHP上传目录)
|
* @return 上传结果
|
*/
|
FileUploadResponse uploadBytes(byte[] fileBytes, String fileName, String targetPath);
|
|
/**
|
* 上传输入流到PHP接口
|
*
|
* @param inputStream 文件输入流
|
* @param fileName 文件名
|
* @param targetPath 目标路径(相对于PHP上传目录)
|
* @return 上传结果
|
*/
|
FileUploadResponse uploadInputStream(InputStream inputStream, String fileName, String targetPath);
|
|
/**
|
* 从URL下载文件并上传到PHP接口
|
*
|
* @param fileUrl 文件URL
|
* @param targetPath 目标路径(相对于PHP上传目录)
|
* @return 上传结果
|
*/
|
FileUploadResponse uploadFromUrl(String fileUrl, String targetPath);
|
|
/**
|
* 从微信API下载文件并上传到PHP接口
|
*
|
* @param accessToken 微信访问令牌
|
* @param mediaId 微信媒体ID
|
* @param targetPath 目标路径(相对于PHP上传目录)
|
* @return 上传结果
|
*/
|
FileUploadResponse uploadFromWechat(String accessToken, String mediaId, String targetPath);
|
|
/**
|
* 检查文件是否存在
|
*
|
* @param filePath 文件路径
|
* @return 是否存在
|
*/
|
boolean fileExists(String filePath);
|
|
/**
|
* 删除文件
|
*
|
* @param filePath 文件路径
|
* @return 是否删除成功
|
*/
|
boolean deleteFile(String filePath);
|
|
/**
|
* 获取文件访问URL
|
*
|
* @param filePath 文件路径
|
* @return 访问URL
|
*/
|
String getFileUrl(String filePath);
|
|
/**
|
* 上传本地文件到PHP接口(包含缩略图生成)
|
*
|
* @param file 要上传的文件
|
* @param targetPath 目标路径(相对于PHP上传目录)
|
* @return 上传结果
|
*/
|
FileUploadResponse uploadLocalFileWithThumbnail(File file, String targetPath);
|
|
/**
|
* 上传MultipartFile到PHP接口(包含缩略图生成)
|
*
|
* @param multipartFile 要上传的文件
|
* @param targetPath 目标路径(相对于PHP上传目录)
|
* @return 上传结果
|
*/
|
FileUploadResponse uploadMultipartFileWithThumbnail(MultipartFile multipartFile, String targetPath);
|
}
|