| | |
| | | import com.google.gson.GsonBuilder; |
| | | import com.yeshi.fanli.dto.ConfigParamsDTO; |
| | | import com.yeshi.fanli.dto.jd.JDCouponInfo; |
| | | import com.yeshi.fanli.dto.jd.JDPingouInfo; |
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail; |
| | | import com.yeshi.fanli.dto.share.ShareGoodsRecordDTO; |
| | | import com.yeshi.fanli.entity.accept.AcceptData; |
| | |
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo; |
| | | import com.yeshi.fanli.entity.bus.user.UserInfo; |
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra; |
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum; |
| | | import com.yeshi.fanli.entity.goods.CommonGoods; |
| | | import com.yeshi.fanli.entity.goods.ShareGoodsTextTemplate; |
| | | import com.yeshi.fanli.entity.jd.JDGoods; |
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum; |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; |
| | |
| | | import com.yeshi.fanli.service.inter.goods.ShareGoodsTextTemplateService; |
| | | import com.yeshi.fanli.service.inter.monitor.BusinessEmergent110Service; |
| | | import com.yeshi.fanli.service.inter.monitor.MonitorService; |
| | | import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService; |
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService; |
| | | import com.yeshi.fanli.service.inter.tlj.ConfigTaoLiJinService; |
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinRecordService; |
| | |
| | | |
| | | @Resource |
| | | private HongBaoManageService hongBaoManageService; |
| | | |
| | | @Resource |
| | | private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService; |
| | | |
| | | @Resource |
| | | private MonitorService monitorService; |
| | |
| | | "下载链接:" + Constant.YINGYONGBAO_LINK, false, true)); |
| | | |
| | | list.add(new ShareGoodsCommentChoiceInfo(ShareGoodsCommentChoiceInfo.TYPE_FANLI_MONEY, "返利金额", |
| | | "返利金额:¥ " + fanliMoney, false, true)); |
| | | String.format("【联系我下载APP】最高可返还%s元", fanliMoney + ""), false, true)); |
| | | |
| | | return list; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | public static String getERCodeContent(String template, TaoBaoGoodsBrief goods, String token) { |
| | | return template.replace("[淘口令]", token); |
| | | } |
| | | |
| | | |
| | | public static String getERCodeContentNew(String template, TaoBaoGoodsBrief goods, String token) { |
| | | String commentText = template.replace("[原价]", goods.getZkPrice().toString()); |
| | | commentText = commentText.replace("[口令]", token); |
| | | commentText = commentText.replace("[淘口令]", token); |
| | | if (StringUtil.isNullOrEmpty(goods.getCouponInfo())) { |
| | | commentText = commentText.replace("领券抢购", "抢购"); |
| | | commentText = commentText.replace("【券后价】[券后价]元", ""); |
| | | } else { |
| | | commentText = commentText.replace("[券后价]", TaoBaoUtil.getAfterUseCouplePrice(goods) + ""); |
| | | } |
| | | |
| | | commentText =commentText.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n"); |
| | | |
| | | commentText = commentText.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n"); |
| | | return commentText; |
| | | } |
| | | |
| | | |
| | | // 淘宝分享活动 |
| | | public static String getTaoBaoActiivtyERCodeContentNew(String template, String token) { |
| | | String commentText = template.replace("[淘口令]", token); |
| | | commentText = commentText.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n"); |
| | | return commentText; |
| | | } |
| | | |
| | | /** |
| | | * 创建淘宝分享信息 |
| | | * |
| | |
| | | TaoBaoLink taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(uid, goodsId, relationId); |
| | | |
| | | if (taoBaoLink != null && taoBaoLink.getGoods() != null && needGoods) { |
| | | ConfigParamsDTO dto = hongBaoManageService.getShowComputeRate(platform, version); |
| | | ConfigParamsDTO dto = orderHongBaoMoneyComputeService.getShowComputeRate(platform, version); |
| | | GoodsDetailVO goodsInfo = GoodsDetailVOFactory.convertTaoBao(taoBaoLink.getGoods(), dto); |
| | | shareInfo.setGoodsInfo(goodsInfo); |
| | | } |
| | |
| | | shareInfo.setCommentTexts(commentTexts); |
| | | |
| | | TaoBaoGoodsBrief goods = taoBaoLink.getGoods(); |
| | | |
| | | |
| | | boolean coupon = false; |
| | | if (!StringUtil.isNullOrEmpty(taoBaoLink.getGoods().getCouponInfo())) { |
| | | coupon = true; |
| | | } |
| | | |
| | | |
| | | String template = shareGoodsTextTemplateService.getTextTemplateByTB(uid); |
| | | String shareText = shareGoodsTextTemplateService.createContentTB(template, goods, taoBaoLink.getTaoToken(), coupon); |
| | | String shareText = shareGoodsTextTemplateService.createContentTB(template, goods, taoBaoLink.getTaoToken(), |
| | | coupon); |
| | | shareInfo.setShareText(shareText); |
| | | |
| | | |
| | | String descText = shareText.replace(taoBaoLink.getGoods().getTitle(), "").trim(); |
| | | if (descText.startsWith("\\r\\n")) { |
| | | descText = descText.substring(0); |
| | | } |
| | | shareInfo.setDescText(deleteBlankLine(descText)); |
| | | |
| | | |
| | | // 测试 |
| | | // 2.0.2之前 |
| | | if (VersionUtil.greaterThan_2_0_7(platform, version)) { |
| | | shareInfo.setClickUrl(getERCodeContentNew(configService.get(ConfigKeyEnum.quickShareTBCommentText.getKey()), |
| | | taoBaoLink.getGoods(), shareInfo.getToken())); |
| | | shareInfo.setClickUrl( |
| | | getERCodeContentNew(configService.get(ConfigKeyEnum.quickShareTBCommentText.getKey()), |
| | | taoBaoLink.getGoods(), shareInfo.getToken())); |
| | | } else if (!VersionUtil.greaterThan_2_0_2(platform, version)) { |
| | | shareInfo.setClickUrl(getERCodeContent(configService.get(ConfigKeyEnum.taobaoShareQrcodeText.getKey()), |
| | | taoBaoLink.getGoods(), shareInfo.getToken())); |
| | | shareInfo.setClickUrl( |
| | | getERCodeContentNew(configService.get(ConfigKeyEnum.taobaoShareQrcodeText.getKey()), |
| | | taoBaoLink.getGoods(), shareInfo.getToken())); |
| | | } |
| | | |
| | | if (VersionUtil.greaterThan_2_0_7(platform, version)) { |
| | | shareInfo.setWxErCode(getERCodeContentNew(configService.get(ConfigKeyEnum.quickShareTBCommentText.getKey()), |
| | | // if (VersionUtil.greaterThan_2_0_7(platform, version)) { |
| | | // shareInfo.setWxErCode( |
| | | // getERCodeContentNew(configService.get(ConfigKeyEnum.quickShareTBCommentText.getKey()), |
| | | // taoBaoLink.getGoods(), shareInfo.getToken())); |
| | | // } else { |
| | | shareInfo.setWxErCode(getERCodeContentNew(configService.get(ConfigKeyEnum.taobaoShareQrcodeText.getKey()), |
| | | taoBaoLink.getGoods(), shareInfo.getToken())); |
| | | } else { |
| | | shareInfo.setWxErCode(getERCodeContent(configService.get(ConfigKeyEnum.taobaoShareQrcodeText.getKey()), |
| | | taoBaoLink.getGoods(), shareInfo.getToken())); |
| | | } |
| | | |
| | | |
| | | // } |
| | | |
| | | // 提示图文内容 |
| | | String imgs = configService.getByVersion(ConfigKeyEnum.goodsShareNotifyImgs.getKey(), platform, |
| | | Integer.parseInt(version)); |
| | |
| | | e1.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | String commentText = ""; |
| | | String recommendText = ""; |
| | | if (VersionUtil.greaterThan_2_0_7(platform, version)) { |
| | |
| | | if (!coupon) { |
| | | recommendText = recommendText.replace("推荐理由:[推荐语]", ""); |
| | | } else { |
| | | recommendText = recommendText.replace("[推荐语]", goods.getDescription()); |
| | | if (!StringUtil.isNullOrEmpty(goods.getDescription())) { |
| | | recommendText = recommendText.replace("[推荐语]", goods.getDescription()); |
| | | } else { |
| | | recommendText = recommendText.replace("推荐理由:[推荐语]", ""); |
| | | } |
| | | } |
| | | |
| | | |
| | | String sales = TaoBaoUtil.getSaleCount(taoBaoLink.getGoods().getBiz30day()); |
| | | if (sales.equals("0")) { |
| | | recommendText = recommendText.replace("销量:[销量]", ""); |
| | |
| | | |
| | | String quickCommentText = configService.get(ConfigKeyEnum.quickShareTBCommentText.getKey()); |
| | | commentText = quickCommentText.replace("[原价]", goods.getZkPrice().toString()); |
| | | commentText = commentText.replace("[口令]", TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken())); |
| | | commentText = commentText.replace("[淘口令]", TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken())); |
| | | if (StringUtil.isNullOrEmpty(taoBaoLink.getGoods().getCouponInfo())) { |
| | | commentText = commentText.replace("领券抢购", "抢购"); |
| | | commentText = commentText.replace("【券后价】[券后价]元", ""); |
| | |
| | | commentText = commentText.replace("[券后价]", |
| | | TaoBaoUtil.getAfterUseCouplePrice(taoBaoLink.getGoods()) + ""); |
| | | } |
| | | |
| | | |
| | | |
| | | if (StringUtil.isNullOrEmpty(taoBaoLink.getGoods().getCouponInfo())) { |
| | | recommendText = recommendText.replace("优惠券:[券面额]元", ""); |
| | | } else { |
| | |
| | | shareInfo.setRecommendText(deleteBlankLine(recommendText)); |
| | | |
| | | // 设置评论文本选项 |
| | | shareInfo.setCommentTextChoiceList(getCommentChoiceList(shareInfo.getCommentText(), null, inviteCode, |
| | | TaoBaoUtil.getGoodsHongBaoMoney(taoBaoLink.getGoods(), hongBaoManageService.getFanLiRate()))); |
| | | shareInfo.setCommentTextChoiceList( |
| | | getCommentChoiceList(shareInfo.getCommentText(), null, inviteCode, TaoBaoUtil.getGoodsHongBaoMoney( |
| | | taoBaoLink.getGoods(), hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP)))); |
| | | |
| | | out.print(JsonUtil.loadTrueResult( |
| | | JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create().toJson(shareInfo))); |
| | |
| | | shareInfo.setCommentTexts(new ArrayList<>()); |
| | | |
| | | if (needGoods) |
| | | shareInfo.setGoodsInfo(GoodsDetailVOFactory.convertJDGoods(jdGoods, |
| | | hongBaoManageService.getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion()))); |
| | | shareInfo.setGoodsInfo(GoodsDetailVOFactory.convertJDGoods(jdGoods, orderHongBaoMoneyComputeService |
| | | .getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion()))); |
| | | |
| | | boolean hasCoupon = false; |
| | | if (couponInfo != null) { |
| | | hasCoupon = true; |
| | | } |
| | | |
| | | |
| | | String template = shareGoodsTextTemplateService.getTextTemplateByJD(uid); |
| | | String shareText = shareGoodsTextTemplateService.createContentJD(template, jdGoods, jumpLink, hasCoupon); |
| | | shareInfo.setShareText(shareText); |
| | |
| | | if (VersionUtil.greaterThan_2_0_7(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | String template2 = configService.get(ConfigKeyEnum.quickShareGoodsText.getKey()); |
| | | recommendText = template2.replace("[商品标题]", jdGoods.getSkuName()); |
| | | // 无推荐语 |
| | | recommendText = recommendText.replace("推荐理由:[推荐语]", ""); |
| | | |
| | | String sales = JDUtil.getSaleCount(jdGoods.getInOrderCount30Days()); |
| | | if (sales.equals("0")) { |
| | | recommendText = recommendText.replace("销量:[销量]", ""); |
| | | } else { |
| | | recommendText = recommendText.replace("[销量]", sales.replace("万", "w")); |
| | | } |
| | | |
| | | BigDecimal price = jdGoods.getPrice(); |
| | | JDPingouInfo pinGouInfo = jdGoods.getPinGouInfo(); |
| | | if (pinGouInfo != null) { |
| | | price = pinGouInfo.getPingouPrice(); |
| | | } |
| | | |
| | | String template3 = configService.get(ConfigKeyEnum.quickShareJDCommentText.getKey()); |
| | | commentText = template3.replace("[原价]", BigDecimalUtil.getWithNoZera(price).toString()); |
| | | if (!hasCoupon) { |
| | | recommendText = recommendText.replace("优惠券:[券面额]元", ""); |
| | | commentText = commentText.replace("【券后价】[券后价]元", ""); |
| | | commentText = commentText.replace("领券抢购", "抢购"); |
| | | } else { |
| | | recommendText = recommendText.replace("[券面额]", |
| | | BigDecimalUtil.getWithNoZera(couponInfo.getDiscount()).toString()); |
| | | commentText = commentText.replace("[券后价]", |
| | | BigDecimalUtil.getWithNoZera(JDUtil.getQuanPrice(jdGoods)).toString()); |
| | | } |
| | | commentText = commentText.replace("[链接]", jumpLink); |
| | | } else { |
| | | commentText = shareInfo.getShareText(); |
| | | recommendText = shareInfo.getDescText(); |
| | |
| | | |
| | | // 设置评论文本选项 |
| | | shareInfo.setCommentTextChoiceList(getCommentChoiceList(null, shareInfo.getCommentText(), inviteCode, |
| | | JDUtil.getGoodsFanLiMoney(jdGoods, hongBaoManageService.getFanLiRate()))); |
| | | JDUtil.getGoodsFanLiMoney(jdGoods, hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP)))); |
| | | |
| | | out.print(JsonUtil.loadTrueResult( |
| | | JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create().toJson(shareInfo))); |
| | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | private String deleteBlankLine(String st){ |
| | | |
| | | private String deleteBlankLine(String st) { |
| | | return st.replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n").replace("\r\n\r\n", "\r\n"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 拼多多分享 |
| | |
| | | .setGoodsInfo(GoodsDetailVOFactory.convertPDDGoods(goods, |
| | | new ConfigParamsDTO(hongBaoManageService.getFanLiRate(), |
| | | hongBaoManageService.getShareRate(), Constant.MAX_REWARD_RATE, |
| | | hongBaoManageService.getVIPFanLiRate()))); |
| | | hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP)))); |
| | | } |
| | | |
| | | // 创建口令 |
| | | // String token = PinDuoDuoApiUtil.createGenerate(goodsId); |
| | | |
| | | // String token = PinDuoDuoApiUtil.createGenerate(goodsId); |
| | | |
| | | boolean hasCoupon = true; |
| | | if (goods.getHasCoupon() == null || !goods.getHasCoupon()) { |
| | | hasCoupon = false; |
| | | } |
| | | } |
| | | String template = shareGoodsTextTemplateService.getTextTemplateByPDD(uid); |
| | | String shareText = shareGoodsTextTemplateService.createContentPDD(template, goods, jumpLink, hasCoupon); |
| | | shareInfo.setShareText(shareText); |
| | |
| | | shareInfo.setCommentText(deleteBlankLine(commentText)); |
| | | |
| | | // 设置评论文本选项 |
| | | shareInfo.setCommentTextChoiceList(getCommentChoiceList(null,shareInfo.getCommentText(), inviteCode, |
| | | PinDuoDuoUtil.getGoodsFanLiMoney(goods, hongBaoManageService.getFanLiRate()))); |
| | | shareInfo.setCommentTextChoiceList(getCommentChoiceList(null, shareInfo.getCommentText(), inviteCode, |
| | | PinDuoDuoUtil.getGoodsFanLiMoney(goods, hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP)))); |
| | | |
| | | out.print(JsonUtil.loadTrueResult( |
| | | JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create().toJson(shareInfo))); |
| | |
| | | out.print(JsonUtil.loadFalseResult(5, e.getMsg())); |
| | | return; |
| | | } |
| | | |
| | | |
| | | // 查询是否有分享 |
| | | UserShareGoodsHistory userShareHistory = shareGoodsService.getShareGoodsHistory(uid, goods.getAuctionId()); |
| | | String token = ""; |
| | |
| | | StringUtil.isNullOrEmpty(goodsLink.getCouponLink()) ? goodsLink.getAuctionUrl() |
| | | : goodsLink.getCouponLink()); |
| | | } |
| | | String content = shareGoodsTextTemplateService.createContentTB(template, goods, token, hasCoupon); |
| | | String content = shareGoodsTextTemplateService.createContentTB(template, goods, token, hasCoupon); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("content", content); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | |
| | | |
| | | String shortLink = PinDuoDuoApiUtil.getPromotionUrl(goodsId, PinDuoDuoApiUtil.PID_SHARE + "", uid + ""); |
| | | |
| | | // // 创建口令 |
| | | // String token = PinDuoDuoApiUtil.createGenerate(goodsId); |
| | | // // 创建口令 |
| | | // String token = PinDuoDuoApiUtil.createGenerate(goodsId); |
| | | |
| | | // 生成分享内容 |
| | | String content = shareGoodsTextTemplateService.createContentPDD(template, goods, shortLink, hasCoupon); |
| | |
| | | } |
| | | } |
| | | |
| | | ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(), |
| | | ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), |
| | | acceptData.getVersion()); |
| | | |
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) |
| | |
| | | } |
| | | |
| | | GoodsDetailVO goodsDetail = null; |
| | | ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(), |
| | | ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), |
| | | acceptData.getVersion()); |
| | | paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate()); |
| | | |
| | |
| | | |
| | | String template = configService.get(ConfigKeyEnum.quickShareGoodsText.getKey()); |
| | | template = template.replace("[商品标题]", goodsDetail.getTitle()).replace("[销量]", goodsDetail.getSalesCount()); |
| | | if (StringUtil.isNullOrEmpty(goodsDetail.getDescription())) { |
| | | if (!StringUtil.isNullOrEmpty(goodsDetail.getDescription())) { |
| | | template = template.replace("[推荐语]", goodsDetail.getDescription()); |
| | | } else { |
| | | template = template.replace("推荐语:[推荐语]", ""); |