Commit 992cd27ab91bc7940201d48023738e63fecac878

Authored by 陈浩
1 parent 89b48934

update

... ... @@ -93,10 +93,13 @@
93 93 <dependency>
94 94 <groupId>org.apache.httpcomponents</groupId>
95 95 <artifactId>httpclient</artifactId>
  96 + <version>4.5.3</version>
96 97 </dependency>
97 98 <dependency>
98 99 <groupId>org.apache.httpcomponents</groupId>
99 100 <artifactId>httpmime</artifactId>
  101 + <version>4.5.3</version>
  102 +
100 103 </dependency>
101 104 </dependencies>
102 105  
... ...
src/main/java/com/cnlive/shenhe/controller/VideosController.java 0 → 100644
  1 +package com.cnlive.shenhe.controller;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.cnlive.shenhe.entity.ShyVideos;
  5 +import com.cnlive.shenhe.serviceImpl.VideosServiceImpl;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Controller;
  8 +import org.springframework.web.bind.annotation.*;
  9 +/**
  10 + * @Auther: chenhao
  11 + * @Date: 2018/11/30 14:22
  12 + * @Description:视频送审接口
  13 + */
  14 +@Controller
  15 +@RequestMapping("/videos")
  16 +public class VideosController {
  17 + @Autowired
  18 + VideosServiceImpl videosServiceImpl;
  19 + @PostMapping("/import")
  20 + @ResponseBody
  21 + public String impotVideo(@RequestBody JSONObject json){
  22 +
  23 +
  24 + return videosServiceImpl.impotVideo(json);
  25 + }
  26 +}
... ...
src/main/java/com/cnlive/shenhe/entity/ShyVideos.java
... ... @@ -55,7 +55,7 @@ public class ShyVideos {
55 55 /**
56 56 * 状态:0.未审核,1:已审核,2.拒绝
57 57 */
58   - private Boolean state;
  58 + private Integer state;
59 59  
60 60 /**
61 61 * 上传时间
... ... @@ -272,7 +272,7 @@ public class ShyVideos {
272 272 *
273 273 * @return state - 状态:0.未审核,1:已审核,2.拒绝
274 274 */
275   - public Boolean getState() {
  275 + public Integer getState() {
276 276 return state;
277 277 }
278 278  
... ... @@ -281,7 +281,7 @@ public class ShyVideos {
281 281 *
282 282 * @param state 状态:0.未审核,1:已审核,2.拒绝
283 283 */
284   - public void setState(Boolean state) {
  284 + public void setState(Integer state) {
285 285 this.state = state;
286 286 }
287 287  
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/VideosServiceImpl.java 0 → 100644
  1 +package com.cnlive.shenhe.serviceImpl;
  2 +import com.alibaba.fastjson.JSONObject;
  3 +import com.cnlive.shenhe.entity.ShySites;
  4 +import com.cnlive.shenhe.entity.ShyVideos;
  5 +import com.cnlive.shenhe.mapper.ShySitesMapper;
  6 +import com.cnlive.shenhe.mapper.ShyVideosMapper;
  7 +import com.cnlive.shenhe.utils.CommonConst;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.stereotype.Service;
  10 +
  11 +/**
  12 + * @Auther: chenhao
  13 + * @Date: 2018/11/30 14:23
  14 + * @Description:
  15 + */
  16 +@Service
  17 +public class VideosServiceImpl {
  18 + @Autowired
  19 + ShyVideosMapper shyVideosMapper;
  20 + @Autowired
  21 + ShySitesMapper shySitesMapper;
  22 + public String impotVideo(JSONObject json){
  23 + ShySites shySites = new ShySites();
  24 + ShyVideos shyVideos = new ShyVideos();
  25 + //判断是否白名单
  26 + shySites.setSpid(Integer.parseInt(json.getString("spId")));
  27 + String write_business = shySitesMapper.select(shySites).get(0).getWrite_business();
  28 + if(write_business.isEmpty()){
  29 + shyVideos.setState(CommonConst.AUDIT_SUCCESS);
  30 + }else {
  31 + shyVideos.setState(CommonConst.AUDIT_INTT);
  32 + }
  33 + //封装数据入库
  34 + shyVideos.setVideo_id(json.getString("videoId"));
  35 + shyVideos.setVideo_title(json.getString("videoTitle"));
  36 + shyVideos.setVideo_url(json.getString("videoUrl"));
  37 + shyVideos.setVideo_imgs(json.getString("videoCoverUrl"));
  38 + shyVideos.setVideo_desc(json.getString("videoIntro"));
  39 + shyVideos.setVideo_keyword(json.getString("videoKeyword"));
  40 + shyVideos.setVideo_priority(json.getString("priority"));
  41 + shyVideos.setCallback(json.getString("callback"));
  42 + shyVideos.setSpid(Integer.parseInt(json.getString("spId")));
  43 + int i = shyVideosMapper.insert(shyVideos);
  44 + if(i>0){
  45 + return "\"errorCode\" = 0,\"errorMessage\" = \"点播审核请求收到成功\"";
  46 + }else {
  47 + return "\"errorCode\" = 0,\"errorMessage\" = \"点播审核请求收到失败\"";
  48 + }
  49 + }
  50 +}
... ...
src/main/resources/mapper/ShyVideosMapper.xml
... ... @@ -16,7 +16,7 @@
16 16 <result column="callback" jdbcType="VARCHAR" property="callback" />
17 17 <result column="video_priority" jdbcType="VARCHAR" property="video_priority" />
18 18 <result column="msg" jdbcType="VARCHAR" property="msg" />
19   - <result column="state" jdbcType="BIT" property="state" />
  19 + <result column="state" jdbcType="INTEGER" property="state" />
20 20 <result column="video_upload_time" jdbcType="TIMESTAMP" property="video_upload_time" />
21 21 <result column="video_keyword" jdbcType="VARCHAR" property="video_keyword" />
22 22 <result column="video_desc" jdbcType="VARCHAR" property="video_desc" />
... ...