This commit is contained in:
parent
5149014098
commit
328573074c
3 changed files with 8 additions and 5 deletions
|
|
@ -68,7 +68,8 @@ public class ClientCodeFacade implements IClearingFacade {
|
|||
predicateBuilder.and(
|
||||
predicateBuilder.equals("companyId", request.getCompanyId()),
|
||||
predicateBuilder.equals("code", request.getCode()),
|
||||
predicateBuilder.equals("tradingClearingRegistryId", tradingClearingRegistry.getId())
|
||||
predicateBuilder.equals("tradingClearingRegistryId", tradingClearingRegistry.getId()),
|
||||
predicateBuilder.equals("status", Status.Active.getKey())
|
||||
)
|
||||
);
|
||||
if (clientCode == null) {
|
||||
|
|
|
|||
|
|
@ -190,11 +190,10 @@ public class ClientCodeMessageListener extends QueueConsumer implements Initiali
|
|||
log.debug("eks_account is filled, creating info account: {}", account.getEks_account());
|
||||
Pair<Long, String> accId = accountFacade.createAccountInfo(account, company);
|
||||
accountIds.add(accId);
|
||||
} else {
|
||||
List<Account> clrnAccs = validator.getStored(ClientCodeStoreObjects.CLRN_ACCS);
|
||||
clrnAccs.forEach(acc -> accountIds.add(new Pair<>(acc.getId(), acc.getCurrency())));
|
||||
}
|
||||
}
|
||||
List<Account> clrnAccs = validator.getStored(ClientCodeStoreObjects.CLRN_ACCS);
|
||||
clrnAccs.forEach(acc -> accountIds.add(new Pair<>(acc.getId(), acc.getCurrency())));
|
||||
|
||||
Long rubMoneyAcc = accountIds.stream()
|
||||
.filter(pair -> CurrencyCode.RUB.equalsByKey(pair.getSecond()))
|
||||
|
|
|
|||
|
|
@ -130,6 +130,8 @@ public enum GatewayEksClientCodeValidationRule implements IValidationRule<ImdgVa
|
|||
DepoAccount depoAccount = depoAccountOpt.get();
|
||||
Imdg<TradingClearingRegistry> imdg = context.obtainMap(IMDGDistributedNames.Map_TradingClearingRegistry,
|
||||
TradingClearingRegistry.class);
|
||||
Imdg<Account> accountImdg = context.obtainMap(IMDGDistributedNames.Map_Account,
|
||||
Account.class);
|
||||
TradingClearingRegistry tcr = imdg.getFirstObjectByFieldValues(
|
||||
Map.of(
|
||||
"depoAccountId", depoAccount.getAccountId(),
|
||||
|
|
@ -137,7 +139,8 @@ public enum GatewayEksClientCodeValidationRule implements IValidationRule<ImdgVa
|
|||
)
|
||||
);
|
||||
if (tcr != null) {
|
||||
return of(AccountError.TradingClearingRegistryAlreadyExist, tcr.getCode(), "code");
|
||||
Account account = accountImdg.getSingleObjectByID(depoAccount.getAccountId());
|
||||
return of(AccountError.AccountForTradingClearingRegistryAlreadyUsed, account.getAccount(), "account");
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue