supeng преди 2 месеца
родител
ревизия
c878d8fa4c
променени са 17 файла, в които са добавени 357 реда и са изтрити 35 реда
  1. 13 0
      content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/common/base/CommonResponse.java
  2. 11 11
      content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/common/enums/ContentTypeEnum.java
  3. 24 0
      content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/common/enums/TaskStatusEnum.java
  4. 20 0
      content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/model/dto/ContentInfoDTO.java
  5. 23 0
      content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/model/dto/ContentUnderstandDTO.java
  6. 23 0
      content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/model/dto/TaskInfoDTO.java
  7. 13 0
      content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/model/dto/TaskResultDTO.java
  8. 2 2
      content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/model/dto/TreeNode.java
  9. 23 0
      content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/model/param/ContentUnderstandParam.java
  10. 20 1
      content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/service/ContentService.java
  11. 3 0
      content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/service/PipelineService.java
  12. 61 2
      content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/service/impl/ContentServiceImpl.java
  13. 4 2
      content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/service/impl/GeminiGenerateContentAction.java
  14. 67 13
      content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/service/impl/PipelineServiceImpl.java
  15. 4 3
      content-understanding-core/src/main/resources/mybatis-generator-config.xml
  16. 8 1
      content-understanding-server/src/main/java/com/tzld/piaoquan/content/understanding/controller/ContentController.java
  17. 38 0
      content-understanding-server/src/main/java/com/tzld/piaoquan/content/understanding/controller/ContentUnderstandingController.java

+ 13 - 0
content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/common/base/CommonResponse.java

@@ -1,5 +1,7 @@
 package com.tzld.piaoquan.content.understanding.common.base;
 
+import java.util.UUID;
+
 /**
  * Common Response
  */
@@ -16,6 +18,10 @@ public class CommonResponse<T> {
     private T data;
     /** 重定向 */
     private String redirect;
+    /**
+     * 请求ID
+     */
+    private String requestId = UUID.randomUUID().toString();
 
     public boolean isSuccess() {
         return this.code == SUCCESS_CODE;
@@ -88,4 +94,11 @@ public class CommonResponse<T> {
         this.redirect = redirect;
     }
 
+    public String getRequestId() {
+        return requestId;
+    }
+
+    public void setRequestId(String requestId) {
+        this.requestId = requestId;
+    }
 }

+ 11 - 11
content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/common/enums/ContentTypeEnum.java

@@ -1,13 +1,21 @@
 package com.tzld.piaoquan.content.understanding.common.enums;
 
+import lombok.Getter;
+
 /**
  * 内容类型
+ * @author supeng
  */
+@Getter
 public enum ContentTypeEnum {
 
-    TEXT(0, "文本"),
-    IMAGE(1, "图片"),
-    VIDEO(2, "视频");
+    TITLE(0, "标题"),
+    COVER(1, "封面"),
+    VIDEO(2, "视频"),
+    INTRODUCTION(3, "简介"),
+    AUDIO(4, "音频"),
+    SRT(5, "字幕"),
+    VTT(6, "字幕");
 
     private final Integer value;
     private final String desc;
@@ -16,12 +24,4 @@ public enum ContentTypeEnum {
         this.value = value;
         this.desc = desc;
     }
-
-    public Integer getValue() {
-        return value;
-    }
-
-    public String getDesc() {
-        return desc;
-    }
 }

+ 24 - 0
content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/common/enums/TaskStatusEnum.java

@@ -0,0 +1,24 @@
+package com.tzld.piaoquan.content.understanding.common.enums;
+
+import lombok.Getter;
+
+/**
+ * 任务状态
+ * @author supeng
+ */
+@Getter
+public enum TaskStatusEnum {
+
+    SUBMIT(0, "已提交"),
+    PROCESS(1, "处理中"),
+    SUCCESS(2, "成功"),
+    FAILURE(3, "失败");
+
+    private final Integer value;
+    private final String desc;
+
+    TaskStatusEnum(Integer value, String desc) {
+        this.value = value;
+        this.desc = desc;
+    }
+}

+ 20 - 0
content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/model/dto/ContentInfoDTO.java

@@ -0,0 +1,20 @@
+package com.tzld.piaoquan.content.understanding.model.dto;
+
+import lombok.Data;
+
+/**
+ * 内容信息
+ *
+ * @author supeng
+ */
+@Data
+public class ContentInfoDTO {
+    private Long videoId;
+    private String title;
+    private String introduction;
+    private String coverUrl;
+    private String videoUrl;
+    private String audioUrl;
+    private String srt;
+    private String vtt;
+}

+ 23 - 0
content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/model/dto/ContentUnderstandDTO.java

@@ -0,0 +1,23 @@
+package com.tzld.piaoquan.content.understanding.model.dto;
+
+import lombok.Data;
+
+/**
+ * 内容信息
+ *
+ * @author supeng
+ */
+@Data
+public class ContentUnderstandDTO {
+    private Long videoId;
+    private String title;
+    private String introduction;
+    private String coverUrl;
+    private String videoUrl;
+    private String audioUrl;
+    private String srt;
+    private String vtt;
+
+    private Long pipelineId;
+    private Integer contentType;
+}

+ 23 - 0
content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/model/dto/TaskInfoDTO.java

@@ -0,0 +1,23 @@
+package com.tzld.piaoquan.content.understanding.model.dto;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author supeng
+ */
+@Data
+public class TaskInfoDTO {
+    private String taskId;
+    private String pipelineId;
+    /**
+     * @see com.tzld.piaoquan.content.understanding.common.enums.TaskStatusEnum
+     */
+    private Integer taskStatus;
+    private String input;
+    private String output;
+    private String reason;
+    private Date createTime;
+    private Date updateTime;
+}

+ 13 - 0
content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/model/dto/TaskResultDTO.java

@@ -0,0 +1,13 @@
+package com.tzld.piaoquan.content.understanding.model.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author supeng
+ */
+@Data
+public class TaskResultDTO {
+    private List<TaskInfoDTO> taskList;
+}

+ 2 - 2
content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/model/dto/PipelineTreeNode.java → content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/model/dto/TreeNode.java

@@ -11,7 +11,7 @@ import java.util.List;
  * @author supeng
  */
 @Data
-public class PipelineTreeNode {
+public class TreeNode {
     /**
      * 要执行的步骤
      */
@@ -27,5 +27,5 @@ public class PipelineTreeNode {
     /**
      * 子节点
      */
-    private List<PipelineTreeNode> children;
+    private List<TreeNode> children;
 }

+ 23 - 0
content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/model/param/ContentUnderstandParam.java

@@ -0,0 +1,23 @@
+package com.tzld.piaoquan.content.understanding.model.param;
+
+import com.tzld.piaoquan.content.understanding.model.dto.ContentInfoDTO;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @author supeng
+ */
+@Data
+public class ContentUnderstandParam {
+    /**
+     * 内容理解维度
+     *
+     * @see com.tzld.piaoquan.content.understanding.common.enums.ContentTypeEnum
+     */
+    private List<Integer> contentTypes;
+    /**
+     * 内容信息
+     */
+    private ContentInfoDTO contentInfo;
+}

+ 20 - 1
content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/service/ContentService.java

@@ -1,7 +1,8 @@
 package com.tzld.piaoquan.content.understanding.service;
 
-import com.tzld.piaoquan.content.understanding.common.base.CommonRequest;
+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;
 
 /**
  * @author supeng
@@ -14,4 +15,22 @@ public interface ContentService {
      * @param param
      */
     void analyse(ContentAnalyseParam param);
+
+    void understand(ContentUnderstandParam param);
+
+    /**
+     * 提交任务
+     *
+     * @param param
+     * @return
+     */
+    TaskResultDTO submitTasks(ContentUnderstandParam param);
+
+    /**
+     * 查询任务
+     *
+     * @param param
+     * @return
+     */
+    TaskResultDTO queryTasks(ContentUnderstandParam param);
 }

+ 3 - 0
content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/service/PipelineService.java

@@ -1,5 +1,6 @@
 package com.tzld.piaoquan.content.understanding.service;
 
+import com.tzld.piaoquan.content.understanding.model.dto.ContentUnderstandDTO;
 import com.tzld.piaoquan.content.understanding.model.param.ContentAnalyseParam;
 
 /**
@@ -8,4 +9,6 @@ import com.tzld.piaoquan.content.understanding.model.param.ContentAnalyseParam;
 public interface PipelineService {
 
     void execute(ContentAnalyseParam param);
+
+    void execute(ContentUnderstandDTO dto);
 }

+ 61 - 2
content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/service/impl/ContentServiceImpl.java

@@ -1,18 +1,23 @@
 package com.tzld.piaoquan.content.understanding.service.impl;
 
-import com.tzld.piaoquan.content.understanding.common.base.CommonRequest;
+import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
 import com.tzld.piaoquan.content.understanding.common.enums.ExceptionEnum;
 import com.tzld.piaoquan.content.understanding.common.exception.CommonException;
+import com.tzld.piaoquan.content.understanding.model.dto.ContentUnderstandDTO;
+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.param.ContentAnalyseParam;
+import com.tzld.piaoquan.content.understanding.model.param.ContentUnderstandParam;
 import com.tzld.piaoquan.content.understanding.service.ContentService;
 import com.tzld.piaoquan.content.understanding.service.LoghubService;
 import com.tzld.piaoquan.content.understanding.service.PipelineService;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
-import java.util.Objects;
+import java.util.*;
 
 /**
  * @author supeng
@@ -30,6 +35,9 @@ public class ContentServiceImpl implements ContentService {
     @Value("${video.analyse.pipelineId:1}")
     private Long videoAnalysePipelineId;
 
+    @ApolloJsonValue("${content.understand.pipeline.config:{}}")
+    private Map<String, Long> configMap;
+
     @Override
     public void analyse(ContentAnalyseParam param) {
         if (Objects.isNull(param) || Objects.isNull(param.getType())) {
@@ -38,4 +46,55 @@ public class ContentServiceImpl implements ContentService {
         param.setPipelineId(videoAnalysePipelineId);
         pipelineService.execute(param);
     }
+
+    @Override
+    public void understand(ContentUnderstandParam param) {
+        if (Objects.isNull(param) || Objects.isNull(param.getContentTypes()) || param.getContentTypes().isEmpty()
+                || Objects.isNull(param.getContentInfo())) {
+            throw new CommonException(ExceptionEnum.PARAMS_INVALID);
+        }
+        //生成jobId
+        String jobId = UUID.randomUUID().toString().replace("-", "") + System.currentTimeMillis();
+        for (Integer contentType : param.getContentTypes()) {
+            Long pipelineId = configMap.get(contentType.toString());
+            if (Objects.isNull(pipelineId)) {
+                //TODO 日志上报 && 记录状态
+                log.info("jobId = {}", jobId);
+                continue;
+            }
+            ContentUnderstandDTO dto = new ContentUnderstandDTO();
+            BeanUtils.copyProperties(param.getContentInfo(), dto);
+            dto.setPipelineId(pipelineId);
+            dto.setContentType(contentType);
+            pipelineService.execute(dto);
+        }
+    }
+
+    @Override
+    public TaskResultDTO submitTasks(ContentUnderstandParam param) {
+        TaskResultDTO taskResultDTO = new TaskResultDTO();
+        List<TaskInfoDTO> taskInfoDTOS = new ArrayList<>();
+        for (Integer contentType : param.getContentTypes()) {
+            Long pipelineId = configMap.get(contentType.toString());
+            if (Objects.isNull(pipelineId)) {
+                //TODO 日志上报 && 记录状态
+                continue;
+            }
+            //生成 taskId
+            String taskId = UUID.randomUUID().toString().replace("-", "") + System.currentTimeMillis();
+            log.info("contentType = {} pipelineId = {} taskId = {}", contentType, pipelineId, taskId);
+            ContentUnderstandDTO dto = new ContentUnderstandDTO();
+            BeanUtils.copyProperties(param.getContentInfo(), dto);
+            dto.setPipelineId(pipelineId);
+            dto.setContentType(contentType);
+            pipelineService.execute(dto);
+        }
+        taskResultDTO.setTaskList(taskInfoDTOS);
+        return taskResultDTO;
+    }
+
+    @Override
+    public TaskResultDTO queryTasks(ContentUnderstandParam param) {
+        return null;
+    }
 }

+ 4 - 2
content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/service/impl/GeminiGenerateContentAction.java

@@ -45,7 +45,9 @@ public class GeminiGenerateContentAction implements Action {
         GeminiParam geminiParam = new GeminiParam();
         geminiParam.setType(type);
         geminiParam.setPrompt(param.getPrompt());
-        if (Objects.equals(ContentTypeEnum.IMAGE.getValue(), type) || Objects.equals(ContentTypeEnum.VIDEO.getValue(), type)) {
+        if (Objects.equals(ContentTypeEnum.COVER.getValue(), type) || Objects.equals(ContentTypeEnum.VIDEO.getValue(), type)
+                || Objects.equals(ContentTypeEnum.AUDIO.getValue(), type) || Objects.equals(ContentTypeEnum.SRT.getValue(), type)
+                || Objects.equals(ContentTypeEnum.VTT.getValue(), type)) {
             geminiParam.setMediaUrl(param.getInput());
         }
         geminiParam.setApiKey(apiKey);
@@ -55,7 +57,7 @@ public class GeminiGenerateContentAction implements Action {
         Optional<String> optionalS = httpPoolClient.postJson(geminiApiUrl, JSON.toJSONString(geminiParam));
         log.info("geminiGenerateContentAction optionalS = {}", optionalS);
         if (optionalS.isPresent()) {
-            CommonResponse<Map<String,Object>> commonResponse = JSON.parseObject(optionalS.get(), CommonResponse.class);
+            CommonResponse<Map<String, Object>> commonResponse = JSON.parseObject(optionalS.get(), CommonResponse.class);
             if (commonResponse.isSuccess() && Objects.nonNull(commonResponse.getData()) && Objects.nonNull(commonResponse.getData().get("result"))) {
                 String content = commonResponse.getData().get("result").toString();
                 //过滤一些特殊格式

+ 67 - 13
content-understanding-core/src/main/java/com/tzld/piaoquan/content/understanding/service/impl/PipelineServiceImpl.java

@@ -2,13 +2,15 @@ package com.tzld.piaoquan.content.understanding.service.impl;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.TypeReference;
+import com.tzld.piaoquan.content.understanding.common.enums.ContentTypeEnum;
 import com.tzld.piaoquan.content.understanding.common.enums.ExceptionEnum;
 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.CuPipelineStepMapper;
 import com.tzld.piaoquan.content.understanding.dao.mapper.CuPromptMapper;
 import com.tzld.piaoquan.content.understanding.model.dto.ContentAnalyseDTO;
-import com.tzld.piaoquan.content.understanding.model.dto.PipelineTreeNode;
+import com.tzld.piaoquan.content.understanding.model.dto.ContentUnderstandDTO;
+import com.tzld.piaoquan.content.understanding.model.dto.TreeNode;
 import com.tzld.piaoquan.content.understanding.model.param.ActionParam;
 import com.tzld.piaoquan.content.understanding.model.param.ContentAnalyseParam;
 import com.tzld.piaoquan.content.understanding.model.po.CuPipelineStep;
@@ -61,7 +63,7 @@ public class PipelineServiceImpl implements PipelineService {
             throw new CommonException(ExceptionEnum.CONFIG_ERROR, "无配置 pipelineId:" + pipelineId);
         }
         // 2.构建tree结构
-        PipelineTreeNode root = buildTree(stepList);
+        TreeNode root = buildTree(stepList);
         root.setType(type);
         root.setInput(content);
         ContentAnalyseDTO dto = new ContentAnalyseDTO();
@@ -70,13 +72,59 @@ public class PipelineServiceImpl implements PipelineService {
         executeTreeNodeBFS(root, dto);
     }
 
-    public PipelineTreeNode buildTree(List<CuPipelineStep> stepList) {
-        Map<Long, PipelineTreeNode> nodeMap = new HashMap<>();
-        PipelineTreeNode root = null;
+    @Override
+    public void execute(ContentUnderstandDTO dto) {
+        // 1.获取pipeline配置
+        Long pipelineId = dto.getPipelineId();
+        Integer contentType = dto.getContentType();
+        CuPipelineStepExample example = new CuPipelineStepExample();
+        example.createCriteria().andPipelineIdEqualTo(pipelineId);
+        List<CuPipelineStep> stepList = cuPipelineStepMapper.selectByExample(example);
+        if (Objects.isNull(stepList) || stepList.isEmpty()) {
+            throw new CommonException(ExceptionEnum.CONFIG_ERROR, "无配置 pipelineId:" + pipelineId);
+        }
+        // 2.构建tree结构
+        TreeNode root = buildTree(stepList);
+        root.setType(contentType);
+        String content = getContent(dto, contentType);
+        if (Objects.isNull(content)) {
+            throw new CommonException(ExceptionEnum.DATA_ERROR, "数据异常content:" + content);
+        }
+        root.setInput(content);
+        ContentAnalyseDTO dto1 = new ContentAnalyseDTO();
+        dto1.setVideoId(dto.getVideoId());
+        dto1.setContent(content);
+        // 3.按照步骤执行pipeline每一步动作
+        executeTreeNodeBFS(root, dto1);
+    }
+
+    private String getContent(ContentUnderstandDTO dto, Integer contentType) {
+        String content = null;
+        if (Objects.equals(contentType, ContentTypeEnum.TITLE.getValue())) {
+            content = dto.getTitle();
+        } else if (Objects.equals(contentType, ContentTypeEnum.COVER.getValue())) {
+            content = dto.getCoverUrl();
+        } else if (Objects.equals(contentType, ContentTypeEnum.VIDEO.getValue())) {
+            content = dto.getVideoUrl();
+        } else if (Objects.equals(contentType, ContentTypeEnum.INTRODUCTION.getValue())) {
+            content = dto.getIntroduction();
+        } else if (Objects.equals(contentType, ContentTypeEnum.AUDIO.getValue())) {
+            content = dto.getAudioUrl();
+        } else if (Objects.equals(contentType, ContentTypeEnum.SRT.getValue())) {
+            content = dto.getSrt();
+        } else if (Objects.equals(contentType, ContentTypeEnum.VTT.getValue())) {
+            content = dto.getVtt();
+        }
+        return content;
+    }
+
+    public TreeNode buildTree(List<CuPipelineStep> stepList) {
+        Map<Long, TreeNode> nodeMap = new HashMap<>();
+        TreeNode root = null;
 
         // 将所有节点放入 Map 中,方便后续查找
         for (CuPipelineStep step : stepList) {
-            PipelineTreeNode node = new PipelineTreeNode();
+            TreeNode node = new TreeNode();
             node.setStep(step);
             nodeMap.put(step.getId(), node);
         }
@@ -87,9 +135,9 @@ public class PipelineServiceImpl implements PipelineService {
             if (Objects.isNull(parentId) || parentId == 0) {
                 root = nodeMap.get(step.getId());
             } else if (nodeMap.containsKey(parentId)) {
-                PipelineTreeNode parentNode = nodeMap.get(parentId);
-                PipelineTreeNode currentNode = nodeMap.get(step.getId());
-                List<PipelineTreeNode> children = parentNode.getChildren();
+                TreeNode parentNode = nodeMap.get(parentId);
+                TreeNode currentNode = nodeMap.get(step.getId());
+                List<TreeNode> children = parentNode.getChildren();
                 if (Objects.isNull(children)) {
                     children = new ArrayList<>();
                     parentNode.setChildren(children);
@@ -100,17 +148,23 @@ public class PipelineServiceImpl implements PipelineService {
         return root;
     }
 
-    public void executeTreeNodeBFS(PipelineTreeNode root, ContentAnalyseDTO dto) {
+    /**
+     * 遍历树结构
+     *
+     * @param root 根节点
+     * @param dto  数据
+     */
+    public void executeTreeNodeBFS(TreeNode root, ContentAnalyseDTO dto) {
         if (Objects.isNull(root) || Objects.isNull(dto) || Objects.isNull(dto.getVideoId())) {
             return;
         }
-        Queue<PipelineTreeNode> queue = new LinkedList<>();
+        Queue<TreeNode> queue = new LinkedList<>();
         queue.offer(root);
 
         Long videoId = dto.getVideoId();
 
         while (!queue.isEmpty()) {
-            PipelineTreeNode currentNode = queue.poll();
+            TreeNode currentNode = queue.poll();
             CuPipelineStep step = currentNode.getStep();
             Integer type = currentNode.getType();
             String input = currentNode.getInput() == null ? "" : currentNode.getInput();
@@ -130,7 +184,7 @@ public class PipelineServiceImpl implements PipelineService {
                 }
                 continue;
             }
-            for (PipelineTreeNode child : currentNode.getChildren()) {
+            for (TreeNode child : currentNode.getChildren()) {
                 child.setInput(result);
                 queue.offer(child);
             }

+ 4 - 3
content-understanding-core/src/main/resources/mybatis-generator-config.xml

@@ -46,9 +46,10 @@
             <property name="enableSubPackages" value="true"/>
         </javaClientGenerator>
 
-        <table tableName="cu_pipeline" domainObjectName="CuPipeline" alias=""/>
-        <table tableName="cu_pipeline_step" domainObjectName="CuPipelineStep" alias=""/>
-        <table tableName="cu_prompt" domainObjectName="CuPrompt" alias=""/>
+<!--        <table tableName="cu_pipeline" domainObjectName="CuPipeline" alias=""/>-->
+<!--        <table tableName="cu_pipeline_step" domainObjectName="CuPipelineStep" alias=""/>-->
+<!--        <table tableName="cu_prompt" domainObjectName="CuPrompt" alias=""/>-->
+        <table tableName="cu_task" domainObjectName="CuTask" alias=""/>
 
     </context>
 

+ 8 - 1
content-understanding-server/src/main/java/com/tzld/piaoquan/content/understanding/controller/ContentController.java

@@ -3,6 +3,7 @@ package com.tzld.piaoquan.content.understanding.controller;
 import com.tzld.piaoquan.content.understanding.common.base.CommonRequest;
 import com.tzld.piaoquan.content.understanding.common.base.CommonResponse;
 import com.tzld.piaoquan.content.understanding.model.param.ContentAnalyseParam;
+import com.tzld.piaoquan.content.understanding.model.param.ContentUnderstandParam;
 import com.tzld.piaoquan.content.understanding.service.ContentService;
 import com.tzld.piaoquan.content.understanding.service.PipelineService;
 import lombok.extern.slf4j.Slf4j;
@@ -13,7 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 /**
- * 降级
+ * 内容分析
  */
 @Slf4j
 @RestController
@@ -29,4 +30,10 @@ public class ContentController {
         return CommonResponse.create();
     }
 
+    @PostMapping(value = "/understand")
+    public CommonResponse<Void> understand(@RequestBody ContentUnderstandParam param) {
+        contentService.understand(param);
+        return CommonResponse.create();
+    }
+
 }

+ 38 - 0
content-understanding-server/src/main/java/com/tzld/piaoquan/content/understanding/controller/ContentUnderstandingController.java

@@ -0,0 +1,38 @@
+package com.tzld.piaoquan.content.understanding.controller;
+
+import com.tzld.piaoquan.content.understanding.common.base.CommonResponse;
+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.service.ContentService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 内容分析
+ */
+@Slf4j
+@RestController
+@RequestMapping("/content/understand")
+public class ContentUnderstandingController {
+
+    @Autowired
+    private ContentService contentService;
+
+    @PostMapping(value = "/submitTasks")
+    public CommonResponse<TaskResultDTO> submitTasks(@RequestBody ContentUnderstandParam param) {
+        contentService.submitTasks(param);
+        return CommonResponse.create();
+    }
+
+    @PostMapping(value = "/queryTasks")
+    public CommonResponse<TaskResultDTO> queryTasks(@RequestBody ContentUnderstandParam param) {
+        contentService.queryTasks(param);
+        return CommonResponse.create();
+    }
+
+}