admin
2019-12-18 84ab5704aee0df06d0352ab67d1fa671ac284c8b
Merge remote-tracking branch 'origin/div' into div
7个文件已修改
130 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RedPackControllerV2.java 48 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/redpack/RedPackWinInviteMapper.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/redpack/RedPackWinInvite.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/redpack/RedPackWinInviteMapper.xml 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackWinInviteServiceImpl.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/redpack/RedPackWinInviteService.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/redpack/RedPackMessageListener.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RedPackControllerV2.java
@@ -416,29 +416,6 @@
    }
    
    /**
     *  该用户邀请进度
     *
     * @param acceptData
     * @param tid  下线UID
     * @param out
     */
    @RequestMapping(value = "getInviteProgress")
    public void getInviteProgress(AcceptData acceptData, Long uid, Long tid, String callback, PrintWriter out) {
        if (uid == null || uid <= 0 || tid == null || tid <= 0) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "传递参数缺失"));
            return;
        }
        JSONObject data = new JSONObject();
        data.put("list", redPackWinInviteService.getInviteProgressByWorkerId(uid, tid));
        data.put("num", threeSaleSerivce.getTeamOrderNumByWorkerId(tid));
        if (!StringUtil.isNullOrEmpty(callback)) {
            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
        } else {
            out.print(JsonUtil.loadTrueResult(data));
        }
    }
    
    /**
     *  该用户邀请奖金榜
@@ -488,4 +465,29 @@
            out.print(JsonUtil.loadTrueResult(data));
        }
    }
    /**
     *  该用户邀请进度
     *
     * @param acceptData
     * @param tid  下线UID
     * @param out
     */
    @RequestMapping(value = "getInviteProgress")
    public void getInviteProgress(AcceptData acceptData, Long uid, Long tid, String callback, PrintWriter out) {
        if (uid == null || uid <= 0 || tid == null || tid <= 0) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "传递参数缺失"));
            return;
        }
        JSONObject data = new JSONObject();
        data.put("list", redPackWinInviteService.getInviteProgressByWorkerId(uid, tid));
        data.put("num", redPackWinInviteService.countTeamNumByTid(uid, tid));
        if (!StringUtil.isNullOrEmpty(callback)) {
            out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
        } else {
            out.print(JsonUtil.loadTrueResult(data));
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/redpack/RedPackWinInviteMapper.java
@@ -81,5 +81,11 @@
    
    long countWinTopListByBossId(@Param("uid")Long uid);
    
    /**
     * 统计当前队员在活动中第几个好友
     * @param uid
     * @param teamUid
     * @return
     */
    long countTeamNumByTid(@Param("uid")Long uid, @Param("teamUid")Long teamUid);
}
fanli/src/main/java/com/yeshi/fanli/entity/redpack/RedPackWinInvite.java
@@ -16,6 +16,7 @@
public class RedPackWinInvite {
    public enum RedPackWinInviteTypeEnum {
        newUserReward("首次使用板栗快省新人奖励"), 
        zeroStageReward("邀请关系确定"),
        oneStageReward("成功邀请好友立得现金"), 
        twoStageReward("完成分享订单递增奖励"), 
        threeStageReward("完成分享订单连续奖励");
fanli/src/main/java/com/yeshi/fanli/mapping/redpack/RedPackWinInviteMapper.xml
@@ -115,9 +115,16 @@
    LIMIT #{start},#{count}
  </select>
  
   <select id="countWinTopListByBossId" resultType="Long">
  <select id="countWinTopListByBossId" resultType="Long">
      SELECT IFNULL(COUNT(DISTINCT d.`rwr_team_uid`),0) FROM `yeshi_ec_red_pack_win_invite` d
    WHERE d.`rwr_uid` = 2662782 AND d.`rwr_type` <![CDATA[<>]]> 'newUserReward'
    WHERE d.`rwr_uid` = #{uid} AND d.`rwr_type` <![CDATA[<>]]> 'newUserReward'
  </select>
  <select id="countTeamNumByTid" resultType="Long">
    SELECT COUNT(dd.`rwr_id`) FROM yeshi_ec_red_pack_win_invite dd
    WHERE dd.`rwr_uid` = #{uid} AND dd.`rwr_type` = 'zeroStageReward'
        AND dd.`rwr_id` <![CDATA[<=]]> (SELECT d.`rwr_id` FROM `yeshi_ec_red_pack_win_invite` d
        WHERE d.`rwr_uid` = #{uid}  AND d.rwr_team_uid = #{teamUid}  AND d.`rwr_type` = 'zeroStageReward')
  </select>
  
  
fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackWinInviteServiceImpl.java
@@ -93,6 +93,38 @@
    public BigDecimal getRewardMoney(Long uid) {
        return redPackWinInviteMapper.getRewardMoney(uid);
    }
    @Override
    @RequestSerializableByKeyService(key = "#teamUid")
    @Transactional(rollbackFor = Exception.class)
    public void initCreateRedPackWin(Long bossId, Long teamUid) {
        UserActiveLog activeLog = userActiveLogService.getUserLatestActiveInfo(bossId);
        if (activeLog == null)
            return;
        // 小于2.0.5版本不增加
        if (!VersionUtil.greaterThan_2_1("appstore".equalsIgnoreCase(activeLog.getChannel()) ? "ios" : "android",
                activeLog.getVersionCode()))
            return;
        // 同一队员只记录一次
        int totalReward = redPackWinInviteMapper.countByUidAndTeamUidAndType(bossId, teamUid,
                RedPackWinInviteTypeEnum.oneStageReward.name());
        if (totalReward > 0)
            return;
        // 获得红包
        RedPackWinInvite winInvite = new RedPackWinInvite();
        winInvite.setUid(bossId);
        winInvite.setTeamUid(teamUid);
        winInvite.setMoney(new BigDecimal(0));
        winInvite.setType(RedPackWinInviteTypeEnum.zeroStageReward);
        winInvite.setIdentifyCode(StringUtil.Md5(RedPackWinInviteTypeEnum.oneStageReward.name() + ":" + teamUid));
        winInvite.setCreateTime(new Date());
        winInvite.setUpdateTime(new Date());
        redPackWinInviteMapper.insertSelective(winInvite);
    }
    @Override
    @RequestSerializableByKeyService(key = "#teamUid")
@@ -346,9 +378,6 @@
        if (userInfo == null) 
            return listVO;
        
        listVO.add(new RedPackWinProgressVO("成功注册", TimeUtil.formatDate(userInfo.getCreatetime())));
        listVO.add(new RedPackWinProgressVO("确立邀请", TimeUtil.formatDate(threeSale.getSucceedTime())));
        // 奖励记录
        List<RedPackWinInvite> listWin = redPackWinInviteMapper.getWinListByBossIdAndTeamUid(uid, tid);
        if (listWin == null || listWin.size() == 0) 
@@ -356,6 +385,10 @@
        
        int month = 1;
        for (RedPackWinInvite win: listWin) {
            if (win.getType() == RedPackWinInviteTypeEnum.zeroStageReward) {
                listVO.add(new RedPackWinProgressVO("成功注册", TimeUtil.formatDate(userInfo.getCreatetime())));
                listVO.add(new RedPackWinProgressVO("确立邀请", TimeUtil.formatDate(threeSale.getSucceedTime())));
            }
            String time = TimeUtil.formatDate(win.getCreateTime());
            BigDecimal money = win.getMoney().setScale(2);
            if (win.getType() == RedPackWinInviteTypeEnum.oneStageReward) {
@@ -389,4 +422,9 @@
        return redPackWinInviteMapper.countWinTopListByBossId(uid);
    }
    
    @Override
    public long countTeamNumByTid(Long uid, Long teamUid) {
        return redPackWinInviteMapper.countTeamNumByTid(uid, teamUid);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/redpack/RedPackWinInviteService.java
@@ -64,5 +64,20 @@
    public List<RedPackWinInvite> getWinTopListByBossId(int page, int count, Long uid);
    public long countWinTopListByBossId(Long uid);
    /**
     * 初始化红包一阶段
     * @param bossId
     * @param teamUid
     */
    public void initCreateRedPackWin(Long bossId, Long teamUid);
    /**
     * 第几个活动好友
     * @param uid
     * @param teamUid
     * @return
     */
    public long countTeamNumByTid(Long uid, Long teamUid);
    
}
fanli/src/main/java/com/yeshi/fanli/util/rocketmq/consumer/redpack/RedPackMessageListener.java
@@ -121,6 +121,9 @@
                        UserInviteMQMsg.class);
                inviteSucceedReward = true;
                uid = userInviteMQMsg.getWorkerId();
                redPackWinInviteService.initCreateRedPackWin(userInviteMQMsg.getBossId(),userInviteMQMsg.getWorkerId());
            } else if (tag.equalsIgnoreCase(UserTopicTagEnum.redPackGiftDrawback.name())) {// 红包赠送
                UserRedPackGiftMQMsg userRedPackGiftMQMsg = new Gson().fromJson(new String(message.getBody()),
                        UserRedPackGiftMQMsg.class);