| | |
| | | mallMemberBankMapper.deleteById(id); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse redBag() { |
| | | MallMember member = LoginUserUtil.getLoginUser(); |
| | | List<MallMoneyFlow> mallMoneyFlows = mallMoneyFlowMapper.selectByMemberIdAndTypeAndStatusAndDate(member.getId(), MoneyFlowTypeEnum.SCORE_POOL.getValue(), 1, new Date()); |
| | | if(CollUtil.isEmpty(mallMoneyFlows)){ |
| | | throw new FebsException("没有红包"); |
| | | } |
| | | BigDecimal amount = BigDecimal.ZERO; |
| | | for(MallMoneyFlow mallMoneyFlow : mallMoneyFlows){ |
| | | mallMoneyFlow.setStatus(2); |
| | | mallMoneyFlowMapper.updateById(mallMoneyFlow); |
| | | |
| | | amount = mallMoneyFlow.getAmount().abs(); |
| | | } |
| | | walletService.add(amount, member.getId(), "commission"); |
| | | walletService.reduce(amount.negate(), member.getId(), "score"); |
| | | return new FebsResponse().success().message("领取成功"); |
| | | } |
| | | } |