Administrator
2018-11-21 548a8de26dbe31e5f28b5f1f7a6411397757c5f3
Merge remote-tracking branch 'origin/master'
5个文件已修改
5个文件已添加
686 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/ThreeSaleExtraInfoMapper.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/ThreeSaleMapper.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/ThreeSale.java 90 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/ThreeSaleExtraInfo.java 101 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleExtraInfoMapper.xml 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleMapper.xml 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/ThreeSaleExtraInfoSerivceImpl.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/ThreeSaleSerivceImpl.java 169 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/hongbao/ThreeSaleExtraInfoSerivce.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java
@@ -4,6 +4,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
@@ -14,11 +15,13 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.beanutils.PropertyUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.yeshi.utils.BigDecimalUtil;
import org.yeshi.utils.HttpUtil;
import org.yeshi.utils.IPUtil;
import org.yeshi.utils.JsonUtil;
@@ -46,6 +49,7 @@
import com.yeshi.fanli.entity.bus.user.OrderItem;
import com.yeshi.fanli.entity.bus.user.PassWordErrorRecord;
import com.yeshi.fanli.entity.bus.user.SMSHistory;
import com.yeshi.fanli.entity.bus.user.ThreeSale;
import com.yeshi.fanli.entity.bus.user.UserActiveLog;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.WeiXinUser;
@@ -88,9 +92,6 @@
import com.yeshi.fanli.util.account.UserUtil;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
import com.yeshi.fanli.util.wx.WXLoginUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@Controller
@RequestMapping("api/v1/customer")
@@ -1584,4 +1585,67 @@
                .loadTrueResult(String.format("%s?id=" + id, Constant.systemCommonConfig.getAppShareInfoUrl())));
    }
    /**
     * 用户队员列表查询 1.4.1
     * @param acceptData
     * @param id
     * @param out
     */
    @RequestMapping(value = "getMyTeam")
    public void getMyTeam(AcceptData acceptData, long page, long uid, long type, PrintWriter out) {
        int pageSize = Constant.PAGE_SIZE;
        JSONObject resultData = new JSONObject();
        if (type == 1) {
            resultData = threeSaleSerivce.getMyFirstTeam((page - 1) * pageSize, pageSize, uid);
        } else if (type == 2) {
            resultData = threeSaleSerivce.getMySecondTeam((page - 1) * pageSize, pageSize, uid);
        } else if (type == 3) {
            ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
            if (threeSale != null) {
                UserInfo boss = threeSale.getBoss();
                if (boss != null) {
                    resultData.put("nickName", boss.getNickName());
                    resultData.put("portrait", boss.getPortrait());
                }
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                Long createTime = threeSale.getCreateTime();
                Date inviteTime = new Date(createTime);
                resultData.put("inviteTime", "邀请时间:" + sdf.format(inviteTime));
            }
        }
        out.print(JsonUtil.loadTrueResult(resultData));
    }
    /**
     * 用户队员统计 1.4.1
     * @param acceptData
     * @param id
     * @param out
     */
    @RequestMapping(value = "countMyTeam")
    public void countMyTeam(AcceptData acceptData, long uid, PrintWriter out) {
        long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
        long firstTeamTotal = threeSaleSerivce.countFirstTeam(uid, null);
        long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
        long secondTeamTotal = threeSaleSerivce.countSecondTeam(uid, null);
        JSONObject resultData = new JSONObject();
        resultData.put("firstTeam", firstTeam);
        resultData.put("firstTeamTotal", firstTeamTotal);
        resultData.put("secondTeam", secondTeam);
        resultData.put("secondTeamTotal", secondTeamTotal);
        out.print(JsonUtil.loadTrueResult(resultData));
    }
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/ThreeSaleExtraInfoMapper.java
New file
@@ -0,0 +1,18 @@
package com.yeshi.fanli.dao.mybatis;
import com.yeshi.fanli.entity.bus.user.ThreeSaleExtraInfo;
public interface ThreeSaleExtraInfoMapper {
    int deleteByPrimaryKey(Long id);
    int insert(ThreeSaleExtraInfo record);
    int insertSelective(ThreeSaleExtraInfo record);
    ThreeSaleExtraInfo selectByPrimaryKey(Long id);
    int updateByPrimaryKeySelective(ThreeSaleExtraInfo record);
    int updateByPrimaryKey(ThreeSaleExtraInfo record);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/ThreeSaleMapper.java
@@ -123,4 +123,46 @@
    
    long countSuperiorQuery(@Param("state")Integer state, @Param("uid") Long uid);
    
    /**
     * 查询一级队员
     * @param paramLong
     * @param paramInt
     * @param paramLong1
     * @return
     */
    List<ThreeSale> listFirstTeam(@Param("start") long start, @Param("count") int count, @Param("uid") Long uid);
    /**
     * 统计一级队员
     * @param uid
     * @param state
     * @return
     */
    long countFirstTeam(@Param("uid") Long uid, @Param("state") Integer state);
    /**
     * 查询二级队员
     * @param start
     * @param count
     * @param uid
     * @return
     */
    List<ThreeSale> listSecondTeam(@Param("start") long start, @Param("count") int count, @Param("uid") Long uid);
    /**
     * 统计二级队员
     * @param uid
     * @param state
     * @return
     */
    long countSecondTeam(@Param("uid") Long uid, @Param("state") Integer state);
    /**
     *
     * @param uid
     * @return
     */
    ThreeSale getMyBoss(@Param("uid") Long uid);
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/ThreeSale.java
@@ -8,82 +8,126 @@
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.yeshi.utils.mybatis.Column;
/**
 * 分销关系
 *
 * @author cxx
 *
 * @date 2018年1月29日
 */
@Entity
@Table(name="yeshi_ec_threeSale")
@Table(name = "yeshi_ec_threeSale")
@org.yeshi.utils.mybatis.Table("yeshi_ec_threeSale")
public class ThreeSale {
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    @Column(name="id")
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id")
    private Long id;
    @ManyToOne
    @JoinColumn(name="boss_id")
    @Column(name="boss_id")
    private UserInfo boss;//邀请者
    @JoinColumn(name = "boss_id")
    @Column(name = "boss_id")
    private UserInfo boss;// 邀请者
    @OneToOne
    @JoinColumn(name="worker_id")
    @Column(name="worker_id")
    private UserInfo worker; //被邀请者
    @Column(name="state")
    private Boolean state;//状态:是否邀请成功 被邀请者登陆后才算邀请成功   1已成功、0还未成功
    @Column(name="expire")  // 是否过期: 是否过期:初始0  已过期1   (2018.10.22添加)
    @JoinColumn(name = "worker_id")
    @Column(name = "worker_id")
    private UserInfo worker; // 被邀请者
    @Column(name = "state")
    private Boolean state;// 状态:是否邀请成功 被邀请者登陆后才算邀请成功 1已成功、0还未成功
    @Column(name = "expire")
    // 是否过期: 是否过期:初始0 已过期1 (2018.10.22添加)
    private Integer expire;
    @Column(name="createTime")
    @Column(name = "createTime")
    private Long createTime;
    @Column(name = "succeedTime")
    private Long succeedTime;
    @Column(name = "updateTime")
    private Long updateTime;
    
    @Transient
    private ThreeSaleExtraInfo threeSaleExtraInfo;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public UserInfo getBoss() {
        return boss;
    }
    public void setBoss(UserInfo boss) {
        this.boss = boss;
    }
    public UserInfo getWorker() {
        return worker;
    }
    public void setWorker(UserInfo worker) {
        this.worker = worker;
    }
    public Long getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }
    public Boolean getState() {
        return state;
    }
    public void setState(Boolean state) {
        this.state = state;
    }
    public Integer getExpire() {
        return expire;
    }
    public void setExpire(Integer expire) {
        this.expire = expire;
    }
    public Long getSucceedTime() {
        return succeedTime;
    }
    public void setSucceedTime(Long succeedTime) {
        this.succeedTime = succeedTime;
    }
    public Long getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Long updateTime) {
        this.updateTime = updateTime;
    }
    public ThreeSaleExtraInfo getThreeSaleExtraInfo() {
        return threeSaleExtraInfo;
    }
    public void setThreeSaleExtraInfo(ThreeSaleExtraInfo threeSaleExtraInfo) {
        this.threeSaleExtraInfo = threeSaleExtraInfo;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/ThreeSaleExtraInfo.java
New file
@@ -0,0 +1,101 @@
package com.yeshi.fanli.entity.bus.user;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
/**
 * 队员备注信息
 *
 * @date 2018年11月20日
 */
@Entity
@Table(name = "yeshi_ec_threesale_extra_info")
@org.yeshi.utils.mybatis.Table("yeshi_ec_threesale_extra_info")
public class ThreeSaleExtraInfo {
    @Id
    @Column(name = "tf_id")
    @GeneratedValue(strategy = GenerationType.AUTO)
    @org.yeshi.utils.mybatis.Column(name = "tf_id")
    private Long id;
    @JoinColumn(name = "tf_boss_id")
    @ManyToOne(fetch = FetchType.EAGER)
    @org.yeshi.utils.mybatis.Column(name = "tf_boss_id")
    private UserInfo boss;//邀请者
    @JoinColumn(name = "tf_worker_id")
    @ManyToOne(fetch = FetchType.EAGER)
    @org.yeshi.utils.mybatis.Column(name = "tf_worker_id")
    private UserInfo worker; //被邀请者
    @JoinColumn(name = "tf_nickname")
    @org.yeshi.utils.mybatis.Column(name = "tf_nickname")
    private String nickname; // 备注名
    @JoinColumn(name = "tf_createtime")
    @org.yeshi.utils.mybatis.Column(name = "tf_createtime")
    private Date createTime; // 创建时间
    @JoinColumn(name = "tf_updatetime")
    @org.yeshi.utils.mybatis.Column(name = "tf_updatetime")
    private Date updateTime; // 更新时间
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public UserInfo getBoss() {
        return boss;
    }
    public void setBoss(UserInfo boss) {
        this.boss = boss;
    }
    public UserInfo getWorker() {
        return worker;
    }
    public void setWorker(UserInfo worker) {
        this.worker = worker;
    }
    public String getNickname() {
        return nickname;
    }
    public void setNickname(String nickname) {
        this.nickname = nickname;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}
fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleExtraInfoMapper.xml
New file
@@ -0,0 +1,54 @@
<?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.ThreeSaleExtraInfoMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.ThreeSaleExtraInfo">
    <id column="tf_id" property="id" jdbcType="BIGINT"/>
    <result column="tf_nickname" property="nickname" jdbcType="VARCHAR"/>
    <result column="tf_createtime" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="tf_updatetime" property="updateTime" jdbcType="TIMESTAMP"/>
      <association property="boss" column="tf_boss_id"
            javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
            <id column="tf_boss_id" property="id" jdbcType="BIGINT" />
    </association>
      <association property="worker" column="tf_worker_id"
            javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
            <id column="tf_worker_id" property="id" jdbcType="BIGINT" />
    </association>
  </resultMap>
  <sql id="Base_Column_List">tf_id,tf_boss_id,tf_worker_id,tf_nickname,tf_createtime,tf_updatetime</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_threesale_extra_info where tf_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_threesale_extra_info where tf_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.ThreeSaleExtraInfo" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_threesale_extra_info (tf_id,tf_boss_id,tf_worker_id,tf_nickname,tf_createtime,tf_updatetime) values (#{id,jdbcType=BIGINT},#{boss.id,jdbcType=BIGINT},#{worker.id,jdbcType=BIGINT},#{nickname,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.ThreeSaleExtraInfo" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_threesale_extra_info
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">tf_id,</if>
      <if test="boss != null">tf_boss_id,</if>
      <if test="worker != null">tf_worker_id,</if>
      <if test="nickname != null">tf_nickname,</if>
      <if test="createTime != null">tf_createtime,</if>
      <if test="updateTime != null">tf_updatetime,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="boss != null">#{boss.id,jdbcType=BIGINT},</if>
      <if test="worker != null">#{worker.id,jdbcType=BIGINT},</if>
      <if test="nickname != null">#{nickname,jdbcType=VARCHAR},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.ThreeSaleExtraInfo">update yeshi_ec_threesale_extra_info set tf_boss_id = #{boss.id,jdbcType=BIGINT},tf_worker_id = #{worker.id,jdbcType=BIGINT},tf_nickname = #{nickname,jdbcType=VARCHAR},tf_createtime = #{createTime,jdbcType=TIMESTAMP},tf_updatetime = #{updateTime,jdbcType=TIMESTAMP} where tf_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.ThreeSaleExtraInfo">update yeshi_ec_threesale_extra_info
    <set>
      <if test="boss != null">tf_boss_id=#{boss.id,jdbcType=BIGINT},</if>
      <if test="worker != null">tf_worker_id=#{worker.id,jdbcType=BIGINT},</if>
      <if test="nickname != null">tf_nickname=#{nickname,jdbcType=VARCHAR},</if>
      <if test="createTime != null">tf_createtime=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">tf_updatetime=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where tf_id = #{id,jdbcType=BIGINT}
  </update>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/ThreeSaleMapper.xml
@@ -5,7 +5,11 @@
    <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.ThreeSale">
        <id column="id" property="id" jdbcType="BIGINT" />
        <result column="state" property="state" jdbcType="BOOLEAN" />
        <result column="succeedTime" property="succeedTime" jdbcType="BIGINT" />
        <result column="createTime" property="createTime" jdbcType="BIGINT" />
        <result column="updateTime" property="updateTime" jdbcType="BIGINT" />
        <result column="expire" property="expire" jdbcType="INTEGER" />
        
        <association property="boss" column="boss_id"
@@ -20,7 +24,9 @@
    <resultMap id="AllResultMap" type="com.yeshi.fanli.entity.bus.user.ThreeSale">
        <id column="id" property="id" jdbcType="BIGINT" />
        <result column="state" property="state" jdbcType="BOOLEAN" />
        <result column="succeedTime" property="succeedTime" jdbcType="BIGINT" />
        <result column="createTime" property="createTime" jdbcType="BIGINT" />
        <result column="updateTime" property="updateTime" jdbcType="BIGINT" />
        <result column="expire" property="expire" jdbcType="INTEGER" />
        
        <association property="boss" column="boss_id"
@@ -28,9 +34,13 @@
            
        <association property="worker" column="worker_id"
            select="com.yeshi.fanli.dao.mybatis.UserInfoMapper.selectByPKey" />
        <association property="threeSaleExtraInfo" column="tf_id"
            resultMap="com.yeshi.fanli.dao.mybatis.ThreeSaleExtraInfoMapper.BaseResultMap" />
    </resultMap>
    
    <sql id="Base_Column_List">id,boss_id,worker_id,state,expire,createTime</sql>
    <sql id="Base_Column_List">id,boss_id,worker_id,state,expire,succeedTime,createTime,updateTime</sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
@@ -65,8 +75,8 @@
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.ThreeSale"
        useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_threeSale
        (id,boss_id,worker_id,state,expire,createTime) values
        (#{id,jdbcType=BIGINT},#{boss.id,jdbcType=BIGINT},#{worker.id,jdbcType=BIGINT},#{state,jdbcType=BOOLEAN},#{expire,jdbcType=INTEGER},#{createTime,jdbcType=BIGINT})
        (id,boss_id,worker_id,state,expire,succeedTime,createTime,updateTime) values
        (#{id,jdbcType=BIGINT},#{boss.id,jdbcType=BIGINT},#{worker.id,jdbcType=BIGINT},#{state,jdbcType=BOOLEAN},#{expire,jdbcType=INTEGER},#{succeedTime,jdbcType=BIGINT},#{createTime,jdbcType=BIGINT},#{updateTime,jdbcType=BIGINT})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.ThreeSale"
        useGeneratedKeys="true" keyProperty="id">
@@ -77,7 +87,9 @@
            <if test="worker != null">worker_id,</if>
            <if test="state != null">state,</if>
            <if test="expire != null">expire,</if>
            <if test="succeedTime != null">succeedTime,</if>
            <if test="createTime != null">createTime,</if>
            <if test="updateTime != null">updateTime,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -86,7 +98,9 @@
            <if test="worker != null">#{worker.id,jdbcType=BIGINT},</if>
            <if test="state != null">#{state,jdbcType=BOOLEAN},</if>
            <if test="expire != null">#{expire,jdbcType=INTEGER},</if>
            <if test="succeedTime != null">#{succeedTime,jdbcType=BIGINT},</if>
            <if test="createTime != null">#{createTime,jdbcType=BIGINT},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=BIGINT},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.ThreeSale">update
@@ -94,7 +108,9 @@
        = #{worker.id,jdbcType=BIGINT},state =
        #{state,jdbcType=BOOLEAN},
        expire = #{expire,jdbcType=INTEGER},
        createTime = #{createTime,jdbcType=BIGINT}
        succeedTime = #{succeedTime,jdbcType=BIGINT},
        createTime = #{createTime,jdbcType=BIGINT},
        updateTime = #{updateTime,jdbcType=BIGINT}
        where id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.ThreeSale">
@@ -104,7 +120,9 @@
            <if test="worker != null">worker_id=#{worker.id,jdbcType=BIGINT},</if>
            <if test="state != null">state=#{state,jdbcType=BOOLEAN},</if>
            <if test="expire != null">expire=#{expire,jdbcType=INTEGER},</if>
            <if test="succeedTime != null">succeedTime=#{succeedTime,jdbcType=BIGINT},</if>
            <if test="createTime != null">createTime=#{createTime,jdbcType=BIGINT},</if>
            <if test="updateTime != null">updateTime=#{updateTime,jdbcType=BIGINT},</if>
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>
@@ -318,4 +336,50 @@
            </if>
    </select>
    
    <select id="listFirstTeam"  resultMap="AllResultMap">
        SELECT    *  FROM `yeshi_ec_threesale`  ts
        LEFT JOIN `yeshi_ec_threesale_extra_info` ff
        ON ts.`boss_id` = ff.`tf_boss_id` AND ts.`worker_id` = ff.`tf_worker_id`
        WHERE ts.`boss_id` =  #{uid}
        ORDER BY ts.state DESC, ts.expire, ts.succeedTime DESC
    </select>
    <select id="countFirstTeam"  resultType="java.lang.Long">
         SELECT count(id) FROM `yeshi_ec_threesale`
         WHERE `boss_id` = #{uid}
         <if test="state != null">
              AND `state` = #{state}
        </if>
    </select>
    <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`
             WHERE  tf.`boss_id` = #{uid}
             ORDER BY ts.state DESC, ts.expire, ts.succeedTime DESC
            LIMIT ${start},${count})A
        LEFT JOIN yeshi_ec_threesale yet ON yet.id = A.id
        LEFT JOIN `yeshi_ec_threesale_extra_info` ff
        ON yet.`boss_id` = ff.`tf_boss_id` AND yet.`worker_id` = ff.`tf_worker_id`
    </select>
    <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`
             WHERE tf.`boss_id` = #{uid}
            <if test="state != null">
                  AND ts.`state` = #{state}
            </if>
         )A
    </select>
    <select id="getMyBoss" resultMap="AllResultMap">
        select <include refid="Base_Column_List" /> from yeshi_ec_threeSale where
        state = 1 and worker_id=#{uid}
    </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/ThreeSaleExtraInfoSerivceImpl.java
New file
@@ -0,0 +1,51 @@
package com.yeshi.fanli.service.impl.hongbao;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.ThreeSaleExtraInfoMapper;
import com.yeshi.fanli.entity.bus.user.ThreeSaleExtraInfo;
import com.yeshi.fanli.service.inter.hongbao.ThreeSaleExtraInfoSerivce;
@Service
public class ThreeSaleExtraInfoSerivceImpl implements ThreeSaleExtraInfoSerivce {
    @Resource
    private ThreeSaleExtraInfoMapper threeSaleExtraInfoMapper;
    @Override
    public int deleteByPrimaryKey(Long id) {
        return threeSaleExtraInfoMapper.deleteByPrimaryKey(id);
    }
    @Override
    public int insert(ThreeSaleExtraInfo record) {
        return threeSaleExtraInfoMapper.insert(record);
    }
    @Override
    public int insertSelective(ThreeSaleExtraInfo record) {
        return threeSaleExtraInfoMapper.insertSelective(record);
    }
    @Override
    public ThreeSaleExtraInfo selectByPrimaryKey(Long id) {
        return threeSaleExtraInfoMapper.selectByPrimaryKey(id);
    }
    @Override
    public int updateByPrimaryKeySelective(ThreeSaleExtraInfo record) {
        return threeSaleExtraInfoMapper.updateByPrimaryKeySelective(record);
    }
    @Override
    public int updateByPrimaryKey(ThreeSaleExtraInfo record) {
        return threeSaleExtraInfoMapper.updateByPrimaryKey(record);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/ThreeSaleSerivceImpl.java
@@ -1,10 +1,17 @@
package com.yeshi.fanli.service.impl.hongbao;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.hibernate.HibernateException;
import org.hibernate.Query;
@@ -19,12 +26,14 @@
import com.yeshi.fanli.dao.mybatis.UserInfoMapper;
import com.yeshi.fanli.dao.user.ThreeSaleDao;
import com.yeshi.fanli.entity.bus.user.ThreeSale;
import com.yeshi.fanli.entity.bus.user.ThreeSaleExtraInfo;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.service.inter.config.InviteGetMoneyService;
import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
@Service
public class ThreeSaleSerivceImpl implements ThreeSaleSerivce {
@@ -342,7 +351,167 @@
    public long countSuperiorQuery(Integer state, Long uid) {
        return threeSaleMapper.countSuperiorQuery(state, uid);
    }
    @Override
    public List<ThreeSale> listFirstTeam(long start, int count, Long uid) {
        return threeSaleMapper.listFirstTeam(start, count, uid);
    }
    @Override
    public long countFirstTeam(Long uid, Integer state) {
        return threeSaleMapper.countFirstTeam(uid, state);
    }
    @Override
    public List<ThreeSale> listSecondTeam(long start, int count, Long uid) {
        return threeSaleMapper.listSecondTeam(start, count, uid);
    }
    @Override
    public long countSecondTeam(Long uid, Integer state) {
        return threeSaleMapper.countSecondTeam(uid, state);
    }
    
    @Override
    public ThreeSale getMyBoss(Long uid) {
        return threeSaleMapper.getMyBoss(uid);
    }
    @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, 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, null);
        return organizeTeam(countTotal, list);
    }
    public JSONObject organizeTeam(long count, List<ThreeSale> list) {
        JSONObject result = new JSONObject();
        JSONArray resultArray  = new JSONArray();
        for (ThreeSale threeSale: list) {
            JSONObject object = new JSONObject();
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Long createTime = threeSale.getCreateTime();
            Date inviteTime = new Date(createTime);
            object.put("inviteTime", sdf.format(inviteTime) + "加入");
            String nickName = null;
            Long lastLoginTime = null;
            String portrait = null;
            Long workerId = null;
            UserInfo worker = threeSale.getWorker();
            if (worker != null) {
                workerId = worker.getId();
                portrait = worker.getPortrait();
                lastLoginTime = worker.getLastLoginTime();
                nickName = worker.getNickName();
            }
            object.put("workerId", workerId);
            object.put("portrait", portrait);
            int type = 0;
            String fontColor1 = "#888888";
            String fontColor2 = "#F14242";
            JSONArray array  = new JSONArray();
            if (threeSale.getState()) {
                type = 1;
                if (lastLoginTime == null) {
                    lastLoginTime = threeSale.getCreateTime();
                }
                JSONArray array1 = new JSONArray();
                array1.add(fontColor1);
                array1.add("最近登陆" + sdf.format(lastLoginTime));
                array.add(array1);
            } else if ( threeSale.getExpire()!= null && (threeSale.getExpire() == 1 || threeSale.getExpire().equals(1))) {
                type = 2;
                JSONArray array1 = new JSONArray();
                array1.add(fontColor1);
                array1.add("已经脱离邀请关系");
                array.add(array1);
            } else {
                type = 0;
                Calendar c = Calendar.getInstance();
                c.setTime(inviteTime);
                c.add(Calendar.DAY_OF_MONTH, 60);// 邀请不超过60天
                Date todayTime = new Date();
                long days =  (c.getTimeInMillis() -todayTime.getTime()) / (1000*3600*24);
                if (days < 0) {
                    days = 0;
                }
                JSONArray array1 = new JSONArray();
                array1.add(fontColor1);
                array1.add("将于");
                JSONArray array2 = new JSONArray();
                array2.add(fontColor2);
                array2.add(days+"天 ");
                JSONArray array3 = new JSONArray();
                array3.add(fontColor1);
                array3.add("后脱离邀请关系");
                array.add(array1);
                array.add(array2);
                array.add(array3);
            }
            object.put("type", type);
            object.put("recentMsg", array);
            ThreeSaleExtraInfo threeSaleExtraInfo = threeSale.getThreeSaleExtraInfo();
            if (threeSaleExtraInfo != null) {
                if (!StringUtil.isNullOrEmpty(threeSaleExtraInfo.getNickname())) {
                    nickName = threeSaleExtraInfo.getNickname();
                }
            }
            object.put("nickName", nickName);
            resultArray.add(object);
        }
        result.put("count", count);
        result.put("result_list", resultArray);
        return result;
    }
    
    
}
fanli/src/main/java/com/yeshi/fanli/service/inter/hongbao/ThreeSaleExtraInfoSerivce.java
New file
@@ -0,0 +1,17 @@
package com.yeshi.fanli.service.inter.hongbao;
import com.yeshi.fanli.entity.bus.user.ThreeSaleExtraInfo;
public interface ThreeSaleExtraInfoSerivce {
    public int deleteByPrimaryKey(Long id);
    public int insert(ThreeSaleExtraInfo record);
    public int insertSelective(ThreeSaleExtraInfo record);
    public ThreeSaleExtraInfo selectByPrimaryKey(Long id);
    public int updateByPrimaryKeySelective(ThreeSaleExtraInfo record);
    public int updateByPrimaryKey(ThreeSaleExtraInfo record);
}