diff --git a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/core/domain/entity/SmUser.java b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/core/domain/entity/SmUser.java index 9326d081..08726f16 100644 --- a/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/core/domain/entity/SmUser.java +++ b/smart-switch-ruoyi/smart-switch-common/src/main/java/com/ruoyi/common/core/domain/entity/SmUser.java @@ -178,4 +178,12 @@ public class SmUser extends BaseEntity @JsonView(JsonViewProfile.App.class) @Size(max = 200, message = "限制提现原因长度不能超过200个字符") private String limitWithdrawReason; + + @Excel(name = "是否限制退款") + @ApiModelProperty("是否限制退款") + private Boolean limitRefund; + + @Excel(name = "限制退款原因") + @ApiModelProperty("限制退款原因") + private String limitRefundReason; } diff --git a/smart-switch-service/src/main/java/com/ruoyi/ss/user/mapper/SmUserMapper.xml b/smart-switch-service/src/main/java/com/ruoyi/ss/user/mapper/SmUserMapper.xml index 88aed127..7475b58d 100644 --- a/smart-switch-service/src/main/java/com/ruoyi/ss/user/mapper/SmUserMapper.xml +++ b/smart-switch-service/src/main/java/com/ruoyi/ss/user/mapper/SmUserMapper.xml @@ -47,6 +47,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" su.is_real, su.limit_withdraw, su.limit_withdraw_reason, + su.limit_refund, + su.limit_refund_reason, (select sum(stb.money) from sm_transaction_bill stb where stb.user_id = su.user_id and stb.type = '1' and stb.status = '2') as recharge_amount, (select sum(stb.arrival_amount) from sm_transaction_bill stb where stb.user_id = su.user_id and stb.type = '2' and stb.status = '14') as with_drawl_amount, (select sum(stb.arrival_amount) from sm_transaction_bill stb where stb.mch_id = su.user_id and stb.type = '1' and stb.status = '2') as total_income @@ -69,6 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and withdraw_service_type = #{withdrawServiceType} and service_type = #{serviceType} and limit_withdraw = #{limitWithdraw} + and limit_refund = #{limitRefund} and su.user_id in ( select sdt.tenant_id @@ -164,6 +167,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" is_real, limit_withdraw, limit_withdraw_reason, + limit_refund, + limit_refund_reason, #{userName}, @@ -199,6 +204,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{isReal}, #{limitWithdraw}, #{limitWithdrawReason}, + #{limitRefund}, + #{limitRefundReason}, @@ -244,6 +251,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" is_real = #{isReal}, limit_withdraw = #{limitWithdraw}, limit_withdraw_reason = #{limitWithdrawReason}, + limit_refund = #{limitRefund}, + limit_refund_reason = #{limitRefundReason}, where user_id = #{userId} diff --git a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppTransactionBillController.java b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppTransactionBillController.java index e37e8f11..a9411d5a 100644 --- a/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppTransactionBillController.java +++ b/smart-switch-web/src/main/java/com/ruoyi/web/controller/app/AppTransactionBillController.java @@ -22,6 +22,8 @@ import com.ruoyi.ss.transactionBill.service.TransactionAssembler; import com.ruoyi.ss.transactionBill.service.TransactionBillConverter; import com.ruoyi.ss.transactionBill.service.TransactionBillService; import com.ruoyi.ss.transactionBill.service.TransactionBillValidator; +import com.ruoyi.ss.user.domain.SmUserVo; +import com.ruoyi.ss.user.service.ISmUserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; @@ -64,6 +66,9 @@ public class AppTransactionBillController extends BaseController @Autowired private TransactionBillConverter transactionBillConverter; + @Autowired + private ISmUserService userService; + /** * 查询充值记录列表 */ @@ -236,9 +241,14 @@ public class AppTransactionBillController extends BaseController if (bill == null) { return error("订单不存在"); } - if (!Objects.equals(bill.getMchId(), getUserId())) { + Long userId = getUserId(); + if (!Objects.equals(bill.getMchId(), userId )) { return error("您无权操作退款"); } + SmUserVo user = userService.selectSmUserByUserId(userId); + if (user.getLimitRefund() != null && user.getLimitRefund()) { + return error("退款失败:" + user.getLimitRefundReason()); + } LoginUser loginUser = getLoginUser(); dto.setUserName(loginUser.getUsername()); dto.setUserType(loginUser.getLoginType().getType());