Authored by mali

转码

package com.yohoufo.dal.order;
import com.yohoufo.dal.order.model.QiniuLiveRecord;
import org.apache.ibatis.annotations.Param;
/**
* Created by li.ma on 2018/12/14.
*/
public interface QiniuLiveRecordMapper {
int updateStatusByPersistId(@Param("persistId")String persistId, @Param("status")Integer status);
QiniuLiveRecord selectByOrderCodes(@Param("orderCode")Integer orderCode);
}
... ...
... ... @@ -10,6 +10,35 @@ public class QiniuLiveRecord {
private Integer status;
private Integer id;
private Long orderCode;
private Integer skup;
private Long sellerOrderCode;
private Integer depotNo;
private Integer startTime;
private Integer endTime;
private String vedioFileUrl;
private Integer createTime;
private Integer updateTime;
private Integer storageId;
private Integer goodsId;
private Integer productId;
private Integer showFlag;
public String getPersistId() {
return persistId;
}
... ... @@ -26,6 +55,118 @@ public class QiniuLiveRecord {
this.status = status;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Long getOrderCode() {
return orderCode;
}
public void setOrderCode(Long orderCode) {
this.orderCode = orderCode;
}
public Integer getSkup() {
return skup;
}
public void setSkup(Integer skup) {
this.skup = skup;
}
public Long getSellerOrderCode() {
return sellerOrderCode;
}
public void setSellerOrderCode(Long sellerOrderCode) {
this.sellerOrderCode = sellerOrderCode;
}
public Integer getDepotNo() {
return depotNo;
}
public void setDepotNo(Integer depotNo) {
this.depotNo = depotNo;
}
public Integer getStartTime() {
return startTime;
}
public void setStartTime(Integer startTime) {
this.startTime = startTime;
}
public Integer getEndTime() {
return endTime;
}
public void setEndTime(Integer endTime) {
this.endTime = endTime;
}
public String getVedioFileUrl() {
return vedioFileUrl;
}
public void setVedioFileUrl(String vedioFileUrl) {
this.vedioFileUrl = vedioFileUrl;
}
public Integer getCreateTime() {
return createTime;
}
public void setCreateTime(Integer createTime) {
this.createTime = createTime;
}
public Integer getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Integer updateTime) {
this.updateTime = updateTime;
}
public Integer getStorageId() {
return storageId;
}
public void setStorageId(Integer storageId) {
this.storageId = storageId;
}
public Integer getGoodsId() {
return goodsId;
}
public void setGoodsId(Integer goodsId) {
this.goodsId = goodsId;
}
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public Integer getShowFlag() {
return showFlag;
}
public void setShowFlag(Integer showFlag) {
this.showFlag = showFlag;
}
@Override
public String toString() {
return JSONObject.toJSONString(this);
... ...
... ... @@ -13,7 +13,6 @@
<result column="vedio_file_url" property="vedioFileUrl" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
<result column="pid" property="pid" jdbcType="INTEGER" />
<result column="status" property="status" jdbcType="INTEGER" />
<result column="storage_id" property="storageId" jdbcType="INTEGER" />
<result column="goods_id" property="goodsId" jdbcType="INTEGER" />
... ... @@ -21,16 +20,14 @@
</resultMap>
<sql id="Base_Column_List" >
id, order_code, skup, seller_order_code, depot_no, start_time, end_time, persistId,
vedio_file_url, create_time, update_time, pid, status, storage_id, goods_id, product_id
vedio_file_url, create_time, update_time, status, storage_id, goods_id, product_id
</sql>
<select id="selectByOrderCodes" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from qiniu_live_record
where order_code in
<foreach collection="orderCodes" open="(" close=")" separator="," item="orderCode">
#{orderCode,jdbcType=BIGINT}
</foreach>
where order_code = #{orderCode, jdbcType=BIGINT}
and show_flag = 1 and status = 1 order by id DESC limit 1
</select>
<update id="updateStatusByPersistId">
... ...
package com.yohoufo.order.service.impl;
import com.google.common.collect.Lists;
import com.yohoufo.dal.order.QiniuLiveRecordMapper;
import com.yohoufo.dal.order.model.QiniuLiveRecord;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by li.ma on 2018/12/14.
*/
@Service
public class QiniuLiveRecordService {
public static final String LIVE_VEDIO_DOMAIN = "http://yhb-img01.qiniudn.com/";
@Autowired
private QiniuLiveRecordMapper qiniuLiveRecordMapper;
... ... @@ -18,4 +25,16 @@ public class QiniuLiveRecordService {
qiniuLiveRecordMapper.updateStatusByPersistId(persistId, 1); // 更新直播记录状态为已转码成功
}
}
public QiniuLiveRecord selectByOrderCodes(Integer orderCode) {
QiniuLiveRecord qiniuLiveRecords = qiniuLiveRecordMapper.selectByOrderCodes(orderCode);
if (null == qiniuLiveRecords || StringUtils.isEmpty(qiniuLiveRecords.getVedioFileUrl())) {
return null;
}
qiniuLiveRecords.setVedioFileUrl(LIVE_VEDIO_DOMAIN + qiniuLiveRecords.getVedioFileUrl());
return qiniuLiveRecords;
}
}
... ...