From 3244b550596e0330031b3f4547356927df83b0ad Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期一, 19 五月 2025 11:48:35 +0800 Subject: [PATCH] 修改bug --- ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingGunFallbackFactory.java | 42 ++++++++++++++++++++++++++++++++---------- 1 files changed, 32 insertions(+), 10 deletions(-) diff --git a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingGunFallbackFactory.java b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingGunFallbackFactory.java index ad57df7..8bce10c 100644 --- a/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingGunFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-chargingPile/src/main/java/com/ruoyi/chargingPile/api/factory/ChargingGunFallbackFactory.java @@ -5,10 +5,9 @@ import com.ruoyi.chargingPile.api.model.TChargingGun; import com.ruoyi.chargingPile.api.model.TChargingPile; import com.ruoyi.chargingPile.api.model.TFaultMessage; +import com.ruoyi.chargingPile.api.vo.GetChargingGunByCode; import com.ruoyi.chargingPile.api.vo.SiteNameVO; import com.ruoyi.common.core.domain.R; -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; @@ -30,7 +29,17 @@ public ChargingGunClient create(Throwable throwable) { log.error("充电枪调用失败:{}", throwable.getMessage()); return new ChargingGunClient() { - + + @Override + public R<List<TChargingGun>> getAllGun() { + return R.fail("获取数据失败:" + throwable.getMessage()); + } + + @Override + public R<List<TChargingPile>> getAllPile() { + return R.fail("获取所有桩失败:" + throwable.getMessage()); + } + @Override public R<String> getAllName(Integer id) { return R.fail("根据id获取充电枪完整名称失败:" + throwable.getMessage()); @@ -38,12 +47,6 @@ @Override public R<TChargingGun> getChargingGunById(Integer id) { - // 手动进行全局事务回滚 - try { - GlobalTransactionContext.getCurrent().rollback(); - } catch (TransactionException e) { - throw new RuntimeException(e); - } return R.fail("根据id获取充电枪失败:" + throwable.getMessage()); } @@ -53,7 +56,7 @@ } @Override - public R<TChargingGun> getChargingGunByCode(String code) { + public R<TChargingGun> getChargingGunByCode(GetChargingGunByCode code) { return R.fail("根据枪编号获取充电枪失败:" + throwable.getMessage()); } @@ -61,7 +64,26 @@ public R<String> updateChargingGunById(TChargingGun chargingGun) { return R.fail("编辑充电枪失败:" + throwable.getMessage()); } + + @Override + public R<List<TChargingGun>> getChargingGunByChargingPileId(Integer chargingPileId) { + return R.fail("根据充电桩id获取枪失败:" + throwable.getMessage()); + } + + @Override + public R<List<TChargingGun>> getChargingGunByChargingPileIds(List<Integer> chargingPileIds) { + return R.fail("根据充电桩ids获取枪失败:" + throwable.getMessage()); + } + + @Override + public R pushChargingGunStatus(Integer id, Integer status) { + return R.fail("接口状态变化后推送给第三方失败:" + throwable.getMessage()); + } + @Override + public R<TChargingGun> getChargingGunByFullNumber(String fullNumber) { + return R.fail("根据枪唯一码查询信息失败:" + throwable.getMessage()); + } }; } } -- Gitblit v1.7.1