admin
2021-09-24 f788607ff771a47bc60d6a86e00b3433c40f3d2c
接入视频直播
40个文件已修改
21个文件已添加
2920 ■■■■ 已修改文件
src/main/java/com/yeshi/buwan/aspect/SignAspect.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/TestController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/admin/api/TVLiveChannelAdminController.java 207 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/api/TVLiveController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/parser/ClassParser.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/parser/ConfigParser.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/parser/FoundParser.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/parser/SearchParser.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/parser/UserParser.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/parser/ZhiBoParser.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/parser/web/WebHomeParser.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/controller/parser/web/WebVideosParser.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/dao/live/TVLiveChannelDao.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/dao/live/TVLiveChannelResourceMapDao.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/dao/live/TVLiveProgramResourceDao.java 97 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/dao/video/StarInfoDao.java 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/dao/video/VideoResourcePlayVersionMapDao.java 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/domain/live/TVLiveChannel.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/domain/live/TVLiveChannelResourceMap.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/domain/live/TVLiveProgramResource.java 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/domain/video/StarInfo.java 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/domain/video/VideoResourcePlayVersionMap.java 109 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/exception/video/VideoPlayException.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/job/LiveJob.java 104 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/live/migu/MiguLiveApiUtil.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/SearchService.java 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/live/MiGuLiveServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/live/TVLiveCategoryChannelServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/live/TVLiveChannelResourceServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/live/TVLiveChannelServiceImpl.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/live/TVLiveProgramResourceServiceImpl.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/video/StarInfoServiceImpl.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/video/VideoResourcePlayVersionMapServiceImpl.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/imp/video/VideoResourceVersionMapServiceImpl.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/inter/live/TVLiveChannelService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/inter/live/TVLiveProgramResourceService.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/inter/video/StarInfoService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/inter/video/VideoResourcePlayVersionMapService.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/inter/video/VideoResourceVersionMapService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/service/manager/search/SolrInternetSearchVideoDataManager.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/util/DouBanUtil.java 429 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/util/JuHe/VideoResourceUtil.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/util/tvlive/DianShiMaoUtil.java 113 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/util/tvlive/TVChannelUtil.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/util/tvlive/TVSOUUtil.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/util/video/VideoDetailUtil.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/vo/tvlive/TVLiveChannelResourceMapAdminVO.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/vo/tvlive/TVLiveChannelVO.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/script/tvlive/dianshimao_program.js 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/admin/new/js/navsetting.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/admin/new/tvlive_category_add.html 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/admin/new/tvlive_category_channel_list.html 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/admin/new/tvlive_channel_add.html 110 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/admin/new/tvlive_channel_list.html 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/admin/new/tvlive_channel_resource.html 235 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/java/com/hxh/spring/test/GeneralTest.java 99 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/java/com/hxh/spring/test/VideoTest.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/java/com/hxh/spring/test/live/TVLiveTest.java 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/java/com/hxh/spring/test/video/VideoResourcePlayVersionTest.java 167 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/java/com/hxh/spring/test/video/VideoResourceVersionTest.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/yeshi/buwan/aspect/SignAspect.java
@@ -48,13 +48,13 @@
        //如果是Android新版本则调用新的签名方法
        //布丸3.8.7之后调用新的签名方法
        if (acceptData != null && "android" .equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() >= 105) {
        if (acceptData != null && "android".equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() >= 105) {
            Map<String, String[]> params = request.getParameterMap();
            //签名
            List<String> list = new ArrayList<>();
            for (Iterator<String> its = params.keySet().iterator(); its.hasNext(); ) {
                String key = its.next();
                if ("sign" .equalsIgnoreCase(key))
                if ("sign".equalsIgnoreCase(key))
                    continue;
                list.add(key + "=" + params.get(key)[0]);
            }
@@ -79,19 +79,26 @@
        if (acceptData != null) {
            if ("ios" .equalsIgnoreCase(acceptData.getPlatform())) {
            if ("ios".equalsIgnoreCase(acceptData.getPlatform())) {
                acceptData.setChannel("appstore");
            }
            if (acceptData.getPackageName().equalsIgnoreCase("com.doudou.ysvideo.lite"))
                acceptData.setPackageName("com.doudou.ysvideo");
            if (acceptData.getPackageName().equalsIgnoreCase("com.doudou.ysvideo.lite")) {
                //小米上架使用
                if (!"xiaomi".equalsIgnoreCase(acceptData.getChannel())) {
                    acceptData.setPackageName("com.doudou.ysvideo");
                    acceptData.setChildPackage("com.doudou.ysvideo.lite");
                } else {
                    acceptData.setChildPackage("com.doudou.ysvideo.lite");
                }
            } else {
                acceptData.setChildPackage(acceptData.getPackage());
            }
            //注入detailSystem
            DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName());
            acceptData.setDetailSystem(detailSystem);
            acceptData.setChildPackage(acceptData.getPackage());
            detailSystem = systemService.getDetailSystemByPackage(acceptData.getChildPackage());
            acceptData.setChildDetailSystem(detailSystem);
        }
src/main/java/com/yeshi/buwan/controller/TestController.java
@@ -53,11 +53,11 @@
        logger.error("测试");
        out.print("success");
    }
    @RequestMapping("searchAlbum")
    public void searchAlbum(String key, PrintWriter out) {
        SearchService.SearchResult result = searchService.searchAlbum(0, key, null,1, 20);
        SearchService.SearchResult result = searchService.searchAlbum(0, key, null, 1, 20, false);
        out.print(JsonUtil.loadTrueResult(result));
    }
src/main/java/com/yeshi/buwan/controller/admin/api/TVLiveChannelAdminController.java
@@ -1,16 +1,16 @@
package com.yeshi.buwan.controller.admin.api;
import com.google.gson.*;
import com.yeshi.buwan.domain.live.SuperTVLiveCategory;
import com.yeshi.buwan.domain.live.TVLiveCategory;
import com.yeshi.buwan.domain.live.TVLiveCategoryChannelMap;
import com.yeshi.buwan.domain.live.TVLiveChannel;
import com.google.gson.reflect.TypeToken;
import com.yeshi.buwan.domain.live.*;
import com.yeshi.buwan.domain.web.DetailSystemSelect;
import com.yeshi.buwan.exception.live.TVLiveCategoryException;
import com.yeshi.buwan.service.imp.SystemService;
import com.yeshi.buwan.service.inter.live.TVLiveCategoryChannelService;
import com.yeshi.buwan.service.inter.live.TVLiveChannelResourceService;
import com.yeshi.buwan.service.inter.live.TVLiveChannelService;
import com.yeshi.buwan.util.*;
import com.yeshi.buwan.vo.tvlive.TVLiveChannelResourceMapAdminVO;
import com.yeshi.buwan.web.tag.PageEntity;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
@@ -39,6 +39,9 @@
    @Resource
    private SystemService systemService;
    @Resource
    private TVLiveChannelResourceService tvLiveChannelResourceService;
    private Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, new JsonSerializer<Date>() {
        @Override
@@ -63,6 +66,24 @@
        data.put("pageEntity", new PageEntity(page, Constant.pageCount, (int) count));
        data.put("data", gson.toJson(channelList));
        out.print(JsonUtil.loadTrueAdmin(data.toString()));
    }
    @RequestMapping(value = "/addChannel", method = RequestMethod.POST)
    public void addChannel(TVLiveChannel channel, HttpSession session, PrintWriter out) {
        if (StringUtil.isNullOrEmpty(channel.getName()) || StringUtil.isNullOrEmpty(channel.gethPicture())) {
            out.print(JsonUtil.loadFalseAdmin("数据不完整"));
            return;
        }
        channel.setState(TVLiveChannel.STATE_NORMAL);
        try {
            tvLiveChannelService.addChannel(channel);
            out.print(JsonUtil.loadTrueAdmin(""));
        } catch (Exception e) {
            out.print(JsonUtil.loadFalseAdmin(e.getMessage()));
            return;
        }
    }
@@ -119,92 +140,100 @@
        out.print(JsonUtil.loadTrueAdmin(""));
    }
    //获取频道资源
//    @RequestMapping(value = "/addCategory", method = RequestMethod.POST)
//    public void addCategory(TVLiveCategory category, String detailsystemids, HttpSession session, PrintWriter out) {
//
//        if (StringUtil.isNullOrEmpty(category.getName())) {
//            out.print(JsonUtil.loadFalseAdmin("数据不完整"));
//            return;
//        }
//
//        category.setSystemId(SystemUtil.getAdminSelectedSystem(session).getId());
//
//        List<String> detailSystemList = new ArrayList<>();
//        if (!StringUtil.isNullOrEmpty(detailsystemids)) {
//            String[] sps = detailsystemids.split(",");
//            for (String sp : sps) {
//                detailSystemList.add(sp);
//            }
//        }
//
//        try {
//            tvLiveCategoryService.addCategory(category, detailSystemList);
//            out.print(JsonUtil.loadTrueAdmin(""));
//        } catch (TVLiveCategoryException e) {
//            out.print(JsonUtil.loadFalseAdmin(e.getMsg()));
//        }
//    }
//
//
//    @RequestMapping(value = "/updateCategory", method = RequestMethod.POST)
//    public void updateCategory(TVLiveCategory category, PrintWriter out) {
//
//        if (StringUtil.isNullOrEmpty(category.getName())) {
//            out.print(JsonUtil.loadFalseAdmin("数据不完整"));
//            return;
//        }
//        tvLiveCategoryService.updateCategory(category);
//        out.print(JsonUtil.loadTrueAdmin(""));
//    }
//
//
//    @RequestMapping(value = "/getCategory", method = RequestMethod.POST)
//    public void getCategory(String id, PrintWriter out) {
//        TVLiveCategory category = tvLiveCategoryService.selectCategoryBuPrimaryKey(id);
//        out.print(JsonUtil.loadTrueAdmin(new Gson().toJson(category)));
//    }
//
//
//    /**
//     * 删除分类
//     *
//     * @param ids
//     * @param out
//     */
//    @RequestMapping(value = "/deleteCategory", method = RequestMethod.POST)
//    public void deleteCategory(String ids, PrintWriter out) {
//        if (StringUtil.isNullOrEmpty(ids)) {
//            out.print(JsonUtil.loadFalseAdmin("ids不能为空"));
//            return;
//        }
//        tvLiveCategoryService.deleteCateogry(Arrays.asList(ids.split(",")));
//        out.print(JsonUtil.loadTrueAdmin(""));
//    }
//
//
//    @RequestMapping(value = "/deleteSuperCategory", method = RequestMethod.POST)
//    public void deleteSuperCategory(String cid, String detailSystemId, PrintWriter out) {
//        if (StringUtil.isNullOrEmpty(cid) || StringUtil.isNullOrEmpty(detailSystemId)) {
//            out.print(JsonUtil.loadFalseAdmin("信息不完整"));
//            return;
//        }
//        tvLiveCategoryService.deleteSuperCategory(cid, detailSystemId);
//        out.print(JsonUtil.loadTrueAdmin(""));
//    }
//
//
//    @RequestMapping(value = "/addSuperCategory", method = RequestMethod.POST)
//    public void addSuperCategory(String cid, String detailSystemId, Integer weight, String icon, PrintWriter out) {
//
//        SuperTVLiveCategory superTVLiveCategory = new SuperTVLiveCategory();
//        superTVLiveCategory.setCid(cid);
//        superTVLiveCategory.setDetailSystemId(detailSystemId);
//        superTVLiveCategory.setWeight(weight);
//        superTVLiveCategory.setIcon(icon);
//        tvLiveCategoryService.addSuperCategory(superTVLiveCategory);
//        out.print(JsonUtil.loadTrueAdmin(""));
//    }
    /**
     * 获取频道的播放资源
     *
     * @param session
     * @param id
     * @param out
     */
    @RequestMapping(value = "/getChannelResourceList", method = RequestMethod.POST)
    public void getChannelResourceList(HttpSession session, String id, PrintWriter out) {
        if (StringUtil.isNullOrEmpty(id)) {
            out.print(JsonUtil.loadFalseAdmin("频道ID不能为空"));
            return;
        }
        List<TVLiveChannelResourceMap> mapList = tvLiveChannelResourceService.listByChannelId(id);
        List<TVLiveChannelResourceMapAdminVO> voList = new ArrayList<>();
        if (mapList != null)
            for (TVLiveChannelResourceMap map : mapList) {
                voList.add(TVLiveChannelResourceMapAdminVO.create(map));
            }
        JSONObject data = new JSONObject();
        data.put("data", gson.toJson(voList));
        data.put("channelId", id);
        out.print(JsonUtil.loadTrueAdmin(data.toString()));
    }
    /**
     * 更新频道播放资源
     *
     * @param session
     * @param id
     * @param resources
     * @param out
     */
    @RequestMapping(value = "/updateChannelResources", method = RequestMethod.POST)
    public void updateChannelResources(HttpSession session, String id, String resources, PrintWriter out) {
        if (StringUtil.isNullOrEmpty(id)) {
            out.print(JsonUtil.loadFalseAdmin("频道ID不能为空"));
            return;
        }
        Type type = new TypeToken<List<TVLiveChannelResourceMapAdminVO>>() {
        }.getType();
        List<TVLiveChannelResourceMapAdminVO> voList = gson.fromJson(resources, type);
        List<TVLiveChannelResourceMap> list = new ArrayList<>();
        for (TVLiveChannelResourceMapAdminVO vo : voList) {
            TVLiveChannelResourceMap map = new TVLiveChannelResourceMap();
            map.setId(vo.getId());
            map.setWeight(vo.getWeight());
            map.setChannelId(id);
            map.setPlayUrl(vo.getPlayUrl());
            map.setSubResourceName(vo.getName());
            list.add(map);
        }
        List<TVLiveChannelResourceMap> originMapList = tvLiveChannelResourceService.listByChannelId(id);
        if (originMapList == null)
            originMapList = new ArrayList<>();
        List<String> originMapIds = new ArrayList<>();
        for (TVLiveChannelResourceMap map : originMapList) {
            originMapIds.add(map.getId());
        }
        //更新需要更新的
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getId() != null && originMapIds.contains(list.get(i).getId())) {
                originMapIds.remove(list.get(i).getId());
                tvLiveChannelResourceService.update(list.get(i));
                list.remove(i--);
            }
        }
        //删除不需要更新的
        for (String mid : originMapIds) {
            tvLiveChannelResourceService.delete(mid);
        }
        //添加新的
        for (TVLiveChannelResourceMap map : list) {
            //咪咕不能手动添加
            map.setResource(TVLiveResource.other);
            tvLiveChannelResourceService.add(map);
        }
        out.print(JsonUtil.loadTrueAdmin(""));
    }
}
src/main/java/com/yeshi/buwan/controller/api/TVLiveController.java
@@ -127,7 +127,7 @@
            MiGuLiveListInfo info = miGuLiveService.selectByPrimaryKey(map.getRid());
            playUrl = MiguLiveApiUtil.getPlayUrl(info.getPID());
        } else if (map.getResource() == TVLiveResource.other) {
            playUrl = map.getPlayUrl();
        }
        JSONObject root = new JSONObject();
        root.put("playUrl", playUrl);
src/main/java/com/yeshi/buwan/controller/parser/ClassParser.java
@@ -330,7 +330,7 @@
        }
        //IOS审核版本
        DetailSystemConfig onLineVersion = detailSystemConfigService.getConfigByKey("ios_online_version", detailSystem, acceptData.getVersion());
        DetailSystemConfig onLineVersion = detailSystemConfigService.getConfigByKey("ios_online_version", acceptData.getDetailSystem(), acceptData.getVersion());
        if (onLineVersion != null && Integer.parseInt(onLineVersion.getValue()) <= acceptData.getVersion()) {
            typelist.clear();
        }
src/main/java/com/yeshi/buwan/controller/parser/ConfigParser.java
@@ -160,7 +160,7 @@
    public void getConfig(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
        LoggerUtil.getUserActiveLogger().info(UserActiveLogFactory.createAppSplash(new BaseLog(acceptData, "")));
        DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName());
        Map<String, String> map = configService.getConfigAsMap(detailSystem, acceptData.getVersion());
        Map<String, String> map = configService.getConfigAsMap(acceptData.getChildDetailSystem(), acceptData.getVersion());
        JSONObject data = new JSONObject();
        JSONObject ad = new JSONObject();
        JSONObject adNew = new JSONObject();
src/main/java/com/yeshi/buwan/controller/parser/FoundParser.java
@@ -170,7 +170,7 @@
        DetailSystem ds = systemService.getDetailSystemByPackage(acceptData.getPackageName());
        //IOS审核版本
        DetailSystemConfig onLineVersion = detailSystemConfigService.getConfigByKey("ios_online_version", ds, acceptData.getVersion());
        DetailSystemConfig onLineVersion = detailSystemConfigService.getConfigByKey("ios_online_version",  acceptData.getDetailSystem(), acceptData.getVersion());
        if (onLineVersion != null && Integer.parseInt(onLineVersion.getValue()) <= acceptData.getVersion()) {
            SolrVideoSearchFilter filter = new SolrVideoSearchFilter();
            filter.setResourceIds(Arrays.asList(new String[]{PPTVUtil.RESOURCE_ID + ""}));
src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java
@@ -12,6 +12,7 @@
import com.yeshi.buwan.domain.video.VideoWatchHistory;
import com.yeshi.buwan.dto.log.BaseLog;
import com.yeshi.buwan.dto.statistic.video.VideoDetailStatisticData;
import com.yeshi.buwan.exception.video.VideoPlayException;
import com.yeshi.buwan.videos.mogotv.MogoTVUtil;
import com.yeshi.buwan.videos.pptv.PPTVApiUtil;
import com.yeshi.buwan.videos.pptv.PPTVUtil;
@@ -205,7 +206,7 @@
            list.add(ht);
        if ("309" .equals(vtid)) {
            if (!"ios" .equalsIgnoreCase(acceptData.getPlatform())) {
                Map<String, String> confMap = configService.getConfigAsMap(detailSystem, acceptData.getVersion());
                Map<String, String> confMap = configService.getConfigAsMap(acceptData.getChildDetailSystem(), acceptData.getVersion());
                String mm = confMap.get("meinv_mm_count");
                int count = Integer.parseInt(mm);
                if (count > 0) {
@@ -234,8 +235,8 @@
                }
                if (VersionUtil.isGraterThan387(acceptData.getPlatform(), acceptData.getVersion())) {
                    DetailSystemConfig adContent = configService.getConfigByKey("home_banner_ad_content", acceptData.getDetailSystem(), acceptData.getVersion());
                    DetailSystemConfig adPosition = configService.getConfigByKey("home_banner_ad_position", acceptData.getDetailSystem(), acceptData.getVersion());
                    DetailSystemConfig adContent = configService.getConfigByKey("home_banner_ad_content",  acceptData.getChildDetailSystem(), acceptData.getVersion());
                    DetailSystemConfig adPosition = configService.getConfigByKey("home_banner_ad_position", acceptData.getChildDetailSystem(), acceptData.getVersion());
                    if (adContent != null && adPosition != null) {
                        HomeType.HomeTypeAd ad = new Gson().fromJson(adContent.getValue(), HomeType.HomeTypeAd.class);
                        int adP = Integer.parseInt(adPosition.getValue());
@@ -335,8 +336,8 @@
        try {
            if (VersionUtil.isGraterThan387(acceptData.getPlatform(), acceptData.getVersion()) && dataKey.equalsIgnoreCase("recommend")) {
                DetailSystemConfig adContent = configService.getConfigByKey("home_banner_ad_content", acceptData.getDetailSystem(), acceptData.getVersion());
                DetailSystemConfig adPosition = configService.getConfigByKey("home_banner_ad_position", acceptData.getDetailSystem(), acceptData.getVersion());
                DetailSystemConfig adContent = configService.getConfigByKey("home_banner_ad_content",  acceptData.getChildDetailSystem(), acceptData.getVersion());
                DetailSystemConfig adPosition = configService.getConfigByKey("home_banner_ad_position", acceptData.getChildDetailSystem(), acceptData.getVersion());
                if (adContent != null && adPosition != null) {
                    HomeType.HomeTypeAd ad = new Gson().fromJson(adContent.getValue(), HomeType.HomeTypeAd.class);
                    int adP = Integer.parseInt(adPosition.getValue());
@@ -976,7 +977,12 @@
        DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName());
        PlayUrl pu = videoDeailUtil.getPlayUrl(acceptData, detailSystem.getId(), id, type, Integer.parseInt(resourceId), videoId);
        PlayUrl pu = null;
        try {
            pu = videoDeailUtil.getPlayUrl(acceptData, detailSystem.getId(), id, type, Integer.parseInt(resourceId), videoId);
        } catch (VideoPlayException e) {
            e.printStackTrace();
        }
        if (pu != null) {
            if (!StringUtil.isNullOrEmpty(pu.getUrl()))
@@ -1030,7 +1036,7 @@
    public void isPraise(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
        DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName());
        DetailSystemConfig config = configService.getConfigByKey("banner_praise", detailSystem, acceptData.getVersion());
        DetailSystemConfig config = configService.getConfigByKey("banner_praise",  acceptData.getChildDetailSystem(), acceptData.getVersion());
        if ("是" .equals(config.getValue())) {
            out.print(JsonUtil.loadTrueJson("1"));
        } else {
@@ -1052,7 +1058,7 @@
    public void getRecommendSearchSpecial(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
        DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName());
        //推荐搜索专题
        DetailSystemConfig config = configService.getConfigByKey("recommend_search_special_position", detailSystem, acceptData.getVersion());
        DetailSystemConfig config = configService.getConfigByKey("recommend_search_special_position",  acceptData.getChildDetailSystem(), acceptData.getVersion());
        if (config == null) {
            out.print(JsonUtil.loadFalseAdmin("位置为空"));
            return;
src/main/java/com/yeshi/buwan/controller/parser/SearchParser.java
@@ -196,7 +196,7 @@
            item.put("icon", map.getIcon());
            String name = item.optString("name");
            //魅族和小米不添加
            if (("xiaomi" .equalsIgnoreCase(acceptData.getChannel()) || "meizu" .equalsIgnoreCase(acceptData.getChannel())) && "hanju-video-types" .equalsIgnoreCase(pid)) {
            if (("xiaomi" .equalsIgnoreCase(acceptData.getChannel())) && "hanju-video-types" .equalsIgnoreCase(pid)) {
                if (name.contains("电视剧") || name.contains("电影") || name.contains("综艺") || name.contains("少儿")) {
                    array.add(item);
                }
src/main/java/com/yeshi/buwan/controller/parser/UserParser.java
@@ -105,7 +105,7 @@
            out.print(JsonUtil.loadFalseJson("获取uid失败"));
            return;
        } else {
            Map<String, String> map = configService.getConfigAsMap(detailSystem, acceptData.getVersion());
            Map<String, String> map = configService.getConfigAsMap(acceptData.getChildDetailSystem(), acceptData.getVersion());
            ShareContent share = shareService.getShareContent(detailSystem.getId());
            JSONObject object = new JSONObject();
            object.put("Uid", uid);
@@ -721,7 +721,7 @@
    //新版热门搜索
    public void getHotSearchNew(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
        DetailSystemConfig config = configService.getConfigByKey("hot_search", acceptData.getDetailSystem(), acceptData.getVersion());
        DetailSystemConfig config = configService.getConfigByKey("hot_search",  acceptData.getDetailSystem(), acceptData.getVersion());
        if (config == null) {
            out.print(JsonUtil.loadFalseJson("无内容"));
            return;
src/main/java/com/yeshi/buwan/controller/parser/ZhiBoParser.java
@@ -114,10 +114,11 @@
        List<LiveType> typelist = new ArrayList<LiveType>();
        String value = "";
        if ("IOS".equalsIgnoreCase(acceptData.getPlatform())) {
            DetailSystemConfig config = configService.getConfigByKey("open_huajiao_IOS", detailSystem, acceptData.getVersion());
            DetailSystemConfig config = configService.getConfigByKey("open_huajiao_IOS",  acceptData.getDetailSystem(), acceptData.getVersion());
            value = config.getValue();
        } else {
            DetailSystemConfig config = configService.getConfigByKey("open_huajiao_Android", detailSystem, acceptData.getVersion());
            DetailSystemConfig config = configService.getConfigByKey("open_huajiao_Android",  acceptData.getDetailSystem(), acceptData.getVersion());
            value = config.getValue();
        }
        if ("是".equals(value)) {
src/main/java/com/yeshi/buwan/controller/parser/web/WebHomeParser.java
@@ -8,6 +8,7 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import com.yeshi.buwan.exception.video.VideoPlayException;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.methods.GetMethod;
@@ -934,7 +935,12 @@
        DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName);
        PlayUrl pu = videoDeailUtil.getPlayUrl(null, detailSystem.getId(), id, type, Integer.parseInt(resourceId), videoId);
        PlayUrl pu = null;
        try {
            pu = videoDeailUtil.getPlayUrl(null, detailSystem.getId(), id, type, Integer.parseInt(resourceId), videoId);
        } catch (VideoPlayException e) {
            e.printStackTrace();
        }
        if (pu != null) {
            if (!StringUtil.isNullOrEmpty(pu.getUrl()))
src/main/java/com/yeshi/buwan/controller/parser/web/WebVideosParser.java
@@ -7,6 +7,7 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import com.yeshi.buwan.exception.video.VideoPlayException;
import org.springframework.stereotype.Controller;
import com.yeshi.buwan.domain.CategoryContry;
@@ -378,7 +379,12 @@
        DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName);
        PlayUrl pu = videoDeailUtil.getPlayUrl(null, detailSystem.getId(), id, type, Integer.parseInt(resourceId), videoId);
        PlayUrl pu = null;
        try {
            pu = videoDeailUtil.getPlayUrl(null, detailSystem.getId(), id, type, Integer.parseInt(resourceId), videoId);
        } catch (VideoPlayException e) {
            e.printStackTrace();
        }
        if (pu != null) {
            if (!StringUtil.isNullOrEmpty(pu.getUrl()))
src/main/java/com/yeshi/buwan/dao/live/TVLiveChannelDao.java
@@ -45,6 +45,9 @@
        if (bean.getState() != null) {
            update.set("state", bean.getState());
        }
        if (bean.getProgramList() != null) {
            update.set("programList", bean.getProgramList());
        }
        if (bean.getCreateTime() != null) {
            update.set("createTime", bean.getCreateTime());
        }
src/main/java/com/yeshi/buwan/dao/live/TVLiveChannelResourceMapDao.java
@@ -37,6 +37,19 @@
        if (bean.getCreateTime() != null) {
            update.set("createTime", bean.getCreateTime());
        }
        if (bean.getPlayUrl() != null) {
            update.set("playUrl", bean.getPlayUrl());
        }
        if (bean.getSubResourceName() != null) {
            update.set("subResourceName", bean.getSubResourceName());
        }
        if (bean.getCreateTime() != null) {
            update.set("createTime", bean.getCreateTime());
        }
        update.set("updateTime", new Date());
        update(query, update);
    }
src/main/java/com/yeshi/buwan/dao/live/TVLiveProgramResourceDao.java
New file
@@ -0,0 +1,97 @@
package com.yeshi.buwan.dao.live;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Repository;
import java.util.List;
import com.yeshi.buwan.domain.live.TVLiveProgramResource;
import com.yeshi.buwan.dao.base.MongodbBaseDao;
import java.util.Date;
import com.yeshi.buwan.domain.live.TVLiveProgramResource.TVLiveProgramResourceType;
import java.lang.String;
import java.util.ArrayList;
@Repository
public class TVLiveProgramResourceDao extends MongodbBaseDao<TVLiveProgramResource> {
    public void updateSelective(TVLiveProgramResource bean) {
        Query query = new Query();
        Update update = new Update();
        query.addCriteria(Criteria.where("id").is(bean.getId()));
        if (bean.getChannelId() != null) {
            update.set("channelId", bean.getChannelId());
        }
        if (bean.getUrl() != null) {
            update.set("url", bean.getUrl());
        }
        if (bean.getType() != null) {
            update.set("type", bean.getType());
        }
        if (bean.getCreateTime() != null) {
            update.set("createTime", bean.getCreateTime());
        }
        update.set("updateTime", new Date());
        update(query, update);
    }
    public List<TVLiveProgramResource> list(DaoQuery daoQuery) {
        Query query = getQuery(daoQuery);
        if (daoQuery.sortList != null && daoQuery.sortList.size() > 0) {
            query.with(new Sort(daoQuery.sortList));
        }
        query.skip(daoQuery.start);
        query.limit(daoQuery.count);
        return findList(query);
    }
    public long count(DaoQuery daoQuery) {
        Query query = getQuery(daoQuery);
        return count(query);
    }
    private Query getQuery(DaoQuery daoQuery) {
        List<Criteria> andList = new ArrayList<>();
        if (daoQuery.channelId != null) {
            andList.add(Criteria.where("channelId").is(daoQuery.channelId));
        }
        if (daoQuery.url != null) {
            andList.add(Criteria.where("url").is(daoQuery.url));
        }
        if (daoQuery.type != null) {
            andList.add(Criteria.where("type").is(daoQuery.type));
        }
        if (daoQuery.minCreateTime != null) {
            andList.add(Criteria.where("createTime").gte(daoQuery.minCreateTime));
        }
        if (daoQuery.maxCreateTime != null) {
            andList.add(Criteria.where("createTime").lt(daoQuery.maxCreateTime));
        }
        Query query = new Query();
        Criteria[] ands = new Criteria[andList.size()];
        andList.toArray(ands);
        if (ands.length > 0) {
            query.addCriteria(new Criteria().andOperator(ands));
        }
        return query;
    }
    public static class DaoQuery {
        public String channelId;
        public String url;
        public TVLiveProgramResource.TVLiveProgramResourceType type;
        public Date minCreateTime;
        public Date maxCreateTime;
        public int start;
        public int count;
        public List<Sort.Order> sortList;
    }
}
src/main/java/com/yeshi/buwan/dao/video/StarInfoDao.java
New file
@@ -0,0 +1,103 @@
package com.yeshi.buwan.dao.video;
import javafx.animation.KeyValue;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Repository;
import com.yeshi.buwan.domain.video.StarInfo;
import java.util.List;
import com.yeshi.buwan.dao.base.MongodbBaseDao;
import java.util.Date;
import java.lang.String;
import java.util.ArrayList;
@Repository
public class StarInfoDao extends MongodbBaseDao<StarInfo> {
    public void updateSelective(StarInfo bean) {
        Query query = new Query();
        Update update = new Update();
        query.addCriteria(Criteria.where("id").is(bean.getId()));
        if (bean.getChineseName() != null) {
            update.set("chineseName", bean.getChineseName());
        }
        if (bean.getEnglishName() != null) {
            update.set("englishName", bean.getEnglishName());
        }
        if (bean.getAvatar() != null) {
            update.set("avatar", bean.getAvatar());
        }
        if (bean.getDetailUrl() != null) {
            update.set("detailUrl", bean.getDetailUrl());
        }
        if (bean.getCreateTime() != null) {
            update.set("createTime", bean.getCreateTime());
        }
        update.set("updateTime", new Date());
        update(query, update);
    }
    public List<StarInfo> list(DaoQuery daoQuery) {
        Query query = getQuery(daoQuery);
        if (daoQuery.sortList != null && daoQuery.sortList.size() > 0) {
            query.with(new Sort(daoQuery.sortList));
        }
        query.skip(daoQuery.start);
        query.limit(daoQuery.count);
        return findList(query);
    }
    public long count(DaoQuery daoQuery) {
        Query query = getQuery(daoQuery);
        return count(query);
    }
    private Query getQuery(DaoQuery daoQuery) {
        List<Criteria> andList = new ArrayList<>();
        if (daoQuery.chineseName != null) {
            andList.add(Criteria.where("chineseName").is(daoQuery.chineseName));
        }
        if (daoQuery.englishName != null) {
            andList.add(Criteria.where("englishName").is(daoQuery.englishName));
        }
        if (daoQuery.avatar != null) {
            andList.add(Criteria.where("avatar").is(daoQuery.avatar));
        }
        if (daoQuery.detailUrl != null) {
            andList.add(Criteria.where("detailUrl").is(daoQuery.detailUrl));
        }
        if (daoQuery.minCreateTime != null) {
            andList.add(Criteria.where("createTime").gte(daoQuery.minCreateTime));
        }
        if (daoQuery.maxCreateTime != null) {
            andList.add(Criteria.where("createTime").lt(daoQuery.maxCreateTime));
        }
        Query query = new Query();
        Criteria[] ands = new Criteria[andList.size()];
        andList.toArray(ands);
        if (ands.length > 0) {
            query.addCriteria(new Criteria().andOperator(ands));
        }
        return query;
    }
    public static class DaoQuery {
        public String chineseName;
        public String englishName;
        public String avatar;
        public String detailUrl;
        public Date minCreateTime;
        public Date maxCreateTime;
        public int start;
        public int count;
        public List<Sort.Order> sortList;
    }
}
src/main/java/com/yeshi/buwan/dao/video/VideoResourcePlayVersionMapDao.java
New file
@@ -0,0 +1,70 @@
package com.yeshi.buwan.dao.video;
import com.yeshi.buwan.dao.base.MongodbBaseDao;
import com.yeshi.buwan.domain.video.VideoResourcePlayVersionMap;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Repository
public class VideoResourcePlayVersionMapDao extends MongodbBaseDao<VideoResourcePlayVersionMap> {
    public void updateSelective(VideoResourcePlayVersionMap bean) {
        Query query = new Query();
        Update update = new Update();
        query.addCriteria(Criteria.where("id").is(bean.getId()));
        if (bean.getDetailSystemId() != null) {
            update.set("detailSystemId", bean.getDetailSystemId());
        }
        if (bean.getVersion() != null) {
            update.set("version", bean.getVersion());
        }
        if (bean.getResourceId() != null) {
            update.set("resourceId", bean.getResourceId());
        }
        if (bean.getRemarks() != null) {
            update.set("remarks", bean.getRemarks());
        }
        if (bean.getCreateTime() != null) {
            update.set("createTime", bean.getCreateTime());
        }
        update.set("updateTime", new Date());
        update(query, update);
    }
    /**
     * 获取有效的来源
     *
     * @param detailSystemId
     * @param version
     * @return
     */
    public List<VideoResourcePlayVersionMap> listValid(String detailSystemId, Integer version, String channel) {
        Query query = new Query();
        List<Criteria> andList = new ArrayList<>();
        andList.add(Criteria.where("detailSystemId").is(detailSystemId));
        andList.add(Criteria.where("version").lte(version));
        if (channel != null) {
            Query childQuery = new Query();
            childQuery.addCriteria(new Criteria().andOperator(Criteria.where("detailSystemId").is(detailSystemId),Criteria.where("version").lte(version), Criteria.where("channel").is(channel.toLowerCase())));
            if (count(childQuery) > 0) {
                andList.add(Criteria.where("channel").is(channel));
            } else {
                andList.add(Criteria.where("channel").is(null));
            }
        } else {
            andList.add(Criteria.where("channel").is(null));
        }
        Criteria[] cts = new Criteria[andList.size()];
        andList.toArray(cts);
        query.addCriteria(new Criteria().andOperator(cts));
        return findList(query);
    }
}
src/main/java/com/yeshi/buwan/domain/live/TVLiveChannel.java
@@ -5,6 +5,7 @@
import org.springframework.data.mongodb.core.mapping.Document;
import java.util.Date;
import java.util.List;
/**
 * 电视直播渠道
@@ -31,6 +32,8 @@
    private Integer state;
    private Date createTime;
    private Date updateTime;
    //节目列表
    private List<TVLiveProgram> programList;
    public String getId() {
@@ -120,4 +123,43 @@
    public void setState(Integer state) {
        this.state = state;
    }
    public List<TVLiveProgram> getProgramList() {
        return programList;
    }
    public void setProgramList(List<TVLiveProgram> programList) {
        this.programList = programList;
    }
    /**
     * 直播节目
     */
    public static class TVLiveProgram {
        private String time;
        private String name;
        public TVLiveProgram(String time, String name) {
            this.time = time;
            this.name = name;
        }
        public String getTime() {
            return time;
        }
        public void setTime(String time) {
            this.time = time;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
    }
}
src/main/java/com/yeshi/buwan/domain/live/TVLiveChannelResourceMap.java
@@ -1,5 +1,6 @@
package com.yeshi.buwan.domain.live;
import com.yeshi.buwan.util.StringUtil;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
@@ -17,6 +18,11 @@
    private Integer weight;
    private Date createTime;
    //子来源名称
    private String subResourceName;
    //播放链接
    private String playUrl;
    public String getId() {
        return id;
@@ -26,8 +32,12 @@
        this.id = id;
    }
    public static String createId(String channelId, TVLiveResource resource) {
        return channelId + "-" + resource.name();
    public static String createId(String channelId, TVLiveResource resource, String subResourceName) {
        String id = channelId + "-" + resource.name();
        if (!StringUtil.isNullOrEmpty(subResourceName)) {
            id += "-" + subResourceName;
        }
        return id;
    }
    public String getChannelId() {
@@ -69,4 +79,21 @@
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getSubResourceName() {
        return subResourceName;
    }
    public void setSubResourceName(String subResourceName) {
        this.subResourceName = subResourceName;
    }
    public String getPlayUrl() {
        return playUrl;
    }
    public void setPlayUrl(String playUrl) {
        this.playUrl = playUrl;
    }
}
src/main/java/com/yeshi/buwan/domain/live/TVLiveProgramResource.java
New file
@@ -0,0 +1,81 @@
package com.yeshi.buwan.domain.live;
import org.springframework.data.annotation.Id;
import java.util.Date;
/**
 * 电视节目源
 */
public class TVLiveProgramResource {
    public enum TVLiveProgramResourceType {
        //电视猫
        dianshimao,
        //搜视网
        tvsou
    }
    @Id
    private String id;
    private String channelId;
    //源链接
    private String url;
    private TVLiveProgramResourceType type;
    private Date createTime;
    private Date updateTime;
    public static String createId(String channelId, TVLiveProgramResourceType type) {
        return channelId + "-" + type.name();
    }
    public String getChannelId() {
        return channelId;
    }
    public void setChannelId(String channelId) {
        this.channelId = channelId;
    }
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    public TVLiveProgramResourceType getType() {
        return type;
    }
    public void setType(TVLiveProgramResourceType type) {
        this.type = type;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
}
src/main/java/com/yeshi/buwan/domain/video/StarInfo.java
New file
@@ -0,0 +1,72 @@
package com.yeshi.buwan.domain.video;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import java.util.Date;
/**
 * @author Administrator
 * @title: StarInfo
 * @description: 明星信息
 * @date 2021/9/23 10:11
 */
@Document(collection = "starInfo")
public class StarInfo {
    //douban的明星ID
    @Id
    private String id;
    private String chineseName;
    private String englishName;
    private String avatar;
    private String detailUrl;
    private Date createTime;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getChineseName() {
        return chineseName;
    }
    public void setChineseName(String chineseName) {
        this.chineseName = chineseName;
    }
    public String getEnglishName() {
        return englishName;
    }
    public void setEnglishName(String englishName) {
        this.englishName = englishName;
    }
    public String getAvatar() {
        return avatar;
    }
    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }
    public String getDetailUrl() {
        return detailUrl;
    }
    public void setDetailUrl(String detailUrl) {
        this.detailUrl = detailUrl;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}
src/main/java/com/yeshi/buwan/domain/video/VideoResourcePlayVersionMap.java
New file
@@ -0,0 +1,109 @@
package com.yeshi.buwan.domain.video;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import java.util.Date;
/**
 * 视频来源播放的版本映射
 */
@Document(collection = "videoResourcePlayVersionMap")
public class VideoResourcePlayVersionMap {
    @Id
    private String id;
    @Indexed
    private String detailSystemId;
    @Indexed
    private Integer version;
    private String resourceId;
    private String remarks;
    private Date createTime;
    private Date updateTime;
    private String channel;
    public VideoResourcePlayVersionMap() {
    }
    public VideoResourcePlayVersionMap(String detailSystemId, Integer version, String resourceId, String channel) {
        this.detailSystemId = detailSystemId;
        this.version = version;
        this.resourceId = resourceId;
        this.channel = channel;
    }
    public static String createId(String detailSystemId, Integer version, String resourceId, String channel) {
        String id = detailSystemId + "-" + version + "-" + resourceId;
        if (channel != null) {
            id += "-" + channel;
        }
        return id;
    }
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getDetailSystemId() {
        return detailSystemId;
    }
    public void setDetailSystemId(String detailSystemId) {
        this.detailSystemId = detailSystemId;
    }
    public Integer getVersion() {
        return version;
    }
    public void setVersion(Integer version) {
        this.version = version;
    }
    public String getResourceId() {
        return resourceId;
    }
    public void setResourceId(String resourceId) {
        this.resourceId = resourceId;
    }
    public String getRemarks() {
        return remarks;
    }
    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getChannel() {
        return channel;
    }
    public void setChannel(String channel) {
        this.channel = channel;
    }
}
src/main/java/com/yeshi/buwan/exception/video/VideoPlayException.java
New file
@@ -0,0 +1,34 @@
package com.yeshi.buwan.exception.video;
/**
 * 爱奇艺搜索引擎异常
 */
public class VideoPlayException extends Exception {
    private int code;
    private String msg;
    public VideoPlayException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public VideoPlayException(String msg) {
        this.msg = msg;
    }
    public String getMsg() {
        return msg;
    }
    public int getCode() {
        return code;
    }
    @Override
    public String getMessage() {
        return msg;
    }
}
src/main/java/com/yeshi/buwan/job/LiveJob.java
@@ -4,14 +4,19 @@
import com.xxl.job.core.handler.annotation.XxlJob;
import com.yeshi.buwan.domain.live.TVLiveChannel;
import com.yeshi.buwan.domain.live.TVLiveChannelResourceMap;
import com.yeshi.buwan.domain.live.TVLiveProgramResource;
import com.yeshi.buwan.domain.live.TVLiveResource;
import com.yeshi.buwan.live.migu.MiGuLiveListInfo;
import com.yeshi.buwan.live.migu.MiguLiveApiUtil;
import com.yeshi.buwan.service.inter.live.MiGuLiveService;
import com.yeshi.buwan.service.inter.live.TVLiveChannelResourceService;
import com.yeshi.buwan.service.inter.live.TVLiveChannelService;
import com.yeshi.buwan.service.inter.live.TVLiveProgramResourceService;
import com.yeshi.buwan.service.inter.system.SystemConfigService;
import com.yeshi.buwan.util.StringUtil;
import com.yeshi.buwan.util.factory.live.TVLiveChannelFactory;
import com.yeshi.buwan.util.tvlive.DianShiMaoUtil;
import com.yeshi.buwan.util.tvlive.TVSOUUtil;
import net.sf.json.JSONArray;
import org.springframework.stereotype.Component;
@@ -44,12 +49,17 @@
            for (MiGuLiveListInfo info : mList) {
                miGuLiveService.saveChannelInfo(info);
                TVLiveChannel channel = TVLiveChannelFactory.create(info);
                //添加到频道
                tvLiveService.save(channel);
                TVLiveChannel old = tvLiveService.selectByPrimaryKey(channel.getId());
                if (old == null) {
                    //添加到频道
                    tvLiveService.save(channel);
                } else {
                    tvLiveService.update(channel);
                }
                TVLiveChannelResourceMap map = new TVLiveChannelResourceMap();
                map.setChannelId(channel.getId());
                map.setId(TVLiveChannelResourceMap.createId(channel.getId(), TVLiveResource.migu));
                map.setId(TVLiveChannelResourceMap.createId(channel.getId(), TVLiveResource.migu, null));
                map.setResource(TVLiveResource.migu);
                map.setRid(info.getId());
                map.setWeight(1);
@@ -62,4 +72,92 @@
    }
    @Resource
    private TVLiveProgramResourceService tvLiveProgramResourceService;
    @Resource
    private TVLiveChannelService tvLiveChannelService;
    /**
     * 更新节目单
     *
     * @param params
     * @return
     * @throws Exception
     */
    @XxlJob("live-updateprograms")
    public ReturnT<String> updatePrograms(String params) throws Exception {
        updatePrograms_TVSOU(params);
        return ReturnT.SUCCESS;
    }
    /**
     * 电视猫
     *
     * @param params
     * @throws Exception
     */
    public void updatePrograms_DianshiMao(String params) throws Exception {
        if (StringUtil.isNullOrEmpty(params)) {
            List<TVLiveProgramResource> list = tvLiveProgramResourceService.listByType(TVLiveProgramResource.TVLiveProgramResourceType.dianshimao, 1, 1000);
            int count = 0;
            for (TVLiveProgramResource resource : list) {
                count++;
                List<TVLiveChannel.TVLiveProgram> plist = DianShiMaoUtil.getProgramList(resource.getUrl());
                System.out.println(count);
                Thread.sleep(1000);
                if (plist != null && plist.size() > 0) {
                    tvLiveChannelService.savePrograms(resource.getChannelId(), plist);
                }
            }
        } else {
            //更新单个节目单
            List<TVLiveProgramResource> list = tvLiveProgramResourceService.listByChannelId(params, 1, 10);
            for (TVLiveProgramResource resource : list) {
                if (resource.getType() != TVLiveProgramResource.TVLiveProgramResourceType.dianshimao)
                    continue;
                List<TVLiveChannel.TVLiveProgram> plist = DianShiMaoUtil.getProgramList(resource.getUrl());
                if (plist != null && plist.size() > 0) {
                    tvLiveChannelService.savePrograms(resource.getChannelId(), plist);
                }
            }
        }
    }
    /**
     * 搜视网
     *
     * @param params
     * @throws Exception
     */
    public void updatePrograms_TVSOU(String params) throws Exception {
        if (StringUtil.isNullOrEmpty(params)) {
            List<TVLiveProgramResource> list = tvLiveProgramResourceService.listByType(TVLiveProgramResource.TVLiveProgramResourceType.tvsou, 1, 1000);
            int count = 0;
            for (TVLiveProgramResource resource : list) {
                count++;
                List<TVLiveChannel.TVLiveProgram> plist = TVSOUUtil.getProgramList(resource.getUrl());
                System.out.println(count);
                Thread.sleep(1000);
                if (plist != null && plist.size() > 0) {
                    tvLiveChannelService.savePrograms(resource.getChannelId(), plist);
                }
            }
        } else {
            //更新单个节目单
            List<TVLiveProgramResource> list = tvLiveProgramResourceService.listByChannelId(params, 1, 10);
            for (TVLiveProgramResource resource : list) {
                if (resource.getType() != TVLiveProgramResource.TVLiveProgramResourceType.tvsou)
                    continue;
                List<TVLiveChannel.TVLiveProgram> plist = TVSOUUtil.getProgramList(resource.getUrl());
                if (plist != null && plist.size() > 0) {
                    tvLiveChannelService.savePrograms(resource.getChannelId(), plist);
                }
            }
        }
    }
}
src/main/java/com/yeshi/buwan/live/migu/MiguLiveApiUtil.java
@@ -21,7 +21,7 @@
     * @return
     */
    public static String getPlayUrl(String pid) {
        return "https://m.miguvideo.com/mgs/msite/prd/detail.html?cid=" + pid;
        return "https://m.miguvideo.com/mgs/msite/prd/liveDetail.html?cId=" + pid;
    }
src/main/java/com/yeshi/buwan/service/imp/SearchService.java
@@ -290,18 +290,18 @@
    }
    public SearchResult searchAlbum(int videoType, String key, List<Long> resourceIds, int page, int pageSize) {
    public SearchResult searchAlbum(int videoType, String key, List<Long> resourceIds, int page, int pageSize, boolean fuzzy) {
        List<VideoInfo> localList = new ArrayList<>();
        //专辑视频集合
        Set<String> solrAlbumVids = new HashSet<>();
        SolrVideoSearchFilter filter = new SolrVideoSearchFilter();
        filter.setFuzzy(fuzzy);
        filter.setKey(key);
        if (videoType == Constant.SEARCH_RESULT_TYPE_HIGH_DEFINITION) {
            filter.setResourceIds(Arrays.asList(new String[]{PPTVUtil.RESOURCE_ID + ""}));
            logger.info("高清搜索# key:{}", key);
        } else {
            List<String> rids = new ArrayList<>();
            for (Long rid : resourceIds) {
                rids.add(rid + "");
@@ -318,7 +318,7 @@
            albumCount = solrResultDTO.getTotalCount();
            for (SolrAlbumVideo sv : (List<SolrAlbumVideo>) solrResultDTO.getVideoList()) {
                VideoInfo video = VideoInfoFactory.create(sv);
                albumSet.add(video.getName() + "#" + video.getVideoType().getId());
                albumSet.add(video.getName() + "#" + video.getVideoType().getId() + "#" + video.getYear());
                video = loadAlbumData(video);
                localList.add(video);
                solrAlbumVids.add(video.getId());
@@ -342,14 +342,25 @@
                        i--;
                    }
                }
                for (InternetSearchVideo sv : isvList) {
                    VideoInfo video = VideoInfoFactory.create(sv);
                    video = loadAlbumData(video);
                    if (albumCount < 3) {
                        localList.add(video);
                    } else {
                        if (video.getName().equalsIgnoreCase(key))
                //精确匹配,不分词
                if (!fuzzy) {
                    for (InternetSearchVideo sv : isvList) {
                        VideoInfo video = VideoInfoFactory.create(sv);
                        video = loadAlbumData(video);
                        //第一个专辑数量
                        if (albumCount < 3) {
                            localList.add(video);
                        } else {
                            if (video.getName().equalsIgnoreCase(key))
                                localList.add(video);
                        }
                    }
                } else {
                    for (InternetSearchVideo sv : isvList) {
                        VideoInfo video = VideoInfoFactory.create(sv);
                        video = loadAlbumData(video);
                        localList.add(video);
                    }
                }
            }
@@ -451,7 +462,12 @@
            localList = new ArrayList<>();
            //先搜索专辑
            int pageSize = 20;
            SearchResult searchResult = searchAlbum(videoType, key, resourceList, page, pageSize);
            SearchResult searchResult = searchAlbum(videoType, key, resourceList, page, pageSize, false);
            if (page == 1 && (searchResult == null || searchResult.videoInfoList == null || searchResult.videoInfoList.size() == 0)) {
                searchResult = searchAlbum(videoType, key, resourceList, page, pageSize, true);
            }
            if (searchResult != null && searchResult.videoInfoList != null) {
                localList.addAll(searchResult.videoInfoList);
            }
src/main/java/com/yeshi/buwan/service/imp/live/MiGuLiveServiceImpl.java
@@ -3,6 +3,7 @@
import com.yeshi.buwan.dao.live.migu.MiGuLiveListInfoDao;
import com.yeshi.buwan.live.migu.MiGuLiveListInfo;
import com.yeshi.buwan.service.inter.live.MiGuLiveService;
import com.yeshi.buwan.util.StringUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -17,7 +18,7 @@
    @Override
    public void saveChannelInfo(MiGuLiveListInfo info) {
        if (info.getId() == null) {
            info.setId(info.getpID());
            info.setId(StringUtil.Md5(info.getName()));
        }
        if (info.getCreateTime() == null) {
src/main/java/com/yeshi/buwan/service/imp/live/TVLiveCategoryChannelServiceImpl.java
@@ -49,7 +49,7 @@
    @Override
    public List<TVLiveChannel> listChannelByCid(String cid, String nameKey, int page, int pageSize) {
        //查询Map
        List<TVLiveCategoryChannelMap> mapList = tvLiveCategoryChannelMapDao.listByCid(cid, (page-1)*pageSize, pageSize);
        List<TVLiveCategoryChannelMap> mapList = tvLiveCategoryChannelMapDao.listByCid(cid, (page - 1) * pageSize, pageSize);
        if (mapList == null || mapList.size() == 0)
            return null;
        List<String> cids = new ArrayList<>();
@@ -66,7 +66,8 @@
        List<TVLiveChannel> resultList = new ArrayList<>();
        for (TVLiveCategoryChannelMap sc : mapList) {
            resultList.add(map.get(sc.getChannelId()));
            if (map.get(sc.getChannelId()) != null)
                resultList.add(map.get(sc.getChannelId()));
        }
        return resultList;
    }
src/main/java/com/yeshi/buwan/service/imp/live/TVLiveChannelResourceServiceImpl.java
@@ -43,7 +43,7 @@
        if (map == null)
            return;
        if (map.getId() == null) {
            map.setId(TVLiveChannelResourceMap.createId(map.getChannelId(), map.getResource()));
            map.setId(TVLiveChannelResourceMap.createId(map.getChannelId(), map.getResource(),map.getSubResourceName()));
        }
        if (tvLiveChannelResourceMapDao.get(map.getId()) != null)
            return;
src/main/java/com/yeshi/buwan/service/imp/live/TVLiveChannelServiceImpl.java
@@ -43,8 +43,36 @@
            channel.setUpdateTime(new Date());
        }
        tvLiveChannelDao.save(channel);
        return channel;
    }
    @Override
    public TVLiveChannel addChannel(TVLiveChannel channel) throws ParamsException, Exception {
        if (channel == null || StringUtil.isNullOrEmpty(channel.getName())) {
            throw new ParamsException(ParamsException.CODE_PARAMS_NOT_ENOUGH, "名称不能为空");
        }
        if (StringUtil.isNullOrEmpty(channel.gethPicture())) {
            throw new ParamsException(ParamsException.CODE_PARAMS_NOT_ENOUGH, "横图不能为空");
        }
        if (channel.getId() == null) {
            channel.setId(StringUtil.Md5(channel.getName()));
        }
        if (channel.getState() == null) {
            channel.setState(TVLiveChannel.STATE_NORMAL);
        }
        if (tvLiveChannelDao.get(channel.getId()) != null) {
            throw new Exception("频道已经存在");
        }
        return save(channel);
    }
    @Override
@@ -88,5 +116,18 @@
        daoQuery.name = name;
        return tvLiveChannelDao.count(daoQuery);
    }
    @Override
    public TVLiveChannel selectByPrimaryKey(String id) {
        return tvLiveChannelDao.get(id);
    }
    @Override
    public void savePrograms(String id, List<TVLiveChannel.TVLiveProgram> tvLivePrograms) {
        TVLiveChannel channel = new TVLiveChannel();
        channel.setId(id);
        channel.setProgramList(tvLivePrograms);
        tvLiveChannelDao.updateSelective(channel);
    }
}
src/main/java/com/yeshi/buwan/service/imp/live/TVLiveProgramResourceServiceImpl.java
New file
@@ -0,0 +1,50 @@
package com.yeshi.buwan.service.imp.live;
import com.yeshi.buwan.domain.live.TVLiveProgramResource;
import com.yeshi.buwan.dao.live.TVLiveProgramResourceDao;
import com.yeshi.buwan.exception.ParamsException;
import com.yeshi.buwan.service.inter.live.TVLiveProgramResourceService;
import javax.annotation.Resource;
import com.yeshi.buwan.util.StringUtil;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Service
public class TVLiveProgramResourceServiceImpl implements TVLiveProgramResourceService {
    @Resource
    private TVLiveProgramResourceDao tVLiveProgramResourceDao;
    @Override
    public void add(TVLiveProgramResource resource) throws ParamsException {
        if (StringUtil.isNullOrEmpty(resource.getChannelId()) || StringUtil.isNullOrEmpty(resource.getUrl()) || resource.getType() == null)
            throw new ParamsException(ParamsException.CODE_PARAMS_NOT_ENOUGH, "参数不完整");
        if (resource.getId() == null)
            resource.setId(TVLiveProgramResource.createId(resource.getChannelId(), resource.getType()));
        if (resource.getCreateTime() == null)
            resource.setCreateTime(new Date());
        tVLiveProgramResourceDao.save(resource);
    }
    @Override
    public List<TVLiveProgramResource> listByChannelId(String channelId, int page, int pageSize) {
        TVLiveProgramResourceDao.DaoQuery daoQuery = new TVLiveProgramResourceDao.DaoQuery();
        daoQuery.channelId = channelId;
        daoQuery.start = (page - 1) * pageSize;
        daoQuery.count = pageSize;
        return tVLiveProgramResourceDao.list(daoQuery);
    }
    @Override
    public List<TVLiveProgramResource> listByType(TVLiveProgramResource.TVLiveProgramResourceType type, int page, int pageSize) {
        TVLiveProgramResourceDao.DaoQuery daoQuery = new TVLiveProgramResourceDao.DaoQuery();
        daoQuery.type = type;
        daoQuery.start = (page - 1) * pageSize;
        daoQuery.count = pageSize;
        return tVLiveProgramResourceDao.list(daoQuery);
    }
}
src/main/java/com/yeshi/buwan/service/imp/video/StarInfoServiceImpl.java
New file
@@ -0,0 +1,16 @@
package com.yeshi.buwan.service.imp.video;
import com.yeshi.buwan.domain.video.StarInfo;
import com.yeshi.buwan.dao.video.StarInfoDao;
import com.yeshi.buwan.service.inter.video.StarInfoService;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import java.util.Date;
@Service
public class StarInfoServiceImpl implements StarInfoService{
  @Resource
  private StarInfoDao starInfoDao;
}
src/main/java/com/yeshi/buwan/service/imp/video/VideoResourcePlayVersionMapServiceImpl.java
New file
@@ -0,0 +1,48 @@
package com.yeshi.buwan.service.imp.video;
import com.yeshi.buwan.dao.video.VideoResourcePlayVersionMapDao;
import com.yeshi.buwan.domain.video.VideoResourcePlayVersionMap;
import com.yeshi.buwan.service.inter.video.VideoResourcePlayVersionMapService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Service
public class VideoResourcePlayVersionMapServiceImpl implements VideoResourcePlayVersionMapService {
    @Resource
    private VideoResourcePlayVersionMapDao videoResourcePlayVersionMapDao;
    @Override
    public void add(VideoResourcePlayVersionMap map) throws Exception {
        if (map == null || map.getDetailSystemId() == null || map.getResourceId() == null || map.getVersion() == null) {
            throw new Exception("参数不完整");
        }
        map.setId(VideoResourcePlayVersionMap.createId(map.getDetailSystemId(), map.getVersion(), map.getResourceId(), map.getChannel()));
        if (map.getCreateTime() == null) {
            map.setCreateTime(new Date());
        }
        videoResourcePlayVersionMapDao.save(map);
    }
    @Override
    public List<VideoResourcePlayVersionMap> list(String detailSystemId, Integer version, String channel) {
        return videoResourcePlayVersionMapDao.listValid(detailSystemId, version, channel);
    }
    @Override
    public List<String> listResourceId(String detailSystemId, Integer version, String channel) {
        List<VideoResourcePlayVersionMap> mapList = list(detailSystemId, version, channel);
        List<String> ids = new ArrayList<>();
        if (mapList != null) {
            for (VideoResourcePlayVersionMap map : mapList) {
                ids.add(map.getResourceId());
            }
        }
        return ids;
    }
}
src/main/java/com/yeshi/buwan/service/imp/video/VideoResourceVersionMapServiceImpl.java
@@ -6,6 +6,7 @@
import javax.annotation.Resource;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@@ -47,4 +48,10 @@
        }
        return ids;
    }
    @Override
    public List<VideoResourceVersionMap> listAll() {
        Query query = new Query();
        return videoResourceVersionMapDao.findList(query);
    }
}
src/main/java/com/yeshi/buwan/service/inter/live/TVLiveChannelService.java
@@ -17,6 +17,8 @@
    public TVLiveChannel save(@Valid TVLiveChannel channel) throws ParamsException;
    public TVLiveChannel addChannel(@Valid TVLiveChannel channel) throws ParamsException,Exception;
    public void delete(String id);
    public void update(TVLiveChannel channel);
@@ -25,5 +27,9 @@
    public long count(String name, Integer state);
    public TVLiveChannel selectByPrimaryKey(String id);
    public void savePrograms(String id, List<TVLiveChannel.TVLiveProgram> tvLivePrograms);
}
src/main/java/com/yeshi/buwan/service/inter/live/TVLiveProgramResourceService.java
New file
@@ -0,0 +1,29 @@
package com.yeshi.buwan.service.inter.live;
import com.yeshi.buwan.domain.live.TVLiveProgramResource;
import com.yeshi.buwan.exception.ParamsException;
import javax.validation.Valid;
import java.util.List;
public interface TVLiveProgramResourceService {
    /**
     * 新增
     *
     * @param resource
     * @throws ParamsException
     */
    public void add(@Valid TVLiveProgramResource resource) throws ParamsException;
    /**
     *
     * @param channelId
     * @return
     */
    public List<TVLiveProgramResource> listByChannelId(String channelId,int page, int pageSize);
    public List<TVLiveProgramResource> listByType(TVLiveProgramResource.TVLiveProgramResourceType type,int page,int pageSize);
}
src/main/java/com/yeshi/buwan/service/inter/video/StarInfoService.java
New file
@@ -0,0 +1,7 @@
package com.yeshi.buwan.service.inter.video;
import com.yeshi.buwan.domain.video.StarInfo;
public interface StarInfoService {
}
src/main/java/com/yeshi/buwan/service/inter/video/VideoResourcePlayVersionMapService.java
New file
@@ -0,0 +1,44 @@
package com.yeshi.buwan.service.inter.video;
import com.yeshi.buwan.domain.video.VideoResourcePlayVersionMap;
import java.util.List;
/**
 * @author HXH
 * @title: 视频播放源管理服务
 * @projectName BuWan
 * @description: 用于管理视频获取播放链接时能够播放哪些播放源,
 * 与VideoResourceVersionMapService不同的是,
 * 前者只能处理是否显示的问题,后者处理的是是否可以播放
 * @date
 */
public interface VideoResourcePlayVersionMapService {
    /**
     * 添加
     *
     * @param map
     * @throws Exception
     */
    public void add(VideoResourcePlayVersionMap map) throws Exception;
    /**
     * 根据系统和版本查询
     *
     * @param detailSystemId
     * @param version
     * @return
     */
    public List<VideoResourcePlayVersionMap> list(String detailSystemId, Integer version, String channel);
    /**
     * 根据系统和版本查询ResourceId
     *
     * @param detailSystemId
     * @param version
     * @return
     */
    public List<String> listResourceId(String detailSystemId, Integer version, String channel);
}
src/main/java/com/yeshi/buwan/service/inter/video/VideoResourceVersionMapService.java
@@ -32,4 +32,10 @@
     */
    public List<String> listResourceId(String detailSystemId, Integer version,String channel);
    public List<VideoResourceVersionMap> listAll();
}
src/main/java/com/yeshi/buwan/service/manager/search/SolrInternetSearchVideoDataManager.java
@@ -99,10 +99,14 @@
        Query query = null;
        if (!StringUtil.isNullOrEmpty(filter.getKey())) {
            //solr精准检索需要带引号
            try {
                query = new SimpleQuery(new Criteria("nameStr").startsWith(key).or("actors").expression("\"" + key + "\""));
            } catch (InvalidDataAccessApiUsageException e) {
                query = new SimpleQuery(new Criteria("name").expression("\"" + key + "\""));
            if (filter.isFuzzy()) {
                query = new SimpleQuery(new Criteria("name").expression(filter.getKey()));
            } else {
                try {
                    query = new SimpleQuery(new Criteria("nameStr").startsWith(key).or("actors").expression("\"" + key + "\""));
                } catch (InvalidDataAccessApiUsageException e) {
                    query = new SimpleQuery(new Criteria("name").expression("\"" + key + "\""));
                }
            }
        } else if (!StringUtil.isNullOrEmpty(filter.getActor())) {
src/main/java/com/yeshi/buwan/util/DouBanUtil.java
@@ -18,162 +18,305 @@
@Entity
public class DouBanUtil {
    public static String baseUrl = "https://movie.douban.com/subject_search?cat=102&";
    public static int maxCount = 1;
    public static String baseUrl = "https://movie.douban.com/subject_search?cat=102&";
    public static int maxCount = 1;
    public static List<VideoInfo> startSearch(String st) throws IOException {
        Document doc = Jsoup
                .connect(
                        baseUrl + "search_text="
                                + URLEncoder.encode(st, "UTF-8"))
                .userAgent(
                        "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.81 Safari/537.36")
                .timeout(20000).get();
        Element el = doc.getElementById("content");
        Elements els = el.getElementsByTag("table");
        List<VideoInfo> list = new ArrayList<VideoInfo>();
        int count = els.size() >= maxCount ? maxCount : els.size();
    /**
     * @title:
     * @description: 搜索
     * @author Administrator
     * @date 2021/9/22 17:46
     */
    public static List<VideoInfo> startSearch(String st) throws IOException {
        Document doc = Jsoup
                .connect(
                        baseUrl + "search_text="
                                + URLEncoder.encode(st, "UTF-8"))
                .userAgent(
                        "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.81 Safari/537.36")
                .timeout(20000).get();
        Element el = doc.getElementById("content");
        Elements els = el.getElementsByTag("table");
        List<VideoInfo> list = new ArrayList<VideoInfo>();
        int count = els.size() >= maxCount ? maxCount : els.size();
        for (int i = 0; i < count; i++) {
            try {
                String url = els.get(i).getElementsByTag("a").get(0)
                        .attr("href");
                LogUtil.i(url);
                Document detailDoc = Jsoup
                        .connect(url)
                        .timeout(20000)
                        .userAgent(
                                "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.81 Safari/537.36")
                        .get();
                Element detail = detailDoc.getElementById("content");
                Element vinfo = detailDoc.getElementById("info");
        for (int i = 0; i < count; i++) {
            try {
                String url = els.get(i).getElementsByTag("a").get(0)
                        .attr("href");
                LogUtil.i(url);
                Document detailDoc = Jsoup
                        .connect(url)
                        .timeout(20000)
                        .userAgent(
                                "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.81 Safari/537.36")
                        .get();
                Element detail = detailDoc.getElementById("content");
                Element vinfo = detailDoc.getElementById("info");
                String name = detail.getElementsByTag("h1").get(0)
                        .getElementsByTag("span").get(0).text();
                String name = detail.getElementsByTag("h1").get(0)
                        .getElementsByTag("span").get(0).text();
                String year = "";
                String picture = detail.getElementById("mainpic")
                        .getElementsByTag("img").get(0).attr("src")
                        .replace("/spst/", "/lpst/");
                String actor = "";
                try {
                    Elements actors = detail
                            .getElementsByAttributeValue("class", "actor")
                            .get(0)
                            .getElementsByAttributeValue("class", "attrs")
                            .get(0).getElementsByTag("span").get(0)
                            .getElementsByTag("a");
                String year = "";
                String picture = detail.getElementById("mainpic")
                        .getElementsByTag("img").get(0).attr("src")
                        .replace("/spst/", "/lpst/");
                String actor = "";
                try {
                    Elements actors = detail
                            .getElementsByAttributeValue("class", "actor")
                            .get(0)
                            .getElementsByAttributeValue("class", "attrs")
                            .get(0).getElementsByTag("span").get(0)
                            .getElementsByTag("a");
                    for (Element w : actors) {
                        actor += w.text() + " ";
                    }
                } catch (Exception e) {
                    // e.printStackTrace();
                }
                Elements beiz = detail.getElementsByAttributeValue("property",
                        "v:genre");
                String beizhu = "";
                for (Element e : beiz) {
                    beizhu += e.text() + " ";
                }
                    for (Element w : actors) {
                        actor += w.text() + " ";
                    }
                } catch (Exception e) {
                    // e.printStackTrace();
                }
                Elements beiz = detail.getElementsByAttributeValue("property",
                        "v:genre");
                String beizhu = "";
                for (Element e : beiz) {
                    beizhu += e.text() + " ";
                }
                String duration = "0";
                try {
                    detail.getElementsByAttributeValue("property", "v:runtime")
                            .get(0).attr("content");
                } catch (Exception e) {
                String duration = "0";
                try {
                    detail.getElementsByAttributeValue("property", "v:runtime")
                            .get(0).attr("content");
                } catch (Exception e) {
                }
                String introduction = "";
                try {
                    introduction = detailDoc
                            .getElementsByAttributeValue("property",
                                    "v:summary").get(0).text();
                } catch (Exception e) {
                }
                String introduction = "";
                try {
                    introduction = detailDoc
                            .getElementsByAttributeValue("property",
                                    "v:summary").get(0).text();
                } catch (Exception e) {
                }
                String score = detailDoc
                        .getElementsByAttributeValue("property", "v:average")
                        .get(0).text();
                }
                String score = detailDoc
                        .getElementsByAttributeValue("property", "v:average")
                        .get(0).text();
                String data = "";
                try {
                    data = detailDoc
                            .getElementsByAttributeValue("property",
                                    "v:initialReleaseDate").get(0).text();
                } catch (Exception e) {
                String data = "";
                try {
                    data = detailDoc
                            .getElementsByAttributeValue("property",
                                    "v:initialReleaseDate").get(0).text();
                } catch (Exception e) {
                }
                try {
                    score = detail
                            .getElementsByAttributeValue("property",
                                    "v:average").get(0).text();
                } catch (Exception e) {
                }
                try {
                    score = detail
                            .getElementsByAttributeValue("property",
                                    "v:average").get(0).text();
                } catch (Exception e) {
                }
                String director = "";
                try {
                    Elements directors = detail.getElementsByAttributeValue(
                            "rel", "v:directedBy");
                    for (int n = 0; n < directors.size(); n++) {
                        director += directors.get(n).text() + " ";
                    }
                }
                String director = "";
                try {
                    Elements directors = detail.getElementsByAttributeValue(
                            "rel", "v:directedBy");
                    for (int n = 0; n < directors.size(); n++) {
                        director += directors.get(n).text() + " ";
                    }
                } catch (Exception e) {
                } catch (Exception e) {
                }
                }
                if (director.endsWith(" "))
                    director = director.substring(0, director.length() - 1);
                Pattern pattern = Pattern
                        .compile("[0-9]{4}[-][0-9]{1,2}[-][0-9]{1,2}");
                Matcher matcher = pattern.matcher(data);
                String dateStr = null;
                if (matcher.find()) {
                    dateStr = matcher.group(0);
                }
                String month = "0";
                String day = "0";
                if (dateStr != null) {
                    year = dateStr.split("-")[0];
                    month = dateStr.split("-")[1];
                    day = dateStr.split("-")[2];
                }
                String area ="";
                String[] infoSt = vinfo.toString().split("<br />");
                for (String ist : infoSt) {
                    if (ist.contains("��Ƭ���")) {
                        try{
                        int start = ist.indexOf("</span>");
                         area = ist.substring(start + 7, ist.length())
                                .replace("\"", "").trim();
                         System.out.println(area);
                        }catch(Exception e)
                        {
                            e.printStackTrace();
                        }
                        break;
                    }
                }
                if (director.endsWith(" "))
                    director = director.substring(0, director.length() - 1);
                Pattern pattern = Pattern
                        .compile("[0-9]{4}[-][0-9]{1,2}[-][0-9]{1,2}");
                Matcher matcher = pattern.matcher(data);
                String dateStr = null;
                if (matcher.find()) {
                    dateStr = matcher.group(0);
                }
                String month = "0";
                String day = "0";
                if (dateStr != null) {
                    year = dateStr.split("-")[0];
                    month = dateStr.split("-")[1];
                    day = dateStr.split("-")[2];
                }
                String area = "";
                String[] infoSt = vinfo.toString().split("<br />");
                for (String ist : infoSt) {
                    if (ist.contains("��Ƭ���")) {
                        try {
                            int start = ist.indexOf("</span>");
                            area = ist.substring(start + 7, ist.length())
                                    .replace("\"", "").trim();
                            System.out.println(area);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        break;
                    }
                }
                VideoInfo info = new VideoInfo();
                info.setName(name);
                info.setBeizhu(beizhu);
                info.setDuration(duration);
                info.setIntroduction(introduction);
                info.setMainActor(actor);
                info.setPicture(picture);
                info.setScore(score);
                info.setYear(year);
                info.setDay(day);
                info.setMonth(month);
                info.setDirector(director);
                info.setArea(area);
                list.add(info);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return list;
    }
                VideoInfo info = new VideoInfo();
                info.setName(name);
                info.setBeizhu(beizhu);
                info.setDuration(duration);
                info.setIntroduction(introduction);
                info.setMainActor(actor);
                info.setPicture(picture);
                info.setScore(score);
                info.setYear(year);
                info.setDay(day);
                info.setMonth(month);
                info.setDirector(director);
                info.setArea(area);
                list.add(info);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return list;
    }
    private static DouBanStar getStarInfo(Element item) {
        DouBanStar star = new DouBanStar();
        String avatarStyle = item.getElementsByClass("avatar").get(0).attr("style");
        String avatar = avatarStyle.replace("background-image: url(", "").replace(")", "").trim();
        String name = item.getElementsByTag("a").get(0).attr("title");
        if (name.contains(" ")) {
            String chaineseName = name.split(" ")[0].trim();
            String englishName = name.substring(chaineseName.length()).trim();
            star.setChineseName(chaineseName);
            star.setEnglishName(englishName);
        }
        String href = item.getElementsByTag("a").get(0).attr("href");
        if (href.endsWith("/"))
            href = href.substring(0, href.length() - 1);
        String[] sts = href.split("/");
        String id = sts[sts.length - 1];
        if (!avatar.contains("default"))
            star.setAvatar(avatar);
        star.setId(id);
        star.setUrl(href);
        return star;
    }
    private static List<DouBanStar> getStarList(Element root) {
        Elements items = root.getElementsByTag("li");
        List<DouBanStar> list = new ArrayList<>();
        for (int i = 0; i < items.size(); i++) {
            Element item = items.get(i);
            DouBanStar star = getStarInfo(item);
            if (star != null) {
                list.add(star);
            }
        }
        return list;
    }
    //获取电影的影人信息
    public static Celebrities getMovieStars(String movieId) throws IOException {
        String url = String.format("https://movie.douban.com/subject/%s/celebrities", movieId);
        Document doc = Jsoup.connect(url).timeout(60000).userAgent("Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.81 Safari/537.36").get();
        Elements eles = doc.getElementById("celebrities").getElementsByClass("list-wrapper");
        Celebrities celebrities = new Celebrities();
        for (int i = 0; i < eles.size(); i++) {
            String type = eles.get(i).getElementsByTag("h2").get(0).ownText();
            if (type.contains("导演")) {
                List<DouBanStar> list = getStarList(eles.get(i));
                celebrities.setDirectors(list);
            } else if (type.contains("演员")) {
                List<DouBanStar> list = getStarList(eles.get(i));
                celebrities.setStars(list);
            }
        }
        return celebrities;
    }
    static class Celebrities {
        private List<DouBanStar> directors;
        private List<DouBanStar> stars;
        public List<DouBanStar> getDirectors() {
            return directors;
        }
        public void setDirectors(List<DouBanStar> directors) {
            this.directors = directors;
        }
        public List<DouBanStar> getStars() {
            return stars;
        }
        public void setStars(List<DouBanStar> stars) {
            this.stars = stars;
        }
    }
    static class DouBanStar {
        private String id;
        private String chineseName;
        private String englishName;
        private String avatar;
        private String url;
        public String getId() {
            return id;
        }
        public void setId(String id) {
            this.id = id;
        }
        public String getChineseName() {
            return chineseName;
        }
        public void setChineseName(String chineseName) {
            this.chineseName = chineseName;
        }
        public String getEnglishName() {
            return englishName;
        }
        public void setEnglishName(String englishName) {
            this.englishName = englishName;
        }
        public String getAvatar() {
            return avatar;
        }
        public void setAvatar(String avatar) {
            this.avatar = avatar;
        }
        public String getUrl() {
            return url;
        }
        public void setUrl(String url) {
            this.url = url;
        }
    }
    public static void main(String[] args) throws IOException {
        getMovieStars("26309788");
    }
}
src/main/java/com/yeshi/buwan/util/JuHe/VideoResourceUtil.java
@@ -1,6 +1,7 @@
package com.yeshi.buwan.util.JuHe;
import com.yeshi.buwan.domain.system.DetailSystem;
import com.yeshi.buwan.service.inter.video.VideoResourcePlayVersionMapService;
import com.yeshi.buwan.service.inter.video.VideoResourceVersionMapService;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component;
@@ -14,6 +15,9 @@
    @Resource
    private VideoResourceVersionMapService videoResourceVersionMapService;
    @Resource
    private VideoResourcePlayVersionMapService videoResourcePlayVersionMapService;
    @Cacheable(value = "homeCache", key = "'getAvailableResourceIds-'+'-'+#detailSystem.id+'-'+#versionCode+'-'+#channel")
    public List<Long> getAvailableResourceIds(DetailSystem detailSystem, int versionCode,String channel) {
        List<String> ridList = videoResourceVersionMapService.listResourceId(detailSystem.getId(), versionCode,channel);
@@ -34,4 +38,18 @@
    }
    @Cacheable(value = "homeCache", key = "'getAvailablePlayResourceIds-'+'-'+#detailSystem.id+'-'+#versionCode+'-'+#channel")
    public List<Long> getAvailablePlayResourceIds(DetailSystem detailSystem, int versionCode,String channel) {
        List<String> ridList = videoResourcePlayVersionMapService.listResourceId(detailSystem.getId(), versionCode,channel);
        List<Long> ids = new ArrayList<>();
        if (ridList != null) {
            for (String id : ridList) {
                ids.add(Long.parseLong(id));
            }
        }
        return ids;
    }
}
src/main/java/com/yeshi/buwan/util/tvlive/DianShiMaoUtil.java
New file
@@ -0,0 +1,113 @@
package com.yeshi.buwan.util.tvlive;
import com.yeshi.buwan.domain.live.TVLiveChannel;
import com.yeshi.buwan.util.NumberUtil;
import com.yeshi.buwan.util.StringUtil;
import net.sf.json.JSONArray;
import org.apache.commons.io.IOUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.yeshi.utils.HttpUtil;
import javax.script.Invocable;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 电视猫帮助类
 */
public class DianShiMaoUtil {
    private static ScriptEngine jsEngine;
    static {
        ScriptEngineManager manager = new ScriptEngineManager();
        jsEngine = manager.getEngineByName("javascript");
        InputStream scriptStream = DianShiMaoUtil.class.getClassLoader().getResourceAsStream("script\\tvlive\\dianshimao_program.js");
        try {
            String script = IOUtils.toString(scriptStream);
            jsEngine.eval(script);
        } catch (ScriptException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    /**
     * 获取当日电视节目表单
     *
     * @param url 如:https://www.tvmao.com/program/CCTV-CCTV1-w4.html
     * @return
     */
    public static List<TVLiveChannel.TVLiveProgram> getProgramList(String url) throws Exception {
        String userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36";
        Document doc = Jsoup.connect(url).userAgent(userAgent).referrer(url).timeout(60000).get();
        List<TVLiveChannel.TVLiveProgram> list = new ArrayList<>();
        Element pgrow = doc.getElementById("pgrow");
        Elements items = pgrow.getElementsByClass("over_hide");
        for (int i = 0; i < items.size(); i++) {
            list.add(parseProgram(items.get(i)));
        }
        //下一页的数据
        Element form = doc.getElementsByTag("form").get(0);
        String q = form.attr("q");
        String a = form.attr("a");
        String id = form.getElementsByTag("button").get(0).attr("id");
        //计算下一页请求链接中的p参数
        Invocable in = (Invocable) jsEngine;
        Object data = in.invokeFunction("f", q, a, id);
        String p = data.toString();
        String nextUrl = "https://www.tvmao.com/api/pg?p=" + URLEncoder.encode(p, "UTF-8");
        Map<String, String> headers = new HashMap<>();
        headers.put("User-Agent",userAgent);
        headers.put("Referer", url);
        String result = HttpUtil.get(nextUrl, headers);
        //解析下一页的结果
        JSONArray array = JSONArray.fromObject(result);
        String script = array.optString(1);
        doc = Jsoup.parse(script);
        items = doc.getElementsByClass("over_hide");
        if(items==null||items.size()<=0){
            throw  new Exception("获取下一页资源出错");
        }
        for (int i = 0; i < items.size(); i++) {
            list.add(parseProgram(items.get(i)));
        }
        return list;
    }
    private static TVLiveChannel.TVLiveProgram parseProgram(Element item) throws Exception {
        String name = item.getElementsByClass("p_show").get(0).text().trim();
        String time = item.getElementsByTag("span").get(0).text().trim();
        if (StringUtil.isNullOrEmpty(name)) {
            throw new Exception("节目名称为空");
        }
        if (!time.contains(":") || !NumberUtil.isNumeric(time.replace(":", ""))) {
            throw new Exception("时间格式错误");
        }
        return new TVLiveChannel.TVLiveProgram(time, name);
    }
    public static void main(String[] args) throws Exception {
        getProgramList("https://www.tvmao.com/program/CCTV-CCTV2-w4.html");
    }
}
src/main/java/com/yeshi/buwan/util/tvlive/TVChannelUtil.java
New file
@@ -0,0 +1,38 @@
package com.yeshi.buwan.util.tvlive;
import com.yeshi.buwan.domain.live.TVLiveChannel;
import com.yeshi.buwan.util.TimeUtil;
import java.util.Date;
import java.util.List;
public class TVChannelUtil {
    public static TVLiveChannel.TVLiveProgram[] getNowProgram(Date nowTime, List<TVLiveChannel.TVLiveProgram> programList) {
        if (programList == null || programList.size() <= 1)
            return null;
        String today = TimeUtil.getGernalTime(nowTime.getTime(), "yyyyMMdd");
        String tomorrow = TimeUtil.getGernalTime(nowTime.getTime() + 1000 * 60 * 60 * 24L, "yyyyMMdd");
        for (int i = 0; i < programList.size(); i++) {
            Date d1 = new Date(TimeUtil.convertGernalTime(today + programList.get(i).getTime(), "yyyyMMddHH:mm"));
            Date d2 = null;
            if (i + 1 >= programList.size()) {
                d2 = new Date(TimeUtil.convertGernalTime(tomorrow + programList.get(0).getTime(), "yyyyMMddHH:mm"));
            } else {
                d2 = new Date(TimeUtil.convertGernalTime(today + programList.get(i + 1).getTime(), "yyyyMMddHH:mm"));
            }
            if (nowTime.getTime() >= d1.getTime() && nowTime.getTime() < d2.getTime()) {
                if (i < programList.size() - 1) {
                    return new TVLiveChannel.TVLiveProgram[]{programList.get(i), programList.get(i + 1)};
                } else {
                    return new TVLiveChannel.TVLiveProgram[]{programList.get(i)};
                }
            }
        }
        return null;
    }
}
src/main/java/com/yeshi/buwan/util/tvlive/TVSOUUtil.java
New file
@@ -0,0 +1,54 @@
package com.yeshi.buwan.util.tvlive;
import com.yeshi.buwan.domain.live.TVLiveChannel;
import com.yeshi.buwan.util.NumberUtil;
import com.yeshi.buwan.util.StringUtil;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.util.ArrayList;
import java.util.List;
/**
 * 搜视网
 */
public class TVSOUUtil {
    public static List<TVLiveChannel.TVLiveProgram> getProgramList(String url) throws Exception {
        String userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36";
        Document doc = Jsoup.connect(url).userAgent(userAgent).referrer(url).timeout(60000).get();
        List<TVLiveChannel.TVLiveProgram> list = new ArrayList<>();
        Element pgrow = doc.getElementsByClass("c_main_section").get(0).getElementsByClass("tab_nav").get(0).getElementsByTag("table").get(0);
        Elements items = pgrow.getElementsByTag("tr");
        for (int i = 0; i < items.size(); i++) {
            list.add(parseProgram(items.get(i)));
        }
        return list;
    }
    private static TVLiveChannel.TVLiveProgram parseProgram(Element item) throws Exception {
        String name = item.getElementsByTag("td").get(1).text().trim();
        String time = item.getElementsByTag("td").get(0).text().trim();
        if (StringUtil.isNullOrEmpty(name)) {
            throw new Exception("节目名称为空");
        }
        if (!time.contains(":") || !NumberUtil.isNumeric(time.replace(":", ""))) {
            throw new Exception("时间格式错误");
        }
        return new TVLiveChannel.TVLiveProgram(time, name);
    }
    public static void main(String[] args) throws Exception {
        getProgramList("https://www.tvsou.com/epg/yangshi/");
    }
}
src/main/java/com/yeshi/buwan/util/video/VideoDetailUtil.java
@@ -1,5 +1,9 @@
package com.yeshi.buwan.util.video;
import com.yeshi.buwan.domain.system.DetailSystem;
import com.yeshi.buwan.exception.video.VideoPlayException;
import com.yeshi.buwan.service.inter.video.VideoResourcePlayVersionMapService;
import com.yeshi.buwan.util.JuHe.VideoResourceUtil;
import com.yeshi.buwan.videos.acFun.AcFunUtil;
import com.yeshi.buwan.dao.VideoInfoDao;
import com.yeshi.buwan.domain.*;
@@ -296,10 +300,21 @@
    @Resource
    private VideoResourceService videoResourceService;
    @Resource
    private VideoResourceUtil videoResourceUtil;
    @Cacheable(value = "homeCache", key = "'getPlayUrl'+'-'+#detailSystemId+'-'+#id+'-'+#type+'-'+#resourceid")
    public PlayUrl getPlayUrl(AcceptData acceptData, String detailSystemId, String id, String type, int resourceid, String videoid) {
    public PlayUrl getPlayUrl(AcceptData acceptData, String detailSystemId, String id, String type, int resourceid, String videoid) throws VideoPlayException {
        playLogger.info(VideoLogFactory.createPlayUrlLog(detailSystemId, id, type, resourceid, videoid));
        //判断resourceId是否在允许播放的来源列表中
        List<Long> resourceIds = videoResourceUtil.getAvailablePlayResourceIds(new DetailSystem(detailSystemId), acceptData.getVersion(), acceptData.getChannel());
        if (resourceIds == null || !resourceIds.contains(Long.parseLong(resourceid + ""))) {
            throw new VideoPlayException(1, "指定播放源无法播放");
        }
        if (VideoUtil.getVideoFromType(id) == HomeVideo.FROM_TYPE_SHORT) {
            VideoResource vr = videoResourceService.getResource(resourceid + "");
            return solrShortVideoDataManager.getPlayUrl(id, vr);
@@ -329,7 +344,7 @@
            case HanmiUtil.RESOURCE_ID:
                return hanmiService.getPlayUrl(detailSystemId, resourceid, id, videoid);
            default:
                return null;
                throw new VideoPlayException(2, "未知播放源");
        }
    }
src/main/java/com/yeshi/buwan/vo/tvlive/TVLiveChannelResourceMapAdminVO.java
New file
@@ -0,0 +1,63 @@
package com.yeshi.buwan.vo.tvlive;
import com.yeshi.buwan.domain.live.TVLiveChannelResourceMap;
import com.yeshi.buwan.domain.live.TVLiveResource;
/**
 * 电视频道资源
 */
public class TVLiveChannelResourceMapAdminVO {
    private String id;
    private String playUrl;
    private String name;
    private int weight;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getPlayUrl() {
        return playUrl;
    }
    public void setPlayUrl(String playUrl) {
        this.playUrl = playUrl;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getWeight() {
        return weight;
    }
    public void setWeight(int weight) {
        this.weight = weight;
    }
    public static TVLiveChannelResourceMapAdminVO create(TVLiveChannelResourceMap map) {
        if (map == null) {
            return null;
        }
        TVLiveChannelResourceMapAdminVO vo = new TVLiveChannelResourceMapAdminVO();
        if (map.getResource() == TVLiveResource.migu) {
            vo.setName("咪咕");
        } else {
            vo.setName(map.getSubResourceName());
        }
        vo.setId(map.getId());
        vo.setPlayUrl(map.getPlayUrl());
        vo.setWeight(map.getWeight());
        return vo;
    }
}
src/main/java/com/yeshi/buwan/vo/tvlive/TVLiveChannelVO.java
@@ -2,6 +2,9 @@
import com.yeshi.buwan.domain.live.TVLiveChannel;
import com.yeshi.buwan.util.StringUtil;
import com.yeshi.buwan.util.tvlive.TVChannelUtil;
import java.util.Date;
public class TVLiveChannelVO {
@@ -17,17 +20,19 @@
        vo.setName(tvLiveChannel.getName());
        vo.setPicture(tvLiveChannel.gethPicture());
        if (!StringUtil.isNullOrEmpty(tvLiveChannel.getNowProgram()) && !StringUtil.isNullOrEmpty(tvLiveChannel.getNowProgramTime())) {
            vo.setNowProgram(tvLiveChannel.getNowProgramTime() + " " + tvLiveChannel.getNowProgram());
        TVLiveChannel.TVLiveProgram[] programs = TVChannelUtil.getNowProgram(new Date(), tvLiveChannel.getProgramList());
        if (programs != null && programs.length > 0) {
            vo.setNowProgram(programs[0].getTime() + " " + programs[0].getName());
        } else {
            vo.setNowProgram("暂无节目信息");
        }
        if (!StringUtil.isNullOrEmpty(tvLiveChannel.getNextProgram()) && !StringUtil.isNullOrEmpty(tvLiveChannel.getNextProgramTime())) {
            vo.setNowProgram(tvLiveChannel.getNextProgramTime() + " " + tvLiveChannel.getNextProgram());
        if (programs != null && programs.length > 1) {
            vo.setNextProgram(programs[1].getTime() + " " + programs[1].getName());
        } else {
            vo.setNowProgram("暂无节目信息");
            vo.setNextProgram("暂无节目信息");
        }
        return vo;
    }
src/main/resources/script/tvlive/dianshimao_program.js
New file
@@ -0,0 +1,30 @@
var keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
function J(a) {
    var b = '',
        i = 0,
        c, chr2, chr3, enc1, enc2, enc3, enc4;
    while (i < a.length) {
        c = a.charCodeAt(i++);
        chr2 = a.charCodeAt(i++);
        chr3 = a.charCodeAt(i++);
        enc1 = c >> 2;
        enc2 = ((c & 3) << 4) | (chr2 >> 4);
        enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
        enc4 = chr3 & 63;
        if (isNaN(chr2)) {
            enc3 = enc4 = 64
        } else if (isNaN(chr3)) {
            enc4 = 64
        }
        b = b + keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4)
    }
    return b
};
function f(q, a, id) {
    var b = new Date();
    var d = b.getDay();
    var w = d == 0 ? 7 : d;
    return keyStr.charAt(w * w) + J(id + '|' + a) + J('|' + q)
}
src/main/webapp/admin/new/js/navsetting.xml
@@ -137,6 +137,7 @@
        <secondNav url="tvlive_channel_list.html" name="频道列表">
            <!-- 网页链接 -->
            <url>tvlive_channel_add.html</url>
            <url>tvlive_channel_resource.html</url>
        </secondNav>
    </topNav>
src/main/webapp/admin/new/tvlive_category_add.html
@@ -5,7 +5,7 @@
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="referrer" content="never">
    <title>添加顶部标签</title>
    <title>添加直播频道</title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/maincontent.css" rel="stylesheet">
    <link href="css/tablestyle.css" rel="stylesheet">
src/main/webapp/admin/new/tvlive_category_channel_list.html
@@ -120,7 +120,7 @@
                        </td>
                        <td>
                            <div class="bianhao name">
                                <a href="#">{{item.name}}</a>
                                <a v-bind:href="'tvlive_channel_resource.html?id='+item.id">{{item.name}}</a>
                            </div>
                        </td>
src/main/webapp/admin/new/tvlive_channel_add.html
New file
@@ -0,0 +1,110 @@
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="referrer" content="never">
    <title>添加顶部标签</title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/maincontent.css" rel="stylesheet">
    <link href="css/tablestyle.css" rel="stylesheet">
    <style>
        .form-group {
            margin-bottom: 30px;
        }
        .checkbox input[type=checkbox] {
            top: 6px;
        }
    </style>
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top">
</nav>
<div id="mainbody">
    <div id="sidebar">
        <dl>
        </dl>
    </div>
    <div id="neirong">
        <div class="erjidh">
            <ol class="breadcrumb">
                <li>
                    <a href="tvlive_channel_list.html">电视直播频道</a>
                </li>
                <li class="active">添加频道</li>
            </ol>
        </div>
        <form class="form-horizontal" role="form">
            <div class="form-group">
                <label for="input1" class="changdu1 control-label">名称</label>
                <div class="col-sm-7">
                    <input type="text" class="form-control" id="name" placeholder="必须填写">
                </div>
            </div>
            <div class="form-group">
                <label for="input1" class="changdu1 control-label">横图</label>
                <div class="col-sm-7">
                    <input type="text" class="form-control" id="hPicture" placeholder="必须填写">
                </div>
            </div>
            <div class="form-group">
                <label for="input1" class="changdu1 control-label">竖图</label>
                <div class="col-sm-7">
                    <input type="text" class="form-control" id="vPicture" placeholder="可不填">
                </div>
            </div>
            <div class="button0">
                <div class="button">
                    <button type="button" class="btn btn-primary save">保存</button>
                </div>
                <div class="button">
                    <input type="reset" class="btn btn-default" value="重置"/>
                </div>
            </div>
        </form>
    </div>
</div>
<script src="//cdn.bootcss.com/jquery/1.10.1/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/nav.js"></script>
<script src="js/common.js"></script>
<script src="layer/layer.js"></script>
<script>
    $(function () {
        $(".save").click(function () {
            var index = layer.load(0, {
                'shade': false
            });
            $.post('api/tvlive/channel/addChannel', {
                'name': $("#name").val(),
                'hPicture': $("#hPicture").val(),
                'vPicture': $("#vPicture").val(),
            }, function (data) {
                layer.close(index);
                if (data.code == 0) {
                    layer.msg("添加成功");
                } else {
                    layer.msg(data.msg);
                }
                doResponse(data, function () {
                });
            }, 'json');
        });
    });
</script>
</body>
</html>
src/main/webapp/admin/new/tvlive_channel_list.html
@@ -59,7 +59,7 @@
            <button type="button" class="btn btn-default search-button">搜索</button>
            <div class="tianjia" class="search">
                <a href="add-tuijian-home-labels.html" class="btn btn-primary" role="button">添加标签&nbsp;+</a>
                <a href="tvlive_channel_add.html" class="btn btn-primary" role="button">添加频道&nbsp;+</a>
            </div>
        </div>
@@ -168,7 +168,19 @@
                        <td class="">
                            <div class="btn btn-primary" v-on:click="showCategorySelect(item.id)">添加到分类</div>
                            <!--<div class="btn btn-primary" v-on:click="showCategorySelect(item.id)">添加到分类</div>-->
                            <!--<div class="btn btn-primary" style="margin-top: 10px;" v-on:click="showCategorySelect(item.id)">来源管理</div>-->
                            <!-- Single button -->
                            <div class="btn-group">
                                <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                    操作 <span class="caret"></span>
                                </button>
                                <ul class="dropdown-menu">
                                    <li><a href="#" v-on:click="showCategorySelect(item.id)">添加到分类</a></li>
                                    <li><a v-bind:href="'tvlive_channel_resource.html?id='+item.id">来源管理</a></li>
                                </ul>
                            </div>
                        </td>
                        <td>
src/main/webapp/admin/new/tvlive_channel_resource.html
New file
@@ -0,0 +1,235 @@
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="referrer" content="never">
    <title>电视直播-频道列表</title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/maincontent.css" rel="stylesheet">
    <style>
        .content-container .container {
            min-height: 200px;
            background: white;
            padding-top: 10px;
        }
        .btn-delete {
            float: left;
            margin-bottom: 0;
            margin-left: 20px;
        }
        .form-item {
            margin-bottom: 10px;
            display: block !important;
        }
        .btn-sure {
            margin-top: 10px;
        }
    </style>
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top">
</nav>
<div id="mainbody">
    <div id="sidebar">
    </div>
    <div id="neirong">
        <ul class="nav nav-tabs">
            <li v-for="item,index in list" role="presentation" v-bind:class="{active:selectIndex==index}"
                v-on:click="selectResource(index)"><a href="#">{{item.name}}</a>
            </li>
            <a href="#">
                <button class="btn btn-primary" v-on:click="addResource">
                    <span class="glyphicon glyphicon-plus"></span>
                    添加
                </button>
            </a>
        </ul>
        <div class="content-container">
            <div v-for="item,index in list" class="container"
                 v-bind:style="{'display':selectIndex==index?'block':'none'}">
                <div class="col-lg-6 form-item">
                    <div class="input-group">
                      <span class="input-group-btn">
                        <button class="btn btn-default" type="button">播放链接</button>
                      </span>
                        <input type="text" :readonly="item.name=='咪咕'?true:false" v-model="item.playUrl"
                               class="form-control"
                               placeholder="请输入完整的播放链接">
                    </div>
                </div>
                <div class="col-lg-3 form-item">
                    <div class="input-group">
                      <span class="input-group-btn">
                        <button class="btn btn-default" type="button">权重</button>
                      </span>
                        <input type="text" v-model="item.weight"
                               class="form-control"
                               placeholder="请输入排序权重(正整数)">
                    </div>
                </div>
                <div style="clear: both;"></div>
                <button class="btn btn-danger btn-delete" v-on:click="deleteResource(index)">删除</button>
            </div>
            <button class="btn btn-primary btn-sure" v-on:click="sure">确定</button>
        </div>
    </div>
    <script src="//cdn.bootcss.com/jquery/1.10.1/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/page.js"></script>
    <script src="js/nav.js"></script>
    <script src="js/common.js"></script>
    <script src="js/vue.min.js"></script>
    <script src="layer/layer.js"></script>
    <script>
        $(function () {
            function getQueryString(name) {
                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
                var r = window.location.search.substr(1).match(reg);
                if (r != null) return unescape(r[2]);
                return null;
            };
            const channelId = getQueryString("id");
            var app = new Vue({
                el: "#neirong",
                data: {
                    list: [],
                    selectIndex: 0,
                },
                methods: {
                    resourceList: function () {
                        var index = layer.load(1, {
                            shade: false
                        })
                        $.post('api/tvlive/channel/getChannelResourceList', {id: channelId}, function (data) {
                            layer.close(index);
                            if (data.code != 0)
                                return;
                            app.list = data.data.data;
                        }, 'json');
                    },
                    addResource: function () {
                        layer.prompt({title: '请输入来源名称', formType: 3}, function (text, index) {
                            layer.close(index);
                            if (text && text.length > 0) {
                                app.list.push({name: text});
                                if (app.selectIndex < 0) {
                                    app.selectIndex = 0;
                                }
                            }
                        });
                    },
                    selectResource: function (index) {
                        app.selectIndex = index;
                    },
                    deleteResource: function (index) {
                        app.list.splice(index, 1);
                        console.log(app.selectIndex + ":" + app.list.length);
                        if (app.selectIndex >= app.list.length) {
                            app.selectIndex = app.list.length - 1;
                        }
                    },
                    sure: function () {
                        layer.confirm('是否确定更改?', {
                            btn: ['确定', '取消'] //按钮
                        }, function () {
                            var index = layer.load(1, {
                                shade: false
                            })
                            $.post('api/tvlive/channel/updateChannelResources', {
                                id: channelId,
                                resources: JSON.stringify(app.list)
                            }, function (data) {
                                layer.close(index);
                                if (data.code != 0) {
                                    layer.msg(data.msg);
                                } else {
                                    layer.alert("更改成功");
                                    window.refresh();
                                }
                            }, 'json');
                        }, function () {
                        });
                    },
                    deleteSpecial: function (id, index) {
                        var indexDialog = layer.confirm('是否删除该条目?', {
                            btn: ['是', '否'] //按钮
                        }, function () {
                            $.post('api/homerecommend/deleteSpcial', {
                                'ids': id
                            }, function (data) {
                                layer.close(indexDialog);
                                if (data.code == 0) {
                                    if (index > -1) {
                                        app.list.splice(index, 1);
                                    } else {
                                        var ids = id.split(",");
                                        console.log(ids);
                                        for (var i = 0; i < ids.length; i++) {
                                            for (var j = 0; j < app.list.length; j++) {
                                                console.log(app.list[j].special.id + ":" + ids[i])
                                                if (app.list[j].special.id == ids[i]) {
                                                    app.list.splice(j, 1);
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                    layer.msg("删除成功");
                                } else {
                                    layer.msg(data.msg);
                                }
                            }, 'json');
                        }, function () {
                        });
                    },
                    edit: function (id) {
                        window.location.href = "edit-tuijian-home-labels.html?id=" + id;
                    },
                }
            });
            app.resourceList();
        });
    </script>
</body>
</html>
src/test/java/com/hxh/spring/test/GeneralTest.java
@@ -1,35 +1,94 @@
package com.hxh.spring.test;
import com.yeshi.buwan.dao.base.MongodbBaseDao;
import com.yeshi.buwan.dao.goldcorn.GoldCornTaskActionDetailDao;
import com.yeshi.buwan.dao.live.TVLiveProgramResourceDao;
import com.yeshi.buwan.dao.video.VideoResourceVersionMapDao;
import com.yeshi.buwan.domain.goldcorn.GoldCornTaskActionDetail;
import com.yeshi.buwan.domain.live.*;
import com.yeshi.buwan.domain.pptv.PPTVPlayProcessRecord;
import com.yeshi.buwan.domain.special.SearchSpecial;
import com.yeshi.buwan.domain.special.SearchSpecialPosition;
import com.yeshi.buwan.domain.special.SearchSpecialPositionMap;
import com.yeshi.buwan.domain.tb.YouZhiHaoHuoGoods;
import com.yeshi.buwan.domain.live.TVLiveProgramResource;
import com.yeshi.buwan.domain.video.StarInfo;
import com.yeshi.buwan.domain.video.VideoResourceVersionMap;
import com.yeshi.buwan.domain.vip.VideoBuyRecord;
import com.yeshi.buwan.live.migu.MiGuLiveListInfo;
import com.yeshi.buwan.service.inter.video.VideoResourceVersionMapService;
import com.yeshi.buwan.videos.bilibili.entity.BilibiliEpInfo;
import com.yeshi.buwan.videos.bilibili.entity.BilibiliMediaInfo;
import com.yeshi.buwan.videos.bilibili.entity.BilibiliSearchVideoMap;
import com.yeshi.buwan.videos.bilibili.entity.BilibiliVideo;
import org.junit.Test;
import org.yeshi.utils.generater.SpringComponentGenerater;
import org.yeshi.utils.generater.entity.MongoDBDaoData;
import org.yeshi.utils.generater.entity.ServiceData;
import java.io.File;
public class GeneralTest {
    private String packageBaseName = "com.yeshi.buwan";
    private Class mongoBaseDao = MongodbBaseDao.class;
    private String PROJECT_PATH = "D:\\workspace\\BuWan";
    @Test
    public void generalMongoDaoAndService() throws ClassNotFoundException {
        /************可更改区域开始*************/
        Class entityClass = StarInfo.class;
        //dao的相对包名
        String daoRelativePackageName = "dao.video";
        String serviceRelativePackageName = "service.inter.video";
        String serviceImplRelativePackageName = "service.imp.video";
        /************可更改区结束*************/
        String daoPackageName = packageBaseName + "." + daoRelativePackageName;
        String daoClassName = daoPackageName + "." + entityClass.getSimpleName() + "Dao";
        //生成dao
        MongoDBDaoData.Builder daoBuilder = new MongoDBDaoData.Builder();
        daoBuilder.setBaseDaoClass(mongoBaseDao).setDaoPackageName(daoPackageName);
        daoBuilder.setEntityClass(entityClass);
        try {
            String targetDir = PROJECT_PATH + "\\src\\main\\java\\" + daoPackageName.replace(".", "\\") + "\\";
            if (!new File(targetDir).exists())
                new File(targetDir).mkdirs();
            SpringComponentGenerater.createMongoDao(daoBuilder.create(), targetDir);
        } catch (Exception e) {
            e.printStackTrace();
        }
        //生成服务接口
        String servicePackageName = packageBaseName + "." + serviceRelativePackageName;
        String serviceClassName = servicePackageName + "." + entityClass.getSimpleName() + "Service";
        ServiceData.Builder builder = new ServiceData.Builder();
        builder.setPackageName(servicePackageName);
        builder.setDaoClass(Class.forName(daoClassName));
        builder.setEntityClass(entityClass);
        try {
            String targetDir = PROJECT_PATH + "\\src\\main\\java\\" + servicePackageName.replace(".", "\\") + "\\";
            if (!new File(targetDir).exists())
                new File(targetDir).mkdirs();
            SpringComponentGenerater.createService(builder.build(), targetDir);
        } catch (Exception e) {
            e.printStackTrace();
        }
        //生成服务实现接口
        String serviceImplPackageName = packageBaseName + "." + serviceImplRelativePackageName;
        builder = new ServiceData.Builder();
        builder.setPackageName(serviceImplPackageName).setServiceClass(Class.forName(serviceClassName)).setDaoClass(Class.forName(daoClassName)).setEntityClass(entityClass);
        try {
            String targetDir = PROJECT_PATH + "\\src\\main\\java\\" + serviceImplPackageName.replace(".", "\\") + "\\";
            if (!new File(targetDir).exists())
                new File(targetDir).mkdirs();
            SpringComponentGenerater.createServiceImpl(builder.build(), targetDir);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @org.junit.Test
    public void createDao() {
        MongoDBDaoData.Builder builder = new MongoDBDaoData.Builder();
        builder.setBaseDaoClass(mongoBaseDao).setDaoPackageName(packageBaseName + ".dao.live");
        builder.setEntityClass(TVLiveProgramResource.class);
        try {
            SpringComponentGenerater.createMongoDao(new MongoDBDaoData.Builder().setBaseDaoClass(MongodbBaseDao.class).setDaoPackageName("com.yeshi.buwan.dao.search").setEntityClass(SearchSpecialPosition.class).create(), "D:\\workspace\\BuWan\\src\\main\\java\\com\\yeshi\\buwan\\dao\\search\\");
            SpringComponentGenerater.createMongoDao(builder.create(), PROJECT_PATH + "\\src\\main\\java\\com\\yeshi\\buwan\\dao\\live\\");
        } catch (Exception e) {
            e.printStackTrace();
        }
@@ -38,8 +97,12 @@
    //
    @org.junit.Test
    public void createService() {
        ServiceData.Builder builder = new ServiceData.Builder();
        builder.setPackageName(packageBaseName + ".service.inter.live");
        builder.setDaoClass(TVLiveProgramResourceDao.class);
        builder.setEntityClass(TVLiveProgramResource.class);
        try {
            SpringComponentGenerater.createService(new ServiceData.Builder().setPackageName("com.yeshi.buwan.service.inter.goldcorn").setDaoClass(GoldCornTaskActionDetailDao.class).setEntityClass(GoldCornTaskActionDetail.class).build(), "D:\\workspace\\BuWan\\src\\main\\java\\com\\yeshi\\buwan\\service\\inter\\goldcorn\\");
            SpringComponentGenerater.createService(builder.build(), PROJECT_PATH + "\\src\\main\\java\\com\\yeshi\\buwan\\service\\inter\\goldcorn\\");
        } catch (Exception e) {
            e.printStackTrace();
        }
src/test/java/com/hxh/spring/test/VideoTest.java
@@ -4,6 +4,7 @@
import com.yeshi.buwan.domain.system.DetailSystem;
import com.yeshi.buwan.domain.VideoInfo;
import com.yeshi.buwan.domain.entity.PlayUrl;
import com.yeshi.buwan.exception.video.VideoPlayException;
import com.yeshi.buwan.videos.iqiyi.IqiYiNewAPI;
import com.yeshi.buwan.videos.iqiyi.entity.IqiyiUpdateQueue;
import com.yeshi.buwan.videos.iqiyi.util.IqiyiUtil;
@@ -97,8 +98,12 @@
        DetailSystem detailSystem = systemService.getDetailSystemByPackage("com.doudou.ysvideo");
        PlayUrl pu = videoDeailUtil.getPlayUrl(null, detailSystem.getId(), 3357160 + "", "acFunVideo",
                Integer.parseInt(21 + ""), 3357160 + "");
        try {
            PlayUrl pu = videoDeailUtil.getPlayUrl(null, detailSystem.getId(), 3357160 + "", "acFunVideo",
                    Integer.parseInt(21 + ""), 3357160 + "");
        } catch (VideoPlayException e) {
            e.printStackTrace();
        }
    }
    @org.junit.Test
src/test/java/com/hxh/spring/test/live/TVLiveTest.java
@@ -1,6 +1,15 @@
package com.hxh.spring.test.live;
import com.yeshi.buwan.dao.live.TVLiveChannelDao;
import com.yeshi.buwan.domain.live.TVLiveChannel;
import com.yeshi.buwan.domain.live.TVLiveProgramResource;
import com.yeshi.buwan.exception.ParamsException;
import com.yeshi.buwan.job.LiveJob;
import com.yeshi.buwan.service.inter.live.TVLiveProgramResourceService;
import com.yeshi.buwan.util.StringUtil;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
@@ -8,6 +17,10 @@
import org.springframework.test.context.web.WebAppConfiguration;
import javax.annotation.Resource;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Scanner;
@RunWith(SpringJUnit4ClassRunner.class) //使用junit4进行测试
@ContextConfiguration(locations = {"classpath:spring.xml"})
@@ -17,10 +30,104 @@
    @Resource
    private LiveJob liveJob;
    @Resource
    private TVLiveChannelDao tvLiveChannelDao;
    @Resource
    private TVLiveProgramResourceService tvLiveProgramResourceService;
    @Test
    public void syncMiGu() throws Exception {
        liveJob.updateMiGu("");
    }
    /**
     * 更新节目单
     */
    @Test
    public void updatePrigrams() throws Exception {
        liveJob.updatePrograms(null);
    }
    @Test
    public void getDianShiMaoChannels() throws IOException {
        Document doc = Jsoup.connect("https://www.tvmao.com/program_satellite/AHTV1-w4.html").userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36").get();
        Elements els = doc.getElementsByClass("chlsnav").get(0).getElementsByTag("ul").get(0).getElementsByTag("a");
        for (int i = 0; i < els.size(); i++) {
            System.out.println(els.get(i).text() + "#https://www.tvmao.com" +
                    els.get(i).attr("href"));
        }
    }
    @Test
    public void getTVSOUChannels() throws IOException {
        Document doc = Jsoup.connect("https://www.tvsou.com/epg/yangshi/").userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36").get();
        Elements els = doc.getElementsByClass("c_list_main").get(0).getElementsByTag("a");
        for (int i = 0; i < els.size(); i++) {
            System.out.println(els.get(i).text() + "#https://www.tvsou.com/" +
                    els.get(i).attr("href"));
        }
    }
    @Test
    public void addProgramResource() throws FileNotFoundException {
        Scanner scanner = new Scanner(new File("C:\\Users\\Administrator\\Desktop\\新建文本文档 (2).txt"));
        while (scanner.hasNextLine()) {
            String line = scanner.nextLine();
            String[] sts = line.split("#");
            if (sts.length > 1) {
                String name = sts[0];
                String link = sts[1].trim();
                String id = StringUtil.Md5(name);
                TVLiveChannel channel = tvLiveChannelDao.get(id);
                if (channel != null) {
                    TVLiveProgramResource resource = new TVLiveProgramResource();
                    resource.setChannelId(channel.getId());
                    resource.setType(TVLiveProgramResource.TVLiveProgramResourceType.dianshimao);
                    resource.setUrl(link);
                    try {
                        tvLiveProgramResourceService.add(resource);
                    } catch (ParamsException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
        scanner.close();
    }
    /**
     * 搜视网
     * @throws FileNotFoundException
     */
    @Test
    public void addProgramResourceTVSOU() throws FileNotFoundException {
        Scanner scanner = new Scanner(new File("C:\\Users\\Administrator\\Desktop\\搜视网.txt"));
        while (scanner.hasNextLine()) {
            String line = scanner.nextLine();
            String[] sts = line.split("#");
            if (sts.length > 1) {
                String name = sts[0];
                String link = sts[1].trim();
                String id = StringUtil.Md5(name);
                TVLiveChannel channel = tvLiveChannelDao.get(id);
                if (channel != null) {
                    TVLiveProgramResource resource = new TVLiveProgramResource();
                    resource.setChannelId(channel.getId());
                    resource.setType(TVLiveProgramResource.TVLiveProgramResourceType.tvsou);
                    resource.setUrl(link);
                    try {
                        tvLiveProgramResourceService.add(resource);
                    } catch (ParamsException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
        scanner.close();
    }
}
src/test/java/com/hxh/spring/test/video/VideoResourcePlayVersionTest.java
New file
@@ -0,0 +1,167 @@
package com.hxh.spring.test.video;
import com.yeshi.buwan.domain.video.VideoResourcePlayVersionMap;
import com.yeshi.buwan.domain.video.VideoResourceVersionMap;
import com.yeshi.buwan.service.inter.video.VideoResourcePlayVersionMapService;
import com.yeshi.buwan.service.inter.video.VideoResourcePlayVersionMapService;
import com.yeshi.buwan.service.inter.video.VideoResourceVersionMapService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
 * @author Administrator
 * @title:
 * @description:
 * @date 2021/9/10 14:46
 */
@RunWith(SpringJUnit4ClassRunner.class) //使用junit4进行测试
@ContextConfiguration(locations = {"classpath:spring.xml"})
@WebAppConfiguration
public class VideoResourcePlayVersionTest {
    @Resource
    private VideoResourcePlayVersionMapService videoResourcePlayVersionMapService;
    @Resource
    private VideoResourceVersionMapService videoResourceVersionMapService;
    @Test
    public void addBuWanAndroid() {
        String[] resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24", "26", "27"};
        for (String rid : resourceIds) {
            try {
                videoResourcePlayVersionMapService.add(new VideoResourcePlayVersionMap("44", 1, rid, null));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        resourceIds = new String[]{"25"};
        for (String rid : resourceIds) {
            try {
                videoResourcePlayVersionMapService.add(new VideoResourcePlayVersionMap("44", 105, rid, null));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    @Test
    public void addMGAndroid() {
        String[] resourceIds = null;
        resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24", "26", "27"};
        for (String rid : resourceIds) {
            try {
                videoResourcePlayVersionMapService.add(new VideoResourcePlayVersionMap("47", 1, rid, null));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
//        resourceIds = new String[]{"25"};
//        for (String rid : resourceIds) {
//            try {
//                videoResourcePlayVersionMapService.add(new VideoResourcePlayVersionMap("47", 1, rid, "meizu"));
//            } catch (Exception e) {
//                e.printStackTrace();
//            }
//        }
    }
    @Test
    public void addHJAndroid() {
        String[] resourceIds = null;
        resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24", "26", "27", "25", "28"};
        for (String rid : resourceIds) {
            try {
                videoResourcePlayVersionMapService.add(new VideoResourcePlayVersionMap("48", 1, rid, "meizu"));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    @Test
    public void addHJMZ() {
        String[] resourceIds = null;
        resourceIds = new String[]{"25", "28"};
        for (String rid : resourceIds) {
            try {
                videoResourcePlayVersionMapService.add(new VideoResourcePlayVersionMap("48", 1, rid, "meizu"));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    @Test
    public void addBuwanLite() {
        String[] resourceIds = null;
        resourceIds = new String[]{"25"};
        for (String rid : resourceIds) {
            try {
                videoResourcePlayVersionMapService.add(new VideoResourcePlayVersionMap("49", 1, rid, "xiaomi"));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    @Test
    public void addBuWanIOS() {
        String[] resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24", "26", "27"};
        for (String rid : resourceIds) {
            try {
                videoResourcePlayVersionMapService.add(new VideoResourcePlayVersionMap("43", 1, rid, null));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    @Test
    public void listValid() {
        List<String> resourceIds = videoResourcePlayVersionMapService.listResourceId("43", 105, null);
        System.out.println(resourceIds);
        resourceIds = videoResourcePlayVersionMapService.listResourceId("44", 1, null);
        System.out.println(resourceIds);
        resourceIds = videoResourcePlayVersionMapService.listResourceId("44", 2, null);
        System.out.println(resourceIds);
        resourceIds = videoResourcePlayVersionMapService.listResourceId("44", 106, null);
        System.out.println(resourceIds);
    }
    @Test
    public void copy() throws Exception {
        List<VideoResourceVersionMap> mapList = videoResourceVersionMapService.listAll();
        for (VideoResourceVersionMap map : mapList) {
            VideoResourcePlayVersionMap pm = new VideoResourcePlayVersionMap();
            pm.setId(map.getId());
            pm.setChannel(map.getChannel());
            pm.setDetailSystemId(map.getDetailSystemId());
            pm.setRemarks(map.getRemarks());
            pm.setVersion(map.getVersion());
            pm.setUpdateTime(new Date());
            pm.setResourceId(map.getResourceId());
            pm.setCreateTime(new Date());
            videoResourcePlayVersionMapService.add(pm);
        }
    }
}
src/test/java/com/hxh/spring/test/video/VideoResourceVersionTest.java
@@ -1,5 +1,6 @@
package com.hxh.spring.test.video;
import com.yeshi.buwan.domain.video.VideoResourcePlayVersionMap;
import com.yeshi.buwan.domain.video.VideoResourceVersionMap;
import com.yeshi.buwan.service.inter.video.VideoResourceVersionMapService;
import org.junit.Test;
@@ -21,7 +22,7 @@
    @Test
    public void addBuWanAndroid() {
        String[] resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24","26", "27"};
        String[] resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24", "26", "27"};
        for (String rid : resourceIds) {
            try {
                videoResourceVersionMapService.add(new VideoResourceVersionMap("44", 1, rid, null));
@@ -45,7 +46,7 @@
    @Test
    public void addMGAndroid() {
        String[] resourceIds = null;
        resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24","26", "27"};
        resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24", "26", "27"};
        for (String rid : resourceIds) {
            try {
                videoResourceVersionMapService.add(new VideoResourceVersionMap("47", 1, rid, null));
@@ -68,7 +69,7 @@
    @Test
    public void addHJAndroid() {
        String[] resourceIds = null;
        resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24","26", "27", "25","28"};
        resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24", "26", "27", "25", "28"};
        for (String rid : resourceIds) {
            try {
                videoResourceVersionMapService.add(new VideoResourceVersionMap("48", 1, rid, "meizu"));
@@ -79,9 +80,23 @@
    }
    @Test
    public void addBuwanLite() {
        String[] resourceIds = null;
        resourceIds = new String[]{"25"};
        for (String rid : resourceIds) {
            try {
                videoResourceVersionMapService.add(new VideoResourceVersionMap("49", 1, rid, "xiaomi"));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    @Test
    public void addHJMZ() {
        String[] resourceIds = null;
        resourceIds = new String[]{ "25","28"};
        resourceIds = new String[]{"25", "28"};
        for (String rid : resourceIds) {
            try {
                videoResourceVersionMapService.add(new VideoResourceVersionMap("48", 1, rid, "meizu"));
@@ -93,7 +108,7 @@
    @Test
    public void addBuWanIOS() {
        String[] resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24","26", "27"};
        String[] resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24", "26", "27"};
        for (String rid : resourceIds) {
            try {
                videoResourceVersionMapService.add(new VideoResourceVersionMap("43", 1, rid, null));