Interface RewardReportService


public interface RewardReportService
A storage service to save/load reward settings
  • Method Details

    • getReport

      WalletRewardPeriodSummary getReport(RewardPeriod rewardPeriod)
      Gets rewards report switch RewardPeriod
      Parameters:
      rewardPeriod - a RewardPeriod
      Returns:
      a WalletRewardPeriodSummary
    • computeRewards

      RewardReport computeRewards(LocalDate localDate)
      Compute rewards swicth configurations for the list of identities passed in parameters
      Parameters:
      localDate - a LocalDate inside the period time that will be retrieved
      Returns:
      a Set of WalletReward with the details of sent tokens and tokens to send
    • computeRewardsByUser

      RewardReport computeRewardsByUser(LocalDate localDate, long userIdentityId)
      Compute rewards By User
      Parameters:
      localDate - a LocalDate inside the period time that will be retrieved
      userIdentityId - User technical identifier (Identity.getId())
      Returns:
      a Set of WalletReward with the details of sent tokens and tokens to send
    • sendRewards

      void sendRewards(LocalDate localDate, String username) throws IllegalAccessException
      Send rewards transactions
      Parameters:
      localDate - a LocalDate inside the period time that will be retrieved
      username - current username sending rewards
      Throws:
      IllegalAccessException - if an error occurs while sending the rewards transactions on blockchain
    • getRewardReport

      RewardReport getRewardReport(LocalDate localDate)
      Retrieve a RewardReport corresponding to a period of time
      Parameters:
      localDate - a LocalDate inside the period time that will be retrieved
      Returns:
      RewardReport if there is a saved one, else null
    • getRewardPeriod

      RewardPeriod getRewardPeriod(RewardPeriodType periodType, LocalDate date)
      Return the stored reward period associated to select period type and date
      Parameters:
      periodType - RewardPeriodType
      date - LocalDate
      Returns:
      RewardPeriod
    • getRewardPeriodById

      RewardPeriod getRewardPeriodById(long rewardPeriodId)
      Return the stored reward period by id
      Parameters:
      rewardPeriodId - reward period id
      Returns:
      RewardPeriod
    • getRewardReportByPeriodId

      RewardReport getRewardReportByPeriodId(long periodId)
      Retrieve a RewardReport corresponding to a period identified by its id
      Parameters:
      periodId - technical identifier of RewardPeriod
      Returns:
      RewardReport
    • saveRewardReport

      void saveRewardReport(RewardReport rewardReport)
      Parameters:
      rewardReport - save generated reward report
    • computeDistributionForecast

      DistributionForecast computeDistributionForecast(RewardSettings rewardSettings)
      Compute a DistributionForecast corresponding to a RewardSettings
      Parameters:
      rewardSettings - RewardSettings
      Returns:
      RewardReport
    • isRewardSendingInProgress

      boolean isRewardSendingInProgress()
      Returns:
      true if reward sending status storage is in progress, else return false
    • getRewardPeriodsInProgress

      List<RewardPeriod> getRewardPeriodsInProgress()
      Returns:
      a List of RewardPeriod that are in progress
    • getRewardPeriodsNotSent

      List<RewardPeriod> getRewardPeriodsNotSent()
    • findRewardReportPeriods

      org.springframework.data.domain.Page<RewardPeriod> findRewardReportPeriods(org.springframework.data.domain.Pageable pageable)
      Retrieves the list of periods sorted descending by start date
      Parameters:
      pageable - Pageable the page to be returned.
      Returns:
      Page of RewardPeriod
    • findRewardPeriodsBetween

      org.springframework.data.domain.Page<RewardPeriod> findRewardPeriodsBetween(long from, long to, org.springframework.data.domain.Pageable pageable)
      Retrieves the list of periods by interval sorted descending by start date
      Parameters:
      from - from date
      to - to date
      pageable - Pageable the page to be returned.
      Returns:
      Page of RewardPeriod
    • findRewardReportPeriods

      org.springframework.data.domain.Page<RewardPeriod> findRewardReportPeriods(String currentUser, org.springframework.data.domain.Pageable pageable) throws IllegalAccessException
      Retrieves the list of periods sorted descending by start date
      Parameters:
      currentUser - user requesting access to reward periods
      pageable - Pageable the page to be returned.
      Returns:
      Page of RewardPeriod
      Throws:
      IllegalAccessException
    • findRewardPeriodsBetween

      org.springframework.data.domain.Page<RewardPeriod> findRewardPeriodsBetween(String currentUser, long from, long to, org.springframework.data.domain.Pageable pageable) throws IllegalAccessException
      Retrieves the list of periods by interval sorted descending by start date
      Parameters:
      currentUser - user requesting access to reward periods
      from - from date
      to - to date
      pageable - Pageable the page to be returned.
      Returns:
      Page of RewardPeriod
      Throws:
      IllegalAccessException
    • listRewards

      List<WalletReward> listRewards(String currentUser, int limit)
      Parameters:
      currentUser - current user listing his rewards
      limit - size limit of items to return
      Returns:
      a List of WalletReward of current user
    • countRewards

      double countRewards(String currentUser)
      Parameters:
      currentUser - the current user listing his rewards
      Returns:
      a total rewards sent for current person
    • replaceRewardTransactions

      void replaceRewardTransactions(String oldHash, String newHash)
      Replaces an old reward transaction hash to a new one, that had boosted the first one
      Parameters:
      oldHash - old Transaction hash
      newHash - new Transaction hash
    • findWalletRewardsByPeriodIdAndStatus

      org.springframework.data.domain.Page<WalletReward> findWalletRewardsByPeriodIdAndStatus(long periodId, List<Long> identityIds, WalletRewardStatus walletRewardStatus, ZoneId zoneId, org.springframework.data.domain.Pageable pageable)
      Gets wallet rewards by PeriodId and status first one
      Parameters:
      periodId - Reward Period id
      identityIds - array of identity Ids
      walletRewardStatus - WalletRewardStatus Wallet reward status
      zoneId - Zone Id
    • countWalletRewardsPointsByPeriodIdAndStatus

      double countWalletRewardsPointsByPeriodIdAndStatus(long periodId, boolean isValid)
      Count wallet rewards points by PeriodId and status
      Parameters:
      periodId - Reward Period id
      isValid - Wallet reward status
    • setRewardSettingChanged

      void setRewardSettingChanged(Map<Long,Boolean> updatedSettings)
      Set isChanged data map for periods not sent
      Parameters:
      updatedSettings - map of isChanged data for periods not sent
    • getRewardSettingChanged

      Map<Long,Boolean> getRewardSettingChanged()
      Gets isChanged data map for periods not sent
    • exportXlsx

      InputStream exportXlsx(long periodId, WalletRewardStatus walletRewardStatus, ZoneId zoneId, String fileName, Locale locale)
      Export wallet rewards into an InputStream containing a file of format XLS
      Parameters:
      periodId - Reward Period id
      walletRewardStatus - WalletRewardStatus Wallet reward status
      zoneId - Zone Id
      fileName - fileName to export
      locale - locale
      Returns:
      InputStream of a file of format XLS