Authored by mali

鉴定视频,无需再次覆盖视频的场景优化

... ... @@ -43,6 +43,9 @@ public class LiveEventsListener implements ApplicationListener<QiniuLiveRecordEv
@Autowired
private UfoLiveService ufoLiveService;
@Autowired
private LiveRecordHelper liveRecordHelper;
/**
* seller_order_code = #{sellerOrderCode,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=INTEGER},
... ... @@ -61,6 +64,10 @@ public class LiveEventsListener implements ApplicationListener<QiniuLiveRecordEv
return;
}
if (liveRecordHelper.noNeddGenerate(record.getOrderCode(), record.getStartTime())) {
return;
}
if (record.getEndTime() - record.getStartTime() > 300) {
record.setEndTime(record.getStartTime() + 300);
}
... ...
package com.yoho.ufo.order.service.event;
import com.google.common.collect.Lists;
import com.yoho.order.dal.QiniuLiveRecordMapper;
import com.yoho.order.model.QiniuLiveRecord;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
/**
* Created by li.ma on 2019/5/20.
*/
@Service
public class LiveRecordHelper {
private static final Logger LOGGER = LoggerFactory.getLogger(LiveRecordHelper.class);
@Autowired
private QiniuLiveRecordMapper qiniuLiveRecordMapper;
/**
* 如果已经存在视频,且开始时间一致,则无需再生成视频
* @param orderCode
* @param startTime
* @return true 无需再次生成
*/
public boolean noNeddGenerate(Long orderCode, Integer startTime) {
if (null == startTime || null == orderCode) {
LOGGER.error("method noNeddGenerate wrong, orderCode is {}, startTime is {}", orderCode, startTime);
return false;
}
boolean reslut = false;
List<QiniuLiveRecord> qiniuLiveRecords = qiniuLiveRecordMapper.selectByOrderCodes(Lists.newArrayList(orderCode));
if (CollectionUtils.isNotEmpty(qiniuLiveRecords) && startTime.equals(qiniuLiveRecords.get(0).getStartTime())) {
reslut = true;
}
LOGGER.info("method noNeddGenerate run. reslut is {}, orderCode is {}, startTime is {}", orderCode, startTime, reslut);
return reslut;
}
}
... ...