FOND section: TCR#depoAccountId NULL fix

This commit is contained in:
ialbert 2024-07-04 17:05:03 +03:00
parent 1eb7a9d485
commit c1ec29a8be

View file

@ -112,19 +112,24 @@ public class RegistryFondBuilder implements IRegistryBuilder {
if ((regDsgn.equals(RegistryDesignation.O) && side.isBuy()) || (regDsgn.equals(RegistryDesignation.T) && side.isSell())) { if ((regDsgn.equals(RegistryDesignation.O) && side.isBuy()) || (regDsgn.equals(RegistryDesignation.T) && side.isSell())) {
isMoney = true; isMoney = true;
reg.setAccountId(tcr.getMoneyAccountId()); reg.setAccountId(tcr.getMoneyAccountId());
account = accountImdg.getSingleObjectByID(tcr.getMoneyAccountId()); if (tcr.getMoneyAccountId() != null) {
account = accountImdg.getSingleObjectByID(tcr.getMoneyAccountId());
capacityByAccount = defineCapacityByAccountType(account.getAccountType(), tcr.getMoneyAccountId());
}
reg.setRegistryInstrumentType(RegistryInstrumentType.M.getKey()); reg.setRegistryInstrumentType(RegistryInstrumentType.M.getKey());
reg.setBalanceDimension(BalanceDimension.MONY.getKey()); //fixme add second leg code branch reg.setBalanceDimension(BalanceDimension.MONY.getKey()); //fixme add second leg code branch
Currency currency = currencyImdg.getFirstObjectByFieldValues(Map.of("currencyCode", exec.getSettlementCurrency())); Currency currency = currencyImdg.getFirstObjectByFieldValues(Map.of("currencyCode", exec.getSettlementCurrency()));
reg.setSecurityId(currency.getId()); reg.setSecurityId(currency.getId());
reg.setSecuritySymbol(currency.getCurrencyCode()); reg.setSecuritySymbol(currency.getCurrencyCode());
capacityByAccount = defineCapacityByAccountType(account.getAccountType(), tcr.getMoneyAccountId());
} else if ((regDsgn.equals(RegistryDesignation.T) && side.isBuy()) || (regDsgn.equals(RegistryDesignation.O) && side.isSell())) { } else if ((regDsgn.equals(RegistryDesignation.T) && side.isBuy()) || (regDsgn.equals(RegistryDesignation.O) && side.isSell())) {
isMoney = false; isMoney = false;
account = accountImdg.getSingleObjectByID(tcr.getDepoAccountId());
reg.setAccountId(tcr.getDepoAccountId()); reg.setAccountId(tcr.getDepoAccountId());
DepoAccount depoAccount = depoAccountImdg.getFirstObjectByFieldValues( DepoAccount depoAccount = null;
if (tcr.getDepoAccountId() != null) {
account = accountImdg.getSingleObjectByID(tcr.getDepoAccountId());
depoAccount = depoAccountImdg.getFirstObjectByFieldValues(
Map.of("accountId", tcr.getDepoAccountId())); Map.of("accountId", tcr.getDepoAccountId()));
}
if (depoAccount != null) { if (depoAccount != null) {
capacityByAccount = depoAccount.getDepoAccountType(); capacityByAccount = depoAccount.getDepoAccountType();
} }