etreschenkov 2024-05-28 10:03:21 +03:00
parent e00cc21a58
commit b2015a9aa4
2 changed files with 11 additions and 8 deletions

View file

@ -496,9 +496,8 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
}
public RequestInfoUpdate tradingClearingRegistryCheck(BaseRequest<TkrAccountsCheckRequest> gatewayRequest) {
log.debug("TradingClearingRegistryCheckRequest received");
TkrAccountsCheckRequest req = gatewayRequest.getRequestPayload();
log.debug("TradingClearingRegistryCheckRequest received with requestId : {}", req.getRequestId());
for (TkrAccount accountForCheck : req.getAccounts()) {
log.debug("Checking TKR with code: {}", accountForCheck.getTkrCode());
TradingClearingRegistry tradingClearingRegistry = tradingClearingRegistryImdg.getSingleObjectByFieldValues(
@ -513,7 +512,7 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
return null;
}
private SendTkrRequest createRequestToGateway(TradingClearingRegistry tradingClearingRegistry){
private SendTkrRequest createRequestToGateway(TradingClearingRegistry tradingClearingRegistry) {
SendTkrRequest sendTkrRequest = new SendTkrRequest();
if (tradingClearingRegistry != null) {
log.debug("Found TKR with id: {} and code: {}", tradingClearingRegistry.getId(), tradingClearingRegistry.getCode());

View file

@ -2,6 +2,7 @@ package ru.spcex.clearing.gatewayapi.service;
import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import ru.spcex.clearing.gatewayapi.controller.inbound.request.tkr.request.TkrRequest;
import ru.spcex.clearing.gatewayapi.service.adapter.TkrAdapter;
import ru.spcex.clearing.platform.messaging.domain.Consts;
@ -21,11 +22,14 @@ public class TkrService {
}
public void processedTkrRequest(TkrRequest tkrRequest) {
List<TkrAccount> tkrAccounts = tkrRequest.getInfoAccount().stream()
List<TkrAccount> tkrAccounts = tkrRequest.getInfoAccount()
.stream().filter(infoAccount -> !StringUtils.hasText(infoAccount.getClientCode()))
.map(tkrAdapter::toTkrResponse).toList();
TkrAccountsCheckRequest tkrAccountsCheckRequest = new TkrAccountsCheckRequest();
tkrAccountsCheckRequest.setRequestId(tkrRequest.getId());
tkrAccountsCheckRequest.setAccounts(tkrAccounts);
kafkaSender.sendRequestToQueue(Consts.DESTINATION_TRADING_CLEARING_REGISTRY_CHECK, tkrAccountsCheckRequest);
if (!tkrAccounts.isEmpty()) {
TkrAccountsCheckRequest tkrAccountsCheckRequest = new TkrAccountsCheckRequest();
tkrAccountsCheckRequest.setRequestId(tkrRequest.getId());
tkrAccountsCheckRequest.setAccounts(tkrAccounts);
kafkaSender.sendRequestToQueue(Consts.DESTINATION_TRADING_CLEARING_REGISTRY_CHECK, tkrAccountsCheckRequest);
}
}
}