diff --git a/clearing-parent/registry-service/src/main/java/ru/spcex/clearing/registry/service/AdmittedLiabilitiesRegisterService.java b/clearing-parent/registry-service/src/main/java/ru/spcex/clearing/registry/service/AdmittedLiabilitiesRegisterService.java index dd95b15e2..da3f30e0d 100644 --- a/clearing-parent/registry-service/src/main/java/ru/spcex/clearing/registry/service/AdmittedLiabilitiesRegisterService.java +++ b/clearing-parent/registry-service/src/main/java/ru/spcex/clearing/registry/service/AdmittedLiabilitiesRegisterService.java @@ -14,7 +14,10 @@ import ru.spcex.clearing.imdg.IMDGDistributedNames; import ru.spcex.clearing.platform.messaging.domain.BaseRequest; import ru.spcex.clearing.platform.messaging.domain.cud.schedule.LauncherCommandRequest; import ru.spcex.clearing.platform.messaging.service.QueueConsumer; -import ru.spcex.platform.enumeration.*; +import ru.spcex.platform.enumeration.RegistryCapacity; +import ru.spcex.platform.enumeration.RegistryCode; +import ru.spcex.platform.enumeration.RegistryDesignation; +import ru.spcex.platform.enumeration.RegistryInstrumentType; import ru.spcex.platform.imdg.api.Imdg; import ru.spcex.platform.imdg.api.ImdgProvider; @@ -68,7 +71,7 @@ public class AdmittedLiabilitiesRegisterService extends QueueConsumer implements private void insertAdmittedLiabilitiesRegister(Registry registry) { AdmittedLiabilitiesRegister admittedLiabilitiesRegister = new AdmittedLiabilitiesRegister(); - Optional company = companyMap.getCollectionObjectsByFieldValues(Map.of("id", "1")).stream().findFirst(); + Optional company = companyMap.getCollectionObjectsByFieldValues(Map.of("id", 1L)).stream().findFirst(); Optional security = securityMap.getCollectionObjectsByFieldValues(Map.of("id", registry.getSecurityId())).stream().findFirst(); String securitySymbol = security.map(Security::getSecuritySymbol).orElse(null); String securityFullName = security.map(Security::getShortName).orElse(null); 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 aafda99fa..92c22d4b3 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 @@ -20,7 +20,6 @@ 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; @@ -57,19 +56,23 @@ 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().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(); - collection.forEach(x -> sessionIdByCompanyId.put(x.getCompanyId(), x.getSessionId())); - actualSession.forEach(x -> { - Long existingCompanySessionId = sessionIdByCompanyId.get(x.getCompanyId()); - if (existingCompanySessionId == null) { - insertDepoPaymentInstructionRegister(sessionIdByPaymentInstructions.get(x.getId())); + Collection actualSessions = sessionMap.getCollectionObjectsByFieldValues(Map.of("section", "FOND")); + + for (Session session : actualSessions) { + Collection paymentInstructionBySessionId = + paymentInstructionMap.getCollectionObjectsByFieldValues(Map.of("sessionId", session.getId())); + for (PaymentInstruction paymentInstruction : paymentInstructionBySessionId) { + DepoPaymentInstructionRegister depoPaymentInstructionRegister = depoPaymentInstructionRegisterMap.getSingleObjectByFieldValues(Map.of( + "companyId", paymentInstruction.getSenderId(), + "sessionId", paymentInstruction.getSessionId()) + ); + if (depoPaymentInstructionRegister == null){ + insertDepoPaymentInstructionRegister(paymentInstruction); + } else { + //todo update?? + } } - }); + } log.debug("successfully processed"); } @@ -84,7 +87,7 @@ public class DepoPaymentInstructionRegisterService extends QueueConsumer impleme depoPaymentInstructionRegister.setCompanyId(paymentInstruction.getSenderId()); //todo fix up depoPaymentInstructionRegister.setTradingClearingRegistryType(); //todo fix up depoPaymentInstructionRegister.setTradingClearingRegistry(); - depoPaymentInstructionRegister.setCbCode("=RNCB-BE-01"); //TODO CLARIFY THERE SHOULD BE VALUE =RNCB-BE-01 OR 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()); //depoPaymentInstructionRegister.setDirection(paymentInstruction.getCreditLeg_direction()); //TODO CLARIFY HOW WE SHOULD MAP LONG IN STRING IS THERE SOME ERRORS depoPaymentInstructionRegister.setSessionId(paymentInstruction.getSessionId());