NotSpeakJob.java
1.14 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
package com.cnlive.shenhe.job;
import com.cnlive.shenhe.entity.ShyNotspeak;
import com.cnlive.shenhe.service.NotspeakService;
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 Administrator
*/
@Component
public class NotSpeakJob {
private static Logger logger = LoggerFactory.getLogger(NotSpeakJob.class);
@Autowired
NotspeakService notSpeakService;
/**
* 自动解除禁言
* 每分钟一次
*/
@Scheduled(cron = "0 0/1 * * * ? ")
public void autoRetReceive() {
List<ShyNotspeak> shyNotspeakList = notSpeakService.getNotSpeakByTime();
if (shyNotspeakList.size() > 0) {
for (ShyNotspeak shyNotspeak : shyNotspeakList) {
logger.info("自动解除禁言的的speak_id:" + shyNotspeak.getId());
notSpeakService.speak(shyNotspeak.getId(), CommonConst.SPEAK_YES, 0, null);
}
}
}
}