|
|
@@ -7,6 +7,15 @@ namespace Admin.NET.Plugin.AiDOP.Service.S8;
|
|
|
|
|
|
public class S8DashboardService : ITransient
|
|
|
{
|
|
|
+ // S8-DASHBOARD-BYOBJECT-NULL-BUCKET-1:byObject / dim-trends(object) 维度统一 NULL 归桶口径。
|
|
|
+ // related_object_code 为 NULL/空白 → 归入"未关联",避免主图空数据误导。
|
|
|
+ private const string UnlinkedObjectLabel = "未关联";
|
|
|
+
|
|
|
+ private static string NormalizeRelatedObjectCode(string? relatedObjectCode) =>
|
|
|
+ string.IsNullOrWhiteSpace(relatedObjectCode)
|
|
|
+ ? UnlinkedObjectLabel
|
|
|
+ : relatedObjectCode!.Trim();
|
|
|
+
|
|
|
private readonly SqlSugarRepository<AdoS8Exception> _rep;
|
|
|
private readonly SqlSugarRepository<AdoS0DepartmentMaster> _deptRep;
|
|
|
private readonly SqlSugarRepository<AdoS8ProcessNode> _processNodeRep;
|
|
|
@@ -142,8 +151,9 @@ public class S8DashboardService : ITransient
|
|
|
count = g.Count(),
|
|
|
}),
|
|
|
byObject = list
|
|
|
- .Where(x => x.RelatedObjectCode != null)
|
|
|
- .GroupBy(x => x.RelatedObjectCode!)
|
|
|
+ // S8-DASHBOARD-BYOBJECT-NULL-BUCKET-1:不再过滤 NULL,与 dim-trends 口径统一;
|
|
|
+ // related_object_code 为空时归入"未关联"桶。
|
|
|
+ .GroupBy(x => NormalizeRelatedObjectCode(x.RelatedObjectCode))
|
|
|
.OrderByDescending(g => g.Count())
|
|
|
.Take(20)
|
|
|
.Select(g => new { key = g.Key, count = g.Count() }),
|
|
|
@@ -210,12 +220,14 @@ public class S8DashboardService : ITransient
|
|
|
var dateLabels = dates.Select(d => d.ToString("yyyy-MM-dd")).ToList();
|
|
|
|
|
|
// 按维度取 key 函数
|
|
|
+ // S8-DASHBOARD-BYOBJECT-NULL-BUCKET-1:object 维度 NULL/空白统一归入"未关联",与 byObject 口径一致;
|
|
|
+ // process 维度沿用历史"未设置",本次不扩大。
|
|
|
Func<dynamic, string> keySelector = dim switch
|
|
|
{
|
|
|
"process" => r => r.ProcessNodeCode ?? "未设置",
|
|
|
"occDept" => r => r.OccurrenceDeptId.ToString(),
|
|
|
"respDept" => r => r.ResponsibleDeptId.ToString(),
|
|
|
- _ => r => r.RelatedObjectCode ?? "未设置", // object
|
|
|
+ _ => r => NormalizeRelatedObjectCode((string?)r.RelatedObjectCode), // object
|
|
|
};
|
|
|
|
|
|
var grouped = rows
|