From 8c272b245e961c8ad22737da18f893e0a02cc993 Mon Sep 17 00:00:00 2001 From: "autumn.g@foxmail.com" Date: Tue, 28 Nov 2023 14:07:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=A1=E5=90=AF=E5=8A=A8=E5=85=85=E7=94=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/MemberBasicInfoServiceImpl.java | 14 +++++++++----- .../service/impl/OrderBasicInfoServiceImpl.java | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/MemberBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/MemberBasicInfoServiceImpl.java index a3a58c351..8f099aa51 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/MemberBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/MemberBasicInfoServiceImpl.java @@ -382,19 +382,23 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService { } try { - BigDecimal totalAccountAmount = BigDecimal.ZERO; + // BigDecimal totalAccountAmount = BigDecimal.ZERO; BigDecimal principalBalance = BigDecimal.ZERO; BigDecimal giftBalance = BigDecimal.ZERO; MemberWalletInfo memberWalletInfo = memberWalletInfoService.selectByMemberId(memberId, merchantId); if (memberWalletInfo != null) { - totalAccountAmount = memberWalletInfo.getPrincipalBalance(); - principalBalance = memberWalletInfo.getPrincipalBalance(); - giftBalance = memberWalletInfo.getGiftBalance(); + if (memberWalletInfo.getPrincipalBalance() != null) { + principalBalance = memberWalletInfo.getPrincipalBalance(); + } + if (memberWalletInfo.getGiftBalance() != null) { + giftBalance = memberWalletInfo.getGiftBalance(); + } + // totalAccountAmount = memberWalletInfo.getPrincipalBalance(); vo.setMerchantId(memberWalletInfo.getMerchantId()); } - vo.setTotalAccountAmount(totalAccountAmount); vo.setPrincipalBalance(principalBalance); vo.setGiftBalance(giftBalance); + vo.setTotalAccountAmount(vo.getPrincipalBalance().add(vo.getGiftBalance())); } catch (Exception e) { log.error("查询用户余额异常 memberId:{}, merchantId:{}", memberId, merchantId, e); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java index e66daa536..8afae4b79 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java @@ -31,7 +31,6 @@ import com.jsowell.common.enums.ykc.*; import com.jsowell.common.exception.BusinessException; import com.jsowell.common.util.DateUtils; import com.jsowell.common.util.PageUtils; -import com.jsowell.common.util.SecurityUtils; import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.bean.BeanUtils; import com.jsowell.common.util.id.IdUtils; @@ -2376,12 +2375,13 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService { payMode = OrderPayModeEnum.PAYMENT_OF_WHITELIST.getValue(); } else { // 通过memberId获取账户余额 - MemberVO memberVO = memberBasicInfoService.queryMemberInfoByMemberId(dto.getMemberId()); + MemberVO memberVO = memberBasicInfoService.queryMemberInfoByMemberId(dto.getMemberId(), pileBasicInfo.getMerchantId() + ""); if (memberVO == null) { throw new BusinessException(ReturnCodeEnum.CODE_GET_MEMBER_ACCOUNT_AMOUNT_ERROR); } accountBalance = memberVO.getTotalAccountAmount(); if (accountBalance.compareTo(BigDecimal.ZERO) <= 0) { + logger.info("充电桩主动申请启动充电生成订单 余额不足", JSON.toJSONString(dto)); throw new BusinessException(ReturnCodeEnum.CODE_BALANCE_IS_INSUFFICIENT); } payMode = OrderPayModeEnum.PAYMENT_OF_BALANCE.getValue();