提交 | 用户 | 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 |
|
|
30 |
/** |
|
31 |
*上传图片(转化实体FileUpdateDto) |
|
32 |
* @param file 文件 |
|
33 |
* @param folderCode 存储文件夹,比如商品轮播图:/goods/banner |
|
34 |
* @param bucketName 存储桶名称 |
|
35 |
* @return |
|
36 |
*/ |
4c7f60
|
37 |
@RequestMapping(value = "/cos/upload-file") |
W |
38 |
Result upload(@RequestParam("file") File file, @RequestParam("folderCode") String folderCode, @RequestParam("bucketName")String bucketName); |
7c680b
|
39 |
/** |
C |
40 |
*下载图片 |
|
41 |
* 可以使用 FileDownUtil.downToFile()方法转化为文件 |
|
42 |
* @param cosDownDto 对象 |
|
43 |
* @return |
|
44 |
*/ |
|
45 |
@PostMapping(value = "/cos/download-file") |
|
46 |
Response downloadFile(@RequestBody FileDownDto cosDownDto); |
|
47 |
|
|
48 |
} |