|
@@ -24,6 +24,7 @@ import com.tzld.piaoquan.content.understanding.service.ContentService;
|
|
|
import com.tzld.piaoquan.content.understanding.service.LoghubService;
|
|
|
import com.tzld.piaoquan.content.understanding.service.ODPSManager;
|
|
|
import com.tzld.piaoquan.content.understanding.service.PipelineService;
|
|
|
+import com.tzld.piaoquan.content.understanding.util.DateUtil;
|
|
|
import com.tzld.piaoquan.content.understanding.util.UrlUtil;
|
|
|
import com.xxl.job.core.log.XxlJobLogger;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -34,6 +35,8 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.time.Duration;
|
|
|
+import java.time.LocalDate;
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
@@ -227,12 +230,16 @@ public class ContentServiceImpl implements ContentService {
|
|
|
@Override
|
|
|
public void newRecommendVideoUnderstandingHandler() {
|
|
|
Stopwatch stopwatch = Stopwatch.createStarted();
|
|
|
- List<Record> newRecommendRecords = odpsManager.tableTunnelQuery("loghubods", newRecommendTable);
|
|
|
+ String dt = DateUtil.formatLocalDateTime(LocalDateTime.now(), "yyyyMMddHH");
|
|
|
+ List<Record> newRecommendRecords = odpsManager.tableTunnelQuery("loghubods", newRecommendTable, "dt=" + dt);
|
|
|
if (Objects.nonNull(newRecommendRecords) && !newRecommendRecords.isEmpty()) {
|
|
|
XxlJobLogger.log("table = {} records size = {}", newRecommendTable, newRecommendRecords.size());
|
|
|
for (Record record : newRecommendRecords) {
|
|
|
try {
|
|
|
Long videoId = record.getBigint("videoid");
|
|
|
+ String type = record.getString("type");
|
|
|
+ String title = record.getString("title");
|
|
|
+ String videoPath = record.getString("video_path");
|
|
|
if (Objects.isNull(videoId)) {
|
|
|
XxlJobLogger.log("table = {} videoId 为 null", newRecommendTable);
|
|
|
continue;
|
|
@@ -249,6 +256,25 @@ public class ContentServiceImpl implements ContentService {
|
|
|
contentDTO.setContentType(ContentTypeEnum.VIDEO.getValue());
|
|
|
contentDTO.setContent(videoUrl);
|
|
|
contentDTO.setPipelineId(oldVersionPipelineId);
|
|
|
+ //上报日志
|
|
|
+// 1. type 类型
|
|
|
+// 2. video_id 视频ID
|
|
|
+// 3. partition 分区
|
|
|
+// 4. data 数据结果
|
|
|
+// 5. error_msg 错误信息
|
|
|
+// 6. status 状态
|
|
|
+// success failure
|
|
|
+// 7. pipelineId
|
|
|
+// 8. taskId
|
|
|
+// 9. video_title
|
|
|
+// 10. video_url
|
|
|
+ Map<String, Object> extMap = new HashMap<>();
|
|
|
+ extMap.put("partition", dt);
|
|
|
+ extMap.put("pipelineId", oldVersionPipelineId);
|
|
|
+ extMap.put("type", type);
|
|
|
+ extMap.put("video_title", title);
|
|
|
+ extMap.put("video_url", videoPath);
|
|
|
+ contentDTO.setExtMap(extMap);
|
|
|
contentDTOList.add(contentDTO);
|
|
|
submitTasksParam.setContents(contentDTOList);
|
|
|
submitTasks(submitTasksParam);
|
|
@@ -265,12 +291,17 @@ public class ContentServiceImpl implements ContentService {
|
|
|
@Override
|
|
|
public void dayTopVideoUnderstandingHandler() {
|
|
|
Stopwatch stopwatch = Stopwatch.createStarted();
|
|
|
- List<Record> newRecommendRecords = odpsManager.tableTunnelQuery("loghubods", topReturnTable);
|
|
|
- if (Objects.nonNull(newRecommendRecords) && !newRecommendRecords.isEmpty()) {
|
|
|
- XxlJobLogger.log("table = {} records size = {}", topReturnTable, newRecommendRecords.size());
|
|
|
- for (Record record : newRecommendRecords) {
|
|
|
+ String dt = DateUtil.formatLocalDateTime(LocalDateTime.now(), "yyyyMMdd");
|
|
|
+ List<Record> topReturnRecords = odpsManager.tableTunnelQuery("loghubods", topReturnTable, "dt=" + dt);
|
|
|
+ if (Objects.nonNull(topReturnRecords) && !topReturnRecords.isEmpty()) {
|
|
|
+ XxlJobLogger.log("table = {} records size = {}", topReturnTable, topReturnRecords.size());
|
|
|
+ for (Record record : topReturnRecords) {
|
|
|
try {
|
|
|
+ //
|
|
|
Long videoId = record.getBigint("videoid");
|
|
|
+ String type = record.getString("type");
|
|
|
+ String title = record.getString("title");
|
|
|
+ String videoPath = record.getString("video_path");
|
|
|
if (Objects.isNull(videoId)) {
|
|
|
XxlJobLogger.log("table = {} videoId 为 null", topReturnTable);
|
|
|
continue;
|
|
@@ -287,6 +318,25 @@ public class ContentServiceImpl implements ContentService {
|
|
|
contentDTO.setContentType(ContentTypeEnum.VIDEO.getValue());
|
|
|
contentDTO.setContent(videoUrl);
|
|
|
contentDTO.setPipelineId(oldVersionPipelineId);
|
|
|
+ //上报日志
|
|
|
+// 1. type 类型
|
|
|
+// 2. video_id 视频ID
|
|
|
+// 3. partition 分区
|
|
|
+// 4. data 数据结果
|
|
|
+// 5. error_msg 错误信息
|
|
|
+// 6. status 状态
|
|
|
+// success failure
|
|
|
+// 7. pipelineId
|
|
|
+// 8. taskId
|
|
|
+// 9. video_title
|
|
|
+// 10. video_url
|
|
|
+ Map<String, Object> extMap = new HashMap<>();
|
|
|
+ extMap.put("partition", dt);
|
|
|
+ extMap.put("pipelineId", oldVersionPipelineId);
|
|
|
+ extMap.put("type", type);
|
|
|
+ extMap.put("video_title", title);
|
|
|
+ extMap.put("video_url", videoPath);
|
|
|
+ contentDTO.setExtMap(extMap);
|
|
|
contentDTOList.add(contentDTO);
|
|
|
submitTasksParam.setContents(contentDTOList);
|
|
|
TaskResultVO taskResultVO = submitTasks(submitTasksParam);
|
|
@@ -303,12 +353,16 @@ public class ContentServiceImpl implements ContentService {
|
|
|
@Override
|
|
|
public void historyVideoUnderstandingHandler() {
|
|
|
Stopwatch stopwatch = Stopwatch.createStarted();
|
|
|
- List<Record> newRecommendRecords = odpsManager.tableTunnelQuery("loghubods", topHistoryTable);
|
|
|
- if (Objects.nonNull(newRecommendRecords) && !newRecommendRecords.isEmpty()) {
|
|
|
- XxlJobLogger.log("table = {} records size = {}", topHistoryTable, newRecommendRecords.size());
|
|
|
- for (Record record : newRecommendRecords) {
|
|
|
+ String dt = DateUtil.formatLocalDateTime(LocalDateTime.now(), "yyyyMMdd");
|
|
|
+ List<Record> topHistoryRecords = odpsManager.tableTunnelQuery("loghubods", topHistoryTable, "dt=" + dt);
|
|
|
+ if (Objects.nonNull(topHistoryRecords) && !topHistoryRecords.isEmpty()) {
|
|
|
+ XxlJobLogger.log("table = {} records size = {}", topHistoryTable, topHistoryRecords.size());
|
|
|
+ for (Record record : topHistoryRecords) {
|
|
|
try {
|
|
|
Long videoId = record.getBigint("videoid");
|
|
|
+ String type = record.getString("type");
|
|
|
+ String title = record.getString("title");
|
|
|
+ String videoPath = record.getString("video_path");
|
|
|
if (Objects.isNull(videoId)) {
|
|
|
XxlJobLogger.log("table = {} videoId 为 null", topHistoryTable);
|
|
|
continue;
|
|
@@ -325,6 +379,25 @@ public class ContentServiceImpl implements ContentService {
|
|
|
contentDTO.setContentType(ContentTypeEnum.VIDEO.getValue());
|
|
|
contentDTO.setContent(videoUrl);
|
|
|
contentDTO.setPipelineId(oldVersionPipelineId);
|
|
|
+ //上报日志
|
|
|
+// 1. type 类型
|
|
|
+// 2. video_id 视频ID
|
|
|
+// 3. partition 分区
|
|
|
+// 4. data 数据结果
|
|
|
+// 5. error_msg 错误信息
|
|
|
+// 6. status 状态
|
|
|
+// success failure
|
|
|
+// 7. pipelineId
|
|
|
+// 8. taskId
|
|
|
+// 9. video_title
|
|
|
+// 10. video_url
|
|
|
+ Map<String, Object> extMap = new HashMap<>();
|
|
|
+ extMap.put("partition", dt);
|
|
|
+ extMap.put("pipelineId", oldVersionPipelineId);
|
|
|
+ extMap.put("type", type);
|
|
|
+ extMap.put("video_title", title);
|
|
|
+ extMap.put("video_url", videoPath);
|
|
|
+ contentDTO.setExtMap(extMap);
|
|
|
contentDTOList.add(contentDTO);
|
|
|
submitTasksParam.setContents(contentDTOList);
|
|
|
TaskResultVO taskResultVO = submitTasks(submitTasksParam);
|