mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-11 03:46:50 +08:00
换日志级别,调试
This commit is contained in:
@@ -182,7 +182,7 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 接口调用失败
|
// 接口调用失败
|
||||||
log.warn("上传案例文档接口调用失败,第{}次尝试,status: {}, response: {}", attempt, statusCode, responseBody);
|
log.error("上传案例文档接口调用失败,第{}次尝试,status: {}, response: {}", attempt, statusCode, responseBody);
|
||||||
if (attempt == maxRetries) {
|
if (attempt == maxRetries) {
|
||||||
// 最后一次尝试仍然失败
|
// 最后一次尝试仍然失败
|
||||||
saveCaseDocumentLog(caseId, caseEntity.getTitle(), CaseDocumentLogOptTypeEnum.CREATE.getCode(), uploadUrl,
|
saveCaseDocumentLog(caseId, caseEntity.getTitle(), CaseDocumentLogOptTypeEnum.CREATE.getCode(), uploadUrl,
|
||||||
@@ -195,7 +195,7 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
|||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 接口调用异常
|
// 接口调用异常
|
||||||
log.warn("上传案例文档接口调用异常,第{}次尝试", attempt, e);
|
log.error("上传案例文档接口调用异常,第{}次尝试", attempt, e);
|
||||||
if (attempt == maxRetries) {
|
if (attempt == maxRetries) {
|
||||||
// 最后一次尝试仍然异常
|
// 最后一次尝试仍然异常
|
||||||
log.error("上传案例文档最终失败,已重试{}次", maxRetries);
|
log.error("上传案例文档最终失败,已重试{}次", maxRetries);
|
||||||
@@ -308,7 +308,7 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 接口调用失败
|
// 接口调用失败
|
||||||
log.warn("删除案例文档接口调用失败,第{}次尝试,status: {}, response: {}", attempt, statusCode, responseBody);
|
log.error("删除案例文档接口调用失败,第{}次尝试,status: {}, response: {}", attempt, statusCode, responseBody);
|
||||||
if (attempt == maxRetries) {
|
if (attempt == maxRetries) {
|
||||||
// 最后一次尝试仍然失败
|
// 最后一次尝试仍然失败
|
||||||
saveCaseDocumentLog(caseId, caseEntity.getTitle(), CaseDocumentLogOptTypeEnum.DELETE.getCode(), deleteUrl,
|
saveCaseDocumentLog(caseId, caseEntity.getTitle(), CaseDocumentLogOptTypeEnum.DELETE.getCode(), deleteUrl,
|
||||||
@@ -321,7 +321,7 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
|||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 接口调用异常
|
// 接口调用异常
|
||||||
log.warn("删除案例文档接口调用异常,第{}次尝试", attempt, e);
|
log.error("删除案例文档接口调用异常,第{}次尝试", attempt, e);
|
||||||
if (attempt == maxRetries) {
|
if (attempt == maxRetries) {
|
||||||
// 最后一次尝试仍然异常
|
// 最后一次尝试仍然异常
|
||||||
log.error("删除案例文档最终失败,已重试{}次", maxRetries);
|
log.error("删除案例文档最终失败,已重试{}次", maxRetries);
|
||||||
@@ -369,14 +369,14 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
|||||||
FieldFilters.eq("caseId", caseId));
|
FieldFilters.eq("caseId", caseId));
|
||||||
|
|
||||||
if (logList.isEmpty()) {
|
if (logList.isEmpty()) {
|
||||||
log.warn("调用删除接口时未找到相关的日志记录,caseId: {}", caseId);
|
log.error("调用删除接口时未找到相关的日志记录,caseId: {}", caseId);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CaseDocumentLog latestLog = logList.get(0);
|
CaseDocumentLog latestLog = logList.get(0);
|
||||||
String oldTaskId = latestLog.getTaskId();
|
String oldTaskId = latestLog.getTaskId();
|
||||||
if (StringUtil.isBlank(oldTaskId)) {
|
if (StringUtil.isBlank(oldTaskId)) {
|
||||||
log.warn("调用删除接口时日志记录中taskId为空,caseId: {}", caseId);
|
log.error("调用删除接口时日志记录中taskId为空,caseId: {}", caseId);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String requestBody = "";
|
String requestBody = "";
|
||||||
@@ -400,7 +400,7 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
|||||||
requestUrl = caseAiProperties.getBaseUrl() + "/apigateway/knowledge/v1/file/upload";
|
requestUrl = caseAiProperties.getBaseUrl() + "/apigateway/knowledge/v1/file/upload";
|
||||||
// 1. 检查文件路径
|
// 1. 检查文件路径
|
||||||
if (StringUtil.isBlank(caseEntity.getFilePath())) {
|
if (StringUtil.isBlank(caseEntity.getFilePath())) {
|
||||||
log.warn("调用上传接口失败,案例文件路径为空,caseId: {}", caseId);
|
log.error("调用上传接口失败,案例文件路径为空,caseId: {}", caseId);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,7 +408,7 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
|||||||
String filePath = savePath + caseEntity.getFilePath();
|
String filePath = savePath + caseEntity.getFilePath();
|
||||||
File file = new File(filePath);
|
File file = new File(filePath);
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
log.warn("调用上传接口失败,案例文件不存在,filePath: {}", filePath);
|
log.error("调用上传接口失败,案例文件不存在,filePath: {}", filePath);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -504,7 +504,7 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
|||||||
// 业务处理失败
|
// 业务处理失败
|
||||||
newOptStatus = CaseDocumentLogOptStatusEnum.SUCCESS.getCode(); // 接口调用成功
|
newOptStatus = CaseDocumentLogOptStatusEnum.SUCCESS.getCode(); // 接口调用成功
|
||||||
newCaseStatus = CaseDocumentLogCaseStatusEnum.FAILED.getCode(); // 业务处理失败
|
newCaseStatus = CaseDocumentLogCaseStatusEnum.FAILED.getCode(); // 业务处理失败
|
||||||
log.warn("文档上传业务处理失败,taskId: {}, message: {}", taskId, message);
|
log.error("文档上传业务处理失败,taskId: {}, message: {}", taskId, message);
|
||||||
} else {
|
} else {
|
||||||
log.error("未知的fileStatus: {}, taskId: {}", fileStatus, taskId);
|
log.error("未知的fileStatus: {}, taskId: {}", fileStatus, taskId);
|
||||||
return false;
|
return false;
|
||||||
@@ -564,7 +564,7 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
|||||||
.collect(java.util.stream.Collectors.toList());
|
.collect(java.util.stream.Collectors.toList());
|
||||||
|
|
||||||
if (taskIds.isEmpty()) {
|
if (taskIds.isEmpty()) {
|
||||||
log.warn("所有运行中的记录都没有有效的taskId");
|
log.error("所有运行中的记录都没有有效的taskId");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -663,14 +663,14 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
|||||||
FieldFilters.eq("caseId", caseId));
|
FieldFilters.eq("caseId", caseId));
|
||||||
|
|
||||||
if (logList.isEmpty()) {
|
if (logList.isEmpty()) {
|
||||||
log.warn("调用删除接口时未找到相关的日志记录,caseId: {}", caseId);
|
log.error("调用删除接口时未找到相关的日志记录,caseId: {}", caseId);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CaseDocumentLog latestLog = logList.get(0);
|
CaseDocumentLog latestLog = logList.get(0);
|
||||||
String taskId = latestLog.getTaskId();
|
String taskId = latestLog.getTaskId();
|
||||||
if (StringUtil.isBlank(taskId)) {
|
if (StringUtil.isBlank(taskId)) {
|
||||||
log.warn("调用删除接口时日志记录中taskId为空,caseId: {}", caseId);
|
log.error("调用删除接口时日志记录中taskId为空,caseId: {}", caseId);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -710,19 +710,19 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
|||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
// 业务处理失败,不重试
|
// 业务处理失败,不重试
|
||||||
log.warn("调用删除接口业务处理失败,不重试,caseId: {}, taskId: {}", caseId, taskId);
|
log.error("调用删除接口业务处理失败,不重试,caseId: {}, taskId: {}", caseId, taskId);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 业务处理失败,不重试
|
// 业务处理失败,不重试
|
||||||
log.warn("调用删除接口业务处理失败,不重试,response: {}", responseBody);
|
log.error("调用删除接口业务处理失败,不重试,response: {}", responseBody);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 接口调用失败
|
// 接口调用失败
|
||||||
log.warn("调用删除接口失败,第{}次尝试,status: {}, response: {}", attempt, statusCode, responseBody);
|
log.error("调用删除接口失败,第{}次尝试,status: {}, response: {}", attempt, statusCode, responseBody);
|
||||||
if (attempt == maxRetries) {
|
if (attempt == maxRetries) {
|
||||||
log.warn("调用删除接口最终失败,已重试{}次", maxRetries);
|
log.error("调用删除接口最终失败,已重试{}次", maxRetries);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// 继续下一次重试
|
// 继续下一次重试
|
||||||
@@ -730,9 +730,9 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
|||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 接口调用异常
|
// 接口调用异常
|
||||||
log.warn("调用删除接口异常,第{}次尝试", attempt, e);
|
log.error("调用删除接口异常,第{}次尝试", attempt, e);
|
||||||
if (attempt == maxRetries) {
|
if (attempt == maxRetries) {
|
||||||
log.warn("调用删除接口最终失败,已重试{}次", maxRetries);
|
log.error("调用删除接口最终失败,已重试{}次", maxRetries);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// 继续下一次重试
|
// 继续下一次重试
|
||||||
@@ -785,14 +785,14 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
|||||||
return taskId;
|
return taskId;
|
||||||
} else {
|
} else {
|
||||||
// 业务处理失败,不重试
|
// 业务处理失败,不重试
|
||||||
log.warn("调用上传接口业务处理失败,不重试,response: {}", responseBody);
|
log.error("调用上传接口业务处理失败,不重试,response: {}", responseBody);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 接口调用失败
|
// 接口调用失败
|
||||||
log.warn("调用上传接口失败,第{}次尝试,status: {}, response: {}", attempt, statusCode, responseBody);
|
log.error("调用上传接口失败,第{}次尝试,status: {}, response: {}", attempt, statusCode, responseBody);
|
||||||
if (attempt == maxRetries) {
|
if (attempt == maxRetries) {
|
||||||
log.warn("调用上传接口最终失败,已重试{}次", maxRetries);
|
log.error("调用上传接口最终失败,已重试{}次", maxRetries);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// 继续下一次重试
|
// 继续下一次重试
|
||||||
@@ -800,9 +800,9 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
|||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 接口调用异常
|
// 接口调用异常
|
||||||
log.warn("调用上传接口异常,第{}次尝试", attempt, e);
|
log.error("调用上传接口异常,第{}次尝试", attempt, e);
|
||||||
if (attempt == maxRetries) {
|
if (attempt == maxRetries) {
|
||||||
log.warn("调用上传接口最终失败,已重试{}次", maxRetries);
|
log.error("调用上传接口最终失败,已重试{}次", maxRetries);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// 继续下一次重试
|
// 继续下一次重试
|
||||||
@@ -819,7 +819,7 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
|||||||
try {
|
try {
|
||||||
com.alibaba.fastjson.JSONArray dataArray = result.getJSONArray("data");
|
com.alibaba.fastjson.JSONArray dataArray = result.getJSONArray("data");
|
||||||
if (dataArray == null || dataArray.isEmpty()) {
|
if (dataArray == null || dataArray.isEmpty()) {
|
||||||
log.warn("文件状态接口返回的data为空");
|
log.error("文件状态接口返回的data为空");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -843,7 +843,7 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
|||||||
|
|
||||||
String fileStatus = taskStatusMap.get(taskId);
|
String fileStatus = taskStatusMap.get(taskId);
|
||||||
if (StringUtil.isBlank(fileStatus)) {
|
if (StringUtil.isBlank(fileStatus)) {
|
||||||
log.warn("未找到taskId对应的文件状态: {}", taskId);
|
log.error("未找到taskId对应的文件状态: {}", taskId);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -875,10 +875,10 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
|||||||
caseLog.setOptStatus(CaseDocumentLogOptStatusEnum.SUCCESS.getCode());
|
caseLog.setOptStatus(CaseDocumentLogOptStatusEnum.SUCCESS.getCode());
|
||||||
caseLog.setCaseStatus(CaseDocumentLogCaseStatusEnum.FAILED.getCode());
|
caseLog.setCaseStatus(CaseDocumentLogCaseStatusEnum.FAILED.getCode());
|
||||||
needUpdate = true;
|
needUpdate = true;
|
||||||
log.warn("文档处理失败,更新状态,taskId: {}, caseId: {}", caseLog.getTaskId(), caseLog.getCaseId());
|
log.error("文档处理失败,更新状态,taskId: {}, caseId: {}", caseLog.getTaskId(), caseLog.getCaseId());
|
||||||
} else {
|
} else {
|
||||||
// 其他状态(uploaded、texted、vectoring),不做数据变更
|
// 其他状态(uploaded、texted、vectoring),不做数据变更
|
||||||
log.debug("文档状态为{},暂不更新数据库,taskId: {}", fileStatus, caseLog.getTaskId());
|
log.info("文档状态为{},暂不更新数据库,taskId: {}", fileStatus, caseLog.getTaskId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果需要更新,执行update操作
|
// 如果需要更新,执行update操作
|
||||||
@@ -888,7 +888,7 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
|
|||||||
log.info("更新CaseDocumentLog成功,logId: {}, taskId: {}, fileStatus: {}",
|
log.info("更新CaseDocumentLog成功,logId: {}, taskId: {}, fileStatus: {}",
|
||||||
caseLog.getId(), caseLog.getTaskId(), fileStatus);
|
caseLog.getId(), caseLog.getTaskId(), fileStatus);
|
||||||
} else {
|
} else {
|
||||||
log.debug("无需更新CaseDocumentLog,taskId: {}, fileStatus: {}", caseLog.getTaskId(), fileStatus);
|
log.info("无需更新CaseDocumentLog,taskId: {}, fileStatus: {}", caseLog.getTaskId(), fileStatus);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("更新日志状态异常,taskId: {}, fileStatus: {}", caseLog.getTaskId(), fileStatus, e);
|
log.error("更新日志状态异常,taskId: {}, fileStatus: {}", caseLog.getTaskId(), fileStatus, e);
|
||||||
|
|||||||
Reference in New Issue
Block a user