Commit 3c7b09016fdb1d6e07cb3f56a0f42dda3adbb5e9
Merge branch 'dev'
Showing
12 changed files
with
277 additions
and
105 deletions
src/main/java/com/cnlive/shenhe/api/ContentControllerApi.java
| ... | ... | @@ -15,6 +15,7 @@ import org.slf4j.LoggerFactory; |
| 15 | 15 | import org.springframework.beans.factory.annotation.Autowired; |
| 16 | 16 | import org.springframework.stereotype.Controller; |
| 17 | 17 | import org.springframework.web.bind.annotation.PostMapping; |
| 18 | +import org.springframework.web.bind.annotation.RequestBody; | |
| 18 | 19 | import org.springframework.web.bind.annotation.RequestMapping; |
| 19 | 20 | import org.springframework.web.bind.annotation.ResponseBody; |
| 20 | 21 | |
| ... | ... | @@ -39,12 +40,13 @@ public class ContentControllerApi { |
| 39 | 40 | */ |
| 40 | 41 | @PostMapping("/import") |
| 41 | 42 | @ResponseBody |
| 42 | - public ResponseBean impotComment(String param) { | |
| 43 | + public ResponseBean impotContent(String param) { | |
| 43 | 44 | logger.info("图文入库,param=====" + param); |
| 44 | 45 | JSONObject json = JSONObject.parseObject(param); |
| 45 | 46 | //判断是否存在 |
| 46 | 47 | ShyContent shyContent=new ShyContent(); |
| 47 | 48 | shyContent.setContent_id(json.getString("contentId")); |
| 49 | + shyContent.setContent_tag("content");//图文标签 | |
| 48 | 50 | List<ShyContent> contentList = contentService.findshyContent(shyContent); |
| 49 | 51 | //存在则更新 |
| 50 | 52 | if (contentList.size() > 0) { |
| ... | ... | @@ -65,7 +67,7 @@ public class ContentControllerApi { |
| 65 | 67 | shyContent1.setCallback(json.getString("callback"));//回调地址 |
| 66 | 68 | shyContent1.setContent_url(json.getString("contentUrl"));//图文发布的url |
| 67 | 69 | shyContent1.setSp_id(json.getInteger("spId"));//spid |
| 68 | - shyContent1.setContent_tag(json.getString("contentTag"));//图文标签 | |
| 70 | + shyContent1.setContent_tag("content");//图文标签 | |
| 69 | 71 | shyContent1.setReceive_status(CommonConst.RECEIVE_BEFORE);//领取状态 |
| 70 | 72 | shyContent1.setLast_update(CommonUtils.getCurrentTime());//最后一次更新时间 |
| 71 | 73 | |
| ... | ... | @@ -95,7 +97,6 @@ public class ContentControllerApi { |
| 95 | 97 | shyContent.setCallback(json.getString("callback"));//回调地址 |
| 96 | 98 | shyContent.setContent_url(json.getString("contentUrl"));//图文发布的url |
| 97 | 99 | shyContent.setSp_id(json.getInteger("spId"));//spid |
| 98 | - shyContent.setContent_tag(json.getString("contentTag"));//图文标签 | |
| 99 | 100 | shyContent.setReceive_status(CommonConst.RECEIVE_BEFORE);//领取状态 |
| 100 | 101 | shyContent.setLast_update(CommonUtils.getCurrentTime());//最后一次更新时间 |
| 101 | 102 | boolean YorN = contentService.impotContent(shyContent); |
| ... | ... | @@ -105,5 +106,81 @@ public class ContentControllerApi { |
| 105 | 106 | return new ResponseBean(ErrorEnum.ERROR); |
| 106 | 107 | } |
| 107 | 108 | } |
| 109 | + | |
| 110 | + | |
| 111 | + /** | |
| 112 | + * @author liwei | |
| 113 | + * @Date: 2019/05/15 11:17 | |
| 114 | + * @Description: 朋友圈送审接口 | |
| 115 | + */ | |
| 116 | + @PostMapping("/importMoment") | |
| 117 | + @ResponseBody | |
| 118 | + public ResponseBean impotMoment(@RequestBody String param) { | |
| 119 | + logger.info("朋友圈入库,param=====" + param); | |
| 120 | + JSONObject json = JSONObject.parseObject(param); | |
| 121 | + //判断是否存在 | |
| 122 | + ShyContent shyContent=new ShyContent(); | |
| 123 | + shyContent.setContent_id(json.getString("momentId"));//朋友圈id | |
| 124 | + shyContent.setContent_tag("moment");//朋友圈标签 | |
| 125 | + List<ShyContent> contentList = contentService.findshyContent(shyContent); | |
| 126 | + //存在则更新 | |
| 127 | + if (contentList.size() > 0) { | |
| 128 | + ShyContent shyContent1 = contentList.get(0); | |
| 129 | + shyContent1.setTitle(json.getString("title"));//标题 | |
| 130 | + shyContent1.setTitle_image(json.getString("image"));//用户头像 | |
| 131 | + shyContent1.setShenhe_type(CommonConst.AUDIT_TYPE_USER);//审核类型是人工 | |
| 132 | + String contentTime = json.getString("createTime");//朋友圈内容创建时间 | |
| 133 | + if (CommonUtils.isNotEmpty(contentTime)) { | |
| 134 | +// Date timestamp = CommonUtils.getTimestamp(contentTime, "yyyy-MM-dd HH:mm:ss"); | |
| 135 | + shyContent1.setContent_time(new Date(Long.valueOf(contentTime))); | |
| 136 | + | |
| 137 | + } | |
| 138 | + shyContent1.setCreate_date(CommonUtils.getCurrentTime()); | |
| 139 | + shyContent1.setCallback(json.getString("callbackUrl"));//回调地址 | |
| 140 | + shyContent1.setContent_url(json.getString("pageUrl"));//朋友圈分享的url | |
| 141 | + shyContent1.setSp_id(json.getInteger("spId"));//spid | |
| 142 | + shyContent1.setAuthor(json.getString("userId"));//用户id | |
| 143 | + shyContent1.setSource(json.getString("nickName"));//用户昵称 | |
| 144 | + shyContent1.setVideoId(json.getString("videoId"));//关联videoId | |
| 145 | + shyContent1.setContent_tag("moment");//图文标签 | |
| 146 | + shyContent1.setReceive_status(CommonConst.RECEIVE_BEFORE);//领取状态 | |
| 147 | + shyContent1.setLast_update(CommonUtils.getCurrentTime());//最后一次更新时间 | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + boolean YorN = contentService.updateshyContent(shyContent1); | |
| 152 | + if (YorN == true) { | |
| 153 | + return new ResponseBean(ErrorEnum.SUCCESS); | |
| 154 | + } else { | |
| 155 | + return new ResponseBean(ErrorEnum.ERROR); | |
| 156 | + } | |
| 157 | + } | |
| 158 | + //如果不存在直接插入 | |
| 159 | + shyContent.setTitle(json.getString("title"));//标题 | |
| 160 | + shyContent.setTitle_image(json.getString("image"));//用户头像 | |
| 161 | + shyContent.setShenhe_type(CommonConst.AUDIT_TYPE_USER);//审核类型是人工 | |
| 162 | + shyContent.setContent_status(1);//当前朋友圈内容的审核状态,先发后审 | |
| 163 | + String contentTime = json.getString("createTime");//创建时间 | |
| 164 | + if (CommonUtils.isNotEmpty(contentTime)) { | |
| 165 | +// Date timestamp = CommonUtils.getTimestamp(contentTime, "yyyy-MM-dd HH:mm:ss"); | |
| 166 | + shyContent.setContent_time(new Date(Long.valueOf(contentTime))); | |
| 167 | + | |
| 168 | + } | |
| 169 | + shyContent.setCreate_date(CommonUtils.getCurrentTime()); | |
| 170 | + shyContent.setCallback(json.getString("callbackUrl"));//回调地址 | |
| 171 | + shyContent.setContent_url(json.getString("pageUrl"));//朋友圈分享的url | |
| 172 | + shyContent.setSp_id(json.getInteger("spId"));//spid | |
| 173 | + shyContent.setAuthor(json.getString("userId"));//用户id | |
| 174 | + shyContent.setSource(json.getString("nickName"));//用户昵称 | |
| 175 | + shyContent.setVideoId(json.getString("videoId"));//关联videoId | |
| 176 | + shyContent.setReceive_status(CommonConst.RECEIVE_BEFORE);//领取状态 | |
| 177 | + shyContent.setLast_update(CommonUtils.getCurrentTime());//最后一次更新时间 | |
| 178 | + boolean YorN = contentService.impotContent(shyContent); | |
| 179 | + if (YorN == true) { | |
| 180 | + return new ResponseBean(ErrorEnum.SUCCESS); | |
| 181 | + } else { | |
| 182 | + return new ResponseBean(ErrorEnum.ERROR); | |
| 183 | + } | |
| 184 | + } | |
| 108 | 185 | |
| 109 | 186 | } | ... | ... |
src/main/java/com/cnlive/shenhe/controller/ContentController.java
| ... | ... | @@ -163,7 +163,11 @@ public class ContentController { |
| 163 | 163 | public ResponseBean pass(String ids, HttpSession session) { |
| 164 | 164 | SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); |
| 165 | 165 | String userId = sessionUser.getUserId(); |
| 166 | - boolean success = contentService.updateState(ids,"审核通过", CommonConst.AUDIT_SUCCESS, userId); | |
| 166 | + boolean success =false; | |
| 167 | + String[] contentIds = ids.split(","); | |
| 168 | + for (String contentId : contentIds) { | |
| 169 | + success = contentService.callback(contentId,"审核通过", CommonConst.AUDIT_SUCCESS, userId); | |
| 170 | + } | |
| 167 | 171 | if (success) { |
| 168 | 172 | return new ResponseBean(); |
| 169 | 173 | } else { |
| ... | ... | @@ -182,7 +186,11 @@ public class ContentController { |
| 182 | 186 | public ResponseBean refuse(String ids,String msg, HttpSession session) { |
| 183 | 187 | SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); |
| 184 | 188 | String userId = sessionUser.getUserId(); |
| 185 | - boolean success = contentService.updateState(ids,msg, CommonConst.AUDIT_REFUSE, userId); | |
| 189 | + boolean success =false; | |
| 190 | + String[] contentIds = ids.split(","); | |
| 191 | + for (String contentId : contentIds) { | |
| 192 | + success = contentService.callback(contentId,msg, CommonConst.AUDIT_REFUSE, userId); | |
| 193 | + } | |
| 186 | 194 | if (success) { |
| 187 | 195 | return new ResponseBean(); |
| 188 | 196 | } else { | ... | ... |
src/main/java/com/cnlive/shenhe/controller/VideosController.java
| ... | ... | @@ -437,31 +437,7 @@ public class VideosController { |
| 437 | 437 | String[] shyVideoIds = ids.split(","); |
| 438 | 438 | String showMsg = ""; |
| 439 | 439 | for (String shyVideoId : shyVideoIds) { |
| 440 | - ShyVideos shyVideos = videosService.selectByPrimaryKey(Integer.parseInt(shyVideoId)); | |
| 441 | - JSONObject result = null; | |
| 442 | - try { | |
| 443 | - result = Pass.auditPass(shyVideos.getVideo_id(), 4, msg, msg, shyVideos.getCallback()); | |
| 444 | - } catch (Exception e) { | |
| 445 | - logger.error("视频审核失败,id==" + shyVideoId, e); | |
| 446 | - showMsg = showMsg + "," + shyVideos.getVideo_title() + " 拒绝请求失败"; | |
| 447 | - break; | |
| 448 | - } | |
| 449 | - if (result == null) { | |
| 450 | - logger.error("视频审核失败且接口错误没有返回信息,id==" + shyVideoId); | |
| 451 | - showMsg = showMsg + "," + shyVideos.getVideo_title() + " 拒绝请求失败"; | |
| 452 | - break; | |
| 453 | - } | |
| 454 | - Integer code = result.getInteger("code"); | |
| 455 | - if (code != 0) { | |
| 456 | - logger.error("视频审核失败,id:{},code:{}", shyVideoId, code); | |
| 457 | - showMsg = showMsg + "," + shyVideos.getVideo_title() + " " + result.getString("msg"); | |
| 458 | - break; | |
| 459 | - } | |
| 460 | - int i = videosService.updateVideo(Integer.parseInt(shyVideoId), userId,null,"", 2, msg); | |
| 461 | - if (i == 0) { | |
| 462 | - showMsg = showMsg + "," + shyVideos.getVideo_title() + " 更新失败"; | |
| 463 | - break; | |
| 464 | - } | |
| 440 | + showMsg = videosService.repulse(shyVideoId, msg, userId); | |
| 465 | 441 | } |
| 466 | 442 | if (CommonUtils.isNotEmpty(showMsg)) { |
| 467 | 443 | responseBean.setErrorCode(ErrorEnum.ERROR.getErrorCode()); | ... | ... |
src/main/java/com/cnlive/shenhe/entity/ShyComments.java
| ... | ... | @@ -54,7 +54,7 @@ public class ShyComments { |
| 54 | 54 | * 原文链接url |
| 55 | 55 | */ |
| 56 | 56 | private String comment_original_url; |
| 57 | - | |
| 57 | + | |
| 58 | 58 | /** |
| 59 | 59 | * 审核类型,1:免审,2:机审,3:人工审 |
| 60 | 60 | */ |
| ... | ... | @@ -313,6 +313,24 @@ public class ShyComments { |
| 313 | 313 | private String spid_desc; |
| 314 | 314 | |
| 315 | 315 | /** |
| 316 | + * 获取审核类型,1:免审,2:机审,3:人工审 | |
| 317 | + * | |
| 318 | + * @return shenhe_type - 审核类型,1:免审,2:机审,3:人工审 | |
| 319 | + */ | |
| 320 | + public Integer getShenhe_type() { | |
| 321 | + return shenhe_type; | |
| 322 | + } | |
| 323 | + | |
| 324 | + /** | |
| 325 | + * 设置审核类型,1:免审,2:机审,3:人工审 | |
| 326 | + * | |
| 327 | + * @param shenhe_type 审核类型,1:免审,2:机审,3:人工审 | |
| 328 | + */ | |
| 329 | + public void setShenhe_type(Integer shenhe_type) { | |
| 330 | + this.shenhe_type = shenhe_type; | |
| 331 | + } | |
| 332 | + | |
| 333 | + /** | |
| 316 | 334 | * 获取更新者 |
| 317 | 335 | * |
| 318 | 336 | * @return updater - 更新者 |
| ... | ... | @@ -538,14 +556,6 @@ public class ShyComments { |
| 538 | 556 | this.receive_user_id = receive_user_id; |
| 539 | 557 | } |
| 540 | 558 | |
| 541 | - public Integer getShenhe_type() { | |
| 542 | - return shenhe_type; | |
| 543 | - } | |
| 544 | - | |
| 545 | - public void setShenhe_type(Integer shenhe_type) { | |
| 546 | - this.shenhe_type = shenhe_type; | |
| 547 | - } | |
| 548 | - | |
| 549 | 559 | public String getSpid_desc() { |
| 550 | 560 | return spid_desc; |
| 551 | 561 | } |
| ... | ... | @@ -554,5 +564,4 @@ public class ShyComments { |
| 554 | 564 | this.spid_desc = spid_desc; |
| 555 | 565 | } |
| 556 | 566 | |
| 557 | - | |
| 558 | 567 | } |
| 559 | 568 | \ No newline at end of file | ... | ... |
src/main/java/com/cnlive/shenhe/entity/ShyContent.java
| ... | ... | @@ -24,7 +24,7 @@ public class ShyContent { |
| 24 | 24 | private String title; |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | - * 标题图片 | |
| 27 | + * 标题图片(头像) | |
| 28 | 28 | */ |
| 29 | 29 | private String title_image; |
| 30 | 30 | |
| ... | ... | @@ -54,21 +54,27 @@ public class ShyContent { |
| 54 | 54 | private String callback; |
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | - * 来源 | |
| 57 | + * 来源(昵称) | |
| 58 | 58 | */ |
| 59 | 59 | private String source; |
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | - * 作者 | |
| 62 | + * 作者(id) | |
| 63 | 63 | */ |
| 64 | 64 | private String author; |
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | - * 图文创建时间 | |
| 67 | + * 关联的点播id | |
| 68 | + */ | |
| 69 | + private String videoId; | |
| 70 | + | |
| 71 | + /** | |
| 72 | + * 图文的创建时间 | |
| 68 | 73 | */ |
| 69 | 74 | private Date content_time; |
| 75 | + | |
| 70 | 76 | /** |
| 71 | - * 图文送审时间 | |
| 77 | + * 图文审核创建时间 | |
| 72 | 78 | */ |
| 73 | 79 | private Date create_date; |
| 74 | 80 | |
| ... | ... | @@ -172,18 +178,18 @@ public class ShyContent { |
| 172 | 178 | } |
| 173 | 179 | |
| 174 | 180 | /** |
| 175 | - * 获取标题图片 | |
| 181 | + * 获取标题图片(头像) | |
| 176 | 182 | * |
| 177 | - * @return title_image - 标题图片 | |
| 183 | + * @return title_image - 标题图片(头像) | |
| 178 | 184 | */ |
| 179 | 185 | public String getTitle_image() { |
| 180 | 186 | return title_image; |
| 181 | 187 | } |
| 182 | 188 | |
| 183 | 189 | /** |
| 184 | - * 设置标题图片 | |
| 190 | + * 设置标题图片(头像) | |
| 185 | 191 | * |
| 186 | - * @param title_image 标题图片 | |
| 192 | + * @param title_image 标题图片(头像) | |
| 187 | 193 | */ |
| 188 | 194 | public void setTitle_image(String title_image) { |
| 189 | 195 | this.title_image = title_image; |
| ... | ... | @@ -226,18 +232,18 @@ public class ShyContent { |
| 226 | 232 | } |
| 227 | 233 | |
| 228 | 234 | /** |
| 229 | - * 获取内容类型:0:免审,1:机审,2:人工审 | |
| 235 | + * 获取审核类型,1:免审,2:机审,3:人工审 | |
| 230 | 236 | * |
| 231 | - * @return shenhe_type - 内容类型:0:免审,1:机审,2:人工审 | |
| 237 | + * @return shenhe_type - 审核类型,1:免审,2:机审,3:人工审 | |
| 232 | 238 | */ |
| 233 | 239 | public Integer getShenhe_type() { |
| 234 | 240 | return shenhe_type; |
| 235 | 241 | } |
| 236 | 242 | |
| 237 | 243 | /** |
| 238 | - * 设置内容类型:0:免审,1:机审,2:人工审 | |
| 244 | + * 设置审核类型,1:免审,2:机审,3:人工审 | |
| 239 | 245 | * |
| 240 | - * @param shenhe_type 内容类型:0:免审,1:机审,2:人工审 | |
| 246 | + * @param shenhe_type 审核类型,1:免审,2:机审,3:人工审 | |
| 241 | 247 | */ |
| 242 | 248 | public void setShenhe_type(Integer shenhe_type) { |
| 243 | 249 | this.shenhe_type = shenhe_type; |
| ... | ... | @@ -280,54 +286,90 @@ public class ShyContent { |
| 280 | 286 | } |
| 281 | 287 | |
| 282 | 288 | /** |
| 283 | - * 获取来源 | |
| 289 | + * 获取来源(昵称) | |
| 284 | 290 | * |
| 285 | - * @return source - 来源 | |
| 291 | + * @return source - 来源(昵称) | |
| 286 | 292 | */ |
| 287 | 293 | public String getSource() { |
| 288 | 294 | return source; |
| 289 | 295 | } |
| 290 | 296 | |
| 291 | 297 | /** |
| 292 | - * 设置来源 | |
| 298 | + * 设置来源(昵称) | |
| 293 | 299 | * |
| 294 | - * @param source 来源 | |
| 300 | + * @param source 来源(昵称) | |
| 295 | 301 | */ |
| 296 | 302 | public void setSource(String source) { |
| 297 | 303 | this.source = source; |
| 298 | 304 | } |
| 299 | 305 | |
| 300 | 306 | /** |
| 301 | - * 获取作者 | |
| 307 | + * 获取作者(id) | |
| 302 | 308 | * |
| 303 | - * @return author - 作者 | |
| 309 | + * @return author - 作者(id) | |
| 304 | 310 | */ |
| 305 | 311 | public String getAuthor() { |
| 306 | 312 | return author; |
| 307 | 313 | } |
| 308 | 314 | |
| 309 | 315 | /** |
| 310 | - * 设置作者 | |
| 316 | + * 设置作者(id) | |
| 311 | 317 | * |
| 312 | - * @param author 作者 | |
| 318 | + * @param author 作者(id) | |
| 313 | 319 | */ |
| 314 | 320 | public void setAuthor(String author) { |
| 315 | 321 | this.author = author; |
| 316 | 322 | } |
| 317 | 323 | |
| 318 | 324 | /** |
| 319 | - * 获取创建时间 | |
| 325 | + * 获取关联的点播id | |
| 326 | + * | |
| 327 | + * @return videoId - 关联的点播id | |
| 328 | + */ | |
| 329 | + public String getVideoId() { | |
| 330 | + return videoId; | |
| 331 | + } | |
| 332 | + | |
| 333 | + /** | |
| 334 | + * 设置关联的点播id | |
| 335 | + * | |
| 336 | + * @param videoId 关联的点播id | |
| 337 | + */ | |
| 338 | + public void setVideoId(String videoId) { | |
| 339 | + this.videoId = videoId; | |
| 340 | + } | |
| 341 | + | |
| 342 | + /** | |
| 343 | + * 获取图文的创建时间 | |
| 320 | 344 | * |
| 321 | - * @return create_date - 创建时间 | |
| 345 | + * @return content_time - 图文的创建时间 | |
| 346 | + */ | |
| 347 | + public Date getContent_time() { | |
| 348 | + return content_time; | |
| 349 | + } | |
| 350 | + | |
| 351 | + /** | |
| 352 | + * 设置图文的创建时间 | |
| 353 | + * | |
| 354 | + * @param content_time 图文的创建时间 | |
| 355 | + */ | |
| 356 | + public void setContent_time(Date content_time) { | |
| 357 | + this.content_time = content_time; | |
| 358 | + } | |
| 359 | + | |
| 360 | + /** | |
| 361 | + * 获取图文审核创建时间 | |
| 362 | + * | |
| 363 | + * @return create_date - 图文审核创建时间 | |
| 322 | 364 | */ |
| 323 | 365 | public Date getCreate_date() { |
| 324 | 366 | return create_date; |
| 325 | 367 | } |
| 326 | 368 | |
| 327 | 369 | /** |
| 328 | - * 设置创建时间 | |
| 370 | + * 设置图文审核创建时间 | |
| 329 | 371 | * |
| 330 | - * @param create_date 创建时间 | |
| 372 | + * @param create_date 图文审核创建时间 | |
| 331 | 373 | */ |
| 332 | 374 | public void setCreate_date(Date create_date) { |
| 333 | 375 | this.create_date = create_date; |
| ... | ... | @@ -431,13 +473,4 @@ public class ShyContent { |
| 431 | 473 | this.sp_desc = sp_desc; |
| 432 | 474 | } |
| 433 | 475 | |
| 434 | - public Date getContent_time() { | |
| 435 | - return content_time; | |
| 436 | - } | |
| 437 | - | |
| 438 | - public void setContent_time(Date content_time) { | |
| 439 | - this.content_time = content_time; | |
| 440 | - } | |
| 441 | - | |
| 442 | - | |
| 443 | 476 | } |
| 444 | 477 | \ No newline at end of file | ... | ... |
src/main/java/com/cnlive/shenhe/entity/ShyLive.java
| ... | ... | @@ -425,18 +425,18 @@ public class ShyLive { |
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | /** |
| 428 | - * 获取状态 1:未认领 2.已认领,3:已审核 | |
| 428 | + * 获取状态 0:未认领 1.已认领,2:已审核 | |
| 429 | 429 | * |
| 430 | - * @return shenhe_state - 状态 1:未认领 2.已认领,3:已审核 | |
| 430 | + * @return shenhe_state - 状态 0:未认领 1.已认领,2:已审核 | |
| 431 | 431 | */ |
| 432 | 432 | public Integer getShenhe_state() { |
| 433 | 433 | return shenhe_state; |
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | /** |
| 437 | - * 设置状态 1:未认领 2.已认领,3:已审核 | |
| 437 | + * 设置状态 0:未认领 1.已认领,2:已审核 | |
| 438 | 438 | * |
| 439 | - * @param shenhe_state 状态 1:未认领 2.已认领,3:已审核 | |
| 439 | + * @param shenhe_state 状态 0:未认领 1.已认领,2:已审核 | |
| 440 | 440 | */ |
| 441 | 441 | public void setShenhe_state(Integer shenhe_state) { |
| 442 | 442 | this.shenhe_state = shenhe_state; | ... | ... |
src/main/java/com/cnlive/shenhe/entity/ShyVideos.java
| ... | ... | @@ -53,6 +53,7 @@ public class ShyVideos { |
| 53 | 53 | * 常用审核意见 |
| 54 | 54 | */ |
| 55 | 55 | private String attr_tags; |
| 56 | + | |
| 56 | 57 | /** |
| 57 | 58 | * 拒绝理由 |
| 58 | 59 | */ |
| ... | ... | @@ -332,6 +333,24 @@ public class ShyVideos { |
| 332 | 333 | } |
| 333 | 334 | |
| 334 | 335 | /** |
| 336 | + * 获取常用审核意见 | |
| 337 | + * | |
| 338 | + * @return attr_tags - 常用审核意见 | |
| 339 | + */ | |
| 340 | + public String getAttr_tags() { | |
| 341 | + return attr_tags; | |
| 342 | + } | |
| 343 | + | |
| 344 | + /** | |
| 345 | + * 设置常用审核意见 | |
| 346 | + * | |
| 347 | + * @param attr_tags 常用审核意见 | |
| 348 | + */ | |
| 349 | + public void setAttr_tags(String attr_tags) { | |
| 350 | + this.attr_tags = attr_tags; | |
| 351 | + } | |
| 352 | + | |
| 353 | + /** | |
| 335 | 354 | * 获取拒绝理由 |
| 336 | 355 | * |
| 337 | 356 | * @return msg - 拒绝理由 |
| ... | ... | @@ -690,14 +709,4 @@ public class ShyVideos { |
| 690 | 709 | public void setSpid_desc(String spid_desc) { |
| 691 | 710 | this.spid_desc = spid_desc; |
| 692 | 711 | } |
| 693 | - | |
| 694 | - public String getAttr_tags() { | |
| 695 | - return attr_tags; | |
| 696 | - } | |
| 697 | - | |
| 698 | - public void setAttr_tags(String attr_tags) { | |
| 699 | - this.attr_tags = attr_tags; | |
| 700 | - } | |
| 701 | - | |
| 702 | - | |
| 703 | 712 | } |
| 704 | 713 | \ No newline at end of file | ... | ... |
src/main/java/com/cnlive/shenhe/job/ContentJob.java
| ... | ... | @@ -50,7 +50,7 @@ public class ContentJob { |
| 50 | 50 | logger.info("当前白名单通过的content_id:"+content.getId()); |
| 51 | 51 | content.setUpdater("白名单"); |
| 52 | 52 | // 更新点播和审核的视频状态 |
| 53 | - contentService.updateState(content.getId()+"","白名单审核通过", 1,""); | |
| 53 | + contentService.callback(content.getId()+"","白名单审核通过", 1,""); | |
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | } | ... | ... |
src/main/java/com/cnlive/shenhe/serviceImpl/ContentServiceImpl.java
| ... | ... | @@ -49,6 +49,8 @@ public class ContentServiceImpl { |
| 49 | 49 | AuditPass Pass; |
| 50 | 50 | @Autowired |
| 51 | 51 | SitesServiceImpl sitesService; |
| 52 | + @Autowired | |
| 53 | + VideosServiceImpl videosService; | |
| 52 | 54 | |
| 53 | 55 | public List<ShySites> getBusiness(ShySites shySites) { |
| 54 | 56 | List<ShySites> sitesList = shySitesMapper.select(shySites); |
| ... | ... | @@ -187,38 +189,52 @@ public class ContentServiceImpl { |
| 187 | 189 | } |
| 188 | 190 | |
| 189 | 191 | //********************** |
| 190 | - public boolean updateState(String ids, String msg, Integer state, String userId) { | |
| 191 | - boolean success = true; | |
| 192 | - String[] contentIds = ids.split(","); | |
| 193 | - for (String contentId : contentIds) { | |
| 192 | + public boolean callback(String contentId, String msg, Integer state, String userId) { | |
| 193 | + boolean success = true; | |
| 194 | 194 | ShyContent content = shyContentMapper.selectByPrimaryKey(Integer.parseInt(contentId)); |
| 195 | 195 | JSONObject result = new JSONObject(); |
| 196 | -// String type = "fabu";// 1、fabu,2、xiaxian,3、shanchu | |
| 197 | -// if (state == 2) { | |
| 198 | -// type = "xiaxian"; | |
| 199 | -// } else if (state == 3) { | |
| 200 | -// type = "shanchu"; | |
| 201 | -// } | |
| 202 | 196 | try { |
| 203 | - result = Pass.contentPass(content.getContent_id(), state+"", msg, content.getCallback()); | |
| 197 | + if(CommonUtils.isNotEmpty(content.getContent_tag())&&content.getContent_tag().equals("content")){ | |
| 198 | + result = Pass.contentPass(content.getContent_id(), state+"", msg, content.getCallback()); | |
| 199 | + }else if(CommonUtils.isNotEmpty(content.getContent_tag())&&content.getContent_tag().equals("moment")){ | |
| 200 | + result = Pass.momentPass(content.getContent_id(), state, msg, content.getCallback(),content.getAuthor()); | |
| 201 | + } | |
| 204 | 202 | } catch (Exception e) { |
| 205 | 203 | logger.error("图文审核回调失败,图文id:{}", content.getId()); |
| 206 | 204 | success = false; |
| 207 | - break; | |
| 205 | + return success; | |
| 208 | 206 | } |
| 209 | 207 | if (result == null) { |
| 210 | 208 | logger.error("图文回调错误,且无返回信息。图文id:{}", content.getId()); |
| 211 | 209 | success = false; |
| 212 | - break; | |
| 210 | + return success; | |
| 213 | 211 | } else { |
| 214 | 212 | Integer code = result.getInteger("errorCode"); |
| 215 | -// msg=CommonUtils.isNotEmpty(msg)?msg+",图文回调结果:"+result.getString("errorMessage"):"图文回调结果:"+result.getString("errorMessage"); | |
| 216 | 213 | if (code != 0) { |
| 217 | 214 | logger.error("图文回调错误,图文id:{},errorCode:{},errorMessage:{}", content.getId(), code, |
| 218 | 215 | result.getString("errorMessage")); |
| 219 | 216 | success = false; |
| 220 | - break; | |
| 217 | + return success; | |
| 218 | + } | |
| 219 | + | |
| 220 | + //如果当前图文是朋友圈的视频,通知点播云 | |
| 221 | + if(CommonUtils.isNotEmpty(content.getContent_tag()) | |
| 222 | + &&content.getContent_tag().equals("moment") | |
| 223 | + &&CommonUtils.isNotEmpty(content.getVideoId()) | |
| 224 | + &&state==CommonConst.AUDIT_REFUSE){ | |
| 225 | + ShyVideos shyVideos1 = new ShyVideos(); | |
| 226 | + shyVideos1.setVideo_id(content.getVideoId()); | |
| 227 | + List<ShyVideos> listshyVideos = videosService.findshyVideo(shyVideos1); | |
| 228 | + if (listshyVideos.size() > 0) { | |
| 229 | + ShyVideos shyVideos = listshyVideos.get(0); | |
| 230 | + String showMsg = videosService.repulse(shyVideos.getId().toString(), msg, userId); | |
| 231 | + if (CommonUtils.isNotEmpty(showMsg)) { | |
| 232 | + success = false; | |
| 233 | + return success; | |
| 234 | + } | |
| 235 | + } | |
| 221 | 236 | } |
| 237 | + | |
| 222 | 238 | content.setContent_status(state);// 设置图文状态为审核后的状态 |
| 223 | 239 | content.setReceive_status(CommonConst.RECEIVE_AUDIT);// 领取状态为已审核 |
| 224 | 240 | content.setShenhe_msg(msg);// 设置审核消息 |
| ... | ... | @@ -233,7 +249,6 @@ public class ContentServiceImpl { |
| 233 | 249 | } |
| 234 | 250 | } |
| 235 | 251 | |
| 236 | - } | |
| 237 | 252 | return success; |
| 238 | 253 | } |
| 239 | 254 | ... | ... |
src/main/java/com/cnlive/shenhe/serviceImpl/VideosServiceImpl.java
| ... | ... | @@ -431,5 +431,37 @@ public class VideosServiceImpl { |
| 431 | 431 | } |
| 432 | 432 | shyVideo.setShenhe_type(shenheType); |
| 433 | 433 | } |
| 434 | + | |
| 435 | + | |
| 436 | + public String repulse(String shyVideoId,String msg,String userId){ | |
| 437 | + String showMsg=""; | |
| 438 | + ShyVideos shyVideos = videosService.selectByPrimaryKey(Integer.parseInt(shyVideoId)); | |
| 439 | + JSONObject result = null; | |
| 440 | + try { | |
| 441 | + result = Pass.auditPass(shyVideos.getVideo_id(), 4, msg, msg, shyVideos.getCallback()); | |
| 442 | + } catch (Exception e) { | |
| 443 | + logger.error("视频审核失败,id==" + shyVideoId, e); | |
| 444 | + showMsg = showMsg + "," + shyVideos.getVideo_title() + " 拒绝请求失败"; | |
| 445 | + return showMsg; | |
| 446 | + } | |
| 447 | + if (result == null) { | |
| 448 | + logger.error("视频审核失败且接口错误没有返回信息,id==" + shyVideoId); | |
| 449 | + showMsg = showMsg + "," + shyVideos.getVideo_title() + " 拒绝请求失败"; | |
| 450 | + return showMsg; | |
| 451 | + } | |
| 452 | + Integer code = result.getInteger("code"); | |
| 453 | + if (code != 0) { | |
| 454 | + logger.error("视频审核失败,id:{},code:{}", shyVideoId, code); | |
| 455 | + showMsg = showMsg + "," + shyVideos.getVideo_title() + " " + result.getString("msg"); | |
| 456 | + return showMsg; | |
| 457 | + } | |
| 458 | + int i = videosService.updateVideo(Integer.parseInt(shyVideoId), userId,null,"", 2, msg); | |
| 459 | + if (i == 0) { | |
| 460 | + showMsg = showMsg + "," + shyVideos.getVideo_title() + " 更新失败"; | |
| 461 | + return showMsg; | |
| 462 | + } | |
| 463 | + | |
| 464 | + return showMsg; | |
| 465 | + } | |
| 434 | 466 | |
| 435 | 467 | } | ... | ... |
src/main/java/com/cnlive/shenhe/utils/AuditPass.java
| ... | ... | @@ -107,4 +107,16 @@ public class AuditPass { |
| 107 | 107 | Map<String, String> post = httpUtil.post(URL); |
| 108 | 108 | return JSONObject.parseObject(post.get("result")); |
| 109 | 109 | } |
| 110 | + public JSONObject momentPass(String content_id, Integer state, String msg, String callback, String userId) { | |
| 111 | + logger.info("朋友圈回调:content_id:{},state:{},msg:{},userId:{}", content_id, state, msg,userId); | |
| 112 | + JSONObject json=new JSONObject(); | |
| 113 | + json.put("userId",userId ); | |
| 114 | + json.put("momentId",content_id ); | |
| 115 | + json.put("status",state ); | |
| 116 | + json.put("msg", msg); | |
| 117 | + String httpUtilResult = HttpClientUtils.HttpPostWithJson(callback, json.toString()); | |
| 118 | + logger.info("朋友圈返回数据,httpUtilResult=====" + httpUtilResult); | |
| 119 | + JSONObject result = JSONObject.parseObject(httpUtilResult); | |
| 120 | + return result; | |
| 121 | + } | |
| 110 | 122 | } | ... | ... |
src/main/resources/mapper/ShyContentMapper.xml
| ... | ... | @@ -17,6 +17,7 @@ |
| 17 | 17 | <result column="callback" jdbcType="VARCHAR" property="callback" /> |
| 18 | 18 | <result column="source" jdbcType="VARCHAR" property="source" /> |
| 19 | 19 | <result column="author" jdbcType="VARCHAR" property="author" /> |
| 20 | + <result column="videoId" jdbcType="VARCHAR" property="videoId" /> | |
| 20 | 21 | <result column="content_time" jdbcType="TIMESTAMP" property="content_time" /> |
| 21 | 22 | <result column="create_date" jdbcType="TIMESTAMP" property="create_date" /> |
| 22 | 23 | <result column="last_update" jdbcType="TIMESTAMP" property="last_update" /> | ... | ... |