Class TaxBandService

java.lang.Object
com.example.vehicletaxsystem.services.TaxBandService

@Service public class TaxBandService extends Object
Service class to handle the logic for tax band queries.
  • Field Details

    • logger

      private final org.slf4j.Logger logger
    • taxBandRepository

      private final TaxBandRepository taxBandRepository
    • taxRateRepository

      private final TaxRateRepository taxRateRepository
  • Constructor Details

  • Method Details

    • getIndividualTaxRateValues

      private Map<String,Double> getIndividualTaxRateValues(TaxBand taxband)
    • convertToTaxBandDTO

      private TaxBandDTO convertToTaxBandDTO(TaxBand taxband)
    • getAllTaxBandDTO

      public List<TaxBandDTO> getAllTaxBandDTO()
    • getTaxBandDTOByBandId

      public TaxBandDTO getTaxBandDTOByBandId(Integer id)
    • getTaxBandDTOSByDescription

      public List<TaxBandDTO> getTaxBandDTOSByDescription(String description)
      Search for tax bands based on partial matches
      Parameters:
      description - string to search tax bands by
      Returns:
      List of taxbands which have descriptions containing the search parameter
    • updateTaxBand

      public TaxBandDTO updateTaxBand(int id, TaxBandDTO taxBandDTO)
      Updates the description and the tax rate id, the list of vehicles wouldn't change across the board.
      It's more of a one way change, if all vehicles in the band were going to change, its probably because the band itself has changed
      Parameters:
      id - id of the tax band being changed
      taxBandDTO - the updated tax band fields
      Returns:
      TaxBandDTO with updated field values