puzhibing
2026-03-24 faae742fccc00d629ede627819cdc9d8a4ec25d3
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
package com.xiaopeng.api.factory.operation;
 
import com.xiaopeng.api.feignClient.operation.XpTestPlanClient;
import com.xiaopeng.api.model.operation.XpTestPlan;
import com.xiaopeng.api.model.operation.XpTestPlanPoint;
import com.xiaopeng.api.model.operation.XpTestPlanVehicle;
import com.xiaopeng.api.model.operation.XpTestPoint;
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.List;
 
@Slf4j
@Component
public class XpTestPlanClientFallbackFactory implements FallbackFactory<XpTestPlanClient> {
    @Override
    public XpTestPlanClient create(Throwable cause) {
        return new XpTestPlanClient() {
 
 
            @Override
            public R<XpTestPlan> getXpTestPlanById(Long id) {
                log.error("获取测试计划失败:{}", cause.getMessage());
                return R.fail("获取测试计划失败");
            }
 
            @Override
            public R<XpTestPlanPoint> getXpTestPlanPointById(Long id) {
                log.error("获取测试计划点失败:{}", cause.getMessage());
                return R.fail("获取测试计划点失败");
            }
 
            @Override
            public R<XpTestPoint> getXpTestPointById(Long id) {
                log.error("获取测试计划点位失败:{}", cause.getMessage());
                return R.fail("获取测试计划点位失败");
            }
 
            @Override
            public R<List<XpTestPlanVehicle>> getXpTestPlanVehicleByTestPlanId(Long testPlanId) {
                log.error("获取测试计划车辆失败:{}", cause.getMessage());
                return R.fail("获取测试计划车辆失败");
            }
        };
    }
}