cxw #17

Merged
root merged 4 commits from cxw into master 2024-09-25 17:07:28 +08:00
6 changed files with 58 additions and 4 deletions
Showing only changes of commit 3909ce665e - Show all commits

View File

@ -24,3 +24,8 @@ export const getWallet = async (params: PayWalletUserReqVO) => {
export const getWalletPage = async (params) => {
return await request.get({ url: `/pay/wallet/page`, params })
}
// 修改会员钱包余额
export const updateWalletBalance = async (data: any) => {
return await request.post({ url: `/pay/wallet/update`, data })
}

View File

@ -196,6 +196,8 @@
<UserLevelUpdateForm ref="updateLevelFormRef" @success="getList" />
<!-- 修改用户积分弹窗 -->
<UserPointUpdateForm ref="updatePointFormRef" @success="getList" />
<!-- 修改用户余额弹窗 -->
<UserBalanceUpdateForm ref="updateBalanceFormRef" @success="getList" />
<!-- 发送优惠券弹窗 -->
<CouponSendForm ref="couponSendFormRef" />
</template>
@ -209,6 +211,7 @@ import MemberLevelSelect from '@/views/member/level/components/MemberLevelSelect
import MemberGroupSelect from '@/views/member/group/components/MemberGroupSelect.vue'
import UserLevelUpdateForm from './UserLevelUpdateForm.vue'
import UserPointUpdateForm from './UserPointUpdateForm.vue'
import UserBalanceUpdateForm from './UserBalanceUpdateForm.vue'
import { CouponSendForm } from '@/views/mall/promotion/coupon/components'
import { checkPermi } from '@/utils/permission'
@ -233,6 +236,7 @@ const queryParams = reactive({
const queryFormRef = ref() //
const updateLevelFormRef = ref() //
const updatePointFormRef = ref() //
const updateBalanceFormRef = ref() //
const selectedIds = ref<number[]>([]) // ID
/** 查询列表 */
@ -299,7 +303,7 @@ const handleCommand = (command: string, row: UserApi.UserVO) => {
updatePointFormRef.value.open(row.id)
break
case 'handleUpdateBlance':
// todo @jason
updateBalanceFormRef.value.open(row.id)
break
default:
break

View File

@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletPageReqVO;
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletRespVO;
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletUserBalanceVo;
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletUserReqVO;
import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletConvert;
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
@ -13,9 +14,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
@ -41,6 +40,14 @@ public class PayWalletController {
return success(PayWalletConvert.INSTANCE.convert02(wallet));
}
@PostMapping("/update")
@PreAuthorize("@ss.hasPermission('pay:wallet:update')")
@Operation(summary = "修改用户钱包余额")
public CommonResult<Boolean> updateWallet(@Valid @RequestBody PayWalletUserBalanceVo reqVo){
payWalletService.updateWallet(reqVo);
return success(true);
}
@GetMapping("/page")
@Operation(summary = "获得会员钱包分页")
@PreAuthorize("@ss.hasPermission('pay:wallet:query')")

View File

@ -0,0 +1,16 @@
package cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Schema(description = "管理后台 - 用户修改余额 Request VO")
@Data
public class PayWalletUserBalanceVo {
@Schema(description = "钱包编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long id;
@Schema(description = "余额", requiredMode = Schema.RequiredMode.REQUIRED)
private Integer balance;
}

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.pay.service.wallet;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletPageReqVO;
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletUserBalanceVo;
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum;
@ -97,4 +98,10 @@ public interface PayWalletService {
*/
void unfreezePrice(Long id, Integer price);
/**
* 修改钱包余额
* @param reqVo
* @return void
*/
void updateWallet(PayWalletUserBalanceVo reqVo);
}

View File

@ -2,7 +2,9 @@ package cn.iocoder.yudao.module.pay.service.wallet;
import cn.hutool.core.lang.Assert;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletPageReqVO;
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletUserBalanceVo;
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO;
import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO;
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
@ -205,4 +207,17 @@ public class PayWalletServiceImpl implements PayWalletService {
}
}
@Override
public void updateWallet(PayWalletUserBalanceVo reqVo) {
if(reqVo.getBalance() == 0){
return;
}
PayWalletDO walletDO = walletMapper.selectById(reqVo.getId());
int totalBalance = walletDO.getBalance() + reqVo.getBalance();
int totalRecharge = walletDO.getTotalRecharge() + reqVo.getBalance();
walletDO.setBalance(totalBalance);
walletDO.setTotalRecharge(totalRecharge);
walletMapper.updateById(walletDO);
}
}