| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | |
| | | @Service |
| | | public class OrderMoneySettleServiceImpl implements OrderMoneySettleService { |
| | | |
| | | Logger logger = LoggerFactory.getLogger(OrderMoneySettleService.class); |
| | | |
| | | @Resource |
| | | private HongBaoV2Mapper hongBaoV2Mapper; |
| | |
| | | |
| | | private void fanliInvite(List<HongBaoV2> hongBaoList, Long uid, int sourceType, String key, Date maxPreGetTime) |
| | | throws TeamEincomeRecordException, ParamsException, TeamRewardDebtException { |
| | | logger.info("邀请奖金预到账:uid-{} sourceType-{} key-{}", new Object[]{uid, sourceType, key}); |
| | | List<Long> hbIdList = new ArrayList<>(); |
| | | BigDecimal invitemoney = new BigDecimal(0); |
| | | Set<String> inviteOrders = new HashSet<>(); |
| | |
| | | continue; |
| | | hongBao = hongBaoV2Mapper.selectByPrimaryKeyForUpdate(hongBao.getId()); |
| | | if (hongBao.getState() == HongBaoV2.STATE_BUKELINGQU || hongBao.getState() == HongBaoV2.STATE_KELINGQU) { |
| | | logger.info("邀请奖金预到账-每个红包-到账开始:hongbaoid-{}", hongBao.getId()); |
| | | TeamRewardDebt debt = teamRewardDebtService.selectBySourceId(hongBao.getId()); |
| | | BigDecimal money = hongBao.getMoney(); |
| | | if (debt != null && debt.getLeftMoney().compareTo(new BigDecimal(0)) > 0 |
| | |
| | | money = money.subtract(debt.getLeftMoney()); |
| | | // 还钱 |
| | | teamRewardDebtService.repayDebt(debt.getId(), debt.getLeftMoney(), null); |
| | | logger.info("邀请奖金预到账-每个红包-还款:hongbaoid-{} debtId-{} debtMoney-{}", new Object[]{hongBao.getId(), debt.getId(), debt.getLeftMoney()}); |
| | | } |
| | | |
| | | logger.info("邀请奖金预到账-每个红包:hongbaoid-{} money-{}", new Object[]{hongBao.getId(), money}); |
| | | invitemoney = invitemoney.add(money); |
| | | HongBaoV2 updateHongBao = new HongBaoV2(); |
| | | updateHongBao.setId(hongBao.getId()); |
| | |
| | | hbIdList.add(hongBao.getId()); |
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByHongBaoId(hongBao.getParent().getId()); |
| | | inviteOrders.add(hongBaoOrder.getCommonOrder().getOrderNo()); |
| | | logger.info("邀请奖金预到账-每个红包-到账成功:hongbaoid-{}", hongBao.getId()); |
| | | } |
| | | } |
| | | |
| | |
| | | if (invitemoney.compareTo(new BigDecimal(0)) > 0) { |
| | | // 获取当前的月份 |
| | | teamRewardManager.addToEincome(uid, maxPreGetTime, invitemoney, sourceType); |
| | | logger.info("邀请奖金预到账-添加到团队收益成功:uid-{} day-{} money-{} sourceType-{}", new Object[]{uid, maxPreGetTime, invitemoney, sourceType}); |
| | | } |
| | | |
| | | hongBaoV2SettleTempService.addTemp(hbIdList, key); |