cxw #17
@ -24,3 +24,8 @@ export const getWallet = async (params: PayWalletUserReqVO) => {
|
|||||||
export const getWalletPage = async (params) => {
|
export const getWalletPage = async (params) => {
|
||||||
return await request.get({ url: `/pay/wallet/page`, 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 })
|
||||||
|
}
|
||||||
|
@ -196,6 +196,8 @@
|
|||||||
<UserLevelUpdateForm ref="updateLevelFormRef" @success="getList" />
|
<UserLevelUpdateForm ref="updateLevelFormRef" @success="getList" />
|
||||||
<!-- 修改用户积分弹窗 -->
|
<!-- 修改用户积分弹窗 -->
|
||||||
<UserPointUpdateForm ref="updatePointFormRef" @success="getList" />
|
<UserPointUpdateForm ref="updatePointFormRef" @success="getList" />
|
||||||
|
<!-- 修改用户余额弹窗 -->
|
||||||
|
<UserBalanceUpdateForm ref="updateBalanceFormRef" @success="getList" />
|
||||||
<!-- 发送优惠券弹窗 -->
|
<!-- 发送优惠券弹窗 -->
|
||||||
<CouponSendForm ref="couponSendFormRef" />
|
<CouponSendForm ref="couponSendFormRef" />
|
||||||
</template>
|
</template>
|
||||||
@ -209,6 +211,7 @@ import MemberLevelSelect from '@/views/member/level/components/MemberLevelSelect
|
|||||||
import MemberGroupSelect from '@/views/member/group/components/MemberGroupSelect.vue'
|
import MemberGroupSelect from '@/views/member/group/components/MemberGroupSelect.vue'
|
||||||
import UserLevelUpdateForm from './UserLevelUpdateForm.vue'
|
import UserLevelUpdateForm from './UserLevelUpdateForm.vue'
|
||||||
import UserPointUpdateForm from './UserPointUpdateForm.vue'
|
import UserPointUpdateForm from './UserPointUpdateForm.vue'
|
||||||
|
import UserBalanceUpdateForm from './UserBalanceUpdateForm.vue'
|
||||||
import { CouponSendForm } from '@/views/mall/promotion/coupon/components'
|
import { CouponSendForm } from '@/views/mall/promotion/coupon/components'
|
||||||
import { checkPermi } from '@/utils/permission'
|
import { checkPermi } from '@/utils/permission'
|
||||||
|
|
||||||
@ -233,6 +236,7 @@ const queryParams = reactive({
|
|||||||
const queryFormRef = ref() // 搜索的表单
|
const queryFormRef = ref() // 搜索的表单
|
||||||
const updateLevelFormRef = ref() // 修改会员等级表单
|
const updateLevelFormRef = ref() // 修改会员等级表单
|
||||||
const updatePointFormRef = ref() // 修改会员积分表单
|
const updatePointFormRef = ref() // 修改会员积分表单
|
||||||
|
const updateBalanceFormRef = ref() // 修改会员余额表单
|
||||||
const selectedIds = ref<number[]>([]) // 表格的选中 ID 数组
|
const selectedIds = ref<number[]>([]) // 表格的选中 ID 数组
|
||||||
|
|
||||||
/** 查询列表 */
|
/** 查询列表 */
|
||||||
@ -299,7 +303,7 @@ const handleCommand = (command: string, row: UserApi.UserVO) => {
|
|||||||
updatePointFormRef.value.open(row.id)
|
updatePointFormRef.value.open(row.id)
|
||||||
break
|
break
|
||||||
case 'handleUpdateBlance':
|
case 'handleUpdateBlance':
|
||||||
// todo @jason:增加一个【修改余额】
|
updateBalanceFormRef.value.open(row.id)
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
|
@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
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.PayWalletPageReqVO;
|
||||||
import cn.iocoder.yudao.module.pay.controller.admin.wallet.vo.wallet.PayWalletRespVO;
|
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.controller.admin.wallet.vo.wallet.PayWalletUserReqVO;
|
||||||
import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletConvert;
|
import cn.iocoder.yudao.module.pay.convert.wallet.PayWalletConvert;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
|
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 lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
@ -41,6 +40,14 @@ public class PayWalletController {
|
|||||||
return success(PayWalletConvert.INSTANCE.convert02(wallet));
|
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")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得会员钱包分页")
|
@Operation(summary = "获得会员钱包分页")
|
||||||
@PreAuthorize("@ss.hasPermission('pay:wallet:query')")
|
@PreAuthorize("@ss.hasPermission('pay:wallet:query')")
|
||||||
|
@ -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;
|
||||||
|
}
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.pay.service.wallet;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
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.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.PayWalletDO;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletTransactionDO;
|
||||||
import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum;
|
import cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum;
|
||||||
@ -97,4 +98,10 @@ public interface PayWalletService {
|
|||||||
*/
|
*/
|
||||||
void unfreezePrice(Long id, Integer price);
|
void unfreezePrice(Long id, Integer price);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改钱包余额
|
||||||
|
* @param reqVo
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
void updateWallet(PayWalletUserBalanceVo reqVo);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,9 @@ package cn.iocoder.yudao.module.pay.service.wallet;
|
|||||||
|
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
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.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.order.PayOrderExtensionDO;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO;
|
import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO;
|
||||||
import cn.iocoder.yudao.module.pay.dal.dataobject.wallet.PayWalletDO;
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user