From db24984ade5247f136cfcdb31b3d0971f2d0546b Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期五, 18 十月 2024 15:13:43 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile
---
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/GoodsFallbackFactory.java | 44 +++++++++++++++++++++++++++++++-------------
1 files changed, 31 insertions(+), 13 deletions(-)
diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/GoodsFallbackFactory.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/GoodsFallbackFactory.java
index f257843..c59d9a9 100644
--- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/GoodsFallbackFactory.java
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/GoodsFallbackFactory.java
@@ -1,26 +1,44 @@
package com.ruoyi.other.api.factory;
+import com.ruoyi.common.core.domain.R;
+import com.ruoyi.other.api.domain.TGoods;
import com.ruoyi.other.api.feignClient.GoodsClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
+import java.util.List;
+
/**
- * 商品服务降级处理
- *
- * @author ruoyi
+ * @author zhibing.pu
+ * @Date 2024/8/16 13:48
*/
@Component
-public class GoodsFallbackFactory implements FallbackFactory<GoodsClient>
-{
- private static final Logger log = LoggerFactory.getLogger(GoodsFallbackFactory.class);
+public class GoodsFallbackFactory implements FallbackFactory<GoodsClient> {
+
+ private static final Logger log = LoggerFactory.getLogger(GoodsFallbackFactory.class);
+
+ @Override
+ public GoodsClient create(Throwable throwable) {
+ log.error("商品调用失败:{}", throwable.getMessage());
+ return new GoodsClient() {
+
+ @Override
+ public R<TGoods> getGoodsById(Integer id) {
+ return R.fail("根据id获取商品信息失败:" + throwable.getMessage());
+ }
- @Override
- public GoodsClient create(Throwable throwable) {
- log.error("商品调用失败:{}", throwable.getMessage());
- return new GoodsClient() {
-
- };
- }
+ @Override
+ public R<List<Integer>> getGoodsIdsByName(String name) {
+ return R.fail("根据商品名称获取商品ids失败:" + throwable.getMessage());
+ }
+
+ @Override
+ public R updateGoods(TGoods goods) {
+ return R.fail("修改商品异常");
+ }
+ };
+ }
+
}
--
Gitblit v1.7.1