|
@@ -197,6 +197,43 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
|
|
|
return this.updateById(entity);// 使用全局配置的雪花算法主键生成器生成ID值
|
|
|
}
|
|
|
|
|
|
+ @Transactional
|
|
|
+ public ToInfrared insert2(ToInfraredBo entityBo) {
|
|
|
+ // 检查input_oss_id是否存在
|
|
|
+ if (ObjectUtil.isNull(entityBo.getInputOssId())) {
|
|
|
+ throw new RuntimeException("oss文件不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ SysOssVo ossEntity = ossService.getById(entityBo.getInputOssId());
|
|
|
+ if (ObjectUtil.isNull(ossEntity)) {
|
|
|
+ throw new RuntimeException("oss文件不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ ToInfrared entity = new ToInfrared();
|
|
|
+ entity.setInputOssId(entityBo.getInputOssId());
|
|
|
+ entity.setUrl(ossEntity.getUrl());
|
|
|
+ entity.setZipFilePath(ossEntity.getFileName());
|
|
|
+ entity.setName(entityBo.getName());
|
|
|
+ entity.setStatus(NOT_START);
|
|
|
+ entity.setRemarks(entityBo.getRemarks());
|
|
|
+ entity.setAlgorithmModelId(entityBo.getAlgorithmModelId());
|
|
|
+ entity.setAlgorithmId(entityBo.getAlgorithmId());
|
|
|
+ boolean flag = this.save(entity);
|
|
|
+
|
|
|
+ if (!flag) {
|
|
|
+ throw new RuntimeException("新增失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ entity = updateEntity(entity, entityBo, ossEntity);
|
|
|
+
|
|
|
+ // 步骤 6. 保存算法参数到数据库
|
|
|
+ boolean flag_ = this.updateById(entity);// 使用全局配置的雪花算法主键生成器生成ID值
|
|
|
+ if (!flag_) {
|
|
|
+ throw new RuntimeException("新增失败");
|
|
|
+ }
|
|
|
+ return entity;
|
|
|
+ }
|
|
|
+
|
|
|
public static Map<String, Object> getAlgorithmParameters(String algorithmConfigStr, Map<String, Object> otherParams) {
|
|
|
Map<String, Object> algorithmParameters = new HashMap<>();
|
|
|
List<Dict> config_list = JsonUtils.parseArrayMap(algorithmConfigStr);
|
|
@@ -244,8 +281,7 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
|
|
|
result.put("source_dir", source_dir);
|
|
|
result.put("result_dir", result_dir);
|
|
|
result.put("log_path", log_path);
|
|
|
- }
|
|
|
- else if (algorithmConfig.getType().equals(BizConstant.AlgorithmType.REASONING)) {
|
|
|
+ } else if (algorithmConfig.getType().equals(BizConstant.AlgorithmType.REASONING)) {
|
|
|
String source_dir = getPredictInputPath(ossEntity);
|
|
|
String result_dir = getPredictOutputPath(entity, ossEntity);
|
|
|
String log_path = getLogFilePath(result_dir, entity.getId(), BizConstant.TO_INFRARED_SUFFIX);
|
|
@@ -254,8 +290,7 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
|
|
|
result.put("result_dir", result_dir);
|
|
|
result.put("log_path", log_path);
|
|
|
result.put("model_path", model_path);
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else {
|
|
|
throw new RuntimeException("算法类型错误");
|
|
|
}
|
|
|
|