etreshenkov 2023-05-23 12:00:19 +03:00
parent 5c93f133dd
commit a26978764b
2 changed files with 22 additions and 16 deletions

View file

@ -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> company = companyMap.getCollectionObjectsByFieldValues(Map.of("id", "1")).stream().findFirst();
Optional<Company> company = companyMap.getCollectionObjectsByFieldValues(Map.of("id", 1L)).stream().findFirst();
Optional<Security> 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);

View file

@ -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<LauncherCommandRequest> userRequest) {
log.debug("LauncherCommandRequest received from {}", createRegistry_GORR.topic());
HashMap<Long, PaymentInstruction> sessionIdByPaymentInstructions = new HashMap<>();
paymentInstructionMap.getAllValues().forEach(x -> sessionIdByPaymentInstructions.put(x.getSessionId(), x));
List<Session> actualSession = sessionMap.getCollectionObjectsByFieldValues(Map.of("section", "FOND")).stream().filter(x ->
sessionIdByPaymentInstructions.containsKey(x.getId())
).toList();
HashMap<Long, Long> sessionIdByCompanyId = new HashMap<>();
Collection<DepoPaymentInstructionRegister> 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<Session> actualSessions = sessionMap.getCollectionObjectsByFieldValues(Map.of("section", "FOND"));
for (Session session : actualSessions) {
Collection<PaymentInstruction> 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());