yujian
2019-08-16 fb5a8918a7983bbdf83586f773884d3961bb3c6d
口令领取+消息
19个文件已修改
530 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgOtherDetail.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/tlj/UserTaoLiJinGiveRecord.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/tlj/UserTaoLiJinOrigin.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/UserSystemCouponGiveRecord.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/tlj/UserTaoLiJinGiveRecordMapper.xml 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserSystemCouponGiveRecordMapper.xml 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgOtherDetailServiceImpl.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserOtherMsgNotificationServiceImpl.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinOriginServiceImpl.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java 201 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoExtraServiceImpl.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponGiveRecordServiceImpl.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/UserOtherMsgNotificationService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/tlj/UserTaoLiJinOriginService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserSystemCouponGiveRecordService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserSystemCouponService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/goods/GoodsDetailVOFactory.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java
@@ -235,18 +235,23 @@
            return;
        }
        if (tb != null) {
            commonGoods = new CommonGoods();
            commonGoods.setPrice(tb.getZkPrice());
            commonGoods.setTitle(tb.getTitle());
            commonGoods.setGoodsId(tb.getAuctionId());
            commonGoods.setGoodsType(Constant.SOURCE_TYPE_TAOBAO);
            commonGoods.setPicture(tb.getPictUrl());
        }
        JSONObject data = new JSONObject();
        
        if(VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) {
            if (tb != null) {
                TaoBaoGoodsBrief goodsBrief = null;
                try {
                    goodsBrief = TaoKeApiUtil.searchGoodsDetail(tb.getAuctionId());
                } catch (TaobaoGoodsDownException e) {
                    e.printStackTrace();
                }
                if (goodsBrief == null) {
                    out.println(JsonUtil.loadFalseResult("暂未找到该商品,请稍后再试!"));
                    return;
                }
                commonGoods = CommonGoodsFactory.create(goodsBrief);
            }
            BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
            BigDecimal shareRate = hongBaoManageService.getShareRate();
            Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
@@ -257,6 +262,15 @@
            return;
        }
        
        if (tb != null) {
            commonGoods = new CommonGoods();
            commonGoods.setPrice(tb.getZkPrice());
            commonGoods.setTitle(tb.getTitle());
            commonGoods.setGoodsId(tb.getAuctionId());
            commonGoods.setGoodsType(Constant.SOURCE_TYPE_TAOBAO);
            commonGoods.setPicture(tb.getPictUrl());
        }
        JSONObject taoBaoGoodsJSON = new JSONObject();
        taoBaoGoodsJSON.put("title", commonGoods.getTitle());
        taoBaoGoodsJSON.put("zkPrice", commonGoods.getPrice() + "");
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgOtherDetail.java
@@ -6,6 +6,7 @@
import org.yeshi.utils.mybatis.Table;
import com.yeshi.fanli.dto.msg.MsgOtherCouponContentDTO;
import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO;
import com.yeshi.fanli.dto.msg.MsgOtherTaoLiJinContentDTO;
import com.yeshi.fanli.entity.bus.user.UserInfo;
@@ -19,7 +20,7 @@
public class MsgOtherDetail {
    public enum MsgTypeOtherTypeEnum {
        couponMianDan("免单券"), couponWelfareMianDan("福利免单券"), couponReward("奖励券"),
        taoLiJin("推广红包");
        taoLiJin("推广红包"), give("赠送");
        
        private final String desc;
@@ -56,6 +57,9 @@
    // 淘礼金参数
    private MsgOtherTaoLiJinContentDTO taoLiJinContent;
    // 赠送信息
    private MsgOtherGiveContentDTO giveContent;
    
    
    public MsgOtherCouponContentDTO getCoupnContent() {
@@ -145,4 +149,12 @@
    public void setTaoLiJinContent(MsgOtherTaoLiJinContentDTO taoLiJinContent) {
        this.taoLiJinContent = taoLiJinContent;
    }
    public MsgOtherGiveContentDTO getGiveContent() {
        return giveContent;
    }
    public void setGiveContent(MsgOtherGiveContentDTO giveContent) {
        this.giveContent = giveContent;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/tlj/UserTaoLiJinGiveRecord.java
@@ -29,12 +29,17 @@
    // 赠送uid
    @Column(name = "tgr_give_uid")
    private Long giveUid;
    // 领取uid
    @Column(name = "tgr_receive_uid")
    private Long receiveUid;
    // 赠送时间
    @Column(name = "tgr_give_time")
    private Date giveTime;
    // 赠送结束时间
    @Column(name = "tgr_end_time")
    private Date endTime;
    // 领取uid
    @Column(name = "tgr_receive_uid")
    private Long receiveUid;
    // 领取时间
    @Column(name = "tgr_receive_time")
    private Date receiveTime;
@@ -99,4 +104,13 @@
    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }
    public Date getEndTime() {
        return endTime;
    }
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/tlj/UserTaoLiJinOrigin.java
@@ -17,7 +17,7 @@
    public enum TaoLiJinOriginEnum {
        newbiesWin("新人红包"), shareWin("推广红包福利"), rankWin("账户等级福利"), inviteWin("邀请队员奖励"), 
        refund("未领取退回"), exchange("金币兑换");
        refund("未领取退回"), exchange("金币兑换"), friendsGive("好友赠送");
        
        private final String desc;
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/UserSystemCouponGiveRecord.java
@@ -20,12 +20,15 @@
    // 赠送uid
    @Column(name = "cgr_give_uid")
    private Long giveUid;
    // 领取uid
    @Column(name = "cgr_receive_uid")
    private Long receiveUid;
    // 赠送时间
    @Column(name = "cgr_give_time")
    private Date giveTime;
    // 赠送结束时间
    @Column(name = "cgr_end_time")
    private Date endTime;
    // 领取uid
    @Column(name = "cgr_receive_uid")
    private Long receiveUid;
    // 领取时间
    @Column(name = "cgr_receive_time")
    private Date receiveTime;
@@ -79,5 +82,12 @@
    public void setReceiveTime(Date receiveTime) {
        this.receiveTime = receiveTime;
    }
    public Date getEndTime() {
        return endTime;
    }
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }
}
fanli/src/main/java/com/yeshi/fanli/mapping/tlj/UserTaoLiJinGiveRecordMapper.xml
@@ -6,24 +6,26 @@
    <id column="tgr_id" property="id" jdbcType="BIGINT"/>
    <result column="tgr_amount" property="amount" jdbcType="DECIMAL"/>
    <result column="tgr_give_uid" property="giveUid" jdbcType="BIGINT"/>
    <result column="tgr_receive_uid" property="receiveUid" jdbcType="BIGINT"/>
    <result column="tgr_give_time" property="giveTime" jdbcType="TIMESTAMP"/>
    <result column="tgr_end_time" property="endTime" jdbcType="TIMESTAMP"/>
    <result column="tgr_receive_uid" property="receiveUid" jdbcType="BIGINT"/>
    <result column="tgr_receive_time" property="receiveTime" jdbcType="TIMESTAMP"/>
    <result column="tgr_state" property="state" jdbcType="INTEGER"/>
  </resultMap>
  <sql id="Base_Column_List">tgr_id,tgr_amount,tgr_give_uid,tgr_receive_uid,tgr_give_time,tgr_receive_time,tgr_state</sql>
  <sql id="Base_Column_List">tgr_id,tgr_amount,tgr_give_uid,tgr_give_time,tgr_end_time,tgr_receive_uid,tgr_receive_time,tgr_state</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_user_taolijin_give_record where tgr_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_taolijin_give_record where tgr_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinGiveRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_taolijin_give_record (tgr_id,tgr_amount,tgr_give_uid,tgr_receive_uid,tgr_give_time,tgr_receive_time,tgr_state) values (#{id,jdbcType=BIGINT},#{amount,jdbcType=DECIMAL},#{giveUid,jdbcType=BIGINT},#{receiveUid,jdbcType=BIGINT},#{giveTime,jdbcType=TIMESTAMP},#{receiveTime,jdbcType=TIMESTAMP},#{state,jdbcType=INTEGER})</insert>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinGiveRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_taolijin_give_record (tgr_id,tgr_amount,tgr_give_uid,tgr_give_time,tgr_end_time,tgr_receive_uid,tgr_receive_time,tgr_state) values (#{id,jdbcType=BIGINT},#{amount,jdbcType=DECIMAL},#{giveUid,jdbcType=BIGINT},#{giveTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{receiveUid,jdbcType=BIGINT},#{receiveTime,jdbcType=TIMESTAMP},#{state,jdbcType=INTEGER})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinGiveRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_taolijin_give_record
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">tgr_id,</if>
      <if test="amount != null">tgr_amount,</if>
      <if test="giveUid != null">tgr_give_uid,</if>
      <if test="receiveUid != null">tgr_receive_uid,</if>
      <if test="giveTime != null">tgr_give_time,</if>
      <if test="endTime != null">tgr_end_time,</if>
      <if test="receiveUid != null">tgr_receive_uid,</if>
      <if test="receiveTime != null">tgr_receive_time,</if>
      <if test="state != null">tgr_state,</if>
    </trim>values
@@ -31,19 +33,21 @@
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="amount != null">#{amount,jdbcType=DECIMAL},</if>
      <if test="giveUid != null">#{giveUid,jdbcType=BIGINT},</if>
      <if test="receiveUid != null">#{receiveUid,jdbcType=BIGINT},</if>
      <if test="giveTime != null">#{giveTime,jdbcType=TIMESTAMP},</if>
      <if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</if>
      <if test="receiveUid != null">#{receiveUid,jdbcType=BIGINT},</if>
      <if test="receiveTime != null">#{receiveTime,jdbcType=TIMESTAMP},</if>
      <if test="state != null">#{state,jdbcType=INTEGER},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinGiveRecord">update yeshi_ec_user_taolijin_give_record set tgr_amount = #{amount,jdbcType=DECIMAL},tgr_give_uid = #{giveUid,jdbcType=BIGINT},tgr_receive_uid = #{receiveUid,jdbcType=BIGINT},tgr_give_time = #{giveTime,jdbcType=TIMESTAMP},tgr_receive_time = #{receiveTime,jdbcType=TIMESTAMP},tgr_state = #{state,jdbcType=INTEGER} where tgr_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinGiveRecord">update yeshi_ec_user_taolijin_give_record set tgr_amount = #{amount,jdbcType=DECIMAL},tgr_give_uid = #{giveUid,jdbcType=BIGINT},tgr_give_time = #{giveTime,jdbcType=TIMESTAMP},tgr_end_time = #{endTime,jdbcType=TIMESTAMP},tgr_receive_uid = #{receiveUid,jdbcType=BIGINT},tgr_receive_time = #{receiveTime,jdbcType=TIMESTAMP},tgr_state = #{state,jdbcType=INTEGER} where tgr_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinGiveRecord">update yeshi_ec_user_taolijin_give_record
    <set>
      <if test="amount != null">tgr_amount=#{amount,jdbcType=DECIMAL},</if>
      <if test="giveUid != null">tgr_give_uid=#{giveUid,jdbcType=BIGINT},</if>
      <if test="receiveUid != null">tgr_receive_uid=#{receiveUid,jdbcType=BIGINT},</if>
      <if test="giveTime != null">tgr_give_time=#{giveTime,jdbcType=TIMESTAMP},</if>
      <if test="endTime != null">tgr_end_time=#{endTime,jdbcType=TIMESTAMP},</if>
      <if test="receiveUid != null">tgr_receive_uid=#{receiveUid,jdbcType=BIGINT},</if>
      <if test="receiveTime != null">tgr_receive_time=#{receiveTime,jdbcType=TIMESTAMP},</if>
      <if test="state != null">tgr_state=#{state,jdbcType=INTEGER},</if>
    </set> where tgr_id = #{id,jdbcType=BIGINT}
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserSystemCouponGiveRecordMapper.xml
@@ -6,45 +6,49 @@
    <id column="cgr_id" property="id" jdbcType="BIGINT"/>
    <result column="cgr_coupon_id" property="couponId" jdbcType="BIGINT"/>
    <result column="cgr_give_uid" property="giveUid" jdbcType="BIGINT"/>
    <result column="cgr_receive_uid" property="receiveUid" jdbcType="BIGINT"/>
    <result column="cgr_give_time" property="giveTime" jdbcType="TIMESTAMP"/>
    <result column="cgr_end_time" property="endTime" jdbcType="TIMESTAMP"/>
    <result column="cgr_receive_uid" property="receiveUid" jdbcType="BIGINT"/>
    <result column="cgr_receive_time" property="receiveTime" jdbcType="TIMESTAMP"/>
  </resultMap>
  <sql id="Base_Column_List">cgr_id,cgr_coupon_id,cgr_give_uid,cgr_receive_uid,cgr_give_time,cgr_receive_time</sql>
  <sql id="Base_Column_List">cgr_id,cgr_coupon_id,cgr_give_uid,cgr_give_time,cgr_end_time,cgr_receive_uid,cgr_receive_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_user_system_coupon_give_record where cgr_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_system_coupon_give_record where cgr_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCouponGiveRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_system_coupon_give_record (cgr_id,cgr_coupon_id,cgr_give_uid,cgr_receive_uid,cgr_give_time,cgr_receive_time) values (#{id,jdbcType=BIGINT},#{couponId,jdbcType=BIGINT},#{giveUid,jdbcType=BIGINT},#{receiveUid,jdbcType=BIGINT},#{giveTime,jdbcType=TIMESTAMP},#{receiveTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCouponGiveRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_system_coupon_give_record (cgr_id,cgr_coupon_id,cgr_give_uid,cgr_give_time,cgr_end_time,cgr_receive_uid,cgr_receive_time) values (#{id,jdbcType=BIGINT},#{couponId,jdbcType=BIGINT},#{giveUid,jdbcType=BIGINT},#{giveTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{receiveUid,jdbcType=BIGINT},#{receiveTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCouponGiveRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_system_coupon_give_record
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">cgr_id,</if>
      <if test="couponId != null">cgr_coupon_id,</if>
      <if test="giveUid != null">cgr_give_uid,</if>
      <if test="receiveUid != null">cgr_receive_uid,</if>
      <if test="giveTime != null">cgr_give_time,</if>
      <if test="endTime != null">cgr_end_time,</if>
      <if test="receiveUid != null">cgr_receive_uid,</if>
      <if test="receiveTime != null">cgr_receive_time,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="couponId != null">#{couponId,jdbcType=BIGINT},</if>
      <if test="giveUid != null">#{giveUid,jdbcType=BIGINT},</if>
      <if test="receiveUid != null">#{receiveUid,jdbcType=BIGINT},</if>
      <if test="giveTime != null">#{giveTime,jdbcType=TIMESTAMP},</if>
      <if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</if>
      <if test="receiveUid != null">#{receiveUid,jdbcType=BIGINT},</if>
      <if test="receiveTime != null">#{receiveTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCouponGiveRecord">update yeshi_ec_user_system_coupon_give_record set cgr_coupon_id = #{couponId,jdbcType=BIGINT},cgr_give_uid = #{giveUid,jdbcType=BIGINT},cgr_receive_uid = #{receiveUid,jdbcType=BIGINT},cgr_give_time = #{giveTime,jdbcType=TIMESTAMP},cgr_receive_time = #{receiveTime,jdbcType=TIMESTAMP} where cgr_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCouponGiveRecord">update yeshi_ec_user_system_coupon_give_record set cgr_coupon_id = #{couponId,jdbcType=BIGINT},cgr_give_uid = #{giveUid,jdbcType=BIGINT},cgr_give_time = #{giveTime,jdbcType=TIMESTAMP},cgr_end_time = #{endTime,jdbcType=TIMESTAMP},cgr_receive_uid = #{receiveUid,jdbcType=BIGINT},cgr_receive_time = #{receiveTime,jdbcType=TIMESTAMP} where cgr_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserSystemCouponGiveRecord">update yeshi_ec_user_system_coupon_give_record
    <set>
      <if test="couponId != null">cgr_coupon_id=#{couponId,jdbcType=BIGINT},</if>
      <if test="giveUid != null">cgr_give_uid=#{giveUid,jdbcType=BIGINT},</if>
      <if test="receiveUid != null">cgr_receive_uid=#{receiveUid,jdbcType=BIGINT},</if>
      <if test="giveTime != null">cgr_give_time=#{giveTime,jdbcType=TIMESTAMP},</if>
      <if test="endTime != null">cgr_end_time=#{endTime,jdbcType=TIMESTAMP},</if>
      <if test="receiveUid != null">cgr_receive_uid=#{receiveUid,jdbcType=BIGINT},</if>
      <if test="receiveTime != null">cgr_receive_time=#{receiveTime,jdbcType=TIMESTAMP},</if>
    </set> where cgr_id = #{id,jdbcType=BIGINT}
  </update>
  <select id="getRecordByUidAndCouponId">
   <select id="getRecordByUidAndCouponId">
    SELECT * FROM yeshi_ec_user_system_coupon_give_record
    WHERE cgr_give_uid = #{uid} AND  cgr_coupon_id = #{couponId}
    LIMIT 1 
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgOtherDetailServiceImpl.java
@@ -40,6 +40,9 @@
        } else if (detail.getType() == MsgTypeOtherTypeEnum.taoLiJin) {
            msgOtherDetailMapper.insertSelective(detail);
            userMsgReadStateService.addOtherMsgUnReadCount(detail.getUser().getId(), 1);
        } else if (detail.getType() == MsgTypeOtherTypeEnum.give) {
            msgOtherDetailMapper.insertSelective(detail);
            userMsgReadStateService.addOtherMsgUnReadCount(detail.getUser().getId(), 1);
        }
    }
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserOtherMsgNotificationServiceImpl.java
@@ -1,7 +1,6 @@
package com.yeshi.fanli.service.impl.msg;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.annotation.Resource;
@@ -10,6 +9,7 @@
import com.google.gson.Gson;
import com.yeshi.fanli.dto.msg.MsgOtherCouponContentDTO;
import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO;
import com.yeshi.fanli.dto.msg.MsgOtherTaoLiJinContentDTO;
import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail;
import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail.MsgTypeOtherTypeEnum;
@@ -302,4 +302,20 @@
        }
    }
    @Override
    public void tokenGiveMsg(Long uid, String beiZhu,  MsgOtherGiveContentDTO content) {
        try {
            MsgOtherDetail detail = new MsgOtherDetail();
            detail.setBeiZhu(beiZhu);
            detail.setCreateTime(new Date());
            detail.setRead(false);
            detail.setUser(new UserInfo(uid));
            detail.setContent(new Gson().toJson(content));
            detail.setType(MsgTypeOtherTypeEnum.give);
            msgOtherDetailService.addMsgOtherDetail(detail);
        } catch (MsgOtherDetailException e) {
            e.printStackTrace();
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinOriginServiceImpl.java
@@ -579,4 +579,37 @@
        // 红包明细
        userTaoLiJinDetailService.createAddDetail(origin);
    }
    @Override
    @Transactional
    public UserTaoLiJinOrigin  receiveFriendsGive(Long uid, BigDecimal money) throws UserTaoLiJinOriginException{
        if (uid == null || money == null) {
            throw new UserTaoLiJinOriginException(1, "参数不能为空");
        }
        // 添加红包余额
        userMoneyExtraService.addTaoLiJin(uid, money, false);
        // 添加新增记录
        UserTaoLiJinOrigin origin = saveOrigin(uid, 1, money, TaoLiJinOriginEnum.friendsGive);
        // 红包明细
        userTaoLiJinDetailService.createAddDetail(origin);
        // 消息
        executor.execute(new Runnable() {
            @Override
            public void run() {
                try {
                    MsgOtherTaoLiJinContentDTO content = new MsgOtherTaoLiJinContentDTO();
                    content.setState("红包增加");
                    content.setSource("好友赠送");
                    content.setMoney(money);
                    userOtherMsgNotificationService.taoLiJinMsg(uid, "", content);
                } catch (Exception e) {
                    LogHelper.errorDetailInfo(e);
                }
            }
        });
        return origin;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java
@@ -1,25 +1,34 @@
package com.yeshi.fanli.service.impl.user;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.user.TokenRecordMapper;
import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinGiveRecord;
import com.yeshi.fanli.entity.bus.user.TokenRecord;
import com.yeshi.fanli.entity.bus.user.TokenRecord.TokenTypeEnum;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
import com.yeshi.fanli.entity.bus.user.UserSystemCouponGiveRecord;
import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum;
import com.yeshi.fanli.exception.tlj.UserTaoLiJinOriginException;
import com.yeshi.fanli.exception.user.TokenRecordException;
import com.yeshi.fanli.exception.user.UserInfoExtraException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
import com.yeshi.fanli.service.inter.msg.UserOtherMsgNotificationService;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinGiveRecordService;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService;
import com.yeshi.fanli.service.inter.user.TokenRecordService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
@@ -32,6 +41,9 @@
@Service
public class TokenRecordServiceImpl implements TokenRecordService {
    @Resource(name = "taskExecutor")
    private TaskExecutor executor;
    @Resource
    private TokenRecordMapper tokenRecordMapper;
@@ -53,6 +65,13 @@
    @Resource
    private UserSystemCouponGiveRecordService userSystemCouponGiveRecordService;
    
    @Resource
    private UserTaoLiJinOriginService userTaoLiJinOriginService;
    @Resource
    private UserOtherMsgNotificationService userOtherMsgNotificationService;
    @Override
    public void insertSelective(TokenRecord record) {
        record.setCreateTime(new Date());
@@ -73,6 +92,15 @@
        TokenRecord rokenRecord = tokenRecordMapper.getByToken(token);
        if (rokenRecord == null)
            throw new TokenRecordException(1, "口令不存在");
        Date now = new Date();
        Date endTimeToken = rokenRecord.getEndTime();
        if (endTimeToken != null && endTimeToken.getTime() < now.getTime())
            throw new TokenRecordException(1, "口令已失效");
        Integer stateTtoken = rokenRecord.getState();
        if (stateTtoken != null && stateTtoken == 1)
            throw new TokenRecordException(1, "口令已失效");
        String nickName = null;
        String portrait = null;
@@ -95,11 +123,8 @@
            nickName = nickName.substring(0, 6) + "...";
        }
        Integer stateTtoken = rokenRecord.getState();
        if (stateTtoken == 1)
            throw new TokenRecordException(1, "口令已失效");
        TokenVO tokenVO = new TokenVO();
        tokenVO.setToken(token);
        tokenVO.setNickName(nickName);
        tokenVO.setPortrait(portrait);
@@ -221,23 +246,32 @@
            throw new TokenRecordException(1, "口令不能为空");
        TokenRecord rokenRecord = tokenRecordMapper.getByToken(token);
        if (rokenRecord == null || rokenRecord.getState() == 1)
        if (rokenRecord == null)
            throw new TokenRecordException(1, "口令已失效");
        Date now = new Date();
        Date endTimeToken = rokenRecord.getEndTime();
        if (endTimeToken != null && endTimeToken.getTime() < now.getTime())
            throw new TokenRecordException(1, "口令已失效");
        Integer stateTtoken = rokenRecord.getState();
        if (stateTtoken != null && stateTtoken == 1)
            throw new TokenRecordException(1, "口令已失效");
        String identify = rokenRecord.getIdentify();
        if (StringUtil.isNullOrEmpty(identify))
            throw new TokenRecordException(1, "口令标识不存在");
        
        Long giveUid = rokenRecord.getUid();
        
        Long giveUid = rokenRecord.getUid();
        UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
        if (userInfoExtra == null) 
            throw new TokenRecordException(1, "用户信息缺失");
            
        boolean receive = false;
        TokenTypeEnum tokenType = rokenRecord.getType();
        if (tokenType == TokenTypeEnum.freeCoupon) {
            UserSystemCoupon userCoupon = userSystemCouponService.selectByPrimaryKey(Long.parseLong(identify));
            long couponId = Long.parseLong(identify);
            UserSystemCoupon userCoupon = userSystemCouponService.selectByPrimaryKey(couponId);
            if (userCoupon == null)
                throw new TokenRecordException(1, "该券不存在");
@@ -255,6 +289,14 @@
                throw new TokenRecordException(1, "口令已失效");
            
            if (give && userCoupon.getState() == UserSystemCoupon.STATE_IN_USE) {
                UserSystemCouponGiveRecord giveRecord = userSystemCouponGiveRecordService.getRecordByUidAndCouponId(giveUid, couponId);
                if (giveRecord == null )
                    throw new TokenRecordException(1, "口令已失效");
                Date endTime = giveRecord.getEndTime();
                if (endTime != null && endTime.getTime() < now.getTime())
                    throw new TokenRecordException(1, "哎呀,这张免单券已失效了!");
                try {
                    userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.freeCoupon.name(), UserSystemCoupon.SOURCE_GIVE);
                } catch (Exception e) {
@@ -262,17 +304,46 @@
                    throw new TokenRecordException(1, "领取失败");
                }
                
                // 更新记录
                userSystemCouponGiveRecordService.updateRecord(uid, giveUid, Long.parseLong(identify));
                // 领取成功
                receive = true;
                // 更新赠送券信息
                userSystemCouponService.updateGiveRecord(uid, couponId, CouponTypeEnum.freeCoupon.name());
                // 更新赠送记录
                giveRecord.setReceiveUid(uid);
                giveRecord.setReceiveTime(new Date());
                userSystemCouponGiveRecordService.updateByPrimaryKeySelective(giveRecord);
                // 消息 + 队员
                executor.execute(new Runnable() {
                    @Override
                    public void run() {
                        SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH.mm");
                        boolean addTeam = addInviteTeam(uid, giveUid, userInfoExtra);
                        String beiZhu = "无";
                        if (addTeam)
                            beiZhu = "领取人已经成为你的一级队员";
                        String userName = "无";
                        UserInfo user = userInfoService.selectByPKey(uid);
                        if (user != null && !StringUtil.isNullOrEmpty(user.getNickName()))
                            userName = user.getNickName();
                        MsgOtherGiveContentDTO msgOther = new MsgOtherGiveContentDTO();
                        msgOther.setType(MsgOtherGiveContentDTO.TYEP_COUPON);
                        msgOther.setTitle("赠送免单券");
                        msgOther.setGiveType("你赠送的免单券被成功领取");
                        msgOther.setReceiveInfo("昵称:  " + userName +" ID:" + uid);
                        msgOther.setGiveTime(sd.format(giveRecord.getGiveTime()));
                        msgOther.setReceiveTime(sd.format(new Date()));
                        userOtherMsgNotificationService.tokenGiveMsg(giveUid, beiZhu, msgOther);
                    }
                });
            } else {
                throw new TokenRecordException(1, "口令已失效");
            }
        } else if (tokenType == TokenTypeEnum.rebatePercentCoupon) {
            UserSystemCoupon userCoupon = userSystemCouponService.selectByPrimaryKey(Long.parseLong(identify));
            long couponId = Long.parseLong(identify);
            UserSystemCoupon userCoupon = userSystemCouponService.selectByPrimaryKey(couponId);
            if (userCoupon == null)
                throw new TokenRecordException(1, "该券不存在");
@@ -290,14 +361,49 @@
                throw new TokenRecordException(1, "口令已失效");
            
            if (give && userCoupon.getState() == UserSystemCoupon.STATE_IN_USE) {
                UserSystemCouponGiveRecord giveRecord = userSystemCouponGiveRecordService.getRecordByUidAndCouponId(giveUid, couponId);
                if (giveRecord == null )
                    throw new TokenRecordException(1, "口令已失效");
                Date endTime = giveRecord.getEndTime();
                if (endTime != null && endTime.getTime() < now.getTime())
                    throw new TokenRecordException(1, "哎呀,这张返利奖励券已失效了!");
                try {
                    userSystemCouponService.insertUserCoupon(uid, CouponTypeEnum.rebatePercentCoupon.name(), UserSystemCoupon.SOURCE_GIVE);
                } catch (Exception e) {
                    LogHelper.errorDetailInfo(e);
                    throw new TokenRecordException(1, "领取失败");
                }
                // 领取成功
                receive = true;
                // 更新赠送券信息
                userSystemCouponService.updateGiveRecord(uid, couponId, CouponTypeEnum.rebatePercentCoupon.name());
                // 更新赠送记录
                giveRecord.setReceiveUid(uid);
                giveRecord.setReceiveTime(new Date());
                userSystemCouponGiveRecordService.updateByPrimaryKeySelective(giveRecord);
                // 消息 + 队员
                executor.execute(new Runnable() {
                    @Override
                    public void run() {
                        SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH.mm");
                        boolean addTeam = addInviteTeam(uid, giveUid, userInfoExtra);
                        String beiZhu = "无";
                        if (addTeam)
                            beiZhu = "领取人已经成为你的一级队员";
                        MsgOtherGiveContentDTO msgOther = new MsgOtherGiveContentDTO();
                        msgOther.setType(MsgOtherGiveContentDTO.TYEP_COUPON);
                        msgOther.setTitle("赠送奖励券");
                        msgOther.setGiveType("你赠送的奖励券被成功领取");
                        msgOther.setReceiveInfo("昵称:[昵称昵称昵称/无]ID:[854245]");
                        msgOther.setGiveTime(sd.format(giveRecord.getGiveTime()));
                        msgOther.setReceiveTime(sd.format(new Date()));
                        userOtherMsgNotificationService.tokenGiveMsg(giveUid, beiZhu, msgOther);
                    }
                });
            } else {
                throw new TokenRecordException(1, "口令已失效");
            }
@@ -305,28 +411,61 @@
            UserTaoLiJinGiveRecord giveRecord = userTaoLiJinGiveRecordService
                    .selectByPrimaryKey(Long.parseLong(identify));
            if (giveRecord == null || giveRecord.getState() == UserTaoLiJinGiveRecord.STATE_OVERDUE) {
                throw new TokenRecordException(1, "哎呀,哎呀,推广红包已失效了!");
                throw new TokenRecordException(1, "哎呀,推广红包已失效了!");
            } else if (giveRecord.getState() == UserTaoLiJinGiveRecord.STATE_RECEIVE) {
                throw new TokenRecordException(1, "哎呀,推广红包已被领取了!");
            } else {
                Date endTime = giveRecord.getEndTime();
                if (endTime != null && endTime.getTime() < now.getTime())
                    throw new TokenRecordException(1, "哎呀,推广红包已失效了!");
                
                BigDecimal amount = giveRecord.getAmount();
                try {
                    // 领取
                    userTaoLiJinOriginService.receiveFriendsGive(uid, amount);
                    // 更新记录
                    UserTaoLiJinGiveRecord updateRecord = new UserTaoLiJinGiveRecord();
                    updateRecord.setId(Long.parseLong(identify));
                    updateRecord.setReceiveTime(new Date());
                    updateRecord.setReceiveUid(uid);
                    updateRecord.setState(UserTaoLiJinGiveRecord.STATE_RECEIVE);
                    userTaoLiJinGiveRecordService.updateByPrimaryKeySelective(updateRecord);
                } catch (UserTaoLiJinOriginException e) {
                    e.printStackTrace();
                }
            }
        } else {
            throw new TokenRecordException(1, "无对应类型");
        }
        if (receive)
            throw new TokenRecordException(1, "领取失败啦");
        if (StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
            // 成为下级
        }
    }
    /**
     *     未激活邀请码: 上下级关系确立
     * @param uid
     * @param giveUid
     * @param userInfoExtra
     * @return
     */
    public boolean addInviteTeam(Long uid, Long giveUid, UserInfoExtra userInfoExtra) {
        boolean invite = false;
        if (StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
            UserInfoExtra userInfoExtraGive = userInfoExtraService.getUserInfoExtra(giveUid);
            if (userInfoExtraGive != null ) {
                String inviteCode = userInfoExtraGive.getInviteCode();
                if(!StringUtil.isNullOrEmpty(inviteCode)) {
                    try {
                        userInfoExtraService.activateInviteCode(uid, inviteCode);
                        invite = true;
                    } catch (UserInfoExtraException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
        return invite;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoExtraServiceImpl.java
@@ -650,67 +650,4 @@
        }
        return inviter;
    }
    @Override
    public String activateUser(Long uid, String inviteUid) throws UserInfoExtraException{
        if (uid == null || inviteUid == null) {
            throw new UserInfoExtraException(1, "传递id不能为空");
        }
        // 被邀请人信息
        UserInfo invitee = userInfoService.selectByPKey(uid);
        if (invitee == null) {
            throw new UserInfoExtraException(1, "用户不存在");
        }
        UserInfoExtra extra = userInfoExtraMapper.getInfoExtraByUid(uid);
        if (extra != null) {
            String inviteCodeHas = extra.getInviteCode();
            if (inviteCodeHas != null && inviteCodeHas.trim().length() > 0) {
                throw new UserInfoExtraException(1, "已存在邀请码,请刷新页面");
            }
        }
        // 邀请人信息
        UserInfo inviter = userInfoService.getInfoByPhoneOrInviteCode(inviteCode, inviteCode);
        if (inviter == null) {
            throw new UserInfoExtraException(1, "上级邀请码不存在");
        }
        // 绑定关系
        try {
            threeSaleSerivce.bindRelationshipByInviteCode(invitee, inviter);
        } catch (ThreeSaleException e) {
            try {
                LogHelper.errorDetailInfo(e);
            } catch (Exception e1) {
                e1.printStackTrace();
            }
            throw new UserInfoExtraException(1, "激活失败");
        }
        // 邀请码有效、生成邀请码
        String code = UserUtil.getInviteCode(uid);
        if (code == null || code.trim().length() == 0) {
            throw new UserInfoExtraException(1, "激活码生成失败");
        }
        UserInfoExtra userInfoExtra = new UserInfoExtra();
        userInfoExtra.setUserInfo(invitee);
        userInfoExtra.setInviteCode(code);
        // 保存额外信息
        saveUserInfoExtra(userInfoExtra);
        Long id = userInfoExtra.getId();
        if (id == null) {
            throw new UserInfoExtraException(1, "激活码生成失败");
        }
        return code;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponGiveRecordServiceImpl.java
@@ -1,7 +1,5 @@
package com.yeshi.fanli.service.impl.user;
import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
@@ -23,14 +21,12 @@
    }
    
    @Override
    public void updateRecord(Long receiveUid, Long giveUid, Long couponId) {
        UserSystemCouponGiveRecord record = userSystemCouponGiveRecordMapper.getRecordByUidAndCouponId(giveUid, couponId);
        if (record != null) {
            UserSystemCouponGiveRecord giveRecord = new UserSystemCouponGiveRecord();
            giveRecord.setId(record.getId());
            giveRecord.setReceiveUid(receiveUid);
            giveRecord.setReceiveTime(new Date());
            userSystemCouponGiveRecordMapper.updateByPrimaryKeySelective(giveRecord);
        }
    public UserSystemCouponGiveRecord getRecordByUidAndCouponId(Long giveUid, Long couponId) {
        return userSystemCouponGiveRecordMapper.getRecordByUidAndCouponId(giveUid, couponId);
    }
    @Override
    public void updateByPrimaryKeySelective(UserSystemCouponGiveRecord giveRecord) {
        userSystemCouponGiveRecordMapper.updateByPrimaryKeySelective(giveRecord);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java
@@ -1937,4 +1937,29 @@
        return tips;
    }
    @Override
    public void updateGiveRecord(Long uid, Long id, String couponType) {
        Date date = new Date();
        // 更新券状态:已使用
        UserSystemCoupon userCoupon = new UserSystemCoupon();
        userCoupon.setId(id);
        userCoupon.setState(UserSystemCoupon.STATE_END_USE);
        userCoupon.setUseTime(date);
        userCoupon.setUpdateTime(date);
        userSystemCouponMapper.updateByPrimaryKeySelective(userCoupon);
        // 插入使用券记录
        UserSystemCouponRecord couponRecord = new UserSystemCouponRecord();
        couponRecord.setState(UserSystemCouponRecord.STATE_SUCCESS);
        couponRecord.setUserSystemCoupon(userCoupon);
        couponRecord.setCouponType(couponType);
        couponRecord.setCreateTime(date);
        couponRecord.setUpdateTime(date);
        userSystemCouponRecordService.insertSelective(couponRecord);
        // TODO 赠送消息
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/UserOtherMsgNotificationService.java
@@ -2,6 +2,7 @@
import java.math.BigDecimal;
import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO;
import com.yeshi.fanli.dto.msg.MsgOtherTaoLiJinContentDTO;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
@@ -177,4 +178,13 @@
     * @param content
     */
    public void taoLiJinMsg(Long uid, String beiZhu, MsgOtherTaoLiJinContentDTO content);
    /**
     * 口令赠送领取
     * @param uid
     * @param beiZhu
     * @param content
     */
    public void tokenGiveMsg(Long uid, String beiZhu, MsgOtherGiveContentDTO content);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/tlj/UserTaoLiJinOriginService.java
@@ -140,4 +140,13 @@
     * @throws UserTaoLiJinOriginException
     */
    public void exchangeMoney(Long uid, BigDecimal money) throws UserTaoLiJinOriginException;
    /**
     * 领取淘礼金-好友赠送
     * @param uid
     * @param money
     * @return
     * @throws UserTaoLiJinOriginException
     */
    public UserTaoLiJinOrigin receiveFriendsGive(Long uid, BigDecimal money) throws UserTaoLiJinOriginException;
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserSystemCouponGiveRecordService.java
@@ -12,7 +12,18 @@
     * @param giveUid
     * @param couponId
     */
    public void updateRecord(Long receiveUid, Long giveUid, Long couponId);
    public void updateByPrimaryKeySelective(UserSystemCouponGiveRecord giveRecord);
    /**
     * 查询赠送记录
     * @param giveUid
     * @param couponId
     * @return
     */
    public UserSystemCouponGiveRecord getRecordByUidAndCouponId(Long giveUid, Long couponId);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserSystemCouponService.java
@@ -237,4 +237,12 @@
     */
    public String giveCoupon(Long uid, Long id) throws UserSystemCouponException;
    /**
     * 更新赠送记录
     * @param uid
     * @param id
     * @param couponType
     */
    public void updateGiveRecord(Long uid, Long id, String couponType);
}
fanli/src/main/java/com/yeshi/fanli/util/factory/goods/GoodsDetailVOFactory.java
@@ -133,7 +133,12 @@
        goodsInfo.setGoodsType(goodsType);
        goodsInfo.setZkPrice(goods.getPrice());
        goodsInfo.setState(goods.getState());
        Integer state = goods.getState();
        if (state == null) {
            goodsInfo.setState(0);
        } else {
            goodsInfo.setState(goods.getState());
        }
        goodsInfo.setSalesCount(TaoBaoUtil.getSaleCount(goods.getSales()));
        if (goodsType == Constant.SOURCE_TYPE_TAOBAO) {