Переглянути джерело

feat: transmission object

unknown 8 місяців тому
батько
коміт
2940ecf2b3

+ 51 - 0
taais-modules/taais-biz/src/main/java/com/taais/biz/domain/TransmissionObject.java

@@ -0,0 +1,51 @@
+package com.taais.biz.domain;
+
+import lombok.*;
+
+import java.io.Serial;
+
+import lombok.Data;
+
+/**
+ * 参数传输对象
+ *
+ * @author tanlun
+ * 2024-10-14
+ */
+@Builder
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class TransmissionObject{
+//    @Serial
+//    private static final long serialVersionUID = 1L;
+
+    /**
+     * 任务类型
+     */
+    private String bizType;
+
+    /**
+     * 任务id
+     */
+    private Long bizId;
+
+    /**
+     * 日志文件保存地址
+     */
+    private String logPath;
+
+    /**
+     * 输入文件路径
+     */
+    private String sourcePath;
+    /**
+     * 结果保存路径
+     */
+    private String resultPath;
+    /**
+     * 其他参数
+     */
+    private String otherParams;
+
+}

+ 14 - 4
taais-modules/taais-biz/src/main/java/com/taais/biz/service/impl/DataAugmentationServiceImpl.java

@@ -6,6 +6,7 @@ import com.mybatisflex.core.query.QueryWrapper;
 import com.taais.biz.constant.BizConstant;
 import com.taais.biz.domain.HttpResponseEntity;
 import com.taais.biz.domain.DataAugmentation;
+import com.taais.biz.domain.TransmissionObject;
 import com.taais.biz.domain.bo.DataAugmentationBo;
 import com.taais.biz.domain.bo.DataAugmentationStartResultBo;
 import com.taais.biz.domain.vo.DataAugmentationVo;
@@ -232,12 +233,12 @@ public class DataAugmentationServiceImpl extends BaseServiceImpl<DataAugmentatio
         Path path = Paths.get(resourcePath);
         Path inputPath = path.resolveSibling(fileName_without_suffix + "_images");
         Path outputPath = path.resolveSibling(fileName_without_suffix + "_stable");
-
+        Path logPath = path.resolveSibling(fileName_without_suffix + "_log");
         makeDir(inputPath.toString());
         makeDir(outputPath.toString());
 
         ZipUtils.unzip(resourcePath, inputPath.toString());
-
+        dataAugmentation.setLog(logPath.toString());
         dataAugmentation.setInputPath(inputPath.toString());
         dataAugmentation.setOutputPath(outputPath.toString());
 
@@ -253,7 +254,16 @@ public class DataAugmentationServiceImpl extends BaseServiceImpl<DataAugmentatio
             return CommonResult.fail("未设置数据增强算法推理的url!请在数据字典中设置该算法的推理url!");
         }
         String data_augmentation_start_url = sysDictDataVos.get(0).getDictValue();
-        HttpResponseEntity responseEntity = sendPostMsg(data_augmentation_start_url, dataAugmentation);
+        //设置传输对象
+        TransmissionObject transmissionObject = new TransmissionObject();
+        transmissionObject.setBizId(dataAugmentation.getId());
+        transmissionObject.setBizType(dataAugmentation.getTaskType());
+        transmissionObject.setLogPath(dataAugmentation.getLog());
+        transmissionObject.setSourcePath(dataAugmentation.getInputPath());
+        transmissionObject.setResultPath(dataAugmentation.getOutputPath());
+        transmissionObject.setOtherParams(dataAugmentation.getHyperparameterConfiguration());
+        HttpResponseEntity responseEntity = sendPostMsg(data_augmentation_start_url, transmissionObject);
+
         if (responseEntity.getStatus() == 200) {
             dataAugmentation.setStatus(BizConstant.VideoStatus.FAILED);
             updateById(dataAugmentation);
@@ -353,7 +363,7 @@ public class DataAugmentationServiceImpl extends BaseServiceImpl<DataAugmentatio
             return CommonResult.fail("未设置数据增强算法停止推理的url!请在数据字典中设置该算法的停止推理地址!");
         }
         String data_augmentation_stop_url = sysDictDataVos.get(0).getDictValue();
-        HttpResponseEntity responseEntity = sendPostMsg(data_augmentation_stop_url, dataAugmentation);
+        HttpResponseEntity responseEntity = sendPostMsg(data_augmentation_stop_url, null);
         if (ObjectUtil.isNotNull(responseEntity) && responseEntity.getStatus() == 200) {
             dataAugmentation.setStatus(BizConstant.VideoStatus.INTERRUPTED);
             updateById(dataAugmentation);