admin
2020-04-02 b9b613a285ebe0da27ca7dd2c3434c8c917abb74
fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/ThreeSaleSerivceImpl.java
@@ -134,7 +134,7 @@
            List<ThreeSale> list = listByWorkerId(worker.getId());
            if (list != null && list.size() > 0) {
               for (ThreeSale ts : list) {
                  if (!ts.getState() && ts.getExpire() == ThreeSale.EXPIRE_OUTOFDATE) {
                  if (!ts.getState() && ts.getExpire() == ThreeSale.EXPIRE_BREAK) {
                     outOfDateCount++;
                  }
               }
@@ -179,7 +179,7 @@
            if (list != null)
               for (int i = 0; i < list.size(); i++) {
                  if (list.get(i).getState() != null && list.get(i).getState() == false
                        && list.get(i).getExpire() == ThreeSale.EXPIRE_OUTOFDATE) {// 过期的
                        && list.get(i).getExpire() == ThreeSale.EXPIRE_BREAK) {// 过期的
                     list.remove(i);
                     i--;
                  }
@@ -607,6 +607,27 @@
   }
   @Override
   public List<ThreeSale> listFirstTeamByUndeleted(long start, int count, Long uid) {
      return threeSaleMapper.listFirstTeamByUndeleted(start, count, uid);
   }
   @Override
   public long countFirstTeamByUndeleted(Long uid) {
      return threeSaleMapper.countFirstTeamByUndeleted(uid);
   }
   @Override
   public List<ThreeSale> listSecondTeamByUndeleted(long start, int count, Long uid) {
      return threeSaleMapper.listSecondTeamByUndeleted(start, count, uid);
   }
   @Override
   public long countSecondTeamByUndeleted(Long uid) {
      return threeSaleMapper.countSecondTeamByUndeleted(uid);
   }
   @Override
   public List<ThreeSale> listSecondTeam(long start, int count, Long uid, Integer state) {
      return threeSaleMapper.listSecondTeam(start, count, uid, state);
   }
@@ -631,4 +652,65 @@
      return threeSaleMapper.getTeamOrderNumByWorkerId(workerId);
   }
   @Override
   public List<ThreeSale> getValidWorkerIdsByTime(Long bossId, long limitTime) {
      return threeSaleMapper.getValidWorkerIdsByTime(bossId, limitTime);
   }
   @Override
   public List<ThreeSale> getMyBossDeepList(Long uid, int deep) {
      List<ThreeSale> deepList = new ArrayList<>();
      ThreeSale boss = getMyBoss(uid);
      while (deep > 0 && boss != null) {
         deep--;
         deepList.add(boss);
         boss = getMyBoss(boss.getBoss().getId());
      }
      return deepList;
   }
   @Override
   public void remvoeBreak(Long id, Long uid, Long tid) {
      ThreeSale threeSale = threeSaleMapper.selectByPrimaryKey(id);
      if (threeSale == null) {
         return;
      }
      Long workerId = threeSale.getWorker().getId();
      if (tid.longValue() != workerId.longValue()) {
         return;
      }
      Integer expire = threeSale.getExpire();
      if (expire == ThreeSale.EXPIRE_NORMAL) {
         return;
      }
      int upExpire = expire;
      Long bossId = threeSale.getBoss().getId();
      if (bossId.longValue() == uid.longValue()) { // 直接粉丝
         if (expire == ThreeSale.EXPIRE_BREAK_VIP_DEL4) {
            upExpire =ThreeSale.EXPIRE_BREAK_VIP_DEL34;
         } else {
            upExpire = ThreeSale.EXPIRE_BREAK_VIP_DEL3;
         }
      } else { // 间接粉丝
         if (expire == ThreeSale.EXPIRE_BREAK_VIP_DEL3) {
            upExpire =ThreeSale.EXPIRE_BREAK_VIP_DEL34;
         } else {
            upExpire = ThreeSale.EXPIRE_BREAK_VIP_DEL4;
         }
      }
      ThreeSale update = new ThreeSale();
      update.setId(id);
      update.setExpire(upExpire);
      update.setUpdateTime(java.lang.System.currentTimeMillis());
      threeSaleMapper.updateByPrimaryKeySelective(update);
   }
}