Commit 30aff1b1dc8454fa63625f59d752d0b913db6968

Authored by 周伟鹏
2 parents 6dcf9db4 543bc3d2

Merge branch 'dev'

src/main/java/com/cnlive/shenhe/api/VideosControllerApi.java
... ... @@ -72,6 +72,8 @@ public class VideosControllerApi {
72 72 //g得到视频id去查询是否已有
73 73 String videoId = json.getString("videoId");
74 74 shyVideos1.setVideo_id(videoId);
  75 + Integer duration = json.getInteger("duration");
  76 + if (CommonUtils.isNotNull(duration)) duration = duration / 1000;
75 77 //查询一下 存在,更新 没有,插入
76 78 List<ShyVideos> listshyVideos = videosService.findshyVideo(shyVideos1);
77 79 if (listshyVideos.size() > 0) {
... ... @@ -96,6 +98,7 @@ public class VideosControllerApi {
96 98 shyVideos.setState(CommonConst.AUDIT_INTT);
97 99 shyVideos.setBucket(json.getString("bucketName"));
98 100 shyVideos.setPlat(json.getInteger("bucketType"));
  101 + shyVideos.setDuration(duration);
99 102 boolean YorN = videosService.updateshyVideos(shyVideos);
100 103 if (YorN == true) {
101 104 return new ResponseBean(ErrorEnum.SUCCESS);
... ... @@ -110,6 +113,10 @@ public class VideosControllerApi {
110 113 shyVideos1.setVideo_imgs(videoCoverUrl);
111 114 if (CommonUtils.isNotEmpty(videoCoverUrl)) {
112 115 String poster = json.getJSONObject("videoCoverUrl").getString("224*126");
  116 + if (CommonUtils.isEmpty(poster)) {
  117 + //ugc短视频只有一张图片
  118 + poster = json.getJSONObject("videoCoverUrl").getString("key");
  119 + }
113 120 shyVideos1.setVideo_poster(poster);
114 121 }
115 122 shyVideos1.setVideo_desc(json.getString("videoIntro"));
... ... @@ -122,7 +129,10 @@ public class VideosControllerApi {
122 129 shyVideos1.setState(CommonConst.AUDIT_INTT);
123 130 shyVideos1.setBucket(json.getString("bucketName"));
124 131 shyVideos1.setPlat(json.getInteger("bucketType"));
125   - shyVideos1 = avsample(shyVideos1);//请求抽帧
  132 + shyVideos1.setDuration(duration);
  133 + if (CommonUtils.isNotNull(duration) && duration > 80) {
  134 + shyVideos1 = avsample(shyVideos1);//视频至少可以抽8张,请求抽帧
  135 + }
126 136 boolean result = videosService.impotVideo(shyVideos1);
127 137 if (result == true) {
128 138 return new ResponseBean(ErrorEnum.SUCCESS);
... ... @@ -147,13 +157,14 @@ public class VideosControllerApi {
147 157  
148 158 String path = video_url.replace("//", "");
149 159 path = path.substring(path.indexOf("/"), path.length());
150   - String domian = video_url.replace(path,"");
  160 + String domian = video_url.replace(path, "");
151 161 path = "/" + bucket + path;
152 162  
153 163 JSONObject attach = new JSONObject();
154 164 JSONObject extParam = new JSONObject();
155   - attach.put("num", 24);
156   - extParam.put("domain",domian);
  165 + attach.put("interval", 10);
  166 + attach.put("strategy", 1);
  167 + extParam.put("domain", domian);
157 168 if (CommonConst.KS_PLAT == plat) {
158 169 //金山
159 170 params.put("plat", 0);
... ... @@ -185,7 +196,7 @@ public class VideosControllerApi {
185 196 httpUtil.setParamMap(dataMap);
186 197 Map<String, String> resultMap = httpUtil.post(url);
187 198 JSONObject result = JSON.parseObject(resultMap.get("result"));
188   - logger.info("请求抽帧结果:result:{}",result);
  199 + logger.info("请求抽帧结果:result:{}", result);
189 200 Integer code = result.getInteger("code");
190 201 if (code == 0) {
191 202 video.setAvsample(CommonConst.AVSAMPLE_ING);
... ...
src/main/java/com/cnlive/shenhe/entity/ShyVideos.java
1 1 package com.cnlive.shenhe.entity;
2 2  
3   -import javax.persistence.Id;
4   -import javax.persistence.Table;
5   -import javax.persistence.Transient;
6 3 import java.util.Date;
  4 +import javax.persistence.*;
7 5  
8 6 @Table(name = "shy_videos")
9 7 public class ShyVideos {
... ... @@ -126,8 +124,10 @@ public class ShyVideos {
126 124 private Integer plat;
127 125  
128 126 /**
129   - * 审核员
  127 + * 视频时长,单位s
130 128 */
  129 + private Integer duration;
  130 +
131 131 @Transient
132 132 private String auditor;
133 133  
... ... @@ -600,4 +600,22 @@ public class ShyVideos {
600 600 public void setPlat(Integer plat) {
601 601 this.plat = plat;
602 602 }
  603 +
  604 + /**
  605 + * 获取视频时长,单位s
  606 + *
  607 + * @return duration - 视频时长,单位s
  608 + */
  609 + public Integer getDuration() {
  610 + return duration;
  611 + }
  612 +
  613 + /**
  614 + * 设置视频时长,单位s
  615 + *
  616 + * @param duration 视频时长,单位s
  617 + */
  618 + public void setDuration(Integer duration) {
  619 + this.duration = duration;
  620 + }
603 621 }
604 622 \ No newline at end of file
... ...
src/main/java/com/cnlive/shenhe/job/UsersSiteJob.java
... ... @@ -71,7 +71,7 @@ public class UsersSiteJob {
71 71 //用户信息入库
72 72 JSONObject user = data.getJSONObject(i);
73 73 Integer id = user.getInteger("sid");
74   - String user_id = CommonUtils.md5(id+"");
  74 + String user_id = CommonUtils.md5(id + "");
75 75 String email = user.getString("email");
76 76 Integer spid = user.getInteger("new_sp_id");
77 77 String userLogo = user.getString("userLogo");
... ... @@ -108,10 +108,15 @@ public class UsersSiteJob {
108 108 ShySites shySites = new ShySites();
109 109 shySites.setSpid(spid);
110 110 List<ShySites> shySitesList = shySitesMapper.select(shySites);
111   - if(shySitesList.isEmpty()){
  111 + if (shySitesList.isEmpty()) {
112 112 shySites.setCompany(company);
113 113 shySites.setName(company_brief);
114 114 shySitesMapper.insertSelective(shySites);
  115 + }else if(CommonUtils.isEmpty(shySitesList.get(0).getCompany()) || CommonUtils.isEmpty(shySitesList.get(0).getName())){
  116 + shySites = shySitesList.get(0);
  117 + shySites.setCompany(company);
  118 + shySites.setName(company_brief);
  119 + shySitesMapper.updateByPrimaryKeySelective(shySites);
115 120 }
116 121  
117 122 }
... ...
src/main/resources/mapper/ShyVideosMapper.xml
... ... @@ -32,5 +32,6 @@
32 32 <result column="task_id" jdbcType="VARCHAR" property="task_id" />
33 33 <result column="bucket" jdbcType="VARCHAR" property="bucket" />
34 34 <result column="plat" jdbcType="INTEGER" property="plat" />
  35 + <result column="duration" jdbcType="INTEGER" property="duration" />
35 36 </resultMap>
36 37 </mapper>
37 38 \ No newline at end of file
... ...