| | |
| | | import com.google.gson.JsonPrimitive;
|
| | | import com.google.gson.JsonSerializationContext;
|
| | | import com.google.gson.JsonSerializer;
|
| | | import com.yeshi.fanli.dto.user.UserInviteLevelEnum;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.user.SMSHistory;
|
| | | 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.bus.user.UserInviteValidNum;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.TearcherInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum;
|
| | | import com.yeshi.fanli.entity.push.DeviceActive;
|
| | |
| | | import com.yeshi.fanli.service.inter.homemodule.HomeNavbarUserService;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyDetailService;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyService;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.LostOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceActiveService;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralDetailService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.UserInviteValidNumService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.TearcherService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | | @Resource
|
| | | private UserMoneyDetailService userMoneyDetailService;
|
| | |
|
| | | @Resource
|
| | | private UserInviteService userInviteService;
|
| | | |
| | | @Resource
|
| | | private UserInviteValidNumService userInviteValidNumService;
|
| | | |
| | | @Resource
|
| | | private CommonOrderService commonOrderService;
|
| | | |
| | | @Resource
|
| | | private TearcherService tearcherService;
|
| | | |
| | | |
| | | /**
|
| | | * 新版登录 V1.5.3
|
| | | *
|
| | |
| | | } else {
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("userInfo", UserUtil.filterForClientUser(userInfo));
|
| | | data.put("inviteCode", userInfoExtraService.getInviteCodeByUid(userInfo.getId()));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
|
| | | final UserInfo uuser = userInfo;
|
| | |
| | | }
|
| | | vo.setFinishMoney(hongBaoV2CountService.getRewardMoneyBySelf(uid));
|
| | |
|
| | | |
| | | List<Integer> list = new ArrayList<Integer>();
|
| | | list.add(BanLiShopOrder.STATE_SUCCESS);
|
| | | BigDecimal payMoney = new BigDecimal(userVipConfigService.getValueByKey("require_order_pay"));
|
| | |
|
| | | vo.setFinishGoldCoin(Long.parseLong(integralDetailService.getCumulativeMoney(uid).setScale(0).toString()));
|
| | | vo.setFinishTeam(hongBaoV2CountService.countValidOrderTeamUserByUid(uid, TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney));
|
| | | |
| | | // vo.setFinishTeam(hongBaoV2CountService.countValidOrderTeamUserByUid(uid,
|
| | | // , payMoney));
|
| | | |
| | | int finishTeam = 0;
|
| | | 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 = commonOrderService.countOrderByUidAndSettled(worker.getId(), payMoney);
|
| | | if (countValid > 0) {
|
| | | finishTeam ++;
|
| | | }
|
| | | }
|
| | | }
|
| | | vo.setFinishTeam(finishTeam);
|
| | | vo.setFinishHongBao(banLiShopOrderService.countByUidAndState(uid, list));
|
| | |
|
| | | |
| | | // 区分老用户和新用户
|
| | | String limtDate = userVipConfigService.getValueByKey("vip_execute_time");
|
| | | Date executeDate = null;
|
| | |
| | | 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 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("申请成功,正在受理中"));
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 获取vip信息
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getVIPInfoV2")
|
| | | public void getVIPInfoV2(String callback, AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | if (uid == null || uid <= 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | |
|
| | | // 用户信息
|
| | | UserInfo userInfo = userInfoService.selectByPKey(uid);
|
| | | if (userInfo == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "该用户不存在"));
|
| | | return;
|
| | | }
|
| | | // 获取等级
|
| | | UserInviteLevelEnum level = userInviteService.getUserInviteLevelNew(uid);
|
| | | |
| | | // 达人
|
| | | long limitOrder = 0;
|
| | | long limitFirst = 0;
|
| | | long limitSecond = 0;
|
| | | if (level == UserInviteLevelEnum.actived || level == UserInviteLevelEnum.noActive) {
|
| | | String orderCount = userVipConfigService.getValueByKey("vip_pre_7_order_count");
|
| | | if (!StringUtil.isNullOrEmpty(orderCount)) {
|
| | | limitOrder = Long.parseLong(orderCount);
|
| | | }
|
| | | String first = userVipConfigService.getValueByKey("vip_pre_7_first_level_team_count");
|
| | | if (!StringUtil.isNullOrEmpty(first)) {
|
| | | limitFirst = Long.parseLong(first);
|
| | | }
|
| | | String second = userVipConfigService.getValueByKey("vip_pre_7_second_level_team_count");
|
| | | if (!StringUtil.isNullOrEmpty(second)) {
|
| | | limitSecond = Long.parseLong(second);
|
| | | }
|
| | | } else if (level == UserInviteLevelEnum.highVIP || level == UserInviteLevelEnum.vipApply) {
|
| | | String orderCount = userVipConfigService.getValueByKey("vip_pre_10_order_count");
|
| | | if (!StringUtil.isNullOrEmpty(orderCount)) {
|
| | | limitOrder = Long.parseLong(orderCount);
|
| | | }
|
| | | String first = userVipConfigService.getValueByKey("vip_pre_10_first_level_team_count");
|
| | | if (!StringUtil.isNullOrEmpty(first)) {
|
| | | limitFirst = Long.parseLong(first);
|
| | | }
|
| | | String second = userVipConfigService.getValueByKey("vip_pre_10_second_level_team_count");
|
| | | if (!StringUtil.isNullOrEmpty(second)) {
|
| | | limitSecond = Long.parseLong(second);
|
| | | }
|
| | | } else if (level == UserInviteLevelEnum.vip || level == UserInviteLevelEnum.tearcherApply) {
|
| | | // TODO 比例
|
| | | |
| | | } else if (level == UserInviteLevelEnum.tearcher) {
|
| | | // TODO
|
| | | }
|
| | | |
| | | // 自购订单
|
| | | long doneOrder = hongBaoV2CountService.countMyDirectOrderByCashArrival(uid, Constant.VIP_ORDER_PAY);
|
| | | // 有效粉丝
|
| | | int doneFirst = 0;
|
| | | int doneSecond = 0;
|
| | | UserInviteValidNum userInviteValidNum = userInviteValidNumService.selectByPrimaryKey(uid);
|
| | | if (userInviteValidNum != null) {
|
| | | doneFirst = userInviteValidNum.getNumFirst() == null ? 0 : userInviteValidNum.getNumFirst();
|
| | | doneSecond = userInviteValidNum.getNumSecond() == null ? 0 : userInviteValidNum.getNumSecond();
|
| | | }
|
| | | |
| | | Date now = new Date();
|
| | | Date start = new Date(0);
|
| | | // 省钱: ---返利订单、奖励券提成
|
| | | List<UserMoneyDetailTypeEnum> typeFanli = new ArrayList<>();
|
| | | typeFanli.add(UserMoneyDetailTypeEnum.fanli);
|
| | | typeFanli.add(UserMoneyDetailTypeEnum.orderReward);
|
| | | BigDecimal saveMoney = userMoneyDetailService.statisticUserTypeMoneyWithDate(uid, typeFanli, start, now).abs();
|
| | | |
| | | // 赚钱: 邀请订单、分享订单、补贴
|
| | | List<UserMoneyDetailTypeEnum> typeList = new ArrayList<>();
|
| | | typeList.add(UserMoneyDetailTypeEnum.share);
|
| | | typeList.add(UserMoneyDetailTypeEnum.invite);
|
| | | typeList.add(UserMoneyDetailTypeEnum.inviteAndShare);
|
| | | 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 teamRate = "最高佣金的<label style=\"color:#E5005C;\">%s</label>";
|
| | | // 达人版
|
| | | JSONObject jsonrRed1 = new JSONObject();
|
| | | jsonrRed1.put("enjoyRate", String.format(shareRate, "145%"));
|
| | | jsonrRed1.put("teamRate", String.format(teamRate, "25%"));
|
| | | jsonrRed1.put("teamIncome", "高级会员以上专属");
|
| | | |
| | | // 高级会员
|
| | | JSONObject jsonrRed2 = new JSONObject();
|
| | | jsonrRed2.put("enjoyRate", String.format(shareRate, "195%"));
|
| | | jsonrRed2.put("teamRate", String.format(teamRate, "50%"));
|
| | | jsonrRed2.put("teamIncome", "享高级团队收益");
|
| | | |
| | | // 超级会员
|
| | | JSONObject jsonrRed3 = new JSONObject();
|
| | | jsonrRed3.put("enjoyRate", String.format(shareRate, "210%"));
|
| | | jsonrRed3.put("teamRate", String.format(teamRate, "110%"));
|
| | | jsonrRed3.put("teamIncome", "享超级团队收益");
|
| | | |
| | | |
| | | JSONObject json = new JSONObject();
|
| | | json.put("level", level.name());
|
| | | json.put("nickName", userInfo.getNickName());
|
| | | json.put("portrait", userInfo.getPortrait());
|
| | | json.put("ruleLink", userVipConfigService.getValueByKey("help_link_vip_h5"));
|
| | | json.put("saveMoney", saveMoney);
|
| | | json.put("earnMoney", earnMoney);
|
| | | |
| | | String tearcherWX = "";
|
| | | TearcherInfo tearcherInfo = tearcherService.selectByUid(uid);
|
| | | if (tearcherInfo != null && !StringUtil.isNullOrEmpty(tearcherInfo.getWxID())) {
|
| | | tearcherWX = tearcherInfo.getWxID();
|
| | | }
|
| | | json.put("tearcherWX", tearcherWX);
|
| | | json.put("tearcherTip", "我是你的导师,为你在省赚过程中解难答疑,对你一对一辅导,倾听你的需求总结并反馈给板栗快省官方运营团队,快来添加我吧。");
|
| | | json.put("newerGongLue", configService.get(ConfigKeyEnum.newerGonglue.getKey()));
|
| | | |
| | | // 已完成
|
| | | json.put("doneOrder", doneOrder);
|
| | | json.put("doneFirst", doneFirst);
|
| | | json.put("doneSecond", doneSecond);
|
| | | |
| | | // 标准
|
| | | json.put("limitOrder", limitOrder);
|
| | | json.put("limitFirst", limitFirst);
|
| | | json.put("limitSecond", limitSecond);
|
| | | |
| | | // 已完成
|
| | | json.put("daRen", jsonrRed1);
|
| | | json.put("highVIP", jsonrRed2);
|
| | | json.put("superVIP", jsonrRed3);
|
| | | |
| | | // 人工客服链接
|
| | | json.put("csdLink", configService.get(ConfigKeyEnum.customerServiceLink.getKey()));
|
| | | |
| | | UserVIPInfo userVIPInfo = userVIPInfoService.selectByUid(uid);
|
| | | String leftTime = "";
|
| | | if (userVIPInfo != null && userVIPInfo.getState() == UserVIPInfo.STATE_VERIFING && userVIPInfo.getApplyTime() != null) {
|
| | | long s = 48 * 60 * 60 - ((System.currentTimeMillis() - userVIPInfo.getApplyTime().getTime()) / 1000);
|
| | | if (s > 3600) {
|
| | | leftTime = s / 3600 + "小时";
|
| | | leftTime = "还剩" + leftTime;
|
| | | } else if (s >= 60) {
|
| | | leftTime = s / 60 + "分钟";
|
| | | leftTime = "还剩" + leftTime;
|
| | | } else if (s > 0) {
|
| | | leftTime = s + "秒";
|
| | | leftTime = "还剩" + leftTime;
|
| | | } else {
|
| | | leftTime = "还剩0秒";
|
| | | }
|
| | | }
|
| | | json.put("leftTime", leftTime);
|
| | | if (!StringUtil.isNullOrEmpty(callback)) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(json)));
|
| | | } else {
|
| | | out.print(JsonUtil.loadTrueResult(json));
|
| | | }
|
| | | }
|
| | |
|