package com.ard.system.api;
|
|
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.http.MediaType;
|
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.multipart.MultipartFile;
|
import com.ard.common.core.constant.ServiceNameConstants;
|
import com.ard.common.core.domain.R;
|
import com.ard.system.api.domain.SysFile;
|
import com.ard.system.api.factory.RemoteFileFallbackFactory;
|
|
/**
|
* 文件服务
|
*
|
* @author ard
|
*/
|
@FeignClient(contextId = "remoteFileService", value = ServiceNameConstants.FILE_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class)
|
public interface RemoteFileService
|
{
|
/**
|
* 上传文件
|
*
|
* @param file 文件信息
|
* @return 结果
|
*/
|
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
public R<SysFile> upload(@RequestPart(value = "file") MultipartFile file);
|
|
/**
|
* 文件上传接口
|
*
|
* @param file 文件信息
|
* @param bucketName 桶名称
|
* @return 访问地址
|
* @throws Exception
|
*/
|
@PostMapping(value = "upload/{bucketName}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
public R<SysFile> upload(@RequestPart(value = "file") MultipartFile file,@PathVariable("bucketName") String bucketName);
|
|
/**
|
* 文件上传接口
|
*
|
* @param file 文件信息
|
* @param bucketName 桶名称
|
* @param path 路径
|
* @return 访问地址
|
* @throws Exception
|
*/
|
@PostMapping(value = "uploadWithPath", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
public R<SysFile> upload(@RequestPart("file") MultipartFile file, @RequestParam("bucketName") String bucketName, @RequestParam("path") String path);
|
|
/**
|
* 删除文件
|
*
|
* @param fileUrl 文件地址
|
* @return 结果
|
*/
|
@DeleteMapping(value = "/delete", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
public R<Boolean> delete(@RequestParam("fileUrl") String fileUrl);
|
}
|