admin
2021-09-24 f788607ff771a47bc60d6a86e00b3433c40f3d2c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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;
 
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
 
@Component
public class VideoResourceUtil {
    @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);
//        if (detailSystem.getId().equalsIgnoreCase("43") && versionCode > 83) {
//            ridList = new ArrayList<>();
////            ridList.add("19");
////            ridList.add("24");
//            ridList.add("25");
//        }
        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);
        List<Long> ids = new ArrayList<>();
        if (ridList != null) {
            for (String id : ridList) {
                ids.add(Long.parseLong(id));
            }
        }
 
        return ids;
    }
 
 
}