Commit 7c4f49982399e38c7dcbc7d16d364cf3c92559f0

Authored by 周伟鹏
1 parent 1c2cfab6

update

src/main/java/com/cnlive/shenhe/controller/VideosController.java
... ... @@ -2,6 +2,8 @@ package com.cnlive.shenhe.controller;
2 2  
3 3 import com.alibaba.fastjson.JSON;
4 4 import com.alibaba.fastjson.JSONObject;
  5 +import com.cnlive.shenhe.bean.ErrorEnum;
  6 +import com.cnlive.shenhe.bean.ResponseBean;
5 7 import com.cnlive.shenhe.entity.ShySites;
6 8 import com.cnlive.shenhe.entity.ShyVideos;
7 9 import com.cnlive.shenhe.serviceImpl.VideosServiceImpl;
... ... @@ -14,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
14 16  
15 17 import java.io.UnsupportedEncodingException;
16 18 import java.security.NoSuchAlgorithmException;
  19 +import java.util.Arrays;
17 20 import java.util.HashMap;
18 21 import java.util.List;
19 22 import java.util.Map;
... ... @@ -30,20 +33,26 @@ public class VideosController {
30 33 VideosServiceImpl videosService;
31 34 @PostMapping("/import")
32 35 @ResponseBody
33   - public String impotVideo(@RequestBody JSONObject json){
  36 + public ResponseBean impotVideo(@RequestBody JSONObject json){
34 37 ShySites shySites = new ShySites();
35 38 ShyVideos shyVideos = new ShyVideos();
  39 + shyVideos.setState(CommonConst.AUDIT_INTT);
36 40 //判断是否白名单
37   - shySites.setSpid(Integer.parseInt(json.getString("spId")));
  41 + shySites.setSpid(json.getInteger("spId"));
38 42 List<ShySites> shySitesList = videosService.getBusiness(shySites);
39 43 if(!shySitesList.isEmpty()){
40 44 if(!shySitesList.get(0).getWrite_business().isEmpty()){
41   - shyVideos.setState(CommonConst.AUDIT_SUCCESS);
42   - }else {
43   - shyVideos.setState(CommonConst.AUDIT_INTT);
  45 + String write_business = shySitesList.get(0).getWrite_business();
  46 + String[] business = write_business.split(",");
  47 + List<String> asList = Arrays.asList(business);
  48 + if(asList.contains(CommonConst.BUSINESS_VIDEO+"")){
  49 + shyVideos.setState(CommonConst.AUDIT_SUCCESS);
  50 + getInfo("",0,"","");
  51 +
  52 + }
44 53 }
45 54 }else {
46   - return "没有此站点";
  55 + return new ResponseBean(ErrorEnum.PARAM_ERROR);
47 56 }
48 57 //封装数据入库
49 58 shyVideos.setVideo_id(json.getString("videoId"));
... ... @@ -57,11 +66,12 @@ public class VideosController {
57 66 shyVideos.setSpid(Integer.parseInt(json.getString("spId")));
58 67 int i = videosService.impotVideo(shyVideos);
59 68 if(i>0){
60   - return "\"errorCode\" = 0,\"errorMessage\" = \"点播审核请求收到成功\"";
  69 + return new ResponseBean();
61 70 }else {
62   - return "\"errorCode\" = 0,\"errorMessage\" = \"点播审核请求收到失败\"";
  71 + return new ResponseBean(ErrorEnum.ERROR);
63 72 }
64 73 }
  74 +
65 75 public String getInfo(String activity_id,int state,String attr_tags,String msg){
66 76 String url ="http://mam.innerapi.cnlive.com/v1/inner/ShenHeInfo/shenheNotify";
67 77 String platformKey ="AUDIT";
... ...
src/main/java/com/cnlive/shenhe/utils/CommonConst.java
... ... @@ -29,4 +29,14 @@ public class CommonConst {
29 29 */
30 30 public static Integer USER_STATUS_FORBID = 2;
31 31  
  32 +
  33 + /**
  34 + * 白名单业务:点播
  35 + */
  36 + public static Integer BUSINESS_VIDEO = 1;
  37 + /**
  38 + * 白名单业务:评论
  39 + */
  40 + public static Integer BUSINESS_COMMENT = 2;
  41 +
32 42 }
... ...