update 可提现金额减去当天申请金额

This commit is contained in:
Guoqs
2025-11-18 14:05:26 +08:00
parent e93948ddf3
commit 392b3e74a5

View File

@@ -683,18 +683,26 @@ public class AdapayService {
// 在途金额
BigDecimal pendingAmount = BigDecimal.ZERO;
BigDecimal todayWithdrawalAmount = BigDecimal.ZERO;
List<WithdrawInfoVO> withdrawInfoVOS = clearingWithdrawInfoService.selectByMerchantId(merchantId);
log.info("==查询提现在途金额param:{}, result:{}", JSON.toJSONString(withdrawInfoVOS), JSON.toJSONString(pendingAmount));
// log.info("==查询提现在途金额param:{}, result:{}", JSON.toJSONString(withdrawInfoVOS), JSON.toJSONString(pendingAmount));
if (CollectionUtils.isNotEmpty(withdrawInfoVOS)) {
pendingAmount = withdrawInfoVOS.stream()
.filter(item -> Constants.ZERO.equals(item.getStatusDesc()))
.map(WithdrawInfoVO::getCashAmt)
.reduce(BigDecimal.ZERO, BigDecimal::add);
// 查询今天的提现金额
for (WithdrawInfoVO withdrawInfoVO : withdrawInfoVOS) {
// 如果applicationTime在当天则加到todayWithdrawalAmount中
if (DateUtils.isToday(withdrawInfoVO.getApplicationTime())) {
todayWithdrawalAmount = todayWithdrawalAmount.add(withdrawInfoVO.getCashAmt());
}
}
}
vo.setPendingAmount(pendingAmount);
// 查询今天的提现金额
BigDecimal todayWithdrawalAmount = clearingWithdrawInfoService.queryTodayWithdrawalAmount(merchantId);
// BigDecimal todayWithdrawalAmount = clearingWithdrawInfoService.queryTodayWithdrawalAmount(merchantId);
// 如果大于0则重新更新LastAvlBalance
if (todayWithdrawalAmount.compareTo(BigDecimal.ZERO) > 0) {
vo.setLastAvlBalance(BigDecimal.ZERO.max(vo.getLastAvlBalance().subtract(todayWithdrawalAmount)));