Authored by mali

转码

1 package com.yohoufo.dal.order; 1 package com.yohoufo.dal.order;
2 2
  3 +import com.yohoufo.dal.order.model.QiniuLiveRecord;
3 import org.apache.ibatis.annotations.Param; 4 import org.apache.ibatis.annotations.Param;
4 5
  6 +
5 /** 7 /**
6 * Created by li.ma on 2018/12/14. 8 * Created by li.ma on 2018/12/14.
7 */ 9 */
8 public interface QiniuLiveRecordMapper { 10 public interface QiniuLiveRecordMapper {
9 int updateStatusByPersistId(@Param("persistId")String persistId, @Param("status")Integer status); 11 int updateStatusByPersistId(@Param("persistId")String persistId, @Param("status")Integer status);
  12 +
  13 + QiniuLiveRecord selectByOrderCodes(@Param("orderCode")Integer orderCode);
10 } 14 }
@@ -10,6 +10,35 @@ public class QiniuLiveRecord { @@ -10,6 +10,35 @@ public class QiniuLiveRecord {
10 10
11 private Integer status; 11 private Integer status;
12 12
  13 + private Integer id;
  14 +
  15 + private Long orderCode;
  16 +
  17 + private Integer skup;
  18 +
  19 + private Long sellerOrderCode;
  20 +
  21 + private Integer depotNo;
  22 +
  23 + private Integer startTime;
  24 +
  25 + private Integer endTime;
  26 +
  27 + private String vedioFileUrl;
  28 +
  29 + private Integer createTime;
  30 +
  31 + private Integer updateTime;
  32 +
  33 + private Integer storageId;
  34 +
  35 + private Integer goodsId;
  36 +
  37 + private Integer productId;
  38 +
  39 + private Integer showFlag;
  40 +
  41 +
13 public String getPersistId() { 42 public String getPersistId() {
14 return persistId; 43 return persistId;
15 } 44 }
@@ -26,6 +55,118 @@ public class QiniuLiveRecord { @@ -26,6 +55,118 @@ public class QiniuLiveRecord {
26 this.status = status; 55 this.status = status;
27 } 56 }
28 57
  58 + public Integer getId() {
  59 + return id;
  60 + }
  61 +
  62 + public void setId(Integer id) {
  63 + this.id = id;
  64 + }
  65 +
  66 + public Long getOrderCode() {
  67 + return orderCode;
  68 + }
  69 +
  70 + public void setOrderCode(Long orderCode) {
  71 + this.orderCode = orderCode;
  72 + }
  73 +
  74 + public Integer getSkup() {
  75 + return skup;
  76 + }
  77 +
  78 + public void setSkup(Integer skup) {
  79 + this.skup = skup;
  80 + }
  81 +
  82 + public Long getSellerOrderCode() {
  83 + return sellerOrderCode;
  84 + }
  85 +
  86 + public void setSellerOrderCode(Long sellerOrderCode) {
  87 + this.sellerOrderCode = sellerOrderCode;
  88 + }
  89 +
  90 + public Integer getDepotNo() {
  91 + return depotNo;
  92 + }
  93 +
  94 + public void setDepotNo(Integer depotNo) {
  95 + this.depotNo = depotNo;
  96 + }
  97 +
  98 + public Integer getStartTime() {
  99 + return startTime;
  100 + }
  101 +
  102 + public void setStartTime(Integer startTime) {
  103 + this.startTime = startTime;
  104 + }
  105 +
  106 + public Integer getEndTime() {
  107 + return endTime;
  108 + }
  109 +
  110 + public void setEndTime(Integer endTime) {
  111 + this.endTime = endTime;
  112 + }
  113 +
  114 + public String getVedioFileUrl() {
  115 + return vedioFileUrl;
  116 + }
  117 +
  118 + public void setVedioFileUrl(String vedioFileUrl) {
  119 + this.vedioFileUrl = vedioFileUrl;
  120 + }
  121 +
  122 + public Integer getCreateTime() {
  123 + return createTime;
  124 + }
  125 +
  126 + public void setCreateTime(Integer createTime) {
  127 + this.createTime = createTime;
  128 + }
  129 +
  130 + public Integer getUpdateTime() {
  131 + return updateTime;
  132 + }
  133 +
  134 + public void setUpdateTime(Integer updateTime) {
  135 + this.updateTime = updateTime;
  136 + }
  137 +
  138 + public Integer getStorageId() {
  139 + return storageId;
  140 + }
  141 +
  142 + public void setStorageId(Integer storageId) {
  143 + this.storageId = storageId;
  144 + }
  145 +
  146 + public Integer getGoodsId() {
  147 + return goodsId;
  148 + }
  149 +
  150 + public void setGoodsId(Integer goodsId) {
  151 + this.goodsId = goodsId;
  152 + }
  153 +
  154 + public Integer getProductId() {
  155 + return productId;
  156 + }
  157 +
  158 + public void setProductId(Integer productId) {
  159 + this.productId = productId;
  160 + }
  161 +
  162 + public Integer getShowFlag() {
  163 + return showFlag;
  164 + }
  165 +
  166 + public void setShowFlag(Integer showFlag) {
  167 + this.showFlag = showFlag;
  168 + }
  169 +
29 @Override 170 @Override
30 public String toString() { 171 public String toString() {
31 return JSONObject.toJSONString(this); 172 return JSONObject.toJSONString(this);
@@ -13,7 +13,6 @@ @@ -13,7 +13,6 @@
13 <result column="vedio_file_url" property="vedioFileUrl" jdbcType="VARCHAR" /> 13 <result column="vedio_file_url" property="vedioFileUrl" jdbcType="VARCHAR" />
14 <result column="create_time" property="createTime" jdbcType="INTEGER" /> 14 <result column="create_time" property="createTime" jdbcType="INTEGER" />
15 <result column="update_time" property="updateTime" jdbcType="INTEGER" /> 15 <result column="update_time" property="updateTime" jdbcType="INTEGER" />
16 - <result column="pid" property="pid" jdbcType="INTEGER" />  
17 <result column="status" property="status" jdbcType="INTEGER" /> 16 <result column="status" property="status" jdbcType="INTEGER" />
18 <result column="storage_id" property="storageId" jdbcType="INTEGER" /> 17 <result column="storage_id" property="storageId" jdbcType="INTEGER" />
19 <result column="goods_id" property="goodsId" jdbcType="INTEGER" /> 18 <result column="goods_id" property="goodsId" jdbcType="INTEGER" />
@@ -21,16 +20,14 @@ @@ -21,16 +20,14 @@
21 </resultMap> 20 </resultMap>
22 <sql id="Base_Column_List" > 21 <sql id="Base_Column_List" >
23 id, order_code, skup, seller_order_code, depot_no, start_time, end_time, persistId, 22 id, order_code, skup, seller_order_code, depot_no, start_time, end_time, persistId,
24 - vedio_file_url, create_time, update_time, pid, status, storage_id, goods_id, product_id 23 + vedio_file_url, create_time, update_time, status, storage_id, goods_id, product_id
25 </sql> 24 </sql>
26 <select id="selectByOrderCodes" resultMap="BaseResultMap" parameterType="java.lang.Integer" > 25 <select id="selectByOrderCodes" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
27 select 26 select
28 <include refid="Base_Column_List" /> 27 <include refid="Base_Column_List" />
29 from qiniu_live_record 28 from qiniu_live_record
30 - where order_code in  
31 - <foreach collection="orderCodes" open="(" close=")" separator="," item="orderCode">  
32 - #{orderCode,jdbcType=BIGINT}  
33 - </foreach> 29 + where order_code = #{orderCode, jdbcType=BIGINT}
  30 + and show_flag = 1 and status = 1 order by id DESC limit 1
34 </select> 31 </select>
35 32
36 <update id="updateStatusByPersistId"> 33 <update id="updateStatusByPersistId">
1 package com.yohoufo.order.service.impl; 1 package com.yohoufo.order.service.impl;
2 2
  3 +import com.google.common.collect.Lists;
3 import com.yohoufo.dal.order.QiniuLiveRecordMapper; 4 import com.yohoufo.dal.order.QiniuLiveRecordMapper;
  5 +import com.yohoufo.dal.order.model.QiniuLiveRecord;
  6 +import org.apache.commons.lang3.StringUtils;
4 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
5 import org.springframework.stereotype.Service; 8 import org.springframework.stereotype.Service;
6 9
  10 +import java.util.List;
  11 +
7 /** 12 /**
8 * Created by li.ma on 2018/12/14. 13 * Created by li.ma on 2018/12/14.
9 */ 14 */
10 @Service 15 @Service
11 public class QiniuLiveRecordService { 16 public class QiniuLiveRecordService {
  17 + public static final String LIVE_VEDIO_DOMAIN = "http://yhb-img01.qiniudn.com/";
  18 +
12 @Autowired 19 @Autowired
13 private QiniuLiveRecordMapper qiniuLiveRecordMapper; 20 private QiniuLiveRecordMapper qiniuLiveRecordMapper;
14 21
@@ -18,4 +25,16 @@ public class QiniuLiveRecordService { @@ -18,4 +25,16 @@ public class QiniuLiveRecordService {
18 qiniuLiveRecordMapper.updateStatusByPersistId(persistId, 1); // 更新直播记录状态为已转码成功 25 qiniuLiveRecordMapper.updateStatusByPersistId(persistId, 1); // 更新直播记录状态为已转码成功
19 } 26 }
20 } 27 }
  28 +
  29 + public QiniuLiveRecord selectByOrderCodes(Integer orderCode) {
  30 + QiniuLiveRecord qiniuLiveRecords = qiniuLiveRecordMapper.selectByOrderCodes(orderCode);
  31 +
  32 + if (null == qiniuLiveRecords || StringUtils.isEmpty(qiniuLiveRecords.getVedioFileUrl())) {
  33 + return null;
  34 + }
  35 +
  36 + qiniuLiveRecords.setVedioFileUrl(LIVE_VEDIO_DOMAIN + qiniuLiveRecords.getVedioFileUrl());
  37 +
  38 + return qiniuLiveRecords;
  39 + }
21 } 40 }