From 30d8e227e8d823b6c38c3b9c90ac2df03b63befe Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 25 二月 2025 16:41:22 +0800
Subject: [PATCH] 淘宝转链接口更新

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/PinDuoDuoControllerV2.java |  331 ++++++++++++++++++++++++++++++------------------------
 1 files changed, 183 insertions(+), 148 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/PinDuoDuoControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/PinDuoDuoControllerV2.java
index 6426b3c..ebc4123 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/PinDuoDuoControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/PinDuoDuoControllerV2.java
@@ -1,148 +1,183 @@
-package com.yeshi.fanli.controller.client.v2;
-
-import java.io.PrintWriter;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.annotation.Resource;
-
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.yeshi.utils.JsonUtil;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.yeshi.fanli.entity.accept.AcceptData;
-import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
-import com.yeshi.fanli.entity.bus.homemodule.Special;
-import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
-import com.yeshi.fanli.entity.bus.lable.QualityFactory;
-import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
-import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
-import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
-import com.yeshi.fanli.service.inter.homemodule.SpecialService;
-import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
-import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
-import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
-import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsService;
-import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
-
-import net.sf.json.JSONArray;
-import net.sf.json.JSONObject;
-
-/**
- * 鐑攢姒�
- * 
- * @author Administrator
- *
- */
-@Controller
-@RequestMapping("api/v2/pdd")
-public class PinDuoDuoControllerV2 {
-
-	@Resource
-	private HongBaoManageService hongBaoManageService;
-
-	@Resource
-	private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
-
-	@Resource
-	private JumpDetailV2Service jumpDetailV2Service;
-
-	@Resource
-	private DaTaoKeGoodsService daTaoKeGoodsService;
-	
-	@Resource
-	private SwiperPictureService swiperPictureService;
-	
-	@Resource
-	private QualityGoodsService qualityGoodsService;
-	
-	@Resource
-	private SpecialService specialService;
-
-
-	
-	/**
-	 * 鎷煎澶氫笓棰樺垎绫�
-	 * @param acceptData
-	 * @param out
-	 */
-	@RequestMapping(value = "getClass")
-	public void getJDClass(AcceptData acceptData, PrintWriter out) {
-		List<GoodsClass> list = new ArrayList<GoodsClass>();
-		list.add(new GoodsClass(1L, "绮鹃��"));
-		list.add(new GoodsClass(2L, "娓呬粨"));
-		list.add(new GoodsClass(3L, "鐧捐揣"));
-		list.add(new GoodsClass(4L, "姣嶅┐"));
-		list.add(new GoodsClass(5L, "椋熷搧"));
-		list.add(new GoodsClass(6L, "濂宠"));
-		list.add(new GoodsClass(7L, "鐢靛櫒"));
-		list.add(new GoodsClass(8L, "闉嬪寘"));
-		list.add(new GoodsClass(9L, "鍐呰。"));
-		list.add(new GoodsClass(10L, "缇庡"));
-		list.add(new GoodsClass(11L, "鐢疯"));
-		list.add(new GoodsClass(12L, "姹借溅"));
-		list.add(new GoodsClass(13L, "姘存灉"));
-		list.add(new GoodsClass(14L, "瀹跺眳"));
-		list.add(new GoodsClass(15L, "鏂囧叿"));
-		list.add(new GoodsClass(16L, "杩愬姩"));
-		list.add(new GoodsClass(17L, "铏氭嫙"));
-		list.add(new GoodsClass(18L, "鍖昏嵂"));
-		JSONObject root = new JSONObject();
-		root.put("list", list);
-		out.print(JsonUtil.loadTrueResult(root));
-	}
-	
-	
-	/**
-	 * 鎷煎澶氫笓棰�
-	 * @param acceptData
-	 * @param out
-	 */
-	@RequestMapping(value = "getGoodsInfo")
-	public void getGoodsInfo(AcceptData acceptData, Integer cid, Integer page, PrintWriter out) {
-		JSONObject root = new JSONObject();
-		if (cid == 1 && page == 1) {
-			List<SwiperPicture> topPicList = swiperPictureService.getByBannerCard("pinduoduo_special_index");
-			if (topPicList == null) {
-				topPicList = new ArrayList<SwiperPicture>();
-			}
-			root.put("listPic", JsonUtil.getApiCommonGson().toJson(topPicList));
-			
-			List<Special> listSpecial = specialService.listByPlaceKey("pinduoduo_special_index");
-			if (listSpecial == null) {
-				listSpecial = new ArrayList<Special>();
-			}
-			root.put("listSpe", JsonUtil.getApiCommonGson().toJson(listSpecial));
-		}
-		
-		List<QualityFactory> listQuery = qualityGoodsService.listFreeGoods((page - 1) * 20, 20);
-		if (listQuery == null) {
-			listQuery = new ArrayList<QualityFactory>();
-		}
-
-		JSONArray array = new JSONArray();
-		if (listQuery.size() > 0) {
-			Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
-					.excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
-			
-			BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
-			BigDecimal shareRate = hongBaoManageService.getShareRate();
-			for (QualityFactory qualityFactory : listQuery) {
-				TaoBaoGoodsBrief goods = qualityFactory.getTaoBaoGoodsBrief();
-				if (goods == null) {
-					continue;
-				}
-				array.add(gson.toJson(GoodsDetailVOFactory.convertTaoBao(goods, null, fanLiRate, shareRate)));
-			}
-		}
-		long count = qualityGoodsService.countFreeGoods();
-		
-		root.put("count", count);
-		root.put("list", array);
-		out.print(JsonUtil.loadTrueResult(root));
-	}
-	
-}
+package com.yeshi.fanli.controller.client.v2;
+
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import com.yeshi.fanli.entity.SystemPIDInfo;
+import com.yeshi.fanli.service.inter.pdd.PDDAuthService;
+import com.yeshi.fanli.service.manger.PIDManager;
+import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
+import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil;
+import com.yeshi.fanli.vo.common.WXXCXJumpInfoVO;
+import com.yeshi.fanli.vo.pdd.PDDConvertLinkResultVO;
+import com.yeshi.fanli.vo.goods.GoodsJumpLinkVO;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.yeshi.utils.JsonUtil;
+
+import com.google.gson.Gson;
+import com.yeshi.fanli.dto.GoodsMoneyConfigParamsDTO;
+import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
+import com.yeshi.fanli.entity.accept.AcceptData;
+import com.yeshi.fanli.entity.bus.homemodule.Special;
+import com.yeshi.fanli.exception.pdd.PDDOrderException;
+import com.yeshi.fanli.service.inter.homemodule.SpecialService;
+import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
+import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService;
+import com.yeshi.fanli.service.inter.pdd.PDDGoodsService;
+import com.yeshi.fanli.util.Constant;
+import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
+import com.yeshi.fanli.vo.goods.GoodsDetailVO;
+import com.yeshi.fanli.vo.homemodule.BannerVO;
+
+import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
+
+/**
+ * 鐑攢姒�
+ *
+ * @author Administrator
+ */
+@Controller
+@RequestMapping("api/v2/pdd")
+public class PinDuoDuoControllerV2 {
+
+    @Resource
+    private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService;
+
+    @Resource
+    private SwiperPictureService swiperPictureService;
+
+    @Resource
+    private SpecialService specialService;
+
+    @Resource
+    private PDDGoodsService pddGoodsService;
+
+    @Resource
+    private PDDAuthService pddAuthService;
+
+    @Resource
+    private PIDManager pidManager;
+
+
+    /**
+     * 鎷煎澶氫笓棰樺垎绫�
+     *
+     * @param acceptData
+     * @param out
+     */
+    @RequestMapping(value = "getClass")
+    public void getClass(AcceptData acceptData, PrintWriter out) {
+        JSONObject root = new JSONObject();
+        root.put("list", pddGoodsService.getSpecialClass());
+        out.print(JsonUtil.loadTrueResult(root));
+    }
+
+
+    /**
+     * 鎷煎澶氫笓棰�
+     *
+     * @param acceptData
+     * @param out
+     */
+    @RequestMapping(value = "getGoodsInfo")
+    public void getGoodsInfo(AcceptData acceptData, Long cid, Integer page, PrintWriter out) {
+        JSONObject root = new JSONObject();
+        if (cid == 1 && page == 1) {
+            List<BannerVO> topPicList = swiperPictureService.getByBannerCardAndVersion("pinduoduo_special_index", acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()), acceptData.getSystem());
+            if (topPicList == null) {
+                topPicList = new ArrayList<BannerVO>();
+            }
+            root.put("listPic", JsonUtil.getApiCommonGson().toJson(topPicList));
+            int platformCode = Constant.getPlatformCode(acceptData.getPlatform());
+            List<Special> listSpecial = specialService.listByPlaceKey("pinduoduo_special_index", platformCode, Integer.parseInt(acceptData.getVersion()), acceptData.getSystem());
+            if (listSpecial == null) {
+                listSpecial = new ArrayList<Special>();
+            }
+            root.put("listSpe", JsonUtil.getApiCommonGson().toJson(listSpecial));
+        }
+
+        try {
+            List<PDDGoodsDetail> goodsList = pddGoodsService.specialSearch(page, cid);
+            JSONArray array = new JSONArray();
+            if (goodsList != null && goodsList.size() > 0) {
+                Gson gson = JsonUtil.getApiCommonGson();
+                GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
+                        acceptData.getVersion(), acceptData.getSystem());
+
+                for (PDDGoodsDetail goods : goodsList) {
+                    GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO);
+                    array.add(gson.toJson(goodsDetailVO));
+                }
+            }
+            root.put("list", array);
+            root.put("count", 1000);
+            out.print(JsonUtil.loadTrueResult(root));
+        } catch (PDDOrderException e) {
+            out.print(JsonUtil.loadFalseResult(e.getMsg()));
+        }
+    }
+
+
+    @RequestMapping(value = "getAuthJumpInfo")
+    public void getAuthJumpInfo(AcceptData acceptData, Long uid, int type, PrintWriter out) {
+        if (uid == null || uid == 0L) {
+            out.print(JsonUtil.loadFalseResult("璇峰厛鐧诲綍"));
+            return;
+        }
+        String pid = null;
+        //鑷喘
+        if (type == 1) {
+            pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.fanli);
+        } else {//鍒嗕韩
+            pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.share);
+        }
+
+        PDDConvertLinkResultVO authLink = PinDuoDuoApiUtil.getAuthLink(pid, pddAuthService.getFanliCustomParams(uid));
+
+        GoodsJumpLinkVO pddJumpLinkVO = new GoodsJumpLinkVO();
+
+        pddJumpLinkVO.set_native(true);
+        pddJumpLinkVO.setJumpLink(authLink.getMobile_url());
+        pddJumpLinkVO.setNativeJumpLink(PinDuoDuoUtil.getAndroidNativeURI(authLink.getMobile_url()));
+        if (authLink.getWe_app_info() != null) {
+            WXXCXJumpInfoVO wxxcxJumpInfoVO = new WXXCXJumpInfoVO();
+            wxxcxJumpInfoVO.setUserName(authLink.getWe_app_info().getUser_name());
+            wxxcxJumpInfoVO.setPath(authLink.getWe_app_info().getPage_path());
+            pddJumpLinkVO.setWxxcxJumpInfo(wxxcxJumpInfoVO);
+        }
+
+        JSONObject data = JSONObject.fromObject(new Gson().toJson(pddJumpLinkVO));
+        data.put("native", pddJumpLinkVO.is_native());
+        out.print(JsonUtil.loadTrueResult(data));
+    }
+
+
+    @RequestMapping(value = "isAuth")
+    public void isAuth(AcceptData acceptData, Long uid, int type, PrintWriter out) {
+        if (uid == null || uid == 0L) {
+            out.print(JsonUtil.loadFalseResult("璇峰厛鐧诲綍"));
+            return;
+        }
+        String pid = null;
+        //鑷喘
+        if (type == 1) {
+            pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.fanli);
+        } else {//鍒嗕韩
+            pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.share);
+        }
+
+        String customParams = pddAuthService.getFanliCustomParams(uid);
+        boolean auth = PinDuoDuoApiUtil.isAuth(pid, customParams);
+        if (auth) {
+            out.print(JsonUtil.loadTrueResult(""));
+        } else {
+            out.print(JsonUtil.loadFalseResult("灏氭湭鎺堟潈"));
+        }
+    }
+
+}

--
Gitblit v1.8.0