mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-08-11 00:33:45 +08:00
修复刷卡/并充余额校验问题:余额不足默认充电金额时改用全部余额,而非直接拒绝启动充电
- ConfirmStartChargingRequestHandler: 云快充刷卡预校验,余额小于默认金额时降级为全部余额 - resolveBalanceChargeAmount: 订单生成共享校验方法,余额不足默认金额时降级为全部余额 - 并充生成订单: 同逻辑修复 - 扫码支付(NotDelayMerchant/DelayMerchant)不受影响,独立的余额校验逻辑保持不变
This commit is contained in:
@@ -317,7 +317,13 @@ public class ConfirmStartChargingRequestHandler extends AbstractYkcHandler {
|
|||||||
BigDecimal totalBalance = memberWalletVO.getTotalBalance() == null
|
BigDecimal totalBalance = memberWalletVO.getTotalBalance() == null
|
||||||
? BigDecimal.ZERO
|
? BigDecimal.ZERO
|
||||||
: memberWalletVO.getTotalBalance();
|
: memberWalletVO.getTotalBalance();
|
||||||
if (!ChargeAmountUtils.isPositive(chargeAmount) || totalBalance.compareTo(chargeAmount) < 0) {
|
// 账户余额小于默认充电金额时,使用全部余额
|
||||||
|
if (totalBalance.compareTo(chargeAmount) < 0) {
|
||||||
|
log.info("余额不足默认金额,使用全部余额, memberId:{}, chargeAmount:{}, totalBalance:{}",
|
||||||
|
memberWalletVO.getMemberId(), chargeAmount, totalBalance);
|
||||||
|
chargeAmount = totalBalance;
|
||||||
|
}
|
||||||
|
if (!ChargeAmountUtils.isPositive(chargeAmount)) {
|
||||||
log.info("余额不足, memberId:{}, chargeAmount:{}, totalBalance:{}",
|
log.info("余额不足, memberId:{}, chargeAmount:{}, totalBalance:{}",
|
||||||
memberWalletVO.getMemberId(), chargeAmount, totalBalance);
|
memberWalletVO.getMemberId(), chargeAmount, totalBalance);
|
||||||
return buildFailureResult("03");
|
return buildFailureResult("03");
|
||||||
|
|||||||
@@ -4730,7 +4730,13 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
|||||||
BigDecimal totalBalance = memberVO.getTotalBalance() == null
|
BigDecimal totalBalance = memberVO.getTotalBalance() == null
|
||||||
? BigDecimal.ZERO
|
? BigDecimal.ZERO
|
||||||
: memberVO.getTotalBalance();
|
: memberVO.getTotalBalance();
|
||||||
|
// 账户余额小于默认充电金额时,使用全部余额
|
||||||
if (totalBalance.compareTo(chargeAmount) < 0) {
|
if (totalBalance.compareTo(chargeAmount) < 0) {
|
||||||
|
logger.info("充电桩主动申请启动充电生成订单 余额不足默认金额,使用全部余额, memberId:{}, chargeAmount:{}, totalBalance:{}",
|
||||||
|
memberId, chargeAmount, totalBalance);
|
||||||
|
chargeAmount = totalBalance;
|
||||||
|
}
|
||||||
|
if (!ChargeAmountUtils.isPositive(chargeAmount)) {
|
||||||
logger.info("充电桩主动申请启动充电生成订单 余额不足, memberId:{}, chargeAmount:{}, totalBalance:{}",
|
logger.info("充电桩主动申请启动充电生成订单 余额不足, memberId:{}, chargeAmount:{}, totalBalance:{}",
|
||||||
memberId, chargeAmount, totalBalance);
|
memberId, chargeAmount, totalBalance);
|
||||||
throw new BusinessException(ReturnCodeEnum.CODE_BALANCE_IS_INSUFFICIENT);
|
throw new BusinessException(ReturnCodeEnum.CODE_BALANCE_IS_INSUFFICIENT);
|
||||||
@@ -6777,7 +6783,13 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
|||||||
BigDecimal totalBalance = memberWalletVO.getTotalBalance() == null
|
BigDecimal totalBalance = memberWalletVO.getTotalBalance() == null
|
||||||
? BigDecimal.ZERO
|
? BigDecimal.ZERO
|
||||||
: memberWalletVO.getTotalBalance();
|
: memberWalletVO.getTotalBalance();
|
||||||
if (!ChargeAmountUtils.isPositive(chargeAmount) || totalBalance.compareTo(chargeAmount) < 0) {
|
// 账户余额小于默认充电金额时,使用全部余额
|
||||||
|
if (totalBalance.compareTo(chargeAmount) < 0) {
|
||||||
|
logger.info("并充生成订单----余额不足默认金额,使用全部余额, memberId:{}, chargeAmount:{}, totalBalance:{}",
|
||||||
|
memberWalletVO.getMemberId(), chargeAmount, totalBalance);
|
||||||
|
chargeAmount = totalBalance;
|
||||||
|
}
|
||||||
|
if (!ChargeAmountUtils.isPositive(chargeAmount)) {
|
||||||
map.put("transactionCode", Constants.ILLEGAL_TRANSACTION_CODE);
|
map.put("transactionCode", Constants.ILLEGAL_TRANSACTION_CODE);
|
||||||
map.put("accountBalance", accountBalance);
|
map.put("accountBalance", accountBalance);
|
||||||
map.put("defeatReasonCode", "03");
|
map.put("defeatReasonCode", "03");
|
||||||
|
|||||||
Reference in New Issue
Block a user