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 = "Клиентский обособленный"; accountType = "Клиентский обособленный";
} }
tkr.setAccountTypeName(accountType); tkr.setAccountTypeName(accountType);
DepoAccount depoAccount = depoAccountImdg.getSingleObjectByID(tradingClearingRegistry.getDepoAccountId()); if (tradingClearingRegistry.getDepoAccountId() != null) {
Account account = null; DepoAccount depoAccount = depoAccountImdg.getSingleObjectByID(tradingClearingRegistry.getDepoAccountId());
if (depoAccount != null) { Account account = null;
account = accountImdg.getSingleObjectByID(depoAccount.getAccountId()); if (depoAccount != null) {
tkr.setDepoAccount(account.getAccount()); account = accountImdg.getSingleObjectByID(depoAccount.getAccountId());
tkr.setDepoAccount(account.getAccount());
}
} }
{ {
Account moneyAccount = accountImdg.getSingleObjectByID(tradingClearingRegistry.getMoneyAccountId()); if (tradingClearingRegistry.getMoneyAccountId() != null) {
MoneyAccountMsg moneyAccountMsg = new MoneyAccountMsg(); Account moneyAccount = accountImdg.getSingleObjectByID(tradingClearingRegistry.getMoneyAccountId());
moneyAccountMsg.setAccount(moneyAccount.getAccount()); MoneyAccountMsg moneyAccountMsg = new MoneyAccountMsg();
moneyAccountMsg.setCurrCode(StringUtils.hasText(moneyAccount.getCurrency()) ? moneyAccount.getCurrency() : "RUB"); moneyAccountMsg.setAccount(moneyAccount.getAccount());
tkr.getMoneyAccounts().add(moneyAccountMsg); moneyAccountMsg.setCurrCode(StringUtils.hasText(moneyAccount.getCurrency()) ? moneyAccount.getCurrency() : "RUB");
tkr.getMoneyAccounts().add(moneyAccountMsg);
}
} }
{ {
Collection<TradingClearingRegistryList> tradingClearingRegistries = tradingClearingRegistryListImdg.getCollectionObjectsByFieldValues( Collection<TradingClearingRegistryList> tradingClearingRegistries = tradingClearingRegistryListImdg.getCollectionObjectsByFieldValues(

View file

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

View file

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