NotSpeakJob.java 1.65 KB
package com.cnlive.shenhe.job;

import com.cnlive.shenhe.bean.ResponseBean;
import com.cnlive.shenhe.entity.ShyComments;
import com.cnlive.shenhe.entity.ShyNotspeak;
import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl;
import com.cnlive.shenhe.serviceImpl.NotspeakServiceImpl;
import com.cnlive.shenhe.serviceImpl.SitesServiceImpl;
import com.cnlive.shenhe.serviceImpl.UsersServiceImpl;
import com.cnlive.shenhe.utils.AuditPass;
import com.cnlive.shenhe.utils.CommonConst;
import com.cnlive.shenhe.utils.CommonUtils;

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;

@Component
public class NotSpeakJob {
    private static Logger logger = LoggerFactory.getLogger(NotSpeakJob.class);
    @Autowired
    SitesServiceImpl sitesService;
    @Autowired
    AuditPass Pass;
    @Autowired
    CommentsServiceImpl commentsService;

    @Autowired
    UsersServiceImpl usersService;
    
    @Autowired
    NotspeakServiceImpl 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);
            }
    	}
    }
    
    
    
}