admin
2019-08-19 616608ec1005bff373bc380ecc3bf02a1063497c
Merge remote-tracking branch 'origin/div' into div
33个文件已修改
3个文件已添加
1330 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java 57 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/tlj/UserTaoLiJinGiveRecordMapper.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/UserSystemCouponGiveRecordMapper.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dto/msg/MsgOtherExchangeContentDTO.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dto/msg/MsgOtherGiveContentDTO.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgInviteDetail.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgOtherDetail.java 26 ●●●●● 补丁 | 查看 | 原始文档 | 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 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/job/TaoLiJinJob.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/job/UserSystemCouponJob.java 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/tlj/UserTaoLiJinGiveRecordMapper.xml 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserSystemCouponGiveRecordMapper.xml 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralExchangeRecordServiceImpl.java 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralExchangeServiceImpl.java 109 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgOtherDetailServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserOtherMsgNotificationServiceImpl.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinGiveRecordServiceImpl.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinOriginServiceImpl.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinRecordServiceImpl.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java 250 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponGiveRecordServiceImpl.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/integral/IntegralExchangeRecordService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/UserOtherMsgNotificationService.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/tlj/UserTaoLiJinGiveRecordService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/tlj/UserTaoLiJinOriginService.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/TokenRecordService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserSystemCouponGiveRecordService.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserSystemCouponService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/Constant.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/goods/GoodsDetailVOFactory.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/UserMsgVOFactory.java 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java
@@ -183,11 +183,12 @@
     * 
     * @param acceptData
     * @param uid
     * @param ids
     * @param ids  // 领取id
     * @param gids // 未领取id
     * @param out
     */
    @RequestMapping(value = "receiveGoldCoin", method = RequestMethod.POST)
    public void receiveGoldCoin(AcceptData acceptData, Long uid, String ids, PrintWriter out) {
    public void receiveGoldCoin(AcceptData acceptData, Long uid, String ids, String gids, PrintWriter out) {
        if (uid == null || uid <= 0) {
            out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
            return;
@@ -201,10 +202,27 @@
            return;
        }
        Set<Long> gidList = gson.fromJson(gids, new TypeToken<HashSet<Long>>() {}.getType());
        try {
            Integer goldCoin = integralTaskRecordService.receiveGoldCoin(uid, idList);
            List<IntegralTaskRecord> list = null;
            if (gidList != null && gidList.size() > 0) {
                list = integralTaskRecordService.listNotReceived(5 - gidList.size(), uid);
            } else {
                list = integralTaskRecordService.listNotReceived(5, uid);
            }
            if (list == null) {
                list = new ArrayList<IntegralTaskRecord>();
            }
            GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
            Gson gson2 = gsonBuilder.create();
            JSONObject data = new JSONObject();
            data.put("goldCoin", goldCoin);
            data.put("list", gson2.toJson(list));
            out.print(JsonUtil.loadTrueResult(data));
        } catch (IntegralTaskRecordException e) {
            out.print(JsonUtil.loadFalseResult(e.getMsg()));
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java
@@ -27,6 +27,7 @@
import com.yeshi.fanli.service.inter.msg.UserSystemMsgService;
import com.yeshi.fanli.service.inter.push.PushService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
@@ -49,6 +50,9 @@
    
    @Resource
    private ThreeSaleSerivce threeSaleSerivce;
    @Resource
    private UserInfoService userInfoService;
    
    @Resource
    private UserInfoExtraService userInfoExtraService;
@@ -355,9 +359,11 @@
        } 
        
        Long remindId = null;
        boolean remindBoss = true;
        if (uid.longValue() == threeSale.getWorker().getId().longValue()) {
            remindId = threeSale.getBoss().getId(); // 提醒上级
        } else if (uid.longValue() == threeSale.getBoss().getId().longValue()) {
            remindBoss = false;
            remindId = threeSale.getWorker().getId(); // 提醒下级
        } 
        
@@ -366,14 +372,51 @@
            return;
        }
        
        try {
            // TODO版本区分
        UserInfo userInfo = userInfoService.selectByPKey(remindId);
        if (userInfo == null) {
            out.print(JsonUtil.loadFalseResult("被提醒人信息不存在"));
            return;
        }
            
//            List<String> listIOS = new ArrayList<String>();
//            List<String> listAndroid = new ArrayList<String>();
//            pushService.pushZNX(remindId, "", "", listIOS, listAndroid);
//            userSystemMsgService.addUserSystemMsg(remindId, UserSystemMsgTypeEnum.question,
//                    "", "", UserSystemMsg.TIME_TAG_EMERGENT, null);
        Long bossId = null;
        Long workerId = null;
        String title = "队员提醒消息";
        String content = "";
        if (remindBoss) {
            bossId = remindId;
            workerId = uid;
            content = "你的邀请人"+ userInfo.getNickName() +",提醒你添加微信号,以便于和你取得联系帮助你更好的省钱,赶快去添加吧;注:请升级到本软件最新版本在“我的-我的信息”中添加。";
        } else {
            bossId = uid;
            workerId = remindId;
        }    content = "你的一级队员"+ userInfo.getNickName() +",提醒你添加微信号,以便于和你取得联系和学习省钱技巧,赶快去添加吧;注:请升级到本软件最新版本在“我的-我的信息”中添加。";
        try {
            List<String> listIOS = new ArrayList<String>();
            List<String> listAndroid = new ArrayList<String>();
            pushService.pushZNX(remindId, title, content, listIOS, listAndroid);
            userSystemMsgService.addUserSystemMsg(remindId, UserSystemMsgTypeEnum.common,
                    title, content, UserSystemMsg.TIME_TAG_COMMON, null);
            ThreeSaleExtraInfo newInfo = new ThreeSaleExtraInfo();
            if (remindBoss) {
                newInfo.setRemindBoss(1);
            } else {
                newInfo.setRemindWorker(1);
            }
            ThreeSaleExtraInfo threeExtra = threeSaleExtraInfoSerivce.getbyBossIdAndWorkerId(bossId, workerId);
            if (threeExtra != null) {
                newInfo.setId(threeExtra.getId());
                newInfo.setUpdateTime(new Date());
                threeSaleExtraInfoSerivce.updateByPrimaryKeySelective(newInfo);
            } else {
                newInfo.setCreateTime(new Date());
                newInfo.setUpdateTime(new Date());
                threeSaleExtraInfoSerivce.insertSelective(newInfo);
            }
            
            JSONObject data = new JSONObject();
            data.put("weiXinState", 2);
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())
@@ -255,6 +260,15 @@
            data.put("goods", gson.toJson(GoodsDetailVOFactory.convertCommonGoods(commonGoods, null, fanLiRate, shareRate)));
            out.print(JsonUtil.loadTrueResult(data));
            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();
@@ -319,7 +333,7 @@
    
    /**
     *
     * 口令领取
     * @param acceptData
     * @param kw
     * @param goodsType
@@ -328,8 +342,8 @@
    @RequestMapping(value = "tokenReceive", method = RequestMethod.POST)
    public void tokenReceive(AcceptData acceptData, Long uid, String token, PrintWriter out) {
        try {
            tokenRecordService.receiveToken(token, uid);
            out.print(JsonUtil.loadTrueResult("领取成功"));
            String msg = tokenRecordService.receiveToken(token, uid);
            out.print(JsonUtil.loadTrueResult(msg));
        } catch (TokenRecordException e) {
            out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
        }
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/tlj/UserTaoLiJinGiveRecordMapper.java
@@ -1,9 +1,17 @@
package com.yeshi.fanli.dao.mybatis.tlj;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinGiveRecord;
public interface UserTaoLiJinGiveRecordMapper extends BaseMapper<UserTaoLiJinGiveRecord> {
    
    /**
     * 查询超期的赠送记录
     * @return
     */
    List<UserTaoLiJinGiveRecord> overdueList(@Param("count") int count);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/UserSystemCouponGiveRecordMapper.java
@@ -1,8 +1,28 @@
package com.yeshi.fanli.dao.mybatis.user;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.bus.user.UserSystemCouponGiveRecord;
public interface UserSystemCouponGiveRecordMapper extends BaseMapper<UserSystemCouponGiveRecord> {
    /**
     * 赠送记录
     * @param uid 赠送人id
     * @param couponId 券id
     * @return
     */
    UserSystemCouponGiveRecord getRecordByUidAndCouponId(@Param("uid") Long uid, @Param("couponId") Long couponId);
    /**
     * 赠送超时未领取的
     * @param count
     * @return
     */
    List<UserSystemCouponGiveRecord> overdueList(@Param("count") int count);
}
fanli/src/main/java/com/yeshi/fanli/dto/msg/MsgOtherExchangeContentDTO.java
New file
@@ -0,0 +1,43 @@
package com.yeshi.fanli.dto.msg;
/**
 * 其他消息里面的金币兑换信息
 *
 * @author Administrator
 *
 */
public class MsgOtherExchangeContentDTO {
    private String state; // 状态
    private String expend;  // 消耗
    private String totalGold;  //赠送类别
    private String thing; // 兑换物品
    public String getState() {
        return state;
    }
    public void setState(String state) {
        this.state = state;
    }
    public String getExpend() {
        return expend;
    }
    public void setExpend(String expend) {
        this.expend = expend;
    }
    public String getTotalGold() {
        return totalGold;
    }
    public void setTotalGold(String totalGold) {
        this.totalGold = totalGold;
    }
    public String getThing() {
        return thing;
    }
    public void setThing(String thing) {
        this.thing = thing;
    }
}
fanli/src/main/java/com/yeshi/fanli/dto/msg/MsgOtherGiveContentDTO.java
New file
@@ -0,0 +1,61 @@
package com.yeshi.fanli.dto.msg;
/**
 * 其他消息里面的淘礼金相关的内容
 *
 * @author Administrator
 *
 */
public class MsgOtherGiveContentDTO {
    // 券
    public final static String TYEP_COUPON = "coupon";
    // 红包
    public final static String TYEP_TLJ = "taolijin";
    private String type;  //赠送类别   券: coupon;  推广红包: taoLiJin
    private String title;  // 标题
    private String giveType;  //赠送类别
    private String receiveInfo; // 领取人信息
    private String giveTime; // 赠送时间
    private String receiveTime;// 领取时间
    public String getGiveType() {
        return giveType;
    }
    public void setGiveType(String giveType) {
        this.giveType = giveType;
    }
    public String getReceiveInfo() {
        return receiveInfo;
    }
    public void setReceiveInfo(String receiveInfo) {
        this.receiveInfo = receiveInfo;
    }
    public String getGiveTime() {
        return giveTime;
    }
    public void setGiveTime(String giveTime) {
        this.giveTime = giveTime;
    }
    public String getReceiveTime() {
        return receiveTime;
    }
    public void setReceiveTime(String receiveTime) {
        this.receiveTime = receiveTime;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgInviteDetail.java
@@ -17,7 +17,7 @@
@Table("yeshi_ec_msg_invite")
public class MsgInviteDetail {
    public enum MsgTypeInviteTypeEnum {
        invite("邀请消息");
        invite("邀请消息"), exchangeCode("恭喜你,邀请码兑换成功");
        private final String desc;
        private MsgTypeInviteTypeEnum(String desc) {
@@ -48,6 +48,7 @@
    @Column(name="mi_update_time")
    private Date updateTime;
    public Long getId() {
        return id;
    }
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgOtherDetail.java
@@ -6,6 +6,8 @@
import org.yeshi.utils.mybatis.Table;
import com.yeshi.fanli.dto.msg.MsgOtherCouponContentDTO;
import com.yeshi.fanli.dto.msg.MsgOtherExchangeContentDTO;
import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO;
import com.yeshi.fanli.dto.msg.MsgOtherTaoLiJinContentDTO;
import com.yeshi.fanli.entity.bus.user.UserInfo;
@@ -19,7 +21,7 @@
public class MsgOtherDetail {
    public enum MsgTypeOtherTypeEnum {
        couponMianDan("免单券"), couponWelfareMianDan("福利免单券"), couponReward("奖励券"),
        taoLiJin("推广红包");
        taoLiJin("推广红包"), give("赠送"), exchange("金币兑换");
        
        private final String desc;
@@ -56,6 +58,12 @@
    // 淘礼金参数
    private MsgOtherTaoLiJinContentDTO taoLiJinContent;
    // 赠送信息
    private MsgOtherGiveContentDTO giveContent;
    // 金币兑换信息
    private MsgOtherExchangeContentDTO exchangeContent;
    
    
    public MsgOtherCouponContentDTO getCoupnContent() {
@@ -145,4 +153,20 @@
    public void setTaoLiJinContent(MsgOtherTaoLiJinContentDTO taoLiJinContent) {
        this.taoLiJinContent = taoLiJinContent;
    }
    public MsgOtherGiveContentDTO getGiveContent() {
        return giveContent;
    }
    public void setGiveContent(MsgOtherGiveContentDTO giveContent) {
        this.giveContent = giveContent;
    }
    public MsgOtherExchangeContentDTO getExchangeContent() {
        return exchangeContent;
    }
    public void setExchangeContent(MsgOtherExchangeContentDTO exchangeContent) {
        this.exchangeContent = exchangeContent;
    }
}
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("好友赠送"), giveSendBack("赠送退回");
        
        private final String desc;
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/UserSystemCouponGiveRecord.java
@@ -12,6 +12,13 @@
@Table("yeshi_ec_user_system_coupon_give_record")
public class UserSystemCouponGiveRecord {
    
    // 未领取
    public final static int STATE_INIT = 0;
    // 已领取
    public final static int STATE_RECEIVE =1;
    // 已过期 退回
    public final static int STATE_OVERDUE = 2;
    @Column(name = "cgr_id")
    private Long id;
    // 券id
@@ -20,16 +27,21 @@
    // 赠送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;
    // 状态
    @Column(name = "cgr_state")
    private Integer state;
    
    
    public Long getId() {
@@ -80,4 +92,19 @@
        this.receiveTime = receiveTime;
    }
    
    public Date getEndTime() {
        return endTime;
    }
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }
    public Integer getState() {
        return state;
    }
    public void setState(Integer state) {
        this.state = state;
    }
}
fanli/src/main/java/com/yeshi/fanli/job/TaoLiJinJob.java
@@ -10,6 +10,7 @@
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinGiveRecord;
import com.yeshi.fanli.entity.taobao.ShareHotGoods;
import com.yeshi.fanli.entity.taobao.TLJBuyGoods;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
@@ -21,6 +22,8 @@
import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinGiveRecordService;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinReportService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.TaoBaoConstant;
@@ -45,6 +48,13 @@
    @Resource
    private TaoBaoUnionConfigService taoBaoUnionConfigService;
    @Resource
    private UserTaoLiJinGiveRecordService userTaoLiJinGiveRecordService;
    @Resource
    private UserTaoLiJinOriginService userTaoLiJinOriginService;
    /**
     * 更新报告
@@ -169,4 +179,33 @@
        addTLJBuyGoods(list, day);
    }
    /**
     * 每天00:10  赠送退回已过期淘礼金
     */
    @Scheduled(cron = "0 10 0 * * ? ")
    public void giveSendBack() {
        if (!Constant.IS_TASK)
            return;
        for (int i = 0; i < 100; i++) {
            List<UserTaoLiJinGiveRecord> overdueList = userTaoLiJinGiveRecordService.overdueList(500);
            if (overdueList == null || overdueList.size() == 0) {
                break;
            }
            for (UserTaoLiJinGiveRecord record: overdueList) {
                try {
                    userTaoLiJinOriginService.giveSendBack(record.getGiveUid(), record.getAmount());
                    // 更新记录
                    UserTaoLiJinGiveRecord updateRecord = new UserTaoLiJinGiveRecord();
                    updateRecord.setId(record.getId());
                    updateRecord.setState(UserTaoLiJinGiveRecord.STATE_OVERDUE);
                    userTaoLiJinGiveRecordService.updateByPrimaryKeySelective(updateRecord);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/job/UserSystemCouponJob.java
New file
@@ -0,0 +1,70 @@
package com.yeshi.fanli.job;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinGiveRecord;
import com.yeshi.fanli.entity.bus.user.UserSystemCouponGiveRecord;
import com.yeshi.fanli.entity.taobao.ShareHotGoods;
import com.yeshi.fanli.entity.taobao.TLJBuyGoods;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig;
import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.taobao.ShareHotGoodsService;
import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinGiveRecordService;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService;
import com.yeshi.fanli.service.inter.user.UserSystemCouponGiveRecordService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.TaoBaoConstant;
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
@Component
public class UserSystemCouponJob {
    @Resource
    private UserSystemCouponGiveRecordService userSystemCouponGiveRecordService;
    /**
     * 每天00:10  赠送退回已过期淘礼金
     */
    @Scheduled(cron = "0 10 0 * * ? ")
    public void giveSendBack() {
        if (!Constant.IS_TASK)
            return;
        for (int i = 0; i < 100; i++) {
            List<UserSystemCouponGiveRecord> overdueList = userSystemCouponGiveRecordService.overdueList(500);
            if (overdueList == null || overdueList.size() == 0) {
                break;
            }
            for (UserSystemCouponGiveRecord record: overdueList) {
//                try {
//                    userTaoLiJinOriginService.giveSendBack(record.getGiveUid(), record.getAmount());
//                    // 更新记录
//                    UserTaoLiJinGiveRecord updateRecord = new UserTaoLiJinGiveRecord();
//                    updateRecord.setId(record.getId());
//                    updateRecord.setState(UserTaoLiJinGiveRecord.STATE_OVERDUE);
//                    userTaoLiJinGiveRecordService.updateByPrimaryKeySelective(updateRecord);
//                } catch (Exception e) {
//                    e.printStackTrace();
//                }
            }
        }
    }
}
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,21 +33,29 @@
      <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}
  </update>
  <select id="overdueList" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_user_taolijin_give_record d
    WHERE d.`tgr_state` = 0 AND d.`tgr_end_time` IS NOT NULL AND d.`tgr_end_time` <![CDATA[<]]> CURDATE()
    LIMIT #{count}
  </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserSystemCouponGiveRecordMapper.xml
@@ -6,42 +6,63 @@
    <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"/>
    <result column="cgr_state" property="state" jdbcType="INTEGER"/>
  </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,cgr_state</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,cgr_state) values (#{id,jdbcType=BIGINT},#{couponId,jdbcType=BIGINT},#{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.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>
      <if test="state != null">cgr_state,</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>
      <if test="state != null">#{state,jdbcType=INTEGER},</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},cgr_state = #{state,jdbcType=INTEGER} 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>
      <if test="state != null">cgr_state=#{state,jdbcType=INTEGER},</if>
    </set> where cgr_id = #{id,jdbcType=BIGINT}
  </update>
  <select id="getRecordByUidAndCouponId" resultMap="BaseResultMap">
    SELECT * FROM yeshi_ec_user_system_coupon_give_record
    WHERE cgr_give_uid = #{uid} AND  cgr_coupon_id = #{couponId}
    ORDER BY cgr_end_time desc
    LIMIT 1
  </select>
  <select id="overdueList" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_user_system_coupon_give_record d
    WHERE d.`cgr_state` = 0 AND d.`cgr_end_time` IS NOT NULL AND d.`cgr_end_time` <![CDATA[<]]> CURDATE()
    LIMIT #{count}
  </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralExchangeRecordServiceImpl.java
@@ -1,5 +1,6 @@
package com.yeshi.fanli.service.impl.integral;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
@@ -7,9 +8,14 @@
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.integral.IntegralExchangeRecordMapper;
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
import com.yeshi.fanli.entity.integral.IntegralExchange;
import com.yeshi.fanli.entity.integral.IntegralExchange.ExchangeTypeEnum;
import com.yeshi.fanli.entity.integral.IntegralExchangeRecord;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.integral.IntegralExchangeRecordService;
import com.yeshi.fanli.service.inter.integral.IntegralExchangeService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.util.StringUtil;
@Service
@@ -21,6 +27,9 @@
    @Resource
    private IntegralExchangeService integralExchangeService;
    
    @Resource
    private UserInfoExtraService userInfoExtraService;
    @Override
    public List<IntegralExchange> listExchange(long start, int count, Long uid){
        List<IntegralExchange> listValid = integralExchangeService.listValidCache(start, count);
@@ -28,16 +37,64 @@
            return listValid;
        }
        
        for(IntegralExchange integralExchange: listValid) {
            String progress = integralExchange.getProgress();
        boolean hasCode = false;
        try {
            UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
            if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
                hasCode = true;
            }
        } catch (Exception e) {
            LogHelper.errorDetailInfo(e);
        }
        for(int i = 0; i < listValid.size(); i++) {
            IntegralExchange exchange = listValid.get(i);
            ExchangeTypeEnum type = exchange.getType();
            if (type == null) {
                listValid.remove(i);
                i --;
                continue;
            }
            Long id = exchange.getId();
            if (type == ExchangeTypeEnum.freeCouponBuy) {
                // 注:因自购免单券,一个用户只能兑换一次,则当前用户一旦兑换成功,自购免单券兑换入口永久在当前用户金币兑换列表中消失。
                long num = integralExchangeRecordMapper.countRecordByUid(id, uid);
                if (num >= 1) {
                    listValid.remove(i);
                    i --;
                    continue;
                }
            }
            // 邀请码激活卡,兑换项,如果当前用户已经激活了邀请功能,则不需要显示该兑换项。
            if (type == ExchangeTypeEnum.inviteCodeActivate && hasCode) {
                listValid.remove(i);
                i --;
                continue;
            }
            // 邀请码发布卡,兑换项,如果当前用户未激活邀请功能,则不需要显示该兑换项。
            if (type == ExchangeTypeEnum.inviteCodePublish && !hasCode) {
                listValid.remove(i);
                i --;
                continue;
            }
            String progress = exchange.getProgress();
            if (StringUtil.isNullOrEmpty(progress))
                continue;
            
            // 今日兑换情况
            long exchange = integralExchangeRecordMapper.countRecordByUid(integralExchange.getId(), uid);
            progress = progress.replace("{已兑换}", exchange + "").replace("{上限数}", integralExchange.getUpperLimit() + "");
            integralExchange.setProgress(progress);
            long num = integralExchangeRecordMapper.countRecordByUid(id, uid);
            Integer upperLimit = exchange.getUpperLimit();
            if (upperLimit == null) {
                progress = progress.replace("{已兑换}", num + "").replace("/{上限数}", "");
            } else {
                progress = progress.replace("{已兑换}", num + "").replace("{上限数}", exchange.getUpperLimit() + "");
            }
            exchange.setProgress(progress);
        }
        return listValid;
    }
@@ -46,4 +103,13 @@
    public long countRecordByUid(long exchangeid, Long uid){
        return integralExchangeRecordMapper.countRecordByUid(exchangeid, uid);
    }
    @Override
    public void addExchangeRecord(long exchangeid, Long uid){
        IntegralExchangeRecord record = new IntegralExchangeRecord();
        record.setExchangeId(exchangeid);
        record.setUid(uid);
        record.setCreateTime(new Date());
        integralExchangeRecordMapper.insertSelective(record);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralExchangeServiceImpl.java
@@ -6,9 +6,11 @@
import javax.annotation.Resource;
import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.integral.IntegralExchangeMapper;
import com.yeshi.fanli.dto.msg.MsgOtherExchangeContentDTO;
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
@@ -23,6 +25,8 @@
import com.yeshi.fanli.service.inter.integral.CodePublishRecordService;
import com.yeshi.fanli.service.inter.integral.IntegralExchangeRecordService;
import com.yeshi.fanli.service.inter.integral.IntegralExchangeService;
import com.yeshi.fanli.service.inter.msg.MsgInviteDetailService;
import com.yeshi.fanli.service.inter.msg.UserOtherMsgNotificationService;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
@@ -35,6 +39,9 @@
@Service
public class IntegralExchangeServiceImpl implements IntegralExchangeService {
    @Resource(name = "taskExecutor")
    private TaskExecutor executor;
    @Resource
    private IntegralExchangeMapper integralExchangeMapper;
@@ -62,6 +69,12 @@
    
    @Resource
    private IntegralExchangeRecordService integralExchangeRecordService;
    @Resource
    private UserOtherMsgNotificationService userOtherMsgNotificationService;
    @Resource
    private MsgInviteDetailService msgInviteDetailService;
    
    
@@ -104,13 +117,13 @@
            return exchangeTip;
        }
        
        int upperLimit = exchange.getUpperLimit();
        // 今日兑换情况
        Integer upperLimit = exchange.getUpperLimit();
        if (upperLimit != null) { // 是否有限制每日次数
        long exchangeCount = integralExchangeRecordService.countRecordByUid(id, uid);
        if (exchangeCount >= upperLimit) {
            throw new IntegralExchangeException(1, "今日兑换已达上限");
        }
        }
        
        Integer goldCoinHas = extraVO.getGoldCoin();
        if (goldCoin.intValue() > goldCoinHas.intValue()) {
@@ -162,11 +175,13 @@
        if (exchange == null)
            throw new IntegralExchangeException(1, "兑换方式不存在");
        int upperLimit = exchange.getUpperLimit();
        // 今日兑换情况
        long exchangeCount = integralExchangeRecordService.countRecordByUid(id, uid);
        long exchangeCount = 0;
        Integer upperLimit = exchange.getUpperLimit();
        if (upperLimit != null) {  // 是否有限制每日次数
            exchangeCount = integralExchangeRecordService.countRecordByUid(id, uid);
        if (exchangeCount >= upperLimit) {
            throw new IntegralExchangeException(1, "今日兑换已达上限");
            }
        }
        
        Integer goldCoin = exchange.getGoldCoin();
@@ -175,26 +190,29 @@
            throw new IntegralExchangeException(1, "当前账户中可用金币不足,无法兑换该奖品!");
        }
        
        String thing = "";
        try {
            ExchangeTypeEnum type = exchange.getType();
            if (ExchangeTypeEnum.freeCouponBuy == type || ExchangeTypeEnum.freeCouponGive == type) {
                // 自购免单券、赠送免单券
            if (ExchangeTypeEnum.freeCouponBuy == type) {
                thing = "自购免单券";
                userSystemCouponService.exchangeCoupon(uid, type.name(), UserSystemCoupon.SOURCE_EXCHANGE, null);
            } else if (ExchangeTypeEnum.freeCouponGive == type) {
                thing = "赠送免单券";
                userSystemCouponService.exchangeCoupon(uid, type.name(), UserSystemCoupon.SOURCE_EXCHANGE, null);
            } else if (ExchangeTypeEnum.rebatePercentCoupon == type) {
                // 奖励免单券
                thing = "奖励免单券";
                userSystemCouponService.exchangeCoupon(uid, type.name(), UserSystemCoupon.SOURCE_EXCHANGE, new BigDecimal(10));
            } else if (ExchangeTypeEnum.inviteCodePublish == type) {
                // 邀请码发布
                thing = "邀请码激活卡";
                if(codePublishRecordService.countValidRecord(uid) > 0)
                    throw new IntegralExchangeException(1, "三天之内不可重复兑换");
                codePublishRecordService.publishInviteCode(uid);
            } else if (ExchangeTypeEnum.taoLiJin == type) {
                // 推广红包
                thing = "推广红包";
                userTaoLiJinOriginService.exchangeMoney(uid, exchange.getAmount());
            } else if (ExchangeTypeEnum.cash == type) {
                // 现金红包
                thing = "现金红包";
                BigDecimal money = exchange.getAmount();
                // 1、插入红包数据
                HongBaoV2 hongBaoV2 = new HongBaoV2();
                hongBaoV2.setMoney(money);
@@ -222,13 +240,32 @@
                progress = progress.replace("{已兑换}",exchangeCount + "").replace("{上限数}", exchange.getUpperLimit() + "");
            exchange.setProgress(progress);
            
            // 剩余金币
            int surplus = goldCoinHas.intValue() - goldCoin.intValue();
            exchange.setUserGoldCoin(surplus + "枚");
            // 更新金币
            UserInfoExtraVO extraUpdate = new UserInfoExtraVO();
            extraUpdate.setId(extraVO.getId());
            extraUpdate.setGoldCoin(goldCoinHas.intValue() - goldCoin.intValue());
            extraUpdate.setGoldCoin(surplus);
            userInfoExtraService.saveUserInfoExtra(extraUpdate);
            
            exchange.setUserGoldCoin(extraUpdate.getGoldCoin() + "枚");
            // 添加兑换记录
            integralExchangeRecordService.addExchangeRecord(id, uid);
            // 消息
            final String things = thing;
            executor.execute(new Runnable() {
                @Override
                public void run() {
                    MsgOtherExchangeContentDTO msgOther = new MsgOtherExchangeContentDTO();
                    msgOther.setState("金币兑换成功");
                    msgOther.setExpend(goldCoin + "金币");
                    msgOther.setTotalGold(surplus + "金币");
                    msgOther.setThing(things);
                    userOtherMsgNotificationService.exchangeMsg(uid, "", msgOther);
                }
            });
            
            return exchange;
        } catch (Exception e) {
@@ -305,19 +342,55 @@
        Integer goldCoin = exchange.getGoldCoin();
        Integer goldCoinHas = extraVO.getGoldCoin();
        if (goldCoin.intValue() > goldCoinHas.intValue()) {
        if (goldCoin.intValue() > goldCoinHas.intValue())
            throw new IntegralExchangeException(1, "当前账户中可用金币不足,无法兑换该奖品!");
        }
        
        try {
            UserInfoExtraVO inviteExtra = userInfoExtraService.getInfoExtraVOByUid(record.getUid());
            if (inviteExtra == null || StringUtil.isNullOrEmpty(inviteExtra.getInviteCode()))
                throw new IntegralExchangeException(1, "兑换失败,该用户邀请码不存在");
            
            String inviteCode = inviteExtra.getInviteCode();
            userInfoExtraService.activateInviteCode(uid, inviteExtra.getInviteCode());
            // 剩余金币
            int surplus = goldCoinHas.intValue() - goldCoin.intValue();
            // 更新金币
            UserInfoExtraVO extraUpdate = new UserInfoExtraVO();
            extraUpdate.setId(extraVO.getId());
            extraUpdate.setGoldCoin(surplus);
            userInfoExtraService.saveUserInfoExtra(extraUpdate);
            // 添加兑换记录
            integralExchangeRecordService.addExchangeRecord(id, uid);
            // 消息
            executor.execute(new Runnable() {
                @Override
                public void run() {
                    UserInfo userInfo = userInfoService.selectByPKey(record.getUid());
                    if (userInfo == null)
                        return;
                    String beizu = "邀请人:" + userInfo.getNickName() + ",邀请码:" + inviteCode;
                    MsgOtherExchangeContentDTO msgOther = new MsgOtherExchangeContentDTO();
                    msgOther.setState("金币兑换成功");
                    msgOther.setExpend(goldCoin + "金币");
                    msgOther.setTotalGold(surplus + "金币");
                    msgOther.setThing("邀请码激活卡");
                    userOtherMsgNotificationService.exchangeMsg(uid, beizu, msgOther);
                }
            });
        } catch (Exception e) {
            LogHelper.errorDetailInfo(e);
            throw new IntegralExchangeException(1, "兑换异常");
            throw new IntegralExchangeException(1, "兑换失败");
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgOtherDetailServiceImpl.java
@@ -40,6 +40,12 @@
        } 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);
        } else if (detail.getType() == MsgTypeOtherTypeEnum.exchange) {
            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,8 @@
import com.google.gson.Gson;
import com.yeshi.fanli.dto.msg.MsgOtherCouponContentDTO;
import com.yeshi.fanli.dto.msg.MsgOtherExchangeContentDTO;
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 +303,37 @@
        }
    }
    @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();
        }
    }
    @Override
    public void exchangeMsg(Long uid, String beiZhu,  MsgOtherExchangeContentDTO 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.exchange);
            msgOtherDetailService.addMsgOtherDetail(detail);
        } catch (MsgOtherDetailException e) {
            e.printStackTrace();
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinGiveRecordServiceImpl.java
@@ -1,5 +1,7 @@
package com.yeshi.fanli.service.impl.tlj;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
@@ -25,8 +27,15 @@
        return userTaoLiJinGiveRecordMapper.selectByPrimaryKey(id);
    }
    
    @Override
    public void updateByPrimaryKeySelective(UserTaoLiJinGiveRecord record) {
        userTaoLiJinGiveRecordMapper.updateByPrimaryKeySelective(record);
    }
    @Override
    public List<UserTaoLiJinGiveRecord> overdueList(int count) {
        return userTaoLiJinGiveRecordMapper.overdueList(count);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinOriginServiceImpl.java
@@ -400,8 +400,6 @@
    }
    
    
    @Override
    public void overdueHongBao(Long uid) {
        if (uid == null) {
@@ -579,4 +577,61 @@
        // 红包明细
        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;
    }
    @Override
    @Transactional
    public void  giveSendBack(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.giveSendBack);
        // 红包明细
        userTaoLiJinDetailService.createAddDetail(origin);
        UserTaoLiJinDetail detail = new UserTaoLiJinDetail();
        detail.setUid(uid);
        detail.setMoney(money);
        detail.setType(TaoLiJinDetailTypeEnum.giveBack);
        detail.setTitle(TaoLiJinDetailTypeEnum.giveBack.getDesc());
        detail.setCreateTime(new Date());
        userTaoLiJinDetailService.insertSelective(detail);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinRecordServiceImpl.java
@@ -533,8 +533,12 @@
        if (amount.compareTo(tlj) > 0)
            throw new UserTaoLiJinRecordException(1, "红包余额不足");
        
        Long giveId = null;
        Date nowDate = new Date();
        try {
            String endDay = DateUtil.plusDay(Constant.GIVE_DAYS - 1, nowDate);
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
            Date endTime = format.parse(endDay);
        
        // 赠送记录
        UserTaoLiJinGiveRecord giveRecord = new UserTaoLiJinGiveRecord();
@@ -542,7 +546,14 @@
        giveRecord.setGiveUid(uid);
        giveRecord.setState(UserTaoLiJinGiveRecord.STATE_INIT);
        giveRecord.setGiveTime(nowDate);
            giveRecord.setEndTime(endTime);
        userTaoLiJinGiveRecordService.insertSelective(giveRecord);
            giveId = giveRecord.getId();
        } catch (Exception e) {
            LogHelper.errorDetailInfo(e);
            throw new UserTaoLiJinRecordException(1, "赠送记录创建失败");
        }
        
        String token = null;
        for (int i = 0; i < 5; i++) {
@@ -551,12 +562,16 @@
                long num = 10000 + (long) (Math.random() * 10000);
                token = UserUtil.getInviteCode(num);
                
                String endDay = DateUtil.plusDay(Constant.TOKEN_DAYS - 1,nowDate);
                SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
                Date endTime = format.parse(endDay);
                TokenRecord tokenRecord = new TokenRecord();
                tokenRecord.setUid(uid);
                tokenRecord.setIdentify(giveRecord.getId()+""); // 记录id
                tokenRecord.setIdentify(giveId + ""); // 记录id
                tokenRecord.setType(TokenTypeEnum.taoLiJin);
                tokenRecord.setStartTime(nowDate);
                tokenRecord.setEndTime(DateUtil.plusDayDate(3, nowDate));
                tokenRecord.setEndTime(endTime);
                tokenRecord.setToken(token);
                tokenRecord.setState(0);
                tokenRecordService.insertSelective(tokenRecord);
fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java
@@ -1,31 +1,38 @@
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 org.yeshi.utils.JsonUtil;
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.ThreeSale;
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.UserSystemCouponException;
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;
import com.yeshi.fanli.service.inter.user.UserSystemCouponGiveRecordService;
import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
@@ -33,6 +40,9 @@
@Service
public class TokenRecordServiceImpl implements TokenRecordService {
    @Resource(name = "taskExecutor")
    private TaskExecutor executor;
    @Resource
    private TokenRecordMapper tokenRecordMapper;
@@ -51,6 +61,17 @@
    @Resource
    private UserInfoExtraService userInfoExtraService;
    @Resource
    private UserSystemCouponGiveRecordService userSystemCouponGiveRecordService;
    @Resource
    private UserTaoLiJinOriginService userTaoLiJinOriginService;
    @Resource
    private UserOtherMsgNotificationService userOtherMsgNotificationService;
    @Override
    public void insertSelective(TokenRecord record) {
@@ -73,6 +94,15 @@
        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;
        Long inviteId = rokenRecord.getUid();
@@ -94,12 +124,9 @@
            nickName = nickName.substring(0, 6) + "...";
        }
        Integer stateTtoken = rokenRecord.getState();
        if (stateTtoken == 1)
            throw new TokenRecordException(1, "口令已失效");
        TokenVO tokenVO = new TokenVO();
        tokenVO.setNickName(nickName);
        tokenVO.setToken(token);
        tokenVO.setNickName(nickName + "赠送");
        tokenVO.setPortrait(portrait);
        String identify = rokenRecord.getIdentify();
@@ -131,6 +158,7 @@
                        throw new TokenRecordException(1001, "温馨提示,[免单券]需要登录后领取");
                    state = true;
                    tokenVO.setAmount(1);
                    UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
                    if (userInfoExtra == null || StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
                        tips.add("确认领取后,你将成为赠送者的一级队员;");
@@ -165,6 +193,7 @@
                        throw new TokenRecordException(1001, "温馨提示,[返利奖励券]需要登录后领取");
                    state = true;
                    tokenVO.setAmount(1);
                    UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
                    if (userInfoExtra == null || StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
                        tips.add("确认领取后,你将成为赠送者的一级队员;");
@@ -190,7 +219,10 @@
                if (uid == null || uid <= 0)
                    throw new TokenRecordException(1001, "温馨提示,[推广红包]需要登录后领取");
                BigDecimal amount = giveRecord.getAmount();
                state = true;
                tokenVO.setAmount(Integer.parseInt(amount.setScale(0).toString()));
                UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
                if (userInfoExtra == null || StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
                    tips.add("确认领取后,你将成为赠送者的一级队员;");
@@ -212,7 +244,7 @@
    }
    @Override
    public void receiveToken(String token, Long uid) throws TokenRecordException {
    public String receiveToken(String token, Long uid) throws TokenRecordException {
        if (uid == null || uid <= 0)
            throw new TokenRecordException(1, "用户未登录");
@@ -220,18 +252,34 @@
            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, "口令标识不存在");
        
        boolean receive = false;
        
        Long giveUid = rokenRecord.getUid();
        UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
        if (userInfoExtra == null)
            throw new TokenRecordException(1, "用户信息缺失");
        String msg = "领取成功";
        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, "该券不存在");
@@ -249,21 +297,62 @@
                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) {
                    LogHelper.errorDetailInfo(e);
                    throw new TokenRecordException(1, "领取失败");
                }
                
                // 领取成功
                receive = true;
                // 更新赠送券信息
                userSystemCouponService.updateGiveRecord(uid, couponId, CouponTypeEnum.freeCoupon.name());
                // 更新赠送记录
                giveRecord.setReceiveUid(uid);
                giveRecord.setReceiveTime(new Date());
                userSystemCouponGiveRecordService.updateByPrimaryKeySelective(giveRecord);
                msg = "领取成功[免单券]成功,请到[我的-福利中心]中查看";
                // 消息 + 队员
                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, "该券不存在");
@@ -281,13 +370,55 @@
                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);
                msg = "领取成功[返利奖励券]成功,请到[我的-福利中心]中查看";
                // 消息 + 队员
                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, "口令已失效");
            }
@@ -295,20 +426,91 @@
            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);
                    msg = "领取成功[推广红包]成功,请到[我的-推广红包]中查看";
                    // 消息 + 队员
                    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);
                        }
                    });
                } catch (UserTaoLiJinOriginException e) {
                    e.printStackTrace();
                }
            }
        } else {
            throw new TokenRecordException(1, "无对应类型");
        }
        if (receive)
            throw new TokenRecordException(1, "领取失败啦");
        UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
        return msg;
    }
    /**
     *     未激活邀请码: 上下级关系确立
     * @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/UserSystemCouponGiveRecordServiceImpl.java
@@ -1,5 +1,7 @@
package com.yeshi.fanli.service.impl.user;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
@@ -20,4 +22,18 @@
        userSystemCouponGiveRecordMapper.insertSelective(record);
    }
    
    @Override
    public UserSystemCouponGiveRecord getRecordByUidAndCouponId(Long giveUid, Long couponId) {
        return userSystemCouponGiveRecordMapper.getRecordByUidAndCouponId(giveUid, couponId);
    }
    @Override
    public void updateByPrimaryKeySelective(UserSystemCouponGiveRecord giveRecord) {
        userSystemCouponGiveRecordMapper.updateByPrimaryKeySelective(giveRecord);
    }
    @Override
    public List<UserSystemCouponGiveRecord> overdueList(int count) {
        return userSystemCouponGiveRecordMapper.overdueList(count);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java
@@ -198,8 +198,8 @@
        }
        SystemCoupon coupon = null;
        if (couponType.equals(CouponTypeEnum.welfareFreeCoupon.name())) {
            // 福利免单券
        if (couponType.equals(CouponTypeEnum.welfareFreeCoupon.name()) || couponType.equals(CouponTypeEnum.freeCoupon.name())) {
            // 免单券
            coupon = systemCouponService.getCouponByType(couponType);
        } else if (couponType.equals(CouponTypeEnum.rebatePercentCoupon.name())) {
            // 随机奖励券
@@ -219,6 +219,8 @@
            if (countSuccess == 0) {
                stateActivated = 0;
            }
        } else if (coupon.getType() == CouponTypeEnum.freeCoupon) {
            stateActivated = 0;
        }
        // 结束日期
@@ -1892,12 +1894,16 @@
                    long num = 10000 + (long) (Math.random() * 10000);
                    token = UserUtil.getInviteCode(num);
                    
                    String endDay = DateUtil.plusDay(Constant.TOKEN_DAYS - 1,nowDate);
                    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
                    Date endTime = format.parse(endDay);
                    TokenRecord tokenRecord = new TokenRecord();
                    tokenRecord.setUid(uid);
                    tokenRecord.setIdentify(id+"");
                    tokenRecord.setType(tokenTypeEnum);
                    tokenRecord.setStartTime(nowDate);
                    tokenRecord.setEndTime(DateUtil.plusDayDate(3, nowDate));
                    tokenRecord.setEndTime(endTime);
                    tokenRecord.setToken(token);
                    tokenRecord.setState(0);
                    tokenRecordService.insertSelective(tokenRecord);
@@ -1915,15 +1921,29 @@
                throw new UserSystemCouponException(1, "口令生成失败");
            
            // 插入赠送记录
            try {
                String endDay = DateUtil.plusDay(Constant.GIVE_DAYS - 1, new Date());
                SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
                Date endTime = format.parse(endDay);
            UserSystemCouponGiveRecord giveRecord = new UserSystemCouponGiveRecord();
            giveRecord.setCouponId(id);
            giveRecord.setGiveUid(uid);
            giveRecord.setGiveTime(nowDate);
                giveRecord.setEndTime(endTime);
            userSystemCouponGiveRecordService.insertSelective(giveRecord);
            } catch (Exception e) {
                LogHelper.errorDetailInfo(e);
                throw new UserSystemCouponException(1, "赠送记录创建失败");
            }
        }
        
        if(StringUtil.isNullOrEmpty(token))
            throw new UserSystemCouponException(1, "口令生成失败");
        userSystemCoupon.setState(UserSystemCoupon.STATE_IN_USE);
        userSystemCoupon.setGive(true);
        userSystemCouponMapper.updateByPrimaryKeySelective(userSystemCoupon);
        String tips = "送给你一张返利奖励券快去领取吧,复制本条消息[&%s&],打开[返利券]App领取,使用后可让返利加倍。\r\n" 
                +"----------------------------\r\n" 
@@ -1935,4 +1955,27 @@
        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);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/integral/IntegralExchangeRecordService.java
@@ -22,4 +22,11 @@
     * @return
     */
    public long countRecordByUid(long exchangeid, Long uid);
    /**
     * 添加兑换记录
     * @param exchangeid
     * @param uid
     */
    public void addExchangeRecord(long exchangeid, Long uid);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/UserOtherMsgNotificationService.java
@@ -2,6 +2,8 @@
import java.math.BigDecimal;
import com.yeshi.fanli.dto.msg.MsgOtherExchangeContentDTO;
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 +179,22 @@
     * @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);
    /**
     * 兑换消息
     * @param uid
     * @param beiZhu
     * @param content
     */
    public void exchangeMsg(Long uid, String beiZhu, MsgOtherExchangeContentDTO content);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/tlj/UserTaoLiJinGiveRecordService.java
@@ -1,5 +1,7 @@
package com.yeshi.fanli.service.inter.tlj;
import java.util.List;
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinGiveRecord;
public interface UserTaoLiJinGiveRecordService {
@@ -12,5 +14,13 @@
    public void updateByPrimaryKeySelective(UserTaoLiJinGiveRecord record);
    /**
     * 查询过期未领取的红包
     * @param count
     * @return
     */
    public List<UserTaoLiJinGiveRecord> overdueList(int count);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/tlj/UserTaoLiJinOriginService.java
@@ -140,4 +140,21 @@
     * @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;
    /**
     * 红包赠送退回
     * @param uid
     * @param money
     * @throws UserTaoLiJinOriginException
     */
    public void giveSendBack(Long uid, BigDecimal money) throws UserTaoLiJinOriginException;
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/TokenRecordService.java
@@ -32,6 +32,6 @@
     * @param uid
     * @throws TokenRecordException
     */
    public void receiveToken(String token, Long uid) throws TokenRecordException;
    public String receiveToken(String token, Long uid) throws TokenRecordException;
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserSystemCouponGiveRecordService.java
@@ -1,10 +1,36 @@
package com.yeshi.fanli.service.inter.user;
import java.util.List;
import com.yeshi.fanli.entity.bus.user.UserSystemCouponGiveRecord;
public interface UserSystemCouponGiveRecordService {
    public void insertSelective(UserSystemCouponGiveRecord record);
    /**
     * 更新领取记录
     * @param receiveUid
     * @param giveUid
     * @param couponId
     */
    public void updateByPrimaryKeySelective(UserSystemCouponGiveRecord giveRecord);
    /**
     * 查询赠送记录
     * @param giveUid
     * @param couponId
     * @return
     */
    public UserSystemCouponGiveRecord getRecordByUidAndCouponId(Long giveUid, Long couponId);
    /**
     * 未领取退回券
     * @param count
     * @return
     */
    public List<UserSystemCouponGiveRecord> overdueList(int count);
}
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/Constant.java
@@ -99,6 +99,11 @@
    public static final int TYPE_SHAER = 2;
    // 邀请
    public static final int TYPE_INVITE = 3;
    // 口令有效期-天
    public static final int TOKEN_DAYS = 1;
    // 赠送有效期-天
    public static final int GIVE_DAYS = 1;
    public static WXGZConfig wxGZConfig;
fanli/src/main/java/com/yeshi/fanli/util/factory/goods/GoodsDetailVOFactory.java
@@ -133,7 +133,12 @@
        goodsInfo.setGoodsType(goodsType);
        goodsInfo.setZkPrice(goods.getPrice());
        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) {
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/UserMsgVOFactory.java
@@ -7,15 +7,17 @@
import com.google.gson.Gson;
import com.yeshi.fanli.dto.msg.MsgOtherCouponContentDTO;
import com.yeshi.fanli.dto.msg.MsgOtherExchangeContentDTO;
import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO;
import com.yeshi.fanli.dto.msg.MsgOtherTaoLiJinContentDTO;
import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail;
import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail.MsgTypeAccountTypeEnum;
import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail;
import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail;
import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail;
import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail.MsgTypeOrderTypeEnum;
import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail;
import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail.MsgTypeAccountTypeEnum;
import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail.MsgTypeOtherTypeEnum;
import com.yeshi.fanli.entity.bus.user.BindingAccount;
import com.yeshi.fanli.entity.bus.user.Extract;
@@ -689,6 +691,96 @@
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
        } else if (msg.getType() == MsgTypeOtherTypeEnum.give) {
            if (StringUtil.isNullOrEmpty(msg.getContent()))
                return null;
            MsgOtherGiveContentDTO dto = new Gson().fromJson(msg.getContent(), MsgOtherGiveContentDTO.class);
            if (dto == null)
                return null;
            String type = dto.getType();
            if (type == null)
                return null;
            if (MsgOtherGiveContentDTO.TYEP_COUPON.equalsIgnoreCase(type)) {
                icon = "http://img.flqapp.com/resource/msg/icon_msg_other_coupon.png";
            } else {
                icon = "http://img.flqapp.com/resource/msg/icon_msg_other_tlj.png";
            }
            List<ClientTextStyleVO> contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(dto.getGiveType(), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("赠送类别", COLOR_TITLE), contentList));
            if (!StringUtil.isNullOrEmpty(dto.getReceiveInfo())) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getReceiveInfo() + "", COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("领取用户", COLOR_TITLE), contentList));
            }
            if (!StringUtil.isNullOrEmpty(dto.getGiveTime())) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getGiveTime() + "", COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("赠送时间", COLOR_TITLE), contentList));
            }
            if (!StringUtil.isNullOrEmpty(dto.getReceiveTime())) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getReceiveTime() + "", COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("领取时间", COLOR_TITLE), contentList));
            }
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            UserMsgVO userMsgVO = new UserMsgVO();
            userMsgVO.setIcon(icon);
            userMsgVO.setTitle(dto.getTitle());
            userMsgVO.setTime(msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime());
            userMsgVO.setContentItems(items);
            return userMsgVO;
        } else if (msg.getType() == MsgTypeOtherTypeEnum.exchange) {
            if (StringUtil.isNullOrEmpty(msg.getContent()))
                return null;
            MsgOtherExchangeContentDTO dto = new Gson().fromJson(msg.getContent(), MsgOtherExchangeContentDTO.class);
            if (dto == null)
                return null;
            icon = "http://img.flqapp.com/resource/msg/icon_msg_other_tlj.png";
            List<ClientTextStyleVO> contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(dto.getState(), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("状态", COLOR_TITLE), contentList));
            if (!StringUtil.isNullOrEmpty(dto.getExpend())) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getExpend() + "", COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("消耗", COLOR_TITLE), contentList));
            }
            if (!StringUtil.isNullOrEmpty(dto.getTotalGold())) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getTotalGold() + "", COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("金币总数", COLOR_TITLE), contentList));
            }
            if (!StringUtil.isNullOrEmpty(dto.getThing())) {
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(dto.getThing() + "", COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("兑换物品", COLOR_TITLE), contentList));
            }
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
        }
        return new UserMsgVO(icon, msg.getType().getDesc(),