admin
2020-04-13 dd5b15229cb15459fa7c31ccea77dac28cbfafbd
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/TeamUserLevelStatisticServiceImpl.java
@@ -37,23 +37,31 @@
      int state = ThreeSale.STATE_SUCCESS;
      long count = threeSaleSerivce.countFirstTeam(uid, state);
      List<ThreeSale> list = threeSaleSerivce.listFirstTeam(0L, (int) count, uid, state);
      int daRenFirstCount = 0;
      int normalFirstCount = 0;
      int highFirstCount = 0;
      int superFirstCount = 0;
      int tearcherFirstCount = 0;
      for (ThreeSale ts : list) {
         UserLevelEnum level = userLevelManager.getUserLevel(ts.getWorker().getId());
         if (level == UserLevelEnum.normalVIP) {
         if (level == UserLevelEnum.daRen) {
            daRenFirstCount++;
         } else if (level == UserLevelEnum.normalVIP) {
            normalFirstCount++;
         } else if (level == UserLevelEnum.highVIP) {
            highFirstCount++;
         } else if (level == UserLevelEnum.superVIP) {
            superFirstCount++;
         } else if (level == UserLevelEnum.tearcher) {
            tearcherFirstCount++;
         }
      }
      int daRenSecondCount = 0;
      int normalSecondCount = 0;
      int highSecondCount = 0;
      int superSecondCount = 0;
      int tearcherSecondCount = 0;
      long secondCount = threeSaleSerivce.countSecondTeam(uid, state);
      int pageSize = 1000;
@@ -63,24 +71,32 @@
         if (list != null)
            for (ThreeSale ts : list) {
               UserLevelEnum level = userLevelManager.getUserLevel(ts.getWorker().getId());
               if (level == UserLevelEnum.normalVIP) {
               if (level == UserLevelEnum.daRen) {
                  daRenSecondCount++;
               } else if (level == UserLevelEnum.normalVIP) {
                  normalSecondCount++;
               } else if (level == UserLevelEnum.highVIP) {
                  highSecondCount++;
               } else if (level == UserLevelEnum.superVIP) {
                  superSecondCount++;
               } else if (level == UserLevelEnum.tearcher) {
                  tearcherSecondCount++;
               }
            }
      }
      UserLevelEnum level = userLevelManager.getUserLevel(uid);
      TeamUserLevelStatistic statistic = new TeamUserLevelStatistic();
      statistic.setDaRenFirstCount(daRenFirstCount);
      statistic.setDaRenSecondCount(daRenSecondCount);
      statistic.setNormalFirstCount(normalFirstCount);
      statistic.setNormalSecondCount(normalSecondCount);
      statistic.setHighFirstCount(highFirstCount);
      statistic.setHighSecondCount(highSecondCount);
      statistic.setSuperFirstCount(superFirstCount);
      statistic.setSuperSecondCount(superSecondCount);
      statistic.setTearcherFirstCount(tearcherFirstCount);
      statistic.setTearcherSecondCount(tearcherSecondCount);
      statistic.setId(uid);
      statistic.setLevel(level);
      add(statistic);
@@ -90,7 +106,7 @@
   public void add(TeamUserLevelStatistic statistic) {
      TeamUserLevelStatistic old = selectByUid(statistic.getId());
      if (old == null) {
         if(statistic.getCreateTime()==null)
         if (statistic.getCreateTime() == null)
            statistic.setCreateTime(new Date());
         teamUserLevelStatisticMapper.insertSelective(statistic);
      } else {
@@ -99,4 +115,14 @@
      }
   }
   @Override
   public void updateUserLevel(Long uid) {
      UserLevelEnum level = userLevelManager.getUserLevel(uid);
      TeamUserLevelStatistic statistic = new TeamUserLevelStatistic();
      statistic.setId(uid);
      statistic.setLevel(level);
      statistic.setUpdateTime(new Date());
      teamUserLevelStatisticMapper.updateByPrimaryKeySelective(statistic);
   }
}