ChannelJob.java
2.34 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
package com.cnlive.shenhe.job;
import com.cnlive.shenhe.entity.ShyChannel;
import com.cnlive.shenhe.service.ChannelService;
import com.cnlive.shenhe.utils.CommonConst;
import com.cnlive.shenhe.utils.InfoUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author Administrator
*/
@Component
public class ChannelJob {
private static Logger logger = LoggerFactory.getLogger(ChannelJob.class);
@Value("${spring.localhost.url}")
//本机地址
private String localhost_url;
@Autowired
InfoUtil infoUtil;
@Autowired
ChannelService channelService;
@Scheduled(fixedRate = 60 * 1000)
public void updateChannel() {
//遍历免审的spid去更改状态值
ShyChannel shyChannel = new ShyChannel();
// 审核类型为免审
shyChannel.setShenhe_type(CommonConst.AUDIT_TYPE_FREE);
shyChannel.setShenhe_status(CommonConst.AUDIT_INTT);
List<ShyChannel> channelList = channelService.findshyChannel(shyChannel);
if (channelList.size() > 0) {
for (ShyChannel channel : channelList) {
channelService.updateState(channel.getId().toString(), CommonConst.AUDIT_SUCCESS, "", "白名单", "白名单通过");
}
}
}
/**
* 频道审核通知
*/
// @Scheduled(fixedRate = 60 * 1000)
public void channelNotice() {
ShyChannel shyChannel = new ShyChannel();
// 审核类型为人工审
shyChannel.setShenhe_type(CommonConst.AUDIT_TYPE_USER);
shyChannel.setShenhe_status(CommonConst.AUDIT_INTT);
List<ShyChannel> channelList = channelService.findshyChannel(shyChannel);
if (channelList.size() > 0) {
logger.info("您有" + channelList.size() + "条新的频道审核申请,请注意查看!");
// 设置Headless模式,linux系统下
System.setProperty("java.awt.headless", "false");
infoUtil.show("新频道申请", "您有" + channelList.size() + "条新的频道审核申请,请注意查看!", localhost_url + "/channel/page?shenhe_status=0&receive=0");
}
}
}