|
@@ -6,14 +6,17 @@ import com.tzld.piaoquan.content.understanding.common.enums.DataStatusEnum;
|
|
import com.tzld.piaoquan.content.understanding.common.enums.ExceptionEnum;
|
|
import com.tzld.piaoquan.content.understanding.common.enums.ExceptionEnum;
|
|
import com.tzld.piaoquan.content.understanding.common.exception.CommonException;
|
|
import com.tzld.piaoquan.content.understanding.common.exception.CommonException;
|
|
import com.tzld.piaoquan.content.understanding.dao.mapper.CuPipelineMapper;
|
|
import com.tzld.piaoquan.content.understanding.dao.mapper.CuPipelineMapper;
|
|
|
|
+import com.tzld.piaoquan.content.understanding.dao.mapper.CuTaskMapper;
|
|
import com.tzld.piaoquan.content.understanding.model.dto.ContentDTO;
|
|
import com.tzld.piaoquan.content.understanding.model.dto.ContentDTO;
|
|
-import com.tzld.piaoquan.content.understanding.model.dto.TaskInfoDTO;
|
|
|
|
import com.tzld.piaoquan.content.understanding.model.dto.TaskResultDTO;
|
|
import com.tzld.piaoquan.content.understanding.model.dto.TaskResultDTO;
|
|
-import com.tzld.piaoquan.content.understanding.model.param.ContentAnalyseParam;
|
|
|
|
-import com.tzld.piaoquan.content.understanding.model.param.ContentUnderstandParam;
|
|
|
|
-import com.tzld.piaoquan.content.understanding.model.param.SubmitTasksParam;
|
|
|
|
|
|
+import com.tzld.piaoquan.content.understanding.model.dto.VideoResultDTO;
|
|
|
|
+import com.tzld.piaoquan.content.understanding.model.param.*;
|
|
import com.tzld.piaoquan.content.understanding.model.po.CuPipeline;
|
|
import com.tzld.piaoquan.content.understanding.model.po.CuPipeline;
|
|
import com.tzld.piaoquan.content.understanding.model.po.CuPipelineExample;
|
|
import com.tzld.piaoquan.content.understanding.model.po.CuPipelineExample;
|
|
|
|
+import com.tzld.piaoquan.content.understanding.model.po.CuTask;
|
|
|
|
+import com.tzld.piaoquan.content.understanding.model.po.CuTaskExample;
|
|
|
|
+import com.tzld.piaoquan.content.understanding.model.vo.ContentUnderstandingResultVO;
|
|
|
|
+import com.tzld.piaoquan.content.understanding.model.vo.TaskResultVO;
|
|
import com.tzld.piaoquan.content.understanding.service.ContentService;
|
|
import com.tzld.piaoquan.content.understanding.service.ContentService;
|
|
import com.tzld.piaoquan.content.understanding.service.LoghubService;
|
|
import com.tzld.piaoquan.content.understanding.service.LoghubService;
|
|
import com.tzld.piaoquan.content.understanding.service.PipelineService;
|
|
import com.tzld.piaoquan.content.understanding.service.PipelineService;
|
|
@@ -45,6 +48,8 @@ public class ContentServiceImpl implements ContentService {
|
|
private Map<String, Long> configMap;
|
|
private Map<String, Long> configMap;
|
|
@Autowired
|
|
@Autowired
|
|
private CuPipelineMapper cuPipelineMapper;
|
|
private CuPipelineMapper cuPipelineMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private CuTaskMapper cuTaskMapper;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void analyse(ContentAnalyseParam param) {
|
|
public void analyse(ContentAnalyseParam param) {
|
|
@@ -79,7 +84,7 @@ public class ContentServiceImpl implements ContentService {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public TaskResultDTO submitTasks(SubmitTasksParam param) {
|
|
|
|
|
|
+ public TaskResultVO submitTasks(SubmitTasksParam param) {
|
|
//参数校验
|
|
//参数校验
|
|
if (Objects.isNull(param) || Objects.isNull(param.getContents()) || param.getContents().isEmpty()) {
|
|
if (Objects.isNull(param) || Objects.isNull(param.getContents()) || param.getContents().isEmpty()) {
|
|
throw new CommonException(ExceptionEnum.PARAMS_INVALID);
|
|
throw new CommonException(ExceptionEnum.PARAMS_INVALID);
|
|
@@ -87,8 +92,9 @@ public class ContentServiceImpl implements ContentService {
|
|
List<ContentDTO> contentDTOList = param.getContents();
|
|
List<ContentDTO> contentDTOList = param.getContents();
|
|
//数据校验
|
|
//数据校验
|
|
for (ContentDTO contentDTO : contentDTOList) {
|
|
for (ContentDTO contentDTO : contentDTOList) {
|
|
- if (Objects.isNull(contentDTO) || Objects.isNull(contentDTO.getPipelineId()) || Objects.isNull(contentDTO.getContent())) {
|
|
|
|
- throw new CommonException(ExceptionEnum.PARAMS_INVALID);
|
|
|
|
|
|
+ if (Objects.isNull(contentDTO) || Objects.isNull(contentDTO.getPipelineId())
|
|
|
|
+ || Objects.isNull(contentDTO.getContent()) || Objects.isNull(contentDTO.getVideoId())) {
|
|
|
|
+ throw new CommonException(ExceptionEnum.PARAMS_INVALID, "videoId、pipelineId、content参数不能为空");
|
|
}
|
|
}
|
|
Long pipelineId = contentDTO.getPipelineId();
|
|
Long pipelineId = contentDTO.getPipelineId();
|
|
CuPipelineExample example = new CuPipelineExample();
|
|
CuPipelineExample example = new CuPipelineExample();
|
|
@@ -104,19 +110,44 @@ public class ContentServiceImpl implements ContentService {
|
|
contentDTO.setContentType(cuPipeline.getContentType());
|
|
contentDTO.setContentType(cuPipeline.getContentType());
|
|
}
|
|
}
|
|
//执行任务
|
|
//执行任务
|
|
- TaskResultDTO taskResultDTO = new TaskResultDTO();
|
|
|
|
- List<TaskInfoDTO> taskInfoDTOS = new ArrayList<>();
|
|
|
|
|
|
+ TaskResultVO taskResultVO = new TaskResultVO();
|
|
|
|
+ List<TaskResultDTO> taskResultDTOS = new ArrayList<>();
|
|
for (ContentDTO contentDTO : contentDTOList) {
|
|
for (ContentDTO contentDTO : contentDTOList) {
|
|
- TaskInfoDTO taskInfoDTO = new TaskInfoDTO();
|
|
|
|
- BeanUtils.copyProperties(contentDTO, taskInfoDTO);
|
|
|
|
- pipelineService.execute(contentDTO);
|
|
|
|
|
|
+ TaskResultDTO taskResultDTO = new TaskResultDTO();
|
|
|
|
+ BeanUtils.copyProperties(contentDTO, taskResultDTO);
|
|
|
|
+ String taskId = pipelineService.executeTask(contentDTO);
|
|
|
|
+ taskResultDTO.setTaskId(taskId);
|
|
|
|
+ taskResultDTOS.add(taskResultDTO);
|
|
|
|
+ }
|
|
|
|
+ taskResultVO.setTaskResults(taskResultDTOS);
|
|
|
|
+ return taskResultVO;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public TaskResultVO queryTasks(QueryTasksParam param) {
|
|
|
|
+ //参数校验
|
|
|
|
+ if (Objects.isNull(param) || Objects.isNull(param.getTaskIds()) || param.getTaskIds().isEmpty()) {
|
|
|
|
+ throw new CommonException(ExceptionEnum.PARAMS_INVALID);
|
|
|
|
+ }
|
|
|
|
+ CuTaskExample example = new CuTaskExample();
|
|
|
|
+ example.createCriteria().andTaskIdIn(param.getTaskIds());
|
|
|
|
+ List<CuTask> list = cuTaskMapper.selectByExample(example);
|
|
|
|
+ TaskResultVO taskResultVO = new TaskResultVO();
|
|
|
|
+ if (Objects.isNull(list) || list.isEmpty()) {
|
|
|
|
+ return taskResultVO;
|
|
|
|
+ }
|
|
|
|
+ List<TaskResultDTO> taskResultDTOS = new ArrayList<>();
|
|
|
|
+ for (CuTask task : list) {
|
|
|
|
+ TaskResultDTO taskResultDTO = new TaskResultDTO();
|
|
|
|
+ BeanUtils.copyProperties(task, taskResultDTO);
|
|
|
|
+ taskResultDTOS.add(taskResultDTO);
|
|
}
|
|
}
|
|
- taskResultDTO.setTaskList(taskInfoDTOS);
|
|
|
|
- return taskResultDTO;
|
|
|
|
|
|
+ taskResultVO.setTaskResults(taskResultDTOS);
|
|
|
|
+ return taskResultVO;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public TaskResultDTO queryTasks(ContentUnderstandParam param) {
|
|
|
|
|
|
+ public ContentUnderstandingResultVO getVideoUnderstandingResult(GetVideoUnderstandingResultParam param) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|