package com.xiaopeng.api.factory.maintenance;
|
|
import com.xiaopeng.api.feignClient.maintenance.XpClockInClient;
|
import com.xiaopeng.common.core.domain.R;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
import org.springframework.stereotype.Component;
|
|
/**
|
* 打卡服务降级工厂
|
*
|
* @author mitao
|
* @date 2026-02-14
|
*/
|
@Slf4j
|
@Component
|
public class XpClockInClientFallbackFactory implements FallbackFactory<XpClockInClient> {
|
|
@Override
|
public XpClockInClient create(Throwable cause) {
|
return new XpClockInClient() {
|
@Override
|
public R<Integer> checkWorkStatus(Long appUserId) {
|
log.error("调用打卡服务检查上班状态失败, appUserId={}, 异常: {}",
|
appUserId, cause.getMessage(), cause);
|
// 降级策略: 返回 (未上班状态)
|
return R.ok(1);
|
}
|
};
|
}
|
}
|