From 3c495119ec61ccd16b2dfc5b6dffd686714672a7 Mon Sep 17 00:00:00 2001 From: zxh <279049017@qq.com> Date: Tue, 01 Sep 2020 18:44:56 +0800 Subject: [PATCH] 添加 byte[] 的上传oss的注解 --- kidgrow-business/kidgrow-filecenter/kidgrow-filecenter-api/src/main/java/com/kidgrow/filecenter/feign/FileService.java | 38 +++++++++++++++++++++++++++++++++++++- 1 files changed, 37 insertions(+), 1 deletions(-) diff --git a/kidgrow-business/kidgrow-filecenter/kidgrow-filecenter-api/src/main/java/com/kidgrow/filecenter/feign/FileService.java b/kidgrow-business/kidgrow-filecenter/kidgrow-filecenter-api/src/main/java/com/kidgrow/filecenter/feign/FileService.java index 053f131..7aea84d 100644 --- a/kidgrow-business/kidgrow-filecenter/kidgrow-filecenter-api/src/main/java/com/kidgrow/filecenter/feign/FileService.java +++ b/kidgrow-business/kidgrow-filecenter/kidgrow-filecenter-api/src/main/java/com/kidgrow/filecenter/feign/FileService.java @@ -1,13 +1,19 @@ package com.kidgrow.filecenter.feign; import com.kidgrow.common.constant.ServiceNameConstants; +import com.kidgrow.common.model.ResultBody; +import com.kidgrow.filecenter.config.FeignMultipartConfig; import com.kidgrow.filecenter.feign.fallback.FileServiceFallbackFactory; import com.kidgrow.filecenter.model.FileInfo; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; + +import java.util.Map; /** * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br> @@ -17,7 +23,7 @@ * @CreateDate: Created in 2020/2/22 14:33 <br> * @Author: <a href="4345453@kidgrow.com">liuke</a> */ -@FeignClient(name = ServiceNameConstants.FILE_CENTER_SERVER, fallbackFactory = FileServiceFallbackFactory.class, decode404 = true) +@FeignClient(name = ServiceNameConstants.FILE_CENTER_SERVER, configuration = FeignMultipartConfig.class,fallbackFactory = FileServiceFallbackFactory.class, decode404 = true) public interface FileService { /** * 根据条件查询 @@ -25,4 +31,34 @@ */ @PostMapping(value = "/files-anon",consumes = MediaType.MULTIPART_FORM_DATA_VALUE) FileInfo upload(@RequestPart("file") MultipartFile file); + + /** + * 根据条件查询 + * @param file + * @param imgType 文件类型:X光片/医院Logo[Xray/Logo] + */ + @PostMapping(value = "/files-upload",produces = {MediaType.APPLICATION_JSON_UTF8_VALUE},consumes = MediaType.MULTIPART_FORM_DATA_VALUE) + FileInfo feignUpload(@RequestPart("file") MultipartFile file,@RequestParam("imgType") String imgType); + + /** + * base64上传图片 + * @param file,imgType + * @param imgType 文件类型:X光片/医院Logo[Xray/Logo] + */ + @PostMapping(value = "/baseUplaod",produces = {MediaType.APPLICATION_JSON_UTF8_VALUE},consumes = MediaType.MULTIPART_FORM_DATA_VALUE) + FileInfo baseUplaod(@RequestParam("file") String file,@RequestParam("imgType") String imgType,@RequestParam("hospitalId") String hospitalId,@RequestParam("departmentId") String departmentId); + + /** + * base64 下载图片 + * @param map + */ + @PostMapping(value = "/baseDownLoad",produces = {MediaType.APPLICATION_JSON_UTF8_VALUE},consumes = MediaType.MULTIPART_FORM_DATA_VALUE) + ResultBody baseDownLoad(@RequestBody Map<String,Object> map) throws Exception; + /** + * byte数组模式上传 到 oss + * @param fileName bytes + */ + @PostMapping(value="byteUplaod") + FileInfo byteUplaod(@RequestParam("fileName") String fileName,@RequestBody byte[] bytes); + } -- Gitblit v1.8.0