zhibing.pu
2024-08-31 f6125b320b78b36c439e85d926cb2b11cd71fc6c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
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());
            }
        };
    }
}