“mitao”
2026-02-13 de89c47bda0ab07e322a3f8a6d1a42445ebe0622
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
package com.xiaopeng.api.factory.maintenance;
 
import com.xiaopeng.api.feignClient.maintenance.XpCheckLocationClient;
import com.xiaopeng.api.model.maintenance.XpCheckLocation;
import com.xiaopeng.common.core.domain.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
 
/**
 * 打卡地址Feign客户端降级工厂
 *
 * @author mitao
 * @since 2026-02-13
 */
@Slf4j
@Component
public class XpCheckLocationClientFallbackFactory implements FallbackFactory<XpCheckLocationClient> {
 
    @Override
    public XpCheckLocationClient create(Throwable cause) {
        log.error("打卡地址服务调用失败: {}", cause.getMessage());
        return new XpCheckLocationClient() {
            @Override
            public R<XpCheckLocation> queryById(Long id) {
                log.error("远程调用获取检查点位信息异常:{}", cause.getMessage());
                return R.fail("远程调用获取检查点位信息异常");
            }
        };
    }
}