|
@@ -402,6 +402,33 @@ public class SysFileServiceImpl extends ServiceImpl<SysFileMapper, SysFile> impl
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Boolean handsToParseTxt(String kgId, String fileId) {
|
|
|
+ List<SysFile> sysFiles = baseMapper.selectList(new QueryWrapper<SysFile>().lambda().eq(SysFile::getFileId, fileId));
|
|
|
+ String objectKey = "";
|
|
|
+ String identifier = "";
|
|
|
+ if (!CollectionUtils.isEmpty(sysFiles)){
|
|
|
+ objectKey = sysFiles.get(0).getObjectKey();
|
|
|
+ identifier = sysFiles.get(0).getIdentifier();
|
|
|
+ }
|
|
|
+ List<ConvertDocToTxt> convertDocToTxts = new ArrayList<>();
|
|
|
+ convertDocToTxts.add(ConvertDocToTxt.builder().fileId(fileId).objectKey(objectKey).identifier(identifier).isNew(false).build());
|
|
|
+ if (!CollectionUtils.isEmpty(convertDocToTxts)) {
|
|
|
+ Map<String, Object> algMap = new HashMap<>();
|
|
|
+ algMap.put("files", convertDocToTxts);
|
|
|
+ try {
|
|
|
+ // 调用算法,获取文档转换为txt的文本内容。
|
|
|
+ String convertToTxtResTmp = algKgClient.convertToTxt(JSON.toJSONString(algMap));
|
|
|
+ dealAlgTxtRes(convertToTxtResTmp);
|
|
|
+ }catch (Exception ex){
|
|
|
+ ex.printStackTrace();
|
|
|
+ log.info("手动调用算法获取txt文本内容返回结果 ex:{}",ex);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 用户编辑的文件上传至minio中。
|