From f537abe9f3646c739beaf15076246a2f71a347e9 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期四, 20 二月 2025 16:57:55 +0800
Subject: [PATCH] IOS广告增加区域屏蔽

---
 src/main/java/com/yeshi/buwan/controller/parser/ClassParser.java |  153 ++++++++++++++++++++++++++++++++++----------------
 1 files changed, 103 insertions(+), 50 deletions(-)

diff --git a/src/main/java/com/yeshi/buwan/controller/parser/ClassParser.java b/src/main/java/com/yeshi/buwan/controller/parser/ClassParser.java
index e6007b0..8661693 100644
--- a/src/main/java/com/yeshi/buwan/controller/parser/ClassParser.java
+++ b/src/main/java/com/yeshi/buwan/controller/parser/ClassParser.java
@@ -8,19 +8,20 @@
 import com.yeshi.buwan.domain.solr.SolrAlbumVideo;
 import com.yeshi.buwan.domain.special.Special;
 import com.yeshi.buwan.domain.system.DetailSystem;
+import com.yeshi.buwan.domain.system.DetailSystemConfig;
 import com.yeshi.buwan.dto.search.SolrResultDTO;
 import com.yeshi.buwan.dto.search.SolrVideoSearchFilter;
-import com.yeshi.buwan.pptv.PPTVUtil;
+import com.yeshi.buwan.service.manager.search.SolrInternetSearchVideoDataManager;
+import com.yeshi.buwan.util.factory.VideoInfoFactory;
+import com.yeshi.buwan.videos.pptv.PPTVUtil;
 import com.yeshi.buwan.service.imp.*;
 import com.yeshi.buwan.service.imp.recommend.CategoryRecommendVideoService;
 import com.yeshi.buwan.service.inter.recommend.HomeRecommendSpecialService;
-import com.yeshi.buwan.service.manager.SolrAlbumVideoDataManager;
-import com.yeshi.buwan.service.manager.SolrCommonVideoDataManager;
+import com.yeshi.buwan.service.manager.search.SolrAlbumVideoDataManager;
 import com.yeshi.buwan.util.*;
 import com.yeshi.buwan.util.JuHe.VideoResourceUtil;
 import com.yeshi.buwan.util.ad.CommonAdUtil;
 import com.yeshi.buwan.util.annotation.RequireUid;
-import com.yeshi.buwan.util.factory.VideoInfoFactory;
 import com.yeshi.buwan.util.video.VideoConstant;
 import com.yeshi.buwan.vo.AcceptData;
 import com.yeshi.buwan.vo.HomeClassVO;
@@ -35,7 +36,6 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
-import java.util.Set;
 
 @Controller
 public class ClassParser {
@@ -72,10 +72,31 @@
     private SolrAlbumVideoDataManager solrAlbumVideoDataManager;
 
     @Resource
+    private SolrInternetSearchVideoDataManager solrInternetSearchVideoDataManager;
+
+    @Resource
     private SearchService searchService;
 
     @Resource
     private HomeRecommendSpecialService homeRecommendSpecialService;
+
+    @Resource
+    private DetailSystemConfigService detailSystemConfigService;
+
+
+    private static String[] getAreas(String area) {
+        switch (area) {
+            case "娓彴":
+                return new String[]{"棣欐腐", "鍙版咕"};
+            case "鍏朵粬鍥藉":
+                return new String[]{"婢冲ぇ鍒╀簹", "鏂板姞鍧�", "鍗板害"};
+            case "娆ф床":
+                return new String[]{"鑻卞浗", "娉曞浗", "寰峰浗", "淇勭綏鏂�", "鎰忓ぇ鍒�", "鍦熻�冲叾"};
+            default:
+                return new String[]{area};
+        }
+    }
+
 
     @RequireUid
     public void getClass(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
@@ -167,25 +188,25 @@
 
 
         //Android骞冲彴3.8.7涔嬪悗杩斿洖VIP
-        if ("android".equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() >= 105) {
-
-            SuperVideoType sty = new SuperVideoType();
-            sty.setCreatetime(0 + "");
-            sty.setPicture("");
-            VideoType vt = new VideoType(Constant.VIDEO_TYPE_VIP);
-            vt.setName("VIP");
-            vt.setShow("1");
-            vt.setIcon("https://hbimg.huabanimg.com/4690ea8f8144f3d46c11e417c77daa5debcb71f9201f-WpAbfw_fw658/format/jpg");
-            sty.setType(vt);
-            boolean isC = false;
-            for (SuperVideoType svt : list) {
-                if (svt.getType().getId() == vt.getId()) {
-                    isC = true;
-                    break;
-                }
-            }
-            list.add(sty);
-        }
+//        if ("android".equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() >= 105) {
+//
+//            SuperVideoType sty = new SuperVideoType();
+//            sty.setCreatetime(0 + "");
+//            sty.setPicture("");
+//            VideoType vt = new VideoType(Constant.VIDEO_TYPE_VIP);
+//            vt.setName("VIP");
+//            vt.setShow("1");
+//            vt.setIcon("https://hbimg.huabanimg.com/4690ea8f8144f3d46c11e417c77daa5debcb71f9201f-WpAbfw_fw658/format/jpg");
+//            sty.setType(vt);
+//            boolean isC = false;
+//            for (SuperVideoType svt : list) {
+//                if (svt.getType().getId() == vt.getId()) {
+//                    isC = true;
+//                    break;
+//                }
+//            }
+//            list.add(sty);
+//        }
 
 
         List<VideoType> typelist = new ArrayList<VideoType>();
@@ -328,6 +349,13 @@
             if (sv.getType().getId() != 309L && sv.getType().getId() != 310L)
                 typelist.add(vo);
         }
+
+        //IOS瀹℃牳鐗堟湰
+        DetailSystemConfig onLineVersion = detailSystemConfigService.getConfigByKey("ios_online_version", acceptData.getDetailSystem(), acceptData.getVersion());
+        if (onLineVersion != null && Integer.parseInt(onLineVersion.getValue()) <= acceptData.getVersion()) {
+            typelist.clear();
+        }
+
         //鑾峰彇棣栭〉鎺ㄨ崘鏍囩
         List<HomeRecommendSpecial> specialList = homeRecommendSpecialService.listSpecialByDetailSystemId(acceptData.getDetailSystem().getId(), null, 1, Constant.pageCount);
         if (specialList != null) {
@@ -342,7 +370,6 @@
                 if (vo.getName().contains("楂樻竻"))
                     vo.setColor("#ff6600");
                 typelist.add(0, vo);
-
             }
         }
 
@@ -413,7 +440,7 @@
 
         DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName());
 
-        List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(detailSystem, acceptData.getVersion());
+        List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(detailSystem, acceptData.getVersion(), acceptData.getChannel());
         List<VideoInfo> list = starService.getStarVideo(detailSystem.getId(), starId, pageIndex,
                 CacheUtil.getMD5Long(resourceList));
 
@@ -475,7 +502,7 @@
         if (Utils.isTest(request, user, detailSystem.getId()))
             detailSystem = systemService.getDetailSystemById(40 + "");
 
-        List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion());
+        List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion(), acceptData.getChannel());
 
         String resourceMD5 = CacheUtil.getMD5Long(resourceList);
 
@@ -484,7 +511,7 @@
         VideoListResultVO vo = null;
 
         try {
-            vo = redisManager.getVideoList(key);
+             vo = redisManager.getVideoList(key);
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -565,7 +592,7 @@
                                 break;
                             default:
                         }
-                        filter.setResourceIds(new String[]{PPTVUtil.RESOURCE_ID + ""});
+                        filter.setResourceIds(Arrays.asList(new String[]{PPTVUtil.RESOURCE_ID + ""}));
 
                         //鏇存柊鏃堕棿
                         if ("1".equalsIgnoreCase(order)) {
@@ -584,12 +611,37 @@
                         long typeid = cc.getParent().getCid();
                         if (StringUtil.isNullOrEmpty(order))
                             order = 1 + "";
-                        list = categoryAreaService.getVideoInfoByArea(typeid + "", detailSystem, pageIndex, 20,
-                                Integer.parseInt(order), resourceList, country,
-                                StringUtil.Md5(typeid + "-" + detailSystem + "-" + pageIndex + "-" + order + "-" + country
-                                        + "-" + CacheUtil.getMD5Long(resourceList)));
+                        //閫氳繃涓撹緫鎼滅储鏌ヨ
+                        List<String> rids = new ArrayList<>();
+                        for (Long rid : resourceList) {
+                            rids.add(rid + "");
+                        }
+
+                        SolrVideoSearchFilter filter = new SolrVideoSearchFilter();
+                        filter.setResourceIds(rids);
+                        filter.setVideoType((int) typeid);
+                        filter.setAreas(Arrays.asList(getAreas(country)));
+                        SolrResultDTO result = solrAlbumVideoDataManager.find(filter, pageIndex, 20);
+
+                        list = new ArrayList<>();
+                        for (Object av : result.getVideoList()) {
+                            list.add(VideoInfoFactory.create((SolrAlbumVideo) av));
+                        }
+                        count = result.getTotalCount() + "";
+
+                        if (pageIndex == 1 && result.getTotalCount() == 0) {
+
+                            solrInternetSearchVideoDataManager.find(filter,pageIndex,20);
+
+                        }
+
+
+//                        list = categoryAreaService.getVideoInfoByArea(typeid + "", detailSystem, pageIndex, 20,
+//                                Integer.parseInt(order), resourceList, country,
+//                                StringUtil.Md5(typeid + "-" + detailSystem + "-" + pageIndex + "-" + order + "-" + country
+//                                        + "-" + CacheUtil.getMD5Long(resourceList)));
                         System.out.println("鍒楄〃鏈�缁堟暟閲�:" + list.size());
-                        count = 1000 + "";
+//                        count = 1000 + "";
                     }
                 }
             }
@@ -853,7 +905,7 @@
         String specialid = request.getParameter("Id");
         Special special = specialService.getSpecial(specialid);
         List<VideoInfo> list = specialService.getSpecialVideoList(specialid);
-        List<Long> availableResourceIds = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion());
+        List<Long> availableResourceIds = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion(), acceptData.getChannel());
         List<VideoInfo> tempList = new ArrayList<>();
         for (VideoInfo videoInfo : list) {
             List<VideoResource> resourceList = videoResourceService.getResourceByVideo(videoInfo);
@@ -945,21 +997,22 @@
         String typeid = request.getParameter("Type");
         DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName());
         List<VideoInfo> rankList = null;
-        if ("ios".equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() >= Constant.IOS_ONLINING_VERSION) {
-            SolrVideoSearchFilter filter = new SolrVideoSearchFilter();
-            filter.setResourceIds(new String[]{25 + ""});
-            filter.setVideoType(Integer.parseInt(typeid));
-            filter.setFreeType(0);
-            SolrResultDTO dto = solrAlbumVideoDataManager.find(filter, 1, 30);
-            List<SolrAlbumVideo> list = dto.getVideoList();
-            rankList = new ArrayList<>();
-            for (SolrAlbumVideo video : list) {
-                rankList.add(VideoInfoFactory.create(video));
-            }
-        } else {
-            rankList = categoryRecommendCacheVideoService.getVideoListByRank(Integer.parseInt(typeid),
-                    detailSystem.getId(), acceptData.getPlatform(), acceptData.getVersion());
-        }
+//        if ("ios".equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() >= Constant.IOS_ONLINING_VERSION) {
+//            SolrVideoSearchFilter filter = new SolrVideoSearchFilter();
+//            filter.setResourceIds(new String[]{25 + ""});
+//            filter.setVideoType(Integer.parseInt(typeid));
+//            filter.setFreeType(0);
+//            SolrResultDTO dto = solrAlbumVideoDataManager.find(filter, 1, 30);
+//            List<SolrAlbumVideo> list = dto.getVideoList();
+//            rankList = new ArrayList<>();
+//            for (SolrAlbumVideo video : list) {
+//                rankList.add(VideoInfoFactory.create(video));
+//            }
+//        }
+//        else {
+        rankList = categoryRecommendCacheVideoService.getVideoListByRank(Integer.parseInt(typeid),
+                detailSystem.getId(), acceptData.getPlatform(), acceptData.getVersion(), acceptData.getChannel());
+//        }
 
 
         List<VideoInfo> list = new ArrayList<>();

--
Gitblit v1.8.0