account-service http://jira.mfd.msk:8088/browse/CLS-577 улучшил текст валидации
This commit is contained in:
parent
afeede8baa
commit
31de64e5bb
1 changed files with 18 additions and 2 deletions
|
|
@ -49,7 +49,7 @@ public class AccountSymbolsValidationConfig {
|
||||||
if (AccountType.Depo.equalsByKey(account.getAccountType())) {
|
if (AccountType.Depo.equalsByKey(account.getAccountType())) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return AccountError.AccountDepoTypeRequired;//todo data.xml!!!
|
return AccountError.AccountDepoTypeRequired;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
|
@ -78,7 +78,23 @@ public class AccountSymbolsValidationConfig {
|
||||||
return empty();
|
return empty();
|
||||||
} else {
|
} else {
|
||||||
AccountSymbols existAS = existAccSymbols.iterator().next();
|
AccountSymbols existAS = existAccSymbols.iterator().next();
|
||||||
return of(AccountError.AccountAlreadyExist, existAS.getAccountId() + "," + existAS.getAccountSymbolValue());
|
String duplicateMsg = "";
|
||||||
|
if (validatedObject.getAccountId() != null && validatedObject.getAccountId().equals(existAS.getAccountId())) {
|
||||||
|
Imdg<Account> accountImdg = context.obtainMap(IMDGDistributedNames.Map_Account, Account.class);
|
||||||
|
Account linkedAccount = accountImdg.getSingleObjectByID(existAS.getAccountId());
|
||||||
|
if (linkedAccount != null) {
|
||||||
|
duplicateMsg = linkedAccount.getAccount();
|
||||||
|
} else {
|
||||||
|
duplicateMsg = "" + existAS.getAccountId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (validatedObject.getAccountSymbolValue() != null &&
|
||||||
|
validatedObject.getAccountSymbolValue().equals(existAS.getAccountSymbolValue())) {
|
||||||
|
if (!duplicateMsg.isEmpty())
|
||||||
|
duplicateMsg += ", ";
|
||||||
|
duplicateMsg += existAS.getAccountSymbolValue();
|
||||||
|
}
|
||||||
|
return of(AccountError.AccountAlreadyExist, duplicateMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue