| | |
| | | public void withdrawal(WithdrawalDto withdrawalDto) { |
| | | Long memberId = LoginUserUtil.getLoginUser().getId(); |
| | | MallMember mallMember = mallMemberService.getById(memberId); |
| | | |
| | | Integer outsideWith = mallMember.getOutsideWith() == null ? 2 :mallMember.getOutsideWith(); |
| | | if (1 != outsideWith) { |
| | | throw new FebsException("功能升级中"); |
| | | } |
| | | |
| | | if (StrUtil.isBlank(mallMember.getTradePassword())) { |
| | | throw new FebsException("未设置支付密码"); |
| | | } |
| | |
| | | |
| | | //每日提现额度上限 |
| | | 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)); |
| | | } |
| | | } |