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

Merge branch 'develop' into dev_wk2

WANGKANG 3 місяців тому
батько
коміт
61db8f83ab

+ 5 - 0
taais-modules/taais-biz/src/main/java/com/taais/biz/controller/DataAugmentationController.java

@@ -333,6 +333,11 @@ public class DataAugmentationController extends BaseController {
         return dataAugmentationService.stop(id);
     }
 
+    @GetMapping("/pause/{id}")
+    public CommonResult pause(@PathVariable("id") Long id) {
+        return dataAugmentationService.pause(id);
+    }
+
     /**
      * 查询数据增强列表
      */

+ 0 - 5
taais-modules/taais-biz/src/main/java/com/taais/biz/domain/dto/DataAmplifyDto.java

@@ -21,22 +21,17 @@ import java.util.Map;
 @Accessors(chain = true)
 public class DataAmplifyDto {
 
-    @NotBlank(message = "id不能为空")
     private String id;
 
-    @NotBlank(message = "批次不能为空")
     private String batchNum;
 
-    @NotBlank(message = "任务名称")
     private String taskName;
 
-    @NotBlank(message = "扩充方式不能为空")
     private String augmentationType;
 
     private String inputImagePath;
 
     private String outputImagePath;
 
-    @NotEmpty(message = "扩充算法配置不能为空")
     private List<Map<String, String>> otherParams;
 }

+ 3 - 0
taais-modules/taais-biz/src/main/java/com/taais/biz/service/IDataAugmentationService.java

@@ -81,4 +81,7 @@ public interface IDataAugmentationService extends IBaseService<DataAugmentation>
     CommonResult stop(Long id);
 
     PageResult<DataAugmentationVo> selectPage1(DataAugmentationBo dataAugmentationBo, String type);
+
+
+    CommonResult pause(Long id);
 }

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

@@ -456,6 +456,43 @@ public class DataAugmentationServiceImpl extends BaseServiceImpl<DataAugmentatio
         map.put("outFileCount", out_fileCount);
         return map;
     }
+    public CommonResult pause(Long id) {
+        DataAugmentation dataAugmentation = getById(id);
+//        SysDictDataBo sysDictDataBo = new SysDictDataBo();
+//        sysDictDataBo.setDictLabel(dataAugmentation.getTaskType() + "停止url");
+//        sysDictDataBo.setDictType("biz_data_augmentation");
+//        List<SysDictDataVo> sysDictDataVos = iSysDictDataService.selectDictDataList(sysDictDataBo);
+//        if (sysDictDataVos.size() == 0) {
+//            return CommonResult.fail("未设置数据增强算法停止推理的url!请在数据字典中设置该算法的停止推理地址!");
+//        }
+//        String data_augmentation_stop_url = sysDictDataVos.get(0).getDictValue();
+        //从通用算法配置表中获取停止api
+//        CommonAlgorithmConfigBo commonAlgorithmConfigBo = new CommonAlgorithmConfigBo();
+//        commonAlgorithmConfigBo.setAlgorithmName(dataAugmentation.getTaskType());
+//
+//        List<CommonAlgorithmConfigVo> commonAlgorithmConfigVos = commonAlgorithmConfigService.selectList(commonAlgorithmConfigBo);
+        QueryWrapper queryWrapper = new QueryWrapper();
+        queryWrapper.eq("algorithm_name", dataAugmentation.getTaskType());
+        List<CommonAlgorithmConfig> list = commonAlgorithmConfigService.list(queryWrapper);
+        if (list.isEmpty()) {
+            return CommonResult.fail("通用算法配置表中无" + dataAugmentation.getTaskType() + "算法配置");
+        }
+        CommonAlgorithmConfig commonAlgorithmConfig = list.get(0);
+        String data_augmentation_stop_url = commonAlgorithmConfig.getPauseApi();
+        //设置传输对象
+        TransmissionObject transmissionObject = new TransmissionObject();
+        transmissionObject.setBizId(dataAugmentation.getId());
+        transmissionObject.setBizType(dataAugmentation.getTaskType());
+        transmissionObject.setLogPath(dataAugmentation.getAlgorithmPath());
+        HttpResponseEntity responseEntity = sendPostMsg(data_augmentation_stop_url, transmissionObject);
+        if (ObjectUtil.isNotNull(responseEntity) && responseEntity.getStatus() == 200) {
+            dataAugmentation.setStatus(BizConstant.ModelStatus.INTERRUPTED);
+            updateById(dataAugmentation);
+            return CommonResult.success("暂停任务成功");
+        } else {
+            return CommonResult.fail("暂停任务失败");
+        }
+    }
 
     @Override
     public CommonResult stop(Long id) {
@@ -481,9 +518,6 @@ public class DataAugmentationServiceImpl extends BaseServiceImpl<DataAugmentatio
             return CommonResult.fail("通用算法配置表中无" + dataAugmentation.getTaskType() + "算法配置");
         }
         CommonAlgorithmConfig commonAlgorithmConfig = list.get(0);
-        if (commonAlgorithmConfig == null) {
-            return CommonResult.fail("通用算法配置表中无" + dataAugmentation.getTaskType() + "算法配置");
-        }
         String data_augmentation_stop_url = commonAlgorithmConfig.getTerminateApi();
         //设置传输对象
         TransmissionObject transmissionObject = new TransmissionObject();
@@ -492,7 +526,7 @@ public class DataAugmentationServiceImpl extends BaseServiceImpl<DataAugmentatio
         transmissionObject.setLogPath(dataAugmentation.getAlgorithmPath());
         HttpResponseEntity responseEntity = sendPostMsg(data_augmentation_stop_url, transmissionObject);
         if (ObjectUtil.isNotNull(responseEntity) && responseEntity.getStatus() == 200) {
-            dataAugmentation.setStatus(BizConstant.ModelStatus.INTERRUPTED);
+            dataAugmentation.setStatus(BizConstant.ModelStatus.FAILED);
             updateById(dataAugmentation);
             return CommonResult.success("终止任务成功");
         } else {

+ 10 - 2
taais-modules/taais-biz/src/main/java/com/taais/biz/service/impl/VideoStableServiceImpl.java

@@ -203,6 +203,9 @@ public class VideoStableServiceImpl extends BaseServiceImpl<VideoStableMapper, V
         return this.removeByIds(Arrays.asList(ids));
     }
 
+    @Resource
+    private CommonAlgorithmConfigServiceImpl algorithmConfigService;
+
     @Override
     public CommonResult start(Long id) {
         VideoStable videoStable = getById(id);
@@ -235,7 +238,9 @@ public class VideoStableServiceImpl extends BaseServiceImpl<VideoStableMapper, V
 
         videoStable.setLogPath(videoStable.getOutputPath() + File.separator + getLogFileName(videoStable));
 
-        HttpResponseEntity responseEntity = sendPostMsg(video_stable_start_url, videoStable);
+        String url = algorithmConfigService.getByAlgorithmName("电子稳相").getStartApi();
+
+        HttpResponseEntity responseEntity = sendPostMsg(url, videoStable);
         if (ObjectUtil.isNotNull(responseEntity) && responseEntity.getStatus() == 200) {
             return CommonResult.success("任务开始成功,请等待完成");
         } else {
@@ -329,7 +334,10 @@ public class VideoStableServiceImpl extends BaseServiceImpl<VideoStableMapper, V
         VideoStable videoStable = getById(id);
 
         videoStable.setLogPath(videoStable.getOutputPath() + File.separator + getLogFileName(videoStable));
-        HttpResponseEntity responseEntity = sendPostMsg(video_stable_stop_url, videoStable);
+
+        String url = algorithmConfigService.getByAlgorithmName("电子稳相").getTerminateApi();
+
+        HttpResponseEntity responseEntity = sendPostMsg(url, videoStable);
         if (ObjectUtil.isNotNull(responseEntity) && responseEntity.getStatus() == 200) {
             videoStable.setStatus(BizConstant.VideoStatus.INTERRUPTED);
             updateById(videoStable);