From 5bfe4069d574bd1fd0b1f29f86653f2bdffaccd7 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期四, 26 九月 2024 16:00:54 +0800
Subject: [PATCH] 合併代碼
---
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/CouponFallbackFactory.java | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/CouponFallbackFactory.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/CouponFallbackFactory.java
index 452dadb..e61f478 100644
--- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/CouponFallbackFactory.java
+++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/CouponFallbackFactory.java
@@ -5,10 +5,14 @@
import com.ruoyi.other.api.domain.TGoods;
import com.ruoyi.other.api.feignClient.CouponClient;
import com.ruoyi.other.api.feignClient.GoodsClient;
+import io.seata.core.exception.TransactionException;
+import io.seata.tm.api.GlobalTransactionContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
+
+import java.util.List;
/**
* @author zhibing.pu
@@ -28,6 +32,22 @@
public R<TCoupon> getCouponById1(Integer id) {
return R.fail("根据id获取优惠券信息失败:" + throwable.getMessage());
}
+
+ @Override
+ public R<List<Integer>> getCouponIdsByName(String name) {
+ return R.fail("根据名称查询优惠券ids:" + throwable.getMessage());
+ }
+
+ @Override
+ public R updateCoupon(TCoupon coupon) {
+ // 手动进行全局事务回滚
+ try {
+ GlobalTransactionContext.getCurrent().rollback();
+ } catch (TransactionException e) {
+ throw new RuntimeException(e);
+ }
+ return R.fail("修改优惠券失败");
+ }
};
}
--
Gitblit v1.7.1