diff --git a/servers/boe-server-all/src/main/java/com/xboe/module/boecase/service/impl/CaseKnowledgeServiceImpl.java b/servers/boe-server-all/src/main/java/com/xboe/module/boecase/service/impl/CaseKnowledgeServiceImpl.java
index a085c1d4..f34d7bd0 100644
--- a/servers/boe-server-all/src/main/java/com/xboe/module/boecase/service/impl/CaseKnowledgeServiceImpl.java
+++ b/servers/boe-server-all/src/main/java/com/xboe/module/boecase/service/impl/CaseKnowledgeServiceImpl.java
@@ -14,7 +14,6 @@ import com.xboe.enums.CaseDocumentLogCaseStatusEnum;
import com.xboe.enums.CaseDocumentLogOptStatusEnum;
import com.xboe.enums.CaseDocumentLogOptTypeEnum;
import com.xboe.enums.CaseDocumentLogRunStatusEnum;
-import com.xboe.module.assistance.service.IEmailService;
import com.xboe.module.assistance.service.ISmtpEmailService;
import com.xboe.module.boecase.dao.CaseDocumentLogDao;
import com.xboe.module.boecase.dao.CasesDao;
@@ -77,9 +76,6 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
@Autowired
private IAiAccessTokenService aiAccessTokenService;
- @Autowired
- private IEmailService emailService;
-
@Autowired
private ISmtpEmailService smtpEmailService;
@@ -1197,6 +1193,7 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
* 根据文件状态更新日志记录
*/
private void updateLogStatusByFileStatus(CaseDocumentLog caseLog, String fileStatus) {
+ boolean needToSendEmail = false;
try {
boolean needUpdate = false;
@@ -1213,7 +1210,8 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
caseLog.setOptStatus(CaseDocumentLogOptStatusEnum.SUCCESS.getCode());
caseLog.setCaseStatus(CaseDocumentLogCaseStatusEnum.FAILED.getCode());
needUpdate = true;
- log.error("文档处理失败,更新状态,taskId: {}, caseId: {}", caseLog.getTaskId(), caseLog.getCaseId());
+ needToSendEmail = true;
+ log.error("文档处理失败,需要发送邮件,更新状态,taskId: {}, caseId: {}", caseLog.getTaskId(), caseLog.getCaseId());
} else {
// 其他状态(uploaded、texted、vectoring),不做数据变更
log.info("文档状态为{},暂不更新数据库,taskId: {}", fileStatus, caseLog.getTaskId());
@@ -1231,6 +1229,28 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
} catch (Exception e) {
log.error("更新日志状态异常,taskId: {}, fileStatus: {}", caseLog.getTaskId(), fileStatus, e);
}
+
+ if (needToSendEmail) {
+ String subject = "【知识处理报警】AI平台处理失败-操作类型:【" + CaseDocumentLogOptTypeEnum.CREATE.getDesc() + "】";
+ StringBuilder content = new StringBuilder();
+ content.append("您好!知识处理流程中,AI平台业务处理失败,具体信息如下:
");
+ content.append("案例标题:").append(caseLog.getCaseTitle()).append("
");
+ content.append("操作类型:").append(CaseDocumentLogOptTypeEnum.CREATE.getDesc()).append("
");
+ content.append("调用时间:").append(caseLog.getOptTime()).append("
");
+ content.append("请及时核查文档处理失败原因,或联系AI平台技术支持排查解析问题。");
+
+ // 使用配置的收件人列表
+ List recipients = caseAiProperties.getAlertEmailRecipients();
+ if (recipients != null && !recipients.isEmpty()) {
+ try {
+ String to = String.join(",", recipients);
+// emailService.sendMail(to, subject, content.toString(), null);
+ smtpEmailService.sendMailBySmtp(to, subject, content.toString(), null);
+ } catch (Exception e) {
+ log.error("发送业务处理失败告警邮件失败", e);
+ }
+ }
+ }
}
/**