| | |
| | | int insertSelective(ThreeSale record);
|
| | |
|
| | | int updateByPrimaryKey(ThreeSale record);
|
| | | |
| | |
|
| | | int updateByPrimaryKeySelective(ThreeSale record);
|
| | |
|
| | | ThreeSale selectByPrimaryKey(Long id);
|
| | | |
| | | |
| | |
|
| | | UserInfo selectBoss(Long uid);
|
| | | |
| | |
|
| | | /**
|
| | | * 根据被邀请者ID查询
|
| | | *
|
| | |
| | | * @return
|
| | | */
|
| | | ThreeSale getByWorkerId(Long workerId);
|
| | | |
| | |
|
| | | /**
|
| | | *
|
| | |
| | | * @return
|
| | | */
|
| | | ThreeSale getMyBoss(@Param("uid") Long uid);
|
| | | |
| | |
|
| | | /**
|
| | | * 根据下级查询成功的邀请关系
|
| | |
| | | */
|
| | | ThreeSale selectSuccessByWorkerId(Long workerId);
|
| | |
|
| | | |
| | | /**
|
| | | * 根据邀请者ID查询关系
|
| | | *
|
| | |
| | | * @return
|
| | | */
|
| | | List<ThreeSale> listByWorkerId(Long workerId);
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 一级查询-后台查询
|
| | |
| | | @Param("state") Integer state, @Param("startTime") String startTime, @Param("endTime") String endTime,
|
| | | @Param("validState") Integer validState);
|
| | |
|
| | | long countFirstTeamQuery(@Param("uid") Long uid, @Param("state") Integer state, @Param("startTime") String startTime,
|
| | | @Param("endTime") String endTime, @Param("validState") Integer validState);
|
| | | long countFirstTeamQuery(@Param("uid") Long uid, @Param("state") Integer state,
|
| | | @Param("startTime") String startTime, @Param("endTime") String endTime,
|
| | | @Param("validState") Integer validState);
|
| | |
|
| | | /**
|
| | | * 二级查询 -后台查询
|
| | |
| | | * @return
|
| | | */
|
| | | List<ThreeSale> listSecondTeamQuery(@Param("start") long start, @Param("count") int count, @Param("uid") Long uid,
|
| | | @Param("state") Integer state, @Param("startTime") String startTime, @Param("endTime") String endTime
|
| | | ,@Param("validState") Integer validState);
|
| | | @Param("state") Integer state, @Param("startTime") String startTime, @Param("endTime") String endTime,
|
| | | @Param("validState") Integer validState);
|
| | |
|
| | | long countSecondTeamQuery(@Param("uid") Long uid, @Param("state") Integer state,
|
| | | @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("validState") Integer validState);
|
| | | @Param("startTime") String startTime, @Param("endTime") String endTime,
|
| | | @Param("validState") Integer validState);
|
| | |
|
| | | /**
|
| | | * 上级查询 -后台查询
|
| | |
| | |
|
| | | long countSuperiorQuery(@Param("state") Integer state, @Param("uid") Long uid);
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 查询一级队员
|
| | | * @param start
|
| | |
| | | * @return
|
| | | */
|
| | | List<ThreeSale> listFirstTeam(@Param("start") long start, @Param("count") int count, @Param("uid") Long uid,
|
| | | @Param("listId")List<Long> listId);
|
| | | @Param("listId") List<Long> listId);
|
| | |
|
| | | /**
|
| | | * 查询二级队员
|
| | |
| | | * @return
|
| | | */
|
| | | List<ThreeSale> listSecondTeam(@Param("start") long start, @Param("count") int count, @Param("uid") Long uid,
|
| | | @Param("listId")List<Long> listId);
|
| | | |
| | | @Param("listId") List<Long> listId);
|
| | |
|
| | | /**
|
| | | * 统计一级队员
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | long countFirstTeam(@Param("uid") Long uid, @Param("listId")List<Long> listId);
|
| | | |
| | | long countFirstTeam(@Param("uid") Long uid, @Param("listId") List<Long> listId);
|
| | |
|
| | | /**
|
| | | * 统计二级队员
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | long countSecondTeam(@Param("uid") Long uid, @Param("listId")List<Long> listId);
|
| | | long countSecondTeam(@Param("uid") Long uid, @Param("listId") List<Long> listId);
|
| | |
|
| | |
|
| | | |
| | | /**
|
| | | * 统计一级队员
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | long countFirstTeamByDate(@Param("uid") Long uid, @Param("dayType")int dayType);
|
| | | |
| | | long countFirstTeamByDate(@Param("uid") Long uid, @Param("dayType") int dayType);
|
| | |
|
| | | /**
|
| | | * 统计二级队员
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | long countSecondTeamByDate(@Param("uid") Long uid, @Param("dayType")int dayType);
|
| | | |
| | | long countSecondTeamByDate(@Param("uid") Long uid, @Param("dayType") int dayType);
|
| | |
|
| | | /**
|
| | | * 根据id、uid查询
|
| | | *
|
| | |
| | | */
|
| | | List<ThreeSale> listbyIdAndBossId(@Param("id") Long id, @Param("uid") Long uid, @Param("expire") Integer expire);
|
| | |
|
| | | |
| | | /**
|
| | | * 获取成功邀请关系数量
|
| | | *
|
| | |
| | | * @return
|
| | | */
|
| | | int getSuccessRelationshipNum(@Param("uid") Long uid);
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 根据邀请者ID、bossID查询 有效关系
|
| | | *
|
| | |
| | | * @return
|
| | | */
|
| | | ThreeSale getRelationshipByBossIdAndWorkerId(@Param("bossId") Long bossId, @Param("workerId") Long workerId);
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 最后一次关系记录 -无论
|
| | | * @param bossId
|
| | |
| | | * @return
|
| | | */
|
| | | ThreeSale getNearRelationByBossIdAndWorkerId(@Param("bossId") Long bossId, @Param("workerId") Long workerId);
|
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 查询时间段邀请成功人信息
|
| | | * @param bossId
|
| | |
| | | * @param maxTime
|
| | | * @return
|
| | | */
|
| | | List<ThreeSale> getSuccessByDate(@Param("bossId")Long bossId,@Param("minTime")Long minTime, @Param("maxTime")Long maxTime);
|
| | | |
| | | List<ThreeSale> getSuccessByDate(@Param("bossId") Long bossId, @Param("minTime") Long minTime,
|
| | | @Param("maxTime") Long maxTime);
|
| | |
|
| | | /**
|
| | | * 查询最近的信息(根据下级ID与状态)
|
| | | * @param workerId
|
| | | * @param state
|
| | | * @return
|
| | | */
|
| | | ThreeSale selectLatestByWorkerIdAndState(@Param("workerId") Long workerId,@Param("state") int state);
|
| | | |
| | | ThreeSale selectLatestByWorkerIdAndState(@Param("workerId") Long workerId, @Param("state") int state);
|
| | |
|
| | | /**
|
| | | * 根据时间查询邀请关系
|
| | | * @param uid
|
| | |
| | | * @return
|
| | | */
|
| | | ThreeSale getByWorkerIdAndTime(@Param("workerId") Long workerId, @Param("time") long time);
|
| | | |
| | |
|
| | | /**
|
| | | * 邀请关系脱离
|
| | | * @param bossId
|
| | | * @param workerId
|
| | | */
|
| | | void inviteSeparate(@Param("workerId") Long workerId, @Param("bossId")Long bossId);
|
| | | |
| | | void inviteSeparate(@Param("workerId") Long workerId, @Param("bossId") Long bossId);
|
| | |
|
| | | /**
|
| | | * 队员在该boss 下第几个队员序号
|
| | | * @param workerId
|
| | | * @return
|
| | | */
|
| | | long getTeamOrderNumByWorkerId(@Param("workerId") Long workerId);
|
| | | |
| | |
|
| | | /**
|
| | | * 有效粉丝uid
|
| | | * @param bossId
|
| | | * @param limitTime
|
| | | * @return
|
| | | */
|
| | | List<ThreeSale> getValidWorkerIdsByTime(@Param("uid") Long uid,@Param("limitTime") long limitTime);
|
| | | List<ThreeSale> getValidWorkerIdsByTime(@Param("uid") Long uid, @Param("limitTime") long limitTime);
|
| | |
|
| | | /**
|
| | | * 查询所有列表
|
| | | * @Title: listAll
|
| | |
| | | * List<ThreeSale> 返回类型
|
| | | * @throws
|
| | | */
|
| | | List<ThreeSale> listAll(@Param("start")long start,@Param("count")int count);
|
| | | |
| | | |
| | | |
| | | List<ThreeSale> listAll(@Param("minTime") Long minTime, @Param("maxTime") Long maxTime, @Param("start") long start,
|
| | | @Param("count") int count);
|
| | |
|
| | | long countAll(@Param("minTime") Long minTime, @Param("maxTime") Long maxTime);
|
| | |
|
| | | } |
| | |
| | | package com.yeshi.fanli.dao.mybatis.user.vip;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import org.apache.ibatis.annotations.Param;
|
| | |
| | | */
|
| | | List<UserVIPPreInfo> listByUid(@Param("uid") Long uid);
|
| | |
|
| | | /**
|
| | | * 根据进度查询
|
| | | * @Title: listByProcess
|
| | | * @Description: |
| | | * @param process
|
| | | * @param start
|
| | | * @param count
|
| | | * @return |
| | | * List<UserVIPPreInfo> 返回类型
|
| | | * @throws
|
| | | */
|
| | | List<UserVIPPreInfo> listByProcess(@Param("process") int process, @Param("minTime") Date minTime,
|
| | | @Param("maxTime") Date maxTime, @Param("start") long start, @Param("count") int count);
|
| | |
|
| | | long countByProcess(@Param("process") int process, @Param("minTime") Date minTime, @Param("maxTime") Date maxTime);
|
| | |
|
| | | } |
| | |
| | | return count(query);
|
| | | }
|
| | |
|
| | | public List<ThreeSaleDetail> listByWorkerUid(Long uid) {
|
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("workerUid").is(uid));
|
| | | return findList(query);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | private Long bossUid;
|
| | | @Indexed
|
| | | @Field
|
| | | private Long workUid;
|
| | | private Long workerUid;
|
| | |
|
| | | @Field
|
| | | private Integer level;// 第几级队员
|
| | | @Field
|
| | |
| | | this.bossUid = bossUid;
|
| | | }
|
| | |
|
| | | public Long getWorkUid() {
|
| | | return workUid;
|
| | | }
|
| | |
|
| | | public void setWorkUid(Long workUid) {
|
| | | this.workUid = workUid;
|
| | | }
|
| | |
|
| | | public Integer getLevel() {
|
| | | return level;
|
| | | }
|
| | |
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Long getWorkerUid() {
|
| | | return workerUid;
|
| | | }
|
| | |
|
| | | public void setWorkerUid(Long workerUid) {
|
| | | this.workerUid = workerUid;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap"
|
| | | parameterType="java.lang.Long">
|
| | | select u.* from yeshi_ec_threeSale s
|
| | | left join yeshi_ec_user u on u.id=s.boss_id
|
| | | where s.state = 1 AND s.worker_id = #{0}
|
| | | left join
|
| | | yeshi_ec_user u on u.id=s.boss_id
|
| | | where s.state = 1 AND s.worker_id =
|
| | | #{0}
|
| | | LIMIT 1
|
| | | </select>
|
| | |
|
| | |
| | |
|
| | | <update id="inviteSeparate">
|
| | | update yeshi_ec_threeSale t set t.state = 0,t.expire = 2,
|
| | | t.updateTime = <![CDATA[UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) * 1000]]>
|
| | | t.updateTime
|
| | | = <![CDATA[UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) * 1000]]>
|
| | | where t.worker_id=#{workerId} AND t.boss_id = #{bossId}
|
| | | </update>
|
| | |
|
| | |
| | | <select id="listSecondTeamQuery" resultMap="BaseResultMap">
|
| | | SELECT yet.*,d.`tvr_type` AS validState FROM (SELECT DISTINCT(ts.`id`)
|
| | | AS id FROM `yeshi_ec_threesale` ts
|
| | | LEFT JOIN yeshi_ec_threesale tf ON ts.`boss_id`=tf.`worker_id` WHERE 1=1
|
| | | LEFT JOIN yeshi_ec_threesale tf ON
|
| | | ts.`boss_id`=tf.`worker_id` WHERE 1=1
|
| | | AND tf.`state` = 1
|
| | | <if test="uid != null">
|
| | | AND tf.`boss_id` = #{uid}
|
| | |
| | |
|
| | | <select id="listSecondTeam" resultMap="AllResultMap">
|
| | | SELECT yet.* FROM (
|
| | | SELECT DISTINCT(ts.`id`) AS id FROM `yeshi_ec_threesale` ts
|
| | | LEFT JOIN yeshi_ec_threesale tf ON ts.`boss_id`= tf.`worker_id`
|
| | | SELECT DISTINCT(ts.`id`) AS id FROM
|
| | | `yeshi_ec_threesale` ts
|
| | | LEFT JOIN yeshi_ec_threesale tf ON
|
| | | ts.`boss_id`= tf.`worker_id`
|
| | | WHERE tf.`boss_id` = #{uid})A
|
| | | LEFT JOIN yeshi_ec_threesale yet ON yet.id =
|
| | | LEFT JOIN
|
| | | yeshi_ec_threesale yet ON yet.id =
|
| | | A.id
|
| | | <if test="listId != null and listId.size > 0">
|
| | | WHERE yet.worker_id in
|
| | |
| | |
|
| | | <select id="countSecondTeam" resultType="java.lang.Long">
|
| | | SELECT COUNT(A.id) FROM (
|
| | | SELECT DISTINCT(ts.`id`) AS id FROM `yeshi_ec_threesale` ts
|
| | | LEFT JOIN yeshi_ec_threesale tf ON ts.`boss_id`=tf.`worker_id`
|
| | | SELECT DISTINCT(ts.`id`) AS id FROM
|
| | | `yeshi_ec_threesale` ts
|
| | | LEFT JOIN yeshi_ec_threesale tf ON
|
| | | ts.`boss_id`=tf.`worker_id`
|
| | | WHERE tf.`boss_id` = #{uid}
|
| | | <if test="listId != null and listId.size > 0">
|
| | | AND tf.worker_id in
|
| | |
| | |
|
| | | <select id="countSecondTeamByDate" resultType="java.lang.Long">
|
| | | SELECT COUNT(A.id) FROM (
|
| | | SELECT DISTINCT(ts.`id`) AS id FROM `yeshi_ec_threesale` ts
|
| | | LEFT JOIN yeshi_ec_threesale tf ON ts.`boss_id`=tf.`worker_id`
|
| | | SELECT DISTINCT(ts.`id`) AS id FROM
|
| | | `yeshi_ec_threesale` ts
|
| | | LEFT JOIN yeshi_ec_threesale tf ON
|
| | | ts.`boss_id`=tf.`worker_id`
|
| | | WHERE tf.`boss_id` = #{uid}
|
| | | <if test="dayType == 1"> <!-- 今日 -->
|
| | | AND TO_DAYS(FROM_UNIXTIME(ts.createTime/1000)) = TO_DAYS(NOW())
|
| | |
| | | SELECT IFNULL(COUNT(d.`id`),0) FROM yeshi_ec_threesale d
|
| | | LEFT JOIN
|
| | | (SELECT t.`id`,t.`boss_id` FROM `yeshi_ec_threesale` t
|
| | | WHERE t.`state` = 1 AND t.`worker_id` = #{workerId} LIMIT 1)t ON
|
| | | t.`boss_id` = d.`boss_id`
|
| | | WHERE t.`state`
|
| | | = 1 AND t.`worker_id` = #{workerId} LIMIT 1)t ON
|
| | | t.`boss_id` =
|
| | | d.`boss_id`
|
| | | WHERE d.`id` <![CDATA[<=]]>t.id
|
| | | AND d.`state` = 1
|
| | | </select>
|
| | |
| | |
|
| | | <select id="getValidWorkerIdsByTime" resultMap="BaseResultMap">
|
| | | SELECT * FROM `yeshi_ec_threesale` tr
|
| | | WHERE tr.`state` = 1 AND tr.`boss_id` = #{uid} AND tr.`succeedTime` <![CDATA[>=]]>
|
| | | WHERE tr.`state` = 1 AND
|
| | | tr.`boss_id` = #{uid} AND tr.`succeedTime` <![CDATA[>=]]>
|
| | | #{limitTime}
|
| | | </select>
|
| | |
|
| | | <select id="listAll" resultMap="BaseResultMap">
|
| | | SELECT * FROM
|
| | | `yeshi_ec_threesale` limit #{start},#{count}
|
| | | `yeshi_ec_threesale`
|
| | |
|
| | | where 1=1
|
| | |
|
| | | <if test="minTime!=null">
|
| | | and tr.`succeedTime` >=#{minTime}
|
| | | </if>
|
| | |
|
| | | <if test="maxTime!=null">
|
| | | and #{maxTime}>tr.`succeedTime`
|
| | | </if>
|
| | |
|
| | | limit #{start},#{count}
|
| | | </select>
|
| | |
|
| | |
|
| | | <select id="countAll" resultType="java.lang.Long">
|
| | | SELECT count(*) FROM
|
| | | `yeshi_ec_threesale`
|
| | |
|
| | | where 1=1
|
| | |
|
| | | <if test="minTime!=null">
|
| | | and tr.`succeedTime` >=#{minTime}
|
| | | </if>
|
| | |
|
| | | <if test="maxTime!=null">
|
| | | and #{maxTime}>tr.`succeedTime`
|
| | | </if>
|
| | | </select>
|
| | |
|
| | | </mapper> |
| | |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user_vip_pre_info where vpi_uid = #{uid} |
| | | </select> |
| | | |
| | | |
| | | <select id="listByProcess" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_user_vip_pre_info where vpi_process = #{process} |
| | | |
| | | <if test="minTime!=null"> |
| | | vpi_create_time>=#{minTime} |
| | | </if> |
| | | |
| | | <if test="maxTime!=null"> |
| | | #{maxTime}>vpi_create_time |
| | | </if> |
| | | limit #{start},#{count} |
| | | </select> |
| | | |
| | | <select id="countByProcess" resultType="java.lang.Long"> |
| | | select |
| | | count(*) |
| | | from yeshi_ec_user_vip_pre_info where vpi_process = #{process} |
| | | |
| | | <if test="minTime!=null"> |
| | | vpi_create_time>=#{minTime} |
| | | </if> |
| | | |
| | | <if test="maxTime!=null"> |
| | | #{maxTime}>vpi_create_time |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | |
| | | </mapper> |
| | |
| | |
|
| | | @Override
|
| | | public void addThreeSaleDetail(ThreeSaleDetail detail) throws ParamsException {
|
| | | if (detail.getBossUid() == null || detail.getWorkUid() == null || detail.getLevel() == null
|
| | | if (detail.getBossUid() == null || detail.getWorkerUid() == null || detail.getLevel() == null
|
| | | || detail.getCreateTime() == null) {
|
| | | throw new ParamsException(1, "参数不完整");
|
| | | }
|
| | | String id = detail.getBossUid() + "#" + detail.getWorkUid();
|
| | | String id = detail.getBossUid() + "#" + detail.getWorkerUid();
|
| | | detail.setId(id);
|
| | | // 根据主键查询
|
| | | ThreeSaleDetail old = threeSaleDetailDao.get(id);
|
| | |
| | | ThreeSaleDetail detail = new ThreeSaleDetail();
|
| | | detail.setBossUid(tts.getBoss().getId());
|
| | | detail.setLevel(level);
|
| | | detail.setWorkUid(workerUid);
|
| | | detail.setWorkerUid(workerUid);
|
| | | if (tts.getSucceedTime() != null)
|
| | | detail.setCreateTime(new Date(tts.getSucceedTime()));
|
| | | else
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ThreeSaleDetail> listByWorkerUid(Long uid) {
|
| | | return threeSaleDetailDao.listByWorkerUid(uid);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | @Override
|
| | | public JSONObject getMyFirstTeam(long start, int count, Long uid) {
|
| | | List<ThreeSale> list = threeSaleMapper.listFirstTeam(start, count, uid,null);
|
| | | List<ThreeSale> list = threeSaleMapper.listFirstTeam(start, count, uid, null);
|
| | | if (list == null) {
|
| | | list = new ArrayList<ThreeSale>();
|
| | | }
|
| | |
| | | public long countSecondTeam(Long uid) {
|
| | | return threeSaleMapper.countSecondTeam(uid, null);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public long countFirstTeam(Long uid, List<Long> listId) {
|
| | | return threeSaleMapper.countFirstTeam(uid, listId);
|
| | |
| | | public long countSecondTeamByDate(Long uid, int dayType) {
|
| | | return threeSaleMapper.countSecondTeamByDate(uid, dayType);
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public ThreeSale selectLatestByWorkerIdAndState(Long workerId, int state) {
|
| | | return threeSaleMapper.selectLatestByWorkerIdAndState(workerId, state);
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ThreeSale> listAll(int page, int pageSize) {
|
| | | return threeSaleMapper.listAll((page-1)*pageSize, pageSize);
|
| | | 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 long countAll(Date minTime, Date maxTime) {
|
| | | return threeSaleMapper.countAll(minTime == null ? null : minTime.getTime(),
|
| | | maxTime == null ? null : maxTime.getTime());
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | info.setSourceType(UserVIPPreInfo.SOURCE_TYPE_TEAM);
|
| | | else
|
| | | info.setSourceType(UserVIPPreInfo.SOURCE_TYPE_ORDER);
|
| | | |
| | |
|
| | | addUserVIPPreInfo(info);
|
| | |
|
| | | // 升级弹框提示
|
| | |
| | | userVIPPreInfoMapper.deleteByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<UserVIPPreInfo> listByProcess(int process, Date minTime, Date maxTime, int page, int pageSize) {
|
| | | return userVIPPreInfoMapper.listByProcess(process, minTime, maxTime, (page - 1) * pageSize, pageSize);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countByProcess(int process, Date minTime, Date maxTime) {
|
| | | return userVIPPreInfoMapper.countByProcess(process, minTime, maxTime);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | public List<ThreeSaleDetail> listByBossUidAndMinLevel(Long bossUid, int minLevel, int page, int pageSize);
|
| | |
|
| | | public long countByBossUidAndMinLevel(Long bossUid, int minLevel);
|
| | | |
| | | |
| | | /**
|
| | | * 根据下级ID查询
|
| | | * @Title: listByWorkerUid
|
| | | * @Description: |
| | | * @param uid
|
| | | * @return |
| | | * List<ThreeSaleDetail> 返回类型
|
| | | * @throws
|
| | | */
|
| | | public List<ThreeSaleDetail> listByWorkerUid(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;
|
| | |
| | | * List<ThreeSale> 返回类型
|
| | | * @throws
|
| | | */
|
| | | public List<ThreeSale> listAll(int page,int pageSize);
|
| | | public List<ThreeSale> listAll(Date minTime,Date maxTime, int page,int pageSize);
|
| | | |
| | | public long countAll(Date minTime,Date maxTime);
|
| | |
|
| | | /**
|
| | | * 根日期类型进行统计直接
|
| | |
| | | package com.yeshi.fanli.service.inter.user.vip;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo;
|
| | | import com.yeshi.fanli.exception.user.vip.UserVIPInfoException;
|
| | |
| | | * @return
|
| | | */
|
| | | public UserVIPPreInfo getLatestProcessInfo(Long uid);
|
| | | |
| | |
|
| | | /**
|
| | | * 获取某个时间的进度
|
| | | *
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public UserVIPPreInfo getProcessInfo(Long uid,Date time);
|
| | | public UserVIPPreInfo getProcessInfo(Long uid, Date time);
|
| | |
|
| | | |
| | | /**
|
| | | * 根据用户ID与步骤查询
|
| | | * @Title: selectByUidAndProcess
|
| | |
| | | * UserVIPPreInfo 返回类型
|
| | | * @throws
|
| | | */
|
| | | |
| | | public UserVIPPreInfo selectByUidAndProcess(Long uid,int process);
|
| | |
|
| | | |
| | | public UserVIPPreInfo selectByUidAndProcess(Long uid, int process);
|
| | |
|
| | | /**
|
| | | * 查询进度根据不同阶段
|
| | | * @param uid
|
| | |
| | | */
|
| | | public UserVIPPreInfo getVipByProcess(Long uid, int process);
|
| | |
|
| | | |
| | |
|
| | | /**
|
| | | * 自购+ 分享订单到账 满足升级验证
|
| | | * @param uid
|
| | | */
|
| | | public void upgradeVipByMyOrder(Long uid);
|
| | |
|
| | |
|
| | | /**
|
| | | * 验证自身是否满足vip条件
|
| | | * @param uid
|
| | | */
|
| | | public void upgradeVipByTeamNum(Long uid);
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 粉丝完成收货-验证直接-间接粉丝
|
| | | * @param uid 粉丝id
|
| | | */
|
| | | public void upgradeBossVipByTeamNum(Long uid);
|
| | | |
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 根据主键删除
|
| | | * @Title: deleteByPrimaryKey
|
| | |
| | | */
|
| | | public void deleteByPrimaryKey(Long id);
|
| | |
|
| | | /**
|
| | | * 根据时间与过程查询
|
| | | * @Title: listByProcess
|
| | | * @Description: |
| | | * @param process
|
| | | * @param minTime
|
| | | * @param maxTime
|
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return |
| | | * List<UserVIPPreInfo> 返回类型
|
| | | * @throws
|
| | | */
|
| | | public List<UserVIPPreInfo> listByProcess(int process, Date minTime, Date maxTime, int page, int pageSize);
|
| | | |
| | | public long countByProcess(int process, Date minTime, Date maxTime);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.manger.user;
|
| | |
|
| | | 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.Component;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSaleDetail;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.TeamDailyRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleDetailService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.vip.TeamDailyRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | /**
|
| | | * 团队成员统计
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Component
|
| | | public class UserTeamStatisticManager {
|
| | |
|
| | | @Resource
|
| | | private UserVIPPreInfoService userVIPPreInfoService;
|
| | |
|
| | | @Resource
|
| | | private ThreeSaleDetailService threeSaleDetailService;
|
| | |
|
| | | @Resource
|
| | | private TeamDailyRecordService teamDailyRecordService;
|
| | |
|
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | |
|
| | | /**
|
| | | * 用户等级升级
|
| | | * @Title: userUpgraded
|
| | | * @Description: |
| | | * @param uid
|
| | | * @param level
|
| | | * @param date |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void userUpgraded(Long uid, UserLevelEnum level, Date date) {
|
| | |
|
| | | // 更新一级,二级,二级外响应的等级提升
|
| | |
|
| | | // 统计
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 同步会员信息(一级/二级/二级外)
|
| | | * @Title: statisticVIPData
|
| | | * @Description: |
| | | * @param minTime
|
| | | * @param maxTime
|
| | | * @return |
| | | * int 返回类型
|
| | | * @throws
|
| | | */
|
| | | private void syncVIPData(Date minTime, Date maxTime) {
|
| | |
|
| | | List<UserVIPPreInfo> totalList = new ArrayList<>();
|
| | |
|
| | | long count = userVIPPreInfoService.countByProcess(UserLevelEnum.highVIP.getLevel(), minTime, maxTime);
|
| | | int pageSize = 1000;
|
| | | int page = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | for (int i = 0; i < page; i++) {
|
| | | List<UserVIPPreInfo> list = userVIPPreInfoService.listByProcess(UserLevelEnum.highVIP.getLevel(), minTime,
|
| | | maxTime, page, pageSize);
|
| | | if (list != null)
|
| | | totalList.addAll(list);
|
| | | }
|
| | |
|
| | | count = userVIPPreInfoService.countByProcess(UserLevelEnum.superVIP.getLevel(), minTime, maxTime);
|
| | | page = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | for (int i = 0; i < page; i++) {
|
| | | List<UserVIPPreInfo> list = userVIPPreInfoService.listByProcess(UserLevelEnum.superVIP.getLevel(), minTime,
|
| | | maxTime, page, pageSize);
|
| | | if (list != null)
|
| | | totalList.addAll(list);
|
| | | }
|
| | |
|
| | | Map<String, Integer> map = new HashMap<>();
|
| | |
|
| | | for (UserVIPPreInfo vipPre : totalList) {
|
| | | String day = TimeUtil.getGernalTime(vipPre.getCreateTime().getTime(), "yyyy-MM-dd");
|
| | | List<ThreeSaleDetail> list = threeSaleDetailService.listByWorkerUid(vipPre.getUid());
|
| | | for (ThreeSaleDetail ts : list) {
|
| | | String key = ts.getBossUid() + "#" + vipPre.getProcess() + "#" + day + "#";
|
| | | if (ts.getLevel() == 1) {
|
| | | key += "1";
|
| | | } else if (ts.getLevel() == 2) {
|
| | | key += "2";
|
| | | } else {
|
| | | key += "3";
|
| | | }
|
| | |
|
| | | if (map.get(key) == null) {
|
| | | map.put(key, 0);
|
| | | }
|
| | |
|
| | | map.put(key, map.get(key) + 1);
|
| | | }
|
| | | }
|
| | |
|
| | | for (java.util.Iterator<String> its = map.keySet().iterator(); its.hasNext();) {
|
| | | String key = its.next();
|
| | | Long uid = Long.parseLong(key.split("#")[0]);
|
| | | String day = key.split("#")[1];
|
| | | int process = Integer.parseInt(key.split("#")[2]);
|
| | | int level = Integer.parseInt(key.split("#")[3]);
|
| | |
|
| | | TeamDailyRecord record = new TeamDailyRecord();
|
| | | record.setUid(uid);
|
| | | record.setCountDay(new Date(TimeUtil.convertToTimeTemp(day, "yyyy-MM-dd")));
|
| | | if (level == 1) {
|
| | | String tempKey = uid + "#" + day + "#" + UserLevelEnum.highVIP.getLevel() + "#" + level;
|
| | | record.setFirstHighVIP(map.get(tempKey));
|
| | |
|
| | | tempKey = uid + "#" + day + "#" + UserLevelEnum.superVIP.getLevel() + "#" + level;
|
| | | record.setFirstSuperVIP(map.get(tempKey));
|
| | |
|
| | | } else if (level == 2) {
|
| | |
|
| | | String tempKey = uid + "#" + day + "#" + UserLevelEnum.highVIP.getLevel() + "#" + level;
|
| | | record.setSecondHighVIP(map.get(tempKey));
|
| | |
|
| | | tempKey = uid + "#" + day + "#" + UserLevelEnum.superVIP.getLevel() + "#" + level;
|
| | | record.setSecondSuperVIP(map.get(tempKey));
|
| | |
|
| | | } else {
|
| | | String tempKey = uid + "#" + day + "#" + UserLevelEnum.highVIP.getLevel() + "#" + level;
|
| | | record.setBeyondHighVIP(map.get(tempKey));
|
| | |
|
| | | tempKey = uid + "#" + day + "#" + UserLevelEnum.superVIP.getLevel() + "#" + level;
|
| | | record.setBeyondSuperVIP(map.get(tempKey));
|
| | | }
|
| | | // TODO 保存
|
| | | // teamDailyRecordService.
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 同步注册信息
|
| | | * @Title: syncRegisterData
|
| | | * @Description: |
| | | * @param minTime
|
| | | * @param maxTime |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | private void syncData(Date minTime, Date maxTime) {
|
| | | List<ThreeSale> totalList = new ArrayList<>();
|
| | | long count = threeSaleSerivce.countAll(minTime, maxTime);
|
| | | int pageSize = 1000;
|
| | | int page = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | for (int i = 0; i < page; i++) {
|
| | | List<ThreeSale> list = threeSaleSerivce.listAll(minTime, maxTime, page, pageSize);
|
| | | if (list != null)
|
| | | totalList.addAll(list);
|
| | | }
|
| | |
|
| | | Map<String, Integer> map = new HashMap<>();
|
| | |
|
| | | for (ThreeSale threeSale : totalList) {
|
| | | String day = TimeUtil.getGernalTime(threeSale.getSucceedTime(), "yyyy-MM-dd");
|
| | | List<ThreeSaleDetail> list = threeSaleDetailService.listByWorkerUid(threeSale.getWorker().getId());
|
| | | for (ThreeSaleDetail ts : list) {
|
| | | String key = ts.getBossUid() + "#" + day + "#";
|
| | | if (ts.getLevel() == 1) {
|
| | | key += "1";
|
| | | } else if (ts.getLevel() == 2) {
|
| | | key += "2";
|
| | | } else {
|
| | | key += "3";
|
| | | }
|
| | |
|
| | | if (map.get(key) == null) {
|
| | | map.put(key, 0);
|
| | | }
|
| | |
|
| | | map.put(key, map.get(key) + 1);
|
| | | }
|
| | | }
|
| | |
|
| | | for (java.util.Iterator<String> its = map.keySet().iterator(); its.hasNext();) {
|
| | | String key = its.next();
|
| | | Long uid = Long.parseLong(key.split("#")[0]);
|
| | | String day = key.split("#")[1];
|
| | | int level = Integer.parseInt(key.split("#")[2]);
|
| | |
|
| | | TeamDailyRecord record = new TeamDailyRecord();
|
| | | record.setUid(uid);
|
| | | record.setCountDay(new Date(TimeUtil.convertToTimeTemp(day, "yyyy-MM-dd")));
|
| | | if (level == 1) {
|
| | | record.setFirstDaRen(map.get(key));
|
| | | } else if (level == 2) {
|
| | | record.setSecondDaRen(map.get(key));
|
| | | } else {
|
| | | record.setBeyondDaRen(map.get(key));
|
| | | }
|
| | | // TODO 保存
|
| | | // teamDailyRecordService.
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 邀请成功
|
| | | * @Title: inviteSuccess
|
| | | * @Description: |
| | | * @param uid 被邀请人用户ID
|
| | | * @param date |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void inviteSuccess(Long uid, Date date) {
|
| | |
|
| | | }
|
| | |
|
| | | }
|