| | |
| | | } |
| | | |
| | | |
| | | private List<HomeVideo> betchInternetVideos(List<HomeVideo> homeVideoList) { |
| | | for (HomeVideo hv : homeVideoList) { |
| | | private List<HomeVideo> betchInternetVideos(List<HomeVideo> homeVideoList, List<Long> resourceIds) { |
| | | for (int i = 0; i < homeVideoList.size(); i++) { |
| | | HomeVideo hv = homeVideoList.get(i); |
| | | if (hv == null || hv.getVideo() != null || StringUtil.isNullOrEmpty(hv.getVideoId())) { |
| | | continue; |
| | | } |
| | |
| | | } |
| | | InternetSearchVideo internetSearchVideo = internetSearchVideoService.selectByPrimaryKeyCache(hv.getVideoId()); |
| | | if (internetSearchVideo != null) { |
| | | hv.setVideo(VideoInfoFactory.create(internetSearchVideo)); |
| | | String[] rids = internetSearchVideo.getResourceIds().split(","); |
| | | List<Long> ridList = new ArrayList<>(); |
| | | for (String rid : rids) { |
| | | ridList.add(Long.parseLong(rid)); |
| | | } |
| | | ridList.retainAll(resourceIds); |
| | | if (ridList.size() > 0) |
| | | hv.setVideo(VideoInfoFactory.create(internetSearchVideo)); |
| | | else { |
| | | homeVideoList.remove(i); |
| | | i--; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | return homeVideoList; |
| | | } |
| | | |
| | | private List<HomeVideo> betchShortVideos(List<HomeVideo> homeVideoList) { |
| | | for (HomeVideo hv : homeVideoList) { |
| | | private List<HomeVideo> betchShortVideos(List<HomeVideo> homeVideoList, List<Long> resourceIds) { |
| | | for (int i = 0; i < homeVideoList.size(); i++) { |
| | | HomeVideo hv = homeVideoList.get(i); |
| | | if (hv == null || hv.getVideo() != null || StringUtil.isNullOrEmpty(hv.getVideoId())) { |
| | | continue; |
| | | } |
| | |
| | | |
| | | SolrShortVideo shortVideo = solrShortVideoDataManager.findOne(hv.getVideoId()); |
| | | if (shortVideo != null) { |
| | | Long rid = Long.parseLong(shortVideo.getResourceId() + ""); |
| | | if (resourceIds.contains(rid)) { |
| | | hv.setVideo(VideoInfoFactory.create(shortVideo)); |
| | | } else { |
| | | homeVideoList.remove(i); |
| | | i--; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | }); |
| | | |
| | | List<VideoInfo> videoInfoList = new ArrayList<>(); |
| | | homeVideos = betchInternetVideos(homeVideos); |
| | | homeVideos = betchShortVideos(homeVideos); |
| | | homeVideos = betchInternetVideos(homeVideos, resourceIds); |
| | | homeVideos = betchShortVideos(homeVideos, resourceIds); |
| | | for (int i = 0; i < homeVideos.size(); i++) { |
| | | if (homeVideos.get(i).getVideo() == null) { |
| | | homeVideos.remove(i); |
| | |
| | | } |
| | | } |
| | | videoInfoExtraService.batchExtra(videoInfoList, resourceIds); |
| | | return betchInternetVideos(homeVideos); |
| | | return betchInternetVideos(homeVideos, resourceIds); |
| | | } |
| | | |
| | | @Override |