| | |
| | | import com.yeshi.buwan.domain.ad.CommonAd; |
| | | import com.yeshi.buwan.domain.ad.CommonAdPositionAd; |
| | | import com.yeshi.buwan.domain.recommend.CategoryRecommendVideo; |
| | | import com.yeshi.buwan.domain.recommend.HomeRecommendSpecial; |
| | | 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.manager.SolrAlbumVideoDataManager; |
| | | import com.yeshi.buwan.service.manager.SolrCommonVideoDataManager; |
| | | import com.yeshi.buwan.service.inter.recommend.HomeRecommendSpecialService; |
| | | 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 java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | @Controller |
| | | public class ClassParser { |
| | |
| | | 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) { |
| | |
| | | if (!StringUtil.isNullOrEmpty(list.get(i).getPicture())) { |
| | | list.get(i).getType().setIcon(list.get(i).getPicture()); |
| | | } |
| | | typeList.add(list.get(i).getType()); |
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() >= Constant.IOS_ONLINING_VERSION) { |
| | | if (VideoConstant.isMainCategory(list.get(i).getType().getId())) { |
| | | typeList.add(list.get(i).getType()); |
| | | } |
| | | } else |
| | | typeList.add(list.get(i).getType()); |
| | | } |
| | | |
| | | |
| | | JSONObject object = new JSONObject(); |
| | | object.put("count", (new StringBuilder(String.valueOf(typeList.size()))).toString()); |
| | |
| | | } |
| | | |
| | | |
| | | if ("android".equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() > 53 && !"qq".equalsIgnoreCase(acceptData.getChannel())) { |
| | | SuperVideoType sty = new SuperVideoType(); |
| | | sty.setCreatetime(0 + ""); |
| | | sty.setPicture(""); |
| | | VideoType vt = new VideoType(Constant.VIDEO_TYPE_ZHIBO); |
| | | vt.setName("美女直播"); |
| | | vt.setShow("1"); |
| | | vt.setCategoryType("http://m.v.6.cn/event/porkvideo?src=9n8wc5medm&nologo=1&t=2"); |
| | | vt.setIcon("https://hbimg.huabanimg.com/12834704bb4aa39342c2fb51e0c644181b13997b70eb-CqlE1I_fw658/format/webp"); |
| | | sty.setType(vt); |
| | | boolean isC = false; |
| | | for (SuperVideoType svt : list) { |
| | | if (svt.getType().getId() == vt.getId()) { |
| | | isC = true; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (!isC) |
| | | list.add(sty); |
| | | } |
| | | |
| | | //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/12834704bb4aa39342c2fb51e0c644181b13997b70eb-CqlE1I_fw658/format/webp"); |
| | | 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>(); |
| | |
| | | typelist.add(type); |
| | | } |
| | | |
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() >= Constant.IOS_ONLINING_VERSION) { |
| | | typelist = new ArrayList<>(); |
| | | HomeClassVO vo = new HomeClassVO(); |
| | | vo.setId(309L); |
| | | vo.setName("推荐"); |
| | | vo.setShowTitle("推荐"); |
| | | vo.setDataType(HomeClassVO.DATA_TYPE_RECOMMEND); |
| | | typelist.add(vo); |
| | | |
| | | vo = new HomeClassVO(); |
| | | vo.setId(VideoConstant.VIDEO_CATEGORY_DIANYING); |
| | | vo.setName("电影"); |
| | | vo.setShowTitle("电影"); |
| | | vo.setDataType(HomeClassVO.DATA_TYPE_CLASS); |
| | | typelist.add(vo); |
| | | |
| | | vo = new HomeClassVO(); |
| | | vo.setId(VideoConstant.VIDEO_CATEGORY_DIANSHIJU); |
| | | vo.setName("电视剧"); |
| | | vo.setShowTitle("电视剧"); |
| | | vo.setDataType(HomeClassVO.DATA_TYPE_CLASS); |
| | | typelist.add(vo); |
| | | |
| | | vo = new HomeClassVO(); |
| | | vo.setId(VideoConstant.VIDEO_CATEGORY_DONGMAN); |
| | | vo.setName("动漫"); |
| | | vo.setShowTitle("动漫"); |
| | | vo.setDataType(HomeClassVO.DATA_TYPE_CLASS); |
| | | typelist.add(vo); |
| | | |
| | | vo = new HomeClassVO(); |
| | | vo.setId(VideoConstant.VIDEO_CATEGORY_ZONGYI); |
| | | vo.setName("综艺"); |
| | | vo.setShowTitle("综艺"); |
| | | vo.setDataType(HomeClassVO.DATA_TYPE_CLASS); |
| | | typelist.add(vo); |
| | | } |
| | | |
| | | JSONObject object = new JSONObject(); |
| | | object.put("count", (new StringBuilder(String.valueOf(typelist.size()))).toString()); |
| | | JSONArray array = new JSONArray(); |
| | |
| | | vo.setShowTitle(type.getShowTitle()); |
| | | vo.setType(type.getType()); |
| | | vo.setCategoryType(type.getCategoryType()); |
| | | |
| | | typelist.add(vo); |
| | | //删除老版本中的除开分类的顶部标签 |
| | | if (sv.getType().getId() != 309L && sv.getType().getId() != 310L) |
| | | typelist.add(vo); |
| | | } |
| | | |
| | | HomeClassVO vo = new HomeClassVO(); |
| | | //IOS审核版本 |
| | | DetailSystemConfig onLineVersion = detailSystemConfigService.getConfigByKey("ios_online_version", acceptData.getDetailSystem(), acceptData.getVersion()); |
| | | if (onLineVersion != null && Integer.parseInt(onLineVersion.getValue()) <= acceptData.getVersion()) { |
| | | typelist.clear(); |
| | | } |
| | | |
| | | vo.setDataType(HomeClassVO.DATA_TYPE_NOVEL); |
| | | vo.setName("小说"); |
| | | typelist.add(1, vo); |
| | | //获取首页推荐标签 |
| | | List<HomeRecommendSpecial> specialList = homeRecommendSpecialService.listSpecialByDetailSystemId(acceptData.getDetailSystem().getId(), null, 1, Constant.pageCount); |
| | | if (specialList != null) { |
| | | for (int i = specialList.size() - 1; i >= 0; i--) { |
| | | HomeRecommendSpecial special = specialList.get(i); |
| | | HomeClassVO vo = new HomeClassVO(); |
| | | vo.setId(Long.parseLong(special.getId())); |
| | | vo.setName(special.getName()); |
| | | vo.setShowTitle(special.getName()); |
| | | vo.setDataKey(special.getDataKey()); |
| | | vo.setDataType(HomeClassVO.DATA_TYPE_RECOMMEND); |
| | | if (vo.getName().contains("高清")) |
| | | vo.setColor("#ff6600"); |
| | | typelist.add(0, vo); |
| | | } |
| | | } |
| | | |
| | | JSONObject object = new JSONObject(); |
| | | object.put("count", (new StringBuilder(String.valueOf(typelist.size()))).toString()); |
| | |
| | | array.add(StringUtil.outPutResultJson(typelist.get(j))); |
| | | object.put("data", array); |
| | | out.print(JsonUtil.loadTrueJson(object.toString())); |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | 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)); |
| | | |
| | |
| | | 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); |
| | | |
| | |
| | | VideoListResultVO vo = null; |
| | | |
| | | try { |
| | | vo = redisManager.getVideoList(key); |
| | | vo = redisManager.getVideoList(key); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | |
| | | } else if (!StringUtil.isNullOrEmpty(homeType)) { |
| | | |
| | | list = new ArrayList<VideoInfo>(); |
| | | list = new ArrayList<>(); |
| | | List<HomeVideo> homeVideoList = homeTypeService.getVideoByTypes(homeType, pageIndex, detailSystem); |
| | | |
| | | for (HomeVideo hv : homeVideoList) { |
| | |
| | | break; |
| | | default: |
| | | } |
| | | filter.setResourceIds(new String[]{PPTVUtil.RESOURCE_ID + ""}); |
| | | filter.setResourceIds(Arrays.asList(new String[]{PPTVUtil.RESOURCE_ID + ""})); |
| | | |
| | | //更新时间 |
| | | if ("1".equalsIgnoreCase(order)) { |
| | |
| | | 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 + ""; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | String parentId = request.getParameter("ParentId"); |
| | | |
| | | //是否包含VIP的分类 |
| | | boolean containsVIPType = false; |
| | | try { |
| | | List<Integer> vipTypeList = Arrays.asList(Constant.vipTypes); |
| | | containsVIPType = vipTypeList.contains(Integer.parseInt(parentId)); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | if (StringUtil.isNullOrEmpty(parentId)) { |
| | | out.print(JsonUtil.loadFalseJson("请上传ParentId")); |
| | | return; |
| | |
| | | list.remove(0); |
| | | } |
| | | |
| | | } else if ((Constant.VIDEO_TYPE_VIP + "").equalsIgnoreCase(parentId)) { |
| | | } else if (containsVIPType) { |
| | | //VIP分类 |
| | | VideoType type = new VideoType(Constant.VIDEO_TYPE_VIP); |
| | | type.setName("全部"); |
| | | type.setShow("1"); |
| | | type.setCategoryType("area"); |
| | | list.add(type); |
| | | |
| | | //VIP根分类 |
| | | if (Constant.VIDEO_TYPE_VIP == Integer.parseInt(parentId)) { |
| | | VideoType type = new VideoType(Constant.VIDEO_TYPE_VIP); |
| | | type.setName("全部"); |
| | | type.setShow("1"); |
| | | type.setCategoryType("area"); |
| | | list.add(type); |
| | | |
| | | |
| | | type = new VideoType(Constant.VIDEO_TYPE_VIP_MOVIE); |
| | | type.setName("电影"); |
| | | type.setShow("1"); |
| | | type.setCategoryType("area"); |
| | | list.add(type); |
| | | type = new VideoType(Constant.VIDEO_TYPE_VIP_MOVIE); |
| | | type.setName("电影"); |
| | | type.setShow("1"); |
| | | type.setCategoryType("area"); |
| | | list.add(type); |
| | | |
| | | type = new VideoType(Constant.VIDEO_TYPE_VIP_TV); |
| | | type.setName("电视剧"); |
| | | type.setShow("1"); |
| | | type.setCategoryType("area"); |
| | | list.add(type); |
| | | type = new VideoType(Constant.VIDEO_TYPE_VIP_TV); |
| | | type.setName("电视剧"); |
| | | type.setShow("1"); |
| | | type.setCategoryType("area"); |
| | | list.add(type); |
| | | |
| | | |
| | | type = new VideoType(Constant.VIDEO_TYPE_VIP_CARTOON); |
| | | type.setName("动漫"); |
| | | type.setShow("1"); |
| | | type.setCategoryType("area"); |
| | | list.add(type); |
| | | type = new VideoType(Constant.VIDEO_TYPE_VIP_CARTOON); |
| | | type.setName("动漫"); |
| | | type.setShow("1"); |
| | | type.setCategoryType("area"); |
| | | list.add(type); |
| | | |
| | | // type = new VideoType(Constant.VIDEO_TYPE_VIP_SHOW); |
| | | // type.setName("综艺"); |
| | | // type.setShow("1"); |
| | | // type.setCategoryType("area"); |
| | | // list.add(type); |
| | | } else { |
| | | VideoType type = new VideoType(Integer.parseInt(parentId)); |
| | | type.setName("全部"); |
| | | type.setShow("1"); |
| | | type.setCategoryType("area"); |
| | | list.add(type); |
| | | } |
| | | |
| | | |
| | | } else { |
| | | List<VideoType> clist = classService.getFirstTypeList(parentId); |
| | |
| | | out.print(JsonUtil.loadTrueJson(object.toString())); |
| | | } |
| | | |
| | | @Resource |
| | | private VideoResourceService videoResourceService; |
| | | |
| | | @RequireUid |
| | | public void getSpecialDetail(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | 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(), acceptData.getChannel()); |
| | | List<VideoInfo> tempList = new ArrayList<>(); |
| | | for (VideoInfo videoInfo : list) { |
| | | List<VideoResource> resourceList = videoResourceService.getResourceByVideo(videoInfo); |
| | | List<Long> rids = new ArrayList<>(); |
| | | for (VideoResource vr : resourceList) { |
| | | if (availableResourceIds.contains(Long.parseLong(vr.getId()))) { |
| | | rids.add(Long.parseLong(vr.getId())); |
| | | break; |
| | | } |
| | | } |
| | | if (rids.size() > 0) { |
| | | tempList.add(videoInfo); |
| | | } |
| | | } |
| | | |
| | | list = tempList; |
| | | |
| | | |
| | | JSONObject object = new JSONObject(); |
| | | object.put("count", list.size()); |
| | | JSONArray array = new JSONArray(); |
| | |
| | | if ("310".equals(typeid)) { // 310做的特殊处理:前端处理的是HomeAd,所有需要返回homeAD的形式 |
| | | Object vi = json.get("VideoInfo"); |
| | | json.put("Video", vi); |
| | | //设置banner的比例 |
| | | object.put("bannerSizeRate", "0.56"); |
| | | } |
| | | json.put("LinkType", "1"); |
| | | array.add(json); |
| | |
| | | public void getRecommendCategoryVideoList(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | String typeid = request.getParameter("Type"); |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); |
| | | List<VideoInfo> rankList = categoryRecommendCacheVideoService.getVideoListByRank(Integer.parseInt(typeid), |
| | | detailSystem.getId(), acceptData.getPlatform(), acceptData.getVersion()); |
| | | 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(), acceptData.getChannel()); |
| | | // } |
| | | |
| | | |
| | | List<VideoInfo> list = new ArrayList<>(); |
| | | list.addAll(rankList); |
| | | for (VideoInfo vi : list) {// 清除无用数据,防止浪费带宽,更改图片 |