admin
2021-07-30 19533a17aa55fafc70d0a385928e785cb50e1ebc
src/main/java/com/yeshi/buwan/mogotv/MogoTVUtil.java
@@ -5,19 +5,18 @@
import com.yeshi.buwan.domain.VideoResource;
import com.yeshi.buwan.domain.entity.PlayUrl;
import com.yeshi.buwan.domain.video.InternetSearchVideo;
import com.yeshi.buwan.mogotv.entity.MogoTVClipInfo;
import com.yeshi.buwan.mogotv.entity.MogoTVSearchVideoMap;
import com.yeshi.buwan.mogotv.entity.MogoTVVideo;
import com.yeshi.buwan.service.imp.VideoResourceService;
import com.yeshi.buwan.service.imp.VideoTypeService;
import com.yeshi.buwan.service.inter.juhe.InternetSearchVideoService;
import com.yeshi.buwan.service.inter.juhe.YouKuService;
import com.yeshi.buwan.service.inter.juhe.MogoTVService;
import com.yeshi.buwan.util.factory.VideoInfoFactory;
import com.yeshi.buwan.util.video.VideoConstant;
import com.yeshi.buwan.youku.entity.YouKuSearchVideoMap;
import com.yeshi.buwan.youku.entity.YouKuShowDetail;
import com.yeshi.buwan.youku.entity.YouKuVideo;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -29,7 +28,7 @@
    private InternetSearchVideoService internetSearchVideoService;
    @Resource
    private YouKuService youKuService;
    private MogoTVService mogoTVService;
    @Resource
    private VideoResourceService videoResourceService;
@@ -39,37 +38,38 @@
    public final static int RESOURCE_ID = 26;
    public static VideoDetailInfo convertToDetail(YouKuVideo youKuVideo) {
    public static VideoDetailInfo convertToDetail(MogoTVClipInfo clipInfo, MogoTVVideo mogoTVVideo) {
        VideoDetailInfo detail = new VideoDetailInfo();
        switch (youKuVideo.getCategory()) {
        switch (clipInfo.getFstlvlType()) {
            case "电影":
                detail.setTag(youKuVideo.getTitle());
                detail.setTag(clipInfo.getTitle());
                break;
            case "电视剧":
            case "动漫":
                detail.setTag(youKuVideo.getShow_videoseq() + "");
                detail.setTag(mogoTVVideo.getT1() + "");
                break;
            case "综艺":
                detail.setTag(youKuVideo.getShow_videostage() + " " + youKuVideo.getTitle());
                detail.setTag(mogoTVVideo.getT4() + " " + mogoTVVideo.getT2());
                break;
        }
        detail.setName(youKuVideo.getTitle());
        detail.setExtraId(youKuVideo.getVideoid());
        detail.setName(mogoTVVideo.getT2());
        detail.setExtraId(mogoTVVideo.getVideo_id());
        detail.setType("url");
        return detail;
    }
    public VideoInfo getVideoInfo(InternetSearchVideo internetSearchVideo) throws Exception {
        YouKuSearchVideoMap map = youKuService.selectByVideoId(internetSearchVideo.getId());
    public VideoInfo getVideoInfo(InternetSearchVideo internetSearchVideo,int pageSize) throws Exception {
        MogoTVSearchVideoMap map = mogoTVService.selectMapByVideoId(internetSearchVideo.getId());
        if (map == null) {
            throw new Exception("视频源不存在");
        }
        YouKuShowDetail showDetail = youKuService.getSimpleShowDetail(map.getShowId());
        showDetail.setVideoList(youKuService.getVideoList(showDetail.getId(), 1, 100));
        MogoTVClipInfo showDetail = mogoTVService.getSimpleClipDetail(map.getClipId());
        showDetail.setVideoList(mogoTVService.getVideoList(showDetail.getClipId(), 1, pageSize,"综艺".equalsIgnoreCase(showDetail.getFstlvlType())?false:true));
        VideoInfo info = VideoInfoFactory.create(internetSearchVideo);
        info.setIntroduction(showDetail.getDescription());
        info.setVideoDetailList(MogoTVUtil.convertToDetail(showDetail.getVideoList()));
        info.setIntroduction(showDetail.getStory());
        info.setVideoDetailList(MogoTVUtil.convertToDetail(showDetail.getVideoList(), showDetail));
        info.setPlayPicture(info.getHpicture());
        //获取资源列表
        List<String> rids = Arrays.asList(internetSearchVideo.getResourceIds().split(","));
@@ -80,7 +80,7 @@
        }
        info.setResourceList(resourceList);
        info.setShowType(MogoTVUtil.getShowType(internetSearchVideo));
        info.setScore(new BigDecimal(showDetail.getScore()).setScale(1).toString());
        info.setScore("6.8");
        //获取分类详情
        info.setVideoType(videoTypeService.getVideoType(info.getVideoType().getId()));
@@ -91,10 +91,10 @@
    }
    public static List<VideoDetailInfo> convertToDetail(List<YouKuVideo> youKuVideoList) {
    public static List<VideoDetailInfo> convertToDetail(List<MogoTVVideo> mogoTVVideoList, MogoTVClipInfo clipInfo) {
        List<VideoDetailInfo> detailList = new ArrayList<>();
        for (YouKuVideo video : youKuVideoList) {
            detailList.add(convertToDetail(video));
        for (MogoTVVideo video : mogoTVVideoList) {
            detailList.add(convertToDetail(clipInfo, video));
        }
        return detailList;
    }
@@ -125,8 +125,8 @@
        PlayUrl playUrl = new PlayUrl();
        VideoResource videoResource = videoResourceService.getResource(resourceid + "");
        playUrl.setResource(videoResource);
        YouKuVideo youKuVideo = youKuService.getVideoDetail(id);
        playUrl.setUrl(youKuVideo.getLink());
        MogoTVVideo mogoTVVideo = mogoTVService.getVideoDetail(id);
        playUrl.setUrl("https://m.mgtv.com"+mogoTVVideo.getUrl());
        playUrl.setPlayType(1);
        playUrl.setParams("");
        return playUrl;