Commit 91a7cff82216b1507b02abb33a2a3e2be488538a
Merge branch 'dev'
Showing
1 changed file
with
46 additions
and
0 deletions
src/main/java/com/cnlive/shenhe/job/TopicJob.java
0 → 100644
| 1 | +package com.cnlive.shenhe.job; | |
| 2 | + | |
| 3 | +import com.cnlive.shenhe.entity.ShyTopic; | |
| 4 | +import com.cnlive.shenhe.serviceImpl.TopicServiceImpl; | |
| 5 | +import com.cnlive.shenhe.utils.CommonConst; | |
| 6 | +import com.cnlive.shenhe.utils.InfoUtil; | |
| 7 | +import org.slf4j.Logger; | |
| 8 | +import org.slf4j.LoggerFactory; | |
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 10 | +import org.springframework.beans.factory.annotation.Value; | |
| 11 | +import org.springframework.scheduling.annotation.Scheduled; | |
| 12 | +import org.springframework.stereotype.Component; | |
| 13 | + | |
| 14 | +import java.util.List; | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * @Author: xujincheng | |
| 18 | + * @Date: 2020/3/13 15:47 | |
| 19 | + */ | |
| 20 | + | |
| 21 | +@Component | |
| 22 | +public class TopicJob { | |
| 23 | + | |
| 24 | + private static Logger logger = LoggerFactory.getLogger(TopicJob.class); | |
| 25 | + | |
| 26 | + @Autowired | |
| 27 | + TopicServiceImpl topicService; | |
| 28 | + @Autowired | |
| 29 | + InfoUtil infoUtil; | |
| 30 | + @Value("${spring.localhost.url}") | |
| 31 | + private String localhost_url; | |
| 32 | + | |
| 33 | + //@Scheduled(cron = "0 0/5 * * * ?") | |
| 34 | + public void topicNotice() { | |
| 35 | + ShyTopic shyTopic = new ShyTopic(); | |
| 36 | + shyTopic.setShenhe_status(CommonConst.AUDIT_INTT); | |
| 37 | + shyTopic.setShenhe_type(CommonConst.AUDIT_TYPE_USER); | |
| 38 | + List<ShyTopic> shyTopicList = topicService.findshyTopic(shyTopic); | |
| 39 | + if(shyTopicList!=null&­TopicList.size()>0){ | |
| 40 | + logger.info("您有"+shyTopicList.size()+"条新的话题审核,请注意查看!"); | |
| 41 | + // 设置Headless模式,linux系统下 | |
| 42 | + System.setProperty("java.awt.headless", "true"); | |
| 43 | + infoUtil.show("新话题审核", "您有"+shyTopicList.size()+"条新的话题审核,请注意查看!",localhost_url+"/topic/page?shenhe_status=0&receive=0"); | |
| 44 | + } | |
| 45 | + } | |
| 46 | +} | ... | ... |