-
Notifications
You must be signed in to change notification settings - Fork 9
Release 1.0.0 #266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Release 1.0.0 #266
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
be72d52
fix: unlock transactions which won't be published now (#264)
Kammerlo e559b56
fix: journal enrichment must adjust the operation type as well (#269)
Kammerlo 4b9a3e5
chore: adjusting build job
Kammerlo ab342b1
feat: moving journalenrichmentstask and fixing totalLCY amount
Kammerlo f1ee400
Fix: Parent cost center missing in extraction
M4rc0Russ0 efac869
chore: fixing test
Kammerlo 98d1218
chore: renamed variable for debouncer configuration
Kammerlo 5f3c846
Merge pull request #271 from cardano-foundation/fix/parent_cost_cente…
M4rc0Russ0 c69e6b1
fix: Missing currecny data should result invalid transaction
M4rc0Russ0 3949ed8
fix: transactional runner to not create new database transactions (#273)
Kammerlo 07f1fd9
chore: spotless
Kammerlo 2aa0f85
chore: adding transactional back to update transaction batch
Kammerlo 87978c8
chore: spotless
Kammerlo ddb3766
Merge pull request #274 from cardano-foundation/fix/missing_currecny_…
M4rc0Russ0 3bef8b6
fix: fixing transactional runner
Kammerlo 07f34b6
fix: optimizing internal transactions (#276)
Kammerlo d819ab6
fix: blockchain publisher didn't saved transaction when running in no…
Kammerlo 6d70272
fix: batches tx counting
M4rc0Russ0 03935b2
Merge pull request #282 from cardano-foundation/fix/batches_tx_counting
M4rc0Russ0 3b02aa4
fix: CARDANO_MAX_TRANSACTION_SIZE_BYTES transaction size
M4rc0Russ0 8fd70b2
Merge pull request #281 from cardano-foundation/fix/CARDANO_MAX_TRANS…
M4rc0Russ0 a759f55
fix: extraction and public interface
M4rc0Russ0 5d5fe08
Merge pull request #283 from cardano-foundation/fix/extraction_and_pu…
M4rc0Russ0 3f3d6c0
fix: public service
M4rc0Russ0 4bd7f80
Merge pull request #284 from cardano-foundation/fix/public_service
M4rc0Russ0 c461e11
feat: Report is set to pending if values don't match
Kammerlo 5dddcd4
Merge pull request #240 from cardano-foundation/feat/LOB-1193-Set-rep…
M4rc0Russ0 a87c13d
fix: account credit name
M4rc0Russ0 6bc1a22
Merge pull request #287 from cardano-foundation/fix/account_credit_name
M4rc0Russ0 ecaaf57
fix: revalt calculation fro CREDIT and DEBIT
M4rc0Russ0 7b51a2a
Merge pull request #290 from cardano-foundation/fix/fxrevalt_calculation
M4rc0Russ0 56b2c87
fix: ERASED_SUM_APPLIED using account values
M4rc0Russ0 ac1796d
Merge pull request #294 from cardano-foundation/fix/ERASED_SUM_APPLIE…
M4rc0Russ0 f663d79
fix: txitem_group_strategy_new
M4rc0Russ0 b98bef8
Merge pull request #297 from cardano-foundation/fix/txitem_group_stra…
M4rc0Russ0 8ab89e6
fix: saving report status in db (#296)
Kammerlo 56fd4ef
Fix/save report status in db (#299)
Kammerlo 02b0a3d
Fix/use always latest report for metrics (#304)
Kammerlo c02c1c7
chore: report version readability
M4rc0Russ0 f393953
fix: total expense values were wrongly mapped (#307)
Kammerlo 572a942
Merge pull request #306 from cardano-foundation/chore/report_version_…
M4rc0Russ0 4d54947
Feat/aggregate on publisher (#308)
Kammerlo dd90c1e
Feat/aggregate Public Pages items (#310)
Kammerlo c97deaa
fix: change the amount reatment from Long to bigDecimal in the Public…
M4rc0Russ0 d5301d4
Merge pull request #311 from cardano-foundation/fix/change_long_to_bi…
M4rc0Russ0 30cd93f
fix: when TxType is FxReval
M4rc0Russ0 5cdb769
Merge pull request #312 from cardano-foundation/fix/fxreval
M4rc0Russ0 1346cb6
fix: rename the dummy account hard coded
M4rc0Russ0 73e2765
Merge pull request #314 from cardano-foundation/fix/rename_dummy_account
M4rc0Russ0 631ce7c
chore: removing exception throw for null objects and skipping them (#…
Kammerlo 4b21734
fix: report validation
M4rc0Russ0 00a8bf3
Merge pull request #321 from cardano-foundation/fix/report_validation
M4rc0Russ0 a949d03
feat: adding API versioning (#320)
Kammerlo 5e6d0e4
Update onChainFormat.md (#329)
Kammerlo bc9b06c
fix: avoiding to overwriting statuses (#326)
Kammerlo 980d260
Merge branch 'main' into release/1.0.0
Kammerlo 559d851
Update version in gradle.properties
Kammerlo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
.../java/org/cardanofoundation/lob/app/accounting_reporting_core/job/TxStatusUpdaterJob.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
package org.cardanofoundation.lob.app.accounting_reporting_core.job; | ||
|
||
import java.time.LocalDate; | ||
import java.util.HashMap; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Set; | ||
import java.util.concurrent.ConcurrentHashMap; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
import org.springframework.scheduling.annotation.Scheduled; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import io.vavr.control.Either; | ||
import org.zalando.problem.Problem; | ||
|
||
import org.cardanofoundation.lob.app.accounting_reporting_core.domain.core.LedgerDispatchStatus; | ||
import org.cardanofoundation.lob.app.accounting_reporting_core.domain.core.TxStatusUpdate; | ||
import org.cardanofoundation.lob.app.accounting_reporting_core.domain.entity.TransactionEntity; | ||
import org.cardanofoundation.lob.app.accounting_reporting_core.domain.entity.report.ReportEntity; | ||
import org.cardanofoundation.lob.app.accounting_reporting_core.repository.ReportRepository; | ||
import org.cardanofoundation.lob.app.accounting_reporting_core.service.internal.LedgerService; | ||
import org.cardanofoundation.lob.app.accounting_reporting_core.service.internal.ReportService; | ||
import org.cardanofoundation.lob.app.accounting_reporting_core.service.internal.TransactionBatchService; | ||
|
||
@Service | ||
@Slf4j | ||
@RequiredArgsConstructor | ||
@ConditionalOnProperty(value = "lob.accounting_reporting_core.enabled", havingValue = "true", matchIfMissing = true) | ||
public class TxStatusUpdaterJob { | ||
|
||
private final Map<String, TxStatusUpdate> txStatusUpdatesMap = new ConcurrentHashMap<>(); | ||
private final LedgerService ledgerService; | ||
private final TransactionBatchService transactionBatchService; | ||
private final ReportRepository reportRepository; | ||
private final ReportService reportService; | ||
|
||
@Value("${lob.blockchain.tx-status-updater.max-map-size:1000}") | ||
private int maxMapSize; | ||
|
||
// This Job collects all TxStatusUpdate events and updates the transactions in the database | ||
@Scheduled( | ||
fixedDelayString = "${ob.blockchain.tx-status-updater.fixed_delay:PT30S}", | ||
initialDelayString = "${lob.blockchain.tx-status-updater.delay:PT30S}") | ||
@Transactional | ||
public void execute() { | ||
Map<String, TxStatusUpdate> updates; | ||
synchronized (txStatusUpdatesMap) { | ||
updates = new HashMap<>(txStatusUpdatesMap); | ||
} | ||
if(updates.isEmpty()) { | ||
log.debug("No TxStatusUpdate events to process"); | ||
return; | ||
} | ||
try { | ||
log.info("Updating Status of {} transactions", updates.size()); | ||
List<TransactionEntity> transactionEntities = ledgerService.updateTransactionsWithNewStatuses(updates); | ||
ledgerService.saveAllTransactionEntities(transactionEntities); | ||
|
||
transactionBatchService.updateBatchesPerTransactions(updates); | ||
updates.forEach(txStatusUpdatesMap::remove); | ||
|
||
// Updating respective reports - Could be refactored to a separate method | ||
Set<ReportEntity> reportEntitiesToBeUpdated = new HashSet<>(); | ||
for(TransactionEntity tx : transactionEntities) { | ||
if (tx.getLedgerDispatchStatus() == LedgerDispatchStatus.FINALIZED) { | ||
LocalDate date = tx.getEntryDate(); | ||
int year = date.getYear(); | ||
int month = date.getMonthValue(); | ||
int quarter = (month - 1) / 3 + 1; | ||
reportEntitiesToBeUpdated.addAll(reportRepository.findNotPublishedByOrganisationIdAndContainingDate(tx.getOrganisation().getId(), year, quarter, month)); | ||
} | ||
} | ||
|
||
reportEntitiesToBeUpdated.forEach(report -> { | ||
log.info("Checking if report {} is ready to publish", report.getId()); | ||
Either<Problem, Boolean> isReadyToPublish = reportService.canPublish(report); | ||
if (isReadyToPublish.isLeft()) { | ||
log.error("Report {} cannot be published: {}", report.getId(), isReadyToPublish.getLeft().getDetail()); | ||
return; | ||
} | ||
report.setIsReadyToPublish(isReadyToPublish.get()); | ||
reportRepository.save(report); | ||
}); | ||
|
||
} catch (Exception e) { | ||
log.error("Failed to process TxStatusUpdates - entries will be retained in the map", e); | ||
} | ||
} | ||
|
||
public void addToStatusUpdateMap(Map<String, TxStatusUpdate> updateMap) { | ||
synchronized (txStatusUpdatesMap) { | ||
Kammerlo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
updateMap.forEach((key, value) -> { | ||
txStatusUpdatesMap.merge(key, value, (oldValue, newValue) -> | ||
newValue.getStatus().compareTo(oldValue.getStatus()) > 0 ? newValue : oldValue | ||
); | ||
}); | ||
} | ||
if(txStatusUpdatesMap.size() > maxMapSize) { | ||
log.warn("TxStatusUpdate map size exceeded the limit of {}. Current size: {}", maxMapSize, txStatusUpdatesMap.size()); | ||
} | ||
} | ||
|
||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.