|
|
@ -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<CommonGovOrgFeignClient> { |
|
|
|
private CommonOrgFeignClientFallback fallback = new CommonOrgFeignClientFallback(); |
|
|
|
@Override |
|
|
|
public Result<GridInfoCache> 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; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|