| File was renamed from xp-api/src/main/java/com/xiaopeng/api/factory/RemoteMenuFallbackFactory.java |
| | |
| | | package com.xiaopeng.api.factory; |
| | | package com.xiaopeng.api.factory.operation; |
| | | |
| | | import com.xiaopeng.api.feign.operation.RemoteMenuService; |
| | | import com.xiaopeng.api.feignClient.operation.SysMenuClient; |
| | | import com.xiaopeng.api.model.operation.SysMenu; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import org.slf4j.Logger; |
| | |
| | | import java.util.List; |
| | | |
| | | @Component |
| | | public class RemoteMenuFallbackFactory implements FallbackFactory<RemoteMenuService> { |
| | | public class RemoteMenuFallbackFactory implements FallbackFactory<SysMenuClient> { |
| | | |
| | | private static final Logger log = LoggerFactory.getLogger(RemoteMenuFallbackFactory.class); |
| | | |
| | | @Override |
| | | public RemoteMenuService create(Throwable cause) { |
| | | public SysMenuClient create(Throwable cause) { |
| | | log.error("菜单服务调用失败: {}", cause.getMessage()); |
| | | return new RemoteMenuService(){ |
| | | return new SysMenuClient(){ |
| | | |
| | | @Override |
| | | public R<List<SysMenu>> getMenusByMenuIds(List<Long> menuIds, String source) { |
| | | public R<List<SysMenu>> getMenusByMenuIds(List<Long> menuIds) { |
| | | log.error("获取菜单列表失败,menuIds: {}, 原因: {}", menuIds, cause.getMessage()); |
| | | // 降级返回空列表,避免登录失败 |
| | | return R.ok(new ArrayList<>()); |