package com.hz.his.feign.service.phis;
|
|
import com.hx.resultTool.Result;
|
import com.hz.his.dto.file.FileDownDto;
|
import com.hz.his.dto.file.FileSignVo;
|
import feign.Response;
|
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.http.MediaType;
|
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.multipart.MultipartFile;
|
|
import java.io.File;
|
|
/**
|
* 这里这个name 需要填写 请求的服务提供者的注册到nacos Server上面的服务名,path 是请求接口前缀
|
*/
|
@FeignClient(name="phi-platform-user",path = "/p-his-data",contextId = "cos-down")
|
public interface SFileService {
|
|
/**
|
*上传图片(转化实体FileUpdateDto)
|
* @param file 文件
|
* @param folderCode 存储文件夹,比如商品轮播图:/goods/banner
|
* @param bucketName 存储桶名称
|
* @return
|
*/
|
@RequestMapping(value = "/cos/upload-multipart",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
Result upload(@RequestPart("file") MultipartFile file, @RequestParam("folderCode") String folderCode, @RequestParam("bucketName")String bucketName);
|
|
/**
|
*上传图片(转化实体FileUpdateDto)
|
* @param file 文件
|
* @param folderCode 存储文件夹,比如商品轮播图:/goods/banner
|
* @param bucketName 存储桶名称
|
* @param fileName 文件名称(含后缀),如:test.xml
|
* @return
|
*/
|
@RequestMapping(value = "/cos/upload-multipart/name",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
Result upload(@RequestPart("file") MultipartFile file, @RequestParam("folderCode") String folderCode, @RequestParam("bucketName")String bucketName,@RequestParam("fileName")String fileName);
|
|
|
/**
|
*下载图片
|
* 可以使用 FileDownUtil.downToFile()方法转化为文件
|
* @param cosDownDto 对象
|
* @return
|
*/
|
@PostMapping(value = "/cos/download-file")
|
Response downloadFile(@RequestBody FileDownDto cosDownDto);
|
|
/**
|
*生成签名访问URL
|
* @param fileSignVo 对象
|
* @return 使用FileSignReturnVo转化
|
*/
|
@PostMapping(value = "/cos/signUrl")
|
Result signUrl(@RequestBody FileSignVo fileSignVo);
|
|
/**
|
*生成上传签名
|
* @param fileSignVo 对象
|
* @return 使用FileSignReturnVo转化
|
*/
|
@PostMapping(value = "/cos/policy")
|
Result policy(@RequestBody FileSignVo fileSignVo);
|
|
}
|