From 3e8b7cbb0ed820e6bd9e97566af42c36c2579bbd Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 17 Mar 2022 14:54:44 +0800 Subject: [PATCH] fallback --- ...CommonGovOrgFeignClientFallBackFactory.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonGovOrgFeignClientFallBackFactory.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonGovOrgFeignClientFallBackFactory.java index e292d07c69..219d8f38cd 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonGovOrgFeignClientFallBackFactory.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonGovOrgFeignClientFallBackFactory.java @@ -1,11 +1,9 @@ package com.epmet.commons.tools.feign.fallback; -import com.epmet.commons.tools.constant.ServiceConstant; -import com.epmet.commons.tools.dto.form.CustomerGridFormDTO; +import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.feign.CommonGovOrgFeignClient; -import com.epmet.commons.tools.redis.common.bean.GridInfoCache; -import com.epmet.commons.tools.utils.ModuleUtils; -import com.epmet.commons.tools.utils.Result; +import feign.hystrix.FallbackFactory; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; /** @@ -13,12 +11,14 @@ import org.springframework.stereotype.Component; * @DateTime 2022/3/17 1:46 下午 * @DESC */ +@Slf4j @Component -public class CommonGovOrgFeignClientFallBackFactory implements CommonGovOrgFeignClient { - +public class CommonGovOrgFeignClientFallBackFactory implements FallbackFactory { + private CommonOrgFeignClientFallback fallback = new CommonOrgFeignClientFallback(); @Override - public Result getGridInfo(CustomerGridFormDTO customerGridFormDTO) { - return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridInfo", customerGridFormDTO); + public CommonGovOrgFeignClient create(Throwable cause) { + log.error(String.format("FeignClient调用发生异常,异常信息:%s", ExceptionUtils.getThrowableErrorStackTrace(cause))); + return fallback; } }