From 4e4af90184f5fa5b40d87e2d08d9192bfd237ef0 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期五, 30 四月 2021 19:13:58 +0800
Subject: [PATCH] 拼多多备案,京东、拼多多,唯品会,苏宁支持小程序跳转

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java |  119 ++++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 93 insertions(+), 26 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
index 7e0797b..baf7cdc 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
@@ -1,7 +1,10 @@
 package com.yeshi.fanli.controller.client.v2;
 
 import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
 import java.math.BigDecimal;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -17,7 +20,8 @@
 import com.yeshi.fanli.util.*;
 import com.yeshi.fanli.vo.common.WXXCXJumpInfoVO;
 import com.yeshi.fanli.vo.pdd.PDDConvertLinkResultVO;
-import com.yeshi.fanli.vo.pdd.PDDJumpLinkVO;
+import com.yeshi.fanli.vo.goods.GoodsJumpLinkVO;
+import com.yeshi.fanli.vo.suning.SuningConvertLinkResult;
 import org.json.simple.JSONArray;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -31,7 +35,6 @@
 import com.yeshi.fanli.dto.jd.JDCouponInfo;
 import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
 import com.yeshi.fanli.dto.pdd.PDDGoodsResult;
-import com.yeshi.fanli.dto.pdd.PDDPromotionUrl;
 import com.yeshi.fanli.dto.pdd.PDDSearchFilter;
 import com.yeshi.fanli.dto.suning.SuningGoodsInfo;
 import com.yeshi.fanli.dto.suning.SuningGoodsInfoRecommend;
@@ -71,23 +74,18 @@
 import com.yeshi.fanli.service.inter.dynamic.GoodsEvaluateService;
 import com.yeshi.fanli.service.inter.goods.CollectionGoodsV2Service;
 import com.yeshi.fanli.service.inter.goods.ScanHistoryV2Service;
-import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
 import com.yeshi.fanli.service.inter.jd.JDGoodsClassService;
-import com.yeshi.fanli.service.inter.money.UserMoneyExtraService;
 import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService;
 import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
-import com.yeshi.fanli.service.inter.redpack.UserTaoLiJinNewbiesService;
 import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
 import com.yeshi.fanli.service.inter.taobao.TLJFreeBuyGoodsService;
 import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
 import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService;
 import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
 import com.yeshi.goods.facade.service.DaTaoKeGoodsDetailV2Service;
-import com.yeshi.fanli.service.inter.tlj.ConfigTaoLiJinService;
 import com.yeshi.fanli.service.inter.user.ShamUserService;
 import com.yeshi.fanli.service.inter.user.TBPidService;
 import com.yeshi.fanli.service.inter.user.UserGoodsStorageService;
-import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
 import com.yeshi.fanli.service.inter.user.UserInfoService;
 import com.yeshi.fanli.service.inter.user.integral.IntegralGetService;
 import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
@@ -1680,9 +1678,21 @@
             }
         }
 
-        JSONObject data = new JSONObject();
-        data.put("native", true);
-        data.put("jumpLink", jumpLink);
+        GoodsJumpLinkVO vo = new GoodsJumpLinkVO();
+        vo.set_native(true);
+        vo.setJumpLink(jumpLink);
+        vo.setNativeJumpLink(jumpLink);
+        try {
+            String wxPage = "pages/union/proxy/proxy?spreadUrl=" + URLEncoder.encode(jumpLink, "UTF-8");
+            WXXCXJumpInfoVO wxxcxJumpInfoVO = new WXXCXJumpInfoVO();
+            wxxcxJumpInfoVO.setUserName("gh_45b306365c3d");
+            wxxcxJumpInfoVO.setPath(wxPage);
+            vo.setWxxcxJumpInfo(wxxcxJumpInfoVO);
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+        JSONObject data = JSONObject.fromObject(new Gson().toJson(vo));
+        data.put("native", vo.is_native());
         out.print(JsonUtil.loadTrueResult(data));
     }
 
@@ -1749,9 +1759,22 @@
             }
         }
 
-        JSONObject data = new JSONObject();
-        data.put("native", true);
-        data.put("jumpLink", jumpLink);
+
+        GoodsJumpLinkVO vo = new GoodsJumpLinkVO();
+        vo.set_native(true);
+        vo.setJumpLink(jumpLink);
+        vo.setNativeJumpLink(jumpLink);
+        try {
+            String wxPage = "pages/union/proxy/proxy?spreadUrl=" + URLEncoder.encode(jumpLink, "UTF-8");
+            WXXCXJumpInfoVO wxxcxJumpInfoVO = new WXXCXJumpInfoVO();
+            wxxcxJumpInfoVO.setUserName("gh_45b306365c3d");
+            wxxcxJumpInfoVO.setPath(wxPage);
+            vo.setWxxcxJumpInfo(wxxcxJumpInfoVO);
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+        JSONObject data = JSONObject.fromObject(new Gson().toJson(vo));
+        data.put("native", vo.is_native());
         out.print(JsonUtil.loadTrueResult(data));
 
         // 鑾峰緱閲戝竵
@@ -1837,7 +1860,7 @@
             LogHelper.test(String.format("鎷煎澶氳浆閾�:uid:%s data:%s", uid + "", data.toString()));
         }
 
-        PDDJumpLinkVO vo = new PDDJumpLinkVO();
+        GoodsJumpLinkVO vo = new GoodsJumpLinkVO();
         vo.set_native(true);
         vo.setNativeJumpLink(PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl()));
         vo.setJumpLink(convertUrl.getUrl());
@@ -1856,7 +1879,7 @@
     }
 
     /**
-     * 鎷煎澶氳喘涔伴摼鎺�
+     * 鍞搧浼氳喘涔伴摼鎺�
      *
      * @param acceptData
      * @param uid
@@ -1897,12 +1920,21 @@
         }
 
         VIPConvertResultDTO convertUrl = VipShopApiUtil.convertLink(id + "", tag);
-        JSONObject data = new JSONObject();
-        data.put("native", true);
-        data.put("jumpLink", convertUrl.getUrl());
-        data.put("nativeJumpLink", convertUrl.getDeeplinkUrl());
-        out.print(JsonUtil.loadTrueResult(data));
 
+        GoodsJumpLinkVO vo = new GoodsJumpLinkVO();
+        vo.set_native(true);
+        vo.setJumpLink(convertUrl.getUrl());
+        vo.setNativeJumpLink(convertUrl.getDeeplinkUrl());
+        if (!StringUtil.isNullOrEmpty(convertUrl.getVipWxUrl())) {
+            WXXCXJumpInfoVO wxxcxJumpInfoVO = new WXXCXJumpInfoVO();
+            wxxcxJumpInfoVO.setUserName("gh_8ed2afad9972");
+            wxxcxJumpInfoVO.setPath(convertUrl.getVipWxUrl());
+            vo.setWxxcxJumpInfo(wxxcxJumpInfoVO);
+        }
+
+        JSONObject data = JSONObject.fromObject(new Gson().toJson(vo));
+        data.put("native", vo.is_native());
+        out.print(JsonUtil.loadTrueResult(data));
         // 鑾峰緱閲戝竵
         integralGetService.addCouponRebate(uid);
     }
@@ -1944,12 +1976,31 @@
         String quanUrl = null;
         if (!StringUtil.isNullOrEmpty(goods.getCouponInfo().getCouponUrl()))
             quanUrl = goods.getCouponInfo().getCouponUrl();
-        String link = SuningApiUtil.convertLink(SuningUtil.getProductUrl(supplierCode, goodsCode), quanUrl,
+        SuningConvertLinkResult link = SuningApiUtil.convertLinkNew(goodsCode, supplierCode,
                 pid, uid + "");
-        JSONObject data = new JSONObject();
-        data.put("native", false);
-        data.put("jumpLink", link);
+
+        GoodsJumpLinkVO vo = new GoodsJumpLinkVO();
+        vo.set_native(false);
+        try {
+            vo.setJumpLink(URLDecoder.decode(link.getWapExtendUrl(), "UTF-8"));
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+        if (!StringUtil.isNullOrEmpty(link.getSpPageUrl())) {
+            WXXCXJumpInfoVO wxxcxJumpInfoVO = new WXXCXJumpInfoVO();
+            wxxcxJumpInfoVO.setUserName("gh_1d1e15e90afc");
+            try {
+                wxxcxJumpInfoVO.setPath(URLDecoder.decode(link.getSpPageUrl(), "UTF-8"));
+            } catch (UnsupportedEncodingException e) {
+                e.printStackTrace();
+            }
+            vo.setWxxcxJumpInfo(wxxcxJumpInfoVO);
+        }
+
+        JSONObject data = JSONObject.fromObject(new Gson().toJson(vo));
+        data.put("native", vo.is_native());
         out.print(JsonUtil.loadTrueResult(data));
+
 
         // 鑾峰緱閲戝竵
         integralGetService.addCouponRebate(uid);
@@ -2135,8 +2186,24 @@
 
         link = JDApiUtil.convertLinkWithSubUnionId(link, null, null, JDApiUtil.POSITION_FANLI + "", uid + "");
 
-        JSONObject data = new JSONObject();
-        data.put("link", link);
+
+        GoodsJumpLinkVO vo = new GoodsJumpLinkVO();
+        vo.set_native(true);
+        vo.setJumpLink(link);
+        vo.setNativeJumpLink(link);
+        try {
+            String wxPage = "pages/union/proxy/proxy?spreadUrl=" + URLEncoder.encode(link, "UTF-8");
+            WXXCXJumpInfoVO wxxcxJumpInfoVO = new WXXCXJumpInfoVO();
+            wxxcxJumpInfoVO.setUserName("gh_45b306365c3d");
+            wxxcxJumpInfoVO.setPath(wxPage);
+            vo.setWxxcxJumpInfo(wxxcxJumpInfoVO);
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+
+        JSONObject data = JSONObject.fromObject(new Gson().toJson(vo));
+        data.put("native", vo.is_native());
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
     }
 

--
Gitblit v1.8.0