From 3909ce665e9449bb3ace9477113bc071dab8f864 Mon Sep 17 00:00:00 2001
From: XinWei <2718030729@qq.com>
Date: Wed, 25 Sep 2024 14:24:12 +0800
Subject: [PATCH 1/3] =?UTF-8?q?=E5=90=8E=E5=8F=B0-=E4=BF=AE=E6=94=B9?=
=?UTF-8?q?=E4=BD=99=E9=A2=9D=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/api/pay/wallet/balance/index.ts | 5 +++++
yudao-admin-vue3/src/views/member/user/index.vue | 6 +++++-
.../admin/wallet/PayWalletController.java | 13 ++++++++++---
.../wallet/vo/wallet/PayWalletUserBalanceVo.java | 16 ++++++++++++++++
.../pay/service/wallet/PayWalletService.java | 7 +++++++
.../pay/service/wallet/PayWalletServiceImpl.java | 15 +++++++++++++++
6 files changed, 58 insertions(+), 4 deletions(-)
create mode 100644 yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletUserBalanceVo.java
diff --git a/yudao-admin-vue3/src/api/pay/wallet/balance/index.ts b/yudao-admin-vue3/src/api/pay/wallet/balance/index.ts
index 3e5ab36..a3ba07f 100644
--- a/yudao-admin-vue3/src/api/pay/wallet/balance/index.ts
+++ b/yudao-admin-vue3/src/api/pay/wallet/balance/index.ts
@@ -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 })
+}
diff --git a/yudao-admin-vue3/src/views/member/user/index.vue b/yudao-admin-vue3/src/views/member/user/index.vue
index 69bf6de..7d61e31 100644
--- a/yudao-admin-vue3/src/views/member/user/index.vue
+++ b/yudao-admin-vue3/src/views/member/user/index.vue
@@ -196,6 +196,8 @@
+
+
@@ -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([]) // 表格的选中 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
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java
index 61a4360..e83d994 100644
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java
+++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java
@@ -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 updateWallet(@Valid @RequestBody PayWalletUserBalanceVo reqVo){
+ payWalletService.updateWallet(reqVo);
+ return success(true);
+ }
+
@GetMapping("/page")
@Operation(summary = "获得会员钱包分页")
@PreAuthorize("@ss.hasPermission('pay:wallet:query')")
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletUserBalanceVo.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletUserBalanceVo.java
new file mode 100644
index 0000000..50f61de
--- /dev/null
+++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletUserBalanceVo.java
@@ -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;
+}
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java
index 358d149..b75d8f9 100644
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java
+++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java
@@ -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);
}
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java
index 63637ef..de7dad4 100644
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java
+++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java
@@ -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);
+ }
+
}
From cc6370087214adf097e9ad3de5e81b3cb63bfc74 Mon Sep 17 00:00:00 2001
From: XinWei <2718030729@qq.com>
Date: Wed, 25 Sep 2024 14:58:50 +0800
Subject: [PATCH 2/3] =?UTF-8?q?=E5=90=8E=E5=8F=B0-=E4=BF=AE=E6=94=B9?=
=?UTF-8?q?=E4=BD=99=E9=A2=9D=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../admin/wallet/vo/wallet/PayWalletUserBalanceVo.java | 3 ++-
.../module/pay/service/wallet/PayWalletServiceImpl.java | 9 ++++++---
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletUserBalanceVo.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletUserBalanceVo.java
index 50f61de..dc939a0 100644
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletUserBalanceVo.java
+++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/wallet/PayWalletUserBalanceVo.java
@@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
@Schema(description = "管理后台 - 用户修改余额 Request VO")
@@ -12,5 +13,5 @@ public class PayWalletUserBalanceVo {
@Schema(description = "钱包编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Long id;
@Schema(description = "余额", requiredMode = Schema.RequiredMode.REQUIRED)
- private Integer balance;
+ private BigDecimal balance;
}
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java
index de7dad4..43366f4 100644
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java
+++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java
@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
+import java.math.BigDecimal;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
@@ -209,12 +210,14 @@ public class PayWalletServiceImpl implements PayWalletService {
@Override
public void updateWallet(PayWalletUserBalanceVo reqVo) {
- if(reqVo.getBalance() == 0){
+ if(reqVo.getBalance().compareTo(BigDecimal.ZERO) == 0){
return;
}
+ BigDecimal change = new BigDecimal("100");
PayWalletDO walletDO = walletMapper.selectById(reqVo.getId());
- int totalBalance = walletDO.getBalance() + reqVo.getBalance();
- int totalRecharge = walletDO.getTotalRecharge() + reqVo.getBalance();
+ int changeBalance = (reqVo.getBalance().multiply(change)).intValue();
+ int totalBalance = walletDO.getBalance() + changeBalance;
+ int totalRecharge = walletDO.getTotalRecharge() + changeBalance;
walletDO.setBalance(totalBalance);
walletDO.setTotalRecharge(totalRecharge);
walletMapper.updateById(walletDO);
From 268bc18530d4498ebbead89869b618ce3442a46f Mon Sep 17 00:00:00 2001
From: XinWei <2718030729@qq.com>
Date: Wed, 25 Sep 2024 17:05:46 +0800
Subject: [PATCH 3/3] =?UTF-8?q?=E5=90=8E=E5=8F=B0-=E4=BF=AE=E6=94=B9?=
=?UTF-8?q?=E4=BD=99=E9=A2=9D=E5=8A=9F=E8=83=BD=E5=AD=98=E5=85=A5=E9=92=B1?=
=?UTF-8?q?=E5=8C=85=E6=B5=81=E6=B0=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../module/pay/enums/ErrorCodeConstants.java | 3 ++
.../enums/wallet/PayWalletBizTypeEnum.java | 3 +-
.../admin/wallet/PayWalletController.java | 2 +-
.../pay/service/wallet/PayWalletService.java | 2 +-
.../service/wallet/PayWalletServiceImpl.java | 34 ++++++++++++++-----
5 files changed, 33 insertions(+), 11 deletions(-)
diff --git a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/ErrorCodeConstants.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/ErrorCodeConstants.java
index 8b7a38e..352ce60 100644
--- a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/ErrorCodeConstants.java
+++ b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/ErrorCodeConstants.java
@@ -47,6 +47,7 @@ public interface ErrorCodeConstants {
ErrorCode WALLET_REFUND_EXIST = new ErrorCode(1_007_007_003, "已经存在钱包退款");
ErrorCode WALLET_FREEZE_PRICE_NOT_ENOUGH = new ErrorCode(1_007_007_004, "钱包冻结余额不足");
+
// ========== 钱包充值模块 1-007-008-000 ==========
ErrorCode WALLET_RECHARGE_NOT_FOUND = new ErrorCode(1_007_008_000, "钱包充值记录不存在");
ErrorCode WALLET_RECHARGE_UPDATE_PAID_STATUS_NOT_UNPAID = new ErrorCode(1_007_008_001, "钱包充值更新支付状态失败,钱包充值记录不是【未支付】状态");
@@ -62,6 +63,8 @@ public interface ErrorCodeConstants {
ErrorCode WALLET_RECHARGE_PACKAGE_NOT_FOUND = new ErrorCode(1_007_008_011, "钱包充值套餐不存在");
ErrorCode WALLET_RECHARGE_PACKAGE_IS_DISABLE = new ErrorCode(1_007_008_012, "钱包充值套餐已禁用");
ErrorCode WALLET_RECHARGE_PACKAGE_NAME_EXISTS = new ErrorCode(1_007_008_013, "钱包充值套餐名称已存在");
+ ErrorCode WALLET_RECHARGE_RANGE_EXCEPTION = new ErrorCode(1_007_007_004, "充值后余额异常");
+
// ========== 转账模块 1-007-009-000 ==========
ErrorCode PAY_TRANSFER_SUBMIT_CHANNEL_ERROR = new ErrorCode(1_007_009_000, "发起转账报错,错误码:{},错误提示:{}");
diff --git a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/wallet/PayWalletBizTypeEnum.java b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/wallet/PayWalletBizTypeEnum.java
index 20e0a8b..a8937fb 100644
--- a/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/wallet/PayWalletBizTypeEnum.java
+++ b/yudao-module-pay/yudao-module-pay-api/src/main/java/cn/iocoder/yudao/module/pay/enums/wallet/PayWalletBizTypeEnum.java
@@ -18,7 +18,8 @@ public enum PayWalletBizTypeEnum implements IntArrayValuable {
RECHARGE(1, "充值"),
RECHARGE_REFUND(2, "充值退款"),
PAYMENT(3, "支付"),
- PAYMENT_REFUND(4, "支付退款");
+ PAYMENT_REFUND(4, "支付退款"),
+ ADMIN_MODIFY(5, "管理员修改");
// TODO 后续增加
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java
index e83d994..cf08e42 100644
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java
+++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/PayWalletController.java
@@ -42,7 +42,7 @@ public class PayWalletController {
@PostMapping("/update")
@PreAuthorize("@ss.hasPermission('pay:wallet:update')")
- @Operation(summary = "修改用户钱包余额")
+ @Operation(summary = "修改用户钱包余额(后台操作)")
public CommonResult updateWallet(@Valid @RequestBody PayWalletUserBalanceVo reqVo){
payWalletService.updateWallet(reqVo);
return success(true);
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java
index b75d8f9..db5b784 100644
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java
+++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletService.java
@@ -99,7 +99,7 @@ public interface PayWalletService {
void unfreezePrice(Long id, Integer price);
/**
- * 修改钱包余额
+ * 修改钱包余额(后台操作)
* @param reqVo
* @return void
*/
diff --git a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java
index 43366f4..1a011fb 100644
--- a/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java
+++ b/yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/wallet/PayWalletServiceImpl.java
@@ -35,7 +35,7 @@ import static cn.iocoder.yudao.module.pay.enums.wallet.PayWalletBizTypeEnum.PAYM
*/
@Service
@Slf4j
-public class PayWalletServiceImpl implements PayWalletService {
+public class PayWalletServiceImpl implements PayWalletService {
@Resource
private PayWalletMapper walletMapper;
@@ -105,7 +105,7 @@ public class PayWalletServiceImpl implements PayWalletService {
/**
* 校验是否能退款
*
- * @param refundId 支付退款单 id
+ * @param refundId 支付退款单 id
* @param walletPayNo 钱包支付 no
*/
private Long validateWalletCanRefund(Long refundId, String walletPayNo) {
@@ -210,17 +210,35 @@ public class PayWalletServiceImpl implements PayWalletService {
@Override
public void updateWallet(PayWalletUserBalanceVo reqVo) {
- if(reqVo.getBalance().compareTo(BigDecimal.ZERO) == 0){
+ // 如果
+ if (reqVo.getBalance().compareTo(BigDecimal.ZERO) == 0) {
return;
}
+ // 把单位从元转为分
BigDecimal change = new BigDecimal("100");
+ // 查出对应钱包信息
PayWalletDO walletDO = walletMapper.selectById(reqVo.getId());
- int changeBalance = (reqVo.getBalance().multiply(change)).intValue();
- int totalBalance = walletDO.getBalance() + changeBalance;
- int totalRecharge = walletDO.getTotalRecharge() + changeBalance;
- walletDO.setBalance(totalBalance);
- walletDO.setTotalRecharge(totalRecharge);
+ if (reqVo.getBalance().compareTo(new BigDecimal("21474836.47")) > 0) {
+ throw exception(WALLET_RECHARGE_RANGE_EXCEPTION);
+ }
+ // 总共改变的金额
+ long changeBalance = (reqVo.getBalance().multiply(change)).longValue();
+ // 总余额
+ long totalBalance = walletDO.getBalance() + changeBalance;
+ // 总充值
+ long totalRecharge = walletDO.getTotalRecharge() + changeBalance;
+ if (totalBalance > 2147483647 || totalRecharge > 2147483647 || totalBalance < 0 || totalRecharge < 0) {
+ throw exception(WALLET_RECHARGE_RANGE_EXCEPTION);
+ }
+ walletDO.setBalance((int) totalBalance);
+ walletDO.setTotalRecharge((int) totalRecharge);
walletMapper.updateById(walletDO);
+ String title = "后台操作给用户" + (totalBalance > 0 ? "增加" : "减少") + "余额" + Math.abs(changeBalance)/100.0 + "元";
+ WalletTransactionCreateReqBO transactionCreateReqBO = new WalletTransactionCreateReqBO()
+ .setWalletId(reqVo.getId()).setPrice((int) changeBalance).setBalance((int) totalBalance)
+ .setBizType(PayWalletBizTypeEnum.ADMIN_MODIFY.getType()).setBizId("0").setTitle(title);
+ walletTransactionService.createWalletTransaction(transactionCreateReqBO);
+
}
}