| | |
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 该用户邀请进度
|
| | | * |
| | | * @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));
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 该用户邀请奖金榜
|
| | |
| | | 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));
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | |
| | | long countWinTopListByBossId(@Param("uid")Long uid); |
| | | |
| | | |
| | | /** |
| | | * 统计当前队员在活动中第几个好友 |
| | | * @param uid |
| | | * @param teamUid |
| | | * @return |
| | | */ |
| | | long countTeamNumByTid(@Param("uid")Long uid, @Param("teamUid")Long teamUid); |
| | | } |
| | |
| | | public class RedPackWinInvite {
|
| | | public enum RedPackWinInviteTypeEnum {
|
| | | newUserReward("首次使用板栗快省新人奖励"),
|
| | | zeroStageReward("邀请关系确定"), |
| | | oneStageReward("成功邀请好友立得现金"),
|
| | | twoStageReward("完成分享订单递增奖励"),
|
| | | threeStageReward("完成分享订单连续奖励");
|
| | |
| | | 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="countWinTopListByBossId" 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> |
| | | |
| | | |
| | |
| | | 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")
|
| | |
| | | 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)
|
| | |
| | |
|
| | | 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) {
|
| | |
| | | return redPackWinInviteMapper.countWinTopListByBossId(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countTeamNumByTid(Long uid, Long teamUid) {
|
| | | return redPackWinInviteMapper.countTeamNumByTid(uid, teamUid);
|
| | | }
|
| | | |
| | | }
|
| | |
| | | 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);
|
| | |
|
| | | }
|
| | |
| | | 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);
|