This commit is contained in:
parent
e00cc21a58
commit
b2015a9aa4
2 changed files with 11 additions and 8 deletions
|
|
@ -496,9 +496,8 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
||||||
}
|
}
|
||||||
|
|
||||||
public RequestInfoUpdate tradingClearingRegistryCheck(BaseRequest<TkrAccountsCheckRequest> gatewayRequest) {
|
public RequestInfoUpdate tradingClearingRegistryCheck(BaseRequest<TkrAccountsCheckRequest> gatewayRequest) {
|
||||||
log.debug("TradingClearingRegistryCheckRequest received");
|
|
||||||
|
|
||||||
TkrAccountsCheckRequest req = gatewayRequest.getRequestPayload();
|
TkrAccountsCheckRequest req = gatewayRequest.getRequestPayload();
|
||||||
|
log.debug("TradingClearingRegistryCheckRequest received with requestId : {}", req.getRequestId());
|
||||||
for (TkrAccount accountForCheck : req.getAccounts()) {
|
for (TkrAccount accountForCheck : req.getAccounts()) {
|
||||||
log.debug("Checking TKR with code: {}", accountForCheck.getTkrCode());
|
log.debug("Checking TKR with code: {}", accountForCheck.getTkrCode());
|
||||||
TradingClearingRegistry tradingClearingRegistry = tradingClearingRegistryImdg.getSingleObjectByFieldValues(
|
TradingClearingRegistry tradingClearingRegistry = tradingClearingRegistryImdg.getSingleObjectByFieldValues(
|
||||||
|
|
@ -513,7 +512,7 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SendTkrRequest createRequestToGateway(TradingClearingRegistry tradingClearingRegistry){
|
private SendTkrRequest createRequestToGateway(TradingClearingRegistry tradingClearingRegistry) {
|
||||||
SendTkrRequest sendTkrRequest = new SendTkrRequest();
|
SendTkrRequest sendTkrRequest = new SendTkrRequest();
|
||||||
if (tradingClearingRegistry != null) {
|
if (tradingClearingRegistry != null) {
|
||||||
log.debug("Found TKR with id: {} and code: {}", tradingClearingRegistry.getId(), tradingClearingRegistry.getCode());
|
log.debug("Found TKR with id: {} and code: {}", tradingClearingRegistry.getId(), tradingClearingRegistry.getCode());
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package ru.spcex.clearing.gatewayapi.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.stereotype.Service;
|
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.controller.inbound.request.tkr.request.TkrRequest;
|
||||||
import ru.spcex.clearing.gatewayapi.service.adapter.TkrAdapter;
|
import ru.spcex.clearing.gatewayapi.service.adapter.TkrAdapter;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||||
|
|
@ -21,11 +22,14 @@ public class TkrService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processedTkrRequest(TkrRequest tkrRequest) {
|
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();
|
.map(tkrAdapter::toTkrResponse).toList();
|
||||||
TkrAccountsCheckRequest tkrAccountsCheckRequest = new TkrAccountsCheckRequest();
|
if (!tkrAccounts.isEmpty()) {
|
||||||
tkrAccountsCheckRequest.setRequestId(tkrRequest.getId());
|
TkrAccountsCheckRequest tkrAccountsCheckRequest = new TkrAccountsCheckRequest();
|
||||||
tkrAccountsCheckRequest.setAccounts(tkrAccounts);
|
tkrAccountsCheckRequest.setRequestId(tkrRequest.getId());
|
||||||
kafkaSender.sendRequestToQueue(Consts.DESTINATION_TRADING_CLEARING_REGISTRY_CHECK, tkrAccountsCheckRequest);
|
tkrAccountsCheckRequest.setAccounts(tkrAccounts);
|
||||||
|
kafkaSender.sendRequestToQueue(Consts.DESTINATION_TRADING_CLEARING_REGISTRY_CHECK, tkrAccountsCheckRequest);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue