|
|
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;
|
|
|
}
|
|
|
} |
...
|
...
|
|