|
@@ -16,6 +16,7 @@ import com.taais.biz.domain.ToInfrared;
|
|
|
import com.taais.biz.domain.bo.ToInfraredBo;
|
|
|
import com.taais.biz.domain.bo.ToInfraredStartResultBo;
|
|
|
import com.taais.biz.domain.bo.VideoStableStartResultBo;
|
|
|
+import com.taais.biz.domain.vo.StartToInfraredTask;
|
|
|
import com.taais.biz.domain.vo.ToInfraredVo;
|
|
|
import com.taais.biz.mapper.ToInfraredMapper;
|
|
|
import com.taais.biz.service.IToInfraredService;
|
|
@@ -31,6 +32,8 @@ import com.taais.common.orm.core.service.impl.BaseServiceImpl;
|
|
|
import com.taais.system.domain.vo.SysOssVo;
|
|
|
import com.taais.system.service.ISysOssService;
|
|
|
import jakarta.annotation.Resource;
|
|
|
+import lombok.extern.log4j.Log4j;
|
|
|
+import lombok.extern.log4j.Log4j2;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.core.io.FileSystemResource;
|
|
@@ -43,6 +46,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import static com.taais.biz.constant.BizConstant.VideoStatus.NOT_START;
|
|
|
import static com.taais.biz.domain.table.ToInfraredTableDef.TO_INFRARED;
|
|
|
import static com.taais.biz.service.impl.VideoStableServiceImpl.*;
|
|
|
+import static com.taais.biz.constant.BizConstant.AlgorithmType;
|
|
|
|
|
|
/**
|
|
|
* 可见光转红外Service业务层处理
|
|
@@ -51,10 +55,8 @@ import static com.taais.biz.service.impl.VideoStableServiceImpl.*;
|
|
|
* 2024-09-20
|
|
|
*/
|
|
|
@Service
|
|
|
+@Log4j2
|
|
|
public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToInfrared> implements IToInfraredService {
|
|
|
- @Value("${server.to_infrared_start_url}")
|
|
|
- private String to_infrared_start_url;
|
|
|
-
|
|
|
@Value("${server.to_infrared_stop_url}")
|
|
|
private String to_infrared_stop_url;
|
|
|
|
|
@@ -63,6 +65,10 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
|
|
|
|
|
|
@Resource
|
|
|
private ToInfraredMapper toInfraredMapper;
|
|
|
+ @Autowired
|
|
|
+ private AlgorithmConfigTrackServiceImpl algorithmConfigTrackService;
|
|
|
+ @Autowired
|
|
|
+ private AlgorithmModelTrackServiceImpl algorithmModelTrackService;
|
|
|
|
|
|
@Override
|
|
|
public QueryWrapper query() {
|
|
@@ -223,7 +229,7 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
|
|
|
|
|
|
Path path = Paths.get(resourcePath);
|
|
|
Path inputPath = path.resolveSibling(fileName_without_suffix + "_images");
|
|
|
- Path outputPath = path.resolveSibling(fileName_without_suffix + "_stable");
|
|
|
+ Path outputPath = path.resolveSibling(fileName_without_suffix + "_to_infrared");
|
|
|
|
|
|
makeDir(inputPath.toString());
|
|
|
makeDir(outputPath.toString());
|
|
@@ -235,12 +241,28 @@ public class ToInfraredServiceImpl extends BaseServiceImpl<ToInfraredMapper, ToI
|
|
|
|
|
|
toInfrared.setStartTime(new Date());
|
|
|
|
|
|
- HttpResponseEntity responseEntity = sendPostMsg(to_infrared_start_url, toInfrared);
|
|
|
+ AlgorithmModelTrack algorithmModelTrack = algorithmModelTrackService.getById(toInfrared.getAlgorithmModelId());
|
|
|
+ AlgorithmConfigTrack algorithmConfigTrack = algorithmConfigTrackService.getById(algorithmModelTrack.getAlgorithmId());
|
|
|
+
|
|
|
+ StartToInfraredTask startToInfraredTask = new StartToInfraredTask();
|
|
|
+ startToInfraredTask.setBizId(toInfrared.getId());
|
|
|
+
|
|
|
+ // if (algorithmConfigTrack.getType() == AlgorithmType.TRAIN) {
|
|
|
+ startToInfraredTask.setModel_path(algorithmModelTrack.getModelAddress());
|
|
|
+ // }
|
|
|
+
|
|
|
+ startToInfraredTask.setOtherParams(algorithmConfigTrack.getParameterConfig());
|
|
|
+ startToInfraredTask.setSource_dir(toInfrared.getInputPath());
|
|
|
+ startToInfraredTask.setResult_dir(toInfrared.getOutputPath());
|
|
|
+
|
|
|
+ HttpResponseEntity responseEntity = sendPostMsg(algorithmConfigTrack.getAlgorithmAddress(), startToInfraredTask);
|
|
|
if (ObjectUtil.isNotNull(responseEntity) && responseEntity.getStatus() == 200) {
|
|
|
toInfrared.setStatus(BizConstant.VideoStatus.RUNNING);
|
|
|
updateById(toInfrared);
|
|
|
return CommonResult.success("任务开始成功,请等待完成");
|
|
|
} else {
|
|
|
+ toInfrared.setStatus(BizConstant.VideoStatus.FAILED);
|
|
|
+ updateById(toInfrared);
|
|
|
return CommonResult.fail("任务开始失败,请检查!");
|
|
|
}
|
|
|
}
|