|
|
|
@ -23,6 +23,7 @@ import com.supervision.neo4j.service.Neo4jService;
|
|
|
|
|
import com.supervision.police.domain.*;
|
|
|
|
|
import com.supervision.police.dto.NoteRecordDTO;
|
|
|
|
|
import com.supervision.police.dto.NoteRecordDetailDTO;
|
|
|
|
|
import com.supervision.police.mapper.ModelAtomicResultMapper;
|
|
|
|
|
import com.supervision.police.mapper.NoteRecordMapper;
|
|
|
|
|
import com.supervision.police.mapper.NoteRecordSplitMapper;
|
|
|
|
|
import com.supervision.police.service.*;
|
|
|
|
@ -74,6 +75,8 @@ public class NoteRecordSplitServiceImpl extends ServiceImpl<NoteRecordSplitMappe
|
|
|
|
|
|
|
|
|
|
private final ModelCaseService modelCaseService;
|
|
|
|
|
|
|
|
|
|
private final ModelAtomicResultService modelAtomicResultService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(transactionManager = "dataSourceTransactionManager", rollbackFor = Exception.class)
|
|
|
|
@ -286,17 +289,14 @@ public class NoteRecordSplitServiceImpl extends ServiceImpl<NoteRecordSplitMappe
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(transactionManager = "dataSourceTransactionManager", rollbackFor = Exception.class, noRollbackFor = BusinessException.class)
|
|
|
|
|
public void delRecords(String id) {
|
|
|
|
|
|
|
|
|
|
NoteRecord noteRecord = noteRecordMapper.selectById(id);
|
|
|
|
|
// 去掉逻辑删除,直接删除
|
|
|
|
|
// noteRecord.setDataStatus(StringUtils.getUUID());
|
|
|
|
|
// noteRecordMapper.updateById(noteRecord);
|
|
|
|
|
String fileIds = noteRecord.getFileIds();
|
|
|
|
|
if (StringUtils.isNotEmpty(fileIds)) {
|
|
|
|
|
|
|
|
|
|
//删除文件
|
|
|
|
|
for (String fileId : fileIds.split(",")) {
|
|
|
|
|
|
|
|
|
|
MinioFile minioFile = minioFileMapper.selectById(fileId);
|
|
|
|
|
// 删除文件
|
|
|
|
|
LangChainChatRes langChainChatRes = langChainChatService.deleteFile(DeleteFileDTO.create(noteRecord.getCaseId(), minioFile.getFilename()));
|
|
|
|
@ -306,7 +306,6 @@ public class NoteRecordSplitServiceImpl extends ServiceImpl<NoteRecordSplitMappe
|
|
|
|
|
minioFile.setDataStatus(StringUtils.getUUID());
|
|
|
|
|
minioFileMapper.updateById(minioFile);
|
|
|
|
|
minioService.delFile(fileId);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 去掉逻辑删除,直接删除
|
|
|
|
@ -324,15 +323,27 @@ public class NoteRecordSplitServiceImpl extends ServiceImpl<NoteRecordSplitMappe
|
|
|
|
|
if (StrUtil.equals("1", item.getAddNeo4j())) {
|
|
|
|
|
// 删除尾节点(不删除头节点),如果删除尾节点,关系会被自动删除
|
|
|
|
|
try {
|
|
|
|
|
neo4jService.delNode(item.getEndNodeGraphId());
|
|
|
|
|
if (ObjectUtil.isNotEmpty(item.getRelGraphId())) {
|
|
|
|
|
// 先移除关系
|
|
|
|
|
neo4jService.deleteRel(item.getRelGraphId());
|
|
|
|
|
}
|
|
|
|
|
if (ObjectUtil.isNotEmpty(item.getEndNodeGraphId())) {
|
|
|
|
|
// 再移除尾节点
|
|
|
|
|
neo4jService.delNode(item.getEndNodeGraphId());
|
|
|
|
|
}
|
|
|
|
|
if (ObjectUtil.isNotEmpty(item.getStartNodeGraphId())) {
|
|
|
|
|
// 尝试删除头节点(只有头节点不存在任何关系的时候才进行删除)
|
|
|
|
|
neo4jService.deleteNoRelationNode(item.getStartNodeGraphId());
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("删除关系失败:{}", item.getRelation(), e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
// TODO 是否需要把model_atomic_result的结果也删除了?
|
|
|
|
|
// 删除三元组数据
|
|
|
|
|
tripleInfoService.lambdaUpdate().eq(TripleInfo::getRecordId, id).remove();
|
|
|
|
|
// 把model_atomic_result的结果也删除了
|
|
|
|
|
modelAtomicResultService.lambdaUpdate().eq(ModelAtomicResult::getRecordId, id).remove();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|