From 24a8d17e007545f7426c48352109aa1a9c6587ee Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 06 五月 2020 12:02:09 +0800 Subject: [PATCH] IOS上线隐藏我的界面的banner与超级会员升级信息 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java | 584 ++++++++++++++++++++++----------------------------------- 1 files changed, 229 insertions(+), 355 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java index 7e5d8cb..6aabcbc 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java @@ -24,6 +24,7 @@ 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; @@ -34,8 +35,8 @@ 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; @@ -55,6 +56,7 @@ 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; @@ -104,6 +106,9 @@ @Resource private HongBaoManageService hongBaoManageService; + + @Resource + private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService; @Resource private MonitorService monitorService; @@ -163,8 +168,8 @@ BigDecimal fanliMoney) { List<ShareGoodsCommentChoiceInfo> list = new ArrayList<>(); if (!StringUtil.isNullOrEmpty(token)) - list.add(new ShareGoodsCommentChoiceInfo(ShareGoodsCommentChoiceInfo.TYPE_TOKEN, "娣樺彛浠�", - String.format("寰╄=杩欐潯%s\n杩涘叆銆怲ao瀹濄�戝嵆鍙姠璐�", token), true, false)); + list.add( + new ShareGoodsCommentChoiceInfo(ShareGoodsCommentChoiceInfo.TYPE_TOKEN, "娣樺彛浠�", token, true, false)); if (!StringUtil.isNullOrEmpty(link)) { list.add(new ShareGoodsCommentChoiceInfo(ShareGoodsCommentChoiceInfo.TYPE_LINK, "閾炬帴", link, true, false)); } @@ -177,7 +182,7 @@ "涓嬭浇閾炬帴锛�" + 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; } @@ -244,16 +249,17 @@ } } - 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("[鍙d护]", token); + commentText = commentText.replace("[娣樺彛浠", token); if (StringUtil.isNullOrEmpty(goods.getCouponInfo())) { - commentText= commentText.replace("棰嗗埜鎶㈣喘", "鎶㈣喘"); - commentText= commentText.replace("銆愬埜鍚庝环銆慬鍒稿悗浠穄鍏�", ""); + commentText = commentText.replace("棰嗗埜鎶㈣喘", "鎶㈣喘"); + commentText = commentText.replace("銆愬埜鍚庝环銆慬鍒稿悗浠穄鍏�", ""); } else { - commentText= commentText.replace("[鍒稿悗浠穄", TaoBaoUtil.getAfterUseCouplePrice(goods) + ""); + 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"); return commentText; } @@ -425,6 +431,11 @@ JSONArray array = JSONArray.fromObject(imgs); shareInfo.setNotifyPicture(array.optString(0)); + // 2.0.7鐗堟湰鍚庣殑鎻愮ず鍥剧墖 + imgs = configService.get(ConfigKeyEnum.goodsShareNotifyImgs207.getKey()); + array = JSONArray.fromObject(imgs); + shareInfo.setNotifyPictureNew(array.optString(0)); + shareInfo.setNotifyDesc(configService.get(ConfigKeyEnum.goodsShareNotify.getKey())); // 娣诲姞鍒嗕韩璁板綍 @@ -486,7 +497,7 @@ 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); } @@ -525,49 +536,44 @@ } shareInfo.setCommentTexts(commentTexts); - String shareText = ""; - // 鏃犲埜 - String shopType = taoBaoLink.getGoods().getUserType() == 0 ? TaoBaoConstant.SHARE_PRICE_TAOBAO - : TaoBaoConstant.SHARE_PRICE_TM; + TaoBaoGoodsBrief goods = taoBaoLink.getGoods(); - if (StringUtil.isNullOrEmpty(taoBaoLink.getGoods().getCouponInfo())) { - String text = shareGoodsTextTemplateService.getCommonTemplate(uid); - if (StringUtil.isNullOrEmpty(text)) - text = configService.get(ConfigKeyEnum.goodsShareTextNoCoupon.getKey()); - shareText = text.replace("{鏍囬}", taoBaoLink.getGoods().getTitle()).replace("{鍟嗗搧鍘熶环}", - MoneyBigDecimalUtil.getWithNoZera(taoBaoLink.getGoods().getZkPrice()) + ""); - } else// 鏈夊埜 - { - String text = shareGoodsTextTemplateService.geteCouponTemplate(uid); - if (StringUtil.isNullOrEmpty(text)) - text = configService.get(ConfigKeyEnum.goodsShareTextCoupon.getKey()); - - shareText = text.replace("{鏍囬}", taoBaoLink.getGoods().getTitle()) - .replace("{鍟嗗搧鍘熶环}", MoneyBigDecimalUtil.getWithNoZera(taoBaoLink.getGoods().getZkPrice()) + "") - .replace("{浼樻儬鍒搁潰棰潁", - MoneyBigDecimalUtil.getWithNoZera(taoBaoLink.getGoods().getCouponAmount()).toString()) - .replace("{浼樻儬鍒镐环}", TaoBaoUtil.getAfterUseCouplePrice(taoBaoLink.getGoods()) + ""); + boolean coupon = false; + if (!StringUtil.isNullOrEmpty(taoBaoLink.getGoods().getCouponInfo())) { + coupon = true; } - shareText = shareText.replace("{搴楅摵绫诲瀷}", shopType) - .replace("{鏈堥攢閲弣", TaoBaoUtil.getSaleCount(taoBaoLink.getGoods().getBiz30day())) - .replace("{棰嗗埜鐭摼}", shortLink).replace("{娣樺彛浠", TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken())); - + String template = shareGoodsTextTemplateService.getTextTemplateByTB(uid); + 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(descText); + shareInfo.setDescText(deleteBlankLine(descText)); + // 娴嬭瘯 // 2.0.2涔嬪墠 - if (!VersionUtil.greaterThan_2_0_2(platform, version)) - shareInfo.setClickUrl(getERCodeContent(configService.get(ConfigKeyEnum.taobaoShareQrcodeText.getKey()), - taoBaoLink.getGoods(), shareInfo.getToken())); + if (VersionUtil.greaterThan_2_0_7(platform, version)) { + shareInfo.setClickUrl( + getERCodeContentNew(configService.get(ConfigKeyEnum.quickShareTBCommentText.getKey()), + taoBaoLink.getGoods(), shareInfo.getToken())); + } else if (!VersionUtil.greaterThan_2_0_2(platform, version)) { + shareInfo.setClickUrl( + getERCodeContentNew(configService.get(ConfigKeyEnum.taobaoShareQrcodeText.getKey()), + taoBaoLink.getGoods(), shareInfo.getToken())); + } - shareInfo.setWxErCode(getERCodeContent(configService.get(ConfigKeyEnum.taobaoShareQrcodeText.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())); + // } // 鎻愮ず鍥炬枃鍐呭 String imgs = configService.getByVersion(ConfigKeyEnum.goodsShareNotifyImgs.getKey(), platform, @@ -575,6 +581,11 @@ JSONArray array = JSONArray.fromObject(imgs); shareInfo.setNotifyPicture(array.optString(0)); + + // 2.0.7鐗堟湰鍚庣殑鎻愮ず鍥剧墖 + imgs = configService.get(ConfigKeyEnum.goodsShareNotifyImgs207.getKey()); + array = JSONArray.fromObject(imgs); + shareInfo.setNotifyPictureNew(array.optString(0)); shareInfo.setNotifyDesc(configService.get(ConfigKeyEnum.goodsShareNotify.getKey())); @@ -596,41 +607,56 @@ } } - // 璁剧疆璇勮鏂囨湰閫夐」 - shareInfo.setCommentTextChoiceList(getCommentChoiceList(shareInfo.getToken(), null, inviteCode, - TaoBaoUtil.getGoodsHongBaoMoney(taoBaoLink.getGoods(), hongBaoManageService.getFanLiRate()))); - String commentText = ""; String recommendText = ""; - if (VersionUtil.greaterThan_2_0_7(platform, version)){ - TaoBaoGoodsBrief goods = taoBaoLink.getGoods(); - String template = configService.get(ConfigKeyEnum.quickShareGoodsText.getKey()); - recommendText = template.replace("[鍟嗗搧鏍囬]", goods.getTitle()). - replace("[閿�閲廬", TaoBaoUtil.getSaleCount(taoBaoLink.getGoods().getBiz30day())); - if (StringUtil.isNullOrEmpty(goods.getDescription())) { - recommendText = recommendText.replace("鎺ㄨ崘璇�:[鎺ㄨ崘璇璢", ""); + if (VersionUtil.greaterThan_2_0_7(platform, version)) { + String template2 = configService.get(ConfigKeyEnum.quickShareGoodsText.getKey()); + recommendText = template2.replace("[鍟嗗搧鏍囬]", goods.getTitle()); + 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("閿�閲�:[閿�閲廬", ""); + } else { + recommendText = recommendText.replace("[閿�閲廬", sales.replace("涓�", "w")); + } + String quickCommentText = configService.get(ConfigKeyEnum.quickShareTBCommentText.getKey()); commentText = quickCommentText.replace("[鍘熶环]", goods.getZkPrice().toString()); - commentText = quickCommentText.replace("[鍙d护]", TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken())); + commentText = commentText.replace("[娣樺彛浠", TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken())); if (StringUtil.isNullOrEmpty(taoBaoLink.getGoods().getCouponInfo())) { - commentText= commentText.replace("棰嗗埜鎶㈣喘", "鎶㈣喘"); - commentText= commentText.replace("銆愬埜鍚庝环銆慬鍒稿悗浠穄鍏�", ""); - recommendText = recommendText.replace("浼樻儬鍒�:[鍒搁潰棰漖", ""); + commentText = commentText.replace("棰嗗埜鎶㈣喘", "鎶㈣喘"); + commentText = commentText.replace("銆愬埜鍚庝环銆慬鍒稿悗浠穄鍏�", ""); } else { - commentText= commentText.replace("[鍒稿悗浠穄", TaoBaoUtil.getAfterUseCouplePrice(taoBaoLink.getGoods()) + ""); - recommendText = recommendText.replace("[鍒搁潰棰漖", MoneyBigDecimalUtil.getWithNoZera(taoBaoLink.getGoods().getCouponAmount()).toString()); + commentText = commentText.replace("[鍒稿悗浠穄", + TaoBaoUtil.getAfterUseCouplePrice(taoBaoLink.getGoods()) + ""); + } + + if (StringUtil.isNullOrEmpty(taoBaoLink.getGoods().getCouponInfo())) { + recommendText = recommendText.replace("浼樻儬鍒�:[鍒搁潰棰漖鍏�", ""); + } else { + recommendText = recommendText.replace("[鍒搁潰棰漖", + MoneyBigDecimalUtil.getWithNoZera(taoBaoLink.getGoods().getCouponAmount()).toString()); } } else { - recommendText = shareInfo.getDescText(); commentText = shareInfo.getShareText(); + recommendText = shareInfo.getDescText(); } - shareInfo.setCommentText(commentText); - shareInfo.setRecommendText(recommendText); - + shareInfo.setCommentText(deleteBlankLine(commentText)); + shareInfo.setRecommendText(deleteBlankLine(recommendText)); + + // 璁剧疆璇勮鏂囨湰閫夐」 + 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))); @@ -709,29 +735,15 @@ if (needGoods) shareInfo.setGoodsInfo(GoodsDetailVOFactory.convertJDGoods(jdGoods, - hongBaoManageService.getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion()))); + orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion()))); - String shareText = ""; boolean hasCoupon = false; - - // 鍒嗕韩妯℃澘 - ShareGoodsTextTemplate textTemplate = shareGoodsTextTemplateService.getShareGoodsTextTemplate(uid); - if (couponInfo == null) { // 鏃犲埜妯℃澘 - if (textTemplate != null) - shareText = textTemplate.getShareJDTextTemplate(); - - if (StringUtil.isNullOrEmpty(shareText)) - shareText = configService.get(ConfigKeyEnum.goodsShareTextNoCouponJD.getKey()); - } else { // 鏈夊埜妯℃澘 + if (couponInfo != null) { hasCoupon = true; - if (textTemplate != null) - shareText = textTemplate.getShareJDTextTemplateCoupon(); - - if (StringUtil.isNullOrEmpty(shareText)) - shareText = configService.get(ConfigKeyEnum.goodsShareTextCouponJD.getKey()); } - shareText = shareGoodsTextTemplateService.createContentByTemplateJD(shareText, uid, jdGoods, jumpLink, - hasCoupon); + + String template = shareGoodsTextTemplateService.getTextTemplateByJD(uid); + String shareText = shareGoodsTextTemplateService.createContentJD(template, jdGoods, jumpLink, hasCoupon); shareInfo.setShareText(shareText); String descText = shareText.replace(jdGoods.getSkuName(), "").trim(); @@ -745,6 +757,11 @@ JSONArray array = JSONArray.fromObject(imgs); shareInfo.setNotifyPicture(array.size() > 1 ? array.optString(1) : array.optString(0)); + + // 2.0.7鐗堟湰鍚庣殑鎻愮ず鍥剧墖 + imgs = configService.get(ConfigKeyEnum.goodsShareNotifyImgs207.getKey()); + array = JSONArray.fromObject(imgs); + shareInfo.setNotifyPictureNew(array.size() > 1 ? array.optString(1) : array.optString(0)); shareInfo.setNotifyDesc(configService.get(ConfigKeyEnum.goodsShareNotifyJD.getKey())); @@ -766,36 +783,48 @@ String inviteCode = userInfoExtraService.getInviteCodeByUid(uid); - // 璁剧疆璇勮鏂囨湰閫夐」 - shareInfo.setCommentTextChoiceList(getCommentChoiceList(null, shareInfo.getClickUrl(), inviteCode, - JDUtil.getGoodsFanLiMoney(jdGoods, hongBaoManageService.getFanLiRate()))); - String commentText = ""; String recommendText = ""; - if (VersionUtil.greaterThan_2_0_7(acceptData.getPlatform(), acceptData.getVersion())){ - String template = configService.get(ConfigKeyEnum.quickShareGoodsText.getKey()); - recommendText = template.replace("[鍟嗗搧鏍囬]", jdGoods.getSkuName()). - replace("[閿�閲廬", JDUtil.getSaleCount(jdGoods.getInOrderCount30Days())); - // 鏃犳帹鑽愯 - recommendText = recommendText.replace("鎺ㄨ崘璇�:[鎺ㄨ崘璇璢", ""); - - String quickCommentText = configService.get(ConfigKeyEnum.quickShareJDCommentText.getKey()); - commentText = quickCommentText.replace("[鍘熶环]", jdGoods.getPrice().toString()); - commentText = quickCommentText.replace("[閾炬帴]", jumpLink); - if (couponInfo == null) { - commentText= commentText.replace("棰嗗埜鎶㈣喘", "鎶㈣喘"); - commentText= commentText.replace("銆愬埜鍚庝环銆慬鍒稿悗浠穄鍏�", ""); - recommendText = recommendText.replace("浼樻儬鍒�:[鍒搁潰棰漖", ""); + 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 { - commentText= commentText.replace("[鍒稿悗浠穄", BigDecimalUtil.getWithNoZera(JDUtil.getQuanPrice(jdGoods)).toString()); - recommendText = recommendText.replace("[鍒搁潰棰漖",BigDecimalUtil.getWithNoZera(JDUtil.getShowCouponInfo(jdGoods).getDiscount()).toString()); + 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.setCommentText(commentText); - shareInfo.setRecommendText(recommendText); + shareInfo.setCommentText(deleteBlankLine(commentText)); + shareInfo.setRecommendText(deleteBlankLine(recommendText)); + + // 璁剧疆璇勮鏂囨湰閫夐」 + shareInfo.setCommentTextChoiceList(getCommentChoiceList(null, shareInfo.getCommentText(), inviteCode, + JDUtil.getGoodsFanLiMoney(jdGoods, hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP)))); out.print(JsonUtil.loadTrueResult( JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create().toJson(shareInfo))); @@ -826,6 +855,10 @@ shareGoodsService.addShareGoodsHistory(history); } }); + } + + 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"); } /** @@ -864,33 +897,18 @@ .setGoodsInfo(GoodsDetailVOFactory.convertPDDGoods(goods, new ConfigParamsDTO(hongBaoManageService.getFanLiRate(), hongBaoManageService.getShareRate(), Constant.MAX_REWARD_RATE, - hongBaoManageService.getVIPFanLiRate()))); - } - - String template = ""; - boolean hasCoupon = false; - ShareGoodsTextTemplate textTemplate = shareGoodsTextTemplateService.getShareGoodsTextTemplate(uid); - if (goods.getHasCoupon() == null || !goods.getHasCoupon()) { - if (textTemplate != null) - template = textTemplate.getSharePDDTextTemplate(); - - if (StringUtil.isNullOrEmpty(template)) - template = configService.get(ConfigKeyEnum.goodsShareTextNocouponPDD.getKey()); - } else { - hasCoupon = true; - if (textTemplate != null) - template = textTemplate.getSharePDDTextTemplateCoupon(); - - if (StringUtil.isNullOrEmpty(template)) - template = configService.get(ConfigKeyEnum.goodsShareTextCouponPDD.getKey()); + hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP)))); } // 鍒涘缓鍙d护 - String token = PinDuoDuoApiUtil.createGenerate(goodsId); + // String token = PinDuoDuoApiUtil.createGenerate(goodsId); - // 鐢熸垚鍒嗕韩鍐呭 - String shareText = shareGoodsTextTemplateService.createContentByTemplatePDD(template, uid, goods, jumpLink, - hasCoupon, token); + 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); String descText = shareText.replace(goods.getGoodsName(), "").trim(); @@ -905,6 +923,11 @@ JSONArray array = JSONArray.fromObject(imgs); shareInfo.setNotifyPicture(array.size() > 1 ? array.optString(1) : array.optString(0)); + + // 2.0.7鐗堟湰鍚庣殑鎻愮ず鍥剧墖 + imgs = configService.get(ConfigKeyEnum.goodsShareNotifyImgs207.getKey()); + array = JSONArray.fromObject(imgs); + shareInfo.setNotifyPictureNew(array.size() > 1 ? array.optString(1) : array.optString(0)); shareInfo.setNotifyDesc(configService.get(ConfigKeyEnum.goodsShareNotifyPDD.getKey())); @@ -927,45 +950,52 @@ String inviteCode = userInfoExtraService.getInviteCodeByUid(uid); - // 璁剧疆璇勮鏂囨湰閫夐」 - shareInfo.setCommentTextChoiceList(getCommentChoiceList(null, shareInfo.getClickUrl(), inviteCode, - PinDuoDuoUtil.getGoodsFanLiMoney(goods, hongBaoManageService.getFanLiRate()))); - String commentText = ""; String recommendText = ""; - if (VersionUtil.greaterThan_2_0_7(acceptData.getPlatform(), acceptData.getVersion())){ + if (VersionUtil.greaterThan_2_0_7(acceptData.getPlatform(), acceptData.getVersion())) { String qtemplate = configService.get(ConfigKeyEnum.quickShareGoodsText.getKey()); recommendText = qtemplate.replace("[鍟嗗搧鏍囬]", goods.getGoodsName()); - + // 鎬婚攢閲� String salesTip = goods.getSalesTip(); if (StringUtil.isNullOrEmpty(salesTip)) { salesTip = "0"; } - recommendText = recommendText.replace("[閿�閲廬", salesTip); - recommendText = recommendText.replace("鎺ㄨ崘璇�:[鎺ㄨ崘璇璢", ""); - - String quickCommentText = configService.get(ConfigKeyEnum.quickSharePDDCommentText.getKey()); - commentText = quickCommentText.replace("[鍘熶环]", MoneyBigDecimalUtil.div(new BigDecimal(goods.getMinGroupPrice()), new BigDecimal(100)).setScale(2).toString()); - commentText = quickCommentText.replace("[閾炬帴]", jumpLink); - if (!hasCoupon) { - commentText= commentText.replace("棰嗗埜鎶㈣喘", "鎶㈣喘"); - commentText= commentText.replace("銆愬埜鍚庝环銆慬鍒稿悗浠穄鍏�", ""); - recommendText = template.replace("浼樻儬鍒�:[鍒搁潰棰漖", ""); + if (salesTip.equals("0")) { + recommendText = recommendText.replace("閿�閲�:[閿�閲廬", ""); } else { - commentText= commentText.replace("[鍒稿悗浠穄", BigDecimalUtil.getWithNoZera(PinDuoDuoUtil.getQuanPrice(goods)).toString()); + recommendText = recommendText.replace("[閿�閲廬", salesTip.replace("涓�", "w")); + recommendText = recommendText.replace("閿�閲�", "鎬婚攢閲�"); + } + recommendText = recommendText.replace("鎺ㄨ崘鐞嗙敱:[鎺ㄨ崘璇璢", ""); + + String quickCommentText = configService.get(ConfigKeyEnum.quickSharePDDCommentText.getKey()); + commentText = quickCommentText.replace("[鍘熶环]", MoneyBigDecimalUtil + .div(new BigDecimal(goods.getMinGroupPrice()), new BigDecimal(100)).setScale(2).toString()); + commentText = commentText.replace("[閾炬帴]", jumpLink); + if (!hasCoupon) { + commentText = commentText.replace("棰嗗埜鎶㈣喘", "鎶㈣喘"); + commentText = commentText.replace("銆愬埜鍚庝环銆慬鍒稿悗浠穄鍏�", ""); + recommendText = recommendText.replace("浼樻儬鍒�:[鍒搁潰棰漖鍏�", ""); + } else { + commentText = commentText.replace("[鍒稿悗浠穄", + BigDecimalUtil.getWithNoZera(PinDuoDuoUtil.getQuanPrice(goods)).toString()); BigDecimal hundred = new BigDecimal(100); BigDecimal amount = MoneyBigDecimalUtil.div(new BigDecimal(goods.getCouponDiscount()), hundred); - recommendText = template.replace("[鍒搁潰棰漖", BigDecimalUtil.getWithNoZera(amount).toString()); + recommendText = recommendText.replace("[鍒搁潰棰漖", BigDecimalUtil.getWithNoZera(amount).toString()); } } else { commentText = shareInfo.getShareText(); recommendText = shareInfo.getDescText(); } - shareInfo.setRecommendText(recommendText); - shareInfo.setCommentText(commentText); - + shareInfo.setRecommendText(deleteBlankLine(recommendText)); + shareInfo.setCommentText(deleteBlankLine(commentText)); + + // 璁剧疆璇勮鏂囨湰閫夐」 + 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))); @@ -1054,7 +1084,7 @@ * @param hasCoupon * @param out */ - public void createTaoBaoViewText(Integer goodsType, Long uid, String template, Long goodsId, Long tljId, + private void createTaoBaoViewText(Integer goodsType, Long uid, String template, Long goodsId, Long tljId, Boolean hasCoupon, PrintWriter out) { TaoBaoGoodsBrief goods = taoBaoGoodsCacheUtil.getCommonTaoBaoGoodsInfo(goodsId); if (goods == null) @@ -1073,49 +1103,13 @@ template = getShareTemplate(goodsType, uid, hasCoupon, tljId); } - // 鏍¢獙鍒告ā鏉挎槸鍚︽纭� - if (hasCoupon) { - // 鏈夊埜鍟嗗搧 - if (tljId != null) { - try { - shareGoodsTextTemplateService.isTaoLiJinTemplateRight(template); - } catch (ShareGoodsTextTemplateException e) { - out.print(JsonUtil.loadFalseResult(5, e.getMsg())); - return; - } - } else { - try { - shareGoodsTextTemplateService.isCouponTemplateRight(template); - } catch (ShareGoodsTextTemplateException e) { - out.print(JsonUtil.loadFalseResult(5, e.getMsg())); - return; - } - } - } else { - // 鏅�氬晢鍝� - try { - shareGoodsTextTemplateService.isCommonTemplateRight(template); - } catch (ShareGoodsTextTemplateException e) { - out.print(JsonUtil.loadFalseResult(5, e.getMsg())); - return; - } + // 鏍¢獙妯℃澘鏄惁姝g‘ + try { + shareGoodsTextTemplateService.verifyRightTB(template); + } catch (ShareGoodsTextTemplateException e) { + out.print(JsonUtil.loadFalseResult(5, e.getMsg())); + return; } - - String url = null; - if (tljId != null) { - UserTaoLiJinRecord userTaoLiJinRecord = userTaoLiJinRecordService.selectByPrimaryKey(tljId); - if (userTaoLiJinRecord == null) { - out.print(JsonUtil.loadFalseResult(5, "娣樼ぜ閲戦鍙栭摼鎺ヤ笉瀛樺湪")); - return; - } - url = userTaoLiJinRecord.getSendUrl(); - } else { - url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(), - Constant.systemCommonConfig.getShareGoodsPagePath(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY), - goods.getAuctionId() + ""); - } - - String shortLink = HttpUtil.getShortLink(url); // 鏌ヨ鏄惁鏈夊垎浜� UserShareGoodsHistory userShareHistory = shareGoodsService.getShareGoodsHistory(uid, goods.getAuctionId()); @@ -1136,8 +1130,7 @@ StringUtil.isNullOrEmpty(goodsLink.getCouponLink()) ? goodsLink.getAuctionUrl() : goodsLink.getCouponLink()); } - String content = shareGoodsTextTemplateService.createContentByTemplate(template, uid, goods, token, shortLink, - hasCoupon, tljId); + String content = shareGoodsTextTemplateService.createContentTB(template, goods, token, hasCoupon); JSONObject data = new JSONObject(); data.put("content", content); out.print(JsonUtil.loadTrueResult(data)); @@ -1154,7 +1147,7 @@ * @param hasCoupon * @param out */ - public void createJDViewText(Integer goodsType, Long uid, String template, Long goodsId, Boolean hasCoupon, + private void createJDViewText(Integer goodsType, Long uid, String template, Long goodsId, Boolean hasCoupon, PrintWriter out) { JDGoods goods = jdGoodsCacheUtil.getGoodsInfo(goodsId); if (goods == null) { @@ -1167,23 +1160,11 @@ } // 鏍¢獙鍒告ā鏉挎槸鍚︽纭� - if (hasCoupon) { - // 鏈夊埜鍟嗗搧 - try { - shareGoodsTextTemplateService.isCouponTemplateRightJD(template); - } catch (ShareGoodsTextTemplateException e) { - out.print(JsonUtil.loadFalseResult(5, e.getMsg())); - return; - } - - } else { - // 鏅�氬晢鍝� - try { - shareGoodsTextTemplateService.isCommonTemplateRightJD(template); - } catch (ShareGoodsTextTemplateException e) { - out.print(JsonUtil.loadFalseResult(5, e.getMsg())); - return; - } + try { + shareGoodsTextTemplateService.verifyRightJD(template); + } catch (ShareGoodsTextTemplateException e) { + out.print(JsonUtil.loadFalseResult(5, e.getMsg())); + return; } String couponUrl = null; @@ -1195,8 +1176,7 @@ String shortLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "", uid + ""); - String content = shareGoodsTextTemplateService.createContentByTemplateJD(template, uid, goods, shortLink, - hasCoupon); + String content = shareGoodsTextTemplateService.createContentJD(template, goods, shortLink, hasCoupon); JSONObject data = new JSONObject(); data.put("content", content); out.print(JsonUtil.loadTrueResult(data)); @@ -1213,7 +1193,7 @@ * @param hasCoupon * @param out */ - public void createPDDViewText(Integer goodsType, Long uid, String template, Long goodsId, Boolean hasCoupon, + private void createPDDViewText(Integer goodsType, Long uid, String template, Long goodsId, Boolean hasCoupon, PrintWriter out) { PDDGoodsDetail goods = pinDuoDuoCacheUtil.getGoodsInfo(goodsId); if (goods == null) { @@ -1226,23 +1206,11 @@ } // 鏍¢獙鍒告ā鏉挎槸鍚︽纭� - if (hasCoupon) { - // 鏈夊埜鍟嗗搧 - try { - shareGoodsTextTemplateService.isCouponTemplateRightPDD(template); - } catch (ShareGoodsTextTemplateException e) { - out.print(JsonUtil.loadFalseResult(5, e.getMsg())); - return; - } - - } else { - // 鏅�氬晢鍝� - try { - shareGoodsTextTemplateService.isCommonTemplateRightPDD(template); - } catch (ShareGoodsTextTemplateException e) { - out.print(JsonUtil.loadFalseResult(5, e.getMsg())); - return; - } + try { + shareGoodsTextTemplateService.verifyRightPDD(template); + } catch (ShareGoodsTextTemplateException e) { + out.print(JsonUtil.loadFalseResult(5, e.getMsg())); + return; } // // 鍒涘缓h5杩炴帴 @@ -1255,12 +1223,11 @@ String shortLink = PinDuoDuoApiUtil.getPromotionUrl(goodsId, PinDuoDuoApiUtil.PID_SHARE + "", uid + ""); - // 鍒涘缓鍙d护 - String token = PinDuoDuoApiUtil.createGenerate(goodsId); + // // 鍒涘缓鍙d护 + // String token = PinDuoDuoApiUtil.createGenerate(goodsId); // 鐢熸垚鍒嗕韩鍐呭 - String content = shareGoodsTextTemplateService.createContentByTemplatePDD(template, uid, goods, shortLink, - hasCoupon, token); + String content = shareGoodsTextTemplateService.createContentPDD(template, goods, shortLink, hasCoupon); JSONObject data = new JSONObject(); data.put("content", content); @@ -1278,58 +1245,11 @@ private String getShareTemplate(int goodsType, Long uid, boolean hasCoupon, Long tljId) { String template = ""; if (goodsType == Constant.SOURCE_TYPE_TAOBAO) { - if (hasCoupon) { - if (tljId != null) { - template = shareGoodsTextTemplateService.getTaoLiJinTemplate(uid); - if (StringUtil.isNullOrEmpty(template)) - template = configTaoLiJinService.getValueByKey("goods_share_text", new Date()); - } else { - template = shareGoodsTextTemplateService.geteCouponTemplate(uid); - if (StringUtil.isNullOrEmpty(template)) - template = configService.get(ConfigKeyEnum.goodsShareTextCoupon.getKey()); - } - - } else { - template = shareGoodsTextTemplateService.getCommonTemplate(uid); - if (StringUtil.isNullOrEmpty(template)) - template = configService.get(ConfigKeyEnum.goodsShareTextNoCoupon.getKey()); - } + template = shareGoodsTextTemplateService.getTextTemplateByTB(uid); } else if (goodsType == Constant.SOURCE_TYPE_JD) { - ShareGoodsTextTemplate textTemplate = shareGoodsTextTemplateService.getShareGoodsTextTemplate(uid); - if (hasCoupon) { - if (textTemplate != null) { - template = textTemplate.getShareJDTextTemplateCoupon(); - } - if (StringUtil.isNullOrEmpty(template)) { - template = configService.get(ConfigKeyEnum.goodsShareTextCouponJD.getKey()); - } - } else { - if (textTemplate != null) { - template = textTemplate.getShareJDTextTemplate(); - } - - if (StringUtil.isNullOrEmpty(template)) { - template = configService.get(ConfigKeyEnum.goodsShareTextNoCouponJD.getKey()); - } - } + template = shareGoodsTextTemplateService.getTextTemplateByJD(uid); } else if (goodsType == Constant.SOURCE_TYPE_PDD) { - ShareGoodsTextTemplate textTemplate = shareGoodsTextTemplateService.getShareGoodsTextTemplate(uid); - if (hasCoupon) { - if (textTemplate != null) { - template = textTemplate.getSharePDDTextTemplateCoupon(); - } - if (StringUtil.isNullOrEmpty(template)) { - template = configService.get(ConfigKeyEnum.goodsShareTextCouponPDD.getKey()); - } - } else { - if (textTemplate != null) { - template = textTemplate.getSharePDDTextTemplate(); - } - - if (StringUtil.isNullOrEmpty(template)) { - template = configService.get(ConfigKeyEnum.goodsShareTextNocouponPDD.getKey()); - } - } + template = shareGoodsTextTemplateService.getTextTemplateByPDD(uid); } return template; } @@ -1411,39 +1331,11 @@ try { if (goodsType == Constant.SOURCE_TYPE_TAOBAO) { - // 鏍¢獙鍒告ā鏉挎槸鍚︽纭� - if (hasCoupon) { - // 鏈夊埜鍟嗗搧 - if (tljId != null) { - shareGoodsTextTemplateService.isTaoLiJinTemplateRight(template); - shareGoodsTextTemplateService.saveTaoLiJinTemplate(uid, template); - } else { - shareGoodsTextTemplateService.isCouponTemplateRight(template); - shareGoodsTextTemplateService.saveCouponTemplate(uid, template); - } - } else { - // 鏅�氬晢鍝� - shareGoodsTextTemplateService.isCommonTemplateRight(template); - shareGoodsTextTemplateService.saveCommonTemplate(uid, template); - } + shareGoodsTextTemplateService.saveTemplateTB(uid, template); } else if (goodsType == Constant.SOURCE_TYPE_JD) { - if (hasCoupon) { - shareGoodsTextTemplateService.isCouponTemplateRightJD(template); - shareGoodsTextTemplateService.saveCouponTemplateJD(uid, template); - } else { - shareGoodsTextTemplateService.isCommonTemplateRightJD(template); - shareGoodsTextTemplateService.saveCommonTemplateJD(uid, template); - out.print(JsonUtil.loadTrueResult("")); - } + shareGoodsTextTemplateService.saveTemplateJD(uid, template); } else if (goodsType == Constant.SOURCE_TYPE_PDD) { - if (hasCoupon) { - shareGoodsTextTemplateService.isCouponTemplateRightPDD(template); - shareGoodsTextTemplateService.saveCouponTemplatePDD(uid, template); - } else { - shareGoodsTextTemplateService.isCommonTemplateRightPDD(template); - shareGoodsTextTemplateService.saveCommonTemplatePDD(uid, template); - out.print(JsonUtil.loadTrueResult("")); - } + shareGoodsTextTemplateService.saveTemplatePDD(uid, template); } } catch (ShareGoodsTextTemplateException e) { out.print(JsonUtil.loadFalseResult(5, e.getMsg())); @@ -1475,27 +1367,11 @@ } if (goodsType == Constant.SOURCE_TYPE_TAOBAO) { - if (hasCoupon) { - if (tljId != null) { - shareGoodsTextTemplateService.resetTaoLijinTemplate(uid); - } else { - shareGoodsTextTemplateService.resetCouponTemplate(uid); - } - } else { - shareGoodsTextTemplateService.resetCommonTemplate(uid); - } + shareGoodsTextTemplateService.resetCommonTemplate(uid); } else if (goodsType == Constant.SOURCE_TYPE_JD) { - if (hasCoupon) { - shareGoodsTextTemplateService.resetCouponTemplateJD(uid); - } else { - shareGoodsTextTemplateService.resetCommonTemplateJD(uid); - } + shareGoodsTextTemplateService.resetCommonTemplateJD(uid); } else if (goodsType == Constant.SOURCE_TYPE_PDD) { - if (hasCoupon) { - shareGoodsTextTemplateService.resetCouponTemplatePDD(uid); - } else { - shareGoodsTextTemplateService.resetCommonTemplatePDD(uid); - } + shareGoodsTextTemplateService.resetCommonTemplatePDD(uid); } if (goodsId != null) { @@ -1556,7 +1432,7 @@ } } - ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(), + ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion()); Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()) @@ -1615,29 +1491,26 @@ out.print(JsonUtil.loadTrueResult(data)); } - - @RequestMapping(value = "getShareTextQuick", method = RequestMethod.POST) - public void getShareTextQuick(AcceptData acceptData, Long goodsId, Integer goodsType, - Long uid, PrintWriter out) { + public void getShareTextQuick(AcceptData acceptData, Long goodsId, Integer goodsType, Long uid, PrintWriter out) { if (uid == null) { out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�")); return; } - + if (goodsType == null || goodsId == null) { out.print(JsonUtil.loadFalseResult(1, "璇蜂紶閫掓纭殑鍟嗗搧淇℃伅")); return; } - + GoodsDetailVO goodsDetail = null; - ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(), + ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion()); paramsDTO.setBaseFanliRate(hongBaoManageService.getBaseFanliRate()); - + if (goodsType == Constant.SOURCE_TYPE_TAOBAO) { TaoBaoGoodsBrief goods = taoBaoGoodsCacheUtil.getCommonTaoBaoGoodsInfo(goodsId); - if (goods == null){ + if (goods == null) { try { goods = redisManager.getTaoBaoGoodsBrief(goodsId); } catch (TaobaoGoodsDownException e) { @@ -1657,29 +1530,30 @@ if (goods != null) { goodsDetail = GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO); } - } - + } + if (goodsDetail == null) { out.print(JsonUtil.loadFalseResult(1, "璇ュ晢鍝佸凡涓嬫灦")); return; } - + 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("鎺ㄨ崘璇�:[鎺ㄨ崘璇璢", ""); } - + if (goodsDetail.isHasCoupon()) { - template = template.replace("[鍒搁潰棰漖", String.format("婊�%s鍏冨噺%s鍏�", - MoneyBigDecimalUtil.getWithNoZera(goodsDetail.getCouponInfo().getStartFee()).toString(), - MoneyBigDecimalUtil.getWithNoZera(goodsDetail.getCouponInfo().getAmount()).toString())); + template = template.replace("[鍒搁潰棰漖", + String.format("婊�%s鍏冨噺%s鍏�", + MoneyBigDecimalUtil.getWithNoZera(goodsDetail.getCouponInfo().getStartFee()).toString(), + MoneyBigDecimalUtil.getWithNoZera(goodsDetail.getCouponInfo().getAmount()).toString())); } else { template = template.replace("浼樻儬鍒�:[鍒搁潰棰漖", ""); } - + JSONObject data = new JSONObject(); data.put("description", template); out.print(JsonUtil.loadTrueResult(data)); -- Gitblit v1.8.0