diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..be975570 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "java.compile.nullAnalysis.mode": "disabled" +} \ No newline at end of file diff --git a/ramls/acq-models b/ramls/acq-models index 667cd28d..c6ebedd7 160000 --- a/ramls/acq-models +++ b/ramls/acq-models @@ -1 +1 @@ -Subproject commit 667cd28d3f0604848e6dc24d1a8e72a956906039 +Subproject commit c6ebedd7de52700d73516076bbdd45cdabb0185c diff --git a/src/main/java/org/folio/services/financedata/FinanceDataService.java b/src/main/java/org/folio/services/financedata/FinanceDataService.java index 3e72bb5e..19450ea2 100644 --- a/src/main/java/org/folio/services/financedata/FinanceDataService.java +++ b/src/main/java/org/folio/services/financedata/FinanceDataService.java @@ -13,10 +13,9 @@ import java.util.UUID; import io.vertx.core.Future; +import lombok.extern.log4j.Log4j2; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.folio.rest.core.RestClient; import org.folio.rest.core.models.RequestContext; import org.folio.rest.core.models.RequestEntry; @@ -35,8 +34,8 @@ import org.folio.services.protection.AcqUnitsService; import org.folio.services.transactions.TransactionApiService; +@Log4j2 public class FinanceDataService { - private static final Logger log = LogManager.getLogger(); private final RestClient restClient; private final AcqUnitsService acqUnitsService; @@ -73,7 +72,7 @@ private Future getFinanceData(String query, int offset, public Future putFinanceData(FyFinanceDataCollection financeDataCollection, RequestContext requestContext) { log.debug("Trying to update finance data collection with size: {}", financeDataCollection.getTotalRecords()); if (CollectionUtils.isEmpty(financeDataCollection.getFyFinanceData())) { - log.info("Finance data collection is empty, nothing to update"); + log.info("putFinanceData:: Finance data collection is empty, nothing to update"); return succeededFuture(); } @@ -90,10 +89,10 @@ private void validateFinanceDataCollection(FyFinanceDataCollection financeDataCo var financeData = financeDataCollection.getFyFinanceData().get(i); validateFinanceDataFields(financeData, i, fiscalYearId); - var allocationChange = BigDecimal.valueOf(financeData.getBudgetAllocationChange()); - var initialAllocation = BigDecimal.valueOf(financeData.getBudgetInitialAllocation()); + var allocationChange = financeData.getBudgetAllocationChange(); + var initialAllocation = financeData.getBudgetInitialAllocation(); - if (allocationChange.doubleValue() < 0 && allocationChange.abs().doubleValue() > initialAllocation.doubleValue()) { + if (allocationChange < 0 && Math.abs(allocationChange) > initialAllocation) { var error = createError("Allocation change cannot be greater than initial allocation", String.format("financeData[%s].budgetAllocationChange", i), String.valueOf(financeData.getBudgetAllocationChange())); throw new HttpException(422, new Errors().withErrors(List.of(error))); @@ -120,7 +119,7 @@ private List createAllocationTransactions(FyFinanceDataCollection f private Transaction createAllocationTransaction(FyFinanceData financeData, String currency) { var allocation = calculateAllocation(financeData); - log.info("Creating allocation transaction for fund '{}' and budget '{}' with allocation '{}'", + log.info("createAllocationTransaction:: Creating allocation transaction for fund '{}' and budget '{}' with allocation '{}'", financeData.getFundId(), financeData.getBudgetId(), allocation); return new Transaction()