| | |
| | | }
|
| | | // 1.6.5 之后返回 微信号提示
|
| | | if (VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion()))
|
| | | userInfo.setWeiXinTip("添加微信号后,你的邀请人和一级队员可以通过微信与你建立联系。");
|
| | | userInfo.setWeiXinTip("添加微信号后,你的邀请人和直接粉丝可以通过微信与你建立联系。");
|
| | |
|
| | | // 查询是否为VIP
|
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("nickName", userInfo.getNickName());
|
| | | data.put("portrait", userInfo.getPortrait());
|
| | | data.put("tips", "确认要成为TA的一级队员吗?邀请关系一旦建立不可更改。");
|
| | | data.put("tips", "确认要成为TA的直接粉丝吗?邀请关系一旦建立不可更改。");
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (UserInfoExtraException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("nickName", userInfo.getNickName());
|
| | | data.put("portrait", userInfo.getPortrait());
|
| | | data.put("tips", "确认要成为TA的一级队员吗?邀请关系一旦建立不可更改。");
|
| | | data.put("tips", "确认要成为TA的直接粉丝吗?邀请关系一旦建立不可更改。");
|
| | | data.put("key", activeWX);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (UserInfoExtraException e) {
|
| | |
| | | @RequestMapping(value = "getMyTeam", method = RequestMethod.POST)
|
| | | public void getMyTeam(AcceptData acceptData, long page, long uid, int type, PrintWriter out) {
|
| | | if (type != 1 && type != 2) {
|
| | | out.print(JsonUtil.loadFalseResult("队员类型不正确"));
|
| | | out.print(JsonUtil.loadFalseResult("粉丝类型不正确"));
|
| | | return;
|
| | | }
|
| | |
|
| | |
| | | if (!hasCode) {
|
| | | List<String> tipCode = new ArrayList<String>();
|
| | | resultData.put("helpLinkActivate", configService.get("team_help_url"));
|
| | | tipCode.add("激活邀请功能后才可以邀请队员,一级队员是由你直接邀请,二级队员是由你的一级队员邀请。");
|
| | | tipCode.add("激活邀请功能后才可以邀请粉丝,直接粉丝是由你直接邀请,间接粉丝是由你的直接粉丝邀请。");
|
| | | tipCode.add("邀请激活功能,必须要有邀请码,邀请码可以通过金币兑换,也可以全网搜索。");
|
| | | resultData.put("tipCode", tipCode);
|
| | | }
|
| | |
| | | // 未添加微信号
|
| | | List<String> tipWeiXin = new ArrayList<String>();
|
| | | if (!bdWeiXin) {
|
| | | tipWeiXin.add("添加微信号后,你的邀请人和一级队员可通过微信号与你建立联系;");
|
| | | tipWeiXin.add("你也可以向邀请人学习或向一级队员教授赚钱技巧。");
|
| | | tipWeiXin.add("添加微信号后,你的邀请人和直接粉丝可通过微信号与你建立联系;");
|
| | | tipWeiXin.add("你也可以向邀请人学习或向直接粉丝教授赚钱技巧。");
|
| | | }
|
| | | resultData.put("tipWeiXin", tipWeiXin);
|
| | | resultData.put("tipWeiXinAdd", "添加微信号后,你的邀请人和一级队员可以通过微信与你建立联系。");
|
| | | resultData.put("tipWeiXinAdd", "添加微信号后,你的邀请人和直接粉丝可以通过微信与你建立联系。");
|
| | | resultData.put("bdWeiXin", bdWeiXin);
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(resultData));
|
| | |
| | |
|
| | | Long bossId = null;
|
| | | Long workerId = null;
|
| | | String title = "队员提醒消息";
|
| | | String title = "粉丝提醒消息";
|
| | | String content = "";
|
| | | if (remindBoss) {
|
| | | // 提示队长
|
| | | bossId = remindId;
|
| | | workerId = uid;
|
| | | content = "你的一级队员" + userInfo.getNickName()
|
| | | content = "你的直接粉丝" + userInfo.getNickName()
|
| | | + ",提醒你添加微信号,以便于和你取得联系和学习省钱技巧,赶快去添加吧;注:请升级到本软件最新版本在“我的-我的信息”中添加。";
|
| | | } else {
|
| | | // 提示队员
|
| | |
| | | orderTaoBao("淘宝订单"),
|
| | | coollect("收藏"),
|
| | | scanHistory("足迹"),
|
| | | team("队员"),
|
| | | team("粉丝"),
|
| | | kefu("联系客服"),
|
| | | taoBaoShoppingCart("淘宝购物车"),
|
| | | orderFind("订单申诉"),
|
| | |
| | | give("赠送"),
|
| | | exchange("金币兑换"),
|
| | | couponActivate("免单券激活"),
|
| | | firstOrderReward("队员首单奖励邀请人金币"),
|
| | | firstOrderReward("粉丝首单奖励邀请人金币"),
|
| | | systemGive("系统赠送"),
|
| | | passVIPApply("超级会员"),
|
| | | rejectVIPApply("超级会员"),
|
| | |
| | | public class UserTaoLiJinOrigin {
|
| | |
|
| | | public enum TaoLiJinOriginEnum {
|
| | | newbiesWin("新人红包"), shareWin("推广红包福利"), rankWin("账户等级福利"), inviteWin("邀请队员奖励"), |
| | | newbiesWin("新人红包"), shareWin("推广红包福利"), rankWin("账户等级福利"), inviteWin("邀请粉丝奖励"), |
| | | refund("未领取退回"), exchange("金币兑换"), friendsGive("好友赠送"), giveSendBack("赠送退回");
|
| | |
|
| | | private final String desc;
|
| | |
| | | giveFreeCoupon("赠送免单券"),
|
| | | giveTaoLiJin("赠送推广红包"),
|
| | | inShop("浏览店铺"),
|
| | | inShopLevelOne("一级队员浏览店铺"),
|
| | | inShopLevelTwo("二级队员浏览店铺"),
|
| | | inShopLevelOne("直接粉丝浏览店铺"),
|
| | | inShopLevelTwo("简介粉丝浏览店铺"),
|
| | | scanPush("浏览推荐记录"),
|
| | | scanGoods("浏览商品详情页"),
|
| | | scanSearchResult("浏览搜索结果页"),
|
| | |
| | | couponRebateLevelOne("浏览购物车页"),
|
| | | couponRebateLevelTwo("浏览购物车页"),
|
| | | rebateOrder("完成返利订单"),
|
| | | inviteOrderLevelOne("一级队员邀请订单"),
|
| | | inviteOrderLevelTwo("二级队员邀请订单"),
|
| | | inviteOrderLevelOne("直接粉丝邀请订单"),
|
| | | inviteOrderLevelTwo("间接粉丝邀请订单"),
|
| | | shareOrder("分享订单"),
|
| | | bindWeiXin("微信授权"),
|
| | | bindPhone("绑定手机"),
|
| | |
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | public enum UniqueKeyEnum {
|
| | | dailySign("每日签到"), smartSearch("智能搜索"), buyReduce("自购立减"), inviteTeam("邀请队员"), shareReward("分享奖励"), |
| | | dailySign("每日签到"), smartSearch("智能搜索"), buyReduce("自购立减"), inviteTeam("邀请粉丝"), shareReward("分享奖励"), |
| | | giveReward("赠送奖励"), scanReward("浏览奖励") , orderReward("订单奖励"), accountMaintain("账号维护");
|
| | | private final String desc;
|
| | |
|
| | |
| | | coupon.getSource(), coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponWelfareMianDan, "至少成功邀请1个队员后可激活"));
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponWelfareMianDan, "至少成功邀请1个粉丝后可激活"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | if (coupon == null || coupon.getUid() == null)
|
| | | return;
|
| | | MsgOtherCouponContentDTO dto = MsgOtherCouponContentDTOFactory.createWelfareCouponActive(getLeftDay(coupon),
|
| | | "成功邀请队员:" + worker.getNickName(), coupon.getStartTime(), coupon.getEndTime());
|
| | | "成功邀请粉丝:" + worker.getNickName(), coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponWelfareMianDan, "可在首页-免单商品-选择商品-使用"));
|
| | |
| | | .createWelfareCouponWillOutOfDate(getLeftDay(coupon), coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponWelfareMianDan, "至少成功邀请1个队员后可激活"));
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponWelfareMianDan, "至少成功邀请1个粉丝后可激活"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | .createWelfareCouponWillOutOfDate(getLeftDay(coupon), coupon.getStartTime(), coupon.getEndTime());
|
| | | try {
|
| | | msgOtherDetailService.addMsgOtherDetail(MsgOtherDetailFactory.createCouponMsg(coupon.getUid(),
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponMianDan, "至少成功邀请1个队员后可激活"));
|
| | | coupon.getId(), dto, MsgTypeOtherTypeEnum.couponMianDan, "至少成功邀请1个粉丝后可激活"));
|
| | | } catch (MsgOtherDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | public void orderShareFirstLevelStatistic(Long uid, String orderId, int orderType, BigDecimal payMoney,
|
| | | BigDecimal money, int goodsCount, int orderState, String sourceUserName) {
|
| | | MsgOrderDetail detail = MsgOrderDetailFactory.createInviteOrder(uid, orderId, orderType, goodsCount, orderState,
|
| | | payMoney, money, String.format("由一级队员【%s】分享", getShortName(sourceUserName)));
|
| | | payMoney, money, String.format("由一级粉丝【%s】分享", getShortName(sourceUserName)));
|
| | | try {
|
| | | msgOrderDetailService.addMsgOrderDetail(detail,
|
| | | (money == null || money.compareTo(new BigDecimal(0)) <= 0) ? false : true);
|
| | |
| | | dto.setNickName(userInfo.getNickName());
|
| | | dto.setPortrait(userInfo.getPortrait());
|
| | | userMoneyMsgNotificationService.teamRedPackRewardMsg(bossId, MsgTypeMoneyTypeEnum.redPackOneStageReward, money,
|
| | | "队员(好友)完成第一阶段", new Gson().toJson(dto));
|
| | | "粉丝(好友)完成第一阶段", new Gson().toJson(dto));
|
| | | }
|
| | |
|
| | | @RequestSerializableByKeyService(key = "#uid")
|
| | |
| | | dto.setNickName(userInfo.getNickName());
|
| | | dto.setPortrait(userInfo.getPortrait());
|
| | | userMoneyMsgNotificationService.teamRedPackRewardMsg(bossId, MsgTypeMoneyTypeEnum.redPackTwoStageReward, money,
|
| | | "队员(好友)完成第二阶段", new Gson().toJson(dto));
|
| | | "粉丝(好友)完成第二阶段", new Gson().toJson(dto));
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | dto.setNickName(userInfo.getNickName());
|
| | | dto.setPortrait(userInfo.getPortrait());
|
| | | userMoneyMsgNotificationService.teamRedPackRewardMsg(bossId, MsgTypeMoneyTypeEnum.redPackThreeStageReward,
|
| | | money, "队员(好友)完成第三阶段连续[第" + monthSpace + "个月]", new Gson().toJson(dto));
|
| | | money, "粉丝(好友)完成第三阶段连续[第" + monthSpace + "个月]", new Gson().toJson(dto));
|
| | | }
|
| | |
|
| | |
|
| | |
| | | state = true;
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra == null || StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
|
| | | tips.add("确认领取后,你将成为赠送人的一级队员;");
|
| | | tips.add("确认领取后,你将成为赠送人的直接粉丝;");
|
| | | tips.add("获赠的免单券,需要激活后才能使用,详情参见免单券激活规则;");
|
| | | tips.add("成功领取后,请到“我的-福利中心”查看。");
|
| | | } else {
|
| | |
| | | state = true;
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra == null || StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
|
| | | tips.add("确认领取后,你将成为赠送人的一级队员;");
|
| | | tips.add("确认领取后,你将成为赠送人的直接粉丝;");
|
| | | tips.add("板栗快省奖励券,可用于“已到账”的返利订单,在返利的基础上再获得一定比例的返利;");
|
| | | tips.add("成功领取后,请到“我的-福利中心”中查看。");
|
| | | } else {
|
| | |
| | | state = true;
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra == null || StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
|
| | | tips.add("确认领取后,你将成为赠送人的一级队员;");
|
| | | tips.add("确认领取后,你将成为赠送人的直接粉丝;");
|
| | | tips.add("红包可提现,可购买折扣商品;");
|
| | | tips.add("成功领取后,请到“我的-红包”中查看。");
|
| | | } else {
|
| | |
| | | boolean addTeam = addInviteTeam(uid, giveUid, userInfoExtra);
|
| | | String beiZhu = "无";
|
| | | if (addTeam)
|
| | | beiZhu = "领取人已经成为你的一级队员";
|
| | | beiZhu = "领取人已经成为你的直接粉丝";
|
| | |
|
| | | String userName = "无";
|
| | | UserInfo user = userInfoService.selectByPKey(uid);
|
| | |
| | | boolean addTeam = addInviteTeam(uid, giveUid, userInfoExtra);
|
| | | String beiZhu = "无";
|
| | | if (addTeam)
|
| | | beiZhu = "领取人已经成为你的一级队员";
|
| | | beiZhu = "领取人已经成为你的直接粉丝";
|
| | |
|
| | | String userName = "无";
|
| | | UserInfo user = userInfoService.selectByPKey(uid);
|
| | |
| | | String beiZhu = "无";
|
| | | String giveBeiZhu = "无";
|
| | | if (addTeam) {
|
| | | beiZhu = "你已成为赠送人的一级队员";
|
| | | giveBeiZhu = "领取人已成为你的一级队员";
|
| | | beiZhu = "你已成为赠送人的直接粉丝";
|
| | | giveBeiZhu = "领取人已成为你的直接粉丝";
|
| | | // 激活邀请信息
|
| | | addInviteMsg(uid, giveUid, giveRecord.getAmount().setScale(2) + "元红包");
|
| | | }
|
| | |
| | | if (ExchangeTypeEnum.freeCouponBuy == type) {
|
| | | exchangeTip.setTip("自购免单券仅能自己使用,且每个用户ID只能兑换一次。\r\n注:兑换成功后请到“我的-福利中心”中查看");
|
| | | } else if (ExchangeTypeEnum.freeCouponGive == type) {
|
| | | exchangeTip.setTip("赠送免单券兑换次数不限,赠送次数不限,受赠人若无“邀请人”成功领取后将成为你的一级队员。\r\n注:兑换成功后请到“我的-福利中心”中查看");
|
| | | exchangeTip.setTip("赠送免单券兑换次数不限,赠送次数不限,受赠人若无“邀请人”成功领取后将成为你的直接粉丝。\r\n注:兑换成功后请到“我的-福利中心”中查看");
|
| | | } else if (ExchangeTypeEnum.rebatePercentCoupon == type) {
|
| | | exchangeTip.setTip("返利奖励券兑换次数不限,赠送次数不限,受赠人若无“邀请人”成功领取后将成为你的一级队员。\r\n注:兑换成功后请到“我的-福利中心”中查看");
|
| | | exchangeTip.setTip("返利奖励券兑换次数不限,赠送次数不限,受赠人若无“邀请人”成功领取后将成为你的直接粉丝。\r\n注:兑换成功后请到“我的-福利中心”中查看");
|
| | | } else if (ExchangeTypeEnum.inviteCodePublish == type) {
|
| | | if (codePublishRecordService.countValidRecord(uid) > 0)
|
| | | throw new IntegralExchangeException(1, "三天之内不可重复兑换");
|
| | |
| | | return totalGoldCoin + (userInfoExtra.getGoldCoin() == null ? 0 : userInfoExtra.getGoldCoin());
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public boolean addDetail(Long uid, IntegralTaskRecord record) throws IntegralTaskRecordException {
|
| | | Long uid2 = record.getUid();
|
| | | if (uid2 == null || uid.longValue() != uid2.longValue())
|
| | |
| | | return integralTaskRecordMapper.countGetCountByTaskIdAndDay(taskId, uid, minTime, maxTime);
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public IntegralTaskRecord addRecord(IntegralTaskRecord record) throws IntegralTaskRecordException {
|
| | | if (record == null)
|
| | |
| | | long count = integralTaskRecordMapper.getTotalGoldCoinByUid(record.getUid());
|
| | | if (count >= 200) {// 大于200发送消息
|
| | | IntegralTaskMQMsg msg = new IntegralTaskMQMsg(record.getUid(), count, new Date());
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.integralTaskFinish,
|
| | | msg);
|
| | | Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.integralTaskFinish, msg);
|
| | | producer.send(message);
|
| | | }
|
| | |
|
| | |
| | | msgOther.setSource("首笔分享订单,系统奖励金币 ");
|
| | | msgOther.setExplain("首笔分享订单得到的奖金不足0.01元时奖励 ");
|
| | | } else {
|
| | | msgOther.setSource(level + "级队员首次下单,系统奖励金币 ");
|
| | | msgOther.setExplain("仅新邀请队员首下单你得到的奖金不足0.01元时奖励 ");
|
| | | if (level.equalsIgnoreCase("一") || level.equalsIgnoreCase("1"))
|
| | | msgOther.setSource("直接粉丝首次下单,系统奖励金币 ");
|
| | | else
|
| | | msgOther.setSource("间接粉丝首次下单,系统奖励金币 ");
|
| | | msgOther.setExplain("仅新邀请粉丝首下单你得到的奖金不足0.01元时奖励 ");
|
| | | }
|
| | | userOtherMsgNotificationService.firstOrderRewardMsg(uid, null, msgOther);
|
| | | }
|
| | |
| | | update.setId(oldDetail.getId());
|
| | | if (!detail.getInviteUser().getState()) {
|
| | | if (detail.getInviteUser().getExpire() == ThreeSale.EXPIRE_NORMAL) {
|
| | | update.setDesc("恭喜你,有新队员加入你的队列,若对方60天内未激活将会与你脱离邀请关系");
|
| | | update.setDesc("恭喜你,有新粉丝加入你的队列,若对方60天内未激活将会与你脱离邀请关系");
|
| | | } else {
|
| | | update.setDesc("抱歉,该队员因60天内未激活,已脱离了你的队列,可以试着重新邀请");
|
| | | update.setDesc("抱歉,该粉丝因60天内未激活,已脱离了你的队列,可以试着重新邀请");
|
| | | }
|
| | | } else {
|
| | | update.setDesc("恭喜你,成功邀请一个队员");
|
| | | update.setDesc("恭喜你,成功邀请一个粉丝");
|
| | | }
|
| | | update.setUpdateTime(new Date());
|
| | | update.setRead(false);
|
| | |
| | | public static final int AUTO_EXTRACT_MIN_SURPLUS = 2;
|
| | |
|
| | | // vip、红包、奖励券倒计时 2.1上线时间
|
| | | public static final String VIP_ONLINE_TIME = "2019-12-20";
|
| | | public static final String VIP_ONLINE_TIME = "2019-12-22";
|
| | |
|
| | | // 红包邀请奖励
|
| | | public static final String RED_PACK_ONLINE_TIME = "2019-12-14";
|
| | |
| | | else
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setDesc("恭喜你,成功邀请一个队员");
|
| | | detail.setDesc("恭喜你,成功邀请一个粉丝");
|
| | | detail.setInviteUser(threeSale);
|
| | | detail.setMsgType(MsgTypeInviteTypeEnum.invite);
|
| | | detail.setRead(false);
|
| | |
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setInviteUser(threeSale);
|
| | | detail.setMsgType(MsgTypeInviteTypeEnum.inviteSucceed);
|
| | | detail.setDesc("队员(好友)熟练使用App可获得红包");
|
| | | detail.setDesc("粉丝(好友)熟练使用App可获得红包");
|
| | | detail.setBeiZhu("满足获得红包条件后系统将自动下发到“我的-红包”中");
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setUpdateTime(new Date());
|
| | |
| | | else
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setDesc("恭喜你,有新队员加入你的队列,若对方60天内未激活将会与你脱离邀请关系");
|
| | | detail.setDesc("恭喜你,有新粉丝加入你的队列,若对方60天内未激活将会与你脱离邀请关系");
|
| | | detail.setInviteUser(threeSale);
|
| | | detail.setMsgType(MsgTypeInviteTypeEnum.invite);
|
| | | detail.setRead(false);
|
| | |
| | | else
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setDesc("抱歉,该队员因60天内未激活,已脱离了你的队列,可以试着重新邀请");
|
| | | detail.setDesc("抱歉,该粉丝因60天内未激活,已脱离了你的队列,可以试着重新邀请");
|
| | | detail.setInviteUser(threeSale);
|
| | | detail.setMsgType(MsgTypeInviteTypeEnum.invite);
|
| | | detail.setRead(false);
|
| | |
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("被邀请人", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("邀请队员成功", COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("邀请粉丝成功", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("邀请状态", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | |
| | | import java.io.InputStreamReader;
|
| | | import java.io.UnsupportedEncodingException;
|
| | | import java.math.BigDecimal;
|
| | | import java.net.URLDecoder;
|
| | | import java.net.URLEncoder;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Collections;
|
| | | import java.util.Comparator;
|
| | | import java.util.HashMap;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | |
| | | import org.jsoup.select.Elements;
|
| | | import org.yeshi.utils.BigDecimalUtil;
|
| | | import org.yeshi.utils.HttpUtil;
|
| | | import org.yeshi.utils.NumberUtil;
|
| | |
|
| | | import com.yeshi.fanli.dto.GoodsClassDTO;
|
| | | import com.yeshi.fanli.dto.jd.JDCommissionInfo;
|
| | |
| | | import com.yeshi.fanli.dto.jd.JDSearchResult;
|
| | | import com.yeshi.fanli.dto.jd.JDShopInfo;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 通过链接id
|
| | | * |
| | | * @param url
|
| | | * @return
|
| | | */
|
| | | public static String getJDGoodsIdByWeiXin(String url) {
|
| | | if (StringUtil.isNullOrEmpty(url)) |
| | | if (StringUtil.isNullOrEmpty(url))
|
| | | return null;
|
| | | |
| | |
|
| | | try {
|
| | | String id = null;
|
| | | int indexOf = url.indexOf("?");
|
| | | url = url.substring(indexOf + 1, url.length()-1);
|
| | | url = url.substring(indexOf + 1, url.length() - 1);
|
| | | String[] temp = url.split("&");
|
| | | for (int i =0; i < temp.length; i ++) {
|
| | | String content = temp[i];
|
| | | for (int i = 0; i < temp.length; i++) {
|
| | | String content = temp[i];
|
| | | if (content.startsWith("sku")) {
|
| | | id = content.split("=")[content.split("=").length-1];
|
| | | id = content.split("=")[content.split("=").length - 1];
|
| | | break;
|
| | | } |
| | | }
|
| | | }
|
| | | return id;
|
| | | } catch (Exception e) {
|
| | |
| | | }
|
| | | return null;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 根据 u.jd短连接获取真实的商品id
|
| | | * |
| | | * @param url
|
| | | * @return
|
| | | */
|
| | | public static String getJDGoodsIdByUJD(String url) {
|
| | | try {
|
| | | String body = HttpUtil.get(url);
|
| | | String body = HttpUtil.get(url);
|
| | | Document doc = Jsoup.parse(body);
|
| | | Elements els = doc.getElementsByTag("script");
|
| | | for (int i = 0; i < els.size(); i++) {
|
| | |
| | | if (content.indexOf("var hrl") > -1) {
|
| | | ScriptEngineManager manager = new ScriptEngineManager();
|
| | | ScriptEngine engine = manager.getEngineByName("javascript");
|
| | | |
| | |
|
| | | int indexOf = content.indexOf("var hrl");
|
| | | content = content.substring(indexOf, content.length());
|
| | | |
| | |
|
| | | int indexOf2 = content.indexOf(";");
|
| | | content = content.substring(0, indexOf2+1);
|
| | | |
| | | content = content.substring(0, indexOf2 + 1);
|
| | |
|
| | | String js = "function getData(){return JSON.stringify(hrl);}" + content;
|
| | | |
| | |
|
| | | engine.eval(js);
|
| | | if (engine instanceof Invocable) {
|
| | | Invocable in = (Invocable) engine;
|
| | | String data = in.invokeFunction("getData").toString();
|
| | | String link = data.substring(1, data.length()-1);
|
| | | |
| | | String link = data.substring(1, data.length() - 1);
|
| | | // 将链接中未encode的参数encode
|
| | | String param = link.split("\\?")[1];
|
| | | String host = link.split("\\?")[0];
|
| | | String[] params = param.split("&");
|
| | | String paramStr = "";
|
| | | for (String p : params) {
|
| | | String value = p.substring(p.indexOf("=") + 1);
|
| | | String key = p.substring(0, p.indexOf("="));
|
| | | if (URLDecoder.decode(value, "UTF-8").equalsIgnoreCase(value)) {
|
| | | value = URLEncoder.encode(value, "UTF-8");
|
| | | }
|
| | | paramStr += key + "=" + value + "&";
|
| | | }
|
| | | link = host + "?" + paramStr;
|
| | | String realLink = HttpUtil.getLocation(link);
|
| | | realLink = realLink.substring(realLink.indexOf("sku=") + 4, realLink.length());
|
| | | return realLink.substring(0, realLink.indexOf("&"));
|
| | | Map<String, String> paramsMap = new HashMap<>();
|
| | |
|
| | | param = realLink.split("\\?")[1];
|
| | | params = param.split("&");
|
| | | for (String p : params) {
|
| | | String value = p.substring(p.indexOf("=") + 1);
|
| | | String key = p.substring(0, p.indexOf("="));
|
| | | paramsMap.put(key, value);
|
| | | }
|
| | | if (!StringUtil.isNullOrEmpty(paramsMap.get("sku"))) {
|
| | | return paramsMap.get("sku");
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(paramsMap.get("wareId"))) {
|
| | | return paramsMap.get("wareId");
|
| | | }
|
| | |
|
| | | // 判断纯数字大于4位的返回
|
| | | for (Iterator<String> its = paramsMap.keySet().iterator(); its.hasNext();) {
|
| | | String key = its.next();
|
| | | String value = paramsMap.get(key);
|
| | | if (NumberUtil.isNumeric(value) && value.length() >= 4) {
|
| | | return value;
|
| | | }
|
| | | }
|
| | | LogHelper.error("京东短接解析失败:" + url);
|
| | | return null;
|
| | | }
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e, "京东短链获取商品ID失败:", url);
|
| | | }
|
| | | return null;
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 查询天猫商品图片、标题
|
| | | *
|
| | |
| | | }
|
| | | return getShowCouponInfo(goods.getCouponInfoList(), price);
|
| | | }
|
| | | |
| | | |
| | | |
| | | |
| | |
|
| | | }
|