|
@@ -21,8 +21,12 @@ import com.taais.common.core.utils.StringUtils;
|
|
|
import com.taais.common.json.utils.JsonUtils;
|
|
|
import com.taais.common.orm.core.page.PageQuery;
|
|
|
import com.taais.common.orm.core.service.impl.BaseServiceImpl;
|
|
|
+import com.taais.system.domain.SysDictData;
|
|
|
import com.taais.system.domain.SysOss;
|
|
|
+import com.taais.system.domain.bo.SysDictDataBo;
|
|
|
+import com.taais.system.domain.vo.SysDictDataVo;
|
|
|
import com.taais.system.domain.vo.SysOssVo;
|
|
|
+import com.taais.system.service.ISysDictDataService;
|
|
|
import com.taais.system.service.ISysOssService;
|
|
|
import jakarta.annotation.Resource;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -57,15 +61,16 @@ import static com.taais.biz.domain.table.DataAugmentationTableDef.DATA_AUGMENTAT
|
|
|
@Service
|
|
|
@Slf4j
|
|
|
public class DataAugmentationServiceImpl extends BaseServiceImpl<DataAugmentationMapper, DataAugmentation> implements IDataAugmentationService {
|
|
|
- @Value("${server.video_stable_start_url}")
|
|
|
- private String video_stable_start_url;
|
|
|
-
|
|
|
- @Value("${server.video_stable_stop_url}")
|
|
|
- private String video_stable_stop_url;
|
|
|
+// @Value("${server.video_stable_start_url}")
|
|
|
+// private String data_augmentation_start_url;
|
|
|
+//
|
|
|
+// @Value("${server.video_stable_start_url}")
|
|
|
+// private String data_augmentation_stop_url;
|
|
|
|
|
|
@Autowired
|
|
|
private ISysOssService ossService;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private ISysDictDataService iSysDictDataService;
|
|
|
@Resource
|
|
|
private DataAugmentationMapper dataAugmentationMapper;
|
|
|
|
|
@@ -96,6 +101,8 @@ public class DataAugmentationServiceImpl extends BaseServiceImpl<DataAugmentatio
|
|
|
(dataAugmentationBo.getAlgorithmPath()));
|
|
|
queryWrapper.and(DATA_AUGMENTATION.HYPERPARAMETER_CONFIGURATION.like
|
|
|
(dataAugmentationBo.getHyperparameterConfiguration()));
|
|
|
+ queryWrapper.and(DATA_AUGMENTATION.TASK_TYPE.like
|
|
|
+ (dataAugmentationBo.getTaskType()));
|
|
|
|
|
|
return queryWrapper;
|
|
|
}
|
|
@@ -155,18 +162,6 @@ public class DataAugmentationServiceImpl extends BaseServiceImpl<DataAugmentatio
|
|
|
}
|
|
|
|
|
|
DataAugmentation dataAugmentation = MapstructUtils.convert(dataAugmentationBo, DataAugmentation.class);
|
|
|
-// DataAugmentation dataAugmentation = new DataAugmentation();
|
|
|
-// dataAugmentation.setId(dataAugmentationBo.getId());
|
|
|
-// dataAugmentation.setOutputPath(dataAugmentationBo.getOutputPath());
|
|
|
-// dataAugmentation.setLog(dataAugmentationBo.getLog());
|
|
|
-// dataAugmentation.setCostSecond(dataAugmentationBo.getCostSecond());
|
|
|
-// dataAugmentation.setInputPath(dataAugmentationBo.getInputPath());
|
|
|
-// dataAugmentation.setEndTime(dataAugmentationBo.getEndTime());
|
|
|
-// dataAugmentation.setAlgorithmPath(dataAugmentationBo.getAlgorithmPath());
|
|
|
-// dataAugmentation.setHyperparameterConfiguration(dataAugmentationBo.getHyperparameterConfiguration());
|
|
|
-// dataAugmentation.setInputOssId(dataAugmentationBo.getInputOssId());
|
|
|
-// dataAugmentation.setRemarks(dataAugmentationBo.getRemarks());
|
|
|
-// dataAugmentation.setStartTime(dataAugmentationBo.getStartTime());
|
|
|
dataAugmentation.setStatus(BizConstant.VideoStatus.NOT_START);
|
|
|
|
|
|
return this.save(dataAugmentation);// 使用全局配置的雪花算法主键生成器生成ID值
|
|
@@ -250,8 +245,15 @@ public class DataAugmentationServiceImpl extends BaseServiceImpl<DataAugmentatio
|
|
|
|
|
|
dataAugmentation.setStatus(BizConstant.VideoStatus.RUNNING);
|
|
|
updateById(dataAugmentation);
|
|
|
-
|
|
|
- HttpResponseEntity responseEntity = sendPostMsg(video_stable_start_url, dataAugmentation);
|
|
|
+ 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!请在数据字典中设置该算法的推理url!");
|
|
|
+ }
|
|
|
+ String data_augmentation_start_url = sysDictDataVos.get(0).getDictValue();
|
|
|
+ HttpResponseEntity responseEntity = sendPostMsg(data_augmentation_start_url, dataAugmentation);
|
|
|
if (responseEntity.getStatus() == 200) {
|
|
|
dataAugmentation.setStatus(BizConstant.VideoStatus.FAILED);
|
|
|
updateById(dataAugmentation);
|
|
@@ -343,12 +345,19 @@ public class DataAugmentationServiceImpl extends BaseServiceImpl<DataAugmentatio
|
|
|
@Override
|
|
|
public CommonResult stop(Long id) {
|
|
|
DataAugmentation dataAugmentation = getById(id);
|
|
|
-
|
|
|
- HttpResponseEntity responseEntity = sendPostMsg(video_stable_stop_url, dataAugmentation);
|
|
|
+ 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();
|
|
|
+ HttpResponseEntity responseEntity = sendPostMsg(data_augmentation_stop_url, dataAugmentation);
|
|
|
if (ObjectUtil.isNotNull(responseEntity) && responseEntity.getStatus() == 200) {
|
|
|
dataAugmentation.setStatus(BizConstant.VideoStatus.INTERRUPTED);
|
|
|
updateById(dataAugmentation);
|
|
|
- return CommonResult.fail("终止任务成功");
|
|
|
+ return CommonResult.success("终止任务成功");
|
|
|
} else {
|
|
|
return CommonResult.fail("终止任务失败");
|
|
|
}
|