feat(RemoteFileService): 新增文件上传功能

- 在RemoteFileService接口中添加upload方法用于文件上传
- 支持MultipartFile类型参数和MULTIPART_FORM_DATA媒体类型
- 返回R对象包含文件存储路径信息
This commit is contained in:
冷冷 authored and PIG AI committed 2025-06-23 16:09:34 +08:00
1 parent d8e56129bc
commit 6912730e94
1 file changed
+20
@@ -1,10 +1,15 @@
package com.pig4cloud.pigx.admin.api.feign;
import com.pig4cloud.pigx.common.core.constant.ServiceNameConstants;
import com.pig4cloud.pigx.common.core.util.R;
import feign.Response;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
/**
* 文件读取
@@ -15,6 +20,21 @@ import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(contextId = "remoteFileService", value = ServiceNameConstants.UPMS_SERVICE)
public interface RemoteFileService {
/**
* 获取文件的方法
*
* @param fileName 文件的名称
* @return 响应对象,包含文件内容
*/
@GetMapping("/sys-file/oss/file")
Response getFile(@RequestParam String fileName);
/**
* 上传文件
*
* @param file 资源
* @return R(/ admin / bucketName / filename)
*/
@PostMapping(value = "/sys-file/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
R upload(@RequestPart("file") MultipartFile file);
}