From 6c68cf469de71773039c2cca8498f35b80b2891b Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 05 九月 2023 18:36:07 +0800
Subject: [PATCH] 唯品会订单修改/猜你喜欢过来的商品不能分享
---
fanli/src/main/java/com/yeshi/fanli/service/impl/user/vip/TeamUserLevelStatisticServiceImpl.java | 334 +++++++++++++++++++++++++++---------------------------
1 files changed, 167 insertions(+), 167 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 b236a26..66eb36c 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
@@ -1,167 +1,167 @@
-package com.yeshi.fanli.service.impl.user.vip;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Resource;
-
-import org.springframework.stereotype.Service;
-
-import com.yeshi.fanli.dao.mybatis.user.vip.TeamUserLevelStatisticMapper;
-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 {
-
- @Resource
- private UserLevelManager userLevelManager;
-
- @Resource
- private TeamUserLevelStatisticMapper teamUserLevelStatisticMapper;
-
- @Resource
- private ThreeSaleSerivce threeSaleSerivce;
-
- @Resource
- private UserLevelStatisticMapper userLevelStatisticMapper;
-
- @Override
- public TeamUserLevelStatistic selectByUid(Long uid) {
- return teamUserLevelStatisticMapper.selectByPrimaryKey(uid);
- }
-
- @Override
- public List<TeamUserLevelStatistic> listByUids(List<Long> uids) {
-
- List<TeamUserLevelStatistic> resultList = new ArrayList<>();
-
- List<TeamUserLevelStatistic> list = teamUserLevelStatisticMapper.listByUids(uids);
- // 鏀惧叆Map涓�
- Map<Long, TeamUserLevelStatistic> map = new HashMap<>();
- if (list != null)
- for (TeamUserLevelStatistic s : list) {
- map.put(s.getId(), s);
- }
-
- for (Long uid : uids) {
- if (map.get(uid) == null) {
- initData(uid);
- TeamUserLevelStatistic statistic = selectByUid(uid);
- resultList.add(statistic);
- } else {
- resultList.add(map.get(uid));
- }
- }
-
- return resultList;
- }
-
- @Override
- public void initData(Long uid) {
- 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 (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 (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);
- TeamUserLevelStatistic statistic = new TeamUserLevelStatistic();
- statistic.setDaRenFirstCount(daRenFirstCount);
- statistic.setDaRenSecondCount(daRenSecondCount);
- 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);
- }
-
- @Override
- public void setUserLevel(Long uid, UserLevelEnum level) {
-
- TeamUserLevelStatistic old = selectByUid(uid);
- if (old == null) {
- initData(uid);
- old = selectByUid(uid);
- }
-
- TeamUserLevelStatistic update = new TeamUserLevelStatistic();
- update.setId(old.getId());
- update.setLevel(level);
- update.setUpdateTime(new Date());
- teamUserLevelStatisticMapper.updateByPrimaryKeySelective(update);
- }
-
- @Override
- public void add(TeamUserLevelStatistic statistic) {
- TeamUserLevelStatistic old = selectByUid(statistic.getId());
- if (old == null) {
- if (statistic.getCreateTime() == null)
- statistic.setCreateTime(new Date());
- teamUserLevelStatisticMapper.insertSelective(statistic);
- } else {
- statistic.setUpdateTime(new Date());
- teamUserLevelStatisticMapper.updateByPrimaryKeySelective(statistic);
- }
- }
-
- @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);
- }
-
-}
+package com.yeshi.fanli.service.impl.user.vip;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Service;
+
+import com.yeshi.fanli.dao.mybatis.user.vip.TeamUserLevelStatisticMapper;
+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 {
+
+ @Resource
+ private UserLevelManager userLevelManager;
+
+ @Resource
+ private TeamUserLevelStatisticMapper teamUserLevelStatisticMapper;
+
+ @Resource
+ private ThreeSaleSerivce threeSaleSerivce;
+
+ @Resource
+ private UserLevelStatisticMapper userLevelStatisticMapper;
+
+ @Override
+ public TeamUserLevelStatistic selectByUid(Long uid) {
+ return teamUserLevelStatisticMapper.selectByPrimaryKey(uid);
+ }
+
+ @Override
+ public List<TeamUserLevelStatistic> listByUids(List<Long> uids) {
+
+ List<TeamUserLevelStatistic> resultList = new ArrayList<>();
+
+ List<TeamUserLevelStatistic> list = teamUserLevelStatisticMapper.listByUids(uids);
+ // 鏀惧叆Map涓�
+ Map<Long, TeamUserLevelStatistic> map = new HashMap<>();
+ if (list != null)
+ for (TeamUserLevelStatistic s : list) {
+ map.put(s.getId(), s);
+ }
+
+ for (Long uid : uids) {
+ if (map.get(uid) == null) {
+ initData(uid);
+ TeamUserLevelStatistic statistic = selectByUid(uid);
+ resultList.add(statistic);
+ } else {
+ resultList.add(map.get(uid));
+ }
+ }
+
+ return resultList;
+ }
+
+ @Override
+ public void initData(Long uid) {
+ 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 (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 (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);
+ TeamUserLevelStatistic statistic = new TeamUserLevelStatistic();
+ statistic.setDaRenFirstCount(daRenFirstCount);
+ statistic.setDaRenSecondCount(daRenSecondCount);
+ 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);
+ }
+
+ @Override
+ public void setUserLevel(Long uid, UserLevelEnum level) {
+
+ TeamUserLevelStatistic old = selectByUid(uid);
+ if (old == null) {
+ initData(uid);
+ old = selectByUid(uid);
+ }
+
+ TeamUserLevelStatistic update = new TeamUserLevelStatistic();
+ update.setId(old.getId());
+ update.setLevel(level);
+ update.setUpdateTime(new Date());
+ teamUserLevelStatisticMapper.updateByPrimaryKeySelective(update);
+ }
+
+ @Override
+ public void add(TeamUserLevelStatistic statistic) {
+ TeamUserLevelStatistic old = selectByUid(statistic.getId());
+ if (old == null) {
+ if (statistic.getCreateTime() == null)
+ statistic.setCreateTime(new Date());
+ teamUserLevelStatisticMapper.insertSelective(statistic);
+ } else {
+ statistic.setUpdateTime(new Date());
+ teamUserLevelStatisticMapper.updateByPrimaryKeySelective(statistic);
+ }
+ }
+
+ @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);
+ }
+
+}
--
Gitblit v1.8.0