etreschenkov 2023-05-27 16:17:03 +03:00
parent a60f550645
commit d2da0e24c4
2 changed files with 11 additions and 7 deletions

View file

@ -104,14 +104,13 @@ public class PrimaryAuctionBnSession extends AbstractSession implements Initiali
if (!isRunning()) { if (!isRunning()) {
return; return;
} }
if (!checkStage(TaskType.StartRevise)) {
log.error("cannot continue session, current stage is {}", currStage.get());
throw new StageException();
}
if (checkStage(TaskType.StartRevise)) { if (checkStage(TaskType.StartRevise)) {
firstPart(req); firstPart(req);
} else if (checkStage(TaskType.FormingPaymentInstruction)) { } else if (checkStage(TaskType.FormingPaymentInstruction)) {
finishPart(req); finishPart(req);
} else {
log.error("cannot continue session, current stage is {}", currStage.get());
throw new StageException();
} }
} catch (StageException e) { } catch (StageException e) {
//already logged //already logged

View file

@ -81,10 +81,11 @@ public class RegistryBuilder {
TradingClearingRegistry tcr = searchTradingClearingRegistry(); TradingClearingRegistry tcr = searchTradingClearingRegistry();
String capacityByAccount = null; String capacityByAccount = null;
boolean isMoney = false; boolean isMoney = false;
Account account = accountImdg.getSingleObjectByID(reg.getAccountId()); Account account = null;
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());
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.getSingleObjectByFieldValues(Map.of("currencyCode", exec.getSettlementCurrency())); Currency currency = currencyImdg.getSingleObjectByFieldValues(Map.of("currencyCode", exec.getSettlementCurrency()));
@ -104,6 +105,7 @@ public class RegistryBuilder {
} 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;
reg.setAccountId(tcr.getDepoAccountId()); reg.setAccountId(tcr.getDepoAccountId());
account = accountImdg.getSingleObjectByID(tcr.getDepoAccountId());
reg.setRegistryInstrumentType(RegistryInstrumentType.S.getKey()); reg.setRegistryInstrumentType(RegistryInstrumentType.S.getKey());
reg.setBalanceDimension(BalanceDimension.PICS.getKey()); //fixme add second leg code branch reg.setBalanceDimension(BalanceDimension.PICS.getKey()); //fixme add second leg code branch
reg.setSecurityId(exec.getSecurityId()); reg.setSecurityId(exec.getSecurityId());
@ -113,8 +115,11 @@ public class RegistryBuilder {
capacityByAccount = depoAccount.getDepoAccountType(); capacityByAccount = depoAccount.getDepoAccountType();
} }
} }
reg.setAccountType(account.getAccountType());
reg.setAccount(account.getAccount()); if (account != null) {
reg.setAccountType(account.getAccountType());
reg.setAccount(account.getAccount());
}
reg.setRegistryDesignation(regDsgn.getKey()); reg.setRegistryDesignation(regDsgn.getKey());
if (capacityByAccount != null) { if (capacityByAccount != null) {
reg.setRegistryCapacity(capacityByAccount); reg.setRegistryCapacity(capacityByAccount);