From a225b039febfe6a3257b3b0d317c7f5174ac9577 Mon Sep 17 00:00:00 2001 From: hongawen <83944980@qq.com> Date: Tue, 29 Oct 2024 20:27:14 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=97=E6=B3=95=E6=A8=A1=E5=9D=97=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E4=B8=8D=E5=BF=85=E8=A6=81=E7=9A=84=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E6=9C=89=E5=A4=87=E4=BB=BD=EF=BC=8C=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E5=AD=98=E7=96=91=E5=B0=B1=E8=81=94=E7=B3=BB=E6=88=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...msStatisticsSpecialMonitorFeignClient.java | 3 +- .../fallback/RMpInfluenceFallbackFactory.java | 2 +- .../fallback/rMpInfluenceFallbackFactory.java | 33 ------------------- 3 files changed, 3 insertions(+), 35 deletions(-) delete mode 100644 pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/api/newalgorithm/fallback/rMpInfluenceFallbackFactory.java diff --git a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/api/newalgorithm/PmsStatisticsSpecialMonitorFeignClient.java b/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/api/newalgorithm/PmsStatisticsSpecialMonitorFeignClient.java index cec3dd59c..b94a5d533 100644 --- a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/api/newalgorithm/PmsStatisticsSpecialMonitorFeignClient.java +++ b/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/api/newalgorithm/PmsStatisticsSpecialMonitorFeignClient.java @@ -3,6 +3,7 @@ package com.njcn.prepare.harmonic.api.newalgorithm; import com.njcn.common.pojo.constant.ServerInfo; import com.njcn.common.pojo.response.HttpResult; +import com.njcn.prepare.harmonic.api.newalgorithm.fallback.PmsStatisticsSpecialMonitorFeignClientFallbackFactory; import com.njcn.prepare.harmonic.pojo.param.LineParam; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.PostMapping; @@ -11,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestBody; @org.springframework.cloud.openfeign.FeignClient( value = ServerInfo.PREPARE_BOOT,//对应模块名 path = "/pmsStatisticsSpecialMonitor",//对应controller请求类 - fallbackFactory = RStatAbnormalFeignClientFallbackFactory.class//服务降级处理类 + fallbackFactory = PmsStatisticsSpecialMonitorFeignClientFallbackFactory.class//服务降级处理类 ) public interface PmsStatisticsSpecialMonitorFeignClient { diff --git a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/api/newalgorithm/fallback/RMpInfluenceFallbackFactory.java b/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/api/newalgorithm/fallback/RMpInfluenceFallbackFactory.java index 62e9d8f3c..4c26820e4 100644 --- a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/api/newalgorithm/fallback/RMpInfluenceFallbackFactory.java +++ b/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/api/newalgorithm/fallback/RMpInfluenceFallbackFactory.java @@ -12,7 +12,7 @@ import org.springframework.stereotype.Component; @Slf4j @Component -public class rMpInfluenceFallbackFactory implements FallbackFactory { +public class RMpInfluenceFallbackFactory implements FallbackFactory { @Override public RMpInfluenceFeignClient create(Throwable throwable) { Enum exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK; diff --git a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/api/newalgorithm/fallback/rMpInfluenceFallbackFactory.java b/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/api/newalgorithm/fallback/rMpInfluenceFallbackFactory.java deleted file mode 100644 index 4c26820e4..000000000 --- a/pqs-prepare/prepare-api/src/main/java/com/njcn/prepare/harmonic/api/newalgorithm/fallback/rMpInfluenceFallbackFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.njcn.prepare.harmonic.api.newalgorithm.fallback; - -import com.njcn.common.pojo.enums.response.CommonResponseEnum; -import com.njcn.common.pojo.exception.BusinessException; -import com.njcn.common.pojo.response.HttpResult; -import com.njcn.prepare.harmonic.api.newalgorithm.RMpInfluenceFeignClient; -import com.njcn.prepare.harmonic.pojo.param.LineParam; -import com.njcn.prepare.harmonic.utils.PrepareEnumUtil; -import feign.hystrix.FallbackFactory; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -@Slf4j -@Component -public class RMpInfluenceFallbackFactory implements FallbackFactory { - @Override - public RMpInfluenceFeignClient create(Throwable throwable) { - Enum exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK; - if (throwable.getCause() instanceof BusinessException) { - BusinessException businessException = (BusinessException)throwable.getCause(); - exceptionEnum = PrepareEnumUtil.getExceptionEnum(businessException.getResult()); - } - - Enum finalExceptionEnum = exceptionEnum; - return new RMpInfluenceFeignClient() { - @Override - public HttpResult rMpInfluenceMHandler(LineParam jobParam) { - log.error("{}异常,降级处理,异常为:{}", "影响特性: ", throwable.toString()); - throw new BusinessException(finalExceptionEnum); - } - }; - } -}