xuhy
2026-02-24 251bb514612312ab8f5de405fcad2c7889d5d43b
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
package com.xiaopeng.api.factory.operation;
 
import com.xiaopeng.api.dto.operation.PointAddDto;
import com.xiaopeng.api.dto.operation.PointMapQuery;
import com.xiaopeng.api.dto.operation.PointUpdateDto;
import com.xiaopeng.api.dto.operation.XpPointEnableDisableDto;
import com.xiaopeng.api.dto.order.HistoryEndPointsDto;
import com.xiaopeng.api.dto.order.HistoryStartPointsDto;
import com.xiaopeng.api.feignClient.operation.XpPointClient;
import com.xiaopeng.api.model.operation.XpElectronicFenceArea;
import com.xiaopeng.api.model.operation.XpPoint;
import com.xiaopeng.api.query.operation.PointPageListQuery;
import com.xiaopeng.api.vo.order.XpHistoryEndPointsVo;
import com.xiaopeng.api.vo.order.XpHistoryStartPointsVo;
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.util.ArrayList;
import java.util.Collections;
import java.util.List;
 
@Slf4j
@Component
public class XpPointClientFallbackFactory implements FallbackFactory<XpPointClient> {
    @Override
    public XpPointClient create(Throwable cause) {
        return new XpPointClient() {
            @Override
            public R<List<XpHistoryStartPointsVo>> getHistoryStartPoints(HistoryStartPointsDto historyStartPointsDto) {
                log.error("获取历史起点失败:{}", cause.getMessage());
                return R.ok(Collections.emptyList());
            }
 
            @Override
            public R<List<XpHistoryEndPointsVo>> getHistoryEndPoints(HistoryEndPointsDto historyEndPointsDto) {
                log.error("获取历史终点失败:{}", cause.getMessage());
                return R.ok(Collections.emptyList());
            }
 
            @Override
            public R<List<XpElectronicFenceArea>> listElectronicFenceArea() {
                log.error("获取所有运营中的区域:{}", cause.getMessage());
                return R.fail(Collections.emptyList());
            }
 
            @Override
            public R<List<XpPoint>> list(PointPageListQuery query) {
                log.error("获取点位分页列表失败:{}", cause.getMessage());
                return R.fail(Collections.emptyList());
            }
 
            @Override
            public R add(PointAddDto pointAddDto) {
                log.error("新增点位失败:{}", cause.getMessage());
                return R.fail("新增点位失败");
            }
 
            @Override
            public R edit(PointUpdateDto pointAddDto) {
                log.error("编辑点位失败:{}", cause.getMessage());
                return R.fail("编辑点位失败");
            }
 
            @Override
            public R<XpPoint> queryById(Long id) {
                log.error("获取点位详情失败:{}", cause.getMessage());
                return R.fail("获取点位详情失败");
            }
 
            @Override
            public R deletePoint(String ids) {
                log.error("删除点位失败:{}", cause.getMessage());
                return R.fail("删除点位失败");
            }
 
            @Override
            public R enableDisable(XpPointEnableDisableDto dto) {
                log.error("修改点位运营状态失败:{}", cause.getMessage());
                return R.fail("修改点位运营状态失败");
            }
 
            @Override
            public R<List<XpPoint>> pointMap(PointMapQuery query) {
                log.error("获取地图点位失败:{}", cause.getMessage());
                return R.ok(new ArrayList<>());
            }
        };
    }
}