| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.util.mq.rabbit.RabbitmqManager; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Resource |
| | | private RocketMQManager rocketMQManager; |
| | | |
| | | @Resource |
| | | private HongBaoRecieveCMQManager hongBaoRecieveCMQManager; |
| | | |
| | | // 下级被封禁,红包失效 |
| | | private void invalidHongBaoForbidden(HongBaoV2 hongBaoV2) throws TeamRewardDebtException { |
| | | if (hongBaoV2.getState() == HongBaoV2.STATE_SHIXIAO || hongBaoV2.getState() == HongBaoV2.STATE_YILINGQU || hongBaoV2.getState() == HongBaoV2.STATE_LINGQUING) |
| | | return; |
| | | //如果在偿还里面就先偿还,然后再失效 |
| | | TeamRewardDebt debt = teamRewardDebtService.selectBySourceId(hongBaoV2.getId()); |
| | | if (debt != null && debt.getLeftMoney().compareTo(hongBaoV2.getMoney()) <= 0) { |
| | | if (debt != null &&debt.getLeftMoney().compareTo(new BigDecimal(0))>0 && debt.getLeftMoney().compareTo(hongBaoV2.getMoney()) <= 0) { |
| | | teamRewardDebtService.repayDebt(debt.getId(), hongBaoV2.getMoney(), "封禁失效,先偿还再失效"); |
| | | } |
| | | |
| | |
| | | public void inviteSettleVipShop(Long uid, Date maxPregetTime) throws OrderMoneySettleException { |
| | | // 查询UID的一二级邀请赚 |
| | | int sourceType = Constant.SOURCE_TYPE_VIP; |
| | | inviteSettle(uid, sourceType, maxPregetTime); |
| | | } |
| | | |
| | | @Override |
| | | public void inviteSettleDY(Long uid, Date maxPregetTime) throws OrderMoneySettleException { |
| | | // 查询UID的一二级邀请赚 |
| | | int sourceType = Constant.SOURCE_TYPE_DY; |
| | | inviteSettle(uid, sourceType, maxPregetTime); |
| | | } |
| | | |
| | |
| | | try { |
| | | invalidHongBaoForbidden(item); |
| | | } catch (TeamRewardDebtException e) { |
| | | e.printStackTrace(); |
| | | throw new OrderMoneySettleException(10, "偿还出错"); |
| | | } |
| | | hongBaoList.remove(i); |
| | |
| | | shareSettle(Constant.SOURCE_TYPE_SUNING, uid, maxPregetTime); |
| | | } |
| | | |
| | | @Override |
| | | public void shareSettleDY(Long uid, Date maxPregetTime) throws OrderMoneySettleException { |
| | | shareSettle(Constant.SOURCE_TYPE_DY, uid, maxPregetTime); |
| | | } |
| | | |
| | | private void shareSettle(int sourceType, Long uid, Date maxPregetTime) throws OrderMoneySettleException { |
| | | /** |
| | | * 处理分享赚 |
| | |
| | | hbIdList.add(v2.getId()); |
| | | accountDetailsHongBaoMapService.saveAccountDetailsHongBaoMap(v2.getId(), userMoneyDetail.getId()); |
| | | try { |
| | | HongBaoRecieveCMQManager.getInstance().addHongBaoRecieveMsg(v2.getId()); |
| | | hongBaoRecieveCMQManager.addHongBaoRecieveMsg(v2.getId()); |
| | | } catch (Exception e) { |
| | | LogHelper.errorDetailInfo(e); |
| | | } |
| | |
| | | for (Long hongBaoId : hbIdList) { |
| | | try { |
| | | if (Constant.ENABLE_MQ) |
| | | HongBaoRecieveCMQManager.getInstance().addHongBaoRecieveMsg(hongBaoId); |
| | | hongBaoRecieveCMQManager.addHongBaoRecieveMsg(hongBaoId); |
| | | } catch (Exception e) { |
| | | LogHelper.errorDetailInfo(e); |
| | | } |
| | |
| | | for (Long hongBaoId : recieveHongBaoIds) { |
| | | try { |
| | | if (Constant.ENABLE_MQ) |
| | | HongBaoRecieveCMQManager.getInstance().addHongBaoRecieveMsg(hongBaoId); |
| | | hongBaoRecieveCMQManager.addHongBaoRecieveMsg(hongBaoId); |
| | | } catch (Exception e) { |
| | | LogHelper.errorDetailInfo(e); |
| | | } |
| | |
| | | for (Long hongBaoId : recieveHongBaoIds) { |
| | | try { |
| | | if (Constant.ENABLE_MQ) |
| | | HongBaoRecieveCMQManager.getInstance().addHongBaoRecieveMsg(hongBaoId); |
| | | hongBaoRecieveCMQManager.addHongBaoRecieveMsg(hongBaoId); |
| | | } catch (Exception e) { |
| | | LogHelper.errorDetailInfo(e); |
| | | } |