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()) {
return;
}
if (!checkStage(TaskType.StartRevise)) {
log.error("cannot continue session, current stage is {}", currStage.get());
throw new StageException();
}
if (checkStage(TaskType.StartRevise)) {
firstPart(req);
} else if (checkStage(TaskType.FormingPaymentInstruction)) {
finishPart(req);
} else {
log.error("cannot continue session, current stage is {}", currStage.get());
throw new StageException();
}
} catch (StageException e) {
//already logged

View file

@ -81,10 +81,11 @@ public class RegistryBuilder {
TradingClearingRegistry tcr = searchTradingClearingRegistry();
String capacityByAccount = null;
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())) {
isMoney = true;
reg.setAccountId(tcr.getMoneyAccountId());
account = accountImdg.getSingleObjectByID(tcr.getMoneyAccountId());
reg.setRegistryInstrumentType(RegistryInstrumentType.M.getKey());
reg.setBalanceDimension(BalanceDimension.MONY.getKey()); //fixme add second leg code branch
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())) {
isMoney = false;
reg.setAccountId(tcr.getDepoAccountId());
account = accountImdg.getSingleObjectByID(tcr.getDepoAccountId());
reg.setRegistryInstrumentType(RegistryInstrumentType.S.getKey());
reg.setBalanceDimension(BalanceDimension.PICS.getKey()); //fixme add second leg code branch
reg.setSecurityId(exec.getSecurityId());
@ -113,8 +115,11 @@ public class RegistryBuilder {
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());
if (capacityByAccount != null) {
reg.setRegistryCapacity(capacityByAccount);