yujian
2020-06-09 554de444b87aab5f93cb1593a8095612cf9479a7
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java
@@ -24,8 +24,13 @@
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.dto.suning.SuningGoodsImg;
import com.yeshi.fanli.dto.suning.SuningGoodsInfo;
import com.yeshi.fanli.dto.vip.VIPConvertResultDTO;
import com.yeshi.fanli.dto.vip.goods.VIPGoodsInfo;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.share.UserShareGoodsGroup;
import com.yeshi.fanli.entity.bus.share.UserShareGoodsHistory;
@@ -34,8 +39,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 +60,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;
@@ -79,9 +85,13 @@
import com.yeshi.fanli.util.jd.JDUtil;
import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil;
import com.yeshi.fanli.util.suning.SuningApiUtil;
import com.yeshi.fanli.util.suning.SuningUtil;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
import com.yeshi.fanli.util.taobao.TaoLiJinUtil;
import com.yeshi.fanli.util.vipshop.VipShopApiUtil;
import com.yeshi.fanli.util.vipshop.VipShopUtil;
import com.yeshi.fanli.vo.goods.GoodsDetailVO;
import com.yeshi.fanli.vo.goods.ShareGoodsCommentChoiceInfo;
import com.yeshi.fanli.vo.goods.ShareInfoVO;
@@ -104,6 +114,9 @@
   @Resource
   private HongBaoManageService hongBaoManageService;
   @Resource
   private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService;
   @Resource
   private MonitorService monitorService;
@@ -177,7 +190,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;
   }
@@ -197,7 +210,7 @@
    * @param out
    */
   @RequestMapping(value = "createShareInfo")
   public void createShareInfo(AcceptData acceptData, Long uid, Long goodsId, String source, Integer totalNum,
   public void createShareInfo(AcceptData acceptData, Long uid, String goodsId, String source, Integer totalNum,
         Integer goodsType, Boolean needGoods, HttpServletRequest request, PrintWriter out) {
      if (uid == null || uid <= 0) {
         out.print(JsonUtil.loadFalseResult(1, "用户ID不能为空"));
@@ -220,47 +233,64 @@
         return;
      }
      if (goodsId == null || goodsId <= 0) {
      if (goodsId == null) {
         out.print(JsonUtil.loadFalseResult(2, "商品ID不能为空"));
         return;
      }
      // 淘宝
      if (goodsType == null || goodsType == Constant.SOURCE_TYPE_TAOBAO) {
         createTaoBaoShare(acceptData, uid, goodsId, totalNum, source, needGoods, request, out);
         createTaoBaoShare(acceptData, uid, Long.parseLong(goodsId), totalNum, source, needGoods, request, out);
         return;
      }
      // 京东
      if (goodsType == Constant.SOURCE_TYPE_JD) {
         createJDShare(acceptData, uid, goodsId, source, needGoods, out);
         createJDShare(acceptData, uid, Long.parseLong(goodsId), source, needGoods, out);
         return;
      }
      // 拼多多
      if (goodsType == Constant.SOURCE_TYPE_PDD) {
         createPDDShare(acceptData, uid, goodsId, source, needGoods, out);
         createPDDShare(acceptData, uid, Long.parseLong(goodsId), source, needGoods, out);
         return;
      }
      // 唯品会
      if (goodsType == Constant.SOURCE_TYPE_VIP) {
         createVIPShare(acceptData, uid, Long.parseLong(goodsId), source, needGoods, out);
         return;
      }
      // 苏宁
      if (goodsType == Constant.SOURCE_TYPE_SUNING) {
         createSuningShare(acceptData, uid, goodsId, source, needGoods, out);
         return;
      }
   }
   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");
      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;
   }
   /**
    * 创建淘宝分享信息
    * 
@@ -495,7 +525,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);
         }
@@ -534,62 +564,45 @@
         }
         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_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));
@@ -625,15 +638,18 @@
         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());
            if (StringUtil.isNullOrEmpty(goods.getDescription())) {
            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("销量:[销量]", "");
@@ -643,27 +659,32 @@
            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("【券后价】[券后价]元", "");
               recommendText = recommendText.replace("优惠券:[券面额]元", "");
            } else {
               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(deleteBlankLine(commentText));
         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), false)));
         out.print(JsonUtil.loadTrueResult(
               JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create().toJson(shareInfo)));
@@ -731,8 +752,10 @@
         couponUrl = couponInfo.getLink();
      }
      String materialId = "https://item.jd.com/" + goodsId + ".html";
      String jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "",
            uid + "");
      String jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "", uid + "");
      if (StringUtil.isNullOrEmpty(jumpLink)) {
         jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, JDApiUtil.POSITION_SHARE + "", uid + "");
      }
      ShareInfoVO shareInfo = new ShareInfoVO();
      shareInfo.setClickUrl(jumpLink);
@@ -742,30 +765,16 @@
      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())));
      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();
@@ -808,31 +817,35 @@
      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());
         // 无推荐语
         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"));
         }
         String quickCommentText = configService.get(ConfigKeyEnum.quickShareJDCommentText.getKey());
         commentText = quickCommentText.replace("[原价]", jdGoods.getPrice().toString());
         commentText = commentText.replace("[链接]", jumpLink);
         if (couponInfo == null) {
            commentText = commentText.replace("领券抢购", "抢购");
            commentText = commentText.replace("【券后价】[券后价]元", "");
         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());
            recommendText = recommendText.replace("[券面额]",
                  BigDecimalUtil.getWithNoZera(JDUtil.getShowCouponInfo(jdGoods).getDiscount()).toString());
         }
         commentText = commentText.replace("[链接]", jumpLink);
      } else {
         commentText = shareInfo.getShareText();
         recommendText = shareInfo.getDescText();
@@ -842,11 +855,14 @@
      // 设置评论文本选项
      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)));
   final String jumpLinkNew=jumpLink;
      // 异步操作
      final JDGoods goods = jdGoods;
      com.yeshi.fanli.util.ThreadUtil.run(new Runnable() {
@@ -863,7 +879,7 @@
            history.setQuanLink(null);
            history.setGoodsId(goodsId);
            history.setPostPicture(goods.getPicUrl());
            history.setShareImg(jumpLink);
            history.setShareImg(jumpLinkNew);
            List<String> imgList = goods.getImageList();
            if (imgList == null) {
@@ -874,12 +890,10 @@
         }
      });
   }
   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");
   }
   /**
    * 拼多多分享
@@ -917,33 +931,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))));
      }
      // 创建口令
      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();
@@ -1028,8 +1027,8 @@
      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)));
@@ -1065,6 +1064,312 @@
   }
   /**
    * 唯品会分享
    * @Title: createVIPShare
    * @Description:
    * @param acceptData
    * @param uid
    * @param goodsId
    * @param source
    * @param needGoods
    * @param out
    * void 返回类型
    * @throws
    */
   public void createVIPShare(AcceptData acceptData, Long uid, Long goodsId, String source, boolean needGoods,
         PrintWriter out) {
      VIPGoodsInfo goods = VipShopApiUtil.getGoodsDetail(goodsId + "");
      if (goods == null) {
         out.print(JsonUtil.loadFalseResult(1, "该商品已下架"));
         return;
      }
      VIPConvertResultDTO jumpLink = VipShopApiUtil.convertLink(goodsId + "", VipShopUtil.getShareChanTag(uid));
      ShareInfoVO shareInfo = new ShareInfoVO();
      shareInfo.setClickUrl(jumpLink.getUrl());
      shareInfo.setWxErCode(jumpLink.getUrl());
      shareInfo.setCommentTexts(new ArrayList<>());
      shareInfo.setRule(configService.get(ConfigKeyEnum.shareRuleLinkVIP.getKey()));
      shareInfo.setPictUrl(goods.getGoodsThumbUrl());
      if (needGoods) {
         shareInfo
               .setGoodsInfo(GoodsDetailVOFactory.convertVIPGoods(goods,
                     new ConfigParamsDTO(hongBaoManageService.getFanLiRate(),
                           hongBaoManageService.getShareRate(), Constant.MAX_REWARD_RATE,
                           hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP))));
      }
      String template = shareGoodsTextTemplateService.getTextTemplateByVIP(uid);
      String shareText = shareGoodsTextTemplateService.createContentVIP(template, goods, jumpLink.getUrl());
      shareInfo.setShareText(shareText);
      String descText = shareText.replace(goods.getGoodsName(), "").trim();
      if (descText.startsWith("\\r\\n")) {
         descText = descText.substring(0);
      }
      shareInfo.setDescText(descText);
      //
      String imgs = configService.getByVersion(ConfigKeyEnum.goodsShareNotifyImgsVIP.getKey(), acceptData.getPlatform(),
            Integer.parseInt(acceptData.getVersion()));
      shareInfo.setNotifyPicture(imgs);
      shareInfo.setNotifyPictureNew(imgs);
      shareInfo.setNotifyDesc(configService.get(ConfigKeyEnum.goodsShareNotifyVIP.getKey()));
      // 添加分享记录
      BigDecimal shareRate = hongBaoManageService.getShareRate();
      BigDecimal shareMoney = VipShopUtil.getGoodsFanLiMoney(goods, shareRate);
      shareInfo.setShareMoney("¥" + shareMoney.toString());
      try {
         ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsDetail(uid, goodsId,
               Constant.SOURCE_TYPE_VIP, false);
         shareInfo.setShareId(shareRecord.getRedisKey());
      } catch (Exception e) {
         try {
            LogHelper.errorDetailInfo(e);
         } catch (Exception e1) {
            e1.printStackTrace();
         }
      }
      String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
      String commentText = "";
      String recommendText = "";
      String qtemplate = configService.get(ConfigKeyEnum.quickShareGoodsText.getKey());
      recommendText = qtemplate.replace("[商品标题]", goods.getGoodsName());
      recommendText = recommendText.replace("销量:[销量]", "");
      recommendText = recommendText.replace("推荐理由:[推荐语]", "");
      recommendText = recommendText.replace("优惠券:[券面额]元", "");
      String quickCommentText = configService.get(ConfigKeyEnum.quickShareVIPCommentText.getKey());
      commentText = quickCommentText.replace("[在售价]", BigDecimalUtil.getWithNoZera(new BigDecimal(goods.getMarketPrice())).toString());
      commentText = commentText.replace("[链接]", jumpLink.getUrl());
      commentText = commentText.replace("[折扣价]", "" +MoneyBigDecimalUtil.getWithNoZera(new BigDecimal(goods.getVipPrice())));
      shareInfo.setRecommendText(deleteBlankLine(recommendText));
      shareInfo.setCommentText(deleteBlankLine(commentText));
      // 设置评论文本选项
      shareInfo.setCommentTextChoiceList(getCommentChoiceList(null, shareInfo.getCommentText(), inviteCode,
            VipShopUtil.getGoodsFanLiMoney(goods, hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP))));
      out.print(JsonUtil.loadTrueResult(
            JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create().toJson(shareInfo)));
      // 异步操作
      com.yeshi.fanli.util.ThreadUtil.run(new Runnable() {
         @Override
         public void run() {
            // 异步操作 添加分享记录
            UserShareGoodsHistory history = new UserShareGoodsHistory();
            history.setUser(new UserInfo(uid));
            history.setHongbao(shareMoney);
            history.setCreateTime(new Date());
            history.setGoodsType(Constant.SOURCE_TYPE_VIP);
            history.setTkCode(null);
            history.setLink(null);
            history.setQuanLink(null);
            history.setGoodsId(goodsId);
            history.setPostPicture(goods.getGoodsThumbUrl());
            history.setShareImg(jumpLink.getUrl());
            List<String> imgList = goods.getGoodsDetailPictures();
            if (imgList == null) {
               imgList = new ArrayList<>();
            }
            if (imgList.size() > 10) {
               imgList = imgList.subList(0, 9);
            }
            history.setPictures(JsonUtil.getGson().toJson(imgList));
            shareGoodsService.addShareGoodsHistory(history);
         }
      });
   }
   /**
    * 苏宁易购分享
    * @Title: createSuningShare
    * @Description:
    * @param acceptData
    * @param uid
    * @param goodsId
    * @param source
    * @param needGoods
    * @param out
    * void 返回类型
    * @throws
    */
   public void createSuningShare(AcceptData acceptData, Long uid, String goodsId, String source, boolean needGoods,
         PrintWriter out) {
      String[] sts = SuningUtil.getGoodsIdDetail(goodsId);
      SuningGoodsInfo goods = SuningApiUtil.getGoodsDetail(sts[1], sts[0]);
      if (goods == null) {
         out.print(JsonUtil.loadFalseResult(1, "该商品已下架"));
         return;
      }
      String couponLink = goods.getCouponInfo().getCouponUrl();
      String jumpLink = SuningApiUtil.convertLink(SuningUtil.getProductUrl(sts[0], sts[1]),
            StringUtil.isNullOrEmpty(couponLink) ? null : couponLink, SuningApiUtil.PID_SHARE, uid + "");
      ShareInfoVO shareInfo = new ShareInfoVO();
      shareInfo.setClickUrl(jumpLink);
      shareInfo.setWxErCode(jumpLink);
      shareInfo.setCommentTexts(new ArrayList<>());
      shareInfo.setRule(configService.get(ConfigKeyEnum.shareRuleLinkSuning.getKey()));
      if (goods.getCommodityInfo().getPictureUrl() != null && goods.getCommodityInfo().getPictureUrl().size() > 0)
         shareInfo.setPictUrl(goods.getCommodityInfo().getPictureUrl().get(0).getPicUrl());
      if (needGoods) {
         shareInfo
               .setGoodsInfo(GoodsDetailVOFactory.convertSuningGoods(goods,
                     new ConfigParamsDTO(hongBaoManageService.getFanLiRate(),
                           hongBaoManageService.getShareRate(), Constant.MAX_REWARD_RATE,
                           hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP))));
      }
      String template = shareGoodsTextTemplateService.getTextTemplateBySuNing(uid);
      //String shareText = shareGoodsTextTemplateService.createQuickShareTextSuNing(template, goods, jumpLink);
      String shareText = shareGoodsTextTemplateService.createCommonShareTextSuNing(template, goods, jumpLink);
      shareInfo.setShareText(shareText);
      String descText = shareText.replace(goods.getCommodityInfo().getCommodityName(), "").trim();
      if (descText.startsWith("\\r\\n")) {
         descText = descText.substring(0);
      }
      shareInfo.setDescText(descText);
      //
      String imgs = configService.getByVersion(ConfigKeyEnum.goodsShareNotifyImgs.getKey(), acceptData.getPlatform(),
            Integer.parseInt(acceptData.getVersion()));
      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.goodsShareNotifySuning.getKey()));
      // 添加分享记录
      BigDecimal shareRate = hongBaoManageService.getShareRate();
      BigDecimal shareMoney = SuningUtil.getGoodsFanLiMoney(goods, shareRate);
      shareInfo.setShareMoney("¥" + shareMoney.toString());
      try {
         ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsDetail(uid,
               Long.parseLong(sts[1]), Constant.SOURCE_TYPE_SUNING, false);
         shareInfo.setShareId(shareRecord.getRedisKey());
      } catch (Exception e) {
         try {
            LogHelper.errorDetailInfo(e);
         } catch (Exception e1) {
            e1.printStackTrace();
         }
      }
      String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
      String commodityPrice = goods.getCommodityInfo().getCommodityPrice();
      if (StringUtil.isNullOrEmpty(commodityPrice)) {
         commodityPrice = goods.getCommodityInfo().getSnPrice();
      }
      String commentText = "";
      String recommendText = "";
      String qtemplate = configService.get(ConfigKeyEnum.quickShareGoodsText.getKey());
      recommendText = qtemplate.replace("[商品标题]", goods.getCommodityInfo().getCommodityName());
      recommendText = recommendText.replace("推荐理由:[推荐语]", "");
      String quickCommentText = configService.get(ConfigKeyEnum.quickShareSuNingCommentText.getKey());
      commentText = quickCommentText.replace("[原价]", BigDecimalUtil.getWithNoZera(new BigDecimal(commodityPrice)).toString());
      commentText = commentText.replace("[链接]", jumpLink);
      String salesCountMidea = "";
      Integer count = Integer.parseInt(goods.getCommodityInfo().getMonthSales());
      if (count < 10000) {
         salesCountMidea = count + "";
      } else {
         double sales = count;
         salesCountMidea = String.format("%.1f", sales / 10000);
         salesCountMidea = salesCountMidea + "万";
      }
      if (StringUtil.isNullOrEmpty(salesCountMidea) || salesCountMidea.equals("0")) {
         recommendText = recommendText.replace("销量:[销量]", "");
      } else {
         recommendText = recommendText.replace("[销量]", salesCountMidea.replace("万", "w"));
      }
      if (goods.getCouponInfo() != null && !StringUtil.isNullOrEmpty(goods.getCouponInfo().getCouponUrl())) {// 有券
         BigDecimal amount = new BigDecimal(goods.getCouponInfo().getCouponValue());
         BigDecimal startFee = new BigDecimal(goods.getCouponInfo().getBounsLimit());
         BigDecimal zkPrice = new BigDecimal(commodityPrice);
         BigDecimal couponPrice  = zkPrice;
         if (zkPrice.compareTo(startFee) >= 0) {
            couponPrice = zkPrice.subtract(amount);
         }
         recommendText = recommendText.replace("[券面额]",
               BigDecimalUtil.getWithNoZera(new BigDecimal(goods.getCouponInfo().getCouponValue())).toString());
         commentText = commentText.replace("[券后价]",BigDecimalUtil.getWithNoZera(couponPrice).toString());
      } else {
         commentText = commentText.replace("领券抢购", "抢购");
         commentText = commentText.replace("【券后价】[券后价]元", "");
         recommendText = recommendText.replace("优惠券:[券面额]元", "");
      }
      shareInfo.setRecommendText(deleteBlankLine(recommendText));
      shareInfo.setCommentText(deleteBlankLine(commentText));
      // 设置评论文本选项
      shareInfo.setCommentTextChoiceList(getCommentChoiceList(null, shareInfo.getCommentText(), inviteCode,
            SuningUtil.getGoodsFanLiMoney(goods, hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP))));
      out.print(JsonUtil.loadTrueResult(
            JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create().toJson(shareInfo)));
      // 异步操作
      com.yeshi.fanli.util.ThreadUtil.run(new Runnable() {
         @Override
         public void run() {
            // 异步操作 添加分享记录
            UserShareGoodsHistory history = new UserShareGoodsHistory();
            history.setUser(new UserInfo(uid));
            history.setHongbao(shareMoney);
            history.setCreateTime(new Date());
            history.setGoodsType(Constant.SOURCE_TYPE_VIP);
            history.setTkCode(null);
            history.setLink(null);
            history.setQuanLink(null);
            history.setGoodsId(Long.parseLong(sts[1]));
            if (goods.getCommodityInfo().getPictureUrl() != null
                  && goods.getCommodityInfo().getPictureUrl().size() > 0)
               history.setPostPicture(goods.getCommodityInfo().getPictureUrl().get(0).getPicUrl());
            history.setShareImg(jumpLink);
            List<SuningGoodsImg> pictureList = goods.getCommodityInfo().getPictureUrl();
            List<String> imgList = new ArrayList<>();
            if (pictureList != null) {
               for (SuningGoodsImg gi : pictureList)
                  imgList.add(gi.getPicUrl());
            }
            history.setPictures(JsonUtil.getGson().toJson(imgList));
            shareGoodsService.addShareGoodsHistory(history);
         }
      });
   }
   /**
    * 预览分享模板
    * 
    * @param acceptData
@@ -1075,7 +1380,7 @@
    * @param out
    */
   @RequestMapping(value = "viewShareTextTemplate", method = RequestMethod.POST)
   public void viewShareTextTemplate(AcceptData acceptData, Long uid, String template, Integer goodsType, Long goodsId,
   public void viewShareTextTemplate(AcceptData acceptData, Long uid, String template, Integer goodsType, String goodsId,
         Long tljId, Boolean hasCoupon, PrintWriter out) {
      if (uid == null) {
         out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
@@ -1087,23 +1392,28 @@
         return;
      }
      if (goodsType == null || goodsType > 3 || goodsType < 1) {
         out.print(JsonUtil.loadFalseResult(3, "平台类型不正确"));
         return;
      }
      if (goodsType == Constant.SOURCE_TYPE_TAOBAO) {
         createTaoBaoViewText(goodsType, uid, template, goodsId, tljId, hasCoupon, out);
         createTaoBaoViewText(goodsType, uid, template,Long.parseLong(goodsId) , tljId, hasCoupon, out);
         return;
      }
      if (goodsType == Constant.SOURCE_TYPE_JD) {
         createJDViewText(goodsType, uid, template, goodsId, hasCoupon, out);
         createJDViewText(goodsType, uid, template, Long.parseLong(goodsId), hasCoupon, out);
         return;
      }
      if (goodsType == Constant.SOURCE_TYPE_PDD) {
         createPDDViewText(goodsType, uid, template, goodsId, hasCoupon, out);
         createPDDViewText(goodsType, uid, template, Long.parseLong(goodsId), hasCoupon, out);
         return;
      }
      if (goodsType == Constant.SOURCE_TYPE_VIP) {
         createVIPViewText(goodsType, uid, template, Long.parseLong(goodsId), hasCoupon, out);
         return;
      }
      if (goodsType == Constant.SOURCE_TYPE_SUNING) {
         createSuNingViewText(goodsType, uid, template, goodsId, hasCoupon, out);
         return;
      }
   }
@@ -1119,7 +1429,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)
@@ -1138,49 +1448,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;
         }
      // 校验模板是否正确
      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());
@@ -1201,8 +1475,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));
@@ -1219,7 +1492,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) {
@@ -1232,23 +1505,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;
@@ -1260,8 +1521,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));
@@ -1278,7 +1538,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) {
@@ -1291,23 +1551,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连接
@@ -1320,18 +1568,90 @@
      String shortLink = PinDuoDuoApiUtil.getPromotionUrl(goodsId, PinDuoDuoApiUtil.PID_SHARE + "", uid + "");
      // 创建口令
      String token = PinDuoDuoApiUtil.createGenerate(goodsId);
      // // 创建口令
      // 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);
      out.print(JsonUtil.loadTrueResult(data));
   }
   /**
    * 唯品会分享
    * @param goodsType
    * @param uid
    * @param template
    * @param goodsId
    * @param hasCoupon
    * @param out
    */
   private void createVIPViewText(Integer goodsType, Long uid, String template, Long goodsId, Boolean hasCoupon,
         PrintWriter out) {
      VIPGoodsInfo goods = VipShopApiUtil.getGoodsDetail(goodsId + "");
      if (goods == null) {
         out.print(JsonUtil.loadFalseResult(4, "商品已下架"));
         return;
      }
      if (StringUtil.isNullOrEmpty(template)) {
         template = getShareTemplate(goodsType, uid, hasCoupon, null);
      }
      // 校验券模板是否正确
      try {
         shareGoodsTextTemplateService.verifyRightVIP(template);
      } catch (ShareGoodsTextTemplateException e) {
         out.print(JsonUtil.loadFalseResult(5, e.getMsg()));
         return;
      }
      VIPConvertResultDTO jumpLink = VipShopApiUtil.convertLink(goodsId + "", VipShopUtil.getShareChanTag(uid));
      // 生成分享内容
      String content = shareGoodsTextTemplateService.createContentVIP(template, goods, jumpLink.getUrl());
      JSONObject data = new JSONObject();
      data.put("content", content);
      out.print(JsonUtil.loadTrueResult(data));
   }
   private void createSuNingViewText(Integer goodsType, Long uid, String template, String goodsId, Boolean hasCoupon,
         PrintWriter out) {
      String[] ids = SuningUtil.getGoodsIdDetail(goodsId);
      SuningGoodsInfo goods = SuningApiUtil.getGoodsDetail(ids[1], ids[0]);
      if (goods == null) {
         out.print(JsonUtil.loadFalseResult(4, "商品已下架"));
         return;
      }
      if (StringUtil.isNullOrEmpty(template)) {
         template = getShareTemplate(goodsType, uid, hasCoupon, null);
      }
      // 校验券模板是否正确
      try {
         shareGoodsTextTemplateService.verifyRightSuNing(template);
      } catch (ShareGoodsTextTemplateException e) {
         out.print(JsonUtil.loadFalseResult(5, e.getMsg()));
         return;
      }
      String couponLink = goods.getCouponInfo().getCouponUrl();
      String jumpLink = SuningApiUtil.convertLink(SuningUtil.getProductUrl(ids[0], ids[1]),
            StringUtil.isNullOrEmpty(couponLink) ? null : couponLink, SuningApiUtil.PID_SHARE, uid + "");
      // 生成普通分享内容
      String content = shareGoodsTextTemplateService.createCommonShareTextSuNing(template, goods, jumpLink);
      JSONObject data = new JSONObject();
      data.put("content", content);
      out.print(JsonUtil.loadTrueResult(data));
   }
   /**
    * 获取分享模板
    * 
@@ -1343,58 +1663,15 @@
   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);
      } else if (goodsType == Constant.SOURCE_TYPE_VIP) {
         template = shareGoodsTextTemplateService.getTextTemplateByVIP(uid);
      } else if (goodsType == Constant.SOURCE_TYPE_SUNING) {
         template = shareGoodsTextTemplateService.getTextTemplateBySuNing(uid);
      }
      return template;
   }
@@ -1433,11 +1710,6 @@
    */
   @RequestMapping(value = "getShareTextTemplateRules", method = RequestMethod.POST)
   public void getShareTextTemplateRules(AcceptData acceptData, Integer goodsType, Long tljId, PrintWriter out) {
      if (goodsType == null || goodsType > 3 || goodsType < 1) {
         out.print(JsonUtil.loadFalseResult(3, "平台类型不正确"));
         return;
      }
      if (goodsType == Constant.SOURCE_TYPE_TAOBAO) {
         if (tljId != null) {
            out.print(
@@ -1449,6 +1721,10 @@
         out.print(JsonUtil.loadTrueResult(configService.get(ConfigKeyEnum.shareGoodsTemplateRulesJD.getKey())));
      } else if (goodsType == Constant.SOURCE_TYPE_PDD) {
         out.print(JsonUtil.loadTrueResult(configService.get(ConfigKeyEnum.shareGoodsTemplateRulesPDD.getKey())));
      } else if (goodsType == Constant.SOURCE_TYPE_VIP) {
         out.print(JsonUtil.loadTrueResult(configService.get(ConfigKeyEnum.shareGoodsTemplateRulesVIP.getKey())));
      } else if (goodsType == Constant.SOURCE_TYPE_SUNING) {
         out.print(JsonUtil.loadTrueResult(configService.get(ConfigKeyEnum.shareGoodsTemplateRulesSuNing.getKey())));
      }
   }
@@ -1469,46 +1745,17 @@
         return;
      }
      if (goodsType == null || goodsType > 3 || goodsType < 1) {
         out.print(JsonUtil.loadFalseResult(3, "平台类型不正确"));
         return;
      }
      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);
         } else if (goodsType == Constant.SOURCE_TYPE_VIP) {
            shareGoodsTextTemplateService.saveTemplateVIP(uid, template);
         } else if (goodsType == Constant.SOURCE_TYPE_SUNING) {
            shareGoodsTextTemplateService.saveTemplateSuNing(uid, template);
         }
      } catch (ShareGoodsTextTemplateException e) {
         out.print(JsonUtil.loadFalseResult(5, e.getMsg()));
@@ -1527,40 +1774,23 @@
    * @param out
    */
   @RequestMapping(value = "resetShareTextTemplate", method = RequestMethod.POST)
   public void resetShareTextTemplate(AcceptData acceptData, Long uid, Long goodsId, Long tljId, Boolean hasCoupon,
   public void resetShareTextTemplate(AcceptData acceptData, Long uid, String goodsId, Long tljId, Boolean hasCoupon,
         Integer goodsType, PrintWriter out) {
      if (uid == null) {
         out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
         return;
      }
      if (goodsType == null || goodsType > 3 || goodsType < 1) {
         out.print(JsonUtil.loadFalseResult(3, "平台类型不正确"));
         return;
      }
      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);
      } else if (goodsType == Constant.SOURCE_TYPE_VIP) {
         shareGoodsTextTemplateService.resetCommonTemplateVIP(uid);
      } else if (goodsType == Constant.SOURCE_TYPE_SUNING) {
         shareGoodsTextTemplateService.resetCommonTemplateSuNing(uid);
      }
      if (goodsId != null) {
@@ -1588,7 +1818,11 @@
      JSONArray array = new JSONArray();
      JSONObject data = new JSONObject();
      List<UserShareGoodsGroup> list = userShareGoodsGroupService.listByRecordId(recordId);
      boolean notBackSuVip = false;
      if (!VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion()))
         notBackSuVip = true;
      List<UserShareGoodsGroup> list = userShareGoodsGroupService.listByRecordId(recordId, notBackSuVip);
      if (list == null || list.size() == 0) {
         data.put("title", "分享商品");
         data.put("count", 0);
@@ -1621,7 +1855,7 @@
         }
      }
      ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
      ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
            acceptData.getVersion());
      Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
@@ -1681,7 +1915,7 @@
   }
   @RequestMapping(value = "getShareTextQuick", method = RequestMethod.POST)
   public void getShareTextQuick(AcceptData acceptData, Long goodsId, Integer goodsType, Long uid, PrintWriter out) {
   public void getShareTextQuick(AcceptData acceptData, String goodsId, Integer goodsType, Long uid, PrintWriter out) {
      if (uid == null) {
         out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
         return;
@@ -1693,15 +1927,15 @@
      }
      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);
         TaoBaoGoodsBrief goods = taoBaoGoodsCacheUtil.getCommonTaoBaoGoodsInfo(Long.parseLong(goodsId));
         if (goods == null) {
            try {
               goods = redisManager.getTaoBaoGoodsBrief(goodsId);
               goods = redisManager.getTaoBaoGoodsBrief(Long.parseLong(goodsId));
            } catch (TaobaoGoodsDownException e) {
               goods = null;
            }
@@ -1710,14 +1944,25 @@
            goodsDetail = GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO);
         }
      } else if (goodsType == Constant.SOURCE_TYPE_JD) {
         JDGoods goods = jdGoodsCacheUtil.getGoodsInfo(goodsId);
         JDGoods goods = jdGoodsCacheUtil.getGoodsInfo(Long.parseLong(goodsId));
         if (goods != null) {
            goodsDetail = GoodsDetailVOFactory.convertJDGoods(goods, paramsDTO);
         }
      } else if (goodsType == Constant.SOURCE_TYPE_PDD) {
         PDDGoodsDetail goods = pinDuoDuoCacheUtil.getGoodsInfo(goodsId);
         PDDGoodsDetail goods = pinDuoDuoCacheUtil.getGoodsInfo(Long.parseLong(goodsId));
         if (goods != null) {
            goodsDetail = GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO);
         }
      } else if (goodsType == Constant.SOURCE_TYPE_VIP) {
         VIPGoodsInfo goods = VipShopApiUtil.getGoodsDetail(goodsId + "");
         if (goods == null) {
            goodsDetail = GoodsDetailVOFactory.convertVIPGoods(goods, paramsDTO);
         }
      } else if (goodsType == Constant.SOURCE_TYPE_SUNING) {
         String[] ids = SuningUtil.getGoodsIdDetail(goodsId);
         SuningGoodsInfo goods = SuningApiUtil.getGoodsDetail(ids[1], ids[0]);
         if (goods != null) {
            goodsDetail = GoodsDetailVOFactory.convertSuningGoods(goods, paramsDTO);
         }
      }
@@ -1728,7 +1973,7 @@
      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("推荐语:[推荐语]", "");