diff --git a/clearing-parent/registry-service/src/main/java/ru/spcex/clearing/registry/service/DepoPaymentInstructionRegisterService.java b/clearing-parent/registry-service/src/main/java/ru/spcex/clearing/registry/service/DepoPaymentInstructionRegisterService.java index 3e428210a..0fe340aec 100644 --- a/clearing-parent/registry-service/src/main/java/ru/spcex/clearing/registry/service/DepoPaymentInstructionRegisterService.java +++ b/clearing-parent/registry-service/src/main/java/ru/spcex/clearing/registry/service/DepoPaymentInstructionRegisterService.java @@ -19,6 +19,7 @@ import ru.spcex.clearing.platform.messaging.domain.cud.schedule.LauncherCommandR import ru.spcex.clearing.platform.messaging.service.QueueConsumer; import ru.spcex.clearing.registry.util.PreClearMap; import ru.spcex.platform.enumeration.AccountType; +import ru.spcex.platform.enumeration.TransactionStatus; import ru.spcex.platform.imdg.api.Imdg; import ru.spcex.platform.imdg.api.ImdgProvider; import ru.spcex.platform.utils.validation.IValidator; @@ -74,8 +75,10 @@ public class DepoPaymentInstructionRegisterService extends QueueConsumer impleme public void depoPaymentInstructionRegisterNew(BaseRequest userRequest) { log.debug("LauncherCommandRequest received from {}", createRegistry_GORR.topic()); - Collection paymentInstructions = paymentInstructionMap.getAllValues(); - log.debug("Selected {} PaymentInstruction, do filter by account...", paymentInstructions.size()); + Map piQuery = Map.of("transactionStatus", TransactionStatus.sent.getKey()); + Collection paymentInstructions = paymentInstructionMap.getCollectionObjectsByFieldValues(piQuery); + log.debug("Selected {} PaymentInstruction by query \"{}\", do filter by account...", + paymentInstructions.size(), piQuery); Collection depoPaymentInstructions = new ArrayList<>(); for (PaymentInstruction paymentInstruction : paymentInstructions) { // filter by accountType diff --git a/clearing-parent/registry-service/src/main/java/ru/spcex/clearing/registry/service/MoneyPaymentInstructionRegisterService.java b/clearing-parent/registry-service/src/main/java/ru/spcex/clearing/registry/service/MoneyPaymentInstructionRegisterService.java index 684f3437c..126cc2d7a 100644 --- a/clearing-parent/registry-service/src/main/java/ru/spcex/clearing/registry/service/MoneyPaymentInstructionRegisterService.java +++ b/clearing-parent/registry-service/src/main/java/ru/spcex/clearing/registry/service/MoneyPaymentInstructionRegisterService.java @@ -18,6 +18,7 @@ import ru.spcex.clearing.platform.messaging.domain.cud.schedule.LauncherCommandR import ru.spcex.clearing.platform.messaging.service.QueueConsumer; import ru.spcex.clearing.registry.util.PreClearMap; import ru.spcex.platform.enumeration.AccountType; +import ru.spcex.platform.enumeration.TransactionStatus; import ru.spcex.platform.imdg.api.Imdg; import ru.spcex.platform.imdg.api.ImdgProvider; import ru.spcex.platform.utils.enumeration.IEnumKey; @@ -70,8 +71,10 @@ public class MoneyPaymentInstructionRegisterService extends QueueConsumer implem public void moneyPaymentInstructionRegisterNew(BaseRequest userRequest) { log.debug("LauncherCommandRequest received from {}", TOPIC_NAME); - Collection paymentInstructions = paymentInstructionMap.getAllValues(); - log.debug("Selected {} PaymentInstruction, do filter by account...", paymentInstructions.size()); + Map piQuery = Map.of("transactionStatus", TransactionStatus.sent.getKey()); + Collection paymentInstructions = paymentInstructionMap.getCollectionObjectsByFieldValues(piQuery); + log.debug("Selected {} PaymentInstruction by query \"{}\", do filter by account...", + paymentInstructions.size(), piQuery); Collection moneyPaymentInstructions = new ArrayList<>(); for (PaymentInstruction paymentInstruction : paymentInstructions) { // filter by accountType diff --git a/clearing-parent/registry-service/src/test/java/ru/spcex/clearing/registry/service/DepoPaymentInstructionRegisterServiceTest.java b/clearing-parent/registry-service/src/test/java/ru/spcex/clearing/registry/service/DepoPaymentInstructionRegisterServiceTest.java index 0a93a52af..20c39794c 100644 --- a/clearing-parent/registry-service/src/test/java/ru/spcex/clearing/registry/service/DepoPaymentInstructionRegisterServiceTest.java +++ b/clearing-parent/registry-service/src/test/java/ru/spcex/clearing/registry/service/DepoPaymentInstructionRegisterServiceTest.java @@ -23,6 +23,7 @@ import ru.spcex.clearing.test.config.ImdgTestConfig; import ru.spcex.clearing.test.config.KafkaTestConfig; import ru.spcex.platform.enumeration.AccountType; import ru.spcex.platform.enumeration.Task; +import ru.spcex.platform.enumeration.TransactionStatus; import ru.spcex.platform.imdg.api.Imdg; import ru.spcex.platform.imdg.api.ImdgProvider; @@ -97,6 +98,7 @@ class DepoPaymentInstructionRegisterServiceTest { paymentInstruction.setSenderId(TRADING_CLEARING_REGISTRY_COMPANY_ID); paymentInstruction.setCreditLeg_direction(SET_CREDIT_LEG_DIRECTION); paymentInstruction.setCreditLeg_amount(SET_CREDIT_LEG_AMOUNT); + paymentInstruction.setTransactionStatus(TransactionStatus.sent.getKey()); paymentInstructionMap.insert(paymentInstruction); diff --git a/clearing-parent/registry-service/src/test/java/ru/spcex/clearing/registry/service/MoneyPaymentInstructionRegisterServiceTest.java b/clearing-parent/registry-service/src/test/java/ru/spcex/clearing/registry/service/MoneyPaymentInstructionRegisterServiceTest.java index 2eed6bcb9..a2b2b1c50 100644 --- a/clearing-parent/registry-service/src/test/java/ru/spcex/clearing/registry/service/MoneyPaymentInstructionRegisterServiceTest.java +++ b/clearing-parent/registry-service/src/test/java/ru/spcex/clearing/registry/service/MoneyPaymentInstructionRegisterServiceTest.java @@ -22,6 +22,7 @@ import ru.spcex.clearing.test.config.ImdgTestConfig; import ru.spcex.clearing.test.config.KafkaTestConfig; import ru.spcex.platform.enumeration.AccountType; import ru.spcex.platform.enumeration.Task; +import ru.spcex.platform.enumeration.TransactionStatus; import ru.spcex.platform.imdg.api.Imdg; import ru.spcex.platform.imdg.api.ImdgProvider; @@ -93,6 +94,7 @@ class MoneyPaymentInstructionRegisterServiceTest { paymentInstruction.setDebitLeg_account(DEBITLEG_ACCOUNT_CONST); paymentInstruction.setSenderId(companySenderId); paymentInstruction.setAddresseeId(companyAddresseeId); + paymentInstruction.setTransactionStatus(TransactionStatus.sent.getKey()); paymentInstructionMap.insert(paymentInstruction); Company companySender = new Company(); companySender.setId(companySenderId);