| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import com.yeshi.fanli.entity.SystemEnum;
|
| | | import com.yeshi.fanli.entity.SystemFunction;
|
| | | import com.yeshi.fanli.util.SystemInfoUtil;
|
| | | import org.springframework.context.annotation.Lazy;
|
| | | import org.springframework.core.task.TaskExecutor;
|
| | | import org.springframework.stereotype.Service;
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.ThreeSaleExtraInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.exception.user.ThreeSaleException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.user.UserActiveLogService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralGetService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.MsgInviteDetailService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.TeamFansInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleExtraInfoSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteMsgNotificationService;
|
| | | import com.yeshi.fanli.service.manger.msg.RocketMQManager;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
|
| | |
| | | @Service
|
| | | public class ThreeSaleSerivceImpl implements ThreeSaleSerivce {
|
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | |
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | | @Resource
|
| | | private ThreeSaleMapper threeSaleMapper;
|
| | |
|
| | | @Resource
|
| | | private UserInfoMapper userInfoMapper;
|
| | | @Resource
|
| | | private UserInviteMsgNotificationService userInviteMsgNotificationService;
|
| | |
|
| | | @Resource
|
| | | private ThreeSaleMapper threeSaleMapper;
|
| | | @Lazy
|
| | | @Resource
|
| | | private IntegralGetService integralGetService;
|
| | |
|
| | | @Resource
|
| | | private UserInviteMsgNotificationService userInviteMsgNotificationService;
|
| | | @Lazy
|
| | | @Resource
|
| | | private TeamFansInfoService teamFansInfoService;
|
| | |
|
| | | @Resource
|
| | | private MsgInviteDetailService msgInviteDetailService;
|
| | |
|
| | | @Resource
|
| | | private UserActiveLogService userActiveLogService;
|
| | | @Resource(name = "taskExecutor")
|
| | | private TaskExecutor executor;
|
| | |
|
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | | @Resource
|
| | | private RocketMQManager rocketMQManager;
|
| | |
|
| | | @Resource
|
| | | private ThreeSaleExtraInfoSerivce threeSaleExtraInfoSerivce;
|
| | |
|
| | | @Lazy
|
| | | @Resource
|
| | | private IntegralGetService integralGetService;
|
| | | public UserInfo getBoss(final long uid) {
|
| | | return threeSaleMapper.selectBoss(uid);
|
| | | }
|
| | |
|
| | | @Resource(name = "taskExecutor")
|
| | | private TaskExecutor executor;
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void bind(UserInfo worker, UserInfo inviter) throws ThreeSaleException {
|
| | | if (worker == null || inviter == null)
|
| | | throw new ThreeSaleException(1, "用户信息为空");
|
| | |
|
| | | @Resource(name = "producer")
|
| | | private Producer producer;
|
| | | //判断是否存在邀请权限
|
| | | SystemEnum system1 = userInfoService.getUserSystem(worker.getId());
|
| | | if (!SystemInfoUtil.hasFunctions(system1, SystemFunction.threeSale))
|
| | | throw new ThreeSaleException(2, "无法建立邀请关系");
|
| | |
|
| | | public UserInfo getBoss(final long uid) {
|
| | | return threeSaleMapper.selectBoss(uid);
|
| | | }
|
| | | SystemEnum system2 = userInfoService.getUserSystem(inviter.getId());
|
| | | if (!SystemInfoUtil.hasFunctions(system2, SystemFunction.threeSale))
|
| | | throw new ThreeSaleException(2, "无法建立邀请关系");
|
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void bind(UserInfo worker, UserInfo inviter) throws ThreeSaleException {
|
| | | if (worker == null || inviter == null)
|
| | | throw new ThreeSaleException(1, "用户信息为空");
|
| | | if (system1 != system2)
|
| | | throw new ThreeSaleException(2, "无法建立邀请关系");
|
| | |
|
| | | if (worker.getId() == null)// 该用户还不存在
|
| | | {
|
| | | // 保存用户
|
| | | UserInfo inviteeUser = userInfoService.addUser(worker, Constant.APPID);
|
| | | if (inviteeUser == null)
|
| | | throw new ThreeSaleException(2, "创建用户失败");
|
| | | // 保存关系
|
| | | ThreeSale threeSale = new ThreeSale();
|
| | | threeSale.setBoss(inviter);
|
| | | threeSale.setCreateTime(java.lang.System.currentTimeMillis());
|
| | | threeSale.setExpire(ThreeSale.EXPIRE_NORMAL);
|
| | | threeSale.setState(false);
|
| | | threeSale.setUpdateTime(java.lang.System.currentTimeMillis());
|
| | | threeSale.setWorker(inviteeUser);
|
| | | threeSaleMapper.insertSelective(threeSale);
|
| | | if (worker.getId() == null)// 该用户还不存在
|
| | | {
|
| | | // 保存用户
|
| | | UserInfo inviteeUser = userInfoService.addUser(worker, worker.getSystem());
|
| | | if (inviteeUser == null)
|
| | | throw new ThreeSaleException(2, "创建用户失败");
|
| | | // 保存关系
|
| | | ThreeSale threeSale = new ThreeSale();
|
| | | threeSale.setBoss(inviter);
|
| | | threeSale.setCreateTime(java.lang.System.currentTimeMillis());
|
| | | threeSale.setExpire(ThreeSale.EXPIRE_NORMAL);
|
| | | threeSale.setState(false);
|
| | | threeSale.setUpdateTime(java.lang.System.currentTimeMillis());
|
| | | threeSale.setWorker(inviteeUser);
|
| | | threeSaleMapper.insertSelective(threeSale);
|
| | |
|
| | | } else {// 是已经存在的用户
|
| | | if (worker.getId().longValue() == inviter.getId())
|
| | | throw new ThreeSaleException(4, "不能绑定自己");
|
| | | } else {// 是已经存在的用户
|
| | | if (worker.getId().longValue() == inviter.getId())
|
| | | throw new ThreeSaleException(4, "不能绑定自己");
|
| | |
|
| | | worker = userInfoService.selectByPKey(worker.getId());
|
| | | worker = userInfoService.selectByPKey(worker.getId());
|
| | |
|
| | | // 用户已经存在我们的用户库中
|
| | | if (worker.getLastLoginTime() == null || worker.getLastLoginTime() == 0L) {
|
| | | // 用户未登录
|
| | | int outOfDateCount = 0;// 过期数量
|
| | | // 查询邀请关系
|
| | | List<ThreeSale> list = listByWorkerId(worker.getId());
|
| | | if (list != null && list.size() > 0) {
|
| | | for (ThreeSale ts : list) {
|
| | | if (!ts.getState() && ts.getExpire() == ThreeSale.EXPIRE_BREAK) {
|
| | | outOfDateCount++;
|
| | | }
|
| | | }
|
| | | // 全部是失效状态
|
| | | if (outOfDateCount == list.size()) {
|
| | | // 可以确定关系
|
| | | ThreeSale threeSale = new ThreeSale();
|
| | | threeSale.setBoss(inviter);
|
| | | threeSale.setCreateTime(java.lang.System.currentTimeMillis());
|
| | | threeSale.setExpire(ThreeSale.EXPIRE_NORMAL);
|
| | | threeSale.setState(false);
|
| | | threeSale.setUpdateTime(java.lang.System.currentTimeMillis());
|
| | | threeSale.setWorker(worker);
|
| | | threeSaleMapper.insertSelective(threeSale);
|
| | | } else {
|
| | | // 还存在有效的邀请,则不做处理
|
| | | }
|
| | | } else {
|
| | | // 用户未登录,又不存在邀请关系,不做处理
|
| | | }
|
| | | } else {
|
| | | // 已经登录,而且没有上下级关系或者上下级关系未生效,则绑定关系
|
| | | List<ThreeSale> list = threeSaleMapper.listByWorkerId(worker.getId());
|
| | | // 删除无效的
|
| | | 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_BREAK) {// 过期的
|
| | | list.remove(i);
|
| | | i--;
|
| | | }
|
| | | }
|
| | | // 查询上级是否有和现在上级一样的
|
| | | if (list == null || list.size() == 0)// 尚未确立关系,建立关系
|
| | | {
|
| | | ThreeSale ts = new ThreeSale();
|
| | | ts.setBoss(inviter);
|
| | | ts.setCreateTime(System.currentTimeMillis());
|
| | | ts.setExpire(ThreeSale.EXPIRE_NORMAL);
|
| | | ts.setState(true);
|
| | | ts.setSucceedTime(System.currentTimeMillis());
|
| | | ts.setWorker(worker);
|
| | | threeSaleMapper.insertSelective(ts);
|
| | | } else {
|
| | | if (!list.get(0).getState() && list.get(0).getExpire() == ThreeSale.EXPIRE_NORMAL
|
| | | && list.get(0).getBoss().getId() == inviter.getId().longValue()) {// 未生效的上级和现在上级一样就生效
|
| | | ThreeSale update = new ThreeSale(list.get(0).getId());
|
| | | update.setState(true);
|
| | | update.setSucceedTime(System.currentTimeMillis());
|
| | | threeSaleMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | // 用户已经存在我们的用户库中
|
| | | if (worker.getLastLoginTime() == null || worker.getLastLoginTime() == 0L) {
|
| | | // 用户未登录
|
| | | int outOfDateCount = 0;// 过期数量
|
| | | // 查询邀请关系
|
| | | List<ThreeSale> list = listByWorkerId(worker.getId());
|
| | | if (list != null && list.size() > 0) {
|
| | | for (ThreeSale ts : list) {
|
| | | if (!ts.getState() && ts.getExpire() == ThreeSale.EXPIRE_BREAK) {
|
| | | outOfDateCount++;
|
| | | }
|
| | | }
|
| | | // 全部是失效状态
|
| | | if (outOfDateCount == list.size()) {
|
| | | // 可以确定关系
|
| | | ThreeSale threeSale = new ThreeSale();
|
| | | threeSale.setBoss(inviter);
|
| | | threeSale.setCreateTime(java.lang.System.currentTimeMillis());
|
| | | threeSale.setExpire(ThreeSale.EXPIRE_NORMAL);
|
| | | threeSale.setState(false);
|
| | | threeSale.setUpdateTime(java.lang.System.currentTimeMillis());
|
| | | threeSale.setWorker(worker);
|
| | | threeSaleMapper.insertSelective(threeSale);
|
| | | } else {
|
| | | // 还存在有效的邀请,则不做处理
|
| | | }
|
| | | } else {
|
| | | // 用户未登录,又不存在邀请关系,不做处理
|
| | | }
|
| | | } else {
|
| | | // 已经登录,而且没有上下级关系或者上下级关系未生效,则绑定关系
|
| | | List<ThreeSale> list = threeSaleMapper.listByWorkerId(worker.getId());
|
| | | // 删除无效的
|
| | | 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_BREAK) {// 过期的
|
| | | list.remove(i);
|
| | | i--;
|
| | | }
|
| | | }
|
| | | // 查询上级是否有和现在上级一样的
|
| | | if (list == null || list.size() == 0)// 尚未确立关系,建立关系
|
| | | {
|
| | | ThreeSale ts = new ThreeSale();
|
| | | ts.setBoss(inviter);
|
| | | ts.setCreateTime(System.currentTimeMillis());
|
| | | ts.setExpire(ThreeSale.EXPIRE_NORMAL);
|
| | | ts.setState(true);
|
| | | ts.setSucceedTime(System.currentTimeMillis());
|
| | | ts.setWorker(worker);
|
| | | threeSaleMapper.insertSelective(ts);
|
| | | } else {
|
| | | if (!list.get(0).getState() && list.get(0).getExpire() == ThreeSale.EXPIRE_NORMAL
|
| | | && list.get(0).getBoss().getId() == inviter.getId().longValue()) {// 未生效的上级和现在上级一样就生效
|
| | | ThreeSale update = new ThreeSale(list.get(0).getId());
|
| | | update.setState(true);
|
| | | update.setSucceedTime(System.currentTimeMillis());
|
| | | threeSaleMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | public void effective(UserInfo worker) {
|
| | | List<ThreeSale> list = threeSaleMapper.listByWorkerId(worker.getId());
|
| | | 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_NORMAL) {
|
| | | ;
|
| | | } else {
|
| | | list.remove(i);
|
| | | i--;
|
| | | }
|
| | | }
|
| | | if (list.size() > 0) {
|
| | | ThreeSale oldSale = list.get(0);
|
| | | @Transactional
|
| | | public void effective(UserInfo worker) {
|
| | | List<ThreeSale> list = threeSaleMapper.listByWorkerId(worker.getId());
|
| | | 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_NORMAL) {
|
| | | ;
|
| | | } else {
|
| | | list.remove(i);
|
| | | i--;
|
| | | }
|
| | | }
|
| | | if (list.size() > 0) {
|
| | | ThreeSale oldSale = list.get(0);
|
| | |
|
| | | ThreeSale update = new ThreeSale(list.get(0).getId());
|
| | | update.setState(true);
|
| | | update.setSucceedTime(System.currentTimeMillis());
|
| | | threeSaleMapper.updateByPrimaryKeySelective(update);
|
| | | ThreeSale update = new ThreeSale(list.get(0).getId());
|
| | | update.setState(true);
|
| | | update.setSucceedTime(System.currentTimeMillis());
|
| | | threeSaleMapper.updateByPrimaryKeySelective(update);
|
| | |
|
| | | oldSale.setState(update.getState());
|
| | | oldSale.setSucceedTime(update.getSucceedTime());
|
| | | oldSale.setState(update.getState());
|
| | | oldSale.setSucceedTime(update.getSucceedTime());
|
| | |
|
| | | // 不以邀请人数计算等级
|
| | | // if (inviter != null)
|
| | | // reComputeUserRank(inviter.getId());
|
| | | // 添加到队列
|
| | | inviteSuccess(worker.getId(), oldSale.getBoss().getId());
|
| | | }
|
| | | }
|
| | | // 不以邀请人数计算等级
|
| | | // if (inviter != null)
|
| | | // reComputeUserRank(inviter.getId());
|
| | | // 添加到队列
|
| | | inviteSuccess(worker.getId(), oldSale.getBoss().getId());
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ThreeSale> listFirstTeamQuery(long start, int count, Long uid, Integer state, String startTime,
|
| | | String endTime, Integer validState) {
|
| | | return threeSaleMapper.listFirstTeamQuery(start, count, uid, state, startTime, endTime, validState);
|
| | | }
|
| | | @Override
|
| | | public List<ThreeSale> listFirstTeamQuery(long start, int count, Long uid, Integer state, String startTime,
|
| | | String endTime, Integer validState) {
|
| | | return threeSaleMapper.listFirstTeamQuery(start, count, uid, state, startTime, endTime, validState);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countFirstTeamQuery(Long uid, Integer state, String startTime, String endTime, Integer validState) {
|
| | | return threeSaleMapper.countFirstTeamQuery(uid, state, startTime, endTime, validState);
|
| | | }
|
| | | @Override
|
| | | public long countFirstTeamQuery(Long uid, Integer state, String startTime, String endTime, Integer validState) {
|
| | | return threeSaleMapper.countFirstTeamQuery(uid, state, startTime, endTime, validState);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ThreeSale> listSecondTeamQuery(long start, int count, Long uid, Integer state, String startTime,
|
| | | String endTime, Integer validState) {
|
| | | return threeSaleMapper.listSecondTeamQuery(start, count, uid, state, startTime, endTime, validState);
|
| | | }
|
| | | @Override
|
| | | public List<ThreeSale> listSecondTeamQuery(long start, int count, Long uid, Integer state, String startTime,
|
| | | String endTime, Integer validState) {
|
| | | return threeSaleMapper.listSecondTeamQuery(start, count, uid, state, startTime, endTime, validState);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countSecondTeamQuery(Long uid, Integer state, String startTime, String endTime, Integer validState) {
|
| | | return threeSaleMapper.countSecondTeamQuery(uid, state, startTime, endTime, validState);
|
| | | }
|
| | | @Override
|
| | | public long countSecondTeamQuery(Long uid, Integer state, String startTime, String endTime, Integer validState) {
|
| | | return threeSaleMapper.countSecondTeamQuery(uid, state, startTime, endTime, validState);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ThreeSale> listSuperiorQuery(long start, int count, Integer state, Long uid) {
|
| | | return threeSaleMapper.listSuperiorQuery(start, count, state, uid);
|
| | | }
|
| | | @Override
|
| | | public List<ThreeSale> listSuperiorQuery(long start, int count, Integer state, Long uid) {
|
| | | return threeSaleMapper.listSuperiorQuery(start, count, state, uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countSuperiorQuery(Integer state, Long uid) {
|
| | | return threeSaleMapper.countSuperiorQuery(state, uid);
|
| | | }
|
| | | @Override
|
| | | public long countSuperiorQuery(Integer state, Long uid) {
|
| | | return threeSaleMapper.countSuperiorQuery(state, uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public ThreeSale getMyBoss(Long uid) {
|
| | | return threeSaleMapper.getMyBoss(uid);
|
| | | }
|
| | | @Override
|
| | | public ThreeSale getMyBoss(Long uid) {
|
| | | return threeSaleMapper.getMyBoss(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public ThreeSale selectByPrimaryKey(Long id) {
|
| | | return threeSaleMapper.selectByPrimaryKey(id);
|
| | | }
|
| | | @Override
|
| | | public ThreeSale selectByPrimaryKey(Long id) {
|
| | | return threeSaleMapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ThreeSale> listbyIdAndBossId(Long id, Long uid, Integer expire) {
|
| | | return threeSaleMapper.listbyIdAndBossId(id, uid, expire);
|
| | | }
|
| | | @Override
|
| | | public List<ThreeSale> listbyIdAndBossId(Long id, Long uid, Integer expire) {
|
| | | return threeSaleMapper.listbyIdAndBossId(id, uid, expire);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public JSONObject getMyFirstTeam(long start, int count, Long uid) {
|
| | | List<ThreeSale> list = threeSaleMapper.listFirstTeam(start, count, uid);
|
| | | if (list == null) {
|
| | | list = new ArrayList<ThreeSale>();
|
| | | }
|
| | | long countTotal = threeSaleMapper.countFirstTeam(uid);
|
| | | return organizeTeam(countTotal, list);
|
| | | }
|
| | | @Override
|
| | | public JSONObject getMyFirstTeam(long start, int count, Long uid) {
|
| | | List<ThreeSale> list = threeSaleMapper.listFirstTeam(start, count, uid, null);
|
| | | if (list == null) {
|
| | | list = new ArrayList<ThreeSale>();
|
| | | }
|
| | | long countTotal = threeSaleMapper.countFirstTeam(uid, null);
|
| | | return organizeTeam(countTotal, list);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public JSONObject getMySecondTeam(long start, int count, Long uid) {
|
| | | List<ThreeSale> list = threeSaleMapper.listSecondTeam(start, count, uid);
|
| | | if (list == null) {
|
| | | list = new ArrayList<ThreeSale>();
|
| | | }
|
| | | long countTotal = threeSaleMapper.countSecondTeam(uid);
|
| | | return organizeTeam(countTotal, list);
|
| | | }
|
| | | @Override
|
| | | public JSONObject getMySecondTeam(long start, int count, Long uid) {
|
| | | List<ThreeSale> list = threeSaleMapper.listSecondTeam(start, count, uid, null);
|
| | | if (list == null) {
|
| | | list = new ArrayList<ThreeSale>();
|
| | | }
|
| | | long countTotal = threeSaleMapper.countSecondTeam(uid, null);
|
| | | return organizeTeam(countTotal, list);
|
| | | }
|
| | |
|
| | | public JSONObject organizeTeam(long count, List<ThreeSale> list) {
|
| | | public JSONObject organizeTeam(long count, List<ThreeSale> list) {
|
| | |
|
| | | JSONObject result = new JSONObject();
|
| | | JSONObject result = new JSONObject();
|
| | |
|
| | | JSONArray resultArray = new JSONArray();
|
| | | JSONArray resultArray = new JSONArray();
|
| | |
|
| | | for (ThreeSale threeSale : list) {
|
| | | JSONObject object = new JSONObject();
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("MM.dd HH:mm");
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
| | | SimpleDateFormat formatYears = new SimpleDateFormat("yyyy");
|
| | |
|
| | | Date todayTime = new Date();
|
| | | // 邀请id
|
| | | object.put("inviteId", threeSale.getId());
|
| | |
|
| | | // 加入队列时间
|
| | | Long createTime = threeSale.getCreateTime();
|
| | | Date inviteTime = new Date(createTime);
|
| | | object.put("inviteTime", format.format(inviteTime) + " 加入");
|
| | |
|
| | | String memoName = "";
|
| | | ThreeSaleExtraInfo threeSaleExtraInfo = threeSale.getThreeSaleExtraInfo();
|
| | | if (threeSaleExtraInfo != null) {
|
| | | if (!StringUtil.isNullOrEmpty(threeSaleExtraInfo.getNickname())) {
|
| | | memoName = threeSaleExtraInfo.getNickname();
|
| | | }
|
| | | }
|
| | | object.put("memoName", memoName);
|
| | |
|
| | | String nickName = "";
|
| | | String portrait = "";
|
| | | Long lastLoginTime = null;
|
| | |
|
| | | UserInfo worker = threeSale.getWorker();
|
| | | if (worker != null) {
|
| | | portrait = worker.getPortrait();
|
| | | lastLoginTime = worker.getLastLoginTime();
|
| | | nickName = worker.getNickName();
|
| | | }
|
| | | object.put("nickName", nickName);
|
| | | object.put("portrait", portrait);
|
| | |
|
| | | int state = 0;
|
| | | String fontColor1 = "#888888";
|
| | | String fontColor2 = "#F14242";
|
| | |
|
| | | JSONArray array = new JSONArray();
|
| | | if (threeSale.getState()) {
|
| | | state = 1;
|
| | | if (lastLoginTime == null) {
|
| | | lastLoginTime = threeSale.getCreateTime();
|
| | | }
|
| | |
|
| | | JSONObject contentJson = new JSONObject();
|
| | | contentJson.put("color", fontColor1);
|
| | |
|
| | | if (formatYears.format(todayTime).equals(formatYears.format(lastLoginTime))) {
|
| | | // 本年
|
| | | contentJson.put("content", "最近登录 " + sdf.format(lastLoginTime));
|
| | | } else {
|
| | | // 往年
|
| | | contentJson.put("content", "最近登录 " + format.format(lastLoginTime));
|
| | | }
|
| | |
|
| | | array.add(contentJson);
|
| | |
|
| | | } else if (threeSale.getExpire() != null
|
| | | && (threeSale.getExpire() == 1 || threeSale.getExpire().equals(1))) {
|
| | | state = 2;
|
| | | JSONObject contentJson = new JSONObject();
|
| | | contentJson.put("color", fontColor1);
|
| | | contentJson.put("content", "已经脱离邀请关系");
|
| | | array.add(contentJson);
|
| | | } else {
|
| | | state = 0;
|
| | |
|
| | | for (ThreeSale threeSale : list) {
|
| | | JSONObject object = new JSONObject();
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("MM.dd HH:mm");
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
| | | SimpleDateFormat formatYears = new SimpleDateFormat("yyyy");
|
| | | Calendar c = Calendar.getInstance();
|
| | | c.setTime(inviteTime);
|
| | | c.add(Calendar.DAY_OF_MONTH, 60);// 邀请不超过60天
|
| | |
|
| | | Date todayTime = new Date();
|
| | | // 邀请id
|
| | | object.put("inviteId", threeSale.getId());
|
| | | long days = (c.getTimeInMillis() - todayTime.getTime()) / (1000 * 3600 * 24);
|
| | | if (days < 0) {
|
| | | days = 0;
|
| | | }
|
| | |
|
| | | // 加入队列时间
|
| | | Long createTime = threeSale.getCreateTime();
|
| | | Date inviteTime = new Date(createTime);
|
| | | object.put("inviteTime", format.format(inviteTime) + " 加入");
|
| | | JSONObject contentJson1 = new JSONObject();
|
| | | contentJson1.put("color", fontColor1);
|
| | | contentJson1.put("content", "将于");
|
| | |
|
| | | String memoName = "";
|
| | | ThreeSaleExtraInfo threeSaleExtraInfo = threeSale.getThreeSaleExtraInfo();
|
| | | if (threeSaleExtraInfo != null) {
|
| | | if (!StringUtil.isNullOrEmpty(threeSaleExtraInfo.getNickname())) {
|
| | | memoName = threeSaleExtraInfo.getNickname();
|
| | | }
|
| | | }
|
| | | object.put("memoName", memoName);
|
| | | JSONObject contentJson2 = new JSONObject();
|
| | | contentJson2.put("color", fontColor2);
|
| | | contentJson2.put("content", days + "天");
|
| | |
|
| | | String nickName = "";
|
| | | String portrait = "";
|
| | | Long lastLoginTime = null;
|
| | | JSONObject contentJson3 = new JSONObject();
|
| | | contentJson3.put("color", fontColor1);
|
| | | contentJson3.put("content", "后脱离邀请关系");
|
| | |
|
| | | UserInfo worker = threeSale.getWorker();
|
| | | if (worker != null) {
|
| | | portrait = worker.getPortrait();
|
| | | lastLoginTime = worker.getLastLoginTime();
|
| | | nickName = worker.getNickName();
|
| | | }
|
| | | object.put("nickName", nickName);
|
| | | object.put("portrait", portrait);
|
| | | array.add(contentJson1);
|
| | | array.add(contentJson2);
|
| | | array.add(contentJson3);
|
| | | }
|
| | |
|
| | | int state = 0;
|
| | | String fontColor1 = "#888888";
|
| | | String fontColor2 = "#F14242";
|
| | | object.put("state", state);
|
| | | object.put("recentMsg", array);
|
| | |
|
| | | JSONArray array = new JSONArray();
|
| | | if (threeSale.getState()) {
|
| | | state = 1;
|
| | | if (lastLoginTime == null) {
|
| | | lastLoginTime = threeSale.getCreateTime();
|
| | | }
|
| | | resultArray.add(object);
|
| | | }
|
| | |
|
| | | JSONObject contentJson = new JSONObject();
|
| | | contentJson.put("color", fontColor1);
|
| | | result.put("count", count);
|
| | | result.put("result_list", resultArray);
|
| | |
|
| | | if (formatYears.format(todayTime).equals(formatYears.format(lastLoginTime))) {
|
| | | // 本年
|
| | | contentJson.put("content", "最近登录 " + sdf.format(lastLoginTime));
|
| | | } else {
|
| | | // 往年
|
| | | contentJson.put("content", "最近登录 " + format.format(lastLoginTime));
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | | array.add(contentJson);
|
| | | @Override
|
| | | public List<ThreeSale> listByWorkerId(Long workerId) {
|
| | | return threeSaleMapper.listByWorkerId(workerId);
|
| | | }
|
| | |
|
| | | } else if (threeSale.getExpire() != null
|
| | | && (threeSale.getExpire() == 1 || threeSale.getExpire().equals(1))) {
|
| | | state = 2;
|
| | | JSONObject contentJson = new JSONObject();
|
| | | contentJson.put("color", fontColor1);
|
| | | contentJson.put("content", "已经脱离邀请关系");
|
| | | array.add(contentJson);
|
| | | } else {
|
| | | state = 0;
|
| | | @Override
|
| | | public int getSuccessRelationshipNum(Long uid) {
|
| | | return threeSaleMapper.getSuccessRelationshipNum(uid);
|
| | | }
|
| | |
|
| | | Calendar c = Calendar.getInstance();
|
| | | c.setTime(inviteTime);
|
| | | c.add(Calendar.DAY_OF_MONTH, 60);// 邀请不超过60天
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void bindInviteRelationship(Long workerId, Long bossId) throws ThreeSaleException {
|
| | | if (workerId == null || bossId == null)
|
| | | throw new ThreeSaleException(1, "用户信息为空");
|
| | | //判断是否存在邀请权限
|
| | | SystemEnum system1 = userInfoService.getUserSystem(workerId);
|
| | | if (!SystemInfoUtil.hasFunctions(system1, SystemFunction.threeSale))
|
| | | throw new ThreeSaleException(2, "无法建立邀请关系");
|
| | |
|
| | | long days = (c.getTimeInMillis() - todayTime.getTime()) / (1000 * 3600 * 24);
|
| | | if (days < 0) {
|
| | | days = 0;
|
| | | }
|
| | | SystemEnum system2 = userInfoService.getUserSystem(bossId);
|
| | | if (!SystemInfoUtil.hasFunctions(system2, SystemFunction.threeSale))
|
| | | throw new ThreeSaleException(2, "无法建立邀请关系");
|
| | |
|
| | | JSONObject contentJson1 = new JSONObject();
|
| | | contentJson1.put("color", fontColor1);
|
| | | contentJson1.put("content", "将于");
|
| | | if (system1 != system2)
|
| | | throw new ThreeSaleException(2, "无法建立邀请关系");
|
| | |
|
| | | JSONObject contentJson2 = new JSONObject();
|
| | | contentJson2.put("color", fontColor2);
|
| | | contentJson2.put("content", days + "天");
|
| | | // 新建立确定关系
|
| | | ThreeSale threeSale = new ThreeSale();
|
| | | threeSale.setBoss(new UserInfo(bossId));
|
| | | threeSale.setWorker(new UserInfo(workerId));
|
| | | threeSale.setState(true);
|
| | | threeSale.setExpire(ThreeSale.EXPIRE_NORMAL);
|
| | | threeSale.setSucceedTime(java.lang.System.currentTimeMillis());
|
| | | threeSale.setCreateTime(java.lang.System.currentTimeMillis());
|
| | | threeSale.setUpdateTime(java.lang.System.currentTimeMillis());
|
| | | threeSaleMapper.insertSelective(threeSale);
|
| | |
|
| | | JSONObject contentJson3 = new JSONObject();
|
| | | contentJson3.put("color", fontColor1);
|
| | | contentJson3.put("content", "后脱离邀请关系");
|
| | | // 邀请成功:消息、相关处理
|
| | | inviteSuccess(workerId, bossId);
|
| | | }
|
| | |
|
| | | array.add(contentJson1);
|
| | | array.add(contentJson2);
|
| | | array.add(contentJson3);
|
| | | }
|
| | | /**
|
| | | * 邀请成功
|
| | | */
|
| | | @Transactional
|
| | | private void inviteSuccess(Long workerId, Long bossId) {
|
| | | // 同步粉丝消息
|
| | | teamFansInfoService.addFansInfo(workerId, bossId, new Date());
|
| | |
|
| | | object.put("state", state);
|
| | | object.put("recentMsg", array);
|
| | | if (!Constant.IS_TEST) {
|
| | | UserInviteMQMsg msg = new UserInviteMQMsg(bossId, workerId, null, new Date(),
|
| | | UserInviteMQMsg.STATE_SUCCESS);
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.inviteSuccess, msg);
|
| | | message.setStartDeliverTime(java.lang.System.currentTimeMillis() + 5000);
|
| | | rocketMQManager.sendNormalMsg(message, 5000L, null);
|
| | | }
|
| | |
|
| | | resultArray.add(object);
|
| | | }
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | try { // 邀请金币
|
| | | integralGetService.addInviteLevelOne(bossId, workerId);
|
| | | } catch (Exception e) {
|
| | | LogHelper.error(e);
|
| | | }
|
| | |
|
| | | result.put("count", count);
|
| | | result.put("result_list", resultArray);
|
| | | // 邀请成功消息
|
| | | try {
|
| | | // 直接粉丝邀请成功
|
| | | UserInfo invitee = userInfoService.selectByPKey(workerId);
|
| | | userInviteMsgNotificationService.directInviteSuccess(bossId, invitee.getNickName(),
|
| | | invitee.getPortrait(), new Date());
|
| | |
|
| | | return result;
|
| | | }
|
| | | // 间接粉丝邀请成功
|
| | | ThreeSale myBoss = threeSaleMapper.getMyBoss(bossId);
|
| | | if (myBoss != null) {
|
| | | UserInfo boss = userInfoService.selectByPKey(bossId);
|
| | | userInviteMsgNotificationService.indirectInviteSuccess(myBoss.getBoss().getId(),
|
| | | boss.getNickName(), invitee.getNickName(), invitee.getPortrait(), new Date());
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.error(e);
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ThreeSale> listByWorkerId(Long workerId) {
|
| | | return threeSaleMapper.listByWorkerId(workerId);
|
| | | }
|
| | | /**
|
| | | * 根据邀请者查询关系
|
| | | *
|
| | | * @param workerId
|
| | | * @return
|
| | | */
|
| | | @Override
|
| | | public ThreeSale getByWorkerId(Long workerId) {
|
| | | return threeSaleMapper.getByWorkerId(workerId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int getSuccessRelationshipNum(Long uid) {
|
| | | return threeSaleMapper.getSuccessRelationshipNum(uid);
|
| | | }
|
| | | @Override
|
| | | public ThreeSale selectByWorkerId(Long workerId) {
|
| | | return threeSaleMapper.selectSuccessByWorkerId(workerId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void bindInviteRelationship(Long workerId, Long bossId) throws ThreeSaleException {
|
| | | if (workerId == null || bossId == null)
|
| | | throw new ThreeSaleException(1, "用户信息为空");
|
| | | @Override
|
| | | public ThreeSale getNearRelationByBossIdAndWorkerId(Long bossId, Long workerId) {
|
| | | return threeSaleMapper.getNearRelationByBossIdAndWorkerId(bossId, workerId);
|
| | | }
|
| | |
|
| | | // 新建立确定关系
|
| | | ThreeSale threeSale = new ThreeSale();
|
| | | threeSale.setBoss(new UserInfo(bossId));
|
| | | threeSale.setWorker(new UserInfo(workerId));
|
| | | threeSale.setState(true);
|
| | | threeSale.setExpire(ThreeSale.EXPIRE_NORMAL);
|
| | | threeSale.setSucceedTime(java.lang.System.currentTimeMillis());
|
| | | threeSale.setCreateTime(java.lang.System.currentTimeMillis());
|
| | | threeSale.setUpdateTime(java.lang.System.currentTimeMillis());
|
| | | threeSaleMapper.insertSelective(threeSale);
|
| | | @Override
|
| | | public List<ThreeSale> getSuccessByDate(Long bossId, Long minTime, Long maxTime) {
|
| | | return threeSaleMapper.getSuccessByDate(bossId, minTime, maxTime);
|
| | | }
|
| | |
|
| | | // 邀请成功:消息、相关处理
|
| | | inviteSuccess(workerId, bossId);
|
| | | }
|
| | | @Override
|
| | | public List<ThreeSale> listFirstTeam(long start, int count, Long uid) {
|
| | | return threeSaleMapper.listFirstTeam(start, count, uid, null);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 邀请成功
|
| | | */
|
| | | @Transactional
|
| | | private void inviteSuccess(Long workerId, Long bossId) {
|
| | | if (!Constant.IS_TEST) {
|
| | | UserInviteMQMsg msg = new UserInviteMQMsg(bossId, workerId, null, new Date(),
|
| | | UserInviteMQMsg.STATE_SUCCESS);
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.inviteSuccess, msg);
|
| | | producer.send(message);
|
| | | }
|
| | | @Override
|
| | | public List<ThreeSale> listSecondTeam(long start, int count, Long uid) {
|
| | | return threeSaleMapper.listSecondTeam(start, count, uid, null);
|
| | | }
|
| | |
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | try { // 邀请金币
|
| | | integralGetService.addInviteLevelOne(bossId, workerId);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | @Override
|
| | | public List<ThreeSale> listFirstTeam(long start, int count, Long uid, List<Long> listId) {
|
| | | return threeSaleMapper.listFirstTeam(start, count, uid, listId);
|
| | | }
|
| | |
|
| | | try {
|
| | | // 直接粉丝邀请成功
|
| | | UserInfo invitee = userInfoService.selectByPKey(workerId);
|
| | | userInviteMsgNotificationService.directInviteSuccess(bossId, invitee.getNickName(),
|
| | | invitee.getPortrait(), new Date());
|
| | | @Override
|
| | | public List<ThreeSale> listSecondTeam(long start, int count, Long uid, List<Long> listId) {
|
| | | return threeSaleMapper.listSecondTeam(start, count, uid, listId);
|
| | | }
|
| | |
|
| | | // 间接粉丝邀请成功
|
| | | ThreeSale myBoss = threeSaleMapper.getMyBoss(bossId);
|
| | | if (myBoss != null) {
|
| | | UserInfo boss = userInfoService.selectByPKey(bossId);
|
| | | userInviteMsgNotificationService.indirectInviteSuccess(myBoss.getBoss().getId(),
|
| | | boss.getNickName(), invitee.getNickName(), invitee.getPortrait(), new Date());
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | | @Override
|
| | | public long countFirstTeam(Long uid) {
|
| | | return threeSaleMapper.countFirstTeam(uid, null);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 根据邀请者查询关系
|
| | | * |
| | | * @param workerId
|
| | | * @return
|
| | | */
|
| | | @Override
|
| | | public ThreeSale getByWorkerId(Long workerId) {
|
| | | return threeSaleMapper.getByWorkerId(workerId);
|
| | | }
|
| | | @Override
|
| | | public long countSecondTeam(Long uid) {
|
| | | return threeSaleMapper.countSecondTeam(uid, null);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public ThreeSale selectByWorkerId(Long workerId) {
|
| | | return threeSaleMapper.selectSuccessByWorkerId(workerId);
|
| | | }
|
| | | @Override
|
| | | public long countFirstTeam(Long uid, List<Long> listId) {
|
| | | return threeSaleMapper.countFirstTeam(uid, listId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public ThreeSale getNearRelationByBossIdAndWorkerId(Long bossId, Long workerId) {
|
| | | return threeSaleMapper.getNearRelationByBossIdAndWorkerId(bossId, workerId);
|
| | | }
|
| | | @Override
|
| | | public long countSecondTeam(Long uid, List<Long> listId) {
|
| | | return threeSaleMapper.countSecondTeam(uid, listId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ThreeSale> getSuccessByDate(Long bossId, Long minTime, Long maxTime) {
|
| | | return threeSaleMapper.getSuccessByDate(bossId, minTime, maxTime);
|
| | | }
|
| | | @Override
|
| | | public long countFirstTeamByDate(Long uid, int dayType) {
|
| | | return threeSaleMapper.countFirstTeamByDate(uid, dayType);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ThreeSale> listFirstTeam(long start, int count, Long uid) {
|
| | | return threeSaleMapper.listFirstTeam(start, count, uid);
|
| | | }
|
| | | @Override
|
| | | public long countSecondTeamByDate(Long uid, int dayType) {
|
| | | return threeSaleMapper.countSecondTeamByDate(uid, dayType);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ThreeSale> listSecondTeam(long start, int count, Long uid) {
|
| | | return threeSaleMapper.listSecondTeam(start, count, uid);
|
| | | }
|
| | | @Override
|
| | | public ThreeSale selectLatestByWorkerIdAndState(Long workerId, int state) {
|
| | | return threeSaleMapper.selectLatestByWorkerIdAndState(workerId, state);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countFirstTeam(Long uid) {
|
| | | return threeSaleMapper.countFirstTeam(uid);
|
| | | }
|
| | | @Override
|
| | | public ThreeSale getByWorkerIdAndTime(Long workerId, long time) {
|
| | | return threeSaleMapper.getByWorkerIdAndTime(workerId, time);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countSecondTeam(Long uid) {
|
| | | return threeSaleMapper.countSecondTeam(uid);
|
| | | }
|
| | | @Override
|
| | | public void inviteSeparate(Long workerId, Long bossId) {
|
| | | threeSaleMapper.inviteSeparate(workerId, bossId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public ThreeSale selectLatestByWorkerIdAndState(Long workerId, int state) {
|
| | | return threeSaleMapper.selectLatestByWorkerIdAndState(workerId, state);
|
| | | }
|
| | | @Override
|
| | | public long getTeamOrderNumByWorkerId(Long workerId) {
|
| | | return threeSaleMapper.getTeamOrderNumByWorkerId(workerId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public ThreeSale getByWorkerIdAndTime(Long workerId, long time) {
|
| | | return threeSaleMapper.getByWorkerIdAndTime(workerId, time);
|
| | | }
|
| | | @Override
|
| | | public List<ThreeSale> getValidWorkerIdsByTime(Long bossId, long limitTime) {
|
| | | return threeSaleMapper.getValidWorkerIdsByTime(bossId, limitTime);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void inviteSeparate(Long workerId, Long bossId) {
|
| | | threeSaleMapper.inviteSeparate(workerId, bossId);
|
| | | }
|
| | | @Override
|
| | | public List<ThreeSale> getMyBossDeepList(Long uid, int deep) {
|
| | |
|
| | | @Override
|
| | | public long getTeamOrderNumByWorkerId(Long workerId) {
|
| | | return threeSaleMapper.getTeamOrderNumByWorkerId(workerId);
|
| | | }
|
| | | List<ThreeSale> deepList = new ArrayList<>();
|
| | | ThreeSale boss = getMyBoss(uid);
|
| | | while (deep > 0 && boss != null) {
|
| | | deep--;
|
| | | deepList.add(boss);
|
| | | boss = getMyBoss(boss.getBoss().getId());
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ThreeSale> getValidWorkerIdsByTime(Long bossId, long limitTime) {
|
| | | return threeSaleMapper.getValidWorkerIdsByTime(bossId, limitTime);
|
| | | }
|
| | | return deepList;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ThreeSale> getMyBossDeepList(Long uid, int deep) {
|
| | | @Override
|
| | | public List<ThreeSale> getMyBossDeepList(Long uid) {
|
| | | // TODO 需要更加简便的方式处理
|
| | | return getMyBossDeepList(uid, 100);
|
| | | }
|
| | |
|
| | | List<ThreeSale> deepList = new ArrayList<>();
|
| | | ThreeSale boss = getMyBoss(uid);
|
| | | while (deep > 0 && boss != null) {
|
| | | deep--;
|
| | | deepList.add(boss);
|
| | | boss = getMyBoss(boss.getBoss().getId());
|
| | | }
|
| | | @Override
|
| | | public Long getTopBoss(Long uid) {
|
| | | Long bossUid = null;
|
| | | UserInfo boss = getBoss(uid);
|
| | | while (boss != null) {
|
| | | bossUid = boss.getId();
|
| | | boss = getBoss(boss.getId());
|
| | | }
|
| | | return bossUid;
|
| | | }
|
| | |
|
| | | return deepList;
|
| | | }
|
| | | @Override
|
| | | public List<ThreeSale> listAll(Date minTime, Date maxTime, int page, int pageSize) {
|
| | | return threeSaleMapper.listAll(minTime == null ? null : minTime.getTime(),
|
| | | maxTime == null ? null : maxTime.getTime(), (page - 1) * pageSize, pageSize);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ThreeSale> getMyBossDeepList(Long uid) {
|
| | | // TODO 需要更加简便的方式处理
|
| | | return getMyBossDeepList(uid, 100);
|
| | | }
|
| | | @Override
|
| | | public long countAll(Date minTime, Date maxTime) {
|
| | | return threeSaleMapper.countAll(minTime == null ? null : minTime.getTime(),
|
| | | maxTime == null ? null : maxTime.getTime());
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Long getTopBoss(Long uid) {
|
| | | Long bossUid = null;
|
| | | UserInfo boss = getBoss(uid);
|
| | | while (boss != null) {
|
| | | bossUid = boss.getId();
|
| | | boss = getBoss(boss.getId());
|
| | | }
|
| | | return bossUid;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ThreeSale> listAll(int page, int pageSize) {
|
| | | return threeSaleMapper.listAll((page-1)*pageSize, pageSize);
|
| | | }
|
| | | @Override
|
| | | public List<Long> getAllBossId() {
|
| | | return threeSaleMapper.getAllBossId();
|
| | | }
|
| | |
|
| | | }
|