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 e105c5703..aafda99fa 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 @@ -17,9 +17,11 @@ import ru.spcex.clearing.platform.messaging.service.QueueConsumer; import ru.spcex.platform.imdg.api.Imdg; import ru.spcex.platform.imdg.api.ImdgProvider; +import java.time.Instant; import java.util.Collection; import java.util.HashMap; import java.util.List; +import java.util.Map; import static ru.spcex.platform.enumeration.Task.createRegistry_GORR; import static ru.spcex.platform.enumeration.Task.createRegistry_GRRT; @@ -55,9 +57,9 @@ public class DepoPaymentInstructionRegisterService extends QueueConsumer impleme public void depoPaymentInstructionRegisterNew(BaseRequest userRequest) { log.debug("LauncherCommandRequest received from {}", createRegistry_GORR.topic()); HashMap sessionIdByPaymentInstructions = new HashMap<>(); - paymentInstructionMap.getAllValues().stream().forEach(x -> sessionIdByPaymentInstructions.put(x.getSessionId(), x)); - List actualSession = sessionMap.getAllValues().stream().filter(x -> - sessionIdByPaymentInstructions.containsKey(x.getId()) && x.getSection().equalsIgnoreCase("FOND") + paymentInstructionMap.getAllValues().forEach(x -> sessionIdByPaymentInstructions.put(x.getSessionId(), x)); + List actualSession = sessionMap.getCollectionObjectsByFieldValues(Map.of("section", "FOND")).stream().filter(x -> + sessionIdByPaymentInstructions.containsKey(x.getId()) ).toList(); HashMap sessionIdByCompanyId = new HashMap<>(); Collection collection = depoPaymentInstructionRegisterMap.getAllValues(); @@ -73,17 +75,21 @@ public class DepoPaymentInstructionRegisterService extends QueueConsumer impleme } private void insertDepoPaymentInstructionRegister(PaymentInstruction paymentInstruction) { + log.trace("Started generating DepoPaymentInstructionRegister entity..."); DepoPaymentInstructionRegister depoPaymentInstructionRegister = new DepoPaymentInstructionRegister(); - //todo fix up Optional tradingClearingRegistry = tradingClearingRegistryMap.getAllValues().stream().filter((x)-> x.getCompanyId().equals(paymentInstruction.getCompanyId())).findFirst(); - + //TODO CLARIFY HOW WE SHOULD FIND TRADING CLEARING REGISTRY IF IN PAYMENT INSTRUCTION THERE IS NO COMPANY ID + //TradingClearingRegistry tradingClearingRegistry = tradingClearingRegistryMap.getSingleObjectByFieldValues(Map.of("companyId", paymentInstruction.getCompanyId())); + depoPaymentInstructionRegister.setCreated(Instant.now()); + depoPaymentInstructionRegister.setUpdated(Instant.now()); depoPaymentInstructionRegister.setCompanyId(paymentInstruction.getSenderId()); //todo fix up depoPaymentInstructionRegister.setTradingClearingRegistryType(); //todo fix up depoPaymentInstructionRegister.setTradingClearingRegistry(); - depoPaymentInstructionRegister.setCbCode("=RNCB-BE-01"); + depoPaymentInstructionRegister.setCbCode("=RNCB-BE-01"); //TODO CLARIFY THERE SHOULD BE VALUE =RNCB-BE-01 OR RNCB-BE-01 depoPaymentInstructionRegister.setQuantity(paymentInstruction.getCreditLeg_amount()); - //todo fix up depoPaymentInstructionRegister.setDirection(paymentInstruction.getCreditLeg_direction()); + //depoPaymentInstructionRegister.setDirection(paymentInstruction.getCreditLeg_direction()); //TODO CLARIFY HOW WE SHOULD MAP LONG IN STRING IS THERE SOME ERRORS depoPaymentInstructionRegister.setSessionId(paymentInstruction.getSessionId()); depoPaymentInstructionRegisterMap.insert(depoPaymentInstructionRegister); + log.debug("inserted successfully DepoBalanceRegister entity with id: {}", depoPaymentInstructionRegister.getId()); } }