|
|
1
|
+package com.yoho.ufo.order.service.event;
|
|
|
2
|
+
|
|
|
3
|
+import com.google.common.collect.Lists;
|
|
|
4
|
+import com.yoho.order.dal.QiniuLiveRecordMapper;
|
|
|
5
|
+import com.yoho.order.model.QiniuLiveRecord;
|
|
|
6
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
7
|
+import org.slf4j.Logger;
|
|
|
8
|
+import org.slf4j.LoggerFactory;
|
|
|
9
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
10
|
+import org.springframework.stereotype.Service;
|
|
|
11
|
+
|
|
|
12
|
+import java.util.Collections;
|
|
|
13
|
+import java.util.List;
|
|
|
14
|
+
|
|
|
15
|
+/**
|
|
|
16
|
+ * Created by li.ma on 2019/5/20.
|
|
|
17
|
+ */
|
|
|
18
|
+@Service
|
|
|
19
|
+public class LiveRecordHelper {
|
|
|
20
|
+ private static final Logger LOGGER = LoggerFactory.getLogger(LiveRecordHelper.class);
|
|
|
21
|
+
|
|
|
22
|
+ @Autowired
|
|
|
23
|
+ private QiniuLiveRecordMapper qiniuLiveRecordMapper;
|
|
|
24
|
+
|
|
|
25
|
+ /**
|
|
|
26
|
+ * 如果已经存在视频,且开始时间一致,则无需再生成视频
|
|
|
27
|
+ * @param orderCode
|
|
|
28
|
+ * @param startTime
|
|
|
29
|
+ * @return true 无需再次生成
|
|
|
30
|
+ */
|
|
|
31
|
+ public boolean noNeddGenerate(Long orderCode, Integer startTime) {
|
|
|
32
|
+ if (null == startTime || null == orderCode) {
|
|
|
33
|
+ LOGGER.error("method noNeddGenerate wrong, orderCode is {}, startTime is {}", orderCode, startTime);
|
|
|
34
|
+ return false;
|
|
|
35
|
+ }
|
|
|
36
|
+
|
|
|
37
|
+ boolean reslut = false;
|
|
|
38
|
+
|
|
|
39
|
+ List<QiniuLiveRecord> qiniuLiveRecords = qiniuLiveRecordMapper.selectByOrderCodes(Lists.newArrayList(orderCode));
|
|
|
40
|
+
|
|
|
41
|
+ if (CollectionUtils.isNotEmpty(qiniuLiveRecords) && startTime.equals(qiniuLiveRecords.get(0).getStartTime())) {
|
|
|
42
|
+ reslut = true;
|
|
|
43
|
+ }
|
|
|
44
|
+
|
|
|
45
|
+ LOGGER.info("method noNeddGenerate run. reslut is {}, orderCode is {}, startTime is {}", orderCode, startTime, reslut);
|
|
|
46
|
+
|
|
|
47
|
+ return reslut;
|
|
|
48
|
+ }
|
|
|
49
|
+} |