| | |
| | | HongBaoV2 oldHongBao = hongBaoV2Mapper.selectByPrimaryKeyForUpdate(hongBaoOrder.getHongBaoV2().getId());
|
| | | if (oldHongBao == null)
|
| | | throw new HongBaoException(10, "红包对象不存在");
|
| | | // 已经失效,已经领取,新老状态一致的红包不做处理
|
| | | if (oldHongBao.getState() == HongBaoV2.STATE_SHIXIAO || oldHongBao.getState() == HongBaoV2.STATE_YILINGQU)
|
| | | // 已经失效,已经领取,领取中,新老状态一致的红包不做处理
|
| | | if (oldHongBao.getState() == HongBaoV2.STATE_SHIXIAO || oldHongBao.getState() == HongBaoV2.STATE_YILINGQU|| oldHongBao.getState() == HongBaoV2.STATE_LINGQUING)
|
| | | return false;
|
| | |
|
| | | SystemEnum system = userInfoService.getUserSystem(commonOrder.getUserInfo().getId());
|
| | |
| | | List<HongBaoV2> children = hongBaoV2Mapper.listChildrenById(hongBao.getId());
|
| | | if (children != null && children.size() > 0)
|
| | | for (HongBaoV2 child : children) {
|
| | | if (child.getState() == HongBaoV2.STATE_YILINGQU)
|
| | | if (child.getState() == HongBaoV2.STATE_YILINGQU||child.getState() == HongBaoV2.STATE_LINGQUING)
|
| | | continue;
|
| | |
|
| | | HongBaoV2 childUpdate = new HongBaoV2(child.getId());
|
| | |
| | | List<HongBaoV2> children = hongBaoV2Mapper.listChildrenById(hongBao.getId());
|
| | | if (children != null)
|
| | | for (HongBaoV2 child : children) {
|
| | | if (child.getState() == HongBaoV2.STATE_YILINGQU)
|
| | | if (child.getState() == HongBaoV2.STATE_YILINGQU||child.getState() == HongBaoV2.STATE_LINGQUING)
|
| | | continue;
|
| | |
|
| | | HongBaoV2 childUpdate = new HongBaoV2(child.getId());
|
| | |
| | |
|
| | | // 插入一级子红包
|
| | | BigDecimal firstRate = hongBaoManageService
|
| | | .getFirstInviteRate(boss.getRank() == null ? 0 : boss.getRank(),system);
|
| | | .getFirstInviteRate(boss.getRank() == null ? 0 : boss.getRank(), system);
|
| | | if (firstRate.compareTo(new BigDecimal(0)) <= 0)
|
| | | return mianDanMoney != null;
|
| | | HongBaoV2 firstHongbao = new HongBaoV2();
|
| | |
| | | boss = threeSaleSerivce.getBoss(boss.getId());
|
| | | if (boss != null) {// 二级BOSS存在
|
| | | BigDecimal secondRate = hongBaoManageService
|
| | | .getSecondInviteRate(boss.getRank() == null ? 0 : boss.getRank(),system);
|
| | | .getSecondInviteRate(boss.getRank() == null ? 0 : boss.getRank(), system);
|
| | | if (secondRate.compareTo(new BigDecimal(0)) <= 0)
|
| | | return mianDanMoney != null;
|
| | | HongBaoV2 secondHongbao = new HongBaoV2();
|
| | |
| | | BigDecimal shareRate = null;
|
| | | if (commonOrder.getSourceType() == Constant.SOURCE_TYPE_TAOBAO
|
| | | && commonOrder.getSourcePosition().equalsIgnoreCase(TaoBaoConstant.TAOBAO_TLJ_RELATION_PID_DEFAULT))// 来自于淘礼金的分享
|
| | | shareRate = hongBaoManageService.getTLJShareRate(commonOrder.getCreateTime().getTime(),system);
|
| | | shareRate = hongBaoManageService.getTLJShareRate(commonOrder.getCreateTime().getTime(), system);
|
| | | else
|
| | | shareRate = hongBaoManageService.getShareRate(UserLevelEnum.daRen,
|
| | | commonOrder.getCreateTime().getTime(),system);
|
| | | commonOrder.getCreateTime().getTime(), system);
|
| | |
|
| | | UserInfo user = userInfoService.getUserById(commonOrder.getUserInfo().getId());
|
| | |
|
| | |
| | | if (taoBaoOrderList != null && taoBaoOrderList.size() > 0
|
| | | && !StringUtil.isNullOrEmpty(taoBaoOrderList.get(0).getRelationId())) {
|
| | | if (shareGoodsActivityOrderService.listByUid(commonOrder.getUserInfo().getId()).size() < 1) {
|
| | | shareRate = new BigDecimal(hongBaoManageService.get("share_activity_proportion",system));
|
| | | shareRate = new BigDecimal(hongBaoManageService.get("share_activity_proportion", system));
|
| | | try {
|
| | | shareGoodsActivityOrderService.addShareGoodsActivityOrder(
|
| | | commonOrder.getUserInfo().getId(), shareRate, commonOrder.getOrderNo());
|
| | |
| | | UserInfo boss = threeSaleSerivce.getBoss(hongBao.getUserInfo().getId());
|
| | | if (boss != null) {
|
| | | BigDecimal firstLevelRate = hongBaoManageService.getFirstShareRate(1,
|
| | | commonOrder.getThirdCreateTime().getTime(),system);
|
| | | commonOrder.getThirdCreateTime().getTime(), system);
|
| | | HongBaoV2 child = new HongBaoV2();
|
| | | child.setParent(hongBao);
|
| | | child.setType(HongBaoV2.TYPE_SHARE_YIJI);
|
| | |
| | | List<Integer> stateList = new ArrayList<>();
|
| | | stateList.add(HongBaoV2.STATE_BUKELINGQU);
|
| | | stateList.add(HongBaoV2.STATE_KELINGQU);
|
| | | stateList.add(HongBaoV2.STATE_LINGQUING);
|
| | | stateList.add(HongBaoV2.STATE_YILINGQU);
|
| | | List<HongBaoV2> hongBaoV2List = hongBaoV2Mapper.listByStateAndTypeAndUid(stateList, typeList, uid, 0, 1);
|
| | | if (hongBaoV2List != null && hongBaoV2List.size() > 0)
|
| | |
| | | return hongBaoV2Mapper.getDirectBossUrankByPid(pid);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void setHongBaoRecieved(Long uid, List<Integer> typeList, Date preGetTime) {
|
| | | hongBaoV2Mapper.setHongBaoRecieved(uid, typeList, preGetTime);
|
| | | }
|
| | |
|
| | |
|
| | | }
|