From a8131f63b4192061426f7b8649eb8bee87bdf17c Mon Sep 17 00:00:00 2001 From: caiyuchao Date: Fri, 10 Jan 2025 16:30:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Ddashboard=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/wfc/user/service/impl/UAccountServiceImpl.java | 4 ++-- .../java/org/wfc/user/service/impl/UOrderServiceImpl.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wfc-modules/wfc-user/src/main/java/org/wfc/user/service/impl/UAccountServiceImpl.java b/wfc-modules/wfc-user/src/main/java/org/wfc/user/service/impl/UAccountServiceImpl.java index 1d26fd0..ad9af2d 100644 --- a/wfc-modules/wfc-user/src/main/java/org/wfc/user/service/impl/UAccountServiceImpl.java +++ b/wfc-modules/wfc-user/src/main/java/org/wfc/user/service/impl/UAccountServiceImpl.java @@ -246,8 +246,8 @@ public class UAccountServiceImpl extends ServiceImpl i BeanUtils.copyProperties(account, dashboardVo); dashboardVo.setId(loginUser.getUserid()); dashboardVo.setActivity(0L); - BigDecimal balanceUsed = Optional.of(account.getBalanceUsed()).orElse(BigDecimal.ZERO); - BigDecimal balance = Optional.of(dashboardVo.getBalance()).orElse(BigDecimal.ZERO); + BigDecimal balanceUsed = Optional.ofNullable(account.getBalanceUsed()).orElse(BigDecimal.ZERO); + BigDecimal balance = Optional.ofNullable(dashboardVo.getBalance()).orElse(BigDecimal.ZERO); if (balance.compareTo(balanceUsed) >= 0) { dashboardVo.setBalance(balance.subtract(balanceUsed)); } else { diff --git a/wfc-modules/wfc-user/src/main/java/org/wfc/user/service/impl/UOrderServiceImpl.java b/wfc-modules/wfc-user/src/main/java/org/wfc/user/service/impl/UOrderServiceImpl.java index 38f3c02..6db857b 100644 --- a/wfc-modules/wfc-user/src/main/java/org/wfc/user/service/impl/UOrderServiceImpl.java +++ b/wfc-modules/wfc-user/src/main/java/org/wfc/user/service/impl/UOrderServiceImpl.java @@ -90,7 +90,7 @@ public class UOrderServiceImpl extends ServiceImpl impleme } else if (OrderTypeEnum.RECHARGE.getCode().equals(order.getType())) { // 充值 // 更新账户余额 - account.setBalance(order.getOrderAmount().add(Optional.of(account.getBalance()).orElse(BigDecimal.ZERO))); + account.setBalance(order.getOrderAmount().add(Optional.ofNullable(account.getBalance()).orElse(BigDecimal.ZERO))); } account.setId(accountId); accountService.saveOrUpdate(account);