Explorar o código

feat:修改解构创作任务

zhaohaipeng hai 1 semana
pai
achega
8694217934

+ 1 - 0
supply-demand-engine-core/src/main/java/com/tzld/piaoquan/sde/model/dto/task/XxlJobParamDto.java

@@ -11,4 +11,5 @@ public class XxlJobParamDto {
 
     private String contentScope;
 
+    private Integer cnt;
 }

+ 7 - 17
supply-demand-engine-core/src/main/java/com/tzld/piaoquan/sde/service/impl/ExecutionTaskServiceImpl.java

@@ -572,35 +572,24 @@ public class ExecutionTaskServiceImpl implements ExecutionTaskService {
                 .collect(Collectors.toList());
 
 
-        // 判断前置的解构任务是否都已完成
+        // 过滤掉解构选题未完成或者未成功的视频
         List<String> videoIds = recordInfos.stream()
                 .map(DeconstructionODPSRecordInfo::getChannelContentId)
                 .collect(Collectors.toList());
         LambdaQueryWrapper<ContentProfile> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.in(ContentProfile::getContentId, videoIds)
+                .eq(ContentProfile::getStage, TaskStageEnum.SELECT_TOPIC.getValue())
                 .eq(ContentProfile::getIsDeleted, IsDeleteEnum.NORMAL.getValue());
         List<ContentProfile> contentProfiles = contentProfileMapper.selectList(queryWrapper);
 
         // 存在未解构的视频
-        if (CollectionUtils.isEmpty(contentProfiles) || recordInfos.size() != contentProfiles.size()) {
-            XxlJobLogger.log("videoDeconstructionContentCreationExecutionTaskCreateHandler exist not deconstruction video");
+        if (CollectionUtils.isEmpty(contentProfiles)) {
+            XxlJobLogger.log("videoDeconstructionContentCreationExecutionTaskCreateHandler all not deconstruction video");
             return;
         }
 
-        // 存在未解构完成视频
-        Set<Integer> taskCompleteStatus = Sets.newHashSet(ExecutionTaskStatusEnum.SUCCESS.getValue(), ExecutionTaskStatusEnum.FAILED.getValue());
-        long taskNotCompleteCnt = contentProfiles.stream()
-                .filter(i -> !taskCompleteStatus.contains(i.getStatus()))
-                .count();
-        if (taskNotCompleteCnt > 0) {
-            log.error("videoDeconstructionContentCreationExecutionTaskCreateHandler depend task exist not complete");
-            XxlJobLogger.log("videoDeconstructionContentCreationExecutionTaskCreateHandler depend task exist not complete");
-            return;
-        }
-
-        // 获取解构成功,vov top10的视频
         Set<String> deconstructionSuccessContentIds = contentProfiles.stream()
-                .filter(i -> ExecutionTaskStatusEnum.SUCCESS.getValue().equals(i.getStatus()))
+                .filter(i -> Objects.equals(i.getStatus(), ExecutionTaskStatusEnum.SUCCESS.getValue()))
                 .map(ContentProfile::getContentId)
                 .collect(Collectors.toSet());
 
@@ -610,10 +599,11 @@ public class ExecutionTaskServiceImpl implements ExecutionTaskService {
         }
         log.info("videoDeconstructionContentCreationExecutionTaskCreateHandler deconstruction success video size {}", deconstructionSuccessContentIds.size());
 
+        Integer limit = Optional.ofNullable(paramJson).map(XxlJobParamDto::getCnt).orElse(10);
         List<DeconstructionODPSRecordInfo> top10RecordInfos = recordInfos.stream()
                 .filter(i -> deconstructionSuccessContentIds.contains(i.getChannelContentId()))
                 .sorted(Comparator.comparingDouble(DeconstructionODPSRecordInfo::getVov).reversed())
-                .limit(10)
+                .limit(limit)
                 .collect(Collectors.toList());
         XxlJobLogger.log("videoDeconstructionContentCreationExecutionTaskCreateHandler records size={}", records.size());
         int count = this.deconstructionTaskCreateHandler(top10RecordInfos, contentScope, TaskStageEnum.CONTENT_CREATION);