package com.op.system.api;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;
import com.op.common.core.constant.ServiceNameConstants;
import com.op.common.core.domain.R;
import com.op.system.api.domain.SysFile;
import com.op.system.api.factory.RemoteFileFallbackFactory;

import java.io.InputStream;
import java.util.List;

/**
 * 文件服务
 *
 * @author OP
 */
@FeignClient(contextId = "remoteFileService", value = ServiceNameConstants.FILE_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class)
public interface RemoteFileService {
	/**
	 * 上传文件
	 *
	 * @param file 文件信息
	 * @return 结果
	 */
	@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
	public R<SysFile> upload(@RequestPart(value = "file") MultipartFile file);

	@PostMapping(value = "/getFile/{id}")
	public InputStream getFile(@PathVariable("id") String id);

}
