会员充值 退款

This commit is contained in:
wangw 2025-03-07 11:24:38 +08:00
parent be47876412
commit 562fbf1695
3 changed files with 15 additions and 9 deletions

View File

@ -3,6 +3,8 @@ package com.czg.account.service;
import com.czg.account.entity.ShopUserFlow;
import com.mybatisflex.core.service.IService;
import java.math.BigDecimal;
/**
* 用户余额流水 服务层
*
@ -11,4 +13,5 @@ import com.mybatisflex.core.service.IService;
*/
public interface ShopUserFlowService extends IService<ShopUserFlow> {
void updateRefund(Long id, BigDecimal refundAmount);
}

View File

@ -3,9 +3,12 @@ package com.czg.service.account.service.impl;
import com.czg.account.entity.ShopUserFlow;
import com.czg.account.service.ShopUserFlowService;
import com.czg.service.account.mapper.ShopUserFlowMapper;
import com.mybatisflex.core.update.UpdateChain;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.apache.dubbo.config.annotation.DubboService;
import java.math.BigDecimal;
/**
* 用户余额流水 服务层实现
*
@ -15,4 +18,11 @@ import org.apache.dubbo.config.annotation.DubboService;
@DubboService
public class ShopUserFlowServiceImpl extends ServiceImpl<ShopUserFlowMapper, ShopUserFlow> implements ShopUserFlowService {
@Override
public void updateRefund(Long id, BigDecimal refundAmount) {
UpdateChain.of(ShopUserFlow.class)
.setRaw(ShopUserFlow::getRefundAmount, "refund_amount + " + refundAmount)
.eq(ShopUserFlow::getId, id)
.update();
}
}

View File

@ -471,16 +471,9 @@ public class PayServiceImpl implements PayService {
.build();
//更新会员余额 并生成流水
shopUserService.updateMoney(shopUser.getShopId(), shopUserMoneyEditDTO);
UpdateChain.of(ShopUserFlow.class)
.setRaw(ShopUserFlow::getRefundAmount, "refund_amount" + refPayParam.getRefAmount())
.eq(ShopUserFlow::getId, inFlow.getId())
.update();
userFlowService.updateRefund(inFlow.getId(), refPayParam.getRefAmount());
if (giftFlow != null) {
UpdateChain.of(ShopUserFlow.class)
.setRaw(ShopUserFlow::getRefundAmount, "refund_amount" + giftFlow.getAmount())
.eq(ShopUserFlow::getId, giftFlow.getId())
.update();
userFlowService.updateRefund( giftFlow.getId(), giftFlow.getAmount());
}
//移除优惠券
inRecordService.remove(QueryWrapper.create()