feat:添加OA系统对接相关代码
This commit is contained in:
+16
@@ -40,6 +40,12 @@ import org.springframework.lang.Nullable;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
|
||||
import org.springblade.core.tool.support.NoErrorFallback;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springblade.core.tool.utils.StringUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
|
||||
|
||||
/**
|
||||
* blade fallBack 代理处理
|
||||
*
|
||||
@@ -69,6 +75,16 @@ public class BladeFeignFallback<T> implements MethodInterceptor {
|
||||
if (Map.class == returnType) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
if (cause instanceof FeignException feignException) {
|
||||
if (feignException.status() == HttpStatus.INTERNAL_SERVER_ERROR.value() && NoErrorFallback.class.isAssignableFrom(returnType)) {
|
||||
// 500 错误并且 继承了 NoErrorFallback,不拦截
|
||||
String body = feignException.contentUTF8();
|
||||
if (StringUtil.isBlank(body)) {
|
||||
return null;
|
||||
}
|
||||
return JSON.parseObject(body, returnType);
|
||||
}
|
||||
}
|
||||
// 暂时不支持 flux,rx,异步等,返回值不是 R,直接返回 null。
|
||||
if (R.class != returnType) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user