| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | |
|
| | | UserInfo userInfo = userInfoService.selectByPKey(uid);
|
| | | if (userInfo == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "该用户不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | // 省钱 -自购产生返利
|
| | |
|
| | | List<Integer> list = new ArrayList<Integer>();
|
| | | list.add(BanLiShopOrder.STATE_SUCCESS);
|
| | | BigDecimal payMoney = new BigDecimal(userVipConfigService.getValueByKey("require_order_pay"));
|
| | |
|
| | | BigDecimal finishGoldCoin = integralDetailService.getCumulativeMoney(uid);
|
| | |
|
| | | // long finishTeam = hongBaoV2CountService.countValidOrderTeamUserByUid(uid,
|
| | | // TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney);
|
| | | // |
| | | long finishTeam = 0L;
|
| | | long vipBegin = TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME);
|
| | | List<ThreeSale> listThreeSale = threeSaleSerivce.getValidWorkerIdsByTime(uid, vipBegin);
|
| | | if (listThreeSale != null && listThreeSale.size() > 0) {
|
| | | for (ThreeSale three: listThreeSale) {
|
| | | UserInfo worker = three.getWorker();
|
| | | if (worker == null || worker.getId() == null) {
|
| | | continue;
|
| | | }
|
| | | // 1、邀请关系成功后;2、单(分享 + 自购)实付款大于1元
|
| | | long countValid = hongBaoV2CountService.countValidOrderByUidAndTime(worker.getId(), three.getSucceedTime(), payMoney);
|
| | | if (countValid > 0) {
|
| | | finishTeam ++;
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | long finishHongBao = banLiShopOrderService.countByUidAndState(uid, list);
|
| | | BigDecimal finishMoney = hongBaoV2CountService.getRewardMoneyBySelf(uid);
|
| | |
|
| | | long limitTeam = 0;
|
| | |
|
| | | // 区分老用户和新用户
|
| | | String limtDate = userVipConfigService.getValueByKey("vip_execute_time");
|
| | | Date executeDate = null;
|
| | | try {
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-mm-dd");
|
| | | executeDate = format.parse(limtDate);
|
| | | } catch (ParseException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (extra != null
|
| | | && (extra.getFirstLoginTime() == null || extra.getFirstLoginTime().getTime() < executeDate.getTime())) {
|
| | | limitTeam = (Long.parseLong(userVipConfigService.getValueByKey("require_invite_num_old_user")));
|
| | | } else {
|
| | | limitTeam = (Long.parseLong(userVipConfigService.getValueByKey("require_invite_num_new_user")));
|
| | | }
|
| | | long limitHongBao = (Long.parseLong(userVipConfigService.getValueByKey("require_shop_buy")));
|
| | | BigDecimal limitMoney = (new BigDecimal(userVipConfigService.getValueByKey("require_fan_money")));
|
| | | BigDecimal limitgoldCoin = (new BigDecimal(userVipConfigService.getValueByKey("require_gold_coin")));
|
| | |
|
| | | if (finishGoldCoin.compareTo(limitgoldCoin) >= 0 && finishTeam >= limitTeam && finishHongBao >= limitHongBao
|
| | | && finishMoney.compareTo(limitMoney) >= 0) {// 条件符合
|
| | | ;
|
| | | } else {
|
| | | if (!StringUtil.isNullOrEmpty(callback)) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("未达到开通条件")));
|
| | | } else {
|
| | | out.print(JsonUtil.loadFalseResult("未达到开通条件"));
|
| | | }
|
| | | return;
|
| | | }
|
| | | // 开通
|
| | | try {
|
| | | userVIPInfoService.applyVIP(uid);
|
| | | } catch (UserVIPInfoException e) {
|
| | |
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(callback)) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("")));
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("申请成功,正在受理中")));
|
| | | } else {
|
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | | out.print(JsonUtil.loadTrueResult("申请成功,正在受理中"));
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | long limitShare = 0;
|
| | | long limitFirst = 0;
|
| | | long limitSecond = 0;
|
| | | String school = "板栗学院";
|
| | | String platformSubsidy = "补贴返佣 ";
|
| | | String teamSubsidy = "会员专属";
|
| | | String teamReward = "超级会员专属";
|
| | | if (level == UserInviteLevelEnum.actived || level == UserInviteLevelEnum.noActive) {
|
| | | // TODO 比例
|
| | | school += "达人班";
|
| | | platformSubsidy += "<label style=\"color:#E5005C;\">52.5%</label>";
|
| | | |
| | | |
| | | String zigou = userVipConfigService.getValueByKey("vip_pre_3_zigou_order_count");
|
| | | if (!StringUtil.isNullOrEmpty(zigou)) {
|
| | | limitZiGou = Long.parseLong(zigou);
|
| | |
| | | limitSecond = Long.parseLong(second);
|
| | | }
|
| | | } else if (level == UserInviteLevelEnum.vipPre1) {
|
| | | |
| | | // TODO 比例
|
| | | school += "普通班";
|
| | | platformSubsidy += "<label style=\"color:#E5005C;\">60%</label>";
|
| | | teamSubsidy = "会员专属最高<label style=\"color:#E5005C;\">7.5%</label>";
|
| | | |
| | | |
| | | String zigou = userVipConfigService.getValueByKey("vip_pre_7_zigou_order_count");
|
| | | if (!StringUtil.isNullOrEmpty(zigou)) {
|
| | | limitZiGou = Long.parseLong(zigou);
|
| | |
| | | limitSecond = Long.parseLong(second);
|
| | | }
|
| | | } else if (level == UserInviteLevelEnum.vipPre2 || level == UserInviteLevelEnum.vipApply) {
|
| | | school += "高级班";
|
| | | platformSubsidy += "<label style=\"color:#E5005C;\">70%</label>";
|
| | | teamSubsidy = "会员专属最高<label style=\"color:#E5005C;\">15%</label>";
|
| | | |
| | | String zigou = userVipConfigService.getValueByKey("vip_pre_10_zigou_order_count");
|
| | | if (!StringUtil.isNullOrEmpty(zigou)) {
|
| | | limitZiGou = Long.parseLong(zigou);
|
| | |
| | | }
|
| | | } else if (level == UserInviteLevelEnum.vip || level == UserInviteLevelEnum.tearcherApply) {
|
| | | // TODO 比例
|
| | | school += "超级班";
|
| | | platformSubsidy += "<label style=\"color:#E5005C;\">115%</label>";
|
| | | teamSubsidy = "会员专属最高<label style=\"color:#E5005C;\">22.5%</label>";
|
| | | teamReward = "超级会员专属最高<label style=\"color:#E5005C;\">40%</label>";
|
| | |
|
| | | } else if (level == UserInviteLevelEnum.tearcher) {
|
| | | // TODO
|
| | | }
|
| | |
|
| | | // 邀请订单
|
| | | // 自购订单
|
| | | long doneZiGou = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
|
| | | HongBaoV2.TYPE_ZIGOU);
|
| | | // 邀请订单
|
| | | // 分享订单
|
| | | long doneShare = hongBaoV2CountService.counOrderByUidAndOrderType(uid, Constant.VIP_ORDER_PAY,
|
| | | HongBaoV2.TYPE_SHARE_GOODS);
|
| | |
|
| | |
| | | typeList.add(UserMoneyDetailTypeEnum.systemEqualize);
|
| | | typeList.add(UserMoneyDetailTypeEnum.subsidy);
|
| | | BigDecimal earnMoney = userMoneyDetailService.statisticUserTypeMoneyWithDate(uid, typeList, start, now).abs();
|
| | | |
| | | if (level != UserInviteLevelEnum.vip) {
|
| | | BigDecimal rate = new BigDecimal("0.409");
|
| | | saveMoney = MoneyBigDecimalUtil.mul2(saveMoney, rate);
|
| | | earnMoney = MoneyBigDecimalUtil.mul2(earnMoney, rate);
|
| | | }
|
| | | |
| | | String shareRate = "可享佣金的<label style=\"color:#E5005C;\">%s</label>";
|
| | | String fansRate = "最高佣金的<label style=\"color:#E5005C;\">%s</label>";
|
| | | String fansIndirect = "最高佣金的<label style=\"color:#E5005C;\">%s</label>";
|
| | | String teamBonus = "团队分红池<label style=\"color:#E5005C;\">%s</label>";
|
| | | // 达人版
|
| | | JSONObject jsonrRed1 = new JSONObject();
|
| | | jsonrRed1.put("shareRate", String.format(shareRate, "152%"));
|
| | | jsonrRed1.put("fansRate", String.format(fansRate, "22.5%"));
|
| | | jsonrRed1.put("fansIndirect", String.format(fansIndirect, "5%"));
|
| | | jsonrRed1.put("teamBonus", "高级会员以上专属");
|
| | | |
| | | JSONObject jsonrRed2 = new JSONObject();
|
| | | jsonrRed2.put("shareRate", String.format(shareRate, "162.5%"));
|
| | | jsonrRed2.put("fansRate", String.format(fansRate, "27.5%"));
|
| | | jsonrRed2.put("fansIndirect", String.format(fansIndirect, "7.5%"));
|
| | | jsonrRed2.put("teamBonus", "高级会员以上专属");
|
| | |
|
| | | JSONObject jsonrRed3 = new JSONObject();
|
| | | jsonrRed3.put("shareRate", String.format(shareRate, "170%"));
|
| | | jsonrRed3.put("fansRate", String.format(fansRate, "32.5%"));
|
| | | jsonrRed3.put("fansIndirect", String.format(fansIndirect, "10%"));
|
| | | jsonrRed3.put("teamBonus", String.format(teamBonus, "40%"));
|
| | |
|
| | | JSONObject jsonrRed4 = new JSONObject();
|
| | | jsonrRed4.put("shareRate", String.format(shareRate, "225%"));
|
| | | jsonrRed4.put("fansRate", String.format(fansRate, "37.5%"));
|
| | | jsonrRed4.put("fansIndirect", String.format(fansIndirect, "12.5%"));
|
| | | jsonrRed4.put("teamBonus", String.format(teamBonus, "80%"));
|
| | |
|
| | |
|
| | | JSONObject json = new JSONObject();
|
| | |
| | | json.put("nickName", userInfo.getNickName());
|
| | | json.put("portrait", userInfo.getPortrait());
|
| | | json.put("ruleLink", userVipConfigService.getValueByKey("help_link_vip_h5"));
|
| | | json.put("tearcherTip", "导师按钮:弹框内容");
|
| | | json.put("saveMoney", saveMoney);
|
| | | json.put("earnMoney", earnMoney);
|
| | | |
| | | json.put("tearcherTip", "我是你的导师,为你在省赚过程中解难答疑,对你一对一辅导,倾听你的需求总结并反馈给板栗快省官方运营团队,快来添加我吧。");
|
| | | json.put("tearcherWX", userVipConfigService.getValueByKey("tearcher_weixin_num"));
|
| | | json.put("newerGongLue", configService.get(ConfigKeyEnum.newerGonglue.getKey()));
|
| | |
|
| | | // 已完成
|
| | | json.put("doneZiGou", doneZiGou);
|
| | |
| | | json.put("limitFirst", limitFirst);
|
| | | json.put("limitSecond", limitSecond);
|
| | |
|
| | | // 文字内容
|
| | | json.put("platformSubsidy", platformSubsidy);
|
| | | json.put("school", school);
|
| | | json.put("teamSubsidy", teamSubsidy);
|
| | | json.put("teamReward", teamReward);
|
| | |
|
| | | // 已完成
|
| | | json.put("master", jsonrRed1);
|
| | | json.put("vip1", jsonrRed2);
|
| | | json.put("vip2", jsonrRed3);
|
| | | json.put("vip3", jsonrRed4);
|
| | | |
| | | // 人工客服链接
|
| | | json.put("csdLink", configService.get(ConfigKeyEnum.customerServiceLink.getKey()));
|
| | |
|