Commit c0fff3152df91c15ae35f9a07f5d3429a4cfa374

Authored by liwei2917
1 parent 614093a8

数美审核排除掉白名单sp

src/main/java/com/cnlive/shenhe/job/VideosJob.java
1 1 package com.cnlive.shenhe.job;
2 2  
3   -import com.alibaba.fastjson.JSONObject;
4   -import com.cnlive.shenhe.entity.ShySites;
5 3 import com.cnlive.shenhe.entity.ShyVideos;
6 4 import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl;
7 5 import com.cnlive.shenhe.serviceImpl.SitesServiceImpl;
... ... @@ -9,15 +7,12 @@ import com.cnlive.shenhe.serviceImpl.UsersServiceImpl;
9 7 import com.cnlive.shenhe.serviceImpl.VideosServiceImpl;
10 8 import com.cnlive.shenhe.utils.AuditPass;
11 9 import com.cnlive.shenhe.utils.CommonConst;
12   -import com.cnlive.shenhe.utils.CommonUtils;
13 10 import org.slf4j.Logger;
14 11 import org.slf4j.LoggerFactory;
15 12 import org.springframework.beans.factory.annotation.Autowired;
16 13 import org.springframework.scheduling.annotation.Scheduled;
17 14 import org.springframework.stereotype.Component;
18 15  
19   -import java.util.ArrayList;
20   -import java.util.Arrays;
21 16 import java.util.List;
22 17  
23 18 @Component
... ... @@ -40,18 +35,8 @@ public class VideosJob {
40 35 */
41 36 @Scheduled(fixedRate = 60 * 1000)
42 37 public void updateVideos() {
43   - //收集免审的spid
44   - List<ShySites> sitesList = sitesService.findAll();
45   - ArrayList<Integer> sites = new ArrayList<Integer>();
46   - for (ShySites shySites : sitesList) {
47   - if (CommonUtils.isNotEmpty(shySites.getWrite_business())) {
48   - String[] business = shySites.getWrite_business().split(",");
49   - List<String> asList = Arrays.asList(business);
50   - if (asList.contains(CommonConst.BUSINESS_VIDEO + "")) {
51   - sites.add(shySites.getSpid());
52   - }
53   - }
54   - }
  38 + //获取所有点播免审sp
  39 + List<Integer> sites = sitesService.getBusinessList();
55 40 //遍历免审的spid去更改状态值
56 41 ShyVideos shyVideos = new ShyVideos();
57 42 for (int spid : sites) {
... ... @@ -78,8 +63,13 @@ public class VideosJob {
78 63 shyVideos.setState(CommonConst.AUDIT_INTT);//待审核状态
79 64 shyVideos.setAvsample(CommonConst.AVSAMPLE_SUCCESS);//抽帧完成
80 65 List<ShyVideos> shyVideosList = videosService.findshyVideo(shyVideos);
  66 + //获取所有点播免审sp
  67 + List<Integer> sites = sitesService.getBusinessList();
81 68 if (shyVideosList.size() > 0) {
82 69 for (ShyVideos video : shyVideosList) {
  70 + if(sites.contains(video.getSpid())){//点播免审sp里面包含视频的sp,则跳过
  71 + continue;
  72 + }
83 73 //数美图片过滤
84 74 videosService.videoFilter(video.getId(),CommonConst.DYNAMIC_USER);
85 75 }
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/SitesServiceImpl.java
... ... @@ -2,6 +2,7 @@ package com.cnlive.shenhe.serviceImpl;
2 2  
3 3 import com.cnlive.shenhe.entity.ShySites;
4 4 import com.cnlive.shenhe.mapper.ShySitesMapper;
  5 +import com.cnlive.shenhe.utils.CommonConst;
5 6 import com.cnlive.shenhe.utils.CommonUtils;
6 7 import com.github.pagehelper.PageHelper;
7 8 import com.github.pagehelper.PageInfo;
... ... @@ -9,6 +10,8 @@ import org.springframework.beans.factory.annotation.Autowired;
9 10 import org.springframework.stereotype.Service;
10 11 import tk.mybatis.mapper.entity.Example;
11 12  
  13 +import java.util.ArrayList;
  14 +import java.util.Arrays;
12 15 import java.util.List;
13 16  
14 17 /**
... ... @@ -70,4 +73,23 @@ public class SitesServiceImpl {
70 73 List<ShySites> shySites = shySitesMapper.selectByExample(example);
71 74 return shySites.get(0);
72 75 }
  76 + /**
  77 + * 获取免审白名单列表(点播)
  78 + * @return
  79 + */
  80 + public List<Integer> getBusinessList() {
  81 + List<ShySites> sitesList = shySitesMapper.selectAll();
  82 + List<Integer> sites = new ArrayList<Integer>();
  83 + for (ShySites shySites : sitesList) {
  84 + if (CommonUtils.isNotEmpty(shySites.getWrite_business())) {
  85 + String[] business = shySites.getWrite_business().split(",");
  86 + List<String> asList = Arrays.asList(business);
  87 + if (asList.contains(CommonConst.BUSINESS_VIDEO + "")) {
  88 + sites.add(shySites.getSpid());
  89 + }
  90 + }
  91 + }
  92 + return sites;
  93 + }
  94 +
73 95 }
... ...