Package backend.logic
Klasse StatisticsService
java.lang.Object
backend.logic.StatisticsService
Service class for generating statistical reports and analytics about reimbursements.
Provides various methods to analyze reimbursement data by category, time period, and user metrics.
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungConstructs an empty StatisticsService.StatisticsService
(List<Reimbursement> reimbursement) Constructs a StatisticsService with a predefined list of reimbursements. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungGenerates a map of the last 12 months with formatted labels.Calculates the average number of invoices per user for each of the last 12 months.getCategoryDistribution
(List<Reimbursement> reimbursements) Generates a distribution of reimbursements by category.Counts reimbursements by invoice category.Counts invoices per month for the last 12 months.Gets all reimbursements from the last 12 months.Calculates the total reimbursement amount per month for the last 12 months.Calculates the total approved amount by invoice category.static void
setConnectionProvider
(ConnectionProvider provider) Sets the connection provider for database operations.void
setReimbursements
(List<Reimbursement> reimb)
-
Konstruktordetails
-
StatisticsService
public StatisticsService()Constructs an empty StatisticsService. -
StatisticsService
Constructs a StatisticsService with a predefined list of reimbursements.- Parameter:
reimbursement
- Initial list of reimbursements to analyze
-
-
Methodendetails
-
setConnectionProvider
Sets the connection provider for database operations.- Parameter:
provider
- The connection provider implementation
-
setReimbursements
-
getReimbursements
-
getSumByCategory
Calculates the total approved amount by invoice category.- Gibt zurück:
- Map with categories as keys and summed amounts as values
-
getCountByCategory
Counts reimbursements by invoice category.- Gibt zurück:
- Map with categories as keys and count of reimbursements as values
-
getCategoryDistribution
Generates a distribution of reimbursements by category.- Parameter:
reimbursements
- List of reimbursements to analyze- Gibt zurück:
- Map with category names as keys and counts as values
-
getInvoiceCountLastYear
Counts invoices per month for the last 12 months.- Gibt zurück:
- Map with month labels (e.g., "May 2025") as keys and invoice counts as values
-
getAverageInvoicesPerUserLastYear
Calculates the average number of invoices per user for each of the last 12 months.- Gibt zurück:
- Map with month labels as keys and average invoice counts as values
-
getReimbursementSumPerMonthLastYear
Calculates the total reimbursement amount per month for the last 12 months.- Gibt zurück:
- Map with month labels as keys and total amounts as values
-
getReimbursementsFromLast12Months
Gets all reimbursements from the last 12 months.- Gibt zurück:
- List of reimbursements from the last year
-
generateLast12MonthsMap
Generates a map of the last 12 months with formatted labels.- Gibt zurück:
- Map with formatted month labels (e.g., "May 2025") as keys and YearMonth objects as values
-