提交 | 用户 | 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 存储桶名称 |
d06ed3
|
35 |
* @param fileName 文件名称(含后缀),如:test.xml |
390f20
|
36 |
* @return |
F |
37 |
*/ |
|
38 |
@RequestMapping(value = "/cos/upload-multipart/name",consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
75c24d
|
39 |
Result upload(@RequestPart("file") MultipartFile file, @RequestParam("folderCode") String folderCode, @RequestParam("bucketName")String bucketName,@RequestParam("fileName")String fileName); |
390f20
|
40 |
|
F |
41 |
|
|
42 |
/** |
7c680b
|
43 |
*下载图片 |
C |
44 |
* 可以使用 FileDownUtil.downToFile()方法转化为文件 |
|
45 |
* @param cosDownDto 对象 |
|
46 |
* @return |
|
47 |
*/ |
|
48 |
@PostMapping(value = "/cos/download-file") |
|
49 |
Response downloadFile(@RequestBody FileDownDto cosDownDto); |
|
50 |
|
0464e0
|
51 |
/** |
C |
52 |
*生成签名访问URL |
|
53 |
* @param fileSignVo 对象 |
|
54 |
* @return 使用FileSignReturnVo转化 |
|
55 |
*/ |
|
56 |
@PostMapping(value = "/cos/signUrl") |
263eb3
|
57 |
Result signUrl(@RequestBody FileSignVo fileSignVo); |
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 |
} |