| | |
| | | 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.dto.search.SolrResultDTO; |
| | |
| | | import com.yeshi.buwan.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.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; |
| | |
| | | @Resource |
| | | private SearchService searchService; |
| | | |
| | | @Resource |
| | | private HomeRecommendSpecialService homeRecommendSpecialService; |
| | | |
| | | @RequireUid |
| | | public void getClass(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); |
| | |
| | | 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()); |
| | |
| | | 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); |
| | | } |
| | | |
| | | typelist.get(0).setDataKey("recommend"); |
| | | |
| | | HomeClassVO vo = new HomeClassVO(); |
| | | |
| | | 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); |
| | | 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())); |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | } else if (!StringUtil.isNullOrEmpty(homeType)) { |
| | | |
| | | list = new ArrayList<VideoInfo>(); |
| | | list = new ArrayList<>(); |
| | | List<HomeVideo> homeVideoList = homeTypeService.getVideoByTypes(homeType, pageIndex, detailSystem); |
| | | |
| | | for (HomeVideo hv : homeVideoList) { |
| | |
| | | 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()); |
| | | 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(); |
| | |
| | | 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()); |
| | | } |
| | | |
| | | |
| | | List<VideoInfo> list = new ArrayList<>(); |
| | | list.addAll(rankList); |
| | | for (VideoInfo vi : list) {// 清除无用数据,防止浪费带宽,更改图片 |