twzydn20000928 hace 1 año
padre
commit
80e3ed71c0
Se han modificado 24 ficheros con 406 adiciones y 137 borrados
  1. 21 0
      pdaaphm-admin/src/main/java/com/pdaaphm/biz/controller/AlgorithmController.java
  2. 8 2
      pdaaphm-admin/src/main/java/com/pdaaphm/biz/controller/AlgorithmIoFieldController.java
  3. 4 1
      pdaaphm-admin/src/main/java/com/pdaaphm/biz/controller/FileController.java
  4. 6 82
      pdaaphm-admin/src/main/java/com/pdaaphm/biz/domain/Algorithm.java
  5. 60 0
      pdaaphm-admin/src/main/java/com/pdaaphm/biz/dto/AlgorithmDTO.java
  6. 44 0
      pdaaphm-admin/src/main/java/com/pdaaphm/biz/dto/SubAlgorithmDTO.java
  7. 2 1
      pdaaphm-admin/src/main/java/com/pdaaphm/biz/mapper/AlgorithmIoFieldMapper.java
  8. 1 0
      pdaaphm-admin/src/main/java/com/pdaaphm/biz/mapper/AlgorithmMapper.java
  9. 4 0
      pdaaphm-admin/src/main/java/com/pdaaphm/biz/mapper/FileMapper.java
  10. 2 1
      pdaaphm-admin/src/main/java/com/pdaaphm/biz/service/IAlgorithmIoFieldService.java
  11. 18 1
      pdaaphm-admin/src/main/java/com/pdaaphm/biz/service/IAlgorithmService.java
  12. 12 8
      pdaaphm-admin/src/main/java/com/pdaaphm/biz/service/IFileService.java
  13. 2 1
      pdaaphm-admin/src/main/java/com/pdaaphm/biz/service/impl/AlgorithmIoFieldServiceImpl.java
  14. 54 0
      pdaaphm-admin/src/main/java/com/pdaaphm/biz/service/impl/AlgorithmServiceImpl.java
  15. 13 8
      pdaaphm-admin/src/main/java/com/pdaaphm/biz/service/impl/FileServiceImpl.java
  16. 3 2
      pdaaphm-admin/src/main/resources/mapper/algoManager/AlgorithmMapper.xml
  17. 4 0
      pdaaphm-admin/src/main/resources/mapper/algoManager/FileMapper.xml
  18. 31 2
      pdaaphm-admin/src/main/resources/mapper/conf/AlgorithmIoFieldMapper.xml
  19. 25 0
      pdaaphm-ui/src/api/algoManager/algorithm.js
  20. 8 0
      pdaaphm-ui/src/api/algoManager/file.js
  21. 2 2
      pdaaphm-ui/src/api/conf/field.js
  22. 65 24
      pdaaphm-ui/src/views/algoManager/algorithm/index.vue
  23. 16 1
      pdaaphm-ui/src/views/algoManager/file/index.vue
  24. 1 1
      pdaaphm-ui/src/views/conf/field/index.vue

+ 21 - 0
pdaaphm-admin/src/main/java/com/pdaaphm/biz/controller/AlgorithmController.java

@@ -2,6 +2,8 @@ package com.pdaaphm.biz.controller;
 
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
+
+import com.pdaaphm.biz.dto.AlgorithmDTO;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -69,6 +71,16 @@ public class AlgorithmController extends BaseController
         return success(algorithmService.selectAlgorithmById(id));
     }
 
+    /**
+     * 获取算法对象详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('algoManager:algorithm:query')")
+    @GetMapping(value = "/getAlgorithmDto/{id}")
+    public AjaxResult getAlgorithmDto(@PathVariable("id") Long id)
+    {
+        return success(algorithmService.getAlgorithmDto(id));
+    }
+
     /**
      * 新增算法
      */
@@ -80,6 +92,15 @@ public class AlgorithmController extends BaseController
         return toAjax(algorithmService.insertAlgorithm(algorithm));
     }
 
+    @PreAuthorize("@ss.hasPermi('algoManager:algorithm:add')")
+    @Log(title = "算法", businessType = BusinessType.INSERT)
+    @PostMapping("/addOrUpdateDto")
+    public AjaxResult addDto(@RequestBody AlgorithmDTO algorithm)
+    {
+        return toAjax(algorithmService.addOrUpdateDto(algorithm));
+    }
+
+
     /**
      * 修改算法
      */

+ 8 - 2
pdaaphm-admin/src/main/java/com/pdaaphm/biz/controller/AlgorithmIoFieldController.java

@@ -1,7 +1,10 @@
 package com.pdaaphm.biz.controller;
 
 import java.util.List;
+import java.util.Map;
 import javax.servlet.http.HttpServletResponse;
+
+import com.pdaaphm.biz.dto.SubAlgorithmDTO;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -102,6 +105,9 @@ public class AlgorithmIoFieldController extends BaseController
         return toAjax(algorithmIoFieldService.deleteAlgorithmIoFieldByIds(ids));
     }
 
-    @GetMapping(value = "/getIoSubList/{subTypeId}")
-    public AjaxResult getIoSubList(@PathVariable("subTypeId") Long id) { return success(algorithmIoFieldService.getIoSubList(id)); }
+    @GetMapping(value = "/getIoSubList/{subTypeId}/{algoId}")
+    public AjaxResult getIoSubList(@PathVariable("subTypeId") Long subTypeId, @PathVariable("subTypeId") Long algoId) {
+        List<SubAlgorithmDTO> map = algorithmIoFieldService.getIoSubList(subTypeId, algoId);
+        return success(map);
+    }
 }

+ 4 - 1
pdaaphm-admin/src/main/java/com/pdaaphm/biz/controller/FileController.java

@@ -23,7 +23,7 @@ import com.pdaaphm.common.core.page.TableDataInfo;
 
 /**
  * 文件Controller
- * 
+ *
  * @author xlk
  * @date 2023-07-26
  */
@@ -101,4 +101,7 @@ public class FileController extends BaseController
     {
         return toAjax(fileService.deleteFileByIds(ids));
     }
+
+    @GetMapping("/getOption")
+    public AjaxResult getOption() { return success(fileService.getOption()); }
 }

+ 6 - 82
pdaaphm-admin/src/main/java/com/pdaaphm/biz/domain/Algorithm.java

@@ -2,6 +2,7 @@ package com.pdaaphm.biz.domain;
 
 import java.util.Date;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.pdaaphm.common.annotation.Excel;
@@ -9,10 +10,11 @@ import com.pdaaphm.common.core.domain.BaseEntity;
 
 /**
  * 算法对象 t_algorithm
- * 
+ *
  * @author xlk
  * @date 2023-07-26
  */
+@Data
 public class Algorithm extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
@@ -46,85 +48,7 @@ public class Algorithm extends BaseEntity
     @Excel(name = "耗时(s)")
     private Long costSecond;
 
-    public void setId(Long id) 
-    {
-        this.id = id;
-    }
-
-    public Long getId() 
-    {
-        return id;
-    }
-    public void setType(String type) 
-    {
-        this.type = type;
-    }
-
-    public String getType() 
-    {
-        return type;
-    }
-    public void setSubTypeId(Long subTypeId) 
-    {
-        this.subTypeId = subTypeId;
-    }
-
-    public Long getSubTypeId() 
-    {
-        return subTypeId;
-    }
-    public void setName(String name) 
-    {
-        this.name = name;
-    }
-
-    public String getName() 
-    {
-        return name;
-    }
-    public void setStartTime(Date startTime) 
-    {
-        this.startTime = startTime;
-    }
-
-    public Date getStartTime() 
-    {
-        return startTime;
-    }
-    public void setCompletedTime(Date completedTime) 
-    {
-        this.completedTime = completedTime;
-    }
-
-    public Date getCompletedTime() 
-    {
-        return completedTime;
-    }
-    public void setCostSecond(Long costSecond) 
-    {
-        this.costSecond = costSecond;
-    }
-
-    public Long getCostSecond() 
-    {
-        return costSecond;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("type", getType())
-            .append("subTypeId", getSubTypeId())
-            .append("name", getName())
-            .append("startTime", getStartTime())
-            .append("completedTime", getCompletedTime())
-            .append("costSecond", getCostSecond())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("remark", getRemark())
-            .toString();
-    }
+    /** 算法子类型名称 */
+    @Excel(name = "算法子类型名称")
+    private String algoSubName;
 }

+ 60 - 0
pdaaphm-admin/src/main/java/com/pdaaphm/biz/dto/AlgorithmDTO.java

@@ -0,0 +1,60 @@
+package com.pdaaphm.biz.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class AlgorithmDTO {
+    private static final long serialVersionUID = 1L;
+
+    /** 编号 */
+    private Long id;
+
+    /** 算法类型 */
+    private String type;
+
+    /** 子类型id */
+    private Long subTypeId;
+
+    /** 名称 */
+    private String name;
+
+    /** 开始时间 */
+    private Date startTime;
+
+    /** 完成时间 */
+    private Date completedTime;
+
+    /** 耗时(s) */
+    private Long costSecond;
+
+    /** 算法子类型名称 */
+    private String algoSubName;
+
+    /** 搜索值 */
+    @JsonIgnore
+    private String searchValue;
+
+    /** 创建者 */
+    private String createBy;
+
+    /** 创建时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    /** 更新者 */
+    private String updateBy;
+
+    /** 更新时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
+    /** 备注 */
+    private String remark;
+
+    private List<SubAlgorithmDTO> ioSubList;
+}

+ 44 - 0
pdaaphm-admin/src/main/java/com/pdaaphm/biz/dto/SubAlgorithmDTO.java

@@ -0,0 +1,44 @@
+package com.pdaaphm.biz.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.pdaaphm.common.annotation.Excel;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class SubAlgorithmDTO {
+
+    /** 算法子表id */
+    private Long id;
+
+    /** 算法表id */
+    private Long algorithmId;
+
+    /** 字段id */
+    private Long fieldId;
+
+    /** 文件id */
+    private Long uploadId;
+
+    /** 字段名称 */
+    private String name;
+    /**
+     * 输入输出类型
+     */
+    private String type;
+
+
+    /** 创建者 */
+    private String createBy;
+    /** 创建时间 */
+    private Date createTime;
+    /** 更新者 */
+    private String updateBy;
+    /** 更新时间 */
+    private Date updateTime;
+    /** 备注 */
+    private String remark;
+
+}

+ 2 - 1
pdaaphm-admin/src/main/java/com/pdaaphm/biz/mapper/AlgorithmIoFieldMapper.java

@@ -4,6 +4,7 @@ import java.util.List;
 import java.util.Map;
 
 import com.pdaaphm.biz.domain.AlgorithmIoField;
+import com.pdaaphm.biz.dto.SubAlgorithmDTO;
 import org.apache.ibatis.annotations.Param;
 
 /**
@@ -62,5 +63,5 @@ public interface AlgorithmIoFieldMapper
      */
     public int deleteAlgorithmIoFieldByIds(Long[] ids);
 
-    List<Map> getIoSubList(Long id);
+    List<SubAlgorithmDTO> getIoSubList(@Param("subTypeId") Long subTypeId,@Param("algoId") Long algoId);
 }

+ 1 - 0
pdaaphm-admin/src/main/java/com/pdaaphm/biz/mapper/AlgorithmMapper.java

@@ -4,6 +4,7 @@ import java.util.List;
 import java.util.Map;
 
 import com.pdaaphm.biz.domain.Algorithm;
+import com.pdaaphm.biz.dto.AlgorithmDTO;
 
 /**
  * 算法Mapper接口

+ 4 - 0
pdaaphm-admin/src/main/java/com/pdaaphm/biz/mapper/FileMapper.java

@@ -1,6 +1,8 @@
 package com.pdaaphm.biz.mapper;
 
 import java.util.List;
+import java.util.Map;
+
 import com.pdaaphm.biz.domain.File;
 
 /**
@@ -58,4 +60,6 @@ public interface FileMapper
      * @return 结果
      */
     public int deleteFileByIds(Long[] ids);
+
+    List<Map> getOption();
 }

+ 2 - 1
pdaaphm-admin/src/main/java/com/pdaaphm/biz/service/IAlgorithmIoFieldService.java

@@ -4,6 +4,7 @@ import java.util.List;
 import java.util.Map;
 
 import com.pdaaphm.biz.domain.AlgorithmIoField;
+import com.pdaaphm.biz.dto.SubAlgorithmDTO;
 
 /**
  * 算法输入输出字段Service接口
@@ -61,5 +62,5 @@ public interface IAlgorithmIoFieldService
      */
     public int deleteAlgorithmIoFieldById(Long id);
 
-    List<Map> getIoSubList(Long id);
+    List<SubAlgorithmDTO> getIoSubList(Long subTypeId, Long algoId);
 }

+ 18 - 1
pdaaphm-admin/src/main/java/com/pdaaphm/biz/service/IAlgorithmService.java

@@ -4,6 +4,7 @@ import java.util.List;
 import java.util.Map;
 
 import com.pdaaphm.biz.domain.Algorithm;
+import com.pdaaphm.biz.dto.AlgorithmDTO;
 
 /**
  * 算法Service接口
@@ -37,6 +38,14 @@ public interface IAlgorithmService
      */
     public int insertAlgorithm(Algorithm algorithm);
 
+    /**
+     * 新增算法
+     *
+     * @param algorithmDto 算法
+     * @return 结果
+     */
+    public int addOrUpdateDto(AlgorithmDTO algorithmDto);
+
     /**
      * 修改算法
      *
@@ -61,5 +70,13 @@ public interface IAlgorithmService
      */
     public int deleteAlgorithmById(Long id);
 
-    List<Map> getOption();
+    public List<Map> getOption();
+
+    /**
+     * 查询算法对象
+     *
+     * @param id 算法主键
+     * @return 算法
+     */
+    public AlgorithmDTO getAlgorithmDto(Long id);
 }

+ 12 - 8
pdaaphm-admin/src/main/java/com/pdaaphm/biz/service/IFileService.java

@@ -1,19 +1,21 @@
 package com.pdaaphm.biz.service;
 
 import java.util.List;
+import java.util.Map;
+
 import com.pdaaphm.biz.domain.File;
 
 /**
  * 文件Service接口
- * 
+ *
  * @author xlk
  * @date 2023-07-26
  */
-public interface IFileService 
+public interface IFileService
 {
     /**
      * 查询文件
-     * 
+     *
      * @param id 文件主键
      * @return 文件
      */
@@ -21,7 +23,7 @@ public interface IFileService
 
     /**
      * 查询文件列表
-     * 
+     *
      * @param file 文件
      * @return 文件集合
      */
@@ -29,7 +31,7 @@ public interface IFileService
 
     /**
      * 新增文件
-     * 
+     *
      * @param file 文件
      * @return 结果
      */
@@ -37,7 +39,7 @@ public interface IFileService
 
     /**
      * 修改文件
-     * 
+     *
      * @param file 文件
      * @return 结果
      */
@@ -45,7 +47,7 @@ public interface IFileService
 
     /**
      * 批量删除文件
-     * 
+     *
      * @param ids 需要删除的文件主键集合
      * @return 结果
      */
@@ -53,9 +55,11 @@ public interface IFileService
 
     /**
      * 删除文件信息
-     * 
+     *
      * @param id 文件主键
      * @return 结果
      */
     public int deleteFileById(Long id);
+
+    List<Map> getOption();
 }

+ 2 - 1
pdaaphm-admin/src/main/java/com/pdaaphm/biz/service/impl/AlgorithmIoFieldServiceImpl.java

@@ -3,6 +3,7 @@ package com.pdaaphm.biz.service.impl;
 import java.util.List;
 import java.util.Map;
 
+import com.pdaaphm.biz.dto.SubAlgorithmDTO;
 import com.pdaaphm.common.utils.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -97,5 +98,5 @@ public class AlgorithmIoFieldServiceImpl implements IAlgorithmIoFieldService
     }
 
     @Override
-    public List<Map> getIoSubList(Long id) { return algorithmIoFieldMapper.getIoSubList(id); }
+    public List<SubAlgorithmDTO> getIoSubList(Long subTypeId, Long algoId) { return algorithmIoFieldMapper.getIoSubList(subTypeId, algoId); }
 }

+ 54 - 0
pdaaphm-admin/src/main/java/com/pdaaphm/biz/service/impl/AlgorithmServiceImpl.java

@@ -3,7 +3,13 @@ package com.pdaaphm.biz.service.impl;
 import java.util.List;
 import java.util.Map;
 
+import com.pdaaphm.biz.domain.SubAlgorithm;
+import com.pdaaphm.biz.dto.AlgorithmDTO;
+import com.pdaaphm.biz.dto.SubAlgorithmDTO;
+import com.pdaaphm.biz.mapper.AlgorithmIoFieldMapper;
+import com.pdaaphm.biz.mapper.SubAlgorithmMapper;
 import com.pdaaphm.common.utils.DateUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.pdaaphm.biz.mapper.AlgorithmMapper;
@@ -21,6 +27,10 @@ public class AlgorithmServiceImpl implements IAlgorithmService
 {
     @Autowired
     private AlgorithmMapper algorithmMapper;
+    @Autowired
+    private SubAlgorithmMapper subAlgorithmMapper;
+    @Autowired
+    private AlgorithmIoFieldMapper algorithmIoFieldMapper;
 
     /**
      * 查询算法
@@ -34,6 +44,23 @@ public class AlgorithmServiceImpl implements IAlgorithmService
         return algorithmMapper.selectAlgorithmById(id);
     }
 
+    /**
+     * 查询算法对象
+     *
+     * @param id 算法主键
+     * @return 算法
+     */
+    @Override
+    public AlgorithmDTO getAlgorithmDto(Long id)
+    {
+        Algorithm algorithm = this.selectAlgorithmById(id);
+        AlgorithmDTO algorithmDto = new AlgorithmDTO();
+        List<SubAlgorithmDTO> l = algorithmIoFieldMapper.getIoSubList(algorithm.getSubTypeId(),id);
+        BeanUtils.copyProperties(algorithm,algorithmDto);
+        algorithmDto.setIoSubList(l);
+        return algorithmDto;
+    }
+
     /**
      * 查询算法列表
      *
@@ -59,6 +86,33 @@ public class AlgorithmServiceImpl implements IAlgorithmService
         return algorithmMapper.insertAlgorithm(algorithm);
     }
 
+    @Override
+    public int addOrUpdateDto(AlgorithmDTO algorithmDto) {
+        // todo dto 2 domain, save doman
+        // get ioSubList, save SubAlgorithm
+        int res;
+        Algorithm algorithm = new Algorithm();
+        BeanUtils.copyProperties(algorithmDto,algorithm);
+        if(algorithmDto.getId() == null){
+            res = this.insertAlgorithm(algorithm);
+        } else {
+            res = this.updateAlgorithm(algorithm);
+        }
+        List<SubAlgorithmDTO> ioSubList = algorithmDto.getIoSubList();
+        SubAlgorithm subAlgorithm = new SubAlgorithm();
+        for(int i = 0; i < ioSubList.size(); i++){
+            SubAlgorithmDTO subAlgorithmDTO = ioSubList.get(i);
+            BeanUtils.copyProperties(subAlgorithmDTO,subAlgorithm);
+            subAlgorithm.setAlgorithmId(algorithm.getId());
+            if(subAlgorithmDTO.getId() == null){
+                subAlgorithmMapper.insertSubAlgorithm(subAlgorithm);
+            } else {
+                subAlgorithmMapper.updateSubAlgorithm(subAlgorithm);
+            }
+        }
+        return res;
+    }
+
     /**
      * 修改算法
      *

+ 13 - 8
pdaaphm-admin/src/main/java/com/pdaaphm/biz/service/impl/FileServiceImpl.java

@@ -1,6 +1,8 @@
 package com.pdaaphm.biz.service.impl;
 
 import java.util.List;
+import java.util.Map;
+
 import com.pdaaphm.common.utils.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -10,19 +12,19 @@ import com.pdaaphm.biz.service.IFileService;
 
 /**
  * 文件Service业务层处理
- * 
+ *
  * @author xlk
  * @date 2023-07-26
  */
 @Service
-public class FileServiceImpl implements IFileService 
+public class FileServiceImpl implements IFileService
 {
     @Autowired
     private FileMapper fileMapper;
 
     /**
      * 查询文件
-     * 
+     *
      * @param id 文件主键
      * @return 文件
      */
@@ -34,7 +36,7 @@ public class FileServiceImpl implements IFileService
 
     /**
      * 查询文件列表
-     * 
+     *
      * @param file 文件
      * @return 文件
      */
@@ -46,7 +48,7 @@ public class FileServiceImpl implements IFileService
 
     /**
      * 新增文件
-     * 
+     *
      * @param file 文件
      * @return 结果
      */
@@ -59,7 +61,7 @@ public class FileServiceImpl implements IFileService
 
     /**
      * 修改文件
-     * 
+     *
      * @param file 文件
      * @return 结果
      */
@@ -72,7 +74,7 @@ public class FileServiceImpl implements IFileService
 
     /**
      * 批量删除文件
-     * 
+     *
      * @param ids 需要删除的文件主键
      * @return 结果
      */
@@ -84,7 +86,7 @@ public class FileServiceImpl implements IFileService
 
     /**
      * 删除文件信息
-     * 
+     *
      * @param id 文件主键
      * @return 结果
      */
@@ -93,4 +95,7 @@ public class FileServiceImpl implements IFileService
     {
         return fileMapper.deleteFileById(id);
     }
+
+    @Override
+    public List<Map> getOption() { return fileMapper.getOption(); }
 }

+ 3 - 2
pdaaphm-admin/src/main/resources/mapper/algoManager/AlgorithmMapper.xml

@@ -17,10 +17,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateBy"    column="update_by"    />
         <result property="updateTime"    column="update_time"    />
         <result property="remark"    column="remark"    />
+        <result property="algoSubName" column="sub_name"    />
     </resultMap>
 
     <sql id="selectAlgorithmVo">
-        select id, `type`, sub_type_id, `name`, start_time, completed_time, cost_second, create_by, create_time, update_by, update_time, remark from t_algorithm
+        select algo.`id`, algo.`type`, algo.sub_type_id, algo.`name`, algo.start_time, algo.completed_time, algo.cost_second, algo.create_by, algo.create_time, algo.update_by, algo.update_time, algo.remark, sub.name as sub_name from t_algorithm as algo left join t_algorithm_sub_type as sub on algo.sub_type_id = sub.id
     </sql>
 
     <select id="selectAlgorithmList" parameterType="Algorithm" resultMap="AlgorithmResult">
@@ -37,7 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectAlgorithmById" parameterType="Long" resultMap="AlgorithmResult">
         <include refid="selectAlgorithmVo"/>
-        where id = #{id}
+        where algo.id = #{id}
     </select>
 
     <insert id="insertAlgorithm" parameterType="Algorithm" useGeneratedKeys="true" keyProperty="id">

+ 4 - 0
pdaaphm-admin/src/main/resources/mapper/algoManager/FileMapper.xml

@@ -83,4 +83,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </delete>
+
+    <select id="getOption" resultType="Map">
+        select id, `name`, `type` from t_file
+    </select>
 </mapper>

+ 31 - 2
pdaaphm-admin/src/main/resources/mapper/conf/AlgorithmIoFieldMapper.xml

@@ -90,7 +90,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </delete>
 
-    <select id="getIoSubList" resultType="Map">
-        select id, `type`, `name` from t_algorithm_io_field where algorithm_sub_id = #{id}
+    <select id="getIoSubList" resultType="com.pdaaphm.biz.dto.SubAlgorithmDTO">
+        SELECT
+            io.id as fieldId,
+            io.`type`,
+            io.`name`,
+            (
+                SELECT
+                    sa.id
+                FROM
+                    t_sub_algorithm sa,
+                    t_algorithm a
+                WHERE
+                    sa.algorithm_id = a.id
+                  AND sa.field_id = io.id
+                  AND a.id = #{algoId}
+            ) AS id,
+            (
+                SELECT
+                    sa.upload_id
+                FROM
+                    t_sub_algorithm sa,
+                    t_algorithm a
+                WHERE
+                    sa.algorithm_id = a.id
+                  AND sa.field_id = io.id
+                  AND a.id = #{algoId}
+            ) AS uploadId
+        FROM
+            t_algorithm_io_field AS io
+        WHERE
+            io.algorithm_sub_id = #{subTypeId}
     </select>
 </mapper>

+ 25 - 0
pdaaphm-ui/src/api/algoManager/algorithm.js

@@ -17,6 +17,14 @@ export function getAlgorithm(id) {
   })
 }
 
+// 查询算法对象详细
+export function getAlgorithmDto(id) {
+  return request({
+    url: '/algoManager/algorithm/getAlgorithmDto/' + id,
+    method: 'get'
+  })
+}
+
 // 新增算法
 export function addAlgorithm(data) {
   return request({
@@ -50,3 +58,20 @@ export function getAlgoSubOption() {
     method: 'get',
   })
 }
+
+// 新增算法
+export function addOrUpdateDto(data) {
+  return request({
+    url: '/algoManager/algorithm/addOrUpdateDto',
+    method: 'post',
+    data: data
+  })
+}
+
+// 运行算法
+export function runAlgorithm(id) {
+  return request({
+    url: '/algoManager/algorithm/addOrUpdateDto/' + id,
+    method: 'get'
+  })
+}

+ 8 - 0
pdaaphm-ui/src/api/algoManager/file.js

@@ -42,3 +42,11 @@ export function delFile(id) {
     method: 'delete'
   })
 }
+
+// 查询所有文件列表
+export function getFileList() {
+  return request({
+    url: '/algoManager/file/getOption',
+    method: 'get',
+  })
+}

+ 2 - 2
pdaaphm-ui/src/api/conf/field.js

@@ -44,9 +44,9 @@ export function delField(id) {
 }
 
 // 查询具体算法输入输出字段列表
-export function getIoSubList(subTypeId) {
+export function getIoSubList(subTypeId,algoId) {
   return request({
-    url: '/conf/field/getIoSubList/' + subTypeId,
+    url: '/conf/field/getIoSubList/' + subTypeId + '/'+ algoId,
     method: 'get',
   })
 }

+ 65 - 24
pdaaphm-ui/src/views/algoManager/algorithm/index.vue

@@ -104,10 +104,21 @@
           plain
           icon="el-icon-download"
           size="mini"
+          :disabled="single"
           @click="handleExport"
           v-hasPermi="['algoManager:algorithm:export']"
         >导出</el-button>
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-mouse"
+          size="mini"
+          @click="handleRun"
+          v-hasPermi="['algoManager:algorithm:run']"
+        >算法运行</el-button>
+      </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
@@ -119,7 +130,7 @@
           <dict-tag :options="dict.type.algorithm_type" :value="scope.row.type"/>
         </template>
       </el-table-column>
-      <el-table-column label="算法子类型" align="center" prop="subTypeId" />
+      <el-table-column label="算法子类型" align="center" prop="algoSubName" />
       <el-table-column label="名称" align="center" prop="name" />
       <el-table-column label="开始时间" align="center" prop="startTime" width="180">
         <template slot-scope="scope">
@@ -180,7 +191,7 @@
             placeholder="请选择算法子类型"
             clearable
             filterable
-            @change='changeFormSubType(form.subTypeId)'
+            @change='changeFormSubType()'
           >
             <el-option
               v-for="item in algoTypeList"
@@ -192,10 +203,27 @@
           </el-select>
         </el-form-item>
         <template v-if="form.subTypeId">
-          <el-form-item v-for="item in ioSubList" :label="item.name" :key="item.id" prop="name">
-            <file-upload v-model="form.path"/>
+          <el-form-item v-for="item in form.ioSubList" :label="item.name" :key="item.id">
+            <!-- <file-upload v-model="form.path"/> -->
+            <el-select
+              v-model="item.uploadId"
+              placeholder="请选择文件"
+              clearable
+              filterable
+            >
+              <el-option
+                v-for="file in fileList"
+                :key="file.id"
+                :label="file.name"
+                :value="file.id"
+              >
+              </el-option>
+            </el-select>
           </el-form-item>
         </template>
+        <el-form-item label="名称" prop="name">
+          <el-input v-model="form.name" placeholder="请输入名称" />
+        </el-form-item>
         <el-form-item label="备注" prop="remark">
           <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
         </el-form-item>
@@ -209,9 +237,10 @@
 </template>
 
 <script>
-import { listAlgorithm, getAlgorithm, delAlgorithm, addAlgorithm, updateAlgorithm } from "@/api/algoManager/algorithm";
+import { listAlgorithm, getAlgorithmDto, delAlgorithm, addOrUpdateDto, runAlgorithm } from "@/api/algoManager/algorithm";
 import { getAlgoSubOption } from "@/api/algoManager/algorithm";
 import { getIoSubList } from "@/api/conf/field";
+import { getFileList } from "@/api/algoManager/file";
 
 export default {
   name: "Algorithm",
@@ -236,8 +265,8 @@ export default {
       algorithmSubList: [],
       // 算法特定类列表
       algoTypeList: [],
-      // 具体算法输入输出文件列表
-      ioSubList: [],
+      // 已上传文件列表
+      fileList: [],
       // 弹出层标题
       title: "",
       // 是否显示弹出层
@@ -268,6 +297,7 @@ export default {
   created() {
     this.getList();
     this.getAlgoSubOption();
+    this.getFileList();
   },
   methods: {
     /** 查询算法列表 */
@@ -288,6 +318,14 @@ export default {
       });
     },
 
+    getFileList() {
+      getFileList().then((resp) => {
+        this.fileList = resp.data;
+        console.info(resp);
+        console.info(this);
+      });
+    },
+
     // 取消按钮
     cancel() {
       this.open = false;
@@ -307,7 +345,9 @@ export default {
         createTime: null,
         updateBy: null,
         updateTime: null,
-        remark: null
+        remark: null,
+        // 具体算法输入输出文件列表
+        ioSubList: []
       };
       this.resetForm("form");
     },
@@ -337,29 +377,22 @@ export default {
     handleUpdate(row) {
       this.reset();
       const id = row.id || this.ids
-      getAlgorithm(id).then(response => {
+      getAlgorithmDto(id).then(response => {
         this.form = response.data;
         this.open = true;
         this.title = "修改算法";
+        this.algoTypeList = this.typeMap.get(this.form.type);
       });
     },
     /** 提交按钮 */
     submitForm() {
       this.$refs["form"].validate(valid => {
         if (valid) {
-          if (this.form.id != null) {
-            updateAlgorithm(this.form).then(response => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addAlgorithm(this.form).then(response => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
-          }
+          addOrUpdateDto(this.form).then(response => {
+            this.$modal.msgSuccess("成功");
+            this.open = false;
+            this.getList();
+          });
         }
       });
     },
@@ -379,6 +412,14 @@ export default {
         ...this.queryParams
       }, `algorithm_${new Date().getTime()}.xlsx`)
     },
+    /** 运行算法按钮操作 */
+    handleRun() {
+      const id = row.id || this.ids
+      runAlgorithm(id).then(response => {
+        this.$modal.msgSuccess("成功");
+        this.getList();
+      });
+    },
     
     createTypeMap() {
       for (const algorithmSub of this.algorithmSubList) {
@@ -408,8 +449,8 @@ export default {
     },
 
     changeFormSubType() {
-      getIoSubList(this.form.subTypeId).then((resp) => {
-        this.ioSubList = resp.data;
+      getIoSubList(this.form.subTypeId,this.form.id).then((resp) => {
+        this.form.ioSubList = resp.data;
         console.info(resp);
       });
     },

+ 16 - 1
pdaaphm-ui/src/views/algoManager/file/index.vue

@@ -66,7 +66,11 @@
       <el-table-column label="编号" align="center" prop="id" />
       <el-table-column label="文档名称" align="center" prop="name" />
       <el-table-column label="文档路径" align="center" prop="path" />
-      <el-table-column label="类型" align="center" prop="type" />
+      <el-table-column label="输入/输出" align="center" prop="type">
+        <template slot-scope="scope">
+          <dict-tag :options="dict.type.algorithm_io_type" :value="scope.row.type"/>
+        </template>
+      </el-table-column>
       <el-table-column label="备注" align="center" prop="remark" />
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
@@ -105,6 +109,16 @@
         <el-form-item label="文档路径" prop="path">
           <file-upload v-model="form.path"/>
         </el-form-item>
+        <el-form-item label="输入/输出" prop="type">
+          <el-select v-model="form.type" placeholder="请选择输入输出类型" clearable filterable>
+            <el-option
+              v-for="dict in dict.type.algorithm_io_type"
+              :key="dict.value"
+              :label="dict.label"
+              :value="dict.value"
+            ></el-option>
+          </el-select>
+        </el-form-item>
         <el-form-item label="备注" prop="remark">
           <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
         </el-form-item>
@@ -122,6 +136,7 @@ import { listFile, getFile, delFile, addFile, updateFile } from "@/api/algoManag
 
 export default {
   name: "File",
+  dicts: ['algorithm_io_type'],
   data() {
     return {
       // 遮罩层

+ 1 - 1
pdaaphm-ui/src/views/conf/field/index.vue

@@ -153,7 +153,7 @@
           </el-select>
         </el-form-item>
         <el-form-item label="输入/输出" prop="type">
-          <el-select v-model="form.type" placeholder="请选择输入/输出">
+          <el-select v-model="form.type" placeholder="请选择输入/输出" clearable filterable>
             <el-option
               v-for="dict in dict.type.algorithm_io_type"
               :key="dict.value"