etreschenkov 2024-05-28 11:56:45 +03:00
parent 6a4a7ec4e7
commit e0eebea890
3 changed files with 27 additions and 21 deletions

View file

@ -544,18 +544,22 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
accountType = "Клиентский обособленный";
}
tkr.setAccountTypeName(accountType);
DepoAccount depoAccount = depoAccountImdg.getSingleObjectByID(tradingClearingRegistry.getDepoAccountId());
Account account = null;
if (depoAccount != null) {
account = accountImdg.getSingleObjectByID(depoAccount.getAccountId());
tkr.setDepoAccount(account.getAccount());
if (tradingClearingRegistry.getDepoAccountId() != null) {
DepoAccount depoAccount = depoAccountImdg.getSingleObjectByID(tradingClearingRegistry.getDepoAccountId());
Account account = null;
if (depoAccount != null) {
account = accountImdg.getSingleObjectByID(depoAccount.getAccountId());
tkr.setDepoAccount(account.getAccount());
}
}
{
Account moneyAccount = accountImdg.getSingleObjectByID(tradingClearingRegistry.getMoneyAccountId());
MoneyAccountMsg moneyAccountMsg = new MoneyAccountMsg();
moneyAccountMsg.setAccount(moneyAccount.getAccount());
moneyAccountMsg.setCurrCode(StringUtils.hasText(moneyAccount.getCurrency()) ? moneyAccount.getCurrency() : "RUB");
tkr.getMoneyAccounts().add(moneyAccountMsg);
if (tradingClearingRegistry.getMoneyAccountId() != null) {
Account moneyAccount = accountImdg.getSingleObjectByID(tradingClearingRegistry.getMoneyAccountId());
MoneyAccountMsg moneyAccountMsg = new MoneyAccountMsg();
moneyAccountMsg.setAccount(moneyAccount.getAccount());
moneyAccountMsg.setCurrCode(StringUtils.hasText(moneyAccount.getCurrency()) ? moneyAccount.getCurrency() : "RUB");
tkr.getMoneyAccounts().add(moneyAccountMsg);
}
}
{
Collection<TradingClearingRegistryList> tradingClearingRegistries = tradingClearingRegistryListImdg.getCollectionObjectsByFieldValues(

View file

@ -17,9 +17,11 @@ public class TkrAdapter {
tkrResponse.setEnabled(infoAccount.getEnabled());
tkrResponse.setTkrCode(infoAccount.getTkrCode());
tkrResponse.setDepoAccount(infoAccount.getDepoAccount());
List<MoneyAccountMsg> moneyAccountMsgs = infoAccount.getMoneyAccounts().stream()
.map(this::toMoneyAccountMsg).toList();
tkrResponse.setMoneyAccounts(moneyAccountMsgs);
if (infoAccount.getMoneyAccounts() != null) {
List<MoneyAccountMsg> moneyAccountMsgs = infoAccount.getMoneyAccounts().stream()
.map(this::toMoneyAccountMsg).toList();
tkrResponse.setMoneyAccounts(moneyAccountMsgs);
}
return tkrResponse;
}

View file

@ -5,21 +5,21 @@ import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
public class Tkr {
@JsonProperty
@JsonProperty("company_id")
private String companyId;
@JsonProperty
@JsonProperty("trading_code")
private Long tradingCode;
@JsonProperty
@JsonProperty("client_code")
private String clientCode;
@JsonProperty
@JsonProperty("tkr_code")
private String tkrCode;
@JsonProperty
@JsonProperty("tkr_type")
private String tkrType;
@JsonProperty
@JsonProperty("account_type_name")
private String accountTypeName;
@JsonProperty
@JsonProperty("depo_account")
private String depoAccount;
@JsonProperty
@JsonProperty("money_account")
private List<MoneyAccountMsg> moneyAccounts = new ArrayList<>();
public String getCompanyId() {