From f83037e99a5352da02be428280793fc3203a554b Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期三, 04 九月 2024 11:27:44 +0800 Subject: [PATCH] 合并代码 --- ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/SysUserRoleVo.java | 49 ++++++++++++++++++++++++ ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java | 5 ++ ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/SysUserRoleFallbackFactory.java | 26 +++++++++++++ ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java | 2 ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/feignClient/SysUserRoleClient.java | 28 ++++++++++++++ 5 files changed, 109 insertions(+), 1 deletions(-) diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/SysUserRoleFallbackFactory.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/SysUserRoleFallbackFactory.java new file mode 100644 index 0000000..6e743e9 --- /dev/null +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/SysUserRoleFallbackFactory.java @@ -0,0 +1,26 @@ +package com.ruoyi.system.api.factory; + +import com.ruoyi.common.core.domain.R; +import com.ruoyi.system.api.domain.SysRole; +import com.ruoyi.system.api.domain.SysUser; +import com.ruoyi.system.api.feignClient.SysUserClient; +import com.ruoyi.system.api.feignClient.SysUserRoleClient; +import com.ruoyi.system.api.model.*; +import org.springframework.stereotype.Component; + +import java.util.List; + +@Component +public class SysUserRoleFallbackFactory implements org.springframework.cloud.openfeign.FallbackFactory<SysUserRoleClient> { + @Override + public SysUserRoleClient create(Throwable cause) { + return new SysUserRoleClient(){ + + + @Override + public R<List<SysUserRoleVo>> getRoleByUserId(Long userId) { + return R.fail("根据用户id获取角色失败:" + cause.getMessage()); + } + }; + } +} diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/feignClient/SysUserRoleClient.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/feignClient/SysUserRoleClient.java new file mode 100644 index 0000000..c14542b --- /dev/null +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/feignClient/SysUserRoleClient.java @@ -0,0 +1,28 @@ +package com.ruoyi.system.api.feignClient; + +import com.ruoyi.common.core.constant.ServiceNameConstants; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.system.api.factory.SysUserRoleFallbackFactory; +import com.ruoyi.system.api.model.SysUserRoleVo; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.List; + +/** + * @author zhibing.pu + * @date 2024/9/4 9:49 + */ +@FeignClient(contextId = "SysUserRoleClient", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = SysUserRoleFallbackFactory.class) +public interface SysUserRoleClient { + + + /** + * 根据用户id获取角色 + * @param userId + * @return + */ + @PostMapping("/userRole/getRoleByUserId") + R<List<SysUserRoleVo>> getRoleByUserId(@RequestParam("userId") Long userId); +} diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/SysUserRoleVo.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/SysUserRoleVo.java new file mode 100644 index 0000000..9c850d1 --- /dev/null +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/model/SysUserRoleVo.java @@ -0,0 +1,49 @@ +package com.ruoyi.system.api.model; + +import com.baomidou.mybatisplus.annotation.TableField; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 用户和角色关联 sys_user_role + * + * @author ruoyi + */ +public class SysUserRoleVo +{ + /** 用户ID */ + @TableField("user_id") + private Long userId; + + /** 角色ID */ + @TableField("role_id") + private Long roleId; + + public Long getUserId() + { + return userId; + } + + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getRoleId() + { + return roleId; + } + + public void setRoleId(Long roleId) + { + this.roleId = roleId; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("userId", getUserId()) + .append("roleId", getRoleId()) + .toString(); + } +} diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java index 0cdb324..a7e58ab 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java @@ -463,7 +463,7 @@ * @param request */ @ResponseBody - @PostMapping(value = "/chargingOrderALICallback") + @PostMapping(value = "/chargingOrderStartupFailureWxRefund") public void chargingOrderStartupFailureWxRefund(HttpServletRequest request){ WxRefundNotifyResp data = wxPaymentClient.refundNotify(request).getData(); if(null != data){ diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java index b992b12..371ad73 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TChargingOrderServiceImpl.java @@ -1061,6 +1061,11 @@ } @Override + public R payRefund(PayOrderRefundDto payOrderQueryDto) { + return null; + } + + @Override public ChargingOrderListInfoVO chargingInfo(String uid) { TChargingOrder chargingOrder= this.getById(uid); -- Gitblit v1.7.1