VideosController.java
4.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
package com.cnlive.shenhe.controller;
import com.alibaba.fastjson.JSONObject;
import com.cnlive.shenhe.bean.ErrorEnum;
import com.cnlive.shenhe.bean.ResponseBean;
import com.cnlive.shenhe.bean.SessionUser;
import com.cnlive.shenhe.entity.ShySites;
import com.cnlive.shenhe.entity.ShyVideos;
import com.cnlive.shenhe.serviceImpl.VideosServiceImpl;
import com.cnlive.shenhe.utils.AuditPass;
import com.cnlive.shenhe.utils.CommonConst;
import com.cnlive.shenhe.utils.CommonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpSession;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
* @Auther: chenhao
* @Date: 2018/11/30 14:22
* @Description:视频送审接口
*/
@Controller
@RequestMapping("/videos")
public class VideosController {
@Autowired
AuditPass Pass;
@Autowired
VideosServiceImpl videosService;
/**
* 视频送审接口
* @param json
* @return
*/
@PostMapping("/import")
@ResponseBody
public ResponseBean impotVideo(@RequestBody JSONObject json){
ShySites shySites = new ShySites();
ShyVideos shyVideos = new ShyVideos();
shyVideos.setState(CommonConst.AUDIT_INTT);
//判断是否白名单
shySites.setSpid(json.getInteger("spId"));
List<ShySites> shySitesList = videosService.getBusiness(shySites);
if(!shySitesList.isEmpty()){
if(CommonUtils.isNotEmpty(shySitesList.get(0).getWrite_business())){
String write_business = shySitesList.get(0).getWrite_business();
String[] business = write_business.split(",");
List<String> asList = Arrays.asList(business);
if(asList.contains(CommonConst.BUSINESS_VIDEO+"")){
shyVideos.setState(CommonConst.AUDIT_SUCCESS);
Pass.auditPass(json.getString("videoId"),CommonConst.AUDIT_SUCCESS,"","");
}else {
shyVideos.setState(CommonConst.AUDIT_INTT);
}
}
}
//封装数据入库
shyVideos.setVideo_id(json.getString("videoId"));
shyVideos.setVideo_title(json.getString("videoTitle"));
shyVideos.setVideo_url(json.getString("videoUrl"));
shyVideos.setVideo_imgs(json.getString("videoCoverUrl"));
shyVideos.setVideo_desc(json.getString("videoIntro"));
shyVideos.setVideo_keyword(json.getString("videoKeyword"));
shyVideos.setVideo_priority(json.getString("priority"));
shyVideos.setCallback(json.getString("callback"));
shyVideos.setSpid(Integer.parseInt(json.getString("spId")));
int i = videosService.impotVideo(shyVideos);
if(i>0){
return new ResponseBean(ErrorEnum.SUCCESS);
}else {
return new ResponseBean(ErrorEnum.ERROR);
}
}
/**
* 审核信息返回接口
* @param activity_id 视频id
* @param state 状态码
* @param attr_tags 标签
* @param msg 备注信息
* @return
*/
@RequestMapping("/shenheVideo")
@ResponseBody
public ResponseBean shenheInfo(String activity_id,int state,String attr_tags,String msg){
String code = Pass.auditPass(activity_id, state, attr_tags, msg);
// if(code.equals("-1")){
// return new ResponseBean(ErrorEnum.ERROR);
// }
int i = videosService.updateVideo(activity_id, state, attr_tags, msg);
if(i==0){
return new ResponseBean(ErrorEnum.ERROR);
}
return new ResponseBean(ErrorEnum.SUCCESS);
}
/**
* 内容分页列表接口
* @param video_title
* @param start_date
* @param end_date
* @param state
* @param page
* @param pageSize
* @param orderByClause
* @return
*/
@RequestMapping("/page")
@ResponseBody
public Object getListVideos(String video_title, String start_date, String end_date, Integer state, Integer page, Integer pageSize, String orderByClause, HttpSession session){
SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey());
Integer spid = sessionUser.getSpid();
if(CommonUtils.isNull(page))page=1;
if(CommonUtils.isNull(pageSize))pageSize=10;
if(CommonUtils.isNotNull(spid)&&spid==0){spid=82;}
return videosService.getListContent(video_title,start_date,end_date,state,page,pageSize,orderByClause,spid);
}
/**
* 内容详情页接口(查看)
* @param id
* @return
*/
@RequestMapping("/details")
@ResponseBody
public Object getDetailsVideo(Integer id){
return videosService.getDetailsContent(id);
}
}