提交 f842eb86 作者: 洪东保

debug

父级 45a36200
...@@ -21,7 +21,7 @@ public class UserController { ...@@ -21,7 +21,7 @@ public class UserController {
private UserService userService; private UserService userService;
/** /**
* 咨询窗用 * 账号密码登录
* *
* @param vo * @param vo
* @return * @return
......
...@@ -48,7 +48,7 @@ import java.util.concurrent.atomic.AtomicInteger; ...@@ -48,7 +48,7 @@ import java.util.concurrent.atomic.AtomicInteger;
public class EmailSender { public class EmailSender {
@Value("${email.sender}") @Value("${email.sender}")
private String SENDER; private String SENDER;
// @Value("${email.sender-pwd}") // @Value("${email.sender-pwd}")
// private String EMAIL_PWD; // private String EMAIL_PWD;
@Value("${email.push-switch}") @Value("${email.push-switch}")
private Boolean pushSwitch; private Boolean pushSwitch;
...@@ -72,13 +72,14 @@ public class EmailSender { ...@@ -72,13 +72,14 @@ public class EmailSender {
/** /**
* 发送邮件,带附件 * 发送邮件,带附件
*
* @param emailPushBuilder * @param emailPushBuilder
* @return * @return
*/ */
public Boolean sendEmailWithAttachment(EmailPush emailPushBuilder) { public Boolean sendEmailWithAttachment(EmailPush emailPushBuilder) {
log.info("sendEmailWithAttachment start, sender -> {}", SENDER); log.info("sendEmailWithAttachment start, sender -> {}", SENDER);
if(!pushSwitch){ if (!pushSwitch) {
log.info("【邮箱推送】:应用未开启邮件推送功能"); log.info("【邮箱推送】:应用未开启邮件推送功能");
return false; return false;
} }
...@@ -92,23 +93,23 @@ public class EmailSender { ...@@ -92,23 +93,23 @@ public class EmailSender {
String toUserCode = emailPushBuilder.getToUserCode(); String toUserCode = emailPushBuilder.getToUserCode();
Boolean emailPushAccess = emailPushBuilder.getEmailPushAccess(); Boolean emailPushAccess = emailPushBuilder.getEmailPushAccess();
//用户自定义邮件推送许可 //用户自定义邮件推送许可
if(emailPushAccess){ if (emailPushAccess) {
log.info("用户允许邮件推送,准备推送邮件至{}------", emailPushBuilder.getToEmail()); log.info("用户允许邮件推送,准备推送邮件至{}------", emailPushBuilder.getToEmail());
} else{ } else {
log.info("用户关闭了邮件推送,推送终止------"); log.info("用户关闭了邮件推送,推送终止------");
processLogService.log(meetingId,subMeetingId,"用户关闭了邮件推送,推送终止"); processLogService.log(meetingId, subMeetingId, "用户关闭了邮件推送,推送终止");
return false; return false;
} }
if(StringUtils.isEmpty(toEmail)){ if (StringUtils.isEmpty(toEmail)) {
log.error("收件邮箱为空,推送失败"); log.error("收件邮箱为空,推送失败");
processLogService.log(meetingId,subMeetingId,"收件邮箱为空,推送失败。environment->"+environment+",testReceiver->"+testReceiver+",realEmail->"+emailPushBuilder.getToEmail()); processLogService.log(meetingId, subMeetingId, "收件邮箱为空,推送失败。environment->" + environment + ",testReceiver->" + testReceiver + ",realEmail->" + emailPushBuilder.getToEmail());
return false; return false;
} }
log.info("准备开始邮件推送..."); log.info("准备开始邮件推送...");
while (retryCount.intValue() < MAX_RETRY && isSent != null && !isSent){ while (retryCount.intValue() < MAX_RETRY && isSent != null && !isSent) {
try { try {
ClientSecretCredential clientSecretCredential = new ClientSecretCredentialBuilder() ClientSecretCredential clientSecretCredential = new ClientSecretCredentialBuilder()
.clientId(CLIENT_ID) .clientId(CLIENT_ID)
.clientSecret(CLIENT_SECRET) .clientSecret(CLIENT_SECRET)
.tenantId(TENANT_ID) .tenantId(TENANT_ID)
...@@ -132,21 +133,18 @@ public class EmailSender { ...@@ -132,21 +133,18 @@ public class EmailSender {
message.subject = subject + "会议纪要"; message.subject = subject + "会议纪要";
ItemBody body = new ItemBody(); ItemBody body = new ItemBody();
body.contentType = BodyType.HTML; body.contentType = BodyType.HTML;
if(redisUtils.hasKey("EMAIL_CONTENT_TEMPLATE")){
if(StringUtils.isEmpty(toUserCode)){ if (StringUtils.isEmpty(toUserCode)) {
isSent = false; isSent = false;
processLogService.log(meetingId,subMeetingId,"【邮件推送异常】:收件人工号不能为空"); processLogService.log(meetingId, subMeetingId, "【邮件推送异常】:收件人工号不能为空");
continue; continue;
}
MeetEmailTemplate one = meetEmailTemplateService.getOne(new LambdaQueryWrapper<MeetEmailTemplate>().orderByDesc(MeetEmailTemplate::getCreateTime).select(MeetEmailTemplate::getContent));
String email_content_template = one.getContent();
long expireTimestamp = ZonedDateTime.now().plusDays(2).toInstant().toEpochMilli();
body.content = MessageFormat.format(email_content_template,meetingInstanceId,toUserCode,String.valueOf(expireTimestamp));
}else{
isSent = null;
processLogService.log(meetingId,subMeetingId,"【邮件推送异常】:邮件模板未设置");
throw new RobotBaseException("邮件模板未设置");
} }
MeetEmailTemplate one = meetEmailTemplateService.getOne(new LambdaQueryWrapper<MeetEmailTemplate>()
.orderByDesc(MeetEmailTemplate::getCreateTime)
.select(MeetEmailTemplate::getContent).last("limit 1"));
String emailContentTemplate = one.getContent();
long expireTimestamp = ZonedDateTime.now().plusDays(2).toInstant().toEpochMilli();
body.content = MessageFormat.format(emailContentTemplate, meetingInstanceId, toUserCode, String.valueOf(expireTimestamp));
message.body = body; message.body = body;
LinkedList<Recipient> toRecipientsList = new LinkedList<>(); LinkedList<Recipient> toRecipientsList = new LinkedList<>();
...@@ -162,7 +160,7 @@ public class EmailSender { ...@@ -162,7 +160,7 @@ public class EmailSender {
FileAttachment attachments = new FileAttachment(); FileAttachment attachments = new FileAttachment();
attachments.name = attachment.getName() + ".docx"; attachments.name = attachment.getName() + ".docx";
attachments.oDataType = "#microsoft.graph.fileAttachment"; attachments.oDataType = "#microsoft.graph.fileAttachment";
attachments.contentType="application/msword"; attachments.contentType = "application/msword";
attachments.contentBytes = attachment.getBytes(); attachments.contentBytes = attachment.getBytes();
attachmentsList.add(attachments); attachmentsList.add(attachments);
} }
...@@ -182,13 +180,13 @@ public class EmailSender { ...@@ -182,13 +180,13 @@ public class EmailSender {
log.info("邮件已成功发送: meetingId->{}, subMeetingId->{}", meetingId, subMeetingId); log.info("邮件已成功发送: meetingId->{}, subMeetingId->{}", meetingId, subMeetingId);
isSent = true; isSent = true;
}catch (Exception e) { } catch (Exception e) {
retryCount.getAndIncrement(); retryCount.getAndIncrement();
// 异常处理 // 异常处理
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw); PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw); e.printStackTrace(pw);
processLogService.log(meetingId,subMeetingId,"【邮件推送异常】:"+sw.toString()); processLogService.log(meetingId, subMeetingId, "【邮件推送异常】:" + sw.toString());
if (retryCount.intValue() > MAX_RETRY) { if (retryCount.intValue() > MAX_RETRY) {
log.error("邮件发送达到最大重试次数: meetingId->{}", meetingId); log.error("邮件发送达到最大重试次数: meetingId->{}", meetingId);
throw new RuntimeException(e); throw new RuntimeException(e);
...@@ -210,7 +208,7 @@ public class EmailSender { ...@@ -210,7 +208,7 @@ public class EmailSender {
AtomicInteger retryCount = new AtomicInteger(0); AtomicInteger retryCount = new AtomicInteger(0);
boolean isSent = false; boolean isSent = false;
while (retryCount.intValue() < MAX_RETRY && !isSent){ while (retryCount.intValue() < MAX_RETRY && !isSent) {
try { try {
ClientSecretCredential clientSecretCredential = new ClientSecretCredentialBuilder() ClientSecretCredential clientSecretCredential = new ClientSecretCredentialBuilder()
.clientId(CLIENT_ID) .clientId(CLIENT_ID)
......
...@@ -230,7 +230,7 @@ public class FileProcessTask { ...@@ -230,7 +230,7 @@ public class FileProcessTask {
Boolean emailGenerateAccess = meetingInfo.getEmailGenerateAccess(); Boolean emailGenerateAccess = meetingInfo.getEmailGenerateAccess();
if (emailGenerateAccess) { if (emailGenerateAccess) {
Long choiceTemplateType = choiceTemplateType(meetingInfo.getSubject()); Long choiceTemplateType = choiceTemplateType(meetingInfo.getSubject());
log.info("choiceTemplateType->{}", choiceTemplateType); log.info("choiceTemplateType -> meet: {}, type: {}", meetingInfo.getSubject(), choiceTemplateType);
// 2. 获取这个会议需要使用的一个模板 // 2. 获取这个会议需要使用的一个模板
MeetingRecordTemplate template = meetingRecordTemplateService.getEnabledRecordTemplate(choiceTemplateType, userIdMapper.getWidByTid(meetingInfo.getHostUid())); MeetingRecordTemplate template = meetingRecordTemplateService.getEnabledRecordTemplate(choiceTemplateType, userIdMapper.getWidByTid(meetingInfo.getHostUid()));
if (template == null) { if (template == null) {
......
...@@ -91,7 +91,7 @@ public class MeetingRecordTemplate implements Serializable { ...@@ -91,7 +91,7 @@ public class MeetingRecordTemplate implements Serializable {
* 删除标识,0-否(默认),1-是 * 删除标识,0-否(默认),1-是
*/ */
@TableLogic(delval = "1", value = "0") @TableLogic(delval = "1", value = "0")
private Boolean isDel; private Boolean isDel = false;
/** /**
* 模板docx文件 * 模板docx文件
......
...@@ -24,9 +24,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -24,9 +24,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cmeeting.ad.entity.RobotSecurityUser; import com.cmeeting.ad.entity.RobotSecurityUser;
import com.cmeeting.ad.util.SecurityUtil; import com.cmeeting.ad.util.SecurityUtil;
import com.cmeeting.constant.RecordTemplateConstant;
import com.cmeeting.exception.RobotBaseException;
import com.cmeeting.constant.MeetingState; import com.cmeeting.constant.MeetingState;
import com.cmeeting.constant.RecordTemplateConstant;
import com.cmeeting.exception.RobotBaseException; import com.cmeeting.exception.RobotBaseException;
import com.cmeeting.log.service.ProcessLogService; import com.cmeeting.log.service.ProcessLogService;
import com.cmeeting.mapper.primary.MeetingInfoMapper; import com.cmeeting.mapper.primary.MeetingInfoMapper;
...@@ -36,12 +35,9 @@ import com.cmeeting.mapper.secondary.SysUserSysMapper; ...@@ -36,12 +35,9 @@ import com.cmeeting.mapper.secondary.SysUserSysMapper;
import com.cmeeting.pojo.MeetingInfo; import com.cmeeting.pojo.MeetingInfo;
import com.cmeeting.pojo.MeetingRecordTemplate; import com.cmeeting.pojo.MeetingRecordTemplate;
import com.cmeeting.pojo.UserId; import com.cmeeting.pojo.UserId;
import com.cmeeting.service.*;
import com.cmeeting.pojo.UserId;
import com.cmeeting.service.MeetingInfoService; import com.cmeeting.service.MeetingInfoService;
import com.cmeeting.service.MeetingRecordTemplateService; import com.cmeeting.service.SysUserSyncService;
import com.cmeeting.service.TencentMeetingService; import com.cmeeting.util.AESUtils;
import com.cmeeting.service.WeComService;
import com.cmeeting.util.MinioUtils; import com.cmeeting.util.MinioUtils;
import com.cmeeting.util.page.PageUtil; import com.cmeeting.util.page.PageUtil;
import com.cmeeting.vo.MeetingInfoVO; import com.cmeeting.vo.MeetingInfoVO;
...@@ -68,7 +64,10 @@ import org.springframework.util.ObjectUtils; ...@@ -68,7 +64,10 @@ import org.springframework.util.ObjectUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.math.BigInteger; import java.math.BigInteger;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.Charset; import java.nio.charset.Charset;
...@@ -112,17 +111,9 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti ...@@ -112,17 +111,9 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti
@Autowired @Autowired
private SysUserSysMapper sysUserSysMapper; private SysUserSysMapper sysUserSysMapper;
@Autowired @Value("${aec.key}")
private WeComService weComService; public String aesKey;
@Autowired
private TencentMeetingService tencentMeetingService;
@Autowired
private MeetingRecordTemplateService meetingRecordTemplateService;
private String CLIENT_ID = "c06fe7cf-2a89-4099-9805-ce03031938f8";
private String CLIENT_SECRET = "wsu8Q~GxYxPLf2akioQZDRG8NR1EzCAHIAQRVc6u";
private String TENANT_ID = "18653b3e-03c7-499e-8baf-42ef06a814ef";
@Resource @Resource
private SysUserSyncService sysUserSyncService; private SysUserSyncService sysUserSyncService;
...@@ -446,7 +437,8 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti ...@@ -446,7 +437,8 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti
try { try {
//去除内容中除了xml内容以外其他的信息,格式化xml //去除内容中除了xml内容以外其他的信息,格式化xml
String xml = extractXmlFromMarkdown(content, meetingId, subMeetingId); String xml = extractXmlFromMarkdown(content, meetingId, subMeetingId);
minioUtils.upload(recordXmlPath,xml.getBytes(StandardCharsets.UTF_8)); String encrypt = AESUtils.encrypt(xml, aesKey);
minioUtils.upload(recordXmlPath, encrypt.getBytes(StandardCharsets.UTF_8));
meetingInfo.setRecordXml(recordXmlPath); meetingInfo.setRecordXml(recordXmlPath);
} catch (Exception e) { } catch (Exception e) {
log.error("填充会议纪要失败: {}", e.getMessage(), e); log.error("填充会议纪要失败: {}", e.getMessage(), e);
......
...@@ -5,6 +5,7 @@ import cn.chatbot.meeting.LLMConfig; ...@@ -5,6 +5,7 @@ import cn.chatbot.meeting.LLMConfig;
import cn.chatbot.meeting.LLMResult; import cn.chatbot.meeting.LLMResult;
import cn.chatbot.meeting.MeetingProcess; import cn.chatbot.meeting.MeetingProcess;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.IoUtil;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
...@@ -23,6 +24,7 @@ import com.cmeeting.pojo.RecordTemplatePermission; ...@@ -23,6 +24,7 @@ import com.cmeeting.pojo.RecordTemplatePermission;
import com.cmeeting.service.MeetingInfoService; import com.cmeeting.service.MeetingInfoService;
import com.cmeeting.service.MeetingRecordTemplateService; import com.cmeeting.service.MeetingRecordTemplateService;
import com.cmeeting.service.RecordTemplatePermissionService; import com.cmeeting.service.RecordTemplatePermissionService;
import com.cmeeting.util.AESUtils;
import com.cmeeting.util.MinioUtils; import com.cmeeting.util.MinioUtils;
import com.cmeeting.vo.RecordTemplateVO; import com.cmeeting.vo.RecordTemplateVO;
import com.deepoove.poi.XWPFTemplate; import com.deepoove.poi.XWPFTemplate;
...@@ -66,6 +68,8 @@ public class RecordTemplatePermissionServiceImpl extends ServiceImpl<RecordTempl ...@@ -66,6 +68,8 @@ public class RecordTemplatePermissionServiceImpl extends ServiceImpl<RecordTempl
private String llmApiAddr; private String llmApiAddr;
@Value(value = "${llm.api-token}") @Value(value = "${llm.api-token}")
private String llmApiToken; private String llmApiToken;
@Value("${aec.key}")
public String aesKey;
/** /**
* 授权 * 授权
...@@ -163,11 +167,14 @@ public class RecordTemplatePermissionServiceImpl extends ServiceImpl<RecordTempl ...@@ -163,11 +167,14 @@ public class RecordTemplatePermissionServiceImpl extends ServiceImpl<RecordTempl
if(meetingInfo == null) throw new RobotBaseException("历史会议不存在!"); if(meetingInfo == null) throw new RobotBaseException("历史会议不存在!");
String recordContent = meetingInfo.getRecordContent(); String recordContent = meetingInfo.getRecordContent();
if(StringUtils.isEmpty(recordContent)) throw new RobotBaseException("历史会议的转录文件为空,请核实"); if(StringUtils.isEmpty(recordContent)) throw new RobotBaseException("历史会议的转录文件为空,请核实");
try { // try {
textContent = minioUtils.getFileText(recordContent); // textContent = minioUtils.getFileText(recordContent);
} catch (IOException e) { InputStream inputStream = minioUtils.getFile(recordContent);
throw new RobotBaseException("历史会议的转录文件内容读取失败!"); // 解密
} textContent = AESUtils.decrypt(IoUtil.read(inputStream, StandardCharsets.UTF_8), aesKey);
// } catch (IOException e) {
// throw new RobotBaseException("历史会议的转录文件内容读取失败!");
// }
meetingDate = meetingInfo.getStartTime().toLocalDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); meetingDate = meetingInfo.getStartTime().toLocalDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
participantNames = meetingInfo.getParticipantUsers(); participantNames = meetingInfo.getParticipantUsers();
}else{ }else{
...@@ -189,8 +196,7 @@ public class RecordTemplatePermissionServiceImpl extends ServiceImpl<RecordTempl ...@@ -189,8 +196,7 @@ public class RecordTemplatePermissionServiceImpl extends ServiceImpl<RecordTempl
//去除内容中除了xml内容以外其他的信息,格式化xml //去除内容中除了xml内容以外其他的信息,格式化xml
String xml = extractXmlFromMarkdown(llmResult.respond); String xml = extractXmlFromMarkdown(llmResult.respond);
String json = convertXmlToJSON(xml); return convertXmlToJSON(xml);
return json;
} }
@Override @Override
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论