From cd5cddf2425f8f6267cfaaf49e37bf624781d3f5 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期四, 14 五月 2020 20:28:27 +0800 Subject: [PATCH] 增加rocketmq消息 --- fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/TeamUserLevelStatisticServiceImpl.java | 74 +++++++++++++++++-------------------- 1 files changed, 34 insertions(+), 40 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/TeamUserLevelStatisticServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/TeamUserLevelStatisticServiceImpl.java index a7f1296..b236a26 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/TeamUserLevelStatisticServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/TeamUserLevelStatisticServiceImpl.java @@ -11,13 +11,14 @@ import org.springframework.stereotype.Service; import com.yeshi.fanli.dao.mybatis.user.vip.TeamUserLevelStatisticMapper; -import com.yeshi.fanli.entity.bus.user.ThreeSale; -import com.yeshi.fanli.entity.bus.user.UserInviteValidRecord; +import com.yeshi.fanli.dao.mybatis.user.vip.UserLevelStatisticMapper; +import com.yeshi.fanli.dto.vip.UserLevelStatisticDTO; import com.yeshi.fanli.entity.bus.user.vip.TeamUserLevelStatistic; import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum; import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce; import com.yeshi.fanli.service.inter.user.vip.TeamUserLevelStatisticService; import com.yeshi.fanli.service.manger.user.UserLevelManager; +import com.yeshi.fanli.util.user.UserLevelUtil; @Service public class TeamUserLevelStatisticServiceImpl implements TeamUserLevelStatisticService { @@ -30,6 +31,9 @@ @Resource private ThreeSaleSerivce threeSaleSerivce; + + @Resource + private UserLevelStatisticMapper userLevelStatisticMapper; @Override public TeamUserLevelStatistic selectByUid(Long uid) { @@ -64,56 +68,46 @@ @Override public void initData(Long uid) { - int pageSize = 1000; - - // 鐩存帴绮変笣缁熻 + List<UserLevelStatisticDTO> firstList = userLevelStatisticMapper.statisticFirstTeamLevelCount(uid); + List<UserLevelStatisticDTO> secondList = userLevelStatisticMapper.statisticSecondTeamLevelCount(uid); int daRenFirstCount = 0; int highFirstCount = 0; int superFirstCount = 0; int tearcherFirstCount = 0; - for (int i = 0; i < 100; i++) { - List<ThreeSale> list = threeSaleSerivce.listFirstTeam(i * pageSize, pageSize, uid); - if (list == null || list.size() == 0) { - break; - } - for (ThreeSale ts : list) { - UserLevelEnum level = userLevelManager.getUserLevel(ts.getWorker().getId()); - if (level == UserLevelEnum.daRen || level == UserLevelEnum.normalVIP) { - daRenFirstCount++; - } else if (level == UserLevelEnum.highVIP) { - highFirstCount++; - } else if (level == UserLevelEnum.superVIP) { - superFirstCount++; - } else if (level == UserLevelEnum.tearcher) { - tearcherFirstCount++; - } - } + for (UserLevelStatisticDTO dto : firstList) { + UserLevelEnum level = UserLevelUtil.getByLevel(dto.getLevel()); + if (level == null) + level = UserLevelEnum.daRen; + + if (level == UserLevelEnum.daRen || level == UserLevelEnum.normalVIP) { + daRenFirstCount += dto.getNum(); + } else if (level == UserLevelEnum.highVIP) + highFirstCount += dto.getNum(); + else if (level == UserLevelEnum.superVIP) + superFirstCount += dto.getNum(); + else if (level == UserLevelEnum.tearcher) + tearcherFirstCount += dto.getNum(); } - // 闂存帴绮変笣缁熻 int daRenSecondCount = 0; int highSecondCount = 0; int superSecondCount = 0; int tearcherSecondCount = 0; - for (int i = 0; i < 100; i++) { - List<ThreeSale> list = threeSaleSerivce.listSecondTeam(i * pageSize, pageSize, uid); - if (list == null || list.size() == 0) { - break; - } - for (ThreeSale ts : list) { - UserLevelEnum level = userLevelManager.getUserLevel(ts.getWorker().getId()); - if (level == UserLevelEnum.daRen || level == UserLevelEnum.normalVIP) { - daRenSecondCount++; - } else if (level == UserLevelEnum.highVIP) { - highSecondCount++; - } else if (level == UserLevelEnum.superVIP) { - superSecondCount++; - } else if (level == UserLevelEnum.tearcher) { - tearcherSecondCount++; - } - } + for (UserLevelStatisticDTO dto : secondList) { + UserLevelEnum level = UserLevelUtil.getByLevel(dto.getLevel()); + if (level == null) + level = UserLevelEnum.daRen; + + if (level == UserLevelEnum.daRen || level == UserLevelEnum.normalVIP) { + daRenSecondCount += dto.getNum(); + } else if (level == UserLevelEnum.highVIP) + highSecondCount += dto.getNum(); + else if (level == UserLevelEnum.superVIP) + superSecondCount += dto.getNum(); + else if (level == UserLevelEnum.tearcher) + tearcherSecondCount += dto.getNum(); } UserLevelEnum level = userLevelManager.getUserLevel(uid); -- Gitblit v1.8.0