From f788607ff771a47bc60d6a86e00b3433c40f3d2c Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 24 九月 2021 15:22:03 +0800 Subject: [PATCH] 接入视频直播 --- src/main/java/com/yeshi/buwan/service/imp/juhe/FunTVService.java | 68 +++++++++++++++++---------------- 1 files changed, 35 insertions(+), 33 deletions(-) diff --git a/src/main/java/com/yeshi/buwan/service/imp/juhe/FunTVService.java b/src/main/java/com/yeshi/buwan/service/imp/juhe/FunTVService.java index 6c4217f..327e301 100644 --- a/src/main/java/com/yeshi/buwan/service/imp/juhe/FunTVService.java +++ b/src/main/java/com/yeshi/buwan/service/imp/juhe/FunTVService.java @@ -9,11 +9,11 @@ import com.yeshi.buwan.domain.*; import com.yeshi.buwan.domain.entity.PlayUrl; import com.yeshi.buwan.domain.push.VideoPushHistory; -import com.yeshi.buwan.funtv.FunTVUtil; -import com.yeshi.buwan.funtv.entity.FunTVAlbum; -import com.yeshi.buwan.funtv.entity.FunTVAlbumVideoMap; -import com.yeshi.buwan.funtv.entity.FunTVVideo; -import com.yeshi.buwan.funtv.entity.VideoFunTV; +import com.yeshi.buwan.videos.funtv.FunTVUtil; +import com.yeshi.buwan.videos.funtv.entity.FunTVAlbum; +import com.yeshi.buwan.videos.funtv.entity.FunTVAlbumVideoMap; +import com.yeshi.buwan.videos.funtv.entity.FunTVVideo; +import com.yeshi.buwan.videos.funtv.entity.VideoFunTV; import com.yeshi.buwan.service.imp.*; import com.yeshi.buwan.service.imp.push.PushService; import com.yeshi.buwan.util.StringUtil; @@ -40,6 +40,7 @@ @Resource private FunTVAlbumDao funTVAlbumDao; + @Resource private FunTVAlbumVideoMapDao funTVAlbumVideoMapDao; @@ -63,6 +64,9 @@ @Resource private VideoManager videoManager; + + @Resource + private ResourceVideoService resourceVideoService; static Logger logger = Logger.getLogger(FunTVService.class); @@ -151,7 +155,7 @@ // 鑾峰彇鏈�鏂颁竴闆嗙殑淇℃伅 List<FunTVVideo> plist = funTVVideoDao.listByAid(p.getAid(), "num", Sort.Direction.DESC, 0, 1); if (plist.size() > 0) { - List<VideoDetailInfo> detailList = new ArrayList<VideoDetailInfo>(); + List<VideoDetailInfo> detailList = new ArrayList<>(); detailList.add(FunTVUtil.convertFunTVVideoToVideoDetail(plist.get(0), p)); vi.setVideoDetailList(detailList); } @@ -305,7 +309,7 @@ final VideoInfo info = FunTVUtil.convertFunTVAlbumToVideoInfo(p); // 绫诲瀷璁$畻 - final List<Integer> typeList = new ArrayList<Integer>(); + final List<Integer> typeList = new ArrayList<>(); int type = FunTVUtil.getFunTVAlbumType(p); boolean exist = false; @@ -382,7 +386,7 @@ return; } else {// 闇�瑕佹柊鍔犲叆videoinfo Serializable id = addVideoInfo(info, p); - List<Integer> typeList = new ArrayList<Integer>(); + List<Integer> typeList = new ArrayList<>(); typeList = FunTVUtil.getShortVideoType(p, p.getCate(), p.getSubCate()); if (typeList == null || typeList.size() <= 0) @@ -465,41 +469,37 @@ return playUrl; } - public List<VideoDetailInfo> getVideoDetailList(String videoid) { + public List<VideoDetailInfo> getVideoDetailList(String videoid, int page, int pageSize) { List<VideoFunTV> list = videoFunTVNewDao.listByVideoId(Long.parseLong(videoid)); if (list != null && list.size() > 0) { final VideoFunTV vft = list.get(0); if (vft != null && vft.getAid() != null) {// 鎸夎妭鐩煡鎵捐棰� String aid = vft.getAid(); FunTVAlbum album = funTVAlbumDao.get(aid); + if (album == null) { + resourceVideoService.delete(videoid, FunTVUtil.RESOURCE_ID + ""); + } + final String type = album.getVideoType(); + Sort.Direction sort = Sort.Direction.ASC; + if (type != null) + if (type.contains("鐢靛奖")) { + sort = Sort.Direction.DESC; + } else if (type.contains("鐢佃鍓�")) { + sort = Sort.Direction.ASC; + } else if (type.contains("缁艰壓")) { + sort = Sort.Direction.DESC; + } else if (type.contains("鍔ㄦ极")) { + sort = Sort.Direction.ASC; + } else + sort = Sort.Direction.DESC; - List<FunTVVideo> videoList = funTVVideoDao.listByAid(aid, "num", Sort.Direction.ASC, 0, 1000); + + List<FunTVVideo> videoList = funTVVideoDao.listByAid(aid, "num", sort, (page - 1) * pageSize, pageSize); if (album == null && videoList.size() > 0) {//澶勭悊鐢靛奖 album = new FunTVAlbum(); album.setTitle(videoList.get(0).getTitle()); album.setVideoType(videoList.get(0).getCate()); } - - final String type=album.getVideoType(); - Comparator<FunTVVideo> cp = new Comparator<FunTVVideo>() { - public int compare(FunTVVideo o1, FunTVVideo o2) { - - long t1 = o1.getNum(); - long t2 = o2.getNum(); - if (type.contains("鐢靛奖")) { - return (int) (t2 - t1); - } else if (type.contains("鐢佃鍓�")) { - return (int) (t1 - t2); - } else if (type.contains("缁艰壓")) { - return (int) (t2 - t1); - } else if (type.contains("鍔ㄦ极")) { - return (int) (t1 - t2); - } else - return (int) (t2 - t1); - } - }; - if (videoList.size() > 0) - Collections.sort(videoList, cp); List<VideoDetailInfo> detailList = new ArrayList<>(); for (FunTVVideo pv : videoList) @@ -507,14 +507,14 @@ return detailList; } else if (vft.getVid() != null) {// 鍗曚釜瑙嗛 FunTVVideo pv = funTVVideoDao.get(vft.getVid()); - List<VideoDetailInfo> detailList = new ArrayList<VideoDetailInfo>(); + List<VideoDetailInfo> detailList = new ArrayList<>(); VideoDetailInfo detail = new VideoDetailInfo(); detail.setId(Long.parseLong(pv.getVid())); detail.setExtraId(pv.getId() + ""); detail.setName(pv.getTitle()); detail.setTag(pv.getDesc()); detail.setType("funtvvideo"); - List<VideoUrl> urlList = new ArrayList<VideoUrl>(); + List<VideoUrl> urlList = new ArrayList<>(); VideoUrl vu = new VideoUrl(); vu.setAdmin(null); vu.setBaseUrl(pv.getPlayUrl()); @@ -526,6 +526,8 @@ detailList.add(detail); return detailList; } + }else{//鍒犻櫎鏉ユ簮 + resourceVideoService.delete(videoid,FunTVUtil.RESOURCE_ID+""); } return null; -- Gitblit v1.8.0