Commit 927348ba8e921233a6e9aeb6f93b9457a13bce07
1 parent
1af077ce
评论审核自动退领
Showing
3 changed files
with
32 additions
and
7 deletions
src/main/java/com/cnlive/shenhe/job/CommentsJob.java
| @@ -3,6 +3,7 @@ package com.cnlive.shenhe.job; | @@ -3,6 +3,7 @@ package com.cnlive.shenhe.job; | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | import com.cnlive.shenhe.entity.ShyComments; | 4 | import com.cnlive.shenhe.entity.ShyComments; |
| 5 | import com.cnlive.shenhe.entity.ShySites; | 5 | import com.cnlive.shenhe.entity.ShySites; |
| 6 | +import com.cnlive.shenhe.entity.ShyVideos; | ||
| 6 | import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl; | 7 | import com.cnlive.shenhe.serviceImpl.CommentsServiceImpl; |
| 7 | import com.cnlive.shenhe.serviceImpl.SitesServiceImpl; | 8 | import com.cnlive.shenhe.serviceImpl.SitesServiceImpl; |
| 8 | import com.cnlive.shenhe.serviceImpl.UsersServiceImpl; | 9 | import com.cnlive.shenhe.serviceImpl.UsersServiceImpl; |
| @@ -82,4 +83,26 @@ public class CommentsJob { | @@ -82,4 +83,26 @@ public class CommentsJob { | ||
| 82 | } | 83 | } |
| 83 | } | 84 | } |
| 84 | } | 85 | } |
| 86 | + | ||
| 87 | + /** | ||
| 88 | + * 自动退领 | ||
| 89 | + */ | ||
| 90 | + @Scheduled(cron="0 0 0 * * ? ")//每天0点执行 | ||
| 91 | + public void autoRetReceive() { | ||
| 92 | + ShyComments shyComments = new ShyComments(); | ||
| 93 | + shyComments.setState(CommonConst.AUDIT_INTT);//审核状态:未审核 | ||
| 94 | + shyComments.setReceive(CommonConst.RECEIVE_AFTER);//已领取 | ||
| 95 | + List<ShyComments> commentsList = commentsService.findshyComments(shyComments); | ||
| 96 | + if (commentsList.size() > 0) { | ||
| 97 | + for (ShyComments comments : commentsList) { | ||
| 98 | + logger.info("自动退领的comments_id:"+comments.getId()); | ||
| 99 | + comments.setReceive(CommonConst.RECEIVE_BEFORE);//未领取 | ||
| 100 | + comments.setReceive_user_id(null); | ||
| 101 | + commentsService.updateshyComments1(comments); | ||
| 102 | + } | ||
| 103 | + } | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + | ||
| 107 | + | ||
| 85 | } | 108 | } |
src/main/java/com/cnlive/shenhe/job/VideosJob.java
| @@ -88,12 +88,14 @@ public class VideosJob { | @@ -88,12 +88,14 @@ public class VideosJob { | ||
| 88 | shyVideos.setState(CommonConst.AUDIT_INTT);//审核状态:未审核 | 88 | shyVideos.setState(CommonConst.AUDIT_INTT);//审核状态:未审核 |
| 89 | shyVideos.setReceive(CommonConst.RECEIVE_AFTER);//已领取 | 89 | shyVideos.setReceive(CommonConst.RECEIVE_AFTER);//已领取 |
| 90 | List<ShyVideos> shyVideosList = videosService.findshyVideo(shyVideos); | 90 | List<ShyVideos> shyVideosList = videosService.findshyVideo(shyVideos); |
| 91 | - for (ShyVideos shyVideos2 : shyVideosList) { | ||
| 92 | - logger.info("自动退领的videos_id:"+shyVideos2.getId()); | ||
| 93 | - shyVideos2.setReceive(CommonConst.RECEIVE_BEFORE);//未领取 | ||
| 94 | - shyVideos2.setReceive_user_id(null); | ||
| 95 | - videosService.updateshyVideos(shyVideos2); | ||
| 96 | - } | 91 | + if(shyVideosList.size()>0){ |
| 92 | + for (ShyVideos shyVideos2 : shyVideosList) { | ||
| 93 | + logger.info("自动退领的videos_id:"+shyVideos2.getId()); | ||
| 94 | + shyVideos2.setReceive(CommonConst.RECEIVE_BEFORE);//未领取 | ||
| 95 | + shyVideos2.setReceive_user_id(null); | ||
| 96 | + videosService.updateshyVideos(shyVideos2); | ||
| 97 | + } | ||
| 98 | + } | ||
| 97 | } | 99 | } |
| 98 | 100 | ||
| 99 | } | 101 | } |
src/main/java/com/cnlive/shenhe/serviceImpl/CommentsServiceImpl.java
| @@ -53,7 +53,7 @@ public class CommentsServiceImpl { | @@ -53,7 +53,7 @@ public class CommentsServiceImpl { | ||
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | public boolean updateshyComments1(ShyComments shyComments) { | 55 | public boolean updateshyComments1(ShyComments shyComments) { |
| 56 | - int result = shyCommentsMapper.updateByPrimaryKeySelective(shyComments); | 56 | + int result = shyCommentsMapper.updateByPrimaryKey(shyComments); |
| 57 | if (result == 0) { | 57 | if (result == 0) { |
| 58 | return false; | 58 | return false; |
| 59 | } | 59 | } |