Package io.meeds.wallet.reward.service
Interface RewardReportService
public interface RewardReportService
A storage service to save/load reward settings
-
Method Summary
Modifier and TypeMethodDescriptioncomputeDistributionForecast(RewardSettings rewardSettings) Compute aDistributionForecastcorresponding to aRewardSettingscomputeRewards(LocalDate localDate) Compute rewards swicth configurations for the list of identities passed in parameterscomputeRewardsByUser(LocalDate localDate, long userIdentityId) Compute rewards By UserdoublecountRewards(String currentUser) doublecountWalletRewardsPointsByPeriodIdAndStatus(long periodId, boolean isValid) Count wallet rewards points by PeriodId and statusexportXlsx(long periodId, WalletRewardStatus walletRewardStatus, ZoneId zoneId, String fileName, Locale locale) Export wallet rewards into anInputStreamcontaining a file of format XLSorg.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 dateorg.springframework.data.domain.Page<RewardPeriod> findRewardPeriodsBetween(String currentUser, long from, long to, org.springframework.data.domain.Pageable pageable) Retrieves the list of periods by interval sorted descending by start dateorg.springframework.data.domain.Page<RewardPeriod> findRewardReportPeriods(String currentUser, org.springframework.data.domain.Pageable pageable) Retrieves the list of periods sorted descending by start dateorg.springframework.data.domain.Page<RewardPeriod> findRewardReportPeriods(org.springframework.data.domain.Pageable pageable) Retrieves the list of periods sorted descending by start dateorg.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 onegetReport(RewardPeriod rewardPeriod) Gets rewards report switchRewardPeriodgetRewardPeriod(RewardPeriodType periodType, LocalDate date) Return the stored reward period associated to select period type and dategetRewardPeriodById(long rewardPeriodId) Return the stored reward period by idgetRewardReport(LocalDate localDate) Retrieve aRewardReportcorresponding to a period of timegetRewardReportByPeriodId(long periodId) Retrieve aRewardReportcorresponding to a period identified by its idGets isChanged data map for periods not sentbooleanlistRewards(String currentUser, int limit) voidreplaceRewardTransactions(String oldHash, String newHash) Replaces an old reward transaction hash to a new one, that had boosted the first onevoidsaveRewardReport(RewardReport rewardReport) voidsendRewards(LocalDate localDate, String username) Send rewards transactionsvoidsetRewardSettingChanged(Map<Long, Boolean> updatedSettings) Set isChanged data map for periods not sent
-
Method Details
-
getReport
Gets rewards report switchRewardPeriod- Parameters:
rewardPeriod- aRewardPeriod- Returns:
- a
WalletRewardPeriodSummary
-
computeRewards
Compute rewards swicth configurations for the list of identities passed in parameters- Parameters:
localDate- aLocalDateinside the period time that will be retrieved- Returns:
- a
SetofWalletRewardwith the details of sent tokens and tokens to send
-
computeRewardsByUser
Compute rewards By User- Parameters:
localDate- aLocalDateinside the period time that will be retrieveduserIdentityId- User technical identifier (Identity.getId())- Returns:
- a
SetofWalletRewardwith the details of sent tokens and tokens to send
-
sendRewards
Send rewards transactions- Parameters:
localDate- aLocalDateinside the period time that will be retrievedusername- current username sending rewards- Throws:
IllegalAccessException- if an error occurs while sending the rewards transactions on blockchain
-
getRewardReport
Retrieve aRewardReportcorresponding to a period of time- Parameters:
localDate- aLocalDateinside the period time that will be retrieved- Returns:
RewardReportif there is a saved one, else null
-
getRewardPeriod
Return the stored reward period associated to select period type and date- Parameters:
periodType-RewardPeriodTypedate-LocalDate- Returns:
RewardPeriod
-
getRewardPeriodById
Return the stored reward period by id- Parameters:
rewardPeriodId- reward period id- Returns:
RewardPeriod
-
getRewardReportByPeriodId
Retrieve aRewardReportcorresponding to a period identified by its id- Parameters:
periodId- technical identifier ofRewardPeriod- Returns:
RewardReport
-
saveRewardReport
- Parameters:
rewardReport- save generated reward report
-
computeDistributionForecast
Compute aDistributionForecastcorresponding to aRewardSettings- 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
ListofRewardPeriodthat 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-Pageablethe page to be returned.- Returns:
PageofRewardPeriod
-
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 dateto- to datepageable-Pageablethe page to be returned.- Returns:
PageofRewardPeriod
-
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 periodspageable-Pageablethe page to be returned.- Returns:
PageofRewardPeriod- 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 periodsfrom- from dateto- to datepageable-Pageablethe page to be returned.- Returns:
PageofRewardPeriod- Throws:
IllegalAccessException
-
listRewards
- Parameters:
currentUser- current user listing his rewardslimit- size limit of items to return- Returns:
- a
ListofWalletRewardof current user
-
countRewards
- Parameters:
currentUser- the current user listing his rewards- Returns:
- a total rewards sent for current person
-
replaceRewardTransactions
Replaces an old reward transaction hash to a new one, that had boosted the first one- Parameters:
oldHash- old Transaction hashnewHash- 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 ididentityIds- array of identity IdswalletRewardStatus-WalletRewardStatusWallet reward statuszoneId- Zone Id
-
countWalletRewardsPointsByPeriodIdAndStatus
double countWalletRewardsPointsByPeriodIdAndStatus(long periodId, boolean isValid) Count wallet rewards points by PeriodId and status- Parameters:
periodId- Reward Period idisValid- Wallet reward status
-
setRewardSettingChanged
Set isChanged data map for periods not sent- Parameters:
updatedSettings- map of isChanged data for periods not sent
-
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 anInputStreamcontaining a file of format XLS- Parameters:
periodId- Reward Period idwalletRewardStatus-WalletRewardStatusWallet reward statuszoneId- Zone IdfileName- fileName to exportlocale- locale- Returns:
InputStreamof a file of format XLS
-