account-service BankAccount SameAccountValidationRule поле account не обязательное.
This commit is contained in:
parent
1b8e773f26
commit
18b94c71fe
2 changed files with 5 additions and 5 deletions
|
|
@ -56,10 +56,6 @@ public class BankAccountValidationConfig {
|
||||||
AccountError.RequiredFieldEmpty,
|
AccountError.RequiredFieldEmpty,
|
||||||
AccountError.CompanyNotFound,
|
AccountError.CompanyNotFound,
|
||||||
false),
|
false),
|
||||||
FieldNotBlankRequiredRule.instance("account",
|
|
||||||
BankAccountNewRequest::getAccount,
|
|
||||||
AccountError.RequiredFieldEmpty
|
|
||||||
),
|
|
||||||
new SameAccountValidationRule<>(AccountType.Bank, BankAccountNewRequest::getAccount),
|
new SameAccountValidationRule<>(AccountType.Bank, BankAccountNewRequest::getAccount),
|
||||||
DictionaryPresentRule.instance("currency",
|
DictionaryPresentRule.instance("currency",
|
||||||
BankAccountNewRequest::getCurrency,
|
BankAccountNewRequest::getCurrency,
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,12 @@ class SameAccountValidationRule<R> implements IValidationRule<ImdgValidationCont
|
||||||
R req = context.getValidatedObject();
|
R req = context.getValidatedObject();
|
||||||
Imdg<Account> accountImdg = context.obtainMap(IMDGDistributedNames.Map_Account, Account.class);
|
Imdg<Account> accountImdg = context.obtainMap(IMDGDistributedNames.Map_Account, Account.class);
|
||||||
ImdgPredicateBuilder pb = accountImdg.predicateBuilder();
|
ImdgPredicateBuilder pb = accountImdg.predicateBuilder();
|
||||||
|
String account = accountGetter.apply(req); // req.getAccount()
|
||||||
|
if (account == null) {
|
||||||
|
return empty();
|
||||||
|
}
|
||||||
ImdgPredicate query = pb.and(
|
ImdgPredicate query = pb.and(
|
||||||
pb.equals("account", accountGetter.apply(req)), // req.getAccount()
|
pb.equals("account", account),
|
||||||
// pb.equals("accountType", accountType), имена всех счетов уникальны, вне зависимости от типа
|
// pb.equals("accountType", accountType), имена всех счетов уникальны, вне зависимости от типа
|
||||||
pb.in("status", ServiceStatus.Active.getKey(), ServiceStatus.Reopened.getKey(), ServiceStatus.Appl.getKey())
|
pb.in("status", ServiceStatus.Active.getKey(), ServiceStatus.Reopened.getKey(), ServiceStatus.Appl.getKey())
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue