| | |
| | | import com.yeshi.buwan.domain.VideoResource; |
| | | import com.yeshi.buwan.domain.VideoType; |
| | | import com.yeshi.buwan.domain.push.VideoPushHistory; |
| | | import com.yeshi.buwan.iqiyi.entity.IqiyiAlbum; |
| | | import com.yeshi.buwan.iqiyi.entity.IqiyiVideoInfo; |
| | | import com.yeshi.buwan.iqiyi.entity.VideoIqiyi; |
| | | import com.yeshi.buwan.iqiyi.util.IqiyiUtil; |
| | | import com.yeshi.buwan.videos.iqiyi.entity.IqiyiAlbum; |
| | | import com.yeshi.buwan.videos.iqiyi.entity.IqiyiVideoInfo; |
| | | import com.yeshi.buwan.videos.iqiyi.entity.VideoIqiyi; |
| | | import com.yeshi.buwan.videos.iqiyi.util.IqiyiUtil; |
| | | import com.yeshi.buwan.log.LogHelper; |
| | | import com.yeshi.buwan.service.imp.StatisticsService; |
| | | import com.yeshi.buwan.service.imp.push.PushService; |
| | |
| | | @Resource |
| | | private ResourceVideoDao resourceVideoDao; |
| | | |
| | | public PushService getPushService() { |
| | | return pushService; |
| | | } |
| | | |
| | | public void setPushService(PushService pushService) { |
| | | this.pushService = pushService; |
| | | } |
| | | |
| | | public StatisticsService getStatisticsService() { |
| | | return statisticsService; |
| | | } |
| | | |
| | | public void setStatisticsService(StatisticsService statisticsService) { |
| | | this.statisticsService = statisticsService; |
| | | } |
| | | |
| | | public VideoIqiyiDao getVideoIqiyiDao() { |
| | | return videoIqiyiDao; |
| | | } |
| | | |
| | | public void setVideoIqiyiDao(VideoIqiyiDao videoIqiyiDao) { |
| | | this.videoIqiyiDao = videoIqiyiDao; |
| | | } |
| | | |
| | | public IqiyiVideoInfoDao getIqiyiVideoInfoDao() { |
| | | return iqiyiVideoInfoDao; |
| | | } |
| | | |
| | | public void setIqiyiVideoInfoDao(IqiyiVideoInfoDao iqiyiVideoInfoDao) { |
| | | this.iqiyiVideoInfoDao = iqiyiVideoInfoDao; |
| | | } |
| | | |
| | | static { |
| | | // PropertyConfigurator.configure(".\\src\\log4j.properties"); |
| | |
| | | logger.error("saveVideoInfo"); |
| | | logger.error(e.getMessage()); |
| | | e.printStackTrace(); |
| | | if (session.getTransaction().isActive()) |
| | | session.getTransaction().rollback(); |
| | | } |
| | | return null; |
| | |
| | | list.get(0).getVideo().setVideocount(videoList.size()); |
| | | if (!StringUtil.isNullOrEmpty(ilist.get(0).getVideoImage())) { |
| | | list.get(0).getVideo().setLatestHpicture( |
| | | ilist.get(0).getVideoImage().replace(".jpg", "_480_270.jpg")); |
| | | IqiyiUtil.getHPicture(ilist.get(0).getVideoImage())); |
| | | list.get(0).getVideo().setLatestVpicture(ilist.get(0).getVideoImage()); |
| | | } |
| | | } |
| | |
| | | list.get(0).getVideo().setTag(tag); |
| | | if (ilist != null && ilist.size() > 0) { |
| | | updateVideo = list.get(0).getVideo(); |
| | | List<VideoDetailInfo> detailList = new ArrayList<VideoDetailInfo>(); |
| | | List<VideoDetailInfo> detailList = new ArrayList<>(); |
| | | detailList.add(convertVideoinfoToDetail(album, ilist.get(0))); |
| | | updateVideo.setVideoDetailList(detailList); |
| | | } |
| | |
| | | list.get(0).getVideo().setUpdatetime(System.currentTimeMillis() + ""); |
| | | |
| | | if (!StringUtil.isNullOrEmpty(list.get(0).getAlbum().getPosterPicUrl())) { |
| | | list.get(0).getVideo().setLatestHpicture(list.get(0).getAlbum() |
| | | .getPosterPicUrl().replace(".jpg", "_480_270.jpg")); |
| | | list.get(0).getVideo().setLatestHpicture( IqiyiUtil.getHPicture( list.get(0).getAlbum() |
| | | .getPosterPicUrl())); |
| | | list.get(0).getVideo() |
| | | .setLatestVpicture(list.get(0).getAlbum().getPosterPicUrl()); |
| | | } |
| | |
| | | } catch (Exception e) { |
| | | logger.error("insertAlbumToVideoInfo"); |
| | | logger.error(e.getMessage()); |
| | | if (session.getTransaction().isActive()) |
| | | session.getTransaction().rollback(); |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | } |
| | | |
| | | @SuppressWarnings("unchecked") |
| | | public List<VideoDetailInfo> getVideoDetailList(final String videoid) { |
| | | public List<VideoDetailInfo> getVideoDetailList(final String videoid,int page,int pageSize) { |
| | | return (List<VideoDetailInfo>) videoIqiyiDao.excute(new HibernateCallback<List<VideoDetailInfo>>() { |
| | | public List<VideoDetailInfo> doInHibernate(Session session) throws HibernateException { |
| | | try { |
| | | List<IqiyiAlbum> list = session |
| | | .createQuery( |
| | | "select a.album from VideoIqiyi a where a.video.id=? order by UNIX_TIMESTAMP(a.album.tvYear) desc") |
| | | .setFirstResult((page-1)*pageSize).setMaxResults(pageSize) |
| | | .setParameter(0, videoid).list(); |
| | | if (list == null || list.size() == 0) { |
| | | return null; |
| | |
| | | } else { |
| | | List<IqiyiVideoInfo> ivlist = session |
| | | .createQuery("from IqiyiVideoInfo a where a.albumId=? order by a.playOrder") |
| | | .setFirstResult((page-1)*pageSize).setMaxResults(pageSize) |
| | | .setParameter(0, list.get(0).getAlbumId() + "").list(); |
| | | |
| | | for (IqiyiVideoInfo ia : ivlist) |
| | |
| | | // info.setPlayPicture(info.getPicture().replace(".jpg", |
| | | // "_480_270.jpg")); |
| | | |
| | | video.setVpicture(album.getPicUrl()); |
| | | video.setHpicture(album.getPicUrl().replace(".jpg", "_480_270.jpg")); |
| | | video.setVpicture(IqiyiUtil.getVPicture(album.getPicUrl())); |
| | | video.setHpicture( IqiyiUtil.getHPicture( album.getPicUrl())); |
| | | |
| | | video.setScore(album.getScore()); |
| | | video.setShare("0"); |
| | |
| | | if (infolist.size() > 0) { |
| | | video.setLatestHpicture(infolist.get(0).getVideoImage()); |
| | | video.setVideocount(infolist.size()); |
| | | video.setLatestHpicture(infolist.get(0).getVideoImage().replace(".jpg", "_480_270.jpg")); |
| | | video.setLatestVpicture(infolist.get(0).getVideoImage()); |
| | | video.setLatestHpicture(IqiyiUtil.getHPicture( infolist.get(0).getVideoImage())); |
| | | video.setLatestVpicture(IqiyiUtil.getVPicture(infolist.get(0).getVideoImage())); |
| | | } |
| | | |
| | | return video; |