feat(platform): expose quality issue identity
This commit is contained in:
@@ -114,7 +114,7 @@ func TestHandlerHistoryMileageQualityOps(t *testing.T) {
|
||||
{"/api/mileage/summary?limit=10", "totalMileageKm"},
|
||||
{"/api/mileage/daily?limit=10", "dailyMileageKm"},
|
||||
{"/api/quality/summary?limit=10", "issueVehicleCount"},
|
||||
{"/api/quality/issues?limit=10", "issueType"},
|
||||
{"/api/quality/issues?limit=10", "sourceEndpoint"},
|
||||
{"/api/ops/health", "linkHealth"},
|
||||
}
|
||||
handler := NewHandler(NewService(NewMockStore()))
|
||||
|
||||
@@ -309,8 +309,8 @@ func (m *MockStore) QualitySummary(_ context.Context, query url.Values) (Quality
|
||||
|
||||
func mockQualityRows() []QualityIssueRow {
|
||||
return []QualityIssueRow{
|
||||
{VIN: "unknown", Plate: "", Protocol: "JT808", IssueType: "VIN_MISSING", Severity: "warning", LastSeen: "2026-07-03 19:58:00", Detail: "phone 13300000001 未命中 binding 表"},
|
||||
{VIN: "LNXNEGRR7SR318212", Plate: "川AHTWO1", Protocol: "GB32960", IssueType: "LINK_GAP", Severity: "error", LastSeen: "2026-07-03 18:20:00", Detail: "Hyundai 平台近 60 分钟无转发"},
|
||||
{VIN: "unknown", Plate: "", Phone: "13300000001", SourceEndpoint: "127.0.0.1:808", Protocol: "JT808", IssueType: "VIN_MISSING", Severity: "warning", LastSeen: "2026-07-03 19:58:00", Detail: "phone 13300000001 未命中 binding 表"},
|
||||
{VIN: "LNXNEGRR7SR318212", Plate: "川AHTWO1", Phone: "", SourceEndpoint: "Hyundai", Protocol: "GB32960", IssueType: "LINK_GAP", Severity: "error", LastSeen: "2026-07-03 18:20:00", Detail: "Hyundai 平台近 60 分钟无转发"},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -151,13 +151,15 @@ type MileageSummary struct {
|
||||
}
|
||||
|
||||
type QualityIssueRow struct {
|
||||
VIN string `json:"vin"`
|
||||
Plate string `json:"plate"`
|
||||
Protocol string `json:"protocol"`
|
||||
IssueType string `json:"issueType"`
|
||||
Severity string `json:"severity"`
|
||||
LastSeen string `json:"lastSeen"`
|
||||
Detail string `json:"detail"`
|
||||
VIN string `json:"vin"`
|
||||
Plate string `json:"plate"`
|
||||
Phone string `json:"phone"`
|
||||
SourceEndpoint string `json:"sourceEndpoint"`
|
||||
Protocol string `json:"protocol"`
|
||||
IssueType string `json:"issueType"`
|
||||
Severity string `json:"severity"`
|
||||
LastSeen string `json:"lastSeen"`
|
||||
Detail string `json:"detail"`
|
||||
}
|
||||
|
||||
type QualitySummary struct {
|
||||
|
||||
@@ -513,13 +513,15 @@ func (s *ProductionStore) QualityIssues(ctx context.Context, query url.Values) (
|
||||
return Page[QualityIssueRow]{}, err
|
||||
}
|
||||
items = append(items, QualityIssueRow{
|
||||
VIN: vin,
|
||||
Plate: plate,
|
||||
Protocol: "JT808",
|
||||
IssueType: "VIN_MISSING",
|
||||
Severity: "warning",
|
||||
LastSeen: lastSeen,
|
||||
Detail: fmt.Sprintf("phone %s 未命中 binding 表,来源 %s", phone, source),
|
||||
VIN: vin,
|
||||
Plate: plate,
|
||||
Phone: phone,
|
||||
SourceEndpoint: source,
|
||||
Protocol: "JT808",
|
||||
IssueType: "VIN_MISSING",
|
||||
Severity: "warning",
|
||||
LastSeen: lastSeen,
|
||||
Detail: fmt.Sprintf("phone %s 未命中 binding 表,来源 %s", phone, source),
|
||||
})
|
||||
}
|
||||
return Page[QualityIssueRow]{Items: items, Total: total, Limit: limit, Offset: offset}, rows.Err()
|
||||
|
||||
Reference in New Issue
Block a user