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/RecommendControllerV2.java |  169 ++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 145 insertions(+), 24 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RecommendControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RecommendControllerV2.java
index a6f813e..7cb00a5 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RecommendControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RecommendControllerV2.java
@@ -3,7 +3,11 @@
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import com.yeshi.fanli.dto.GoodsMoneyConfigParamsDTO;
+import com.yeshi.fanli.dto.common.CommonContentResult;
+import com.yeshi.fanli.dto.common.CommonContentTypeEnum;
+import com.yeshi.fanli.entity.SystemEnum;
 import com.yeshi.fanli.lijin.manager.GoodsLijinMnager;
+import com.yeshi.fanli.service.inter.goods.CommonTemplateContentService;
 import com.yeshi.goods.facade.dto.taobao.dataoke.DingDongTime;
 import com.yeshi.fanli.dto.jd.JDSearchResult;
 import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
@@ -132,6 +136,9 @@
     @Resource
     private GoodsLijinMnager goodsLijinMnager;
 
+    @Resource
+    private CommonTemplateContentService commonTemplateContentService;
+
     /**
      * 鏂扮増鎺ㄨ崘涓撻绠$悊(1.5.3)
      *
@@ -184,6 +191,103 @@
 
             if (VersionUtil.greaterThan_2_0(acceptData.getPlatform(), acceptData.getVersion()))
                 root.put("searchDiscovery", getSearchDiscoveryInfo(acceptData));
+
+
+            out.print(JsonUtil.loadTrueResult(root));
+        } catch (Exception e) {
+            out.print(JsonUtil.loadFalseResult(1, "鑾峰彇鏁版嵁澶辫触"));
+            try {
+                LogHelper.errorDetailInfo(e);
+            } catch (Exception e1) {
+                e1.printStackTrace();
+            }
+        }
+    }
+
+
+    /**
+     * 鐗逛环鎺ㄨ崘
+     *
+     * @param acceptData
+     * @param uid
+     * @param out
+     */
+    @RequestMapping(value = "getRecommendIndexTJ")
+    public void getRecommendIndexTJ(AcceptData acceptData, Long uid, PrintWriter out) {
+        try {
+            // 鑾峰彇璁惧瀹氫箟鎬у埆
+            int deviceSex = deviceSexService.getDeviceSex(acceptData.getDevice(), acceptData.getSystem());
+
+            // 1銆佷笓棰樻ā鍧�
+            JSONObject root = specialService.listCacheSpecialToIndex(acceptData, deviceSex, acceptData.getSystem());
+
+            // 2銆侀《閮ㄨ疆鎾浘
+            List<BannerVO> oldtopPicList = swiperPictureService.getByBannerCardAndVersion("index_top",
+                    acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()), acceptData.getSystem());
+
+            List<BannerVO> topPicList = new ArrayList<>();
+            if (oldtopPicList != null && oldtopPicList.size() > 0)
+                topPicList.addAll(oldtopPicList);
+
+            root.put("topPicList", JsonUtil.getApiCommonGson().toJson(topPicList));
+
+            // 3銆侀個璇锋湁濂�
+            List<BannerVO> invitePicList = null;
+            if ("ios".equalsIgnoreCase(acceptData.getPlatform())
+                    && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()), acceptData.getSystem())) {
+                // 濡傛灉IOS褰撳墠鐗堟湰澶勪簬瀹℃牳鐘舵�佸氨涓嶈繑鍥�
+            } else {
+                invitePicList = swiperPictureService.getByBannerCardAndVersion("index_invite", acceptData.getPlatform(),
+                        Integer.parseInt(acceptData.getVersion()), acceptData.getSystem());
+            }
+
+            if (invitePicList == null) {
+                invitePicList = new ArrayList<BannerVO>();
+            }
+            root.put("invitePicList", JsonUtil.getApiCommonGson().toJson(invitePicList));
+
+            // 4銆両OS鐨勫簳閮ㄧ綉椤甸摼鎺�
+            String platform = acceptData.getPlatform();
+            if ("ios".equalsIgnoreCase(platform)) {
+                root.put("htmlLink", configService.getValue(ConfigKeyEnum.indexHtmlLinkIos.getKey(), acceptData.getSystem()));
+            }
+
+            root.put("spikeGoods", getSpikeGoodsContent(acceptData));
+            if (VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion()))
+                root.put("scoreExchange", getScoreExchangeInfo(acceptData));
+
+            if (VersionUtil.greaterThan_2_0(acceptData.getPlatform(), acceptData.getVersion()))
+                root.put("searchDiscovery", getSearchDiscoveryInfo(acceptData));
+
+
+            //浠婃棩鐖嗘
+            CommonContentResult commonContentResult = commonTemplateContentService.getContentList(CommonContentTypeEnum.pddHotGoodsRank, null, 1, 10, acceptData.getSystem());
+            if (commonContentResult != null && commonContentResult.getGoodsList() != null && commonContentResult.getGoodsList().size() > 0) {
+                com.alibaba.fastjson.JSONObject hotSale = new com.alibaba.fastjson.JSONObject();
+                JumpDetailV2 jumpDetailV2 = new JumpDetailV2();
+                jumpDetailV2.setActivity("com.tejia.lijin.app.ui.sellwellcommodity.SellWellGoods");
+
+                hotSale.put("jumpDetail", jumpDetailV2);
+                com.alibaba.fastjson.JSONObject params = new com.alibaba.fastjson.JSONObject();
+                String navs = "[{\"key\":\"pddHotGoodsRank\",\"title\":\"鎷煎澶歕"},{\"key\":\"jdHotGoodsRank\",\"title\":\"浜笢\"},{\"key\":\"tbHotGoodsRank\",\"title\":\"娣樺疂\"}]";
+                params.put("navs", navs.replace("\"","\\"+"\""));
+                hotSale.put("params", params);
+
+                Collections.shuffle(commonContentResult.getGoodsList());
+
+                //鑾峰彇goodsList
+                GoodsMoneyConfigParamsDTO configParamsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
+                        acceptData.getVersion(), acceptData.getSystem());
+                List<GoodsDetailVO> goodsList = goodsLijinMnager.loadCommonGoodsMoneyInfo(acceptData.getSystem(), uid, commonContentResult.getGoodsList(), configParamsDTO);
+                JSONArray array = new JSONArray();
+                Gson gson = new Gson();
+                for (GoodsDetailVO vo : goodsList) {
+                    array.add(gson.toJson(vo));
+                }
+                hotSale.put("goodsList", array);
+                root.put("hotSales", hotSale);
+            }
+
 
             out.print(JsonUtil.loadTrueResult(root));
         } catch (Exception e) {
@@ -255,9 +359,9 @@
 
         JumpDetailV2 jumpDetail = null;
         if (VersionUtil.greaterThan_2_0_2(acceptData.getPlatform(), acceptData.getVersion())) {
-            jumpDetail = jumpDetailV2Service.getByTypeCache("spike_goods_list");
+            jumpDetail = jumpDetailV2Service.getByTypeCache("spike_goods_list",acceptData.getSystem());
         } else {
-            jumpDetail = jumpDetailV2Service.getByTypeCache("web");
+            jumpDetail = jumpDetailV2Service.getByTypeCache("web",acceptData.getSystem());
         }
 
         if (array == null) {
@@ -381,7 +485,7 @@
      * @param out
      */
     @RequestMapping("getSpikeGoodsList")
-    public void getSpikeGoodsList(AcceptData acceptData, Integer page, Long goodsId, String qtime, PrintWriter out) {
+    public void getSpikeGoodsList(AcceptData acceptData, Integer page, String goodsId, String qtime, PrintWriter out) {
         List<DaTaoKeDetailV2> detailList0 = daTaoKeGoodsDetailV2Service.getDingDongQiangData(qtime);
         if (detailList0 == null)
             detailList0 = new ArrayList<>();
@@ -391,7 +495,7 @@
         JSONArray array = new JSONArray();
         if (page == 1 && goodsId != null && detailList != null) {
             for (int i = 0; i < detailList.size(); i++) {
-                if (detailList.get(i).getGoodsId().longValue() == goodsId) {
+                if ( TaoBaoUtil.isEqual( detailList.get(i).getGoodsId(), goodsId)) {
                     DaTaoKeDetailV2 goods = detailList.get(i);
                     detailList.remove(i);
                     detailList.add(0, goods);
@@ -434,7 +538,7 @@
         params.put("balanceMore", true);
         root.put("params", params);
         root.put("jumpDetail", jumpDetailV2Service.getByTypeCache("integralExchange",
-                Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion())));
+                Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem()));
 
         root.put("name", "閲戝竵鍏戞崲");
         root.put("desc", "姣忔棩绛惧埌锛屾儕鍠滀笉鍋�");
@@ -472,10 +576,10 @@
         root.put("picture", "http://img.flqapp.com/resource/home_search_found.png");
         root.put("params", params);
         root.put("jumpDetail", jumpDetailV2Service.getByTypeCache("web",
-                Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion())));
+                Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem()));
 
         root.put("jumpResult", jumpDetailV2Service.getByTypeCache("search_goods_result",
-                Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion())));
+                Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem()));
         root.put("keyList", array);
         return root;
     }
@@ -531,7 +635,7 @@
     public void taoBaoGuessUserLikeByDevice(AcceptData acceptData, Long uid, int page, HttpServletRequest request,
                                             PrintWriter out) {
         int pageSize = Constant.PAGE_SIZE;
-        JSONArray array = new JSONArray();
+
         Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create();
 
         String idfa = acceptData.getIdfa();
@@ -551,16 +655,11 @@
                     acceptData.getVersion(), acceptData.getSystem());
 
 
-            List<GoodsDetailVO> voList = goodsLijinMnager.loadTBMoneyInfo(acceptData.getSystem(), uid, goodsList, paramsDTO);
+            List<GoodsDetailVO> voList = goodsLijinMnager.loadTBMoneyInfo(acceptData.getSystem(), uid, goodsList, paramsDTO,false);
 
             for (GoodsDetailVO vo : voList) {
                 if (page < 3)
                     vo.setRecommend(true);
-                try {
-                    array.add(gson.toJson(vo));
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
             }
 
             if (page == 1) {
@@ -589,11 +688,22 @@
                         detailVO.setOtherInfo(otherInfo);
                         detailVO.setPictureTag(new ClientTextStyleVO("绔嬪噺TOP" + (i + 1), "#E5005C", "#FCE431", null));
                         detailVO.setRecommend(true);
-                        array.add(0, gson.toJson(detailVO));
+                        voList.add(0, detailVO);
                     }
                 }
             }
 
+            JSONArray array = new JSONArray();
+            for (GoodsDetailVO vo : voList) {
+                if (acceptData.getSystem() == SystemEnum.yhqjx||acceptData.getSystem() == SystemEnum.hsb) {
+                    //鏆傛椂涓嶇瓫閫夌孩鍖�
+//                    if (!StringUtil.isNullOrEmpty(vo.getMoneyInfo().getHongBaoMoney())) {
+                        array.add(gson.toJson(vo));
+//                    }
+                } else {
+                    array.add(gson.toJson(vo));
+                }
+            }
             JSONObject data = new JSONObject();
             data.put("list", array);
             data.put("count", 1000);
@@ -602,8 +712,8 @@
         }
 
         // 浠庢帹鑽愭潵
+        List<GoodsDetailVO> finalVOList = new ArrayList<>();
         if (page <= 1) {
-            array.clear();
             if (!StringUtil.isNullOrEmpty(imei) || !StringUtil.isNullOrEmpty(idfa)) {
                 long startTime = java.lang.System.currentTimeMillis();
 
@@ -636,7 +746,7 @@
                                 deviceGoodsList.add(goods);
                             }
                         }
-                        List<GoodsDetailVO> voList = goodsLijinMnager.loadTBMoneyInfo(acceptData.getSystem(), uid, deviceGoodsList, paramsDTO);
+                        List<GoodsDetailVO> voList = goodsLijinMnager.loadTBMoneyInfo(acceptData.getSystem(), uid, deviceGoodsList, paramsDTO,false);
                         for (GoodsDetailVO vo : voList) {
                             vo.setRecommend(true);
                         }
@@ -653,9 +763,7 @@
 
                     Collections.shuffle(goodsList);
                     goodsList = goodsList.size() > 20 ? goodsList.subList(0, 20) : goodsList;
-                    for (GoodsDetailVO goods : goodsList) {
-                        array.add(gson.toJson(goods));
-                    }
+                    finalVOList.addAll(goodsList);
                 } else {
                     try {
                         monitorService.addClientAPIMonitor(MonitorFactory.createClientAPI(request, 0,
@@ -665,16 +773,29 @@
                     }
                 }
             }
-            JSONArray localArray = qualityGoodsService.getRecommendToIndexV2((page - 1) * pageSize, pageSize, acceptData.getPlatform(), acceptData.getVersion(), acceptData.getSystem());
-            array.addAll(localArray);
+            List<GoodsDetailVO> voList = qualityGoodsService.getRecommendToIndexV2((page - 1) * pageSize, pageSize, acceptData.getPlatform(), acceptData.getVersion(), acceptData.getSystem());
+            if (voList != null)
+                finalVOList.addAll(voList);
+
         } else {// 浠庣簿閫夊簱鏉�
-            array = qualityGoodsService.getRecommendToIndexV2((page - 1) * pageSize, pageSize, acceptData.getPlatform(), acceptData.getVersion(), acceptData.getSystem());
-            if (array == null) {
+            List<GoodsDetailVO> voList = qualityGoodsService.getRecommendToIndexV2((page - 1) * pageSize, pageSize, acceptData.getPlatform(), acceptData.getVersion(), acceptData.getSystem());
+            if (voList == null || voList.size() == 0) {
                 out.print(JsonUtil.loadFalseResult("娌℃湁鏇村浜�"));
                 return;
             }
         }
 
+        JSONArray array = new JSONArray();
+        for (GoodsDetailVO vo : finalVOList) {
+            if (acceptData.getSystem() == SystemEnum.yhqjx||acceptData.getSystem() == SystemEnum.hsb) {
+                if (!StringUtil.isNullOrEmpty(vo.getMoneyInfo().getHongBaoMoney())) {
+                    array.add(gson.toJson(vo));
+                }
+            } else {
+                array.add(gson.toJson(vo));
+            }
+        }
+
         JSONObject data = new JSONObject();
         data.put("list", array);
         data.put("count", 1000);

--
Gitblit v1.8.0