TopicJob.java
1.54 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
package com.cnlive.shenhe.job;
import com.cnlive.shenhe.entity.ShyTopic;
import com.cnlive.shenhe.service.TopicService;
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.stereotype.Component;
import java.util.List;
/**
* @Author: xujincheng
* @Date: 2020/3/13 15:47
*/
@Component
public class TopicJob {
private static Logger logger = LoggerFactory.getLogger(TopicJob.class);
@Autowired
TopicService topicService;
@Autowired
InfoUtil infoUtil;
@Value("${spring.localhost.url}")
private String localhost_url;
//@Scheduled(cron = "0 0/5 * * * ?")
public void topicNotice() {
ShyTopic shyTopic = new ShyTopic();
shyTopic.setShenhe_status(CommonConst.AUDIT_INTT);
shyTopic.setShenhe_type(CommonConst.AUDIT_TYPE_USER);
List<ShyTopic> shyTopicList = topicService.findShyTopic(shyTopic);
if (shyTopicList != null && shyTopicList.size() > 0) {
logger.info("您有" + shyTopicList.size() + "条新的话题审核,请注意查看!");
// 设置Headless模式,linux系统下
System.setProperty("java.awt.headless", "true");
infoUtil.show("新话题审核", "您有" + shyTopicList.size() + "条新的话题审核,请注意查看!", localhost_url + "/topic/page?shenhe_status=0&receive=0");
}
}
}