VideosJob.java 2.72 KB
package com.cnlive.shenhe.job;

import com.cnlive.shenhe.entity.ShyVideos;
import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl;
import com.cnlive.shenhe.serviceImpl.SitesServiceImpl;
import com.cnlive.shenhe.serviceImpl.UsersServiceImpl;
import com.cnlive.shenhe.serviceImpl.VideosServiceImpl;
import com.cnlive.shenhe.utils.AuditPass;
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;

@Component
public class VideosJob {
    private static Logger logger = LoggerFactory.getLogger(VideosJob.class);
    @Autowired
    SitesServiceImpl sitesService;
    @Autowired
    AuditPass Pass;
    @Autowired
    CommentsServiceImpl commentsService;
    @Autowired
    UsersServiceImpl usersService;
    @Autowired
    VideosServiceImpl videosService;


    /**
     * 白名单sp视频通过
     */
    @Scheduled(fixedRate =  60 * 1000)
    public void updateVideos() {
    	//获取所有点播免审sp
        List<Integer> sites = sitesService.getBusinessList();
        //遍历免审的spid去更改状态值
        ShyVideos shyVideos = new ShyVideos();
        for (int spid : sites) {
            shyVideos.setSpid(spid);
            shyVideos.setState(CommonConst.AUDIT_INTT);
            List<ShyVideos> shyVideosList = videosService.findshyVideo(shyVideos);
            if (shyVideosList.size() > 0) {
                for (ShyVideos video : shyVideosList) {
                	video.setUpdater("白名单");
                	//更新点播和审核的视频状态
                	videosService.updateDianboAndShenhe(video,3);
                }
            }
        }
    }
    
    /**
     * 定时发送数美检测视频
     */
    @Scheduled(fixedRate =  60 * 1000)
    public void videofilter() {
    	 ShyVideos shyVideos = new ShyVideos();
    	 shyVideos.setCategory(CommonConst.CATEGORY_WITNESS);//目击者
    	 shyVideos.setState(CommonConst.AUDIT_INTT);//待审核状态
    	 shyVideos.setAvsample(CommonConst.AVSAMPLE_SUCCESS);//抽帧完成
         List<ShyVideos> shyVideosList = videosService.findshyVideo(shyVideos);
         //获取所有点播免审sp
         List<Integer> sites = sitesService.getBusinessList();
         if (shyVideosList.size() > 0) {
             for (ShyVideos video : shyVideosList) {
            	 if(sites.contains(video.getSpid())){//点播免审sp里面包含视频的sp,则跳过
            		 continue;
            	 }
              //数美图片过滤
              videosService.videoFilter(video.getId(),CommonConst.DYNAMIC_USER);
             }
         }
    }
}