yujian
2019-07-16 c04327c1e6271e10c6d4f13ebb53438f6edca50e
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java
@@ -268,14 +268,14 @@
    * @param out
    */
   @RequestMapping(value = "createShareInfo")
   public void createShareInfo(AcceptData acceptData, Long uid, Long auctionId, String source, Integer totalNum,
   public void createShareInfo(AcceptData acceptData, Long uid, Long goodsId, String source, Integer totalNum,
         Integer goodsType, HttpServletRequest request, PrintWriter out) {
      if (uid == null || uid <= 0) {
         out.print(JsonUtil.loadFalseResult(1, "用户ID不能为空"));
         return;
      }
      
      if (auctionId == null || auctionId <= 0) {
      if (goodsId == null || goodsId <= 0) {
         out.print(JsonUtil.loadFalseResult(2, "商品ID不能为空"));
         return;
      }
@@ -292,11 +292,11 @@
      
      if (goodsType == Constant.SOURCE_TYPE_JD) {
         // 京东 
         createJDShare(acceptData, uid, auctionId, source, out);
         createJDShare(acceptData, uid, goodsId, source, out);
         return;
      } else if (goodsType == Constant.SOURCE_TYPE_PDD) {
         // 拼多多 
         createPDDShare(acceptData, uid, auctionId, source, out);
         createPDDShare(acceptData, uid, goodsId, source, out);
         return;
      }
      
@@ -308,17 +308,17 @@
         relationId = extraInfo.getRelationId();
      
      if (source != null && "taolijin".equals(source)) {
         createTaoLijin(uid, auctionId, totalNum, relationId, request, out);
         createTaoLijin(uid, goodsId, totalNum, relationId, request, out);
         return;
      }
      
      try {
         TaoBaoLink taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(uid, auctionId, relationId);
         TaoBaoLink taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(uid, goodsId, relationId);
         
         JSONObject data = new JSONObject();
         String url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(),
               Constant.systemCommonConfig.getShareGoodsPagePath(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY),
               auctionId + "");
               goodsId + "");
         
         String shortLink = HttpUtil.getShortLink(url);
         if (!StringUtil.isNullOrEmpty(shortLink)) {
@@ -327,8 +327,7 @@
         data.put("clickUrl", url);
         data.put("token", taoBaoLink.getTaoToken());
         data.put("rule",
               "http://apph5.yeshitv.com/apppage/all_help_content.html?id=148&from=singlemessage&isappinstalled=0");
         data.put("rule", configService.get("share_rule_link_tb"));
         data.put("pictUrl", TbImgUtil.getTBSizeImg(taoBaoLink.getGoods().getPictUrl(), 500));
         String shareText = "";
@@ -377,7 +376,7 @@
         data.put("shareMoney", "¥" + shareMoney.toString());
         try {
            ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsDetail(uid, auctionId, Constant.SOURCE_TYPE_TAOBAO);
            ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsDetail(uid, goodsId, Constant.SOURCE_TYPE_TAOBAO);
            data.put("shareId", shareRecord.getRedisKey());
         } catch (Exception e) {
            try {
@@ -415,14 +414,14 @@
         });
         return;
      } catch (ShareGoodsException e) {
         LogHelper.errorDetailInfo(e, "分享出错:uid:"+uid+"auctionId:"+auctionId, "");
         LogHelper.errorDetailInfo(e, "分享出错:uid:"+uid+"auctionId:"+goodsId, "");
         // 分享出错报警
         try {
            monitorService.addClientAPIMonitor(MonitorFactory.createClientAPI(request, e.getCode(), 0, "分享出错"));
         } catch (Exception e1) {
         }
         out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMessage()));
         businessEmergent110Service.shareTaoBaoGoodsError(StringUtil.Md5(auctionId + ""));
         businessEmergent110Service.shareTaoBaoGoodsError(StringUtil.Md5(goodsId + ""));
      }
   }
   
@@ -491,8 +490,7 @@
            }
         }
         data.put("token", taoBaoLink.getTaoToken());
         data.put("rule", "http://apph5.yeshitv.com/apppage/all_help_content.html?id=148&from=singlemessage&isappinstalled=0");
         data.put("rule", configService.get("share_rule_link_tb"));
         data.put("pictUrl", TbImgUtil.getTBSizeImg(taoBaoLink.getGoods().getPictUrl(), 500));
         // 无券
@@ -620,27 +618,27 @@
               Constant.systemCommonConfig.getShareGoodsPagePath(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY),
               goodsId + "", Constant.SOURCE_TYPE_JD);
         
         // 券短连接
         String shortLink = HttpUtil.getShortLink(url);
         if (!StringUtil.isNullOrEmpty(shortLink)) {
            url = shortLink;
         }
         data.put("clickUrl", url);
         // 帮助中心-介绍
         String rule = "http://apph5.yeshitv.com/apppage/all_help_content.html?id=148&from=singlemessage&isappinstalled=0";
         data.put("rule", rule);
         data.put("rule", configService.get("share_rule_link_jd"));
         data.put("pictUrl", jdGoods.getPicUrl());
         String shareText = "";
         
         String shopType = "京东价";
         // 无券
         // 分享模板
         JDCouponInfo couponInfo = jdGoods.getCouponInfo();
         if (couponInfo == null) {
            String text = shareGoodsTextTemplateService.getCommonTemplate(uid);
            if (StringUtil.isNullOrEmpty(text))
            if (StringUtil.isNullOrEmpty(text)) {
               text = configService.get("goods_share_text_nocoupon");
            }
            shareText = text.replace("{标题}", jdGoods.getSkuName()).replace("{商品原价}",
                  MoneyBigDecimalUtil.getWithNoZera(jdGoods.getPrice()) + "");
         } else// 有券
@@ -659,6 +657,8 @@
               .replace("{月销量}", JDUtil.getSaleCount(jdGoods.getInOrderCount30Days()))
               .replace("{领券短链}", shortLink).replace("{淘口令}", null);
         data.put("shareText", shareText);
         String descText = shareText.replace(jdGoods.getSkuName(), "").trim();
         if (descText.startsWith("\\r\\n"))
            descText = descText.substring(0);
@@ -669,7 +669,7 @@
         int p = (int) (array.size() * Math.random());
         if (p < array.size())
            data.put("notifyPicture", array.optString(p));
         data.put("notifyDesc", configService.get("goods_share_notify"));
         data.put("notifyDesc", configService.get("goods_share_notify_jd"));
         // 添加分享记录
         BigDecimal shareRate = hongBaoManageService.getShareRate();
@@ -731,7 +731,6 @@
         out.print(JsonUtil.loadFalseResult(1, "该商品已下架"));
         return;
      }
      JSONObject data = new JSONObject();
      String url = String.format("http://%s%s?uid=%s&id=%s&appType=flq&goodsType=%s", configService.getH5Host(),
@@ -745,8 +744,7 @@
      data.put("clickUrl", url);
      // 帮助中心-介绍
      String rule = "http://apph5.yeshitv.com/apppage/all_help_content.html?id=148&from=singlemessage&isappinstalled=0";
      data.put("rule", rule);
      data.put("rule", configService.get("share_rule_link_pdd"));
      data.put("pictUrl", goods.getGoodsImageUrl());
      String shareText = "";
@@ -786,7 +784,8 @@
      int p = (int) (array.size() * Math.random());
      if (p < array.size())
         data.put("notifyPicture", array.optString(p));
      data.put("notifyDesc", configService.get("goods_share_notify"));
      data.put("notifyDesc", configService.get("goods_share_notify_pdd"));
      // 添加分享记录
      BigDecimal shareRate = hongBaoManageService.getShareRate();