ContentJob.java
3 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
package com.cnlive.shenhe.job;
import com.cnlive.shenhe.entity.ShyContent;
import com.cnlive.shenhe.service.ContentService;
import com.cnlive.shenhe.utils.CommonConst;
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;
/**
* 图文发布审核
*
* @author
*/
@Component
public class ContentJob {
private static Logger logger = LoggerFactory.getLogger(ContentJob.class);
@Autowired
ContentService contentService;
/**
* 白名单sp图文通过
*/
@Scheduled(fixedRate = 60 * 1000)
public void updateVideos() {
ShyContent shyContent = new ShyContent();
// 审核类型为免审
shyContent.setShenhe_type(CommonConst.AUDIT_TYPE_FREE);
// 领取状态为未领取
shyContent.setReceive_status(CommonConst.RECEIVE_BEFORE);
List<ShyContent> shyContentList = contentService.findShyContent(shyContent);
if (shyContentList.size() > 0) {
for (ShyContent content : shyContentList) {
logger.info("当前白名单通过的content_id:" + content.getId());
content.setUpdater("白名单");
// 更新点播和审核的视频状态
contentService.callback(content.getId() + "", "白名单审核通过", CommonConst.AUDIT_SUCCESS, "", content.getUpdater());
}
}
}
/**
* 定时向易盾提交网站地址
* 每2分钟一次
*/
@Scheduled(cron = "0 0/2 * * * ? ")
public void videofilter() {
logger.info("审核云提交网页审核到易盾...........");
List<ShyContent> shyContentList = contentService.findShyContentWithWebPage();
if (shyContentList != null && shyContentList.size() > 0) {
logger.info("审核云提交网页审核到易盾数据个数:{}", shyContentList.size());
for (ShyContent content : shyContentList) {
content.setUpdater("机审");
contentService.contentFilter(content);
}
}
}
/**
* 自动退领
* 每天0点执行
*/
@Scheduled(cron = "0 0 0 * * ? ")
public void autoRetReceive() {
logger.info("图文自动退领的进入.....");
ShyContent shyContent = new ShyContent();
//领取状态为,已领
shyContent.setReceive_status(CommonConst.RECEIVE_AFTER);
List<ShyContent> shyContentList = contentService.findShyContent(shyContent);
if (shyContentList.size() > 0) {
for (ShyContent shyContent2 : shyContentList) {
logger.info("自动退领的content_id:" + shyContent2.getId());
//未领取
shyContent2.setReceive_status(CommonConst.RECEIVE_BEFORE);
shyContent2.setAuditor_id(null);
contentService.updateShyContent(shyContent2);
}
}
}
}