forked from kidgrow-microservices-platform

zhaoxiaohao
2020-08-12 3dcb4e0ebfd43190957f556d886917b2a2ffa064
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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>
 *
 * @Description: <br>
 * @Project: <br>
 * @CreateDate: Created in 2020/2/22 14:33 <br>
 * @Author: <a href="4345453@kidgrow.com">liuke</a>
 */
@FeignClient(name = ServiceNameConstants.FILE_CENTER_SERVER, configuration = FeignMultipartConfig.class,fallbackFactory = FileServiceFallbackFactory.class, decode404 = true)
public interface FileService {
    /**
     * 根据条件查询
     * @param file
     */
    @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;
 
}