“mitao”
2026-03-09 a6414cf583f21d8a39cc5e1372c8af9db13377bb
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
package com.xiaopeng.api.factory.order;
 
import com.xiaopeng.api.dto.order.AddCruiseMissionDto;
import com.xiaopeng.api.dto.order.GetOrderNumDto;
import com.xiaopeng.api.dto.order.PopOrderDto;
import com.xiaopeng.api.dto.statistics.OrderStatisticsDTO;
import com.xiaopeng.api.dto.statistics.StatisticsQueryDTO;
import com.xiaopeng.api.feignClient.order.XpCruiseOrderClient;
import com.xiaopeng.api.feignClient.order.XpOrderClient;
import com.xiaopeng.api.model.order.XpCruiseOrder;
import com.xiaopeng.api.model.order.XpOrder;
import com.xiaopeng.common.core.domain.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
 
import java.math.BigDecimal;
import java.util.ArrayList;
 
/**
 * 订单Feign客户端降级工厂
 *
 * @author mitao
 */
@Slf4j
@Component
public class XpCruiseOrderClientFallbackFactory implements FallbackFactory<XpCruiseOrderClient> {
 
    @Override
    public XpCruiseOrderClient create(Throwable cause) {
        log.error("订单服务调用失败: {}", cause.getMessage());
        return new XpCruiseOrderClient() {
            @Override
            public R<String> addCruiseOrder(XpCruiseOrder order) {
                log.error("订单服务调用失败: {}", cause.getMessage());
                return null;
            }
 
            @Override
            public R<?> addCruiseMission(AddCruiseMissionDto dto) {
                log.error("订单服务调用失败: {}", cause.getMessage());
                return null;
            }
 
            @Override
            public R<String> updateCruiseOrder(String vin) {
                log.error("订单服务调用失败: {}", cause.getMessage());
                return null;
            }
 
            @Override
            public R<String> closeCruiseOrder(String vin) {
                log.error("订单服务调用失败: {}", cause.getMessage());
                return null;
            }
 
            @Override
            public R<XpCruiseOrder> getCruiseOrder(String orderId) {
                log.error("订单服务调用失败: {}", cause.getMessage());
                return null;
            }
        };
    }
}