提交 | 用户 | 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; |
0464e0
|
5 |
import com.hz.his.dto.file.FileSignVo; |
7c680b
|
6 |
import feign.Response; |
C |
7 |
import org.springframework.cloud.openfeign.FeignClient; |
|
8 |
import org.springframework.http.MediaType; |
|
9 |
import org.springframework.web.bind.annotation.*; |
|
10 |
import org.springframework.web.multipart.MultipartFile; |
|
11 |
|
|
12 |
import java.io.File; |
|
13 |
|
|
14 |
/** |
|
15 |
* 这里这个name 需要填写 请求的服务提供者的注册到nacos Server上面的服务名,path 是请求接口前缀 |
|
16 |
*/ |
|
17 |
@FeignClient(name="phis-provider",path = "/p-his-data",contextId = "cos-down") |
|
18 |
public interface SFileService { |
|
19 |
|
|
20 |
/** |
|
21 |
*上传图片(转化实体FileUpdateDto) |
|
22 |
* @param file 文件 |
|
23 |
* @param folderCode 存储文件夹,比如商品轮播图:/goods/banner |
|
24 |
* @param bucketName 存储桶名称 |
|
25 |
* @return |
|
26 |
*/ |
|
27 |
@RequestMapping(value = "/cos/upload-multipart",consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
|
28 |
Result upload(@RequestPart("file") MultipartFile file, @RequestParam("folderCode") String folderCode, @RequestParam("bucketName")String bucketName); |
|
29 |
|
|
30 |
/** |
390f20
|
31 |
*上传图片(转化实体FileUpdateDto) |
F |
32 |
* @param file 文件 |
|
33 |
* @param folderCode 存储文件夹,比如商品轮播图:/goods/banner |
|
34 |
* @param bucketName 存储桶名称 |
|
35 |
* @return |
|
36 |
*/ |
|
37 |
@RequestMapping(value = "/cos/upload-multipart/name",consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
75c24d
|
38 |
Result upload(@RequestPart("file") MultipartFile file, @RequestParam("folderCode") String folderCode, @RequestParam("bucketName")String bucketName,@RequestParam("fileName")String fileName); |
390f20
|
39 |
|
F |
40 |
|
|
41 |
/** |
7c680b
|
42 |
*下载图片 |
C |
43 |
* 可以使用 FileDownUtil.downToFile()方法转化为文件 |
|
44 |
* @param cosDownDto 对象 |
|
45 |
* @return |
|
46 |
*/ |
|
47 |
@PostMapping(value = "/cos/download-file") |
|
48 |
Response downloadFile(@RequestBody FileDownDto cosDownDto); |
|
49 |
|
0464e0
|
50 |
/** |
C |
51 |
*生成签名访问URL |
|
52 |
* @param fileSignVo 对象 |
|
53 |
* @return 使用FileSignReturnVo转化 |
|
54 |
*/ |
|
55 |
@PostMapping(value = "/cos/signUrl") |
|
56 |
Response downloadFile(@RequestBody FileSignVo fileSignVo); |
|
57 |
|
1cc0e3
|
58 |
|
W |
59 |
/** |
|
60 |
*生成上传签名 |
|
61 |
* @param fileSignVo 对象 |
|
62 |
* @return 使用FileSignReturnVo转化 |
|
63 |
*/ |
|
64 |
@PostMapping(value = "/cos/policy") |
|
65 |
Result policy(@RequestBody FileSignVo fileSignVo); |
|
66 |
|
7c680b
|
67 |
} |