xiaoyong931011
2023-04-17 d12a748a4c598972271ddc46bde8167f9113879c
每日最大限额
1 files modified
7 ■■■■ changed files
src/main/java/cc/mrbird/febs/mall/service/impl/MallMemberWithdrawServiceImpl.java 7 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/impl/MallMemberWithdrawServiceImpl.java
@@ -69,9 +69,14 @@
        //每日提现额度上限
        BigDecimal allCashOut = cashOutSettingVo.getAllCashOut();
        if(withdrawalDto.getAmount().compareTo(allCashOut) > 0){
            throw new FebsException("每日限额为"+cashOutSettingVo.getAllCashOut().setScale(2,BigDecimal.ROUND_DOWN));
        }
        List<MallMemberWithdraw> mallMemberWithdrawListDone = this.baseMapper.selectListByMemberIdAndDate(memberId,new Date());
        if(CollUtil.isNotEmpty(mallMemberWithdrawListDone)){
            if (withdrawalDto.getAmount().compareTo(allCashOut) >= 0) {
            BigDecimal amountTCAll = mallMemberWithdrawListDone.stream().map(MallMemberWithdraw::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
            amountTCAll = amountTCAll.add(withdrawalDto.getAmount());
            if (amountTCAll.compareTo(allCashOut) > 0) {
                throw new FebsException("每日限额为"+cashOutSettingVo.getAllCashOut().setScale(2,BigDecimal.ROUND_DOWN));
            }
        }