| | |
| | | import com.yeshi.buwan.dao.HomeVideoDao; |
| | | import com.yeshi.buwan.domain.HomeVideo; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.solr.SolrShortVideo; |
| | | import com.yeshi.buwan.domain.video.InternetSearchVideo; |
| | | import com.yeshi.buwan.service.imp.VideoInfoService; |
| | | import com.yeshi.buwan.service.inter.juhe.InternetSearchVideoService; |
| | | import com.yeshi.buwan.service.inter.recommend.HomeVideoService; |
| | | import com.yeshi.buwan.service.inter.video.VideoInfoExtraService; |
| | | import com.yeshi.buwan.service.manager.search.SolrShortVideoDataManager; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import com.yeshi.buwan.util.NumberUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.factory.VideoInfoFactory; |
| | | import com.yeshi.buwan.util.video.VideoUtil; |
| | | import org.hibernate.Session; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | @Resource |
| | | private InternetSearchVideoService internetSearchVideoService; |
| | | |
| | | @Resource |
| | | private SolrShortVideoDataManager solrShortVideoDataManager; |
| | | |
| | | @Resource |
| | | private VideoInfoService videoInfoService; |
| | |
| | | if (hv == null || hv.getVideo() != null || StringUtil.isNullOrEmpty(hv.getVideoId())) { |
| | | continue; |
| | | } |
| | | if (NumberUtil.isNumeric(hv.getVideoId())) { |
| | | if (VideoUtil.getVideoFromType(hv.getVideoId()) != HomeVideo.FROM_TYPE_INTERNET) { |
| | | continue; |
| | | } |
| | | InternetSearchVideo internetSearchVideo = internetSearchVideoService.selectByPrimaryKeyCache(hv.getVideoId()); |
| | | if (internetSearchVideo != null) { |
| | | hv.setVideo(VideoInfoFactory.create(internetSearchVideo)); |
| | | } |
| | | } |
| | | |
| | | return homeVideoList; |
| | | } |
| | | |
| | | private List<HomeVideo> betchShortVideos(List<HomeVideo> homeVideoList) { |
| | | for (HomeVideo hv : homeVideoList) { |
| | | if (hv == null || hv.getVideo() != null || StringUtil.isNullOrEmpty(hv.getVideoId())) { |
| | | continue; |
| | | } |
| | | if (VideoUtil.getVideoFromType(hv.getVideoId()) != HomeVideo.FROM_TYPE_SHORT) { |
| | | continue; |
| | | } |
| | | |
| | | SolrShortVideo shortVideo = solrShortVideoDataManager.findOne(hv.getVideoId()); |
| | | if (shortVideo != null) { |
| | | hv.setVideo(VideoInfoFactory.create(shortVideo)); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | List<VideoInfo> videoInfoList = new ArrayList<>(); |
| | | homeVideos = betchInternetVideos(homeVideos); |
| | | homeVideos = betchShortVideos(homeVideos); |
| | | for (int i = 0; i < homeVideos.size(); i++) { |
| | | if (homeVideos.get(i).getVideo() == null) { |
| | | homeVideos.remove(i); |