diff --git a/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/execution/ExecutionCurrencyComponent.java b/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/execution/ExecutionCurrencyComponent.java index d49a78a83..8d3eec2f4 100644 --- a/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/execution/ExecutionCurrencyComponent.java +++ b/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/execution/ExecutionCurrencyComponent.java @@ -106,6 +106,7 @@ public class ExecutionCurrencyComponent implements IExecutionUploadComponent { public void processNewTS(Long fromId) { boolean cleanLoad = fromId == null; if (cleanLoad) { + log.info("clearing cash..."); cash.clear(); initExecCash(); } @@ -136,6 +137,7 @@ public class ExecutionCurrencyComponent implements IExecutionUploadComponent { //убираем уже добавленные в ExecutionCurrency if (!cleanLoad) { + log.info("filtering strades based on ExecutionCurrency cash..."); sTrades.removeIf(sTrd -> { Side sTrdSide = IEnumKey.getEnumByKey(Side.class, sTrd.getOperation()); if (sTrdSide == null || !(sTrdSide.equals(Side.BUY) || sTrdSide.equals(Side.SELL))) { @@ -170,21 +172,23 @@ public class ExecutionCurrencyComponent implements IExecutionUploadComponent { if (!cleanLoad || (storedId = cash.get(execKey)) == null) { newEC.setId(idGen.nextId()); cash.put(execKey, ExecUploadCashInfo.cash(newEC)); + log.debug("New executionCurrency.id={} was created.", newEC.getId()); } else { newEC.setId(storedId.id()); newEC.setUpdated(newEC.getCreated()); newEC.setCreated(storedId.createDt()); + log.debug("executionCurrency.id={} was updated.", newEC.getId()); } execsToInsert.put(newEC.getId(), newEC); //executionCurrencyImdg.insert(newEC); sendNotification(newEC); - log.debug("New executionCurrency.id={} was created.", newEC.getId()); } catch (ClearingException ce) { auditMessage(ce); } catch (Exception e) { log.error("When create new ExecutionCurrency by STrade[{}] error: {}", sTrd.getId(), ExceptionUtils.getStackTrace(e)); } } + log.info("batch putAll {} ExecutionCurrency", execsToInsert.size()); executionCurrencyImdg.putAll(execsToInsert, 200); Long newMaxTradeNum = sTrades.stream().mapToLong(STrades::getTradeNum).max().orElse(0); // orElseGet(() -> tradeNum) diff --git a/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/execution/ExecutionDepositComponent.java b/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/execution/ExecutionDepositComponent.java index 8f6ec8641..6cd27e1ad 100644 --- a/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/execution/ExecutionDepositComponent.java +++ b/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/execution/ExecutionDepositComponent.java @@ -105,6 +105,7 @@ public class ExecutionDepositComponent implements IExecutionUploadComponent { public void processNewTS(Long fromId) { boolean cleanLoad = fromId == null; if (cleanLoad) { + log.info("clearing cash..."); cash.clear(); initExecCash(); } @@ -134,6 +135,7 @@ public class ExecutionDepositComponent implements IExecutionUploadComponent { //убираем уже добавленные в ExecutionDeposit if (!cleanLoad) { + log.info("filtering strades based on ExecutionDeposit cash..."); sTrades.removeIf(sTrd -> { Side sTrdSide = IEnumKey.getEnumByKey(Side.class, sTrd.getOperation()); if (sTrdSide == null || !(sTrdSide.equals(Side.BUY) || sTrdSide.equals(Side.SELL))) { @@ -168,21 +170,23 @@ public class ExecutionDepositComponent implements IExecutionUploadComponent { if (!cleanLoad || (storedId = cash.get(execKey)) == null) { newED.setId(idGen.nextId()); cash.put(execKey, ExecUploadCashInfo.cash(newED)); + log.debug("New executionDeposit.id={} was created.", newED.getId()); } else { newED.setId(storedId.id()); newED.setUpdated(newED.getCreated()); newED.setCreated(storedId.createDt()); + log.debug("executionDeposit.id={} was updated.", newED.getId()); } execsToInsert.put(newED.getId(), newED); //executionDepositImdg.insert(newED); sendNotification(newED); - log.debug("New executionDeposit.id={} was created.", newED.getId()); } catch (ClearingException ce) { auditMessage(ce); } catch (Exception e) { log.error("When create new ExecutionDeposit by STrade[{}] error: {}", sTrd.getId(), ExceptionUtils.getStackTrace(e)); } } + log.info("batch putAll {} ExecutionDeposit", execsToInsert.size()); executionDepositImdg.putAll(execsToInsert, 200); Long newMaxTradeNum = sTrades.stream().mapToLong(STrades::getTradeNum).max().orElseGet(() -> tradeNum); diff --git a/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/execution/ExecutionFondComponent.java b/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/execution/ExecutionFondComponent.java index 69af95c4c..58a041b59 100644 --- a/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/execution/ExecutionFondComponent.java +++ b/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/execution/ExecutionFondComponent.java @@ -124,6 +124,7 @@ public class ExecutionFondComponent implements IExecutionUploadComponent { public void processNewTS(Long fromId) { boolean cleanLoad = fromId == null; if (cleanLoad) { + log.info("clearing cash..."); cash.clear(); initExecCash(); } @@ -153,6 +154,7 @@ public class ExecutionFondComponent implements IExecutionUploadComponent { //убираем уже добавленные в ExecutionDeposit if (!cleanLoad) { + log.info("filtering strades based on ExecutionFond cash..."); sTrades.removeIf(sTrd -> { Side sTrdSide = IEnumKey.getEnumByKey(Side.class, sTrd.getOperation()); if (sTrdSide == null || !(sTrdSide.equals(Side.BUY) || sTrdSide.equals(Side.SELL))) { @@ -187,21 +189,23 @@ public class ExecutionFondComponent implements IExecutionUploadComponent { if (!cleanLoad || (storedId = cash.get(execKey)) == null) { newED.setId(idGen.nextId()); cash.put(execKey, ExecUploadCashInfo.cash(newED)); + log.debug("New executionFond.id={} was created.", newED.getId()); } else { newED.setId(storedId.id()); newED.setUpdated(newED.getCreated()); newED.setCreated(storedId.createDt()); + log.debug("executionFond.id={} was updated.", newED.getId()); } execsToInsert.put(newED.getId(), newED); //executionFondImdg.insert(newED); sendNotification(newED); - log.debug("New executionDeposit.id={} was created.", newED.getId()); } catch (ClearingException ce) { auditMessage(ce); } catch (Exception e) { - log.error("When create new ExecutionDeposit by STrade[{}] error: {}", sTrd.getId(), ExceptionUtils.getStackTrace(e)); + log.error("When create new ExecutionFond by STrade[{}] error: {}", sTrd.getId(), ExceptionUtils.getStackTrace(e)); } } + log.info("batch putAll {} ExecutionFond", execsToInsert.size()); executionFondImdg.putAll(execsToInsert, 200); Long newMaxTradeNum = sTrades.stream().mapToLong(STrades::getTradeNum).max().orElseGet(() -> tradeNum); diff --git a/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/execution/ExecutionUploadCashUtil.java b/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/execution/ExecutionUploadCashUtil.java index 06b7b3073..76a3b1f04 100644 --- a/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/execution/ExecutionUploadCashUtil.java +++ b/clearing-parent/clearing-service/src/main/java/ru/spcex/clearing/service/execution/ExecutionUploadCashUtil.java @@ -3,18 +3,23 @@ package ru.spcex.clearing.service.execution; import java.time.LocalDate; import java.util.Collection; import java.util.Map; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import ru.clearing.classes.statics.data.execution.ExecutionCommon; import ru.spcex.platform.imdg.api.Imdg; import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder; public class ExecutionUploadCashUtil { + private static final Logger log = LoggerFactory.getLogger(ExecutionUploadCashUtil.class); public static void loadExecutions(Imdg executionImdg, Map cash) { + log.info("loading cash for {}...", executionImdg.getMapName()); LocalDate today = LocalDate.now(); ImdgPredicateBuilder pb = executionImdg.predicateBuilder(); Collection execs = executionImdg.getCollectionObjectsByPredicate( pb.equals("tradingDate", today) ); + log.info("loading cash for {} done. executions found: {}", executionImdg.getMapName(), execs.size()); execs.forEach(e -> cash.put(ExecUploadKey.cash(e), ExecUploadCashInfo.cash(e))); } }