admin
2025-02-20 f537abe9f3646c739beaf15076246a2f71a347e9
src/main/java/com/yeshi/buwan/util/JuHe/VideoResourceUtil.java
@@ -1,7 +1,13 @@
package com.yeshi.buwan.util.JuHe;
import com.yeshi.buwan.domain.DetailSystem;
import com.yeshi.buwan.domain.system.DetailSystem;
import com.yeshi.buwan.service.imp.DetailSystemConfigService;
import com.yeshi.buwan.service.inter.video.VideoResourcePlayVersionMapService;
import com.yeshi.buwan.service.inter.video.VideoResourceVersionMapService;
import com.yeshi.buwan.util.Constant;
import com.yeshi.buwan.util.config.SystemConfigUtil;
import com.yeshi.buwan.videos.funtv.FunTVUtil;
import net.sf.json.JSONObject;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component;
@@ -14,15 +20,75 @@
    @Resource
    private VideoResourceVersionMapService videoResourceVersionMapService;
    @Cacheable(value = "homeCache", key = "'getAvailableResourceIds-'+'-'+#detailSystem.id+'-'+#versionCode")
    public List<Long> getAvailableResourceIds(DetailSystem detailSystem, int versionCode) {
        List<String> ridList = videoResourceVersionMapService.listResourceId(detailSystem.getId(), versionCode);
    @Resource
    private VideoResourcePlayVersionMapService videoResourcePlayVersionMapService;
    @Resource
    private DetailSystemConfigService detailSystemConfigService;
    @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.toLowerCase());
//        if (detailSystem.getId().equalsIgnoreCase("43") && versionCode > 83) {
//            ridList = new ArrayList<>();
////            ridList.add("19");
////            ridList.add("24");
//            ridList.add("25");
//        }
        ridList.remove(25+"");
        ridList.remove(28+"");
        if(Constant.IS_HAVE_FIRST_ONLINE) {
            ridList.add(FunTVUtil.RESOURCE_ID + "");
            //是否是首次上线
            String firstOnLineValue =  detailSystemConfigService.getConfigValueByKey("first_online_versions",detailSystem.getId(), versionCode);
            if( SystemConfigUtil.isFirstOnLine(firstOnLineValue, channel, versionCode)){
                // 首次上线要打开风行
                ridList.add(FunTVUtil.RESOURCE_ID+"");
            }
        }
        //韩剧上线的时候需要打开
//        if(detailSystem.getId().equalsIgnoreCase("51")){
//            ridList.add("28");
//        }
//        ridList.clear();
//        ridList.add("13");
//        ridList.add("22");
        List<Long> ids = new ArrayList<>();
        if (ridList != null) {
            for (String id : ridList) {
                ids.add(Long.parseLong(id));
            }
        }
        return ids;
    }
    @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.toLowerCase());
        // 韩剧上线需要打开注释
//        if(detailSystem.getId().equalsIgnoreCase("51")){
//            ridList.add("28");
//        }
        // 首次上线要打开风行
        if(Constant.IS_HAVE_FIRST_ONLINE) {
            ridList.add(FunTVUtil.RESOURCE_ID + "");
            String firstOnLineValue = detailSystemConfigService.getConfigValueByKey("first_online_versions", detailSystem.getId(), versionCode);
            if (SystemConfigUtil.isFirstOnLine(firstOnLineValue, channel, versionCode)) {
                ridList.add(FunTVUtil.RESOURCE_ID + "");
            }
        }
        List<Long> ids = new ArrayList<>();
        if (ridList != null) {
            for (String id : ridList) {
                ids.add(Long.parseLong(id));
            }
        }
        return ids;
    }