VideosJob.java
4.35 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
package com.cnlive.shenhe.job;
import com.cnlive.shenhe.entity.ShyVideos;
import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl;
import com.cnlive.shenhe.serviceImpl.SitesServiceImpl;
import com.cnlive.shenhe.serviceImpl.UsersServiceImpl;
import com.cnlive.shenhe.serviceImpl.VideosServiceImpl;
import com.cnlive.shenhe.utils.AuditPass;
import com.cnlive.shenhe.utils.CommonConst;
import com.cnlive.shenhe.utils.CommonUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
public class VideosJob {
private static Logger logger = LoggerFactory.getLogger(VideosJob.class);
@Autowired
SitesServiceImpl sitesService;
@Autowired
AuditPass Pass;
@Autowired
CommentsServiceImpl commentsService;
@Autowired
UsersServiceImpl usersService;
@Autowired
VideosServiceImpl videosService;
/**
* 白名单sp视频通过
*/
@Scheduled(fixedRate = 60 * 1000)
public void updateVideos() {
//获取所有点播免审sp
List<Integer> sites = sitesService.getBusinessList();
//遍历免审的spid去更改状态值
ShyVideos shyVideos = new ShyVideos();
for (int spid : sites) {
shyVideos.setSpid(spid);
shyVideos.setState(CommonConst.AUDIT_INTT);
List<ShyVideos> shyVideosList = videosService.findshyVideo(shyVideos);
if (shyVideosList.size() > 0) {
for (ShyVideos video : shyVideosList) {
//如果网家家的栏目是“目击者”,跳过免审
if(CommonUtils.isNotEmpty(video.getCategory()) && video.getCategory().equals(CommonConst.CATEGORY_WITNESS)){
if(video.getAvsample().equals(CommonConst.AVSAMPLE_SUCCESS)){
logger.info("发送数美检测的videos_id:"+video.getId());
//数美图片过滤
videosService.videoFilter(video.getId(),CommonConst.DYNAMIC_USER);
}else{
continue;
}
}
logger.info("白名单自动通过的videos_id:"+video.getId());
video.setUpdater("白名单");
//更新点播和审核的视频状态
videosService.updateDianboAndShenhe(video,3);
}
}
}
}
/**
* 定时发送数美检测视频
*/
/** @Scheduled(cron="0 0/1 7-23 * * ? ")//每天7点到23点执行,每分钟一次
public void videofilter() {
ShyVideos shyVideos = new ShyVideos();
shyVideos.setCategory(CommonConst.CATEGORY_WITNESS);//目击者
shyVideos.setState(CommonConst.AUDIT_INTT);//待审核状态
shyVideos.setAvsample(CommonConst.AVSAMPLE_SUCCESS);//抽帧完成
List<ShyVideos> shyVideosList = videosService.findshyVideo(shyVideos);
//获取所有点播免审sp
// List<Integer> sites = sitesService.getBusinessList();
if (shyVideosList.size() > 0) {
for (ShyVideos video : shyVideosList) {
// if(sites.contains(video.getSpid())){//点播免审sp里面包含视频的sp,则跳过
// continue;
// }
logger.info("定时发送数美检测的videos_id:"+video.getId());
//数美图片过滤
videosService.videoFilter(video.getId(),CommonConst.DYNAMIC_USER);
}
}
}
*/
/**
* 自动退领
*/
@Scheduled(cron="0 0 0 * * ? ")//每天0点执行
public void autoRetReceive() {
logger.info("点播自动退领的进入.....");
ShyVideos shyVideos = new ShyVideos();
shyVideos.setState(CommonConst.AUDIT_INTT);//审核状态:未审核
shyVideos.setReceive(CommonConst.RECEIVE_AFTER);//已领取
List<ShyVideos> shyVideosList = videosService.findshyVideo(shyVideos);
if(shyVideosList.size()>0){
for (ShyVideos shyVideos2 : shyVideosList) {
logger.info("自动退领的videos_id:"+shyVideos2.getId());
shyVideos2.setReceive(CommonConst.RECEIVE_BEFORE);//未领取
shyVideos2.setReceive_user_id(null);
videosService.updateshyVideos(shyVideos2);
}
}
}
}