VideosServiceImpl.java
1.99 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
package com.cnlive.shenhe.serviceImpl;
import com.alibaba.fastjson.JSONObject;
import com.cnlive.shenhe.entity.ShySites;
import com.cnlive.shenhe.entity.ShyVideos;
import com.cnlive.shenhe.mapper.ShySitesMapper;
import com.cnlive.shenhe.mapper.ShyVideosMapper;
import com.cnlive.shenhe.utils.CommonConst;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @Auther: chenhao
* @Date: 2018/11/30 14:23
* @Description:
*/
@Service
public class VideosServiceImpl {
@Autowired
ShyVideosMapper shyVideosMapper;
@Autowired
ShySitesMapper shySitesMapper;
public String impotVideo(JSONObject json){
ShySites shySites = new ShySites();
ShyVideos shyVideos = new ShyVideos();
//判断是否白名单
shySites.setSpid(Integer.parseInt(json.getString("spId")));
String write_business = shySitesMapper.select(shySites).get(0).getWrite_business();
if(write_business.isEmpty()){
shyVideos.setState(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 = shyVideosMapper.insert(shyVideos);
if(i>0){
return "\"errorCode\" = 0,\"errorMessage\" = \"点播审核请求收到成功\"";
}else {
return "\"errorCode\" = 0,\"errorMessage\" = \"点播审核请求收到失败\"";
}
}
}