allen 6 ماه پیش
والد
کامیت
a7a0281378

+ 56 - 0
pdaaphm-admin/src/main/java/com/pdaaphm/system/domain/AlgConfig.java

@@ -26,9 +26,25 @@ public class AlgConfig extends BaseEntity
     @Excel(name = "算法类型", readConverterExp = "1=补全,2扩充,3特称提取,4退化评估,5故障预测")
     private String algType;
 
+    /** 算法语言 */
+    @Excel(name = "算法语言")
+    private String algLang;
+
+    /** 是否固定输入输出 */
+    @Excel(name = "是否固定输入输出")
+    private String fixed;
+
     /** 处理的算法 */
     private String algUrl;
 
+    /** 输入地址 */
+    @Excel(name = "输入地址")
+    private String inputUrl;
+
+    /** 输出地址 */
+    @Excel(name = "输出地址")
+    private String outUrl;
+
     public void setId(Long id) 
     {
         this.id = id;
@@ -56,6 +72,24 @@ public class AlgConfig extends BaseEntity
     {
         return algType;
     }
+    public void setAlgLang(String algLang) 
+    {
+        this.algLang = algLang;
+    }
+
+    public String getAlgLang() 
+    {
+        return algLang;
+    }
+    public void setFixed(String fixed) 
+    {
+        this.fixed = fixed;
+    }
+
+    public String getFixed() 
+    {
+        return fixed;
+    }
     public void setAlgUrl(String algUrl) 
     {
         this.algUrl = algUrl;
@@ -65,6 +99,24 @@ public class AlgConfig extends BaseEntity
     {
         return algUrl;
     }
+    public void setInputUrl(String inputUrl) 
+    {
+        this.inputUrl = inputUrl;
+    }
+
+    public String getInputUrl() 
+    {
+        return inputUrl;
+    }
+    public void setOutUrl(String outUrl) 
+    {
+        this.outUrl = outUrl;
+    }
+
+    public String getOutUrl() 
+    {
+        return outUrl;
+    }
 
     @Override
     public String toString() {
@@ -72,7 +124,11 @@ public class AlgConfig extends BaseEntity
             .append("id", getId())
             .append("algName", getAlgName())
             .append("algType", getAlgType())
+            .append("algLang", getAlgLang())
+            .append("fixed", getFixed())
             .append("algUrl", getAlgUrl())
+            .append("inputUrl", getInputUrl())
+            .append("outUrl", getOutUrl())
             .append("createBy", getCreateBy())
             .append("createTime", getCreateTime())
             .append("updateBy", getUpdateBy())

+ 113 - 23
pdaaphm-admin/src/main/java/com/pdaaphm/system/service/impl/TDataProcessServiceImpl.java

@@ -1,16 +1,18 @@
 package com.pdaaphm.system.service.impl;
 
+import java.io.File;
+import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.nio.file.StandardCopyOption;
+import java.util.*;
 import java.util.concurrent.TimeoutException;
 
 import com.pdaaphm.biz.domain.BaseResponse;
+import com.pdaaphm.biz.utils.MatlabUtils;
 import com.pdaaphm.common.config.PadaphmConfig;
+import com.pdaaphm.common.constant.Constants;
 import com.pdaaphm.common.utils.DateUtils;
 import com.pdaaphm.common.utils.DictUtils;
 import com.pdaaphm.common.utils.StringUtils;
@@ -169,8 +171,85 @@ public class TDataProcessServiceImpl implements ITDataProcessService {
         dataProcess.setStartTime(new Date());
         dataProcess.setEndTime(null);
         this.updateTDataProcess(dataProcess);
-        Map<String, String> resultMap = doRunDataProcess(algConfig, data, bizAlgType);
-        if (resultMap.get("errorMsg") == null) {
+        process(dataProcess, algConfig, data, bizAlgType);
+    }
+
+    private Map<String, String> processExeAndFixedPath(AlgConfig algConfig, Data data, String bizAlgType) {
+        Map<String, String> returnMap = new HashMap<>(8);
+        // 获取配置
+        String inputUrl = algConfig.getInputUrl() + Constants.ALG_INPUT;
+        try {
+            // 复制输入
+            String realDataPath = PadaphmConfig.getProfile() + StringUtils.substringAfter(data.getDataPath(), Constants.RESOURCE_PREFIX);
+            copyFile(realDataPath, inputUrl);
+            // 运行exe程序
+            MatlabUtils matlabUtils = new MatlabUtils();
+            matlabUtils.runMatExe(algConfig.getAlgUrl());
+            String resultPath = StringUtils.substringAfter(algConfig.getOutUrl(), Constants.RESOURCE_PREFIX);
+            // 复制输出
+            // 复制csv
+            String targetCsvPath = StringUtils.format("{}/{}/{}_{}_{}.csv", PadaphmConfig.getUploadPath(), DateUtils.datePath(), getOriginaFileName(data.getDataPath()), bizAlgType, Seq.getId(Seq.uploadSeqType));
+            copyFile(algConfig.getOutUrl() + Constants.ALG_OUTPUT_CSV, targetCsvPath);
+            returnMap.put("resultPath", targetCsvPath);
+            // 复制jpg
+            if (checkFileExist(algConfig.getOutUrl() + Constants.ALG_OUTPUT_JPG)) {
+                String targetJpgPath = StringUtils.format("{}/{}/{}_{}_{}.jpg", PadaphmConfig.getUploadPath(), DateUtils.datePath(), getOriginaFileName(data.getDataPath()), bizAlgType, Seq.getId(Seq.uploadSeqType));
+                copyFile(algConfig.getOutUrl() + Constants.ALG_OUTPUT_JPG, targetJpgPath);
+                returnMap.put("resultImagePath", targetJpgPath);
+            }
+            // 读取txt
+            if (checkFileExist(algConfig.getOutUrl() + Constants.ALG_OUTPUT_TXT)) {
+                String msg = readSmallFileContent(algConfig.getOutUrl() + Constants.ALG_OUTPUT_TXT);
+                returnMap.put("msg", msg);
+            }
+            returnMap.put("status", "200");
+        } catch (Exception e) {
+            logger.error("processExeAndFixedPath 运行报错", e);
+            returnMap.put("status", "500");
+        }
+        return returnMap;
+    }
+
+    private static String readSmallFileContent(String resultPath) {
+        File file = new File(resultPath);  // 文件路径
+
+        StringBuilder content = new StringBuilder();
+        try (Scanner scanner = new Scanner(file)) {
+            while (scanner.hasNextLine()) {
+                content.append(scanner.nextLine()).append(System.lineSeparator());  // 逐行读取
+            }
+
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+        return content.toString();
+    }
+
+    private static void copyFile(String realDataPath, String inputUrl) {
+        Path sourcePath = Paths.get(realDataPath);  // 源文件路径
+        Path targetPath = Paths.get(inputUrl);  // 目标文件路径
+        try {
+            // 确保目标目录存在
+            Path targetDir = targetPath.getParent();
+            if (!Files.exists(targetDir)) {
+                Files.createDirectories(targetDir);  // 如果目录不存在,创建目录
+            }
+            // 使用Files.copy()复制文件
+            Files.copy(sourcePath, targetPath, StandardCopyOption.REPLACE_EXISTING);
+            System.out.println("文件已成功复制!");
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    private void process(TDataProcess dataProcess, AlgConfig algConfig, Data data, String bizAlgType) {
+        Map<String, String> resultMap = null;
+        if("否".equals(algConfig.getFixed())){
+            resultMap = doRunDataProcess(algConfig, data, bizAlgType);
+        } else {
+            resultMap = processExeAndFixedPath(algConfig, data, bizAlgType);
+        }
+        if ("200".equals(resultMap.get("status"))) {
             // 成功场景
             // create new data
             Data newData = new Data();
@@ -182,6 +261,7 @@ public class TDataProcessServiceImpl implements ITDataProcessService {
             }
             newData.setDataType((Integer.parseInt(dataProcess.getProcessType()) + 1) + "");
             newData.setDataName(FileUtils.getNameNotSuffix(resultPath));
+            newData.setRemark(resultMap.get("msg"));
             dataService.insertData(newData);
             // update dataProcess
             dataProcess.setProcessStatus("3"); // 已完成
@@ -189,7 +269,7 @@ public class TDataProcessServiceImpl implements ITDataProcessService {
             dataProcess.setEndTime(new Date());
             this.updateTDataProcess(dataProcess);
         } else {
-            logger.error("dataProcess error,id:{},error:{}",dataProcess.getId(),resultMap.get("errorMsg"));
+            logger.error("dataProcess error,id:{},error:{}", dataProcess.getId(),resultMap.get("msg"));
             // 失败场景
             dataProcess.setProcessStatus("4"); // 失败
             dataProcess.setEndTime(new Date());
@@ -199,25 +279,31 @@ public class TDataProcessServiceImpl implements ITDataProcessService {
     }
 
     private Map<String, String> doRunDataProcess(AlgConfig algConfig, Data data, String bizAlgType) {
-        Map<String, String> result = new HashMap<>(2);
+
         String algUrl = algConfig.getAlgUrl();
         String dataPath = data.getDataPath();
-        logger.info("doRunDataProcess.dataPath: {}", dataPath);
-        String fileName = FileUtils.getNameNotSuffix(dataPath);
-        logger.info("doRunDataProcess.fileName: {}", fileName);
-        String originalFileName = fileName.split("_")[0];
+        String originalFileName = getOriginaFileName(dataPath);
         // 文件名 原始文件名_类型_时间戳
         String resultPath = StringUtils.format("{}/{}/{}_{}_{}.csv", PadaphmConfig.getUploadPath(), DateUtils.datePath(), originalFileName, bizAlgType, Seq.getId(Seq.uploadSeqType));
         String resultImagePath = StringUtils.format("{}/{}/{}_{}_{}.jpeg", PadaphmConfig.getUploadPath(), DateUtils.datePath(), originalFileName, bizAlgType, Seq.getId(Seq.uploadSeqType));
 
-        String errorMsg = sendHttp(algUrl, dataPath.replace("/profile",PadaphmConfig.getProfile()), resultPath, resultImagePath);
-        result.put("resultPath", resultPath);
-        result.put("resultImagePath", resultImagePath);
-        result.put("errorMsg", errorMsg);
-        return result;
+        return sendHttp(algUrl, dataPath.replace("/profile",PadaphmConfig.getProfile()), resultPath, resultImagePath);
+
+
+    }
+
+    private String getOriginaFileName(String dataPath) {
+        logger.info("doRunDataProcess.dataPath: {}", dataPath);
+        String fileName = FileUtils.getNameNotSuffix(dataPath);
+        logger.info("doRunDataProcess.fileName: {}", fileName);
+        String originalFileName = fileName.split("_")[0];
+        return originalFileName;
     }
 
     private boolean checkFileExist(String resultImagePath) {
+        if(StringUtils.isEmpty(resultImagePath)){
+            return false;
+        }
         String realPath = resultImagePath;
 
         if (realPath.startsWith("/profile")) {
@@ -228,7 +314,10 @@ public class TDataProcessServiceImpl implements ITDataProcessService {
         return Files.exists(path);
     }
 
-    private String sendHttp(String algUrl, String dataPath, String resultPath, String resultImagePath) {
+    private Map<String, String> sendHttp(String algUrl, String dataPath, String resultPath, String resultImagePath) {
+        Map<String, String> resultMap = new HashMap<>(8);
+        resultMap.put("resultPath", resultPath);
+        resultMap.put("resultImagePath", resultImagePath);
         HttpComponentsClientHttpRequestFactory httpRequestFactory = new HttpComponentsClientHttpRequestFactory();
         httpRequestFactory.setConnectionRequestTimeout(3000);
         httpRequestFactory.setConnectTimeout(3000);
@@ -260,12 +349,13 @@ public class TDataProcessServiceImpl implements ITDataProcessService {
         // get response
         BaseResponse res = result.block();
         if (res == null) {
+            resultMap.put("status","500");
+            resultMap.put("msg", "response is null");
             logger.error("response is null");
-            return "response is null";
-        }
-        if (!Integer.valueOf("200").equals(res.getCode())) {
-            return res.getMsg();
+            return resultMap;
         }
-        return null;
+        resultMap.put("status",res.getCode().toString());
+        resultMap.put("msg",res.getMsg());
+        return resultMap;
     }
 }

+ 2 - 2
pdaaphm-admin/src/main/resources/application.yml

@@ -72,13 +72,13 @@ spring:
   # redis 配置
   redis:
     # 地址
-    host: localhost
+    host: 101.126.133.7
     # 端口,默认为6379
     port: 6379
     # 数据库索引
     database: 0
     # 密码
-    password: CWwYsGjafmv8Sr7g
+    password: Z;G4AS:Vor'YF#p?
     # 连接超时时间
     timeout: 10s
     lettuce:

+ 22 - 1
pdaaphm-admin/src/main/resources/mapper/system/AlgConfigMapper.xml

@@ -8,7 +8,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="id"    column="id"    />
         <result property="algName"    column="alg_name"    />
         <result property="algType"    column="alg_type"    />
+        <result property="algLang"    column="alg_lang"    />
+        <result property="fixed"    column="fixed"    />
         <result property="algUrl"    column="alg_url"    />
+        <result property="inputUrl"    column="input_url"    />
+        <result property="outUrl"    column="out_url"    />
         <result property="createBy"    column="create_by"    />
         <result property="createTime"    column="create_time"    />
         <result property="updateBy"    column="update_by"    />
@@ -17,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectAlgConfigVo">
-        select id, alg_name, alg_type, alg_url, create_by, create_time, update_by, update_time, remark from t_alg_config
+        select id, alg_name, alg_type, alg_lang, fixed, alg_url, input_url, out_url, create_by, create_time, update_by, update_time, remark from t_alg_config
     </sql>
 
     <select id="selectAlgConfigList" parameterType="AlgConfig" resultMap="AlgConfigResult">
@@ -25,6 +29,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <where>  
             <if test="algName != null  and algName != ''"> and alg_name like concat('%', #{algName}, '%')</if>
             <if test="algType != null  and algType != ''"> and alg_type = #{algType}</if>
+            <if test="algLang != null  and algLang != ''"> and alg_lang = #{algLang}</if>
+            <if test="fixed != null  and fixed != ''"> and fixed = #{fixed}</if>
+            <if test="algUrl != null  and algUrl != ''"> and alg_url = #{algUrl}</if>
+            <if test="inputUrl != null  and inputUrl != ''"> and input_url = #{inputUrl}</if>
+            <if test="outUrl != null  and outUrl != ''"> and out_url = #{outUrl}</if>
         </where>
         order by create_time desc
     </select>
@@ -39,7 +48,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="algName != null and algName != ''">alg_name,</if>
             <if test="algType != null and algType != ''">alg_type,</if>
+            <if test="algLang != null and algLang != ''">alg_lang,</if>
+            <if test="fixed != null and fixed != ''">fixed,</if>
             <if test="algUrl != null and algUrl != ''">alg_url,</if>
+            <if test="inputUrl != null">input_url,</if>
+            <if test="outUrl != null">out_url,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createTime != null">create_time,</if>
             <if test="updateBy != null">update_by,</if>
@@ -49,7 +62,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="algName != null and algName != ''">#{algName},</if>
             <if test="algType != null and algType != ''">#{algType},</if>
+            <if test="algLang != null and algLang != ''">#{algLang},</if>
+            <if test="fixed != null and fixed != ''">#{fixed},</if>
             <if test="algUrl != null and algUrl != ''">#{algUrl},</if>
+            <if test="inputUrl != null">#{inputUrl},</if>
+            <if test="outUrl != null">#{outUrl},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
@@ -63,7 +80,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <trim prefix="SET" suffixOverrides=",">
             <if test="algName != null and algName != ''">alg_name = #{algName},</if>
             <if test="algType != null and algType != ''">alg_type = #{algType},</if>
+            <if test="algLang != null and algLang != ''">alg_lang = #{algLang},</if>
+            <if test="fixed != null and fixed != ''">fixed = #{fixed},</if>
             <if test="algUrl != null and algUrl != ''">alg_url = #{algUrl},</if>
+            <if test="inputUrl != null">input_url = #{inputUrl},</if>
+            <if test="outUrl != null">out_url = #{outUrl},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>

+ 5 - 0
pdaaphm-common/src/main/java/com/pdaaphm/common/constant/Constants.java

@@ -144,4 +144,9 @@ public class Constants
      */
     public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
             "org.springframework", "org.apache", "com.pdaaphm.common.utils.file", "com.pdaaphm.common.config" };
+
+    public static final String ALG_INPUT = "/input.csv";
+    public static final String ALG_OUTPUT_CSV = "/result.csv";
+    public static final String ALG_OUTPUT_JPG = "/result.jpg";
+    public static final String ALG_OUTPUT_TXT = "/result.txt";
 }

+ 127 - 108
pdaaphm-ui/src/views/system/algConfig/index.vue

@@ -1,13 +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 :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
       <el-form-item label="算法名称" prop="algName">
         <el-input
           v-model="queryParams.algName"
@@ -17,11 +10,7 @@
         />
       </el-form-item>
       <el-form-item label="算法类型" prop="algType">
-        <el-select
-          v-model="queryParams.algType"
-          placeholder="请选择算法类型"
-          clearable
-        >
+        <el-select v-model="queryParams.algType" placeholder="请选择算法类型" clearable>
           <el-option
             v-for="dict in dict.type.biz_alg_type"
             :key="dict.value"
@@ -30,17 +19,43 @@
           />
         </el-select>
       </el-form-item>
+      <el-form-item label="算法语言" prop="algLang">
+        <el-select v-model="queryParams.algLang" placeholder="请选择算法语言" clearable>
+          <el-option
+            v-for="dict in dict.type.biz_alg_lang"
+            :key="dict.value"
+            :label="dict.label"
+            :value="dict.value"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="处理的算法" prop="algUrl">
+        <el-input
+          v-model="queryParams.algUrl"
+          placeholder="请输入处理的算法"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="输入地址" prop="inputUrl">
+        <el-input
+          v-model="queryParams.inputUrl"
+          placeholder="请输入输入地址"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="输出地址" prop="outUrl">
+        <el-input
+          v-model="queryParams.outUrl"
+          placeholder="请输入输出地址"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </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
-        >
+        <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>
       </el-form-item>
     </el-form>
 
@@ -53,8 +68,7 @@
           size="mini"
           @click="handleAdd"
           v-hasPermi="['system:algConfig:add']"
-          >新增</el-button
-        >
+        >新增</el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
@@ -65,8 +79,7 @@
           :disabled="single"
           @click="handleUpdate"
           v-hasPermi="['system:algConfig:edit']"
-          >修改</el-button
-        >
+        >修改</el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
@@ -77,8 +90,7 @@
           :disabled="multiple"
           @click="handleDelete"
           v-hasPermi="['system:algConfig:remove']"
-          >删除</el-button
-        >
+        >删除</el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
@@ -88,25 +100,17 @@
           size="mini"
           @click="handleExport"
           v-hasPermi="['system:algConfig:export']"
-          >导出</el-button
-        >
+        >导出</el-button>
       </el-col>
-      <right-toolbar
-        :showSearch.sync="showSearch"
-        @queryTable="getList"
-      ></right-toolbar>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
-    <el-table
-      v-loading="loading"
-      :data="algConfigList"
-      @selection-change="handleSelectionChange"
-    >
+    <el-table v-loading="loading" :data="algConfigList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="编号" width="100" align="center" prop="id" />
       <el-table-column
         label="算法名称"
-        width="150"
+        width="300"
         align="center"
         prop="algName"
       />
@@ -117,19 +121,16 @@
         prop="algType"
       >
         <template slot-scope="scope">
-          <dict-tag
-            :options="dict.type.biz_alg_type"
-            :value="scope.row.algType"
-          />
+          <dict-tag :options="dict.type.biz_alg_type" :value="scope.row.algType"/>
         </template>
       </el-table-column>
-      <el-table-column label="算法地址" align="center" prop="algUrl" />
-      <!-- <el-table-column label="备注" align="center" prop="remark" /> -->
-      <el-table-column
-        label="操作"
-        align="center"
-        class-name="small-padding fixed-width"
-      >
+      <el-table-column label="算法语言" align="center" prop="algLang">
+        <template slot-scope="scope">
+          <dict-tag :options="dict.type.biz_alg_lang" :value="scope.row.algLang"/>
+        </template>
+      </el-table-column>
+      <el-table-column label="是否固定输入输出" align="center" prop="fixed" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
             size="mini"
@@ -137,22 +138,20 @@
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
             v-hasPermi="['system:algConfig:edit']"
-            >修改</el-button
-          >
+          >修改</el-button>
           <el-button
             size="mini"
             type="text"
             icon="el-icon-delete"
             @click="handleDelete(scope.row)"
             v-hasPermi="['system:algConfig:remove']"
-            >删除</el-button
-          >
+          >删除</el-button>
         </template>
       </el-table-column>
     </el-table>
 
     <pagination
-      v-show="total > 0"
+      v-show="total>0"
       :total="total"
       :page.sync="queryParams.pageNum"
       :limit.sync="queryParams.pageSize"
@@ -160,8 +159,8 @@
     />
 
     <!-- 添加或修改算法配置对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="150px" label-position= 'left'>
         <el-form-item label="算法名称" prop="algName">
           <el-input v-model="form.algName" placeholder="请输入算法名称" />
         </el-form-item>
@@ -171,19 +170,38 @@
               v-for="dict in dict.type.biz_alg_type"
               :key="dict.value"
               :label="dict.value"
-              >{{ dict.label }}</el-radio
-            >
+            >{{dict.label}}</el-radio>
+          </el-radio-group>
+        </el-form-item>
+        <el-form-item label="算法语言" prop="algLang">
+          <el-radio-group v-model="form.algLang">
+            <el-radio
+              v-for="dict in dict.type.biz_alg_lang"
+              :key="dict.value"
+              :label="dict.value"
+            >{{dict.label}}</el-radio>
           </el-radio-group>
         </el-form-item>
-        <el-form-item label="处理的算法" prop="algUrl" label-width="100px">
+        <el-form-item label="处理的算法" prop="algUrl">
           <el-input v-model="form.algUrl" placeholder="请输入处理的算法" />
         </el-form-item>
+        <el-form-item label="是否固定输入输出" prop="fixed">
+            <el-switch
+              v-model="form.fixed"
+              active-color="#13ce66"
+              inactive-color="#ff4949"
+              active-value="是"
+              inactive-value="否">
+            </el-switch>
+        </el-form-item>
+        <el-form-item label="输入地址" prop="inputUrl">
+          <el-input v-model="form.inputUrl" placeholder="请输入输入地址" />
+        </el-form-item>
+        <el-form-item label="输出地址" prop="outUrl">
+          <el-input v-model="form.outUrl" placeholder="请输入输出地址" />
+        </el-form-item>
         <el-form-item label="备注" prop="remark">
-          <el-input
-            v-model="form.remark"
-            type="textarea"
-            placeholder="请输入内容"
-          />
+          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
@@ -195,17 +213,11 @@
 </template>
 
 <script>
-import {
-  listAlgConfig,
-  getAlgConfig,
-  delAlgConfig,
-  addAlgConfig,
-  updateAlgConfig,
-} from "@/api/system/algConfig";
+import { listAlgConfig, getAlgConfig, delAlgConfig, addAlgConfig, updateAlgConfig } from "@/api/system/algConfig";
 
 export default {
   name: "AlgConfig",
-  dicts: ["biz_alg_type"],
+  dicts: ['biz_alg_type', 'biz_alg_lang'],
   data() {
     return {
       // 遮罩层
@@ -232,21 +244,32 @@ export default {
         pageSize: 10,
         algName: null,
         algType: null,
+        algLang: null,
+        fixed: null,
+        algUrl: null,
+        inputUrl: null,
+        outUrl: null,
       },
       // 表单参数
       form: {},
       // 表单校验
       rules: {
         algName: [
-          { required: true, message: "算法名称不能为空", trigger: "blur" },
+          { required: true, message: "算法名称不能为空", trigger: "blur" }
         ],
         algType: [
-          { required: true, message: "算法类型不能为空", trigger: "change" },
+          { required: true, message: "算法类型不能为空", trigger: "change" }
+        ],
+        algLang: [
+          { required: true, message: "算法语言不能为空", trigger: "change" }
+        ],
+        fixed: [
+          { required: true, message: "是否固定输入输出不能为空", trigger: "blur" }
         ],
         algUrl: [
-          { required: true, message: "处理的算法不能为空", trigger: "blur" },
+          { required: true, message: "处理的算法不能为空", trigger: "blur" }
         ],
-      },
+      }
     };
   },
   created() {
@@ -256,7 +279,7 @@ export default {
     /** 查询算法配置列表 */
     getList() {
       this.loading = true;
-      listAlgConfig(this.queryParams).then((response) => {
+      listAlgConfig(this.queryParams).then(response => {
         this.algConfigList = response.rows;
         this.total = response.total;
         this.loading = false;
@@ -273,12 +296,16 @@ export default {
         id: null,
         algName: null,
         algType: null,
+        algLang: null,
+        fixed: '否',
         algUrl: null,
+        inputUrl: null,
+        outUrl: null,
         createBy: null,
         createTime: null,
         updateBy: null,
         updateTime: null,
-        remark: null,
+        remark: null
       };
       this.resetForm("form");
     },
@@ -294,9 +321,9 @@ export default {
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
-      this.ids = selection.map((item) => item.id);
-      this.single = selection.length !== 1;
-      this.multiple = !selection.length;
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
     },
     /** 新增按钮操作 */
     handleAdd() {
@@ -307,8 +334,8 @@ export default {
     /** 修改按钮操作 */
     handleUpdate(row) {
       this.reset();
-      const id = row.id || this.ids;
-      getAlgConfig(id).then((response) => {
+      const id = row.id || this.ids
+      getAlgConfig(id).then(response => {
         this.form = response.data;
         this.open = true;
         this.title = "修改算法配置";
@@ -316,16 +343,16 @@ export default {
     },
     /** 提交按钮 */
     submitForm() {
-      this.$refs["form"].validate((valid) => {
+      this.$refs["form"].validate(valid => {
         if (valid) {
           if (this.form.id != null) {
-            updateAlgConfig(this.form).then((response) => {
+            updateAlgConfig(this.form).then(response => {
               this.$modal.msgSuccess("修改成功");
               this.open = false;
               this.getList();
             });
           } else {
-            addAlgConfig(this.form).then((response) => {
+            addAlgConfig(this.form).then(response => {
               this.$modal.msgSuccess("新增成功");
               this.open = false;
               this.getList();
@@ -337,27 +364,19 @@ export default {
     /** 删除按钮操作 */
     handleDelete(row) {
       const ids = row.id || this.ids;
-      this.$modal
-        .confirm('是否确认删除算法配置编号为"' + ids + '"的数据项?')
-        .then(function () {
-          return delAlgConfig(ids);
-        })
-        .then(() => {
-          this.getList();
-          this.$modal.msgSuccess("删除成功");
-        })
-        .catch(() => {});
+      this.$modal.confirm('是否确认删除算法配置编号为"' + ids + '"的数据项?').then(function() {
+        return delAlgConfig(ids);
+      }).then(() => {
+        this.getList();
+        this.$modal.msgSuccess("删除成功");
+      }).catch(() => {});
     },
     /** 导出按钮操作 */
     handleExport() {
-      this.download(
-        "system/algConfig/export",
-        {
-          ...this.queryParams,
-        },
-        `algConfig_${new Date().getTime()}.xlsx`
-      );
-    },
-  },
+      this.download('system/algConfig/export', {
+        ...this.queryParams
+      }, `algConfig_${new Date().getTime()}.xlsx`)
+    }
+  }
 };
 </script>

+ 11 - 0
sql/update20241206.sql

@@ -0,0 +1,11 @@
+ALTER TABLE `pdaaphm`.`t_alg_config`
+ADD COLUMN `alg_lang` varchar(255) NULL COMMENT '算法语言' AFTER `alg_type`,
+ADD COLUMN `fixed` varchar(16) NULL COMMENT '是否固定输入输出' AFTER `alg_lang`,
+ADD COLUMN `input_url` varchar(255) NULL COMMENT '输入地址' AFTER `alg_url`,
+ADD COLUMN `out_url` varchar(255) NULL COMMENT '输出地址' AFTER `input_url`;
+
+ALTER TABLE `pdaaphm`.`t_data`
+ADD COLUMN `txt_path` varchar(255) NULL COMMENT '文本路径' AFTER `image_path`;
+
+ALTER TABLE `pdaaphm`.`t_alg_config`
+MODIFY COLUMN `fixed` varchar(16) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 否 COMMENT '是否固定输入输出' AFTER `alg_lang`;