From 626d711cb15896055c13fe344eb7fcc824589715 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期四, 19 十二月 2019 15:38:42 +0800 Subject: [PATCH] 帮助中心 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RedPackControllerV2.java | 159 +++++++++++++++++++++++++++++++++++------------------ 1 files changed, 105 insertions(+), 54 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RedPackControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RedPackControllerV2.java index 8af1684..026a038 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RedPackControllerV2.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RedPackControllerV2.java @@ -26,9 +26,8 @@ import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import com.yeshi.fanli.entity.accept.AcceptData; -import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture; +import com.yeshi.fanli.entity.bus.user.ThreeSale; import com.yeshi.fanli.entity.bus.user.UserInfo; -import com.yeshi.fanli.entity.bus.user.UserInfoExtra; import com.yeshi.fanli.entity.redpack.RedPackDetail.RedPackDetailTypeEnum; import com.yeshi.fanli.entity.redpack.RedPackExchange; import com.yeshi.fanli.entity.redpack.RedPackWinInvite; @@ -41,17 +40,20 @@ import com.yeshi.fanli.service.inter.redpack.RedPackConfigService; import com.yeshi.fanli.service.inter.redpack.RedPackDetailService; import com.yeshi.fanli.service.inter.redpack.RedPackExchangeService; +import com.yeshi.fanli.service.inter.redpack.RedPackForbidService; import com.yeshi.fanli.service.inter.redpack.RedPackGiveRecordService; import com.yeshi.fanli.service.inter.redpack.RedPackWinInviteService; -import com.yeshi.fanli.service.inter.redpack.RedPackWinNewUserService; import com.yeshi.fanli.service.inter.user.UserInfoExtraService; import com.yeshi.fanli.service.inter.user.UserInfoService; +import com.yeshi.fanli.service.inter.user.UserSystemCouponService; +import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce; import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.TimeUtil; +import com.yeshi.fanli.util.UserInviteUtil; import com.yeshi.fanli.vo.redpack.RedPackDetailVO; -import com.yeshi.fanli.vo.redpack.RedPackWinDetailVO; import com.yeshi.fanli.vo.redpack.RedPackWinInviteVO; +import com.yeshi.fanli.vo.redpack.RedPackWinProgressVO; import net.sf.json.JSONObject; @@ -76,22 +78,29 @@ @Resource private RedPackWinInviteService redPackWinInviteService; - - @Resource - private RedPackWinNewUserService redPackWinNewUserService; @Resource private UserInfoService userInfoService; @Resource private UserInfoExtraService userInfoExtraService; - + @Resource private JumpDetailV2Service jumpDetailV2Service; - + @Resource private SwiperPictureService swiperPictureService; + @Resource + private UserSystemCouponService userSystemCouponService; + + @Resource + private RedPackForbidService redPackForbidService; + + @Resource + private ThreeSaleSerivce threeSaleSerivce; + + /** * 缁熻 * @@ -116,6 +125,7 @@ BigDecimal thisMonthUse = zero; BigDecimal lastMonthUse = zero; BigDecimal balance = redPackBalanceService.getBalance(uid); + ; if (balance == null) { balance = zero; } else { @@ -188,12 +198,9 @@ * * @param acceptData * @param uid - * @param index - * List鏈�鏈殑涓婚敭ID - * @param year - * 骞翠唤 - * @param month - * 鏈堜唤 + * @param index List鏈�鏈殑涓婚敭ID + * @param year 骞翠唤 + * @param month 鏈堜唤 * @param out */ @RequestMapping(value = "getMoneyDetails") @@ -376,67 +383,111 @@ @RequestMapping(value = "getBasicInfo") public void getBasicInfo(AcceptData acceptData, Long uid, String callback, PrintWriter out) { if (uid == null || uid <= 0) { - out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�")); + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�")); return; } + JSONObject data = new JSONObject(); data.put("balance", redPackBalanceService.getBalance(uid)); data.put("ruleLink", redPackConfigService.getValueByKey("invite_reward_rule_link")); - UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid); - if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) { - data.put("inviteCode", userInfoExtra.getInviteCode()); + data.put("shareLink", UserInviteUtil.getShareUrl(uid)); + data.put("redPackLock", redPackForbidService.verifyForbid(uid)); + + String inviteCode = userInfoExtraService.getInviteCodeByUid(uid); + if ( !StringUtil.isNullOrEmpty(inviteCode)) { + data.put("inviteCode", inviteCode); } else { data.put("inviteCode", ""); } + + // 璧犻�佸厤鍗曞埜 + long freeCouponCount = userSystemCouponService.countGiveFreeCoupon(uid); + // 濂栧姳鍒� + long rewardCouponCount = userSystemCouponService.countUsableRewardCoupon(uid); + + data.put("freeCouponCount", freeCouponCount); + data.put("rewardCouponCount", rewardCouponCount); if (!StringUtil.isNullOrEmpty(callback)) { out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); - } else + } else { out.print(JsonUtil.loadTrueResult(data)); + } + } + + + + /** + * 璇ョ敤鎴烽個璇峰閲戞 + * + * @param acceptData + * @param uid 涓嬬嚎UID + * @param out + */ + @RequestMapping(value = "getInviteReward") + public void getInviteReward(AcceptData acceptData,Integer page, Long uid, String callback, PrintWriter out) { + if (uid == null || uid <= 0) { + JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�")); + return; + } + + if (page == null || page < 1) + page = 1; + + List<RedPackWinProgressVO> listVO = new ArrayList<RedPackWinProgressVO>(); + List<RedPackWinInvite> list = redPackWinInviteService.getWinTopListByBossId(page, Constant.PAGE_SIZE, uid); + if (list != null) { + for (RedPackWinInvite win: list) { + ThreeSale threeSale = threeSaleSerivce.getNearRelationByBossIdAndWorkerId(uid, win.getTeamUid()); + if (threeSale == null) + continue; + + UserInfo userInfo = userInfoService.selectByPKey(win.getTeamUid()); + if (userInfo == null) + continue; + + RedPackWinProgressVO progressVO = new RedPackWinProgressVO(); + progressVO.setUid(userInfo.getId()); + progressVO.setName(userInfo.getNickName()); + progressVO.setPortrait(userInfo.getPortrait()); + progressVO.setMoney(win.getMoney().setScale(2).toString()); + progressVO.setTime("閭�璇凤細" + TimeUtil.formatDate(threeSale.getSucceedTime())); + listVO.add(progressVO); + } + } + + JSONObject data = new JSONObject(); + data.put("list", listVO); + data.put("count", redPackWinInviteService.countWinTopListByBossId(uid)); + if (!StringUtil.isNullOrEmpty(callback)) { + out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); + } else { + out.print(JsonUtil.loadTrueResult(data)); + } } /** - * 鏂颁汉绾㈠寘璇︽儏 + * 璇ョ敤鎴烽個璇疯繘搴� + * * @param acceptData - * @param uid + * @param tid 涓嬬嚎UID * @param out */ - @RequestMapping(value = "getWinDetail", method = RequestMethod.POST) - public void getWinDetail(AcceptData acceptData, Long uid, PrintWriter out) { - if (uid == null || uid <= 0) { - out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�")); + @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; } - try { - RedPackWinDetailVO winDetail = redPackWinNewUserService.receiveReward(uid); - if (winDetail == null) { - out.print(JsonUtil.loadFalseResult(1, "绾㈠寘宸茶鎶㈠厜")); - return; - } - winDetail.setLogo(Constant.systemCommonConfig.getDefaultPortrait()); - winDetail.setLogoLight(Constant.systemCommonConfig.getDefaultPortrait()); - - JSONObject params = new JSONObject(); - params.put("url", redPackConfigService.getValueByKey("goods_shop_link_h5")); - winDetail.setParams(params.toString()); - winDetail.setJumpDetail(jumpDetailV2Service.getByTypeCache("web", - Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion()))); - winDetail.setTips(redPackConfigService.getValueByKey("new_user_win_tips")); - - // 2銆侀《閮ㄨ疆鎾浘 - List<SwiperPicture> oldtopPicList = swiperPictureService.getByBannerCard("redpack_win_detail_banner"); - List<SwiperPicture> topPicList = new ArrayList<>(); - if (oldtopPicList != null && oldtopPicList.size() > 0) - topPicList.addAll(oldtopPicList); - - JSONObject data = new JSONObject(); - data.put("detail", JsonUtil.getApiCommonGson().toJson(winDetail)); - data.put("banner", JsonUtil.getApiCommonGson().toJson(topPicList)); - out.print(JsonUtil.loadTrueResult(data)); - } catch (Exception e) { - out.print(JsonUtil.loadFalseResult(1, "绾㈠寘宸茶鎶㈠厜鍟�")); + 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)); } } } -- Gitblit v1.8.0