进度识别

This commit is contained in:
lcj
2025-12-02 16:12:07 +08:00
parent 40559d4d73
commit 4e3faa7a23

View File

@ -1220,7 +1220,7 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
@Override @Override
public CompletableFuture<Boolean> recognizeAsync(Long bigPictureId, String fileUrl, String tifUrl, List<Long> projectIds) { public CompletableFuture<Boolean> recognizeAsync(Long bigPictureId, String fileUrl, String tifUrl, List<Long> projectIds) {
// 调用识别算法 // 调用识别算法
RecognizeVo recognizeVo = null; RecognizeVo recognizeVo;
try { try {
recognizeVo = recognizerManager.recognize(fileUrl); recognizeVo = recognizerManager.recognize(fileUrl);
} catch (Exception e) { } catch (Exception e) {
@ -1278,18 +1278,20 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
} }
// 将识别数据同步到图片上 // 将识别数据同步到图片上
Long recognizePic = null; Long recognizePic = null;
try { if (CollUtil.isNotEmpty(recognizerVoList)) {
RecognizeImageStreamResult drawnImage = RecognizerManager.drawImageToStream(fileUrl, targets); try {
InputStream inputStream = drawnImage.getInputStream(); RecognizeImageStreamResult drawnImage = RecognizerManager.drawImageToStream(fileUrl, targets);
String contentType = drawnImage.getContentType(); InputStream inputStream = drawnImage.getInputStream();
long length = drawnImage.getLength(); String contentType = drawnImage.getContentType();
SysOssVo drawnVo = ossService.upload(inputStream, fileName, contentType, length); long length = drawnImage.getLength();
if (drawnVo != null) { SysOssVo drawnVo = ossService.upload(inputStream, fileName, contentType, length);
recognizePic = drawnVo.getOssId(); if (drawnVo != null) {
recognizePic = drawnVo.getOssId();
}
} catch (IOException | URISyntaxException e) {
log.error("将识别数据同步到图片上失败", e);
return CompletableFuture.completedFuture(false);
} }
} catch (IOException | URISyntaxException e) {
log.error("将识别数据同步到图片上失败", e);
return CompletableFuture.completedFuture(false);
} }
String recognizerStr = JSONUtil.toJsonStr(recognizerVoList); String recognizerStr = JSONUtil.toJsonStr(recognizerVoList);
// 更新数据和状态 // 更新数据和状态
@ -1299,10 +1301,7 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl<PgsProgressPla
.set(DroDroneBigPicture::getRecognizePic, recognizePic) .set(DroDroneBigPicture::getRecognizePic, recognizePic)
.set(DroDroneBigPicture::getRecognizeResult, recognizerStr) .set(DroDroneBigPicture::getRecognizeResult, recognizerStr)
.update(); .update();
if (!update) { return CompletableFuture.completedFuture(update);
return CompletableFuture.completedFuture(false);
}
return CompletableFuture.completedFuture(true);
} }
/** /**