提交 | 用户 | 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 |
*/ |
314a4b
|
17 |
@FeignClient(name="phi-platform-user",path = "/p-his-data",contextId = "cos-down") |
7c680b
|
18 |
public interface SFileService { |
C |
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") |
263eb3
|
56 |
Result signUrl(@RequestBody FileSignVo fileSignVo); |
1cc0e3
|
57 |
|
W |
58 |
/** |
|
59 |
*生成上传签名 |
|
60 |
* @param fileSignVo 对象 |
|
61 |
* @return 使用FileSignReturnVo转化 |
|
62 |
*/ |
|
63 |
@PostMapping(value = "/cos/policy") |
|
64 |
Result policy(@RequestBody FileSignVo fileSignVo); |
|
65 |
|
7c680b
|
66 |
} |