提交 | 用户 | age
|
ddd881
|
1 |
package com.hz.his.feign.service.phis; |
7c680b
|
2 |
|
C |
3 |
import com.hx.resultTool.Result; |
f5bce1
|
4 |
import com.hz.his.dto.file.FileDownDto; |
7c680b
|
5 |
import feign.Response; |
C |
6 |
import org.springframework.cloud.openfeign.FeignClient; |
|
7 |
import org.springframework.http.MediaType; |
|
8 |
import org.springframework.web.bind.annotation.*; |
|
9 |
import org.springframework.web.multipart.MultipartFile; |
|
10 |
|
|
11 |
import java.io.File; |
|
12 |
|
|
13 |
/** |
|
14 |
* 这里这个name 需要填写 请求的服务提供者的注册到nacos Server上面的服务名,path 是请求接口前缀 |
|
15 |
*/ |
|
16 |
@FeignClient(name="phis-provider",path = "/p-his-data",contextId = "cos-down") |
|
17 |
public interface SFileService { |
|
18 |
|
|
19 |
/** |
|
20 |
*上传图片(转化实体FileUpdateDto) |
|
21 |
* @param file 文件 |
|
22 |
* @param folderCode 存储文件夹,比如商品轮播图:/goods/banner |
|
23 |
* @param bucketName 存储桶名称 |
|
24 |
* @return |
|
25 |
*/ |
|
26 |
@RequestMapping(value = "/cos/upload-multipart",consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
|
27 |
Result upload(@RequestPart("file") MultipartFile file, @RequestParam("folderCode") String folderCode, @RequestParam("bucketName")String bucketName); |
|
28 |
|
|
29 |
/** |
390f20
|
30 |
*上传图片(转化实体FileUpdateDto) |
F |
31 |
* @param file 文件 |
|
32 |
* @param folderCode 存储文件夹,比如商品轮播图:/goods/banner |
|
33 |
* @param bucketName 存储桶名称 |
|
34 |
* @return |
|
35 |
*/ |
|
36 |
@RequestMapping(value = "/cos/upload-multipart/name",consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
c2c5af
|
37 |
Result upload(@RequestPart("file") MultipartFile file, @RequestParam("folderCode") String folderCode, @RequestParam("bucketName")String bucketName,@RequestParam("fileName")String fileName); |
390f20
|
38 |
|
F |
39 |
|
|
40 |
/** |
7c680b
|
41 |
*下载图片 |
C |
42 |
* 可以使用 FileDownUtil.downToFile()方法转化为文件 |
|
43 |
* @param cosDownDto 对象 |
|
44 |
* @return |
|
45 |
*/ |
|
46 |
@PostMapping(value = "/cos/download-file") |
|
47 |
Response downloadFile(@RequestBody FileDownDto cosDownDto); |
|
48 |
|
|
49 |
} |