🐛 修复BFI附件上传Feign multipart编码失败(Error converting request body)
This commit is contained in:
+10
@@ -27,7 +27,12 @@ package org.springblade.thirdparty.bfi.config;
|
|||||||
|
|
||||||
import feign.Request;
|
import feign.Request;
|
||||||
import feign.RequestInterceptor;
|
import feign.RequestInterceptor;
|
||||||
|
import feign.codec.Encoder;
|
||||||
|
import feign.form.spring.SpringFormEncoder;
|
||||||
import org.springblade.thirdparty.bfi.interceptor.BfiRequestInterceptor;
|
import org.springblade.thirdparty.bfi.interceptor.BfiRequestInterceptor;
|
||||||
|
import org.springframework.beans.factory.ObjectFactory;
|
||||||
|
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
|
||||||
|
import org.springframework.cloud.openfeign.support.SpringEncoder;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -61,4 +66,9 @@ public class BfiFeignClientConfig {
|
|||||||
public Request.Options options() {
|
public Request.Options options() {
|
||||||
return new Request.Options(10, TimeUnit.SECONDS, 60, TimeUnit.SECONDS, true);
|
return new Request.Options(10, TimeUnit.SECONDS, 60, TimeUnit.SECONDS, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Encoder feignFormEncoder(ObjectFactory<HttpMessageConverters> messageConverters) {
|
||||||
|
return new SpringFormEncoder(new SpringEncoder(messageConverters));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -465,7 +465,7 @@ public interface IBfiClient {
|
|||||||
* @param attachmentUploadFileArgs 上传参数 JSON 字符串:{"entityNumber":"ap_payapply","billPkId":2386455983883835392,"controlKey":"attachmentpanel"}
|
* @param attachmentUploadFileArgs 上传参数 JSON 字符串:{"entityNumber":"ap_payapply","billPkId":2386455983883835392,"controlKey":"attachmentpanel"}
|
||||||
* @return 上传结果,data.path 即金蝶侧文件路径
|
* @return 上传结果,data.path 即金蝶侧文件路径
|
||||||
*/
|
*/
|
||||||
@PostMapping(value = ATTACHMENT_UPLOAD_URL, produces = MediaType.MULTIPART_FORM_DATA_VALUE)
|
@PostMapping(value = ATTACHMENT_UPLOAD_URL, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||||
BfiResultVO<BfiAttachmentUploadVO> uploadAttachment(@RequestHeader(BfiConstant.HEADER_ACCESS_TOKEN) String accessToken,
|
BfiResultVO<BfiAttachmentUploadVO> uploadAttachment(@RequestHeader(BfiConstant.HEADER_ACCESS_TOKEN) String accessToken,
|
||||||
@RequestPart("file") MultipartFile file,
|
@RequestPart("file") MultipartFile file,
|
||||||
@RequestPart("attachmentUploadFileArgs") String attachmentUploadFileArgs);
|
@RequestPart("attachmentUploadFileArgs") String attachmentUploadFileArgs);
|
||||||
|
|||||||
Reference in New Issue
Block a user