| package com.ruoyi.integration.api.factory; | 
|   | 
| import com.ruoyi.common.core.domain.R; | 
| import com.ruoyi.integration.api.feignClient.IntegrationClient; | 
| import com.ruoyi.integration.api.model.*; | 
| import org.slf4j.Logger; | 
| import org.slf4j.LoggerFactory; | 
| import org.springframework.cloud.openfeign.FallbackFactory; | 
| import org.springframework.stereotype.Component; | 
|   | 
| /** | 
|  * 充电桩服务降级处理 | 
|  *  | 
|  * @author ruoyi | 
|  */ | 
| @Component | 
| public class IntegrationFallbackFactory implements FallbackFactory<IntegrationClient> | 
| { | 
|     private static final Logger log = LoggerFactory.getLogger(IntegrationFallbackFactory.class); | 
|   | 
|     @Override | 
|     public IntegrationClient create(Throwable throwable) { | 
|         log.error("充电桩调用失败:{}", throwable.getMessage()); | 
|         return new IntegrationClient() { | 
|   | 
|             @Override | 
|             public R<String> onlineReply(OnlineReply onlineReply) { | 
|                 return R.fail("登录认证应答调用失败:" + throwable.getMessage()); | 
|             } | 
|   | 
|             @Override | 
|             public R<String> pong(Pong pong) { | 
|                 return R.fail("心跳包应答调用失败:" + throwable.getMessage()); | 
|             } | 
|   | 
|             @Override | 
|             public R<String> billingModeVerifyReply(BillingModeVerifyReply billingModeVerifyReply) { | 
|                 return R.fail("计费模型验证请求应答调用失败:" + throwable.getMessage()); | 
|             } | 
|   | 
|             @Override | 
|             public R<String> acquisitionBillingModeReply(AcquisitionBillingModeReply acquisitionBillingModeReply) { | 
|                 return R.fail("计费模型验证请求应答调用失败:" + throwable.getMessage()); | 
|             } | 
|   | 
|             @Override | 
|             public R<String> readRealTimeMonitoringData(ReadRealTimeMonitoringData readRealTimeMonitoringData) { | 
|                 return R.fail("读取实时监测数据调用失败:" + throwable.getMessage()); | 
|             } | 
|   | 
|             @Override | 
|             public R<String> endCharge(EndCharge endCharge) { | 
|                 return R.fail("充电结束调用失败:" + throwable.getMessage()); | 
|             } | 
|   | 
|             @Override | 
|             public R<String> platformConfirmationCharging(PlatformConfirmationCharging platformConfirmationCharging) { | 
|                 return R.fail("运营平台确认启动充电调用失败:" + throwable.getMessage()); | 
|             } | 
|   | 
|             @Override | 
|             public R<String> platformStartCharging(PlatformStartCharging platformStartCharging) { | 
|                 return R.fail("运营平台远程控制启机调用失败:" + throwable.getMessage()); | 
|             } | 
|   | 
|             @Override | 
|             public R<String> platformStopCharging(PlatformStopCharging platformStopCharging) { | 
|                 return R.fail("运营平台远程停机调用失败:" + throwable.getMessage()); | 
|             } | 
|   | 
|             @Override | 
|             public R<String> confirmTransactionRecord(ConfirmTransactionRecord confirmTransactionRecord) { | 
|                 return R.fail("交易记录确认调用失败:" + throwable.getMessage()); | 
|             } | 
|   | 
|             @Override | 
|             public R<String> updateBalance(UpdateBalance updateBalance) { | 
|                 return R.fail("远程账户余额更新调用失败:" + throwable.getMessage()); | 
|             } | 
|   | 
|             @Override | 
|             public R<String> synchronizeOfflineCard(SynchronizeOfflineCard synchronizeOfflineCard) { | 
|                 return R.fail("离线卡数据同步调用失败:" + throwable.getMessage()); | 
|             } | 
|   | 
|             @Override | 
|             public R<String> clearOfflineCard(ClearOfflineCard clearOfflineCard) { | 
|                 return R.fail("离线卡数据清除调用失败:" + throwable.getMessage()); | 
|             } | 
|   | 
|             @Override | 
|             public R<String> queryOfflineCard(QueryOfflineCard queryOfflineCard) { | 
|                 return R.fail("离线卡数据查询调用失败:" + throwable.getMessage()); | 
|             } | 
|   | 
|             @Override | 
|             public R<String> workingParameterSetting(WorkingParameterSetting workingParameterSetting) { | 
|                 return R.fail("充电桩工作参数设置调用失败:" + throwable.getMessage()); | 
|             } | 
|   | 
|             @Override | 
|             public R<String> timingSetting(TimingSetting timingSetting) { | 
|                 return R.fail("对时设置调用失败:" + throwable.getMessage()); | 
|             } | 
|   | 
|             @Override | 
|             public R<String> setupBillingModel(SetupBillingModel setupBillingModel) { | 
|                 return R.fail("计费模型设置调用失败:" + throwable.getMessage()); | 
|             } | 
|   | 
|             @Override | 
|             public R<String> openOrCloseGroundLock(OpenOrCloseGroundLock openOrCloseGroundLock) { | 
|                 return R.fail("遥控地锁升锁与降锁命令 (下行)调用失败:" + throwable.getMessage()); | 
|             } | 
|   | 
|             @Override | 
|             public R<String> platformRestart(PlatformRestart platformRestart) { | 
|                 return R.fail("远程重启调用失败:" + throwable.getMessage()); | 
|             } | 
|   | 
|             @Override | 
|             public R<String> platformRemoteUpdate(PlatformRemoteUpdate platformRemoteUpdate) { | 
|                 return R.fail("远程更新调用失败:" + throwable.getMessage()); | 
|             } | 
|         }; | 
|     } | 
| } |