|
|
|
@ -12,6 +12,7 @@ import com.supervision.police.dto.*;
|
|
|
|
|
import com.supervision.police.service.*;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.aop.framework.AopContext;
|
|
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
@ -39,7 +40,7 @@ public class OCREvidenceServiceImpl implements OCREvidenceService {
|
|
|
|
|
public Boolean submitOrcTask(String fileId) {
|
|
|
|
|
Assert.notEmpty(fileId, "文件id不能为空");
|
|
|
|
|
|
|
|
|
|
asyncDoOrcTask(null, fileId);
|
|
|
|
|
((OCREvidenceService)AopContext.currentProxy()).asyncDoOrcTask(null, fileId);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -59,7 +60,12 @@ public class OCREvidenceServiceImpl implements OCREvidenceService {
|
|
|
|
|
for (FileOcrProcess fileOcrProcess : fileOcrProcesses) {
|
|
|
|
|
|
|
|
|
|
// 调用提取属性接口
|
|
|
|
|
log.info("subOrcTask:文件id:{} 识别结果:{}", fileId, JSONUtil.toJsonStr(fileOcrProcess));
|
|
|
|
|
fileOcrProcess = ocrProcessService.getById(fileOcrProcess.getId());
|
|
|
|
|
if (StrUtil.isEmpty(fileOcrProcess.getOcrText())){
|
|
|
|
|
log.warn("subOrcTask:文件id:{}, 对应的ocrText属性为空,跳过属性识别...", fileId);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
log.debug("subOrcTask:远程接口retrieve开始识别文本...:{}", fileOcrProcess.getOcrText());
|
|
|
|
|
RetrieveResDTO retrieve = ocrService.retrieve(new RetrieveReqDTO(fileOcrProcess.getOcrText()));
|
|
|
|
|
log.info("subOrcTask:文件id:{} 识别结果:{}", fileId, JSONUtil.toJsonStr(retrieve));
|
|
|
|
|
|
|
|
|
@ -75,6 +81,8 @@ public class OCREvidenceServiceImpl implements OCREvidenceService {
|
|
|
|
|
evidenceFileService.save(new EvidenceFile(evidenceId,fileId));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
log.warn("subOrcTask:文件id:{} 识别结果为空", fileId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -96,7 +104,9 @@ public class OCREvidenceServiceImpl implements OCREvidenceService {
|
|
|
|
|
fileEvidencePropertyService.removeByEvidenceAndFileId(evidenceId,fileId);
|
|
|
|
|
|
|
|
|
|
List<FileEvidenceProperty> fileEvidence = toFileEvidence(evidenceId, fileId, propertyMap);
|
|
|
|
|
fileEvidencePropertyService.saveBatch(fileEvidence);
|
|
|
|
|
for (FileEvidenceProperty property : fileEvidence) {
|
|
|
|
|
fileEvidencePropertyService.save(property);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return fileEvidence;
|
|
|
|
|
}
|
|
|
|
@ -133,7 +143,7 @@ public class OCREvidenceServiceImpl implements OCREvidenceService {
|
|
|
|
|
evidenceFileService.save(new EvidenceFile(evidenceId, evidenceFileOCRDTO.getFileId()));
|
|
|
|
|
|
|
|
|
|
// 保存证据属性
|
|
|
|
|
List<FileEvidenceProperty> evidencePropertyList = saveEvidenceProperty(evidenceFileOCRDTO.getEvidenceId(),
|
|
|
|
|
List<FileEvidenceProperty> evidencePropertyList = saveEvidenceProperty(evidenceId,
|
|
|
|
|
evidenceFileOCRDTO.getFileId(), evidenceFileOCRDTO.getProperty());
|
|
|
|
|
|
|
|
|
|
if (CollUtil.isEmpty(evidencePropertyList)){
|
|
|
|
|