限制退款

This commit is contained in:
墨大叔 2024-09-15 17:36:44 +08:00
parent 0c53e63ce3
commit af0a37eabe
3 changed files with 28 additions and 1 deletions

View File

@ -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;
}

View File

@ -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"
<if test="withdrawServiceType != null and withdrawServiceType != ''"> and withdraw_service_type = #{withdrawServiceType}</if>
<if test="serviceType != null and serviceType != ''"> and service_type = #{serviceType}</if>
<if test="limitWithdraw != null "> and limit_withdraw = #{limitWithdraw}</if>
<if test="limitRefund != null "> and limit_refund = #{limitRefund}</if>
<if test="tenantDeviceId != null">
and su.user_id in (
select sdt.tenant_id
@ -164,6 +167,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isReal != null">is_real,</if>
<if test="limitWithdraw != null">limit_withdraw,</if>
<if test="limitWithdrawReason != null">limit_withdraw_reason,</if>
<if test="limitRefund != null">limit_refund,</if>
<if test="limitRefundReason != null">limit_refund_reason,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userName != null and userName != ''">#{userName},</if>
@ -199,6 +204,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isReal != null">#{isReal},</if>
<if test="limitWithdraw != null">#{limitWithdraw},</if>
<if test="limitWithdrawReason != null">#{limitWithdrawReason},</if>
<if test="limitRefund != null">#{limitRefund},</if>
<if test="limitRefundReason != null">#{limitRefundReason},</if>
</trim>
</insert>
@ -244,6 +251,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isReal != null">is_real = #{isReal},</if>
<if test="limitWithdraw != null">limit_withdraw = #{limitWithdraw},</if>
<if test="limitWithdrawReason != null">limit_withdraw_reason = #{limitWithdrawReason},</if>
<if test="limitRefund != null">limit_refund = #{limitRefund},</if>
<if test="limitRefundReason != null">limit_refund_reason = #{limitRefundReason},</if>
</trim>
where user_id = #{userId}
</update>

View File

@ -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());