admin
2025-02-25 30d8e227e8d823b6c38c3b9c90ac2df03b63befe
fanli/src/main/java/com/yeshi/fanli/service/inter/user/invite/ThreeSaleSerivce.java
@@ -1,276 +1,337 @@
package com.yeshi.fanli.service.inter.user.invite;
import java.util.List;
import com.yeshi.fanli.entity.bus.user.ThreeSale;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.exception.user.ThreeSaleException;
import net.sf.json.JSONObject;
public interface ThreeSaleSerivce {
   /**
    * 获取该用户上级用户
    *
    * @param uid
    *            用户ID
    * @return
    */
   UserInfo getBoss(long uid);
   void bind(UserInfo worker, UserInfo boss) throws ThreeSaleException;
   /**
    * 邀请关系生效
    *
    * @param worker
    */
   void effective(UserInfo worker);
   /**
    * 一级查询
    *
    * @param start
    * @param count
    * @param uid
    * @param startTime
    * @param endTime
    * @return
    */
   public List<ThreeSale> listFirstTeamQuery(long start, int count, Long uid, Integer state, String startTime,
         String endTime, Integer validState);
   public long countFirstTeamQuery(Long uid, Integer state, String startTime, String endTime, Integer validState);
   /**
    * 二级查询
    *
    * @param start
    * @param count
    * @param uid
    * @param startTime
    * @param endTime
    * @return
    */
   public List<ThreeSale> listSecondTeamQuery(long start, int count, Long uid, Integer state, String startTime,
         String endTime, Integer validState);
   public long countSecondTeamQuery(Long uid, Integer state, String startTime, String endTime, Integer validState);
   /**
    * 上级查询
    *
    * @param start
    * @param count
    * @param uid
    * @return
    */
   public List<ThreeSale> listSuperiorQuery(long start, int count, Integer state, Long uid);
   public long countSuperiorQuery(Integer state, Long uid);
   /**
    * 前端查询一级队员
    *
    * @param start
    * @param count
    * @param uid
    * @return
    */
   public JSONObject getMyFirstTeam(long start, int count, Long uid);
   /**
    * 前端查询二级队员
    *
    * @param start
    * @param count
    * @param uid
    * @return
    */
   public JSONObject getMySecondTeam(long start, int count, Long uid);
   /**
    * 获取上级
    *
    * @param uid
    * @return
    */
   public ThreeSale getMyBoss(Long uid);
   public ThreeSale selectByPrimaryKey(Long id);
   /**
    * 查询队员记录 id+uid
    *
    * @param id
    * @param uid
    * @param expire
    *            是否失效状态
    * @return
    */
   public List<ThreeSale> listbyIdAndBossId(Long id, Long uid, Integer expire);
   /**
    * 根据邀请者查询关系
    *
    * @param workerId
    * @return
    */
   public List<ThreeSale> listByWorkerId(Long workerId);
   /**
    * 获取成功邀请关系数量
    *
    * @param uid
    * @return
    */
   public int getSuccessRelationshipNum(Long uid);
   /**
    * 根据邀请者查询关系
    *
    * @param workerId
    * @return
    */
   public ThreeSale getByWorkerId(Long workerId);
   /**
    * 微信激活邀请队员关系
    * @param invitee
    * @param inviterId
    * @param threeSaleOld
    * @throws ThreeSaleException
    */
   public void bindInviteRelationship(Long workerId, Long bossId) throws ThreeSaleException;
   /**
   * 根据下级查找对象
    * @param workerId
    * @return
    */
   public ThreeSale selectByWorkerId(Long workerId);
   /**
    * 查询最近一条数据(根据下级用户ID与状态)
    * @param workerId
    * @param state
    * @return
    */
   public ThreeSale selectLatestByWorkerIdAndState(Long workerId, int state);
   /**
    * 时间段呢 邀请成功信息
    * @param bossId
    * @param minTime
    * @param maxTime
    * @return
    */
   public List<ThreeSale> getSuccessByDate(Long bossId, Long minTime, Long maxTime);
   /**
    * 一级队员
    * @param start
    * @param count
    * @param uid
    * @param state
    * @return
    */
   public List<ThreeSale> listFirstTeam(long start, int count, Long uid);
   /**
    * 二级队员
    * @param start
    * @param count
    * @param uid
    * @param state
    * @return
    */
   public List<ThreeSale> listSecondTeam(long start, int count, Long uid);
   /**
    * 统计直接粉丝数量
    *
    * @param uid
    * @return
    */
   public long countFirstTeam(Long uid);
   /**
    * 统计间接粉丝数量
    * @param uid
    * @return
    */
   public long countSecondTeam(Long uid);
   /**
    * 查询邀请关系 时间筛选
    * @param workerId 下级id
    * @param time
    * @return
    */
   public ThreeSale getByWorkerIdAndTime(Long workerId, long time);
   /**
    * 邀请关系脱离
    * @param workerId
    * @param bossId
    */
   public void inviteSeparate(Long workerId, Long bossId);
   /*
    * 该队员 在队中排第几
    */
   public long getTeamOrderNumByWorkerId(Long workerId);
   /**
    * 查询最近关系 - 有效则优先
    * @param bossId
    * @param workerId
    * @return
    */
   public ThreeSale getNearRelationByBossIdAndWorkerId(Long bossId, Long workerId);
   /**
    * 根据时间筛选出有效粉丝
    * @param bossId
    * @param limitTime
    * @return
    */
   public List<ThreeSale> getValidWorkerIdsByTime(Long bossId, long limitTime);
   /**
    * 获取上几级邀请人
    * @Title: getMyBossDeepList
    * @Description:
    * @param uid
    * @param deep 上deep级
    * @return
    * List<ThreeSale> 返回类型
    * @throws
    */
   public List<ThreeSale> getMyBossDeepList(Long uid, int deep);
   /**
    * 获取上级列表
    * @Title: getMyBossDeepList
    * @Description:
    * @param uid
    * @return
    * List<ThreeSale> 返回类型
    * @throws
    */
   public List<ThreeSale> getMyBossDeepList(Long uid);
   /**
    * 获取用户的顶级boss
    * @Title: getTopBoss
    * @Description:
    * @param uid
    * @return
    * Long 返回类型
    * @throws
    */
   public Long getTopBoss(Long uid);
}
package com.yeshi.fanli.service.inter.user.invite;
import java.util.Date;
import java.util.List;
import com.yeshi.fanli.entity.bus.user.ThreeSale;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.exception.user.ThreeSaleException;
import net.sf.json.JSONObject;
public interface ThreeSaleSerivce {
   /**
    * 获取该用户上级用户
    *
    * @param uid
    *            用户ID
    * @return
    */
   UserInfo getBoss(long uid);
   void bind(UserInfo worker, UserInfo boss) throws ThreeSaleException;
   /**
    * 邀请关系生效
    *
    * @param worker
    */
   void effective(UserInfo worker);
   /**
    * 一级查询
    *
    * @param start
    * @param count
    * @param uid
    * @param startTime
    * @param endTime
    * @return
    */
   public List<ThreeSale> listFirstTeamQuery(long start, int count, Long uid, Integer state, String startTime,
         String endTime, Integer validState);
   public long countFirstTeamQuery(Long uid, Integer state, String startTime, String endTime, Integer validState);
   /**
    * 二级查询
    *
    * @param start
    * @param count
    * @param uid
    * @param startTime
    * @param endTime
    * @return
    */
   public List<ThreeSale> listSecondTeamQuery(long start, int count, Long uid, Integer state, String startTime,
         String endTime, Integer validState);
   public long countSecondTeamQuery(Long uid, Integer state, String startTime, String endTime, Integer validState);
   /**
    * 上级查询
    *
    * @param start
    * @param count
    * @param uid
    * @return
    */
   public List<ThreeSale> listSuperiorQuery(long start, int count, Integer state, Long uid);
   public long countSuperiorQuery(Integer state, Long uid);
   /**
    * 前端查询一级队员
    *
    * @param start
    * @param count
    * @param uid
    * @return
    */
   public JSONObject getMyFirstTeam(long start, int count, Long uid);
   /**
    * 前端查询二级队员
    *
    * @param start
    * @param count
    * @param uid
    * @return
    */
   public JSONObject getMySecondTeam(long start, int count, Long uid);
   /**
    * 获取上级
    *
    * @param uid
    * @return
    */
   public ThreeSale getMyBoss(Long uid);
   public ThreeSale selectByPrimaryKey(Long id);
   /**
    * 查询队员记录 id+uid
    *
    * @param id
    * @param uid
    * @param expire
    *            是否失效状态
    * @return
    */
   public List<ThreeSale> listbyIdAndBossId(Long id, Long uid, Integer expire);
   /**
    * 根据邀请者查询关系
    *
    * @param workerId
    * @return
    */
   public List<ThreeSale> listByWorkerId(Long workerId);
   /**
    * 获取成功邀请关系数量
    *
    * @param uid
    * @return
    */
   public int getSuccessRelationshipNum(Long uid);
   /**
    * 根据邀请者查询关系
    *
    * @param workerId
    * @return
    */
   public ThreeSale getByWorkerId(Long workerId);
   /**
    * 微信激活邀请队员关系
    * @param invitee
    * @param inviterId
    * @param threeSaleOld
    * @throws ThreeSaleException
    */
   public void bindInviteRelationship(Long workerId, Long bossId) throws ThreeSaleException;
   /**
   * 根据下级查找对象
    * @param workerId
    * @return
    */
   public ThreeSale selectByWorkerId(Long workerId);
   /**
    * 查询最近一条数据(根据下级用户ID与状态)
    * @param workerId
    * @param state
    * @return
    */
   public ThreeSale selectLatestByWorkerIdAndState(Long workerId, int state);
   /**
    * 时间段呢 邀请成功信息
    * @param bossId
    * @param minTime
    * @param maxTime
    * @return
    */
   public List<ThreeSale> getSuccessByDate(Long bossId, Long minTime, Long maxTime);
   /**
    * 一级队员
    * @param start
    * @param count
    * @param uid
    * @param state
    * @return
    */
   public List<ThreeSale> listFirstTeam(long start, int count, Long uid);
   /**
    * 二级队员
    * @param start
    * @param count
    * @param uid
    * @param state
    * @return
    */
   public List<ThreeSale> listSecondTeam(long start, int count, Long uid);
   /**
    * 一级队员
    * @param start
    * @param count
    * @param uid
    * @param state
    * @return
    */
   public List<ThreeSale> listFirstTeam(long start, int count, Long uid, List<Long> listId);
   /**
    * 二级队员
    * @param start
    * @param count
    * @param uid
    * @param state
    * @return
    */
   public List<ThreeSale> listSecondTeam(long start, int count, Long uid, List<Long> listId);
   public long countFirstTeam(Long uid);
   public long countSecondTeam(Long uid);
   /**
    * 统计直接粉丝数量
    *
    * @param uid
    * @return
    */
   public long countFirstTeam(Long uid, List<Long> listId);
   /**
    * 统计间接粉丝数量
    * @param uid
    * @return
    */
   public long countSecondTeam(Long uid, List<Long> listId);
   /**
    * 查询邀请关系 时间筛选
    * @param workerId 下级id
    * @param time
    * @return
    */
   public ThreeSale getByWorkerIdAndTime(Long workerId, long time);
   /**
    * 邀请关系脱离
    * @param workerId
    * @param bossId
    */
   public void inviteSeparate(Long workerId, Long bossId);
   /*
    * 该队员 在队中排第几
    */
   public long getTeamOrderNumByWorkerId(Long workerId);
   /**
    * 查询最近关系 - 有效则优先
    * @param bossId
    * @param workerId
    * @return
    */
   public ThreeSale getNearRelationByBossIdAndWorkerId(Long bossId, Long workerId);
   /**
    * 根据时间筛选出有效粉丝
    * @param bossId
    * @param limitTime
    * @return
    */
   public List<ThreeSale> getValidWorkerIdsByTime(Long bossId, long limitTime);
   /**
    * 获取上几级邀请人
    * @Title: getMyBossDeepList
    * @Description:
    * @param uid
    * @param deep 上deep级
    * @return
    * List<ThreeSale> 返回类型
    * @throws
    */
   public List<ThreeSale> getMyBossDeepList(Long uid, int deep);
   /**
    * 获取上级列表
    * @Title: getMyBossDeepList
    * @Description:
    * @param uid
    * @return
    * List<ThreeSale> 返回类型
    * @throws
    */
   public List<ThreeSale> getMyBossDeepList(Long uid);
   /**
    * 获取用户的顶级boss
    * @Title: getTopBoss
    * @Description:
    * @param uid
    * @return
    * Long 返回类型
    * @throws
    */
   public Long getTopBoss(Long uid);
   /**
    * 查询列表
    * @Title: list
    * @Description:
    * @param page
    * @param pageSize
    * @return
    * List<ThreeSale> 返回类型
    * @throws
    */
   public List<ThreeSale> listAll(Date minTime,Date maxTime, int page,int pageSize);
   public long countAll(Date minTime,Date maxTime);
   /**
    * 根日期类型进行统计直接
    */
   public long countFirstTeamByDate(Long uid, int dayType);
   /**
    *  根日期类型进行统计间接
    * @param uid
    * @param dayType
    * @return
    */
   public long countSecondTeamByDate(Long uid, int dayType);
   /**
    * 查询boosID
    * @return
    */
   public List<Long> getAllBossId();
}