Commit 11725b5d8f21c56d9c2e6979bae4e43478e6ea49

Authored by 郑超
1 parent a858ddf2

update

src/main/java/com/cnlive/shenhe/job/AudioJob.java
1 package com.cnlive.shenhe.job; 1 package com.cnlive.shenhe.job;
2 2
3 import com.cnlive.shenhe.entity.ShyAudio; 3 import com.cnlive.shenhe.entity.ShyAudio;
4 -import com.cnlive.shenhe.entity.ShyVideos;  
5 import com.cnlive.shenhe.entity.ShyYidun; 4 import com.cnlive.shenhe.entity.ShyYidun;
6 import com.cnlive.shenhe.serviceImpl.AudioServiceImpl; 5 import com.cnlive.shenhe.serviceImpl.AudioServiceImpl;
7 import com.cnlive.shenhe.serviceImpl.YiDunServiceImpl; 6 import com.cnlive.shenhe.serviceImpl.YiDunServiceImpl;
src/main/java/com/cnlive/shenhe/job/ChannelJob.java
1 package com.cnlive.shenhe.job; 1 package com.cnlive.shenhe.job;
2 2
3 import com.cnlive.shenhe.entity.ShyChannel; 3 import com.cnlive.shenhe.entity.ShyChannel;
4 -import com.cnlive.shenhe.entity.ShyComments;  
5 import com.cnlive.shenhe.serviceImpl.ChannelServiceImpl; 4 import com.cnlive.shenhe.serviceImpl.ChannelServiceImpl;
6 -import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl;  
7 import com.cnlive.shenhe.serviceImpl.SitesServiceImpl; 5 import com.cnlive.shenhe.serviceImpl.SitesServiceImpl;
8 import com.cnlive.shenhe.serviceImpl.UsersServiceImpl; 6 import com.cnlive.shenhe.serviceImpl.UsersServiceImpl;
9 import com.cnlive.shenhe.utils.AuditPass; 7 import com.cnlive.shenhe.utils.AuditPass;
10 import com.cnlive.shenhe.utils.CommonConst; 8 import com.cnlive.shenhe.utils.CommonConst;
11 import com.cnlive.shenhe.utils.InfoUtil; 9 import com.cnlive.shenhe.utils.InfoUtil;
12 -  
13 import org.slf4j.Logger; 10 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory; 11 import org.slf4j.LoggerFactory;
15 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
@@ -23,10 +20,8 @@ import java.util.List; @@ -23,10 +20,8 @@ import java.util.List;
23 public class ChannelJob { 20 public class ChannelJob {
24 private static Logger logger = LoggerFactory.getLogger(ChannelJob.class); 21 private static Logger logger = LoggerFactory.getLogger(ChannelJob.class);
25 @Value("${spring.localhost.url}") 22 @Value("${spring.localhost.url}")
26 - private String localhost_url;//本机地址  
27 -  
28 - @Autowired  
29 - SitesServiceImpl sitesService; 23 + private String localhost_url;//本机地址
  24 +
30 @Autowired 25 @Autowired
31 AuditPass Pass; 26 AuditPass Pass;
32 @Autowired 27 @Autowired
@@ -34,42 +29,38 @@ public class ChannelJob { @@ -34,42 +29,38 @@ public class ChannelJob {
34 @Autowired 29 @Autowired
35 ChannelServiceImpl channelService; 30 ChannelServiceImpl channelService;
36 31
37 - @Autowired  
38 - UsersServiceImpl usersService;  
39 -  
40 -  
41 @Scheduled(fixedRate = 60 * 1000) 32 @Scheduled(fixedRate = 60 * 1000)
42 public void updateChannel() { 33 public void updateChannel() {
43 34
44 //遍历免审的spid去更改状态值 35 //遍历免审的spid去更改状态值
45 ShyChannel shyChannel = new ShyChannel(); 36 ShyChannel shyChannel = new ShyChannel();
46 - shyChannel.setShenhe_type(CommonConst.AUDIT_TYPE_FREE);// 审核类型为免审  
47 - shyChannel.setShenhe_status(CommonConst.AUDIT_INTT);  
48 - List<ShyChannel> channelList = channelService.findshyChannel(shyChannel);  
49 - if (channelList.size() > 0) {  
50 - for (ShyChannel channel : channelList) {  
51 - channelService.updateState(channel.getId().toString(), CommonConst.AUDIT_SUCCESS, "","白名单","白名单通过");  
52 - } 37 + shyChannel.setShenhe_type(CommonConst.AUDIT_TYPE_FREE);// 审核类型为免审
  38 + shyChannel.setShenhe_status(CommonConst.AUDIT_INTT);
  39 + List<ShyChannel> channelList = channelService.findshyChannel(shyChannel);
  40 + if (channelList.size() > 0) {
  41 + for (ShyChannel channel : channelList) {
  42 + channelService.updateState(channel.getId().toString(), CommonConst.AUDIT_SUCCESS, "", "白名单", "白名单通过");
53 } 43 }
  44 + }
54 } 45 }
55 - 46 +
56 /** 47 /**
57 * 频道审核通知 48 * 频道审核通知
58 */ 49 */
59 // @Scheduled(fixedRate = 60 * 1000) 50 // @Scheduled(fixedRate = 60 * 1000)
60 public void channelNotice() { 51 public void channelNotice() {
61 - ShyChannel shyChannel = new ShyChannel();  
62 - shyChannel.setShenhe_type(CommonConst.AUDIT_TYPE_USER);// 审核类型为人工审  
63 - shyChannel.setShenhe_status(CommonConst.AUDIT_INTT);  
64 - List<ShyChannel> channelList = channelService.findshyChannel(shyChannel);  
65 - if (channelList.size() > 0) {  
66 - logger.info("您有"+channelList.size()+"条新的频道审核申请,请注意查看!");  
67 - // 设置Headless模式,linux系统下 52 + ShyChannel shyChannel = new ShyChannel();
  53 + shyChannel.setShenhe_type(CommonConst.AUDIT_TYPE_USER);// 审核类型为人工审
  54 + shyChannel.setShenhe_status(CommonConst.AUDIT_INTT);
  55 + List<ShyChannel> channelList = channelService.findshyChannel(shyChannel);
  56 + if (channelList.size() > 0) {
  57 + logger.info("您有" + channelList.size() + "条新的频道审核申请,请注意查看!");
  58 + // 设置Headless模式,linux系统下
68 System.setProperty("java.awt.headless", "false"); 59 System.setProperty("java.awt.headless", "false");
69 - infoUtil.show("新频道申请", "您有"+channelList.size()+"条新的频道审核申请,请注意查看!",localhost_url+"/channel/page?shenhe_status=0&receive=0");  
70 - }  
71 - 60 + infoUtil.show("新频道申请", "您有" + channelList.size() + "条新的频道审核申请,请注意查看!", localhost_url + "/channel/page?shenhe_status=0&receive=0");
  61 + }
  62 +
72 } 63 }
73 -  
74 - 64 +
  65 +
75 } 66 }
src/main/java/com/cnlive/shenhe/job/CommentsJob.java
1 package com.cnlive.shenhe.job; 1 package com.cnlive.shenhe.job;
2 2
3 -import com.alibaba.fastjson.JSONObject;  
4 import com.cnlive.shenhe.entity.ShyComments; 3 import com.cnlive.shenhe.entity.ShyComments;
5 -import com.cnlive.shenhe.entity.ShySites;  
6 -import com.cnlive.shenhe.entity.ShyVideos;  
7 import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl; 4 import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl;
8 -import com.cnlive.shenhe.serviceImpl.SitesServiceImpl;  
9 -import com.cnlive.shenhe.serviceImpl.UsersServiceImpl;  
10 import com.cnlive.shenhe.utils.AuditPass; 5 import com.cnlive.shenhe.utils.AuditPass;
11 import com.cnlive.shenhe.utils.CommonConst; 6 import com.cnlive.shenhe.utils.CommonConst;
12 -import com.cnlive.shenhe.utils.CommonUtils;  
13 import org.slf4j.Logger; 7 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory; 8 import org.slf4j.LoggerFactory;
15 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
16 import org.springframework.scheduling.annotation.Scheduled; 10 import org.springframework.scheduling.annotation.Scheduled;
17 import org.springframework.stereotype.Component; 11 import org.springframework.stereotype.Component;
18 12
19 -import java.util.ArrayList;  
20 -import java.util.Arrays;  
21 import java.util.List; 13 import java.util.List;
22 14
23 @Component 15 @Component
24 public class CommentsJob { 16 public class CommentsJob {
25 private static Logger logger = LoggerFactory.getLogger(CommentsJob.class); 17 private static Logger logger = LoggerFactory.getLogger(CommentsJob.class);
26 @Autowired 18 @Autowired
27 - SitesServiceImpl sitesService;  
28 - @Autowired  
29 - AuditPass Pass;  
30 - @Autowired  
31 CommentsServiceImpl commentsService; 19 CommentsServiceImpl commentsService;
32 20
33 - @Autowired  
34 - UsersServiceImpl usersService;  
35 -  
36 -  
37 @Scheduled(fixedRate = 60 * 1000) 21 @Scheduled(fixedRate = 60 * 1000)
38 public void updateComments() { 22 public void updateComments() {
39 23
40 //遍历免审的spid去更改状态值 24 //遍历免审的spid去更改状态值
41 ShyComments shyComments = new ShyComments(); 25 ShyComments shyComments = new ShyComments();
42 - shyComments.setShenhe_type(CommonConst.AUDIT_TYPE_FREE);// 审核类型为免审  
43 - shyComments.setState(CommonConst.AUDIT_INTT);  
44 - List<ShyComments> commentsList = commentsService.findshyComments(shyComments);  
45 - if (commentsList.size() > 0) {  
46 - for (ShyComments comments : commentsList) {  
47 - commentsService.updateState(comments.getId().toString(), CommonConst.AUDIT_SUCCESS, "","白名单","白名单通过");  
48 -// //封装json数据传参进行回调  
49 -// JSONObject json1 = new JSONObject();  
50 -// json1.put("activity_id", comments.getActivity_id());  
51 -// json1.put("state", 3);  
52 -// json1.put("attr_tags", "");  
53 -// json1.put("msg", "白名单通过");  
54 -// JSONObject result = new JSONObject();  
55 -// try {  
56 -// result = Pass.commentPass(json1, comments.getCallback());  
57 -// Integer errorCode = result.getInteger("errorCode");  
58 -// if (0 == errorCode) {  
59 -// int i = commentsService.updateComment(comments.getId(), CommonConst.AUDIT_SUCCESS, json1.getString("msg"));  
60 -// if (i != 1) {  
61 -// logger.error("评论审核回调失败,activity_id:{},errorCode:{},errorMessage:{}", comments.getActivity_id(), errorCode, result.getString("errorMessage"));  
62 -// }  
63 -// } else {  
64 -// commentsService.updateComment(comments.getId(), CommonConst.AUDIT_CALLBACK_FAIL, "白名单回调失败");  
65 -// logger.error("评论审核回调失败,activity_id:{},errorCode:{},errorMessage:{}", comments.getActivity_id(), errorCode, result.getString("errorMessage"));  
66 -// }  
67 -// } catch (Exception e) {  
68 -// logger.error("评论回调失败,activity_id:{}", comments.getActivity_id(),e);  
69 -// }  
70 - } 26 + shyComments.setShenhe_type(CommonConst.AUDIT_TYPE_FREE);// 审核类型为免审
  27 + shyComments.setState(CommonConst.AUDIT_INTT);
  28 + List<ShyComments> commentsList = commentsService.findshyComments(shyComments);
  29 + if (commentsList.size() > 0) {
  30 + for (ShyComments comments : commentsList) {
  31 + commentsService.updateState(comments.getId().toString(), CommonConst.AUDIT_SUCCESS, "", "白名单", "白名单通过");
71 } 32 }
  33 + }
72 } 34 }
73 - 35 +
74 /** 36 /**
75 * 自动退领 37 * 自动退领
76 */ 38 */
77 - @Scheduled(cron="0 0 0 * * ? ")//每天0点执行 39 + @Scheduled(cron = "0 0 0 * * ? ")//每天0点执行
78 public void autoRetReceive() { 40 public void autoRetReceive() {
79 - logger.info("评论自动退领的进入.....");  
80 - ShyComments shyComments = new ShyComments();  
81 - shyComments.setState(CommonConst.AUDIT_INTT);//审核状态:未审核  
82 - shyComments.setReceive(CommonConst.RECEIVE_AFTER);//已领取  
83 - List<ShyComments> commentsList = commentsService.findshyComments(shyComments); 41 + logger.info("评论自动退领的进入.....");
  42 + ShyComments shyComments = new ShyComments();
  43 + shyComments.setState(CommonConst.AUDIT_INTT);//审核状态:未审核
  44 + shyComments.setReceive(CommonConst.RECEIVE_AFTER);//已领取
  45 + List<ShyComments> commentsList = commentsService.findshyComments(shyComments);
84 if (commentsList.size() > 0) { 46 if (commentsList.size() > 0) {
85 for (ShyComments comments : commentsList) { 47 for (ShyComments comments : commentsList) {
86 - logger.info("自动退领的comments_id:"+comments.getId());  
87 - comments.setReceive(CommonConst.RECEIVE_BEFORE);//未领取  
88 - comments.setReceive_user_id(null);  
89 - commentsService.updateshyComments1(comments); 48 + logger.info("自动退领的comments_id:" + comments.getId());
  49 + comments.setReceive(CommonConst.RECEIVE_BEFORE);//未领取
  50 + comments.setReceive_user_id(null);
  51 + commentsService.updateshyComments1(comments);
90 } 52 }
91 - } 53 + }
92 } 54 }
93 -  
94 -  
95 - 55 +
  56 +
96 } 57 }
src/main/java/com/cnlive/shenhe/job/ContentJob.java
1 package com.cnlive.shenhe.job; 1 package com.cnlive.shenhe.job;
2 2
3 import com.cnlive.shenhe.entity.ShyContent; 3 import com.cnlive.shenhe.entity.ShyContent;
4 -import com.cnlive.shenhe.entity.ShyVideos;  
5 import com.cnlive.shenhe.entity.ShyYidun; 4 import com.cnlive.shenhe.entity.ShyYidun;
6 -import com.cnlive.shenhe.serviceImpl.*;  
7 -import com.cnlive.shenhe.utils.AuditPass; 5 +import com.cnlive.shenhe.serviceImpl.ContentServiceImpl;
  6 +import com.cnlive.shenhe.serviceImpl.YiDunServiceImpl;
8 import com.cnlive.shenhe.utils.CommonConst; 7 import com.cnlive.shenhe.utils.CommonConst;
9 -import com.cnlive.shenhe.utils.CommonUtils;  
10 -  
11 import org.slf4j.Logger; 8 import org.slf4j.Logger;
12 import org.slf4j.LoggerFactory; 9 import org.slf4j.LoggerFactory;
13 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
@@ -20,84 +17,74 @@ import java.util.List; @@ -20,84 +17,74 @@ import java.util.List;
20 public class ContentJob { 17 public class ContentJob {
21 private static Logger logger = LoggerFactory.getLogger(ContentJob.class); 18 private static Logger logger = LoggerFactory.getLogger(ContentJob.class);
22 @Autowired 19 @Autowired
23 - SitesServiceImpl sitesService;  
24 - @Autowired  
25 - AuditPass Pass;  
26 - @Autowired  
27 - CommentsServiceImpl commentsService;  
28 - @Autowired  
29 - UsersServiceImpl usersService;  
30 - @Autowired  
31 - VideosServiceImpl videosService;  
32 - @Autowired  
33 ContentServiceImpl contentService; 20 ContentServiceImpl contentService;
34 - @Autowired  
35 - YiDunServiceImpl yiDunServiceImpl; 21 + @Autowired
  22 + YiDunServiceImpl yiDunServiceImpl;
36 23
37 24
38 /** 25 /**
39 - * 白名单sp图文通过  
40 - */  
41 - @Scheduled(fixedRate = 60 * 1000)  
42 - public void updateVideos() {  
43 - ShyContent shyContent = new ShyContent();  
44 - shyContent.setShenhe_type(CommonConst.AUDIT_TYPE_FREE);// 审核类型为免审  
45 - shyContent.setReceive_status(CommonConst.RECEIVE_BEFORE);// 领取状态为未领取  
46 - List<ShyContent> shyContentList = contentService.findshyContent(shyContent);  
47 - if (shyContentList.size() > 0) {  
48 - for (ShyContent content : shyContentList) {  
49 - logger.info("当前白名单通过的content_id:"+content.getId());  
50 - content.setUpdater("白名单");  
51 - // 更新点播和审核的视频状态  
52 - contentService.callback(content.getId()+"","白名单审核通过", 1,"","白名单");  
53 - }  
54 - } 26 + * 白名单sp图文通过
  27 + */
  28 + @Scheduled(fixedRate = 60 * 1000)
  29 + public void updateVideos() {
  30 + ShyContent shyContent = new ShyContent();
  31 + shyContent.setShenhe_type(CommonConst.AUDIT_TYPE_FREE);// 审核类型为免审
  32 + shyContent.setReceive_status(CommonConst.RECEIVE_BEFORE);// 领取状态为未领取
  33 + List<ShyContent> shyContentList = contentService.findshyContent(shyContent);
  34 + if (shyContentList.size() > 0) {
  35 + for (ShyContent content : shyContentList) {
  36 + logger.info("当前白名单通过的content_id:" + content.getId());
  37 + content.setUpdater("白名单");
  38 + // 更新点播和审核的视频状态
  39 + contentService.callback(content.getId() + "", "白名单审核通过", 1, "", "白名单");
  40 + }
  41 + }
  42 + }
  43 +
  44 + /**
  45 + * 定时向易盾提交网站地址
  46 + */
  47 + @Scheduled(cron = "0 0/1 * * * ? ")//每分钟一次
  48 + public void videofilter() {
  49 + ShyContent shyContent = new ShyContent();
  50 + //机审
  51 + shyContent.setShenhe_type(CommonConst.AUDIT_TYPE_MACHANE);
  52 + //待审
  53 + shyContent.setReceive_status(CommonConst.RECEIVE_BEFORE);
  54 + List<ShyContent> shyContentList = contentService.findshyContent(shyContent);
  55 + if (shyContentList != null && shyContentList.size() > 0) {
  56 + for (ShyContent content : shyContentList) {
  57 + //易盾网站过滤
  58 + ShyYidun shyYidun = new ShyYidun();
  59 + shyYidun.setContent_id(content.getId().toString());
  60 + ShyYidun shyYidun1 = yiDunServiceImpl.getidunMsgByContentId(shyYidun);
  61 + if (shyYidun1 == null) {
  62 + logger.info("定时发送易盾检测的content_id:" + content.getId());
  63 + contentService.contentFilter(content);
  64 +
  65 + }
  66 + }
  67 + }
55 } 68 }
56 69
57 - /**  
58 - * 定时向易盾提交网站地址  
59 - */  
60 - @Scheduled(cron = "0 0/1 * * * ? ")//每分钟一次  
61 - public void videofilter() {  
62 - ShyContent shyContent = new ShyContent();  
63 - //机审  
64 - shyContent.setShenhe_type(CommonConst.AUDIT_TYPE_MACHANE);  
65 - //待审  
66 - shyContent.setReceive_status(CommonConst.RECEIVE_BEFORE);  
67 - List<ShyContent> shyContentList = contentService.findshyContent(shyContent);  
68 - if (shyContentList != null && shyContentList.size() > 0) {  
69 - for (ShyContent content : shyContentList) {  
70 - //易盾网站过滤  
71 - ShyYidun shyYidun = new ShyYidun();  
72 - shyYidun.setContent_id(content.getId().toString());  
73 - ShyYidun shyYidun1 = yiDunServiceImpl.getidunMsgByContentId(shyYidun);  
74 - if (shyYidun1 == null) {  
75 - logger.info("定时发送易盾检测的content_id:" + content.getId());  
76 - contentService.contentFilter(content);  
77 70
78 - }  
79 - }  
80 - }  
81 - }  
82 -  
83 -  
84 /** 71 /**
85 * 自动退领 72 * 自动退领
86 */ 73 */
87 - @Scheduled(cron="0 0 0 * * ? ")//每天0点执行 74 + @Scheduled(cron = "0 0 0 * * ? ")//每天0点执行
88 public void autoRetReceive() { 75 public void autoRetReceive() {
89 - logger.info("图文自动退领的进入.....");  
90 - ShyContent shyContent = new ShyContent();  
91 - shyContent.setReceive_status(CommonConst.RECEIVE_AFTER);//领取状态为,已领  
92 - List<ShyContent> shyContentList = contentService.findshyContent(shyContent);  
93 - if(shyContentList.size()>0){  
94 - for (ShyContent shyContent2 : shyContentList) {  
95 - logger.info("自动退领的content_id:"+shyContent2.getId());  
96 - shyContent2.setReceive_status(CommonConst.RECEIVE_BEFORE);//未领取  
97 - shyContent2.setAuditor_id(null);  
98 - contentService.updateshyContent(shyContent2);  
99 - }  
100 - } 76 + logger.info("图文自动退领的进入.....");
  77 + ShyContent shyContent = new ShyContent();
  78 + shyContent.setReceive_status(CommonConst.RECEIVE_AFTER);//领取状态为,已领
  79 + List<ShyContent> shyContentList = contentService.findshyContent(shyContent);
  80 + if (shyContentList.size() > 0) {
  81 + for (ShyContent shyContent2 : shyContentList) {
  82 + logger.info("自动退领的content_id:" + shyContent2.getId());
  83 + shyContent2.setReceive_status(CommonConst.RECEIVE_BEFORE);//未领取
  84 + shyContent2.setAuditor_id(null);
  85 + contentService.updateshyContent(shyContent2);
  86 + }
  87 + }
101 } 88 }
102 - 89 +
103 } 90 }
src/main/java/com/cnlive/shenhe/job/LiveApplyJob.java
1 package com.cnlive.shenhe.job; 1 package com.cnlive.shenhe.job;
2 2
3 import com.alibaba.fastjson.JSONObject; 3 import com.alibaba.fastjson.JSONObject;
4 -import com.cnlive.shenhe.bean.ErrorEnum;  
5 -import com.cnlive.shenhe.bean.ResponseBean;  
6 -import com.cnlive.shenhe.entity.ShyChannel;  
7 -import com.cnlive.shenhe.entity.ShyComments;  
8 import com.cnlive.shenhe.entity.ShyEmail; 4 import com.cnlive.shenhe.entity.ShyEmail;
9 import com.cnlive.shenhe.entity.ShyLiveapply; 5 import com.cnlive.shenhe.entity.ShyLiveapply;
10 import com.cnlive.shenhe.entity.ShySites; 6 import com.cnlive.shenhe.entity.ShySites;
11 -import com.cnlive.shenhe.entity.ShyVideos;  
12 import com.cnlive.shenhe.mapper.ShyLiveapplyMapper; 7 import com.cnlive.shenhe.mapper.ShyLiveapplyMapper;
13 -import com.cnlive.shenhe.serviceImpl.ChannelServiceImpl;  
14 -import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl;  
15 import com.cnlive.shenhe.serviceImpl.EmailServiceImpl; 8 import com.cnlive.shenhe.serviceImpl.EmailServiceImpl;
16 import com.cnlive.shenhe.serviceImpl.LiveApplyServiceImpl; 9 import com.cnlive.shenhe.serviceImpl.LiveApplyServiceImpl;
17 import com.cnlive.shenhe.serviceImpl.SitesServiceImpl; 10 import com.cnlive.shenhe.serviceImpl.SitesServiceImpl;
18 import com.cnlive.shenhe.serviceImpl.UsersServiceImpl; 11 import com.cnlive.shenhe.serviceImpl.UsersServiceImpl;
19 -import com.cnlive.shenhe.utils.AuditPass;  
20 -import com.cnlive.shenhe.utils.CommonConst;  
21 -import com.cnlive.shenhe.utils.CommonUtils;  
22 -import com.cnlive.shenhe.utils.HttpUtil;  
23 -import com.cnlive.shenhe.utils.InfoUtil;  
24 -import com.cnlive.shenhe.utils.OpenUtil;  
25 -  
26 -import tk.mybatis.mapper.entity.Example;  
27 -import tk.mybatis.mapper.entity.Example.Criteria;  
28 - 12 +import com.cnlive.shenhe.utils.*;
29 import org.slf4j.Logger; 13 import org.slf4j.Logger;
30 import org.slf4j.LoggerFactory; 14 import org.slf4j.LoggerFactory;
31 import org.springframework.beans.factory.annotation.Autowired; 15 import org.springframework.beans.factory.annotation.Autowired;
32 import org.springframework.beans.factory.annotation.Value; 16 import org.springframework.beans.factory.annotation.Value;
33 import org.springframework.scheduling.annotation.Scheduled; 17 import org.springframework.scheduling.annotation.Scheduled;
34 import org.springframework.stereotype.Component; 18 import org.springframework.stereotype.Component;
  19 +import tk.mybatis.mapper.entity.Example;
  20 +import tk.mybatis.mapper.entity.Example.Criteria;
35 21
36 import java.util.HashMap; 22 import java.util.HashMap;
37 import java.util.List; 23 import java.util.List;
@@ -41,137 +27,132 @@ import java.util.Map; @@ -41,137 +27,132 @@ import java.util.Map;
41 public class LiveApplyJob { 27 public class LiveApplyJob {
42 private static Logger logger = LoggerFactory.getLogger(LiveApplyJob.class); 28 private static Logger logger = LoggerFactory.getLogger(LiveApplyJob.class);
43 @Value("${spring.localhost.url}") 29 @Value("${spring.localhost.url}")
44 - private String localhost_url;//本机地址 30 + private String localhost_url;//本机地址
45 @Value("${email_app_id}") 31 @Value("${email_app_id}")
46 private String email_app_id;//开发者对应的id,与app_key相对应 32 private String email_app_id;//开发者对应的id,与app_key相对应
47 @Value("${email_app_key}") 33 @Value("${email_app_key}")
48 private String email_app_key;//开发者帐号对应的key. 请开发者谨慎保管此值。 34 private String email_app_key;//开发者帐号对应的key. 请开发者谨慎保管此值。
49 @Value("${email_send_URL}") 35 @Value("${email_send_URL}")
50 private String email_send_URL;//调用邮件发送服务器的地址 36 private String email_send_URL;//调用邮件发送服务器的地址
51 - 37 +
52 @Autowired 38 @Autowired
53 SitesServiceImpl sitesService; 39 SitesServiceImpl sitesService;
54 @Autowired 40 @Autowired
55 - AuditPass Pass;  
56 - @Autowired  
57 - InfoUtil infoUtil;  
58 - @Autowired  
59 LiveApplyServiceImpl liveApplyServiceImpl; 41 LiveApplyServiceImpl liveApplyServiceImpl;
60 @Autowired 42 @Autowired
61 ShyLiveapplyMapper shyLiveApplyMapper; 43 ShyLiveapplyMapper shyLiveApplyMapper;
62 44
63 @Autowired 45 @Autowired
64 - UsersServiceImpl usersService;  
65 - @Autowired  
66 EmailServiceImpl emailServiceImpl; 46 EmailServiceImpl emailServiceImpl;
67 47
68 @Scheduled(fixedRate = 60 * 1000) 48 @Scheduled(fixedRate = 60 * 1000)
69 public void updateLiveApply() { 49 public void updateLiveApply() {
70 50
71 //遍历免审的spid去更改状态值 51 //遍历免审的spid去更改状态值
72 - ShyLiveapply shyLiveApply = new ShyLiveapply();  
73 - shyLiveApply.setShenhe_type(CommonConst.AUDIT_TYPE_FREE);// 审核类型为免审  
74 - shyLiveApply.setShenhe_state(CommonConst.AUDIT_INTT);  
75 - List<ShyLiveapply> liveApplyList = liveApplyServiceImpl.findshyLiveApply(shyLiveApply);  
76 - if (liveApplyList.size() > 0) {  
77 - for (ShyLiveapply liveApply : liveApplyList) {  
78 - liveApplyServiceImpl.updateLiveApply(liveApply.getId(), "","白名单", CommonConst.AUDIT_SUCCESS,"白名单通过");  
79 - } 52 + ShyLiveapply shyLiveApply = new ShyLiveapply();
  53 + shyLiveApply.setShenhe_type(CommonConst.AUDIT_TYPE_FREE);// 审核类型为免审
  54 + shyLiveApply.setShenhe_state(CommonConst.AUDIT_INTT);
  55 + List<ShyLiveapply> liveApplyList = liveApplyServiceImpl.findshyLiveApply(shyLiveApply);
  56 + if (liveApplyList.size() > 0) {
  57 + for (ShyLiveapply liveApply : liveApplyList) {
  58 + liveApplyServiceImpl.updateLiveApply(liveApply.getId(), "", "白名单", CommonConst.AUDIT_SUCCESS, "白名单通过");
80 } 59 }
  60 + }
81 } 61 }
82 - 62 +
83 /** 63 /**
84 * 直播申请邮件通知 64 * 直播申请邮件通知
85 */ 65 */
86 @Scheduled(fixedRate = 60 * 1000) 66 @Scheduled(fixedRate = 60 * 1000)
87 public void liveApplyNotice() { 67 public void liveApplyNotice() {
88 - Example example = new Example(ShyLiveapply.class); 68 + Example example = new Example(ShyLiveapply.class);
89 Criteria criteria = example.createCriteria(); 69 Criteria criteria = example.createCriteria();
90 criteria.andEqualTo("shenhe_state", CommonConst.AUDIT_SUCCESS); 70 criteria.andEqualTo("shenhe_state", CommonConst.AUDIT_SUCCESS);
91 criteria.andNotEqualTo("email_notice_state", CommonConst.NOTICE_SUCCESS);//状态不等于已通知 71 criteria.andNotEqualTo("email_notice_state", CommonConst.NOTICE_SUCCESS);//状态不等于已通知
92 List<ShyLiveapply> shyLiveApplyList = shyLiveApplyMapper.selectByExample(example); 72 List<ShyLiveapply> shyLiveApplyList = shyLiveApplyMapper.selectByExample(example);
93 - if (shyLiveApplyList.size() > 0) {  
94 - String app_id = email_app_id; //开发者对应的id,与app_key相对应  
95 - String app_key = email_app_key; //开发者帐号对应的key. 请开发者谨慎保管此值。  
96 - String URL = email_send_URL;//调用邮件发送服务器的地址  
97 - List<ShyEmail> shyEmailList=emailServiceImpl.getEmailSendList(CommonConst.EMAIL_LIVEAPPLY);  
98 - logger.info("直播申请邮件通知开始,共"+shyLiveApplyList.size()+"个申请,每个申请通知"+shyEmailList.size()+"个邮箱");  
99 - for(ShyLiveapply liveApply : shyLiveApplyList){  
100 - logger.info("当前发送邮件的直播申请id为:"+liveApply.getId());  
101 - Integer notice_state = liveApply.getEmail_notice_state();//初始化通知状态  
102 - String notice_msg = liveApply.getEmail_notice_msg();//初始化通知消息  
103 - //显示spid简称 73 + if (shyLiveApplyList.size() > 0) {
  74 + String app_id = email_app_id; //开发者对应的id,与app_key相对应
  75 + String app_key = email_app_key; //开发者帐号对应的key. 请开发者谨慎保管此值。
  76 + String URL = email_send_URL;//调用邮件发送服务器的地址
  77 + List<ShyEmail> shyEmailList = emailServiceImpl.getEmailSendList(CommonConst.EMAIL_LIVEAPPLY);
  78 + logger.info("直播申请邮件通知开始,共" + shyLiveApplyList.size() + "个申请,每个申请通知" + shyEmailList.size() + "个邮箱");
  79 + for (ShyLiveapply liveApply : shyLiveApplyList) {
  80 + logger.info("当前发送邮件的直播申请id为:" + liveApply.getId());
  81 + Integer notice_state = liveApply.getEmail_notice_state();//初始化通知状态
  82 + String notice_msg = liveApply.getEmail_notice_msg();//初始化通知消息
  83 + //显示spid简称
104 ShySites shySites = sitesService.findspidDescByspid(liveApply.getSp_id()); 84 ShySites shySites = sitesService.findspidDescByspid(liveApply.getSp_id());
105 if (CommonUtils.isNotNull(shySites)) { 85 if (CommonUtils.isNotNull(shySites)) {
106 - liveApply.setSpid_desc(shySites.getName()); 86 + liveApply.setSpid_desc(shySites.getName());
  87 + }
  88 + for (ShyEmail shyEmail : shyEmailList) {//循环需要发送邮件的邮箱
  89 + String startTime = CommonUtils.formatDate(liveApply.getPre_start_time(), "yyyy-MM-dd HH:mm:ss");
  90 + String endTime = CommonUtils.isNotNull(liveApply.getPre_end_time()) ? CommonUtils.formatDate(liveApply.getPre_end_time(), "yyyy-MM-dd HH:mm:ss") : "待定";
  91 + String content = liveApply.getSender() + "__" + liveApply.getMobile() + "__" + liveApply.getOrganization() + "__" + liveApply.getTheme() + "__" + startTime + "__" + endTime + "__" + liveApply.getLive_place() + "__" + liveApply.getPush_url() + "__" + liveApply.getPull_source() + "," + liveApply.getPull_url();
  92 + String dateTime = CommonUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss");//获取一个格式化后的当前时间
  93 + String emailAddr = shyEmail.getEmail();
  94 + String title = liveApply.getSpid_desc() + "新直播开播申请";
  95 + String templateId = "4017";
  96 + Map<String, String> params = new HashMap<>();
  97 + params.put("appId", app_id);
  98 + params.put("emailAddr", emailAddr);
  99 + params.put("title", title);
  100 + params.put("content", content);
  101 + params.put("templateId", templateId);
  102 + params.put("sign", OpenUtil.sign(params, app_key));
  103 + HttpUtil httpUtil = HttpUtil.init();
  104 + httpUtil.setParamMap(params);
  105 + try {
  106 + Map<String, String> post = httpUtil.post(URL);
  107 + logger.info("当前发送邮件用户为:" + emailAddr + ",发送邮件的直播申请审核云id为:" + liveApply.getId() + "结果为:" + post.get("result"));
  108 + JSONObject result = JSONObject.parseObject(post.get("result"));
  109 + if (result == null) {
  110 + notice_state = CommonConst.NOTICE_FAIL;
  111 + notice_msg = notice_msg + "\n" + dateTime + " 邮件服务器调用失败,result为空";
  112 + break;
  113 + }
  114 + Integer code = result.getInteger("errorCode");
  115 + if (code != 0) {
  116 + notice_state = CommonConst.NOTICE_FAIL;
  117 + notice_msg = notice_msg + "\n" + dateTime + " 邮件服务器调用失败,result返回消息为:" + result.getString("errorMessage");
  118 + break;
  119 + } else {
  120 + notice_state = CommonConst.NOTICE_SUCCESS;
  121 + notice_msg = notice_msg + "\n" + dateTime + " 邮件" + emailAddr + "(" + shyEmail.getRemark() + ")发送成功";
  122 + }
  123 + } catch (Exception e) {
  124 + notice_state = CommonConst.NOTICE_FAIL;
  125 + notice_msg = notice_msg + "\n" + dateTime + " 邮件服务器调用失败,服务器报错了";
  126 + break;
  127 + }
107 } 128 }
108 - for(ShyEmail shyEmail:shyEmailList){//循环需要发送邮件的邮箱  
109 - String startTime=CommonUtils.formatDate(liveApply.getPre_start_time(), "yyyy-MM-dd HH:mm:ss");  
110 - String endTime=CommonUtils.isNotNull(liveApply.getPre_end_time())?CommonUtils.formatDate(liveApply.getPre_end_time(), "yyyy-MM-dd HH:mm:ss"):"待定";  
111 - String content = liveApply.getSender()+"__"+liveApply.getMobile()+"__"+liveApply.getOrganization()+"__"+liveApply.getTheme()+"__"+startTime+"__"+endTime+"__"+liveApply.getLive_place()+"__"+liveApply.getPush_url()+"__"+liveApply.getPull_source()+","+liveApply.getPull_url();  
112 - String dateTime=CommonUtils.getCurrentDate("yyyy-MM-dd HH:mm:ss");//获取一个格式化后的当前时间  
113 - String emailAddr = shyEmail.getEmail();  
114 - String title = liveApply.getSpid_desc()+"新直播开播申请";  
115 - String templateId = "4017";  
116 - Map<String, String> params = new HashMap<>();  
117 - params.put("appId", app_id);  
118 - params.put("emailAddr", emailAddr);  
119 - params.put("title",title );  
120 - params.put("content", content);  
121 - params.put("templateId", templateId);  
122 - params.put("sign", OpenUtil.sign(params,app_key));  
123 - HttpUtil httpUtil = HttpUtil.init();  
124 - httpUtil.setParamMap(params);  
125 - try {  
126 - Map<String, String> post = httpUtil.post(URL);  
127 - logger.info("当前发送邮件用户为:"+emailAddr+",发送邮件的直播申请审核云id为:"+liveApply.getId()+"结果为:"+post.get("result"));  
128 - JSONObject result=JSONObject.parseObject(post.get("result"));  
129 - if (result == null) {  
130 - notice_state=CommonConst.NOTICE_FAIL;  
131 - notice_msg=notice_msg+"\n"+dateTime+" 邮件服务器调用失败,result为空";  
132 - break;  
133 - }  
134 - Integer code = result.getInteger("errorCode");  
135 - if (code != 0) {  
136 - notice_state=CommonConst.NOTICE_FAIL;  
137 - notice_msg=notice_msg+"\n"+dateTime+" 邮件服务器调用失败,result返回消息为:"+result.getString("errorMessage");  
138 - break;  
139 - }else{  
140 - notice_state=CommonConst.NOTICE_SUCCESS;  
141 - notice_msg=notice_msg+"\n"+dateTime+" 邮件"+emailAddr+"("+shyEmail.getRemark()+")发送成功";  
142 - }  
143 - } catch (Exception e) {  
144 - notice_state=CommonConst.NOTICE_FAIL;  
145 - notice_msg=notice_msg+"\n"+dateTime+" 邮件服务器调用失败,服务器报错了";  
146 - break;  
147 - }  
148 - }  
149 - 129 +
150 liveApply.setEmail_notice_state(notice_state); 130 liveApply.setEmail_notice_state(notice_state);
151 liveApply.setEmail_notice_msg(notice_msg); 131 liveApply.setEmail_notice_msg(notice_msg);
152 liveApplyServiceImpl.updateshyLiveApply(liveApply); 132 liveApplyServiceImpl.updateshyLiveApply(liveApply);
153 - }  
154 - }  
155 - 133 + }
  134 + }
  135 +
156 } 136 }
  137 +
157 /** 138 /**
158 * 自动退领 139 * 自动退领
159 */ 140 */
160 - @Scheduled(cron="0 0 0 * * ? ")//每天0点执行 141 + @Scheduled(cron = "0 0 0 * * ? ")//每天0点执行
161 public void autoRetReceive() { 142 public void autoRetReceive() {
162 - logger.info("直播申请自动退领的进入.....");  
163 - ShyLiveapply liveApply = new ShyLiveapply();  
164 - liveApply.setShenhe_state(CommonConst.AUDIT_INTT);//审核状态:未审核  
165 - liveApply.setReceive(CommonConst.RECEIVE_AFTER);//已领取  
166 - List<ShyLiveapply> shyLiveapplyList = liveApplyServiceImpl.findshyLiveApply(liveApply);  
167 - if(shyLiveapplyList.size()>0){  
168 - for (ShyLiveapply liveapply : shyLiveapplyList) {  
169 - logger.info("自动退领的liveApply_id:"+liveapply.getId());  
170 - liveapply.setReceive(CommonConst.RECEIVE_BEFORE);//未领取  
171 - liveapply.setAuditor(null);  
172 - liveApplyServiceImpl.updateshyLiveApply(liveApply);  
173 - }  
174 - } 143 + logger.info("直播申请自动退领的进入.....");
  144 + ShyLiveapply liveApply = new ShyLiveapply();
  145 + liveApply.setShenhe_state(CommonConst.AUDIT_INTT);//审核状态:未审核
  146 + liveApply.setReceive(CommonConst.RECEIVE_AFTER);//已领取
  147 + List<ShyLiveapply> shyLiveapplyList = liveApplyServiceImpl.findshyLiveApply(liveApply);
  148 + if (shyLiveapplyList.size() > 0) {
  149 + for (ShyLiveapply liveapply : shyLiveapplyList) {
  150 + logger.info("自动退领的liveApply_id:" + liveapply.getId());
  151 + liveapply.setReceive(CommonConst.RECEIVE_BEFORE);//未领取
  152 + liveapply.setAuditor(null);
  153 + liveApplyServiceImpl.updateshyLiveApply(liveApply);
  154 + }
  155 + }
175 } 156 }
176 - 157 +
177 } 158 }
src/main/java/com/cnlive/shenhe/job/NotSpeakJob.java
1 package com.cnlive.shenhe.job; 1 package com.cnlive.shenhe.job;
2 2
3 -import com.cnlive.shenhe.bean.ResponseBean;  
4 -import com.cnlive.shenhe.entity.ShyComments;  
5 import com.cnlive.shenhe.entity.ShyNotspeak; 3 import com.cnlive.shenhe.entity.ShyNotspeak;
6 import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl; 4 import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl;
7 import com.cnlive.shenhe.serviceImpl.NotspeakServiceImpl; 5 import com.cnlive.shenhe.serviceImpl.NotspeakServiceImpl;
@@ -9,8 +7,6 @@ import com.cnlive.shenhe.serviceImpl.SitesServiceImpl; @@ -9,8 +7,6 @@ import com.cnlive.shenhe.serviceImpl.SitesServiceImpl;
9 import com.cnlive.shenhe.serviceImpl.UsersServiceImpl; 7 import com.cnlive.shenhe.serviceImpl.UsersServiceImpl;
10 import com.cnlive.shenhe.utils.AuditPass; 8 import com.cnlive.shenhe.utils.AuditPass;
11 import com.cnlive.shenhe.utils.CommonConst; 9 import com.cnlive.shenhe.utils.CommonConst;
12 -import com.cnlive.shenhe.utils.CommonUtils;  
13 -  
14 import org.slf4j.Logger; 10 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory; 11 import org.slf4j.LoggerFactory;
16 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
@@ -23,33 +19,21 @@ import java.util.List; @@ -23,33 +19,21 @@ import java.util.List;
23 public class NotSpeakJob { 19 public class NotSpeakJob {
24 private static Logger logger = LoggerFactory.getLogger(NotSpeakJob.class); 20 private static Logger logger = LoggerFactory.getLogger(NotSpeakJob.class);
25 @Autowired 21 @Autowired
26 - SitesServiceImpl sitesService;  
27 - @Autowired  
28 - AuditPass Pass;  
29 - @Autowired  
30 - CommentsServiceImpl commentsService;  
31 -  
32 - @Autowired  
33 - UsersServiceImpl usersService;  
34 -  
35 - @Autowired  
36 NotspeakServiceImpl notSpeakService; 22 NotspeakServiceImpl notSpeakService;
37 23
38 -  
39 /** 24 /**
40 * 自动解除禁言 25 * 自动解除禁言
41 */ 26 */
42 - @Scheduled(cron="0 0/1 * * * ? ")//每分钟一次 27 + @Scheduled(cron = "0 0/1 * * * ? ")//每分钟一次
43 public void autoRetReceive() { 28 public void autoRetReceive() {
44 - List<ShyNotspeak> shyNotspeakList = notSpeakService.getNotSpeakByTime(); 29 + List<ShyNotspeak> shyNotspeakList = notSpeakService.getNotSpeakByTime();
45 if (shyNotspeakList.size() > 0) { 30 if (shyNotspeakList.size() > 0) {
46 for (ShyNotspeak shyNotspeak : shyNotspeakList) { 31 for (ShyNotspeak shyNotspeak : shyNotspeakList) {
47 - logger.info("自动解除禁言的的speak_id:"+shyNotspeak.getId());  
48 - notSpeakService.speak(shyNotspeak.getId(), CommonConst.SPEAK_YES, 0, null); 32 + logger.info("自动解除禁言的的speak_id:" + shyNotspeak.getId());
  33 + notSpeakService.speak(shyNotspeak.getId(), CommonConst.SPEAK_YES, 0, null);
49 } 34 }
50 - } 35 + }
51 } 36 }
52 -  
53 -  
54 - 37 +
  38 +
55 } 39 }
src/main/java/com/cnlive/shenhe/job/TopicJob.java
@@ -8,7 +8,6 @@ import org.slf4j.Logger; @@ -8,7 +8,6 @@ import org.slf4j.Logger;
8 import org.slf4j.LoggerFactory; 8 import org.slf4j.LoggerFactory;
9 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.beans.factory.annotation.Value; 10 import org.springframework.beans.factory.annotation.Value;
11 -import org.springframework.scheduling.annotation.Scheduled;  
12 import org.springframework.stereotype.Component; 11 import org.springframework.stereotype.Component;
13 12
14 import java.util.List; 13 import java.util.List;
@@ -36,11 +35,11 @@ public class TopicJob { @@ -36,11 +35,11 @@ public class TopicJob {
36 shyTopic.setShenhe_status(CommonConst.AUDIT_INTT); 35 shyTopic.setShenhe_status(CommonConst.AUDIT_INTT);
37 shyTopic.setShenhe_type(CommonConst.AUDIT_TYPE_USER); 36 shyTopic.setShenhe_type(CommonConst.AUDIT_TYPE_USER);
38 List<ShyTopic> shyTopicList = topicService.findshyTopic(shyTopic); 37 List<ShyTopic> shyTopicList = topicService.findshyTopic(shyTopic);
39 - if(shyTopicList!=null&&shyTopicList.size()>0){  
40 - logger.info("您有"+shyTopicList.size()+"条新的话题审核,请注意查看!"); 38 + if (shyTopicList != null && shyTopicList.size() > 0) {
  39 + logger.info("您有" + shyTopicList.size() + "条新的话题审核,请注意查看!");
41 // 设置Headless模式,linux系统下 40 // 设置Headless模式,linux系统下
42 System.setProperty("java.awt.headless", "true"); 41 System.setProperty("java.awt.headless", "true");
43 - infoUtil.show("新话题审核", "您有"+shyTopicList.size()+"条新的话题审核,请注意查看!",localhost_url+"/topic/page?shenhe_status=0&receive=0"); 42 + infoUtil.show("新话题审核", "您有" + shyTopicList.size() + "条新的话题审核,请注意查看!", localhost_url + "/topic/page?shenhe_status=0&receive=0");
44 } 43 }
45 } 44 }
46 } 45 }
src/main/java/com/cnlive/shenhe/job/UsersSiteJob.java
@@ -115,14 +115,13 @@ public class UsersSiteJob { @@ -115,14 +115,13 @@ public class UsersSiteJob {
115 shySites.setUpdated_at(CommonUtils.getCurrentTime()); 115 shySites.setUpdated_at(CommonUtils.getCurrentTime());
116 shySites.setCreated_at(CommonUtils.getCurrentTime()); 116 shySites.setCreated_at(CommonUtils.getCurrentTime());
117 shySitesMapper.insertSelective(shySites); 117 shySitesMapper.insertSelective(shySites);
118 - }else if(CommonUtils.isNotNull(shySitesList.get(0))){ 118 + } else if (CommonUtils.isNotNull(shySitesList.get(0))) {
119 shySites = shySitesList.get(0); 119 shySites = shySitesList.get(0);
120 shySites.setCompany(company); 120 shySites.setCompany(company);
121 shySites.setName(company_brief); 121 shySites.setName(company_brief);
122 shySites.setUpdated_at(CommonUtils.getCurrentTime()); 122 shySites.setUpdated_at(CommonUtils.getCurrentTime());
123 shySitesMapper.updateByPrimaryKeySelective(shySites); 123 shySitesMapper.updateByPrimaryKeySelective(shySites);
124 } 124 }
125 -  
126 } 125 }
127 } else { 126 } else {
128 logger.error("请求用户云失败,errorCode:{},errorMessage{}", errorCode, result.getString("errorMessage")); 127 logger.error("请求用户云失败,errorCode:{},errorMessage{}", errorCode, result.getString("errorMessage"));
src/main/java/com/cnlive/shenhe/job/VideosJob.java
1 package com.cnlive.shenhe.job; 1 package com.cnlive.shenhe.job;
2 2
3 import com.cnlive.shenhe.entity.ShyVideos; 3 import com.cnlive.shenhe.entity.ShyVideos;
4 -import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl;  
5 -import com.cnlive.shenhe.serviceImpl.SitesServiceImpl;  
6 -import com.cnlive.shenhe.serviceImpl.UsersServiceImpl;  
7 import com.cnlive.shenhe.serviceImpl.VideosServiceImpl; 4 import com.cnlive.shenhe.serviceImpl.VideosServiceImpl;
8 -import com.cnlive.shenhe.utils.AuditPass;  
9 import com.cnlive.shenhe.utils.CommonConst; 5 import com.cnlive.shenhe.utils.CommonConst;
10 -import com.cnlive.shenhe.utils.CommonUtils;  
11 -  
12 import org.slf4j.Logger; 6 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory; 7 import org.slf4j.LoggerFactory;
14 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
@@ -21,75 +15,66 @@ import java.util.List; @@ -21,75 +15,66 @@ import java.util.List;
21 public class VideosJob { 15 public class VideosJob {
22 private static Logger logger = LoggerFactory.getLogger(VideosJob.class); 16 private static Logger logger = LoggerFactory.getLogger(VideosJob.class);
23 @Autowired 17 @Autowired
24 - SitesServiceImpl sitesService;  
25 - @Autowired  
26 - AuditPass Pass;  
27 - @Autowired  
28 - CommentsServiceImpl commentsService;  
29 - @Autowired  
30 - UsersServiceImpl usersService;  
31 - @Autowired  
32 VideosServiceImpl videosService; 18 VideosServiceImpl videosService;
33 19
  20 + /**
  21 + * 白名单sp视频通过
  22 + */
  23 + @Scheduled(fixedRate = 60 * 1000)
  24 + public void updateVideos() {
  25 + ShyVideos shyVideos = new ShyVideos();
  26 + shyVideos.setShenhe_type(CommonConst.AUDIT_TYPE_FREE);// 审核类型为免审
  27 + shyVideos.setState(CommonConst.AUDIT_INTT);// 审核状态为未审核
  28 + List<ShyVideos> shyVideosList = videosService.findshyVideo(shyVideos);
  29 + if (shyVideosList.size() > 0) {
  30 + for (ShyVideos video : shyVideosList) {
  31 + logger.info("当前白名单通过的videos_id:" + video.getId());
  32 + video.setUpdater("白名单");
  33 + // 更新点播和审核的视频状态
  34 + videosService.updateDianboAndShenhe(video, 3);
  35 + }
  36 + }
  37 + }
34 38
35 /** 39 /**
36 - * 白名单sp视频通过  
37 - */  
38 - @Scheduled(fixedRate = 60 * 1000)  
39 - public void updateVideos() {  
40 - ShyVideos shyVideos = new ShyVideos();  
41 - shyVideos.setShenhe_type(CommonConst.AUDIT_TYPE_FREE);// 审核类型为免审  
42 - shyVideos.setState(CommonConst.AUDIT_INTT);// 审核状态为未审核  
43 - List<ShyVideos> shyVideosList = videosService.findshyVideo(shyVideos);  
44 - if (shyVideosList.size() > 0) {  
45 - for (ShyVideos video : shyVideosList) {  
46 - logger.info("当前白名单通过的videos_id:"+video.getId());  
47 - video.setUpdater("白名单");  
48 - // 更新点播和审核的视频状态  
49 - videosService.updateDianboAndShenhe(video, 3);  
50 - }  
51 - }  
52 - } 40 + * 定时向易盾发送视频进行检测
  41 + */
  42 + @Scheduled(cron = "0 0/1 10-23 * * ? ")//每天10点到23点执行,每分钟一次
  43 + public void videofilter() {
  44 + ShyVideos shyVideos = new ShyVideos();
  45 + shyVideos.setShenhe_type(CommonConst.AUDIT_TYPE_MACHANE);//审核类型为机审
  46 + shyVideos.setState(CommonConst.AUDIT_INTT);//待审核状态
  47 + shyVideos.setAvsample(CommonConst.AVSAMPLE_SUCCESS);//抽帧完成
  48 + List<ShyVideos> shyVideosList = videosService.findshyVideo(shyVideos);
  49 + if (shyVideosList != null && shyVideosList.size() > 0) {
  50 + for (ShyVideos video : shyVideosList) {
  51 + logger.info("定时向易盾发送检测视频的videos_id:" + video.getId());
  52 + //易盾图片过滤
  53 + videosService.videoFilter(video.getId());
  54 +
  55 + }
  56 + }
  57 + }
53 58
54 - /**  
55 - * 定时向易盾发送视频进行检测  
56 - */  
57 - @Scheduled(cron = "0 0/1 10-23 * * ? ")//每天10点到23点执行,每分钟一次  
58 - public void videofilter() {  
59 - ShyVideos shyVideos = new ShyVideos();  
60 - shyVideos.setShenhe_type(CommonConst.AUDIT_TYPE_MACHANE);//审核类型为机审  
61 - shyVideos.setState(CommonConst.AUDIT_INTT);//待审核状态  
62 - shyVideos.setAvsample(CommonConst.AVSAMPLE_SUCCESS);//抽帧完成  
63 - List<ShyVideos> shyVideosList = videosService.findshyVideo(shyVideos);  
64 - if (shyVideosList != null && shyVideosList.size() > 0) {  
65 - for (ShyVideos video : shyVideosList) {  
66 - logger.info("定时向易盾发送检测视频的videos_id:" + video.getId());  
67 - //易盾图片过滤  
68 - videosService.videoFilter(video.getId());  
69 59
70 - }  
71 - }  
72 - }  
73 -  
74 -  
75 /** 60 /**
76 * 自动退领 61 * 自动退领
77 */ 62 */
78 - @Scheduled(cron="0 0 0 * * ? ")//每天0点执行 63 + @Scheduled(cron = "0 0 0 * * ? ")//每天0点执行
79 public void autoRetReceive() { 64 public void autoRetReceive() {
80 - logger.info("点播自动退领的进入.....");  
81 - ShyVideos shyVideos = new ShyVideos();  
82 - shyVideos.setState(CommonConst.AUDIT_INTT);//审核状态:未审核  
83 - shyVideos.setReceive(CommonConst.RECEIVE_AFTER);//已领取  
84 - List<ShyVideos> shyVideosList = videosService.findshyVideo(shyVideos);  
85 - if(shyVideosList.size()>0){  
86 - for (ShyVideos shyVideos2 : shyVideosList) {  
87 - logger.info("自动退领的videos_id:"+shyVideos2.getId());  
88 - shyVideos2.setReceive(CommonConst.RECEIVE_BEFORE);//未领取  
89 - shyVideos2.setReceive_user_id(null);  
90 - videosService.updateshyVideos(shyVideos2);  
91 - }  
92 - } 65 + logger.info("点播自动退领的进入.....");
  66 + ShyVideos shyVideos = new ShyVideos();
  67 + shyVideos.setState(CommonConst.AUDIT_INTT);//审核状态:未审核
  68 + shyVideos.setReceive(CommonConst.RECEIVE_AFTER);//已领取
  69 + List<ShyVideos> shyVideosList = videosService.findshyVideo(shyVideos);
  70 + if (shyVideosList.size() > 0) {
  71 + for (ShyVideos shyVideos2 : shyVideosList) {
  72 + logger.info("自动退领的videos_id:" + shyVideos2.getId());
  73 + shyVideos2.setReceive(CommonConst.RECEIVE_BEFORE);//未领取
  74 + shyVideos2.setReceive_user_id(null);
  75 + videosService.updateshyVideos(shyVideos2);
  76 + }
  77 + }
93 } 78 }
94 - 79 +
95 } 80 }
src/main/java/com/cnlive/shenhe/job/YiDunUrlResultJob.java
@@ -89,7 +89,7 @@ public class YiDunUrlResultJob { @@ -89,7 +89,7 @@ public class YiDunUrlResultJob {
89 JSONObject jsonObject = resultJSONArray.getJSONObject(i); 89 JSONObject jsonObject = resultJSONArray.getJSONObject(i);
90 String dataId = jsonObject.getString("dataId"); 90 String dataId = jsonObject.getString("dataId");
91 ShyYidun yiDunMsg = yiDunServiceImpl.getYiDunMsg(dataId); 91 ShyYidun yiDunMsg = yiDunServiceImpl.getYiDunMsg(dataId);
92 - if(yiDunMsg==null){ 92 + if (yiDunMsg == null) {
93 continue; 93 continue;
94 } 94 }
95 newYiDunMsg.setId(yiDunMsg.getId()); 95 newYiDunMsg.setId(yiDunMsg.getId());
@@ -113,26 +113,26 @@ public class YiDunUrlResultJob { @@ -113,26 +113,26 @@ public class YiDunUrlResultJob {
113 JSONObject jsonObject1 = texts.getJSONObject(j); 113 JSONObject jsonObject1 = texts.getJSONObject(j);
114 //检测结果,0:通过,1:嫌疑,2:不通过 114 //检测结果,0:通过,1:嫌疑,2:不通过
115 int action = jsonObject1.getIntValue("action"); 115 int action = jsonObject1.getIntValue("action");
116 - String labelMsg="";  
117 - if(action!=0){ 116 + String labelMsg = "";
  117 + if (action != 0) {
118 JSONArray labels = jsonObject1.getJSONArray("labels"); 118 JSONArray labels = jsonObject1.getJSONArray("labels");
119 - labelMsg="(";  
120 - if(labels!=null&&labels.size()>0){ 119 + labelMsg = "(";
  120 + if (labels != null && labels.size() > 0) {
121 for (Object obj : labels) { 121 for (Object obj : labels) {
122 JSONObject jsonObjectone = (JSONObject) obj; 122 JSONObject jsonObjectone = (JSONObject) obj;
123 Integer label = jsonObjectone.getInteger("label"); 123 Integer label = jsonObjectone.getInteger("label");
124 String name = TextLabels.getName(label); 124 String name = TextLabels.getName(label);
125 - labelMsg=labelMsg+name; 125 + labelMsg = labelMsg + name;
126 126
127 } 127 }
128 } 128 }
129 } 129 }
130 if (action == 1) { 130 if (action == 1) {
131 - desc = desc + "文字嫌疑"+labelMsg+")"; 131 + desc = desc + "文字嫌疑" + labelMsg + ")";
132 break; 132 break;
133 } 133 }
134 if (action == 2) { 134 if (action == 2) {
135 - desc = desc + "文字违规"+labelMsg+")"; 135 + desc = desc + "文字违规" + labelMsg + ")";
136 break; 136 break;
137 } 137 }
138 } 138 }
@@ -143,36 +143,34 @@ public class YiDunUrlResultJob { @@ -143,36 +143,34 @@ public class YiDunUrlResultJob {
143 JSONObject jsonObject1 = images.getJSONObject(k); 143 JSONObject jsonObject1 = images.getJSONObject(k);
144 //0:正常,1:不确定,2:确定 144 //0:正常,1:不确定,2:确定
145 int level = jsonObject1.getIntValue("level"); 145 int level = jsonObject1.getIntValue("level");
146 - String labelMsg="";  
147 - if(level!=0){ 146 + String labelMsg = "";
  147 + if (level != 0) {
148 JSONArray labels = jsonObject1.getJSONArray("labels"); 148 JSONArray labels = jsonObject1.getJSONArray("labels");
149 - labelMsg="(";  
150 - if(labels!=null&&labels.size()>0){ 149 + labelMsg = "(";
  150 + if (labels != null && labels.size() > 0) {
151 for (Object obj : labels) { 151 for (Object obj : labels) {
152 JSONObject jsonObjectone = (JSONObject) obj; 152 JSONObject jsonObjectone = (JSONObject) obj;
153 int labelsLevel = jsonObjectone.getIntValue("level"); 153 int labelsLevel = jsonObjectone.getIntValue("level");
154 //分类级别 0-正常 1-不确定 2-确定 154 //分类级别 0-正常 1-不确定 2-确定
155 - if(labelsLevel!=0){ 155 + if (labelsLevel != 0) {
156 Integer label = jsonObjectone.getInteger("label"); 156 Integer label = jsonObjectone.getInteger("label");
157 String name = ImageLabels.getName(label); 157 String name = ImageLabels.getName(label);
158 - labelMsg=labelMsg+name; 158 + labelMsg = labelMsg + name;
159 } 159 }
160 } 160 }
161 } 161 }
162 162
163 } 163 }
164 if (level == 1) { 164 if (level == 1) {
165 - desc = desc + "第" + (i + 1) + "张图片嫌疑"+labelMsg+")"; 165 + desc = desc + "第" + (i + 1) + "张图片嫌疑" + labelMsg + ")";
166 break; 166 break;
167 } 167 }
168 if (level == 2) { 168 if (level == 2) {
169 - desc = desc + "第" + (i + 1) + "张图片违规"+labelMsg+")"; 169 + desc = desc + "第" + (i + 1) + "张图片违规" + labelMsg + ")";
170 break; 170 break;
171 } 171 }
172 } 172 }
173 } 173 }
174 -  
175 - //审核类型改为人工审核  
176 shyContent.setShenhe_type(CommonConst.AUDIT_TYPE_USER); 174 shyContent.setShenhe_type(CommonConst.AUDIT_TYPE_USER);
177 //拒绝原因 175 //拒绝原因
178 shyContent.setShenhe_msg(desc); 176 shyContent.setShenhe_msg(desc);
src/main/java/com/cnlive/shenhe/jsoup/GetData.java
@@ -21,7 +21,6 @@ public class GetData { @@ -21,7 +21,6 @@ public class GetData {
21 while (true) { 21 while (true) {
22 List<String> jobList = getJobList(document); 22 List<String> jobList = getJobList(document);
23 for (String joburl : jobList) { 23 for (String joburl : jobList) {
24 - System.out.println(joburl);  
25 try { 24 try {
26 new newCrawl().abc(joburl); 25 new newCrawl().abc(joburl);
27 } catch (Exception e) { 26 } catch (Exception e) {
@@ -41,17 +40,17 @@ public class GetData { @@ -41,17 +40,17 @@ public class GetData {
41 * 通过document获取具体的岗位数据 40 * 通过document获取具体的岗位数据
42 */ 41 */
43 private static List<String> getJobList(Document dom) { 42 private static List<String> getJobList(Document dom) {
44 - String URL ="http://www.chinanews.com"; 43 + String URL = "http://www.chinanews.com";
45 ArrayList<String> list = new ArrayList<>(); 44 ArrayList<String> list = new ArrayList<>();
46 Elements select = dom.select(".content_list ul li");//获取到整个列表数据 45 Elements select = dom.select(".content_list ul li");//获取到整个列表数据
47 for (Element element : select) { 46 for (Element element : select) {
48 /* 处理个别li标签是空格问题,直接跳过不处理*/ 47 /* 处理个别li标签是空格问题,直接跳过不处理*/
49 - if (element.attr("id") != "" && !element.attr("id").equals("")){ 48 + if (element.attr("id") != "" && !element.attr("id").equals("")) {
50 continue; 49 continue;
51 } 50 }
52 Elements elementa = element.select(".dd_bt a");//得到带连接的a标签 51 Elements elementa = element.select(".dd_bt a");//得到带连接的a标签
53 String href = elementa.attr("href");//从a标签里面获取到他的相对路径 52 String href = elementa.attr("href");//从a标签里面获取到他的相对路径
54 - href = URL+href; 53 + href = URL + href;
55 // String jobName = select1.text(); 54 // String jobName = select1.text();
56 // Elements select2 = element.select(".t2 a"); 55 // Elements select2 = element.select(".t2 a");
57 // String addr = element.select(".t3").text(); 56 // String addr = element.select(".t3").text();
src/main/java/com/cnlive/shenhe/jsoup/newCrawl.java
1 package com.cnlive.shenhe.jsoup; 1 package com.cnlive.shenhe.jsoup;
2 2
3 -import java.io.IOException;  
4 -import java.net.URL;  
5 -import java.util.LinkedList;  
6 -import java.util.regex.Matcher;  
7 -import java.util.regex.Pattern;  
8 -  
9 import org.jsoup.Jsoup; 3 import org.jsoup.Jsoup;
10 import org.jsoup.nodes.Document; 4 import org.jsoup.nodes.Document;
11 -import org.jsoup.nodes.Element;  
12 import org.jsoup.select.Elements; 5 import org.jsoup.select.Elements;
13 6
  7 +import java.io.IOException;
  8 +import java.net.URL;
  9 +
14 public class newCrawl { 10 public class newCrawl {
15 public void abc(String url) throws Exception { 11 public void abc(String url) throws Exception {
16 newCrawl newCl = new newCrawl(); 12 newCrawl newCl = new newCrawl();