Commit b68137041dcc7155f6354b647a572180d79f286b

Authored by liwei2917
1 parent f89387f4

自动退领

src/main/java/com/cnlive/shenhe/controller/VideosController.java
... ... @@ -70,7 +70,7 @@ public class VideosController {
70 70 SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
71 71 String userId = sessionUser.getUserId();
72 72 ShyVideos shyVideos = videosService.selectByPrimaryKey(id);
73   - if (shyVideos.getReceive() && CommonUtils.isNotEmpty(shyVideos.getReceive_user_id()) && userId.equals(shyVideos.getReceive_user_id())) {
  73 +// if (shyVideos.getReceive() && CommonUtils.isNotEmpty(shyVideos.getReceive_user_id()) && userId.equals(shyVideos.getReceive_user_id())) {
74 74 JSONObject result = null;
75 75 try {
76 76 result = Pass.auditPass(activity_id, state, attr_tags, msg, callback);
... ... @@ -94,9 +94,9 @@ public class VideosController {
94 94 return new ResponseBean(ErrorEnum.ERROR);
95 95 }
96 96 return new ResponseBean(ErrorEnum.SUCCESS);
97   - }
98   - logger.error("领取逻辑不符,不能审核,Video_id:{}", shyVideos.getVideo_id());
99   - return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "领取逻辑不符,不能审核");
  97 +// }
  98 +// logger.error("领取逻辑不符,不能审核,Video_id:{}", shyVideos.getVideo_id());
  99 +// return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "领取逻辑不符,不能审核");
100 100 }
101 101  
102 102 /**
... ... @@ -223,6 +223,12 @@ public class VideosController {
223 223 }
224 224  
225 225  
  226 + /**
  227 + * 退领
  228 + * @param ids
  229 + * @param session
  230 + * @return
  231 + */
226 232 @PostMapping("/retReceive")
227 233 @ResponseBody
228 234 public ResponseBean retReceive(String ids, HttpSession session) {
... ...
src/main/java/com/cnlive/shenhe/job/VideosJob.java
... ... @@ -56,7 +56,7 @@ public class VideosJob {
56 56 /**
57 57 * 定时发送数美检测视频
58 58 */
59   - @Scheduled(fixedRate = 60 * 1000)
  59 + @Scheduled(cron="0 0/1 7-23 * * ? *")//每天7点到23点执行,每分钟一次
60 60 public void videofilter() {
61 61 ShyVideos shyVideos = new ShyVideos();
62 62 shyVideos.setCategory(CommonConst.CATEGORY_WITNESS);//目击者
... ... @@ -75,4 +75,22 @@ public class VideosJob {
75 75 }
76 76 }
77 77 }
  78 +
  79 +
  80 + /**
  81 + * 自动退领
  82 + */
  83 + @Scheduled(cron="0 0 0 * * ? ")//每天0点执行
  84 + public void autoRetReceive() {
  85 + ShyVideos shyVideos = new ShyVideos();
  86 + shyVideos.setState(CommonConst.AUDIT_INTT);//审核状态:未审核
  87 + shyVideos.setReceive(CommonConst.RECEIVE_AFTER);//已领取
  88 + List<ShyVideos> shyVideosList = videosService.findshyVideo(shyVideos);
  89 + for (ShyVideos shyVideos2 : shyVideosList) {
  90 + shyVideos2.setReceive(CommonConst.RECEIVE_BEFORE);//未领取
  91 + shyVideos2.setReceive_user_id(null);
  92 + videosService.updateshyVideos(shyVideos2);
  93 + }
  94 + }
  95 +
78 96 }
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/VideosServiceImpl.java
... ... @@ -86,7 +86,7 @@ public class VideosServiceImpl {
86 86 }
87 87  
88 88 public boolean updateshyVideos(ShyVideos shyVideos) {
89   - int i = shyVideosMapper.updateByPrimaryKeySelective(shyVideos);
  89 + int i = shyVideosMapper.updateByPrimaryKey(shyVideos);
90 90 if (i == 0) {
91 91 return false;
92 92 }
... ... @@ -99,7 +99,7 @@ public class VideosServiceImpl {
99 99 shyVideos.setState(state);
100 100 shyVideos.setMsg(msg);
101 101 shyVideos.setUpdater(updater);
102   - return shyVideosMapper.updateByPrimaryKeySelective(shyVideos);
  102 + return shyVideosMapper.updateByPrimaryKey(shyVideos);
103 103 }
104 104  
105 105 public PageInfo<ShyVideos> getListContent(String video_title, String start_date, String end_date, Integer state, Boolean receive, Integer page, Integer pageSize, String video_priority, String orderByClause, Integer spid, String userId) {
... ... @@ -209,7 +209,7 @@ public class VideosServiceImpl {
209 209 if (shyVideos.getState() == CommonConst.AUDIT_INTT && shyVideos.getReceive() && shyVideos.getReceive_user_id().equals(userId)) {
210 210 shyVideos.setReceive(CommonConst.RECEIVE_BEFORE);
211 211 shyVideos.setReceive_user_id(null);
212   - int i = shyVideosMapper.updateByPrimaryKeySelective(shyVideos);
  212 + int i = shyVideosMapper.updateByPrimaryKey(shyVideos);
213 213 if (i != 1) {
214 214 return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "退领失败,请重试");
215 215 }
... ...