allen 1 ano atrás
pai
commit
c40dd29ef7
22 arquivos alterados com 444 adições e 197 exclusões
  1. 5 0
      kgraph-admin/src/main/resources/application.yml
  2. 37 1
      kgraph-common/src/main/java/com/kgraph/common/utils/file/FileUtils.java
  3. 6 0
      kgraph-graph/src/main/java/com/kgraph/graph/controller/ProcessedFileController.java
  4. 9 0
      kgraph-graph/src/main/java/com/kgraph/graph/controller/SourceFileController.java
  5. 23 2
      kgraph-graph/src/main/java/com/kgraph/graph/domain/Task.java
  6. 2 0
      kgraph-graph/src/main/java/com/kgraph/graph/mapper/ProcessedFileMapper.java
  7. 4 0
      kgraph-graph/src/main/java/com/kgraph/graph/mapper/SourceFileMapper.java
  8. 2 0
      kgraph-graph/src/main/java/com/kgraph/graph/service/IProcessedFileService.java
  9. 4 0
      kgraph-graph/src/main/java/com/kgraph/graph/service/ISourceFileService.java
  10. 12 0
      kgraph-graph/src/main/java/com/kgraph/graph/service/impl/ProcessedFileServiceImpl.java
  11. 14 0
      kgraph-graph/src/main/java/com/kgraph/graph/service/impl/SourceFileServiceImpl.java
  12. 21 0
      kgraph-graph/src/main/java/com/kgraph/neo4j/domain/EntityClass.java
  13. 7 0
      kgraph-graph/src/main/java/com/kgraph/neo4j/service/IEntityClassService.java
  14. 10 0
      kgraph-graph/src/main/java/com/kgraph/neo4j/service/impl/EntityClassImpl.java
  15. 4 0
      kgraph-graph/src/main/resources/mapper/graph/ProcessedFileMapper.xml
  16. 4 0
      kgraph-graph/src/main/resources/mapper/graph/SourceFileMapper.xml
  17. 8 0
      kgraph-ui/src/api/graph/processedFile.js
  18. 9 0
      kgraph-ui/src/api/graph/sourceFile.js
  19. 78 61
      kgraph-ui/src/views/graph/processedFile/index.vue
  20. 57 57
      kgraph-ui/src/views/graph/sourceFile/index.vue
  21. 126 74
      kgraph-ui/src/views/graph/task/index.vue
  22. 2 2
      sql/ry_20230706.sql

+ 5 - 0
kgraph-admin/src/main/resources/application.yml

@@ -89,6 +89,11 @@ spring:
         max-active: 8
         # #连接池最大阻塞等待时间(使用负值表示没有限制)
         max-wait: -1ms
+  data:
+    neo4j:
+      uri: bolt://127.0.0.1:7687
+      username: neo4j
+      password: 123456
 
 # token配置
 token:

+ 37 - 1
kgraph-common/src/main/java/com/kgraph/common/utils/file/FileUtils.java

@@ -274,7 +274,7 @@ public class FileUtils
     }
 
     /**
-     * 获取不带后缀文件名称 /profile/upload/2022/04/16/ruoyi.png -- ruoyi
+     * 获取不带后缀文件名称 /profile/upload/2022/04/16/xxx_20220416xxxxxx.png -> xxx_20220416xxxxxx
      * 
      * @param fileName 路径名称
      * @return 没有文件路径和后缀的名称
@@ -288,4 +288,40 @@ public class FileUtils
         String baseName = FilenameUtils.getBaseName(fileName);
         return baseName;
     }
+
+    /**
+     * 获取后缀 /profile/upload/2022/04/16/xxx_20220416xxxxxx.png -> png
+     *
+     * @param fileName
+     * @return
+     */
+    public static String getSuffix(String fileName) {
+        String suffix = "";
+        String fullName = getName(fileName);
+        String[] fullNames = fullName.split("\\.");
+        if (fullNames.length >= 2) {
+            suffix = fullNames[fullNames.length - 1];
+        }
+        return suffix;
+    }
+
+    /**
+     * 获取真实的文件名 /profile/upload/2022/04/16/xxx_20220416xxxxxx.png -> xxx
+     *  20231112155240A001
+     *  123456789012345678 length = 18
+     *
+     * @param fileName
+     * @return
+     */
+    final static int dateLength= "20231112155240A001".length();
+    public static String getRealName(String filePath) {
+        String nameNotSuffix = getNameNotSuffix(filePath);
+        String realName = nameNotSuffix;
+        String[] names = nameNotSuffix.split("_");
+        if (names.length >= 2 && names[names.length - 1].length() == dateLength) {
+            realName = nameNotSuffix.substring(0, nameNotSuffix.length() - dateLength - 1);
+        }
+        return realName;
+    }
+
 }

+ 6 - 0
kgraph-graph/src/main/java/com/kgraph/graph/controller/ProcessedFileController.java

@@ -101,4 +101,10 @@ public class ProcessedFileController extends BaseController
     {
         return toAjax(processedFileService.deleteProcessedFileByIds(ids));
     }
+
+    @GetMapping("/getOptionsBySourceFileId/{id}")
+    public AjaxResult getOptionsBySourceFileId(@PathVariable Long id)
+    {
+        return success(processedFileService.getOptionsBySourceFileId(id));
+    }
 }

+ 9 - 0
kgraph-graph/src/main/java/com/kgraph/graph/controller/SourceFileController.java

@@ -101,4 +101,13 @@ public class SourceFileController extends BaseController
     {
         return toAjax(sourceFileService.deleteSourceFileByIds(ids));
     }
+
+    /**
+     * 获取源文件的Option(id,name)
+     */
+    @GetMapping("/getOptions")
+    public AjaxResult getOptions()
+    {
+        return success(sourceFileService.getOptions());
+    }
 }

+ 23 - 2
kgraph-graph/src/main/java/com/kgraph/graph/domain/Task.java

@@ -1,5 +1,6 @@
 package com.kgraph.graph.domain;
 
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.kgraph.common.annotation.Excel;
@@ -19,17 +20,21 @@ public class Task extends BaseEntity
     private Long id;
 
     /** 源文件id */
-    @Excel(name = "源文件id")
+    @Excel(name = "任务名称")
     private String taskName;
 
     /** 任务名称 */
-    @Excel(name = "任务名称")
+    @Excel(name = "任务类型")
     private String taskType;
 
     /** 子任务 */
     @Excel(name = "子任务")
     private String subtask;
 
+    /** 使用subtask */
+    @Deprecated
+    private String subtaskArray;
+
     /** 任务状态 */
     @Excel(name = "任务状态")
     private String taskStatus;
@@ -106,6 +111,22 @@ public class Task extends BaseEntity
         return relateProcessedFileId;
     }
 
+    public String[] getSubtaskArray() {
+        if (StringUtils.isNotEmpty(subtask)) {
+            return subtask.split(",");
+        } else {
+            return new String[0];
+        }
+    }
+
+    public void setSubtaskArray(String[] subtaskArray) {
+        if (subtaskArray != null) {
+            subtask = String.join(",", subtaskArray);
+        } else {
+            subtask = "";
+        }
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 2 - 0
kgraph-graph/src/main/java/com/kgraph/graph/mapper/ProcessedFileMapper.java

@@ -58,4 +58,6 @@ public interface ProcessedFileMapper
      * @return 结果
      */
     public int deleteProcessedFileByIds(Long[] ids);
+
+    List getOptionsBySourceFileId(Long id);
 }

+ 4 - 0
kgraph-graph/src/main/java/com/kgraph/graph/mapper/SourceFileMapper.java

@@ -1,6 +1,8 @@
 package com.kgraph.graph.mapper;
 
 import java.util.List;
+import java.util.Map;
+
 import com.kgraph.graph.domain.SourceFile;
 
 /**
@@ -58,4 +60,6 @@ public interface SourceFileMapper
      * @return 结果
      */
     public int deleteSourceFileByIds(Long[] ids);
+
+    List getOptions();
 }

+ 2 - 0
kgraph-graph/src/main/java/com/kgraph/graph/service/IProcessedFileService.java

@@ -58,4 +58,6 @@ public interface IProcessedFileService
      * @return 结果
      */
     public int deleteProcessedFileById(Long id);
+
+    List getOptionsBySourceFileId(Long id);
 }

+ 4 - 0
kgraph-graph/src/main/java/com/kgraph/graph/service/ISourceFileService.java

@@ -1,6 +1,8 @@
 package com.kgraph.graph.service;
 
 import java.util.List;
+import java.util.Map;
+
 import com.kgraph.graph.domain.SourceFile;
 
 /**
@@ -58,4 +60,6 @@ public interface ISourceFileService
      * @return 结果
      */
     public int deleteSourceFileById(Long id);
+
+    List getOptions();
 }

+ 12 - 0
kgraph-graph/src/main/java/com/kgraph/graph/service/impl/ProcessedFileServiceImpl.java

@@ -2,6 +2,8 @@ package com.kgraph.graph.service.impl;
 
 import java.util.List;
 import com.kgraph.common.utils.DateUtils;
+import com.kgraph.common.utils.file.FileUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.kgraph.graph.mapper.ProcessedFileMapper;
@@ -54,6 +56,10 @@ public class ProcessedFileServiceImpl implements IProcessedFileService
     public int insertProcessedFile(ProcessedFile processedFile)
     {
         processedFile.setCreateTime(DateUtils.getNowDate());
+        if(StringUtils.isEmpty(processedFile.getProcessedFileName()) && StringUtils.isNotEmpty(processedFile.getProcessedFilePath())){
+            processedFile.setProcessedFileName(FileUtils.getRealName(processedFile.getProcessedFilePath()));
+        }
+        processedFile.setProcessedFileType(FileUtils.getSuffix(processedFile.getProcessedFilePath()));
         return processedFileMapper.insertProcessedFile(processedFile);
     }
 
@@ -67,6 +73,7 @@ public class ProcessedFileServiceImpl implements IProcessedFileService
     public int updateProcessedFile(ProcessedFile processedFile)
     {
         processedFile.setUpdateTime(DateUtils.getNowDate());
+        processedFile.setProcessedFileType(FileUtils.getSuffix(processedFile.getProcessedFilePath()));
         return processedFileMapper.updateProcessedFile(processedFile);
     }
 
@@ -93,4 +100,9 @@ public class ProcessedFileServiceImpl implements IProcessedFileService
     {
         return processedFileMapper.deleteProcessedFileById(id);
     }
+
+    @Override
+    public List getOptionsBySourceFileId(Long id) {
+        return processedFileMapper.getOptionsBySourceFileId(id);
+    }
 }

+ 14 - 0
kgraph-graph/src/main/java/com/kgraph/graph/service/impl/SourceFileServiceImpl.java

@@ -1,7 +1,11 @@
 package com.kgraph.graph.service.impl;
 
 import java.util.List;
+import java.util.Map;
+
 import com.kgraph.common.utils.DateUtils;
+import com.kgraph.common.utils.file.FileUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.kgraph.graph.mapper.SourceFileMapper;
@@ -54,6 +58,10 @@ public class SourceFileServiceImpl implements ISourceFileService
     public int insertSourceFile(SourceFile sourceFile)
     {
         sourceFile.setCreateTime(DateUtils.getNowDate());
+        if(StringUtils.isEmpty(sourceFile.getSourceFileName()) && StringUtils.isNotEmpty(sourceFile.getSourceFilePath())){
+            sourceFile.setSourceFileName(FileUtils.getRealName(sourceFile.getSourceFilePath()));
+        }
+        sourceFile.setSourceFileType(FileUtils.getSuffix(sourceFile.getSourceFilePath()));
         return sourceFileMapper.insertSourceFile(sourceFile);
     }
 
@@ -67,6 +75,7 @@ public class SourceFileServiceImpl implements ISourceFileService
     public int updateSourceFile(SourceFile sourceFile)
     {
         sourceFile.setUpdateTime(DateUtils.getNowDate());
+        sourceFile.setSourceFileType(FileUtils.getSuffix(sourceFile.getSourceFilePath()));
         return sourceFileMapper.updateSourceFile(sourceFile);
     }
 
@@ -93,4 +102,9 @@ public class SourceFileServiceImpl implements ISourceFileService
     {
         return sourceFileMapper.deleteSourceFileById(id);
     }
+
+    @Override
+    public List getOptions() {
+        return sourceFileMapper.getOptions();
+    }
 }

+ 21 - 0
kgraph-graph/src/main/java/com/kgraph/neo4j/domain/EntityClass.java

@@ -0,0 +1,21 @@
+package com.kgraph.neo4j.domain;
+
+import org.springframework.data.neo4j.core.schema.Id;
+import org.springframework.data.neo4j.core.schema.Node;
+import org.springframework.data.neo4j.core.schema.Property;
+
+import java.util.Map;
+
+/**
+ * @author Allen
+ * @date 2023
+ */
+@Node
+public class EntityClass
+{
+    @Id
+    private Long id;
+
+    @Property
+    private Map<String, Object> dynamicProperties;
+}

+ 7 - 0
kgraph-graph/src/main/java/com/kgraph/neo4j/service/IEntityClassService.java

@@ -0,0 +1,7 @@
+package com.kgraph.neo4j.service;
+
+import org.springframework.stereotype.Service;
+
+@Service
+public interface IEntityClassService {
+}

+ 10 - 0
kgraph-graph/src/main/java/com/kgraph/neo4j/service/impl/EntityClassImpl.java

@@ -0,0 +1,10 @@
+package com.kgraph.neo4j.service.impl;
+
+import com.kgraph.neo4j.service.IEntityClassService;
+import org.springframework.stereotype.Service;
+
+@Service
+public class EntityClassImpl implements IEntityClassService {
+
+    
+}

+ 4 - 0
kgraph-graph/src/main/resources/mapper/graph/ProcessedFileMapper.xml

@@ -89,4 +89,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </delete>
+
+    <select id="getOptionsBySourceFileId" parameterType="Long" resultType="Map">
+        select id, processed_file_name as name from biz_processed_file where source_file_id = #{id} order by create_time desc
+    </select>
 </mapper>

+ 4 - 0
kgraph-graph/src/main/resources/mapper/graph/SourceFileMapper.xml

@@ -79,4 +79,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </delete>
+
+    <select id="getOptions" resultType="Map">
+        select id, source_file_name as name from biz_source_file order by create_time desc
+    </select>
 </mapper>

+ 8 - 0
kgraph-ui/src/api/graph/processedFile.js

@@ -42,3 +42,11 @@ export function delProcessedFile(id) {
     method: 'delete'
   })
 }
+
+// 获取id,name的option
+export function getOptionsBySourceFileId(id) {
+  return request({
+    url: '/graph/processedFile/getOptionsBySourceFileId/' + id,
+    method: 'get'
+  })
+}

+ 9 - 0
kgraph-ui/src/api/graph/sourceFile.js

@@ -42,3 +42,12 @@ export function delSourceFile(id) {
     method: 'delete'
   })
 }
+
+// 获取id,name的option
+export function getSourceFileOptions() {
+  return request({
+    url: '/graph/sourceFile/getOptions',
+    method: 'get'
+  })
+}
+

+ 78 - 61
kgraph-ui/src/views/graph/processedFile/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item label="源文件id" prop="sourceFileId">
+    <el-form v-show="showSearch" ref="queryForm" :model="queryParams" size="small" :inline="true" label-width="100px">
+      <el-form-item label="源文件" prop="sourceFileId">
         <el-input
           v-model="queryParams.sourceFileId"
           placeholder="请输入源文件id"
@@ -34,47 +34,47 @@
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
         <el-button
+          v-hasPermi="['graph:processedFile:add']"
           type="primary"
           plain
           icon="el-icon-plus"
           size="mini"
           @click="handleAdd"
-          v-hasPermi="['graph:processedFile:add']"
         >新增</el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-hasPermi="['graph:processedFile:edit']"
           type="success"
           plain
           icon="el-icon-edit"
           size="mini"
           :disabled="single"
           @click="handleUpdate"
-          v-hasPermi="['graph:processedFile:edit']"
         >修改</el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-hasPermi="['graph:processedFile:remove']"
           type="danger"
           plain
           icon="el-icon-delete"
           size="mini"
           :disabled="multiple"
           @click="handleDelete"
-          v-hasPermi="['graph:processedFile:remove']"
         >删除</el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-hasPermi="['graph:processedFile:export']"
           type="warning"
           plain
           icon="el-icon-download"
           size="mini"
           @click="handleExport"
-          v-hasPermi="['graph:processedFile:export']"
         >导出</el-button>
       </el-col>
-      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+      <right-toolbar :show-search.sync="showSearch" @queryTable="getList" />
     </el-row>
 
     <el-table v-loading="loading" :data="processedFileList" @selection-change="handleSelectionChange">
@@ -88,23 +88,23 @@
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
+            v-hasPermi="['graph:processedFile:edit']"
             size="mini"
             type="text"
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
-            v-hasPermi="['graph:processedFile:edit']"
           >修改</el-button>
           <el-button
+            v-hasPermi="['graph:processedFile:remove']"
             size="mini"
             type="text"
             icon="el-icon-delete"
             @click="handleDelete(scope.row)"
-            v-hasPermi="['graph:processedFile:remove']"
           >删除</el-button>
         </template>
       </el-table-column>
     </el-table>
-    
+
     <pagination
       v-show="total>0"
       :total="total"
@@ -114,19 +114,26 @@
     />
 
     <!-- 添加或修改处理文件管理对话框 -->
-    <el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="500px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+    <el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="700px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
         <el-form-item label="源文件id" prop="sourceFileId">
-          <el-input v-model="form.sourceFileId" placeholder="请输入源文件id" />
+          <el-select v-model="form.sourceFileId" placeholder="请选择源文件">
+            <el-option
+              v-for="item in sourceFileOptions"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id"
+            />
+          </el-select>
         </el-form-item>
         <el-form-item label="处理文件名称" prop="processedFileName">
           <el-input v-model="form.processedFileName" placeholder="请输入处理文件名称" />
         </el-form-item>
         <el-form-item label="文件编号" prop="num">
-          <el-input v-model="form.num" placeholder="请输入文件编号" />
+          <el-input-number v-model="form.num" placeholder="请输入文件编号" />
         </el-form-item>
         <el-form-item label="处理文件路径" prop="processedFilePath">
-          <el-input v-model="form.processedFilePath" type="textarea" placeholder="请输入内容" />
+          <file-upload v-model="form.processedFilePath" />
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
@@ -138,10 +145,10 @@
 </template>
 
 <script>
-import { listProcessedFile, getProcessedFile, delProcessedFile, addProcessedFile, updateProcessedFile } from "@/api/graph/processedFile";
-
+import { listProcessedFile, getProcessedFile, delProcessedFile, addProcessedFile, updateProcessedFile } from '@/api/graph/processedFile'
+import { getSourceFileOptions } from '@/api/graph/sourceFile'
 export default {
-  name: "ProcessedFile",
+  name: 'ProcessedFile',
   data() {
     return {
       // 遮罩层
@@ -159,7 +166,7 @@ export default {
       // 处理文件管理表格数据
       processedFileList: [],
       // 弹出层标题
-      title: "",
+      title: '',
       // 是否显示弹出层
       open: false,
       // 查询参数
@@ -170,32 +177,42 @@ export default {
         processedFileName: null,
         num: null,
         processedFileType: null,
-        processedFilePath: null,
+        processedFilePath: null
       },
       // 表单参数
       form: {},
       // 表单校验
       rules: {
-      }
-    };
+      },
+      sourceFileOptions: []
+    }
   },
   created() {
-    this.getList();
+    this.getList()
+    this.getOption()
+  },
+  activated() {
+    this.getOption()
   },
   methods: {
+    getOption() {
+      getSourceFileOptions().then(resp => {
+        this.sourceFileOptions = resp.data
+      })
+    },
     /** 查询处理文件管理列表 */
     getList() {
-      this.loading = true;
+      this.loading = true
       listProcessedFile(this.queryParams).then(response => {
-        this.processedFileList = response.rows;
-        this.total = response.total;
-        this.loading = false;
-      });
+        this.processedFileList = response.rows
+        this.total = response.total
+        this.loading = false
+      })
     },
     // 取消按钮
     cancel() {
-      this.open = false;
-      this.reset();
+      this.open = false
+      this.reset()
     },
     // 表单重置
     reset() {
@@ -210,70 +227,70 @@ export default {
         createTime: null,
         updateBy: null,
         updateTime: null
-      };
-      this.resetForm("form");
+      }
+      this.resetForm('form')
     },
     /** 搜索按钮操作 */
     handleQuery() {
-      this.queryParams.pageNum = 1;
-      this.getList();
+      this.queryParams.pageNum = 1
+      this.getList()
     },
     /** 重置按钮操作 */
     resetQuery() {
-      this.resetForm("queryForm");
-      this.handleQuery();
+      this.resetForm('queryForm')
+      this.handleQuery()
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
       this.ids = selection.map(item => item.id)
-      this.single = selection.length!==1
+      this.single = selection.length !== 1
       this.multiple = !selection.length
     },
     /** 新增按钮操作 */
     handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "添加处理文件管理";
+      this.reset()
+      this.open = true
+      this.title = '添加处理文件管理'
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
-      this.reset();
+      this.reset()
       const id = row.id || this.ids
       getProcessedFile(id).then(response => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改处理文件管理";
-      });
+        this.form = response.data
+        this.open = true
+        this.title = '修改处理文件管理'
+      })
     },
     /** 提交按钮 */
     submitForm() {
-      this.$refs["form"].validate(valid => {
+      this.$refs['form'].validate(valid => {
         if (valid) {
           if (this.form.id != null) {
             updateProcessedFile(this.form).then(response => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
+              this.$modal.msgSuccess('修改成功')
+              this.open = false
+              this.getList()
+            })
           } else {
             addProcessedFile(this.form).then(response => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
+              this.$modal.msgSuccess('新增成功')
+              this.open = false
+              this.getList()
+            })
           }
         }
-      });
+      })
     },
     /** 删除按钮操作 */
     handleDelete(row) {
-      const ids = row.id || this.ids;
+      const ids = row.id || this.ids
       this.$modal.confirm('是否确认删除处理文件管理编号为"' + ids + '"的数据项?').then(function() {
-        return delProcessedFile(ids);
+        return delProcessedFile(ids)
       }).then(() => {
-        this.getList();
-        this.$modal.msgSuccess("删除成功");
-      }).catch(() => {});
+        this.getList()
+        this.$modal.msgSuccess('删除成功')
+      }).catch(() => {})
     },
     /** 导出按钮操作 */
     handleExport() {
@@ -282,5 +299,5 @@ export default {
       }, `processedFile_${new Date().getTime()}.xlsx`)
     }
   }
-};
+}
 </script>

+ 57 - 57
kgraph-ui/src/views/graph/sourceFile/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+    <el-form v-show="showSearch" ref="queryForm" :model="queryParams" size="small" :inline="true" label-width="68px">
       <el-form-item label="源文件名称" prop="sourceFileName">
         <el-input
           v-model="queryParams.sourceFileName"
@@ -18,47 +18,47 @@
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
         <el-button
+          v-hasPermi="['graph:sourceFile:add']"
           type="primary"
           plain
           icon="el-icon-plus"
           size="mini"
           @click="handleAdd"
-          v-hasPermi="['graph:sourceFile:add']"
         >新增</el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-hasPermi="['graph:sourceFile:edit']"
           type="success"
           plain
           icon="el-icon-edit"
           size="mini"
           :disabled="single"
           @click="handleUpdate"
-          v-hasPermi="['graph:sourceFile:edit']"
         >修改</el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-hasPermi="['graph:sourceFile:remove']"
           type="danger"
           plain
           icon="el-icon-delete"
           size="mini"
           :disabled="multiple"
           @click="handleDelete"
-          v-hasPermi="['graph:sourceFile:remove']"
         >删除</el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-hasPermi="['graph:sourceFile:export']"
           type="warning"
           plain
           icon="el-icon-download"
           size="mini"
           @click="handleExport"
-          v-hasPermi="['graph:sourceFile:export']"
         >导出</el-button>
       </el-col>
-      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+      <right-toolbar :show-search.sync="showSearch" @queryTable="getList" />
     </el-row>
 
     <el-table v-loading="loading" :data="sourceFileList" @selection-change="handleSelectionChange">
@@ -70,23 +70,23 @@
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
+            v-hasPermi="['graph:sourceFile:edit']"
             size="mini"
             type="text"
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
-            v-hasPermi="['graph:sourceFile:edit']"
           >修改</el-button>
           <el-button
+            v-hasPermi="['graph:sourceFile:remove']"
             size="mini"
             type="text"
             icon="el-icon-delete"
             @click="handleDelete(scope.row)"
-            v-hasPermi="['graph:sourceFile:remove']"
           >删除</el-button>
         </template>
       </el-table-column>
     </el-table>
-    
+
     <pagination
       v-show="total>0"
       :total="total"
@@ -96,13 +96,13 @@
     />
 
     <!-- 添加或修改源文件管理对话框 -->
-    <el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="500px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+    <el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="700px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
         <el-form-item label="源文件名称" prop="sourceFileName">
-          <el-input v-model="form.sourceFileName" placeholder="请输入源文件名称" />
+          <el-input v-model="form.sourceFileName" placeholder="可自动根据上传文件名填充" />
         </el-form-item>
         <el-form-item label="源文件路径" prop="sourceFilePath">
-          <el-input v-model="form.sourceFilePath" type="textarea" placeholder="请输入内容" />
+          <file-upload v-model="form.sourceFilePath" />
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
@@ -114,10 +114,10 @@
 </template>
 
 <script>
-import { listSourceFile, getSourceFile, delSourceFile, addSourceFile, updateSourceFile } from "@/api/graph/sourceFile";
+import { listSourceFile, getSourceFile, delSourceFile, addSourceFile, updateSourceFile } from '@/api/graph/sourceFile'
 
 export default {
-  name: "SourceFile",
+  name: 'SourceFile',
   data() {
     return {
       // 遮罩层
@@ -135,7 +135,7 @@ export default {
       // 源文件管理表格数据
       sourceFileList: [],
       // 弹出层标题
-      title: "",
+      title: '',
       // 是否显示弹出层
       open: false,
       // 查询参数
@@ -144,32 +144,32 @@ export default {
         pageSize: 10,
         sourceFileName: null,
         sourceFileType: null,
-        sourceFilePath: null,
+        sourceFilePath: null
       },
       // 表单参数
       form: {},
       // 表单校验
       rules: {
       }
-    };
+    }
   },
   created() {
-    this.getList();
+    this.getList()
   },
   methods: {
     /** 查询源文件管理列表 */
     getList() {
-      this.loading = true;
+      this.loading = true
       listSourceFile(this.queryParams).then(response => {
-        this.sourceFileList = response.rows;
-        this.total = response.total;
-        this.loading = false;
-      });
+        this.sourceFileList = response.rows
+        this.total = response.total
+        this.loading = false
+      })
     },
     // 取消按钮
     cancel() {
-      this.open = false;
-      this.reset();
+      this.open = false
+      this.reset()
     },
     // 表单重置
     reset() {
@@ -182,70 +182,70 @@ export default {
         createTime: null,
         updateBy: null,
         updateTime: null
-      };
-      this.resetForm("form");
+      }
+      this.resetForm('form')
     },
     /** 搜索按钮操作 */
     handleQuery() {
-      this.queryParams.pageNum = 1;
-      this.getList();
+      this.queryParams.pageNum = 1
+      this.getList()
     },
     /** 重置按钮操作 */
     resetQuery() {
-      this.resetForm("queryForm");
-      this.handleQuery();
+      this.resetForm('queryForm')
+      this.handleQuery()
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
       this.ids = selection.map(item => item.id)
-      this.single = selection.length!==1
+      this.single = selection.length !== 1
       this.multiple = !selection.length
     },
     /** 新增按钮操作 */
     handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "添加源文件管理";
+      this.reset()
+      this.open = true
+      this.title = '添加源文件管理'
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
-      this.reset();
+      this.reset()
       const id = row.id || this.ids
       getSourceFile(id).then(response => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改源文件管理";
-      });
+        this.form = response.data
+        this.open = true
+        this.title = '修改源文件管理'
+      })
     },
     /** 提交按钮 */
     submitForm() {
-      this.$refs["form"].validate(valid => {
+      this.$refs['form'].validate(valid => {
         if (valid) {
           if (this.form.id != null) {
             updateSourceFile(this.form).then(response => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
+              this.$modal.msgSuccess('修改成功')
+              this.open = false
+              this.getList()
+            })
           } else {
             addSourceFile(this.form).then(response => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
+              this.$modal.msgSuccess('新增成功')
+              this.open = false
+              this.getList()
+            })
           }
         }
-      });
+      })
     },
     /** 删除按钮操作 */
     handleDelete(row) {
-      const ids = row.id || this.ids;
+      const ids = row.id || this.ids
       this.$modal.confirm('是否确认删除源文件管理编号为"' + ids + '"的数据项?').then(function() {
-        return delSourceFile(ids);
+        return delSourceFile(ids)
       }).then(() => {
-        this.getList();
-        this.$modal.msgSuccess("删除成功");
-      }).catch(() => {});
+        this.getList()
+        this.$modal.msgSuccess('删除成功')
+      }).catch(() => {})
     },
     /** 导出按钮操作 */
     handleExport() {
@@ -254,5 +254,5 @@ export default {
       }, `sourceFile_${new Date().getTime()}.xlsx`)
     }
   }
-};
+}
 </script>

+ 126 - 74
kgraph-ui/src/views/graph/task/index.vue

@@ -1,10 +1,10 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item label="源文件id" prop="taskName">
+    <el-form v-show="showSearch" ref="queryForm" :model="queryParams" size="small" :inline="true" label-width="68px">
+      <el-form-item label="任务名称" prop="taskName">
         <el-input
           v-model="queryParams.taskName"
-          placeholder="请输入源文件id"
+          placeholder="请输入任务名称"
           clearable
           @keyup.enter.native="handleQuery"
         />
@@ -17,7 +17,7 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item label="源文件id" prop="relateSourceFileId">
+      <!-- <el-form-item label="源文件id" prop="relateSourceFileId">
         <el-input
           v-model="queryParams.relateSourceFileId"
           placeholder="请输入源文件id"
@@ -32,7 +32,7 @@
           clearable
           @keyup.enter.native="handleQuery"
         />
-      </el-form-item>
+      </el-form-item> -->
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@@ -42,54 +42,54 @@
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
         <el-button
+          v-hasPermi="['graph:task:add']"
           type="primary"
           plain
           icon="el-icon-plus"
           size="mini"
           @click="handleAdd"
-          v-hasPermi="['graph:task:add']"
         >新增</el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-hasPermi="['graph:task:edit']"
           type="success"
           plain
           icon="el-icon-edit"
           size="mini"
           :disabled="single"
           @click="handleUpdate"
-          v-hasPermi="['graph:task:edit']"
         >修改</el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-hasPermi="['graph:task:remove']"
           type="danger"
           plain
           icon="el-icon-delete"
           size="mini"
           :disabled="multiple"
           @click="handleDelete"
-          v-hasPermi="['graph:task:remove']"
         >删除</el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-hasPermi="['graph:task:export']"
           type="warning"
           plain
           icon="el-icon-download"
           size="mini"
           @click="handleExport"
-          v-hasPermi="['graph:task:export']"
         >导出</el-button>
       </el-col>
-      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+      <right-toolbar :show-search.sync="showSearch" @queryTable="getList" />
     </el-row>
 
     <el-table v-loading="loading" :data="taskList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="id" align="center" prop="id" />
-      <el-table-column label="源文件id" align="center" prop="taskName" />
-      <el-table-column label="任务名称" align="center" prop="taskType" />
+      <el-table-column label="任务名称" align="center" prop="taskName" />
+      <el-table-column label="任务类型" align="center" prop="taskType" />
       <el-table-column label="子任务" align="center" prop="subtask" />
       <el-table-column label="任务状态" align="center" prop="taskStatus" />
       <el-table-column label="源文件id" align="center" prop="relateSourceFileId" />
@@ -98,23 +98,23 @@
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
+            v-hasPermi="['graph:task:edit']"
             size="mini"
             type="text"
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
-            v-hasPermi="['graph:task:edit']"
           >修改</el-button>
           <el-button
+            v-hasPermi="['graph:task:remove']"
             size="mini"
             type="text"
             icon="el-icon-delete"
             @click="handleDelete(scope.row)"
-            v-hasPermi="['graph:task:remove']"
           >删除</el-button>
         </template>
       </el-table-column>
     </el-table>
-    
+
     <pagination
       v-show="total>0"
       :total="total"
@@ -124,22 +124,48 @@
     />
 
     <!-- 添加或修改任务管理对话框 -->
-    <el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="500px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="源文件id" prop="taskName">
-          <el-input v-model="form.taskName" placeholder="请输入源文件id" />
+    <el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="700px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
+        <el-form-item label="任务名称" prop="taskName">
+          <el-input v-model="form.taskName" placeholder="请输入任务名称" />
         </el-form-item>
-        <el-form-item label="子任务" prop="subtask">
-          <el-input v-model="form.subtask" placeholder="请输入子任务" />
+        <el-form-item label="任务类型" prop="taskType">
+          <!-- <el-input v-model="form.taskType" placeholder="请输入任务类型" /> -->
+          <el-radio v-model="form.taskType" label="1" @change="taskTypeChange">数据处理</el-radio>
+          <el-radio v-model="form.taskType" label="2" @change="taskTypeChange">知识抽取</el-radio>
         </el-form-item>
-        <el-form-item label="源文件id" prop="relateSourceFileId">
-          <el-input v-model="form.relateSourceFileId" placeholder="请输入源文件id" />
+        <el-form-item label="子任务" prop="subtaskArray">
+          <el-checkbox-group v-model="form.subtaskArray">
+            <template v-if="form.taskType==='1'">
+              <el-checkbox v-for="dict in dict.type.biz_data_process" :key="dict.value" :label="dict.value"> {{ dict.label }}</el-checkbox>
+            </template>
+            <template v-else>
+              <el-checkbox v-for="dict in dict.type.biz_kg_build" :key="dict.value" :label="dict.value"> {{ dict.label }}</el-checkbox>
+            </template>
+          </el-checkbox-group>
         </el-form-item>
-        <el-form-item label="处理文件id" prop="relateProcessedFileId">
-          <el-input v-model="form.relateProcessedFileId" placeholder="请输入处理文件id" />
+        <el-form-item label="源文件" prop="relateSourceFileId">
+          <el-select v-model="form.relateSourceFileId" placeholder="请选择源文件" @change="relateSourceFileIdChange">
+            <el-option
+              v-for="item in sourceFileOptions"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="处理文件" prop="relateProcessedFileId">
+          <el-select v-model="form.relateProcessedFileId" placeholder="请选择处理文件">
+            <el-option
+              v-for="item in relateProcessedFileOptions"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id"
+            />
+          </el-select>
         </el-form-item>
         <el-form-item label="备注" prop="remark">
-          <el-input v-model="form.remark" placeholder="请输入备注" />
+          <el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
@@ -151,10 +177,12 @@
 </template>
 
 <script>
-import { listTask, getTask, delTask, addTask, updateTask } from "@/api/graph/task";
-
+import { listTask, getTask, delTask, addTask, updateTask } from '@/api/graph/task'
+import { getSourceFileOptions } from '@/api/graph/sourceFile'
+import { getOptionsBySourceFileId } from '@/api/graph/processedFile'
 export default {
-  name: "Task",
+  name: 'Task',
+  dicts: ['biz_data_process', 'biz_kg_build'],
   data() {
     return {
       // 遮罩层
@@ -172,7 +200,7 @@ export default {
       // 任务管理表格数据
       taskList: [],
       // 弹出层标题
-      title: "",
+      title: '',
       // 是否显示弹出层
       open: false,
       // 查询参数
@@ -180,44 +208,62 @@ export default {
         pageNum: 1,
         pageSize: 10,
         taskName: null,
-        taskType: null,
+        taskType: '1',
         subtask: null,
+        subtaskArray: [],
         taskStatus: null,
         relateSourceFileId: null,
-        relateProcessedFileId: null,
+        relateProcessedFileId: null
       },
       // 表单参数
       form: {},
       // 表单校验
       rules: {
-      }
-    };
+      },
+      sourceFileOptions: [],
+      relateProcessedFileOptions: []
+    }
   },
   created() {
-    this.getList();
+    this.getList()
+    this.getOptions()
   },
   methods: {
+    getOptions() {
+      getSourceFileOptions().then(resp => {
+        this.sourceFileOptions = resp.data
+      })
+    },
+    getOptionsBySourceFileId(id) {
+      getOptionsBySourceFileId(id).then(resp => {
+        this.relateProcessedFileOptions = resp.data
+      })
+    },
+    relateSourceFileIdChange() {
+      this.getOptionsBySourceFileId(this.form.relateSourceFileId)
+    },
     /** 查询任务管理列表 */
     getList() {
-      this.loading = true;
+      this.loading = true
       listTask(this.queryParams).then(response => {
-        this.taskList = response.rows;
-        this.total = response.total;
-        this.loading = false;
-      });
+        this.taskList = response.rows
+        this.total = response.total
+        this.loading = false
+      })
     },
     // 取消按钮
     cancel() {
-      this.open = false;
-      this.reset();
+      this.open = false
+      this.reset()
     },
     // 表单重置
     reset() {
       this.form = {
         id: null,
         taskName: null,
-        taskType: null,
+        taskType: '1',
         subtask: null,
+        subtaskArray: [],
         taskStatus: null,
         relateSourceFileId: null,
         relateProcessedFileId: null,
@@ -226,77 +272,83 @@ export default {
         createTime: null,
         updateBy: null,
         updateTime: null
-      };
-      this.resetForm("form");
+      }
+      this.resetForm('form')
+      this.relateProcessedFileOptions = []
     },
     /** 搜索按钮操作 */
     handleQuery() {
-      this.queryParams.pageNum = 1;
-      this.getList();
+      this.queryParams.pageNum = 1
+      this.getList()
     },
     /** 重置按钮操作 */
     resetQuery() {
-      this.resetForm("queryForm");
-      this.handleQuery();
+      this.resetForm('queryForm')
+      this.handleQuery()
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
       this.ids = selection.map(item => item.id)
-      this.single = selection.length!==1
+      this.single = selection.length !== 1
       this.multiple = !selection.length
     },
     /** 新增按钮操作 */
     handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "添加任务管理";
+      this.reset()
+      this.open = true
+      this.title = '添加任务管理'
+      this.taskTypeChange()
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
-      this.reset();
+      this.reset()
       const id = row.id || this.ids
       getTask(id).then(response => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改任务管理";
-      });
+        this.form = response.data
+        this.open = true
+        this.title = '修改任务管理'
+        this.getOptionsBySourceFileId(this.form.relateSourceFileId)
+      })
     },
     /** 提交按钮 */
     submitForm() {
-      this.$refs["form"].validate(valid => {
+      this.$refs['form'].validate(valid => {
         if (valid) {
           if (this.form.id != null) {
             updateTask(this.form).then(response => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
+              this.$modal.msgSuccess('修改成功')
+              this.open = false
+              this.getList()
+            })
           } else {
             addTask(this.form).then(response => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
+              this.$modal.msgSuccess('新增成功')
+              this.open = false
+              this.getList()
+            })
           }
         }
-      });
+      })
     },
     /** 删除按钮操作 */
     handleDelete(row) {
-      const ids = row.id || this.ids;
+      const ids = row.id || this.ids
       this.$modal.confirm('是否确认删除任务管理编号为"' + ids + '"的数据项?').then(function() {
-        return delTask(ids);
+        return delTask(ids)
       }).then(() => {
-        this.getList();
-        this.$modal.msgSuccess("删除成功");
-      }).catch(() => {});
+        this.getList()
+        this.$modal.msgSuccess('删除成功')
+      }).catch(() => {})
     },
     /** 导出按钮操作 */
     handleExport() {
       this.download('graph/task/export', {
         ...this.queryParams
       }, `task_${new Date().getTime()}.xlsx`)
+    },
+    taskTypeChange() {
+      this.form.subtask = ''
     }
   }
-};
+}
 </script>

+ 2 - 2
sql/ry_20230706.sql

@@ -734,8 +734,8 @@ IF
 	EXISTS biz_task;
 CREATE TABLE biz_task (
 	id BIGINT ( 20 ) NOT NULL auto_increment COMMENT 'id',
-	task_name VARCHAR ( 200 ) COMMENT '源文件id',
-	task_type VARCHAR ( 200 ) DEFAULT '' COMMENT '任务名称',
+	task_name VARCHAR ( 200 ) COMMENT '任务名称',
+	task_type VARCHAR ( 200 ) DEFAULT '' COMMENT '任务类型',
 	subtask VARCHAR ( 64 ) DEFAULT '' COMMENT '子任务',
 	task_status VARCHAR ( 10 ) DEFAULT '' COMMENT '任务状态',
 	relate_source_file_id BIGINT ( 20 ) COMMENT '源文件id',