Commit 79c54a3f55283af94ff4d94e4fa39ee2ab68af24
1 parent
49306b4e
音频数据退领功能
Showing
3 changed files
with
54 additions
and
1 deletions
src/main/java/com/cnlive/shenhe/controller/AudioController.java
| @@ -133,6 +133,14 @@ public class AudioController extends BaseController { | @@ -133,6 +133,14 @@ public class AudioController extends BaseController { | ||
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | 135 | ||
| 136 | + /** | ||
| 137 | + * 认领 | ||
| 138 | + * | ||
| 139 | + * @param ids | ||
| 140 | + * @param num | ||
| 141 | + * @param session | ||
| 142 | + * @return | ||
| 143 | + */ | ||
| 136 | @PostMapping("/receive") | 144 | @PostMapping("/receive") |
| 137 | @ResponseBody | 145 | @ResponseBody |
| 138 | public ResponseBean receive(String ids, Integer num, HttpSession session) { | 146 | public ResponseBean receive(String ids, Integer num, HttpSession session) { |
| @@ -157,4 +165,28 @@ public class AudioController extends BaseController { | @@ -157,4 +165,28 @@ public class AudioController extends BaseController { | ||
| 157 | Integer n = audioService.receive(ids, num, userId, spid); | 165 | Integer n = audioService.receive(ids, num, userId, spid); |
| 158 | return new ResponseBean(ErrorEnum.SUCCESS.getErrorCode(), "认领到" + n + "条内容"); | 166 | return new ResponseBean(ErrorEnum.SUCCESS.getErrorCode(), "认领到" + n + "条内容"); |
| 159 | } | 167 | } |
| 168 | + | ||
| 169 | + | ||
| 170 | + /** | ||
| 171 | + * 退领 | ||
| 172 | + * | ||
| 173 | + * @param ids | ||
| 174 | + * @param session | ||
| 175 | + * @return | ||
| 176 | + */ | ||
| 177 | + @PostMapping("/retReceive") | ||
| 178 | + @ResponseBody | ||
| 179 | + public ResponseBean retReceive(String ids, HttpSession session) { | ||
| 180 | + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); | ||
| 181 | + String userId = sessionUser.getUserId(); | ||
| 182 | + //在退领操作前先判断是否包含已退领或者已经审核的数据,有则退回检查并重新退领 | ||
| 183 | + String[] cids = ids.split(","); | ||
| 184 | + for (String cid : cids) { | ||
| 185 | + ShyAudio shyAudio = audioService.selectByPrimaryKey(Integer.parseInt(cid)); | ||
| 186 | + if (shyAudio.getState() != CommonConst.AUDIT_INTT || shyAudio.getReceive()==CommonConst.RECEIVE_BEFORE || !shyAudio.getReceive_user_id().equals(userId)) { | ||
| 187 | + return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "退领失败,您选中的内容包含已退领的或已经审核的"); | ||
| 188 | + } | ||
| 189 | + } | ||
| 190 | + return audioService.retReceive(ids, userId); | ||
| 191 | + } | ||
| 160 | } | 192 | } |
src/main/java/com/cnlive/shenhe/serviceImpl/AudioServiceImpl.java
| 1 | package com.cnlive.shenhe.serviceImpl; | 1 | package com.cnlive.shenhe.serviceImpl; |
| 2 | 2 | ||
| 3 | +import com.cnlive.shenhe.bean.ErrorEnum; | ||
| 4 | +import com.cnlive.shenhe.bean.ResponseBean; | ||
| 3 | import com.cnlive.shenhe.entity.ShyAudio; | 5 | import com.cnlive.shenhe.entity.ShyAudio; |
| 4 | import com.cnlive.shenhe.entity.ShyVideos; | 6 | import com.cnlive.shenhe.entity.ShyVideos; |
| 5 | import com.cnlive.shenhe.mapper.ShyAudioMapper; | 7 | import com.cnlive.shenhe.mapper.ShyAudioMapper; |
| @@ -40,6 +42,7 @@ public class AudioServiceImpl { | @@ -40,6 +42,7 @@ public class AudioServiceImpl { | ||
| 40 | return shyAudio; | 42 | return shyAudio; |
| 41 | } | 43 | } |
| 42 | 44 | ||
| 45 | + //认领 | ||
| 43 | public Integer receive(String ids, Integer num, String userId, Integer spid) { | 46 | public Integer receive(String ids, Integer num, String userId, Integer spid) { |
| 44 | Integer n = 0; | 47 | Integer n = 0; |
| 45 | if (CommonUtils.isNotEmpty(ids)) { | 48 | if (CommonUtils.isNotEmpty(ids)) { |
| @@ -72,6 +75,25 @@ public class AudioServiceImpl { | @@ -72,6 +75,25 @@ public class AudioServiceImpl { | ||
| 72 | return n; | 75 | return n; |
| 73 | } | 76 | } |
| 74 | 77 | ||
| 78 | + //退领 | ||
| 79 | + public ResponseBean retReceive(String ids, String userId) { | ||
| 80 | + String[] cids = ids.split(","); | ||
| 81 | + for (String cid : cids) { | ||
| 82 | + ShyAudio shyAudio = shyAudioMapper.selectByPrimaryKey(Integer.parseInt(cid)); | ||
| 83 | + if (shyAudio.getState() == CommonConst.AUDIT_INTT && shyAudio.getReceive()==CommonConst.RECEIVE_AFTER && shyAudio.getReceive_user_id().equals(userId)) { | ||
| 84 | + shyAudio.setReceive(CommonConst.RECEIVE_BEFORE); | ||
| 85 | + shyAudio.setReceive_user_id(null); | ||
| 86 | + int i = shyAudioMapper.updateByPrimaryKey(shyAudio); | ||
| 87 | + if (i != 1) { | ||
| 88 | + return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "退领失败,请重试"); | ||
| 89 | + } | ||
| 90 | + } else { | ||
| 91 | + return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "退领失败,您选中的内容包含已退领的或已经审核的"); | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | + return new ResponseBean(ErrorEnum.SUCCESS.getErrorCode(), "已退领"); | ||
| 95 | + } | ||
| 96 | + | ||
| 75 | //分页查询音频数据 | 97 | //分页查询音频数据 |
| 76 | public PageInfo<ShyAudio> getListContent(String video_title, String start_date, String end_date, Integer state, Integer receive, Integer page, Integer pageSize, String video_priority, String orderByClause, Integer spid, String userId, String sp_Id) { | 98 | public PageInfo<ShyAudio> getListContent(String video_title, String start_date, String end_date, Integer state, Integer receive, Integer page, Integer pageSize, String video_priority, String orderByClause, Integer spid, String userId, String sp_Id) { |
| 77 | Example example = new Example(ShyAudio.class); | 99 | Example example = new Example(ShyAudio.class); |
src/main/java/com/cnlive/shenhe/serviceImpl/VideosServiceImpl.java
| @@ -233,7 +233,6 @@ public class VideosServiceImpl { | @@ -233,7 +233,6 @@ public class VideosServiceImpl { | ||
| 233 | } | 233 | } |
| 234 | 234 | ||
| 235 | public ResponseBean retReceive(String ids, String userId) { | 235 | public ResponseBean retReceive(String ids, String userId) { |
| 236 | - boolean result = true; | ||
| 237 | String[] cids = ids.split(","); | 236 | String[] cids = ids.split(","); |
| 238 | for (String cid : cids) { | 237 | for (String cid : cids) { |
| 239 | ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(Integer.parseInt(cid)); | 238 | ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(Integer.parseInt(cid)); |