admin
2022-04-16 04f09e52ffd4681bdfd85e51acd3da0d1280c3d3
src/main/java/com/yeshi/buwan/controller/parser/ClassParser.java
@@ -11,18 +11,17 @@
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.inter.system.SystemConfigService;
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;
@@ -37,7 +36,6 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
@Controller
public class ClassParser {
@@ -74,6 +72,9 @@
    private SolrAlbumVideoDataManager solrAlbumVideoDataManager;
    @Resource
    private SolrInternetSearchVideoDataManager solrInternetSearchVideoDataManager;
    @Resource
    private SearchService searchService;
    @Resource
@@ -81,6 +82,21 @@
    @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) {
@@ -172,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>();
@@ -335,7 +351,7 @@
        }
        //IOS审核版本
        DetailSystemConfig onLineVersion = detailSystemConfigService.getConfigByKey("ios_online_version", detailSystem, acceptData.getVersion());
        DetailSystemConfig onLineVersion = detailSystemConfigService.getConfigByKey("ios_online_version", acceptData.getDetailSystem(), acceptData.getVersion());
        if (onLineVersion != null && Integer.parseInt(onLineVersion.getValue()) <= acceptData.getVersion()) {
            typelist.clear();
        }
@@ -495,7 +511,7 @@
        VideoListResultVO vo = null;
        try {
            vo = redisManager.getVideoList(key);
             vo = redisManager.getVideoList(key);
        } catch (Exception e) {
            e.printStackTrace();
        }
@@ -576,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)) {
@@ -595,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 + "";
                    }
                }
            }