提交 624eac0c 作者: duanxincheng

重新生成纪要功能调试

父级 04a0d678
...@@ -202,20 +202,12 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti ...@@ -202,20 +202,12 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti
//获取系统模板 //获取系统模板
MeetingRecordTemplate meetingRecordTemplate = meetingRecordTemplateMapper.selectById(2); MeetingRecordTemplate meetingRecordTemplate = meetingRecordTemplateMapper.selectById(2);
String processedResult = processWithClaude(recordTextBuffer.toString(),meetingDate,meetingRecordTemplate.getPrompt(),meetingId,subMeetingId); String processedResult = processWithClaude(recordTextBuffer.toString(),meetingDate,meetingRecordTemplate.getPrompt(),meetingId,subMeetingId);
String groupOfficeMinutesPath = saveResult(processedResult, recordTextBuffer.toString().getBytes(StandardCharsets.UTF_8), meetingInfo, meetingRecordTemplate); saveResult(processedResult, recordTextBuffer.toString().getBytes(StandardCharsets.UTF_8), meetingInfo, meetingRecordTemplate);
try(InputStream is = new FileInputStream(groupOfficeMinutesPath)){ meetingInfoMapper.update(null,
byte[] meetingMinutesBytes = IOUtils.toByteArray(is);
minioUtils.upload(groupOfficeMinutesPath,meetingMinutesBytes);
meetingInfoMapper.update(meetingInfo,
new LambdaUpdateWrapper<MeetingInfo>() new LambdaUpdateWrapper<MeetingInfo>()
.eq(MeetingInfo::getMeetingId,meetingId) .eq(MeetingInfo::getMeetingId,meetingId)
.eq(subMeetingId != null,MeetingInfo::getSubMeetingId,subMeetingId) .eq(subMeetingId != null,MeetingInfo::getSubMeetingId,subMeetingId)
.set(MeetingInfo::getRecordXml,groupOfficeMinutesPath)); .set(MeetingInfo::getRecordXml,meetingInfo.getRecordXml()));
}catch (Exception e){
throw new RuntimeException(e);
}finally {
FileUtil.del(groupOfficeMinutesPath);
}
return true; return true;
}catch (Exception e){ }catch (Exception e){
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
...@@ -233,46 +225,18 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti ...@@ -233,46 +225,18 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti
* @param meetingInfo 会议对象 * @param meetingInfo 会议对象
* @param meetingRecordTemplate 模板信息 * @param meetingRecordTemplate 模板信息
*/ */
private String saveResult(String content, byte[] recordData, MeetingInfo meetingInfo,MeetingRecordTemplate meetingRecordTemplate) { private void saveResult(String content, byte[] recordData, MeetingInfo meetingInfo,MeetingRecordTemplate meetingRecordTemplate) {
String meetingName;
String meetingId = meetingInfo.getMeetingId(); String meetingId = meetingInfo.getMeetingId();
String subMeetingId = meetingInfo.getSubMeetingId(); String subMeetingId = meetingInfo.getSubMeetingId();
//转录文件临时存储路径 //转录文件临时存储路径
String recordContentPath = meetingId + "-recordContent-" + IdUtil.fastSimpleUUID() + ".txt"; String recordContentPath = meetingId + "-recordContent-" + IdUtil.fastSimpleUUID() + ".txt";
//生成的xml临时存储路径 //生成的xml临时存储路径
String recordXmlPath = meetingId + "-recordXmlPath-" + IdUtil.fastSimpleUUID() + ".xml"; String recordXmlPath = meetingId + "-recordXmlPath-" + IdUtil.fastSimpleUUID() + ".xml";
//填充后的会议纪要名称
String meetingMinutesFileName;
//填充后的会议纪要word文件临时路径
String meetingMinutesPath;
try { try {
//去除内容中除了xml内容以外其他的信息,格式化xml //去除内容中除了xml内容以外其他的信息,格式化xml
String xml = extractXmlFromMarkdown(content, meetingId, subMeetingId); String xml = extractXmlFromMarkdown(content, meetingId, subMeetingId);
minioUtils.upload(recordContentPath,recordData);
minioUtils.upload(recordXmlPath,xml.getBytes(StandardCharsets.UTF_8)); minioUtils.upload(recordXmlPath,xml.getBytes(StandardCharsets.UTF_8));
//将xml格式的内容转换为map,用于填充模板 meetingInfo.setRecordXml(recordXmlPath);
Map<String, Object> dataModel = convertXmlToMap(xml);
meetingName = dataModel.get("meeting_name") != null ? String.valueOf(dataModel.get("meeting_name")) : "腾讯会议纪要";
meetingMinutesFileName = meetingName + "_" + meetingRecordTemplate.getName();
//追加参会人员信息
Map<String,Object> participantsMap = new ConcurrentHashMap<>();
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
String meetingDate = meetingInfo.getStartTime().toLocalDate().format(df);
participantsMap.put("meeting_date",meetingDate);
participantsMap.put("meeting_location","线上腾讯会议");
participantsMap.put("meeting_participants", meetingInfo.getParticipantUsers());
participantsMap.put("meeting_host",meetingInfo.getHost());
dataModel.putAll(participantsMap);
XWPFTemplate template;
try (InputStream inputStream = minioUtils.getFile(meetingRecordTemplate.getTemplate())) {
template = XWPFTemplate.compile(inputStream).render(dataModel);
} catch (IOException e) {
throw new RuntimeException(e);
}
meetingMinutesPath = baseSavePath + meetingMinutesFileName + ".docx";
template.writeAndClose(new FileOutputStream(meetingMinutesPath));
processLogService.log(meetingId,subMeetingId,"填充会议纪要成功");
} catch (Exception e) { } catch (Exception e) {
log.error("填充会议纪要失败: {}", e.getMessage(), e); log.error("填充会议纪要失败: {}", e.getMessage(), e);
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
...@@ -281,19 +245,6 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti ...@@ -281,19 +245,6 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti
processLogService.log(meetingId,subMeetingId,"填充会议纪要失败"+sw.toString()); processLogService.log(meetingId,subMeetingId,"填充会议纪要失败"+sw.toString());
throw new RuntimeException("填充会议纪要失败"); throw new RuntimeException("填充会议纪要失败");
} }
meetingInfoMapper.update(meetingInfo,
new LambdaUpdateWrapper<MeetingInfo>()
.eq(MeetingInfo::getMeetingId,meetingId)
.eq(subMeetingId != null,MeetingInfo::getSubMeetingId,subMeetingId)
.set(MeetingInfo::getRecordContent,recordContentPath)
.set(MeetingInfo::getRecordXml,recordXmlPath)
.set(MeetingInfo::getParticipantUsers,meetingInfo.getParticipantUsers())
.set(MeetingInfo::getIsGenerated,Boolean.TRUE)
);
meetingInfo.setRecordContent(recordContentPath);
meetingInfo.setRecordXml(recordXmlPath);
return baseSavePath + meetingMinutesFileName + ".docx";
} }
/** /**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论