|
@@ -190,6 +190,13 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ entity = updateEntity(entity, toInfraredBo, ossEntity);
|
|
|
+
|
|
|
+ // 步骤 6. 保存算法参数到数据库
|
|
|
+ return this.updateById(entity);// 使用全局配置的雪花算法主键生成器生成ID值
|
|
|
+ }
|
|
|
+
|
|
|
+ private ToInfrared updateEntity(ToInfrared entity, ToInfraredBo toInfraredBo, SysOssVo ossEntity) {
|
|
|
// 从这里开始,配置任务的algorithm_parameters参数
|
|
|
// 步骤 1. 首先根据算法id获取算法配置
|
|
|
AlgorithmConfigTrack algorithmConfig = algorithmConfigTrackService.getById(entity.getAlgorithmId());
|
|
@@ -213,7 +220,7 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
|
|
|
}
|
|
|
// 步骤 3. 然后根据前端传入的参数,覆盖默认参数
|
|
|
for (String key : algorithmParameters.keySet()) {
|
|
|
- if (toInfraredBo.getOtherParams().containsKey(key)) {
|
|
|
+ if (toInfraredBo.getOtherParams().containsKey(key) && ObjectUtil.isNotEmpty(toInfraredBo.getOtherParams().get(key))) {
|
|
|
algorithmParameters.put(key, toInfraredBo.getOtherParams().get(key));
|
|
|
}
|
|
|
}
|
|
@@ -257,17 +264,16 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
|
|
|
// 步骤 5. 将算法参数map序列化为json字符串,保存到数据库中
|
|
|
entity.setAlgorithmParameters(JsonUtils.toJsonString(result));
|
|
|
|
|
|
-
|
|
|
- String resourcePath = getResourcePath(ossService.getById(entity.getInputOssId()));
|
|
|
makeDir(entity.getInputPath());
|
|
|
makeDir(entity.getOutputPath());
|
|
|
|
|
|
File file = new File(entity.getInputPath());
|
|
|
if (!file.exists()) {
|
|
|
+ String resourcePath = getResourcePath(ossService.getById(entity.getInputOssId()));
|
|
|
ZipUtils.unzip(resourcePath, entity.getInputPath());
|
|
|
}
|
|
|
- // 步骤 6. 保存算法参数到数据库
|
|
|
- return this.updateById(entity);// 使用全局配置的雪花算法主键生成器生成ID值
|
|
|
+
|
|
|
+ return entity;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -279,6 +285,14 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
|
|
|
@Override
|
|
|
public boolean update(ToInfraredBo toInfraredBo) {
|
|
|
ToInfrared toInfrared = MapstructUtils.convert(toInfraredBo, ToInfrared.class);
|
|
|
+
|
|
|
+ SysOssVo ossEntity = ossService.getById(toInfraredBo.getInputOssId());
|
|
|
+ if (ObjectUtil.isNull(ossEntity)) {
|
|
|
+ throw new RuntimeException("oss文件不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ toInfrared = updateEntity(toInfrared, toInfraredBo, ossEntity);
|
|
|
+
|
|
|
if (ObjectUtil.isNotNull(toInfrared) && ObjectUtil.isNotNull(toInfrared.getId())) {
|
|
|
boolean updated = this.updateById(toInfrared);
|
|
|
return updated;
|