|
|
|
@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.function.Function;
|
|
|
|
@ -75,19 +76,25 @@ public class NoteRecordSplitServiceImpl extends ServiceImpl<NoteRecordSplitMappe
|
|
|
|
|
private final FileOcrProcessService fileOcrProcessService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(transactionManager = "dataSourceTransactionManager", rollbackFor = Exception.class)
|
|
|
|
|
public String uploadRecords(NoteRecordReqVO records) throws IOException {
|
|
|
|
|
return uploadRecords(records, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(transactionManager = "dataSourceTransactionManager", rollbackFor = Exception.class)
|
|
|
|
|
public String uploadRecords(NoteRecordReqVO records) {
|
|
|
|
|
public String uploadRecords(NoteRecordReqVO records, boolean extractFlag) throws IOException {
|
|
|
|
|
|
|
|
|
|
ModelCase modelCase = modelCaseService.getById(records.getCaseId());
|
|
|
|
|
Assert.notEmpty(modelCase.getCaseNo(), "案件编号不能为空");
|
|
|
|
|
|
|
|
|
|
boolean isUpdate = StrUtil.isNotEmpty(records.getId());
|
|
|
|
|
NoteRecord record = records.toNoteRecord();
|
|
|
|
|
String recordId = noteRecordService.saveOrUpdRecord(record);
|
|
|
|
|
|
|
|
|
|
if (isUpdate){
|
|
|
|
|
// 如果是更新操作,不进行三元组提取。
|
|
|
|
|
// 如果record ID不为空且不需要提取三元组,则保存完毕直接返回,不提取。
|
|
|
|
|
if (StrUtil.isNotEmpty(records.getId()) && !extractFlag){
|
|
|
|
|
return recordId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -319,7 +326,7 @@ public class NoteRecordSplitServiceImpl extends ServiceImpl<NoteRecordSplitMappe
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(transactionManager = "dataSourceTransactionManager", rollbackFor = Exception.class)
|
|
|
|
|
public String redoExtract(NoteRecordReqVO records) {
|
|
|
|
|
public String redoExtract(NoteRecordReqVO records) throws IOException {
|
|
|
|
|
CaseTaskRecord caseTaskRecord = caseTaskRecordService.getOne(new QueryWrapper<CaseTaskRecord>().eq("record_id", records.getId()));
|
|
|
|
|
if (caseTaskRecord != null && TASK_STATUS_IN_PROCESS == caseTaskRecord.getStatus()){
|
|
|
|
|
return "任务正在执行中,请稍后再试";
|
|
|
|
@ -357,7 +364,7 @@ public class NoteRecordSplitServiceImpl extends ServiceImpl<NoteRecordSplitMappe
|
|
|
|
|
tripleInfoService.remove(new QueryWrapper<TripleInfo>().eq("record_id", records.getId()));
|
|
|
|
|
// 重置note_record表的isPromptUpdate字段为false
|
|
|
|
|
noteRecordService.lambdaUpdate().eq(NoteRecord::getId, records.getId()).set(NoteRecord::getIsPromptUpdate, false).update();
|
|
|
|
|
return uploadRecords(records);
|
|
|
|
|
return uploadRecords(records, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setRecordDetailSerialNumber(List<NoteRecordDetailDTO> noteRecordDetailDTOList) {
|
|
|
|
|