From 1ab74826aa57cbbe7ec67404c48f33d7056387c4 Mon Sep 17 00:00:00 2001 From: hjhan Date: Fri, 6 Feb 2026 16:30:06 +0800 Subject: [PATCH] =?UTF-8?q?fix(ClientModule):=20=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E4=B8=8D=E8=83=BD=E7=BF=BB=E9=A1=B5=E6=8A=A5?= =?UTF-8?q?=E9=94=99=20=E5=AE=A2=E6=88=B7=E7=AB=AF=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E4=B8=AD=E7=9A=84=E7=A9=BA=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加auditLog空值检查避免NullReferenceException - 为开户审批和其他审批流程分别处理不同的流程列表 - 添加错误日志记录以便调试auditLog为空的情况 - 当auditLog为空时按一般审批流程处理以确保功能正常运行 --- .../Modules/ClientModule/ClientQueryService.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/YLErpDAL/Modules/ClientModule/ClientQueryService.cs b/YLErpDAL/Modules/ClientModule/ClientQueryService.cs index 58f59b41..14edc1d4 100644 --- a/YLErpDAL/Modules/ClientModule/ClientQueryService.cs +++ b/YLErpDAL/Modules/ClientModule/ClientQueryService.cs @@ -1,4 +1,4 @@ -using Autofac.Features.Indexed; +using Autofac.Features.Indexed; using Autofac.Features.OwnedInstances; using BaseOUDAL; using ClosedXML; @@ -452,12 +452,23 @@ namespace YLErp.Modules.ClientModule clientLinq.ApprovalRole = roles.Where(x => x.Id == clientLinq.ProcessRoleId)?.FirstOrDefault()?.Name; if (clientLinq.ApprovalStatus == "审批中") { - if (clientLinq.auditLog.OptType.Contains("开户审批")) + // 添加空值检查并记录日志 + if (clientLinq.auditLog != null) { - clientLinq.ApprovalStatus = GetApprovalStatus(openProcessList.ToList(), clientLinq.ApprovalStatus, clientLinq.ApprovalOrderId, clientLinq.ProcessOrderBranch); + if (clientLinq.auditLog.OptType.Contains("开户审批")) + { + clientLinq.ApprovalStatus = GetApprovalStatus(openProcessList.ToList(), clientLinq.ApprovalStatus, clientLinq.ApprovalOrderId, clientLinq.ProcessOrderBranch); + } + else + { + clientLinq.ApprovalStatus = GetApprovalStatus(clientProcessList.ToList(), clientLinq.ApprovalStatus, clientLinq.ApprovalOrderId, clientLinq.ProcessOrderBranch); + } } else { + // 记录auditLog为空的情况,便于后续调试 + LogFactory.GetLogger("ClientQueryService").Error("ClientQueryService.SearchList: auditLog is null for client id: " + clientLinq.id + ", ApprovalOrderId: " + clientLinq.ApprovalOrderId + ", ProcessOrderBranch: " + clientLinq.ProcessOrderBranch + ", ApprovalStatus: " + clientLinq.ApprovalStatus); + // 当auditLog为空时,无法判断是否为开户审批,按一般审批流程处理 clientLinq.ApprovalStatus = GetApprovalStatus(clientProcessList.ToList(), clientLinq.ApprovalStatus, clientLinq.ApprovalOrderId, clientLinq.ProcessOrderBranch); } }