Merge remote-tracking branch 'origin/div' into div
| | |
| | |
|
| | | ThreeSale selectByPrimaryKey(Long id);
|
| | |
|
| | | |
| | | UserInfo selectBoss(Long uid);
|
| | |
|
| | | /**
|
| | |
| | | */
|
| | | ThreeSale getByWorkerId(Long workerId);
|
| | |
|
| | |
|
| | | /**
|
| | | *
|
| | | * @param uid
|
| | | * @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);
|
| | |
|
| | | /**
|
| | | * 上级查询 -后台查询
|
| | |
| | | @Param("state") Integer state, @Param("uid") Long uid);
|
| | |
|
| | | long countSuperiorQuery(@Param("state") Integer state, @Param("uid") Long uid);
|
| | |
|
| | | |
| | |
|
| | | /**
|
| | | * 查询一级队员
|
| | |
| | | */
|
| | | long countSecondTeam(@Param("uid") Long uid, @Param("listId")List<Long> listId);
|
| | |
|
| | |
|
| | | |
| | | /**
|
| | | * 统计一级队员
|
| | | * @param 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查询 有效关系
|
| | |
| | | */
|
| | | ThreeSale getRelationshipByBossIdAndWorkerId(@Param("bossId") Long bossId, @Param("workerId") Long workerId);
|
| | |
|
| | | |
| | | /**
|
| | | * 最后一次关系记录 -无论
|
| | | * @param bossId
|
| | |
| | | */
|
| | | 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与状态)
|
| | |
| | | * @return
|
| | | */
|
| | | 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);
|
| | |
|
| | | } |
| | |
| | | Long countOrderBySourceAndNearDay(@Param("uid") Long uid, @Param("source") int source, @Param("day") int day); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.order;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | public class UserOrderDailyStatisticDTO {
|
| | | private Long uid;
|
| | | private String type;
|
| | | private String day;
|
| | | private int orderCount;
|
| | | private BigDecimal money;
|
| | | public Long getUid() {
|
| | | return uid;
|
| | | }
|
| | | public void setUid(Long uid) {
|
| | | this.uid = uid;
|
| | | }
|
| | | public String getType() {
|
| | | return type;
|
| | | }
|
| | | public void setType(String type) {
|
| | | this.type = type;
|
| | | }
|
| | | public String getDay() {
|
| | | return day;
|
| | | }
|
| | | public void setDay(String day) {
|
| | | this.day = day;
|
| | | }
|
| | | public int getOrderCount() {
|
| | | return orderCount;
|
| | | }
|
| | | public void setOrderCount(int orderCount) {
|
| | | this.orderCount = orderCount;
|
| | | }
|
| | | public BigDecimal getMoney() {
|
| | | return money;
|
| | | }
|
| | | public void setMoney(BigDecimal money) {
|
| | | this.money = money;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.order; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | public interface UserOrderDailyStatisticMapper { |
| | | |
| | | /** |
| | | * 根据下单时间统计(自购或分享订单) |
| | | * @Title: listByPlaceOrderTime |
| | | * @Description: |
| | | * @param minTime |
| | | * @param maxTime |
| | | * @return |
| | | * List<UserOrderDailyStatisticDTO> 返回类型 |
| | | * @throws |
| | | */ |
| | | List<UserOrderDailyStatisticDTO> listFanLiAndShareByPlaceOrderTime(@Param("minTime") Date minTime, |
| | | @Param("maxTime") Date maxTime); |
| | | |
| | | |
| | | /** |
| | | * |
| | | * @Title: listTeamByPlaceOrderTime |
| | | * @Description: |
| | | * @param minTime |
| | | * @param maxTime |
| | | * @return |
| | | * List<UserOrderDailyStatisticDTO> 返回类型 |
| | | * @throws |
| | | */ |
| | | List<UserOrderDailyStatisticDTO> listTeamByPlaceOrderTime(@Param("minTime") Date minTime, |
| | | @Param("maxTime") Date 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;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.job.team;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.xxl.job.core.biz.model.ReturnT;
|
| | | import com.xxl.job.core.handler.annotation.XxlJob;
|
| | | import com.yeshi.fanli.service.manger.user.UserTeamStatisticManager;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | /**
|
| | | * 团队统计
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Component
|
| | | public class TeamStatisticJob {
|
| | |
|
| | | @Resource
|
| | | private UserTeamStatisticManager userTeamStatisticManager;
|
| | |
|
| | | /**
|
| | | * 更新团队统计中的会员等级统计
|
| | | * @Title: updatePDDOrder
|
| | | * @Description: |
| | | * @param param
|
| | | * @return
|
| | | * @throws Exception |
| | | * ReturnT<String> 返回类型
|
| | | * @throws
|
| | | */
|
| | | @XxlJob("updateTeamStatisticLevelCount")
|
| | | public ReturnT<String> updatePDDOrder(String param) throws Exception {
|
| | | long now = System.currentTimeMillis();
|
| | | Date minTime = new Date(TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(now, "yyyy-MM-dd"), "yyyy-MM-dd"));
|
| | | Date maxTime = new Date(TimeUtil
|
| | | .convertToTimeTemp(TimeUtil.getGernalTime(now + 1000 * 60 * 60 * 24L, "yyyy-MM-dd"), "yyyy-MM-dd"));
|
| | | userTeamStatisticManager.syncInviteData(minTime, maxTime);
|
| | | userTeamStatisticManager.syncVIPData(minTime, maxTime);
|
| | | return ReturnT.SUCCESS;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | 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 `succeedTime` >=#{minTime}
|
| | | </if>
|
| | |
|
| | | <if test="maxTime!=null">
|
| | | and #{maxTime}>`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 `succeedTime` >=#{minTime}
|
| | | </if>
|
| | |
|
| | | <if test="maxTime!=null">
|
| | | and #{maxTime}>`succeedTime`
|
| | | </if>
|
| | | </select>
|
| | |
|
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper |
| | | namespace="com.yeshi.fanli.dao.mybatis.order.UserOrderDailyStatisticMapper"> |
| | | |
| | | |
| | | |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.dao.mybatis.order.UserOrderDailyStatisticDTO"> |
| | | <result column="uid" property="uid" jdbcType="BIGINT" /> |
| | | <result column="type" property="type" jdbcType="VARCHAR" /> |
| | | <result column="day" property="day" jdbcType="VARCHAR" /> |
| | | <result column="orderCount" property="orderCount" jdbcType="INTEGER" /> |
| | | <result column="money" property="money" jdbcType="DECIMAL" /> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="listFanLiAndShareByPlaceOrderTime" resultMap="BaseResultMap"> |
| | | SELECT |
| | | co.`co_uid` as |
| | | uid,co.`co_child_source_type` AS `type`, SUM(v.`hb_money`) |
| | | AS |
| | | money,DATE(co.`co_third_create_time`) AS |
| | | `day`,COUNT(DISTINCT(CONCAT( |
| | | co.co_order_no,'#',co.co_source_type))) |
| | | AS orderCount FROM |
| | | yeshi_ec_hongbao_v2 v LEFT JOIN |
| | | yeshi_ec_hongbao_order ho ON |
| | | ho.`ho_hongbao_id`=v.`hb_id` LEFT JOIN |
| | | yeshi_ec_common_order co ON |
| | | co.`co_id`=ho.`ho_order_id` WHERE |
| | | co.`co_id`>0 AND |
| | | co.`co_third_create_time`>=#{minTime} and |
| | | #{maxTime}>co.`co_third_create_time` AND |
| | | v.`hb_state`!=4 GROUP BY |
| | | co_uid,DATE(co.`co_third_create_time`),co.`co_child_source_type` |
| | | </select> |
| | | |
| | | |
| | | <select id="listTeamByPlaceOrderTime" resultMap="BaseResultMap"> |
| | | |
| | | SELECT v.`hb_uid` as uid,co.`co_child_source_type` AS `type`, SUM(v.`hb_money`) AS |
| | | money,DATE(co.`co_third_create_time`) AS `day`,COUNT(DISTINCT(CONCAT( |
| | | co.co_order_no,'#',co.co_source_type))) AS orderCount FROM |
| | | yeshi_ec_hongbao_v2 v LEFT JOIN yeshi_ec_hongbao_order ho ON |
| | | ho.`ho_hongbao_id`=v.`hb_pid` LEFT JOIN yeshi_ec_common_order co ON |
| | | co.`co_id`=ho.`ho_order_id` WHERE (v.`hb_type`=6 OR v.`hb_type`=7 OR |
| | | v.`hb_type`=21 OR v.`hb_type`=22) AND co.`co_id`>0 AND |
| | | co.`co_third_create_time`>=#{minTime} AND |
| | | #{maxTime}>co.`co_third_create_time` AND v.`hb_state`!=4 GROUP BY |
| | | v.`hb_uid`,DATE(co.`co_third_create_time`),co.`co_child_source_type` |
| | | |
| | | </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"> |
| | | and vpi_create_time>=#{minTime} |
| | | </if> |
| | | |
| | | <if test="maxTime!=null"> |
| | | and #{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"> |
| | | and vpi_create_time>=#{minTime} |
| | | </if> |
| | | |
| | | <if test="maxTime!=null"> |
| | | and #{maxTime}>vpi_create_time |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | |
| | | </mapper> |
| | |
| | | @Resource |
| | | private OrderMoneyDailyCountDao orderMoneyDailyCountDao; |
| | | |
| | | |
| | | @Override |
| | | @RequestSerializableByKeyService(key = "#record.uid") |
| | | public void saveDailyCount(OrderMoneyDailyCount record) { |
| | |
| | | return; // 参数不全 |
| | | } |
| | | String gernalTime = TimeUtil.getGernalTime(record.getCountDay().getTime()); |
| | | String id = StringUtil.Md5(record.getUid() + record.getSourceType().name() + gernalTime); |
| | | String id = StringUtil.Md5(record.getUid() + "#" + record.getSourceType().name() + "#" + gernalTime); |
| | | |
| | | // id |
| | | record.setId(id); |
| | |
| | | record.setYearMonth(formatMonth.format(record.getCountDay()) ); |
| | | |
| | | OrderMoneyDailyCount dailyCount = orderMoneyDailyCountDao.getById(id); |
| | | if (dailyCount == null) { |
| | | if (dailyCount != null) { |
| | | // 选择性更新 |
| | | orderMoneyDailyCountDao.updateSelective(record); |
| | | } else { |
| | |
| | |
|
| | | @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);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | 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());
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | throw new UserVIPPreInfoException(1, "信息不完整");
|
| | | for (Long fuid : Constant.NO_UPGRADE_UIDS) {// 禁止不能升级的用户升级
|
| | | if (info.getUid().longValue() == fuid)
|
| | | return;
|
| | | throw new UserVIPPreInfoException(100, "禁止升级");
|
| | | }
|
| | |
|
| | | UserVIPPreInfo oldInfo = userVIPPreInfoMapper.selectByUidAndProcess(info.getUid(), info.getProcess());
|
| | |
| | | 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;
|
| | |
| | | */
|
| | | public UserVIPPreInfo getProcessInfo(Long uid,Date time);
|
| | |
|
| | | |
| | | /**
|
| | | * 根据用户ID与步骤查询
|
| | | * @Title: selectByUidAndProcess
|
| | |
| | |
|
| | | public UserVIPPreInfo selectByUidAndProcess(Long uid,int process);
|
| | |
|
| | | |
| | | /**
|
| | | * 查询进度根据不同阶段
|
| | | * @param uid
|
| | |
| | | */
|
| | | public UserVIPPreInfo getVipByProcess(Long uid, int process);
|
| | |
|
| | | |
| | |
|
| | | /**
|
| | | * 自购+ 分享订单到账 满足升级验证
|
| | | * @param uid
|
| | | */
|
| | | public void upgradeVipByMyOrder(Long uid);
|
| | |
|
| | |
|
| | | /**
|
| | | * 验证自身是否满足vip条件
|
| | |
| | | */
|
| | | public void upgradeVipByTeamNum(Long uid);
|
| | |
|
| | | |
| | | /**
|
| | | * 粉丝完成收货-验证直接-间接粉丝
|
| | | * @param uid 粉丝id
|
| | | */
|
| | | public void upgradeBossVipByTeamNum(Long uid);
|
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 根据主键删除
|
| | |
| | | */
|
| | | 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.invite.TeamDailyRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo;
|
| | | import com.yeshi.fanli.exception.user.TeamDailyRecordException;
|
| | | import com.yeshi.fanli.service.inter.user.invite.TeamDailyRecordService;
|
| | | 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.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
|
| | | */
|
| | | public 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, i + 1, 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, i + 1, 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() + "#" + day + "#" + vipPre.getProcess() + "#";
|
| | | 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));
|
| | | }
|
| | | // 保存
|
| | | try {
|
| | | teamDailyRecordService.save(record);
|
| | | } catch (TeamDailyRecordException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 同步注册信息
|
| | | * @Title: syncRegisterData
|
| | | * @Description: |
| | | * @param minTime
|
| | | * @param maxTime |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void syncInviteData(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, i + 1, 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));
|
| | | }
|
| | | // 保存
|
| | | try {
|
| | | teamDailyRecordService.save(record);
|
| | | } catch (TeamDailyRecordException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 邀请成功
|
| | | * @Title: inviteSuccess
|
| | | * @Description: |
| | | * @param uid 被邀请人用户ID
|
| | | * @param date |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void inviteSuccess(Long uid, Date date) {
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | commonOrder.setThirdCreateTime(new Date(order.getOrderCreateTime() * 1000));
|
| | | commonOrder.setUpdateTime(new Date());
|
| | | commonOrder.setTradeId(order.getOrderId());
|
| | | commonOrder.setChildSourceType("拼多多");
|
| | | return commonOrder;
|
| | | }
|
| | |
|
| | |
| | | commonOrder.setUpdateTime(new Date());
|
| | | commonOrder.setTradeId(order.getTradeId());
|
| | | commonOrder.setEstimate(order.getEstimateFee());
|
| | | commonOrder.setChildSourceType("京东");
|
| | | return commonOrder;
|
| | | }
|
| | |
|