Class AmmServiceImpl
java.lang.Object
ch.tocco.nice2.optional.amm.impl.service.AmmServiceImpl
- All Implemented Interfaces:
AmmService
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AmmServiceConditionsprotected final PersistenceServiceprotected final TimezoneResolverService -
Constructor Summary
ConstructorsConstructorDescriptionAmmServiceImpl(AmmServiceConditions ammServiceConditions, TimezoneResolverService timezoneResolver, PersistenceService persistenceService) -
Method Summary
Modifier and TypeMethodDescriptiongetAmmMonth(Entity caseEntity, int year, int month) Creates an AmmMonth Bean containing information about presences for each "half-day" of the month (e.g.getAmmMonth(Entity caseEntity, int year, int month, @Nullable Entity subventionCanton) This method can be used to generate an AmmMonth with a fixed Subvention_canton entity.
-
Field Details
-
ammServiceConditions
-
timezoneResolver
-
persistenceService
-
-
Constructor Details
-
AmmServiceImpl
public AmmServiceImpl(AmmServiceConditions ammServiceConditions, TimezoneResolverService timezoneResolver, PersistenceService persistenceService)
-
-
Method Details
-
getAmmMonth
Description copied from interface:AmmServiceCreates an AmmMonth Bean containing information about presences for each "half-day" of the month (e.g. am + pm for days 1-31). Missing days (days without presences or days of shorter months) are filled with empty AmmDay beans. It works as follows 1. Try to resolve Working_day of case for the current half day 2. Try to resolve Reservation_registration for the current half day 3. Resolve the Registration_accomplishment_status of the resolved entity 4. Resolve the Subvention_canton of the case 5. Get the code of the Registration_accomplishment_status_subvention_canton corresponding to the canton + status and write it into the AmmDay bean Additionally, it calculates expense totals for the current month by type as follows: 1. Select all expenses of current month (date >= first day of month invalid input: '&' date invalid input: '<'= last day of month) 2. Group expenses by Expense_type 3. Create a AmmExpenses record per type containing type, number of expeneses, avg amount, and total amount The queries that are used to resolve Working_days or Reservation_registration can be configured using the interface AmmServiceConditions- Specified by:
getAmmMonthin interfaceAmmService- Parameters:
caseEntity- the case foryear- the year for which the presences are generated (yyyy, e.g. 2025)month- month for which the presences are generated (1-12)- Returns:
- the generated AmmMonth
-
getAmmMonth
public AmmMonth getAmmMonth(Entity caseEntity, int year, int month, @Nullable Entity subventionCanton) Description copied from interface:AmmServiceThis method can be used to generate an AmmMonth with a fixed Subvention_canton entity. The Subvention_canton of the caseEntity is no longer resolved / considered.- Specified by:
getAmmMonthin interfaceAmmService- Parameters:
caseEntity- the case foryear- the year for which the presences are generated (yyyy, e.g. 2025)month- month for which the presences are generated (1-12)subventionCanton- the subvention canton entity to be used- Returns:
- the generated AmmMonth
-