Add aftersales stats to dashboard and service-layer tests

- CompanyStatsOverviewDTO and GetStats() now include aftersales counts
  (total, pending confirmation, closed, rejected) and a recentAftersales list
- aftersales_service_test.go covers YYMMNN sequence, owner-only submit,
  state machine, phone last-4 check, reject increment, force-close
- users_service_test.go covers duplicate username, self-demotion guard,
  last-admin guard, password reset, assignable filter

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Frudrax Cheng
2026-05-26 11:04:23 +08:00
parent 3ddd4db126
commit 128bb7cda6
7 changed files with 571 additions and 17 deletions
+13 -9
View File
@@ -187,15 +187,19 @@ type CompanyUpdateRequest struct {
// CompanyStatsOverviewDTO 企业统计概览
type CompanyStatsOverviewDTO struct {
TotalCompanies int64 `json:"totalCompanies"`
ActiveCompanies int64 `json:"activeCompanies"`
InactiveCompanies int64 `json:"inactiveCompanies"`
TotalSerials int64 `json:"totalSerials"`
ActiveSerials int64 `json:"activeSerials"`
RevokedSerials int64 `json:"revokedSerials"`
TotalEmployeeSerials int64 `json:"totalEmployeeSerials"`
ActiveEmployeeSerials int64 `json:"activeEmployeeSerials"`
RevokedEmployeeSerials int64 `json:"revokedEmployeeSerials"`
TotalCompanies int64 `json:"totalCompanies"`
ActiveCompanies int64 `json:"activeCompanies"`
InactiveCompanies int64 `json:"inactiveCompanies"`
TotalSerials int64 `json:"totalSerials"`
ActiveSerials int64 `json:"activeSerials"`
RevokedSerials int64 `json:"revokedSerials"`
TotalEmployeeSerials int64 `json:"totalEmployeeSerials"`
ActiveEmployeeSerials int64 `json:"activeEmployeeSerials"`
RevokedEmployeeSerials int64 `json:"revokedEmployeeSerials"`
TotalAftersales int64 `json:"totalAftersales"`
PendingConfirmation int64 `json:"pendingConfirmation"`
ClosedAftersales int64 `json:"closedAftersales"`
RejectedAftersales int64 `json:"rejectedAftersales"`
}
// EmployeeSerial 员工序列号模型