From 32d6c2ea8039b4771fd6b1ded8b022733e32352f Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 03 四月 2021 18:56:57 +0800
Subject: [PATCH] 首页瀑布流

---
 src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java |   40 ++++++++++++++++++++++++++++++++++++----
 1 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java b/src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java
index 1a2345f..d6b6180 100644
--- a/src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java
+++ b/src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java
@@ -289,6 +289,37 @@
     }
 
 
+    // 棣栭〉绫诲瀷鑾峰彇
+    public void getHomeTypeNew(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
+        // 20170914 涓�绾ц棰戝垎绫籌D
+        String page = request.getParameter("Page");
+        String pageSize = request.getParameter("PageSize");
+        String dataKey = request.getParameter("DataKey");
+
+        long count = homeTypeService.countHomeType(acceptData.getDetailSystem().getId(), acceptData.getVersion(), dataKey);
+
+        List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion());
+        List<HomeType> homeTypeList = homeTypeService.getHomeTypeList(acceptData.getDetailSystem().getId(), acceptData.getVersion(), dataKey, Integer.parseInt(page), Integer.parseInt(pageSize));
+
+        if (homeTypeList != null)
+            for (HomeType homeType : homeTypeList) {
+                String resourceKey = StringUtil.Md5(org.yeshi.utils.StringUtil.concat(resourceList, ","));
+                List<HomeVideo> homeVideoList = homeTypeService.getHomeVideoList(homeType.getId(), resourceKey, resourceList, null, 1, homeType.getNumber());
+                long videoCount = homeTypeService.getHomeVideoListCount(homeType.getId(), resourceKey, resourceList, null);
+                homeType.setCount((int) videoCount);
+                homeType.setHomeVideoList(homeVideoList);
+            }
+
+        JSONObject object = new JSONObject();
+        JSONArray array = new JSONArray();
+        for (int i = 0; i < homeTypeList.size(); i++)
+            array.add(StringUtil.outPutResultJson(homeTypeList.get(i)));
+        object.put("data", array);
+        object.put("count", count + "");
+        out.print(JsonUtil.loadTrueJson(object.toString()));
+    }
+
+
     public HomeType convertHomeVideoList(HomeType type) {
         List<VideoInfo> vlist = new ArrayList<VideoInfo>();
         List<HomeVideo> list = type.getHomeVideoList();
@@ -321,15 +352,16 @@
 
         List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion());
         //鏌ヨ澶у浘
-        List<HomeVideo> bigPictureVideos = homeTypeService.getHomeVideoList(homeTypeId, resourceList, true, 1, homeType.getNumber());
+        List<HomeVideo> bigPictureVideos = homeTypeService.getHomeVideoList(homeTypeId, org.yeshi.utils.StringUtil.concat(resourceList, ","), resourceList, true, 1, homeType.getNumber());
 
 
         //澶у浘闇�瑕佹瘡娆¢兘杩斿洖
 
         JSONObject object = new JSONObject();
+        String resourceKey = StringUtil.Md5(org.yeshi.utils.StringUtil.concat(resourceList, ","));
 
-        Long count = homeTypeService.getHomeVideoListCount(homeTypeId, resourceList, null);
-        List<HomeVideo> list1 = homeTypeService.getHomeVideoList(homeTypeId, resourceList, false, page, homeType.getNumber());
+        Long count = homeTypeService.getHomeVideoListCount(homeTypeId, resourceKey, resourceList, null);
+        List<HomeVideo> list1 = homeTypeService.getHomeVideoList(homeTypeId, resourceKey, resourceList, false, page, homeType.getNumber());
         List<HomeVideo> list = new ArrayList<>();
         list.addAll(bigPictureVideos);
         list.addAll(list1);
@@ -597,7 +629,7 @@
                     //姣忓ぉ灞曠ず涓�娆″箍鍛�
                     long showTime = TimeUtil.convertGernalTime(TimeUtil.getGernalTime(System.currentTimeMillis() + 1000 * 60 * 60 * 24L, "yyyy-MM-dd"), "yyyy-MM-dd");
 
-                    deviceAdStrategyService.setVideoDetailAdStrategy(acceptData.getUtdId(), acceptData.getDetailSystem().getId(), showTime, showTime);
+                    deviceAdStrategyService.setVideoDetailAdStrategy(acceptData.getUtdId(), acceptData.getDetailSystem().getId(), showTime, null);
                 }
             });
             return;

--
Gitblit v1.8.0