This commit is contained in:
parent
93fb2eaa07
commit
addf59853e
2 changed files with 8 additions and 8 deletions
|
|
@ -181,7 +181,6 @@ public class ValidationConfig {
|
|||
context.addImdg(IMDGDistributedNames.Map_Account, imdgAccount);
|
||||
context.addImdg(IMDGDistributedNames.Map_Company, imdgCompany);
|
||||
return new ValidatorImpl<>(context,
|
||||
Sdf08NewValidationRule.CompanyPresent,
|
||||
Sdf08NewValidationRule.AccountPresent
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ public class Sdf08Executor extends AbstractExecutor<SDf08> {
|
|||
private final Function<SDf08, IValidator> sDf08Validator;
|
||||
private final Imdg<ClearingAccount> clearingAccountImdg;
|
||||
private final Imdg<TradingClearingRegistry> tradingClearingRegistryImdg;
|
||||
private final Imdg<Company> companyImdg;
|
||||
private final Imdg<SDf09> sdf09Imdg;
|
||||
private final IMessageResolver messageResolver;
|
||||
|
||||
|
|
@ -59,11 +60,12 @@ public class Sdf08Executor extends AbstractExecutor<SDf08> {
|
|||
ImdgProvider imdgProvider,
|
||||
IMessageResolver messageResolver) {
|
||||
this.imdgProvider = imdgProvider;
|
||||
this.statementImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Statement, Statement.class);
|
||||
this.statementImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Statement, Statement.class);
|
||||
this.registryImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Registry, Registry.class);
|
||||
this.securityImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Security, Security.class);
|
||||
this.clearingAccountImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_ClearingAccount, ClearingAccount.class);
|
||||
this.tradingClearingRegistryImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_TradingClearingRegistry, TradingClearingRegistry.class);
|
||||
this.companyImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Company, Company.class);
|
||||
this.sdf09Imdg = imdgProvider.getImdg(IMDGDistributedNames.Map_SDf09, SDf09.class);
|
||||
this.sDf08Validator = sDf08Validator;
|
||||
this.messageResolver = messageResolver;
|
||||
|
|
@ -90,11 +92,10 @@ public class Sdf08Executor extends AbstractExecutor<SDf08> {
|
|||
for (SDf08 sdf08 : sdf) {
|
||||
IValidator validator = sDf08Validator.apply(sdf08);
|
||||
Optional<EnumMessage> error = validator.tillFirstError();
|
||||
Company company = validator.getStored(ValidationStored.Sdf08Company);
|
||||
Account account = validator.getStored(ValidationStored.Sdf08Account);
|
||||
if (statementRequest.getAccountCreationResults().size() == 0
|
||||
&& ClearingErrorInternal.AccountNotPresent.equals(error.map(EnumMessage::getSubject).orElse(null))) {
|
||||
result.getAccountRequests().add(createAccountRequestPart(sdf08.getId(), sdf08.getDepoCode(), company.getId()));
|
||||
result.getAccountRequests().add(createAccountRequestPart(sdf08.getId(), sdf08.getDepoCode(), account.getCompanyId()));
|
||||
log.info("account {} for sdf08.id={} not found - send request for creation", sdf08.getDepoCode(), sdf08.getId());
|
||||
continue;
|
||||
} else if (ClearingErrorInternal.AccountNotPresent.equals(error.map(EnumMessage::getSubject).orElse(null))) {
|
||||
|
|
@ -107,12 +108,13 @@ public class Sdf08Executor extends AbstractExecutor<SDf08> {
|
|||
continue;
|
||||
}
|
||||
|
||||
Statement stmt = createSdf08Statement(sdf08, company, account);
|
||||
Statement stmt = createSdf08Statement(sdf08, account);
|
||||
SDf09 sdf09New = createSuccessSdf09(sdf08, generationIdForGroup); //fixme тоже мб убрать
|
||||
sdf09Imdg.insert(sdf09New);
|
||||
stmt.setOutSDfId(sdf09New.getId());
|
||||
statementImdg.insert(stmt);
|
||||
|
||||
Company company = companyImdg.getSingleObjectByID(account.getCompanyId());
|
||||
Optional<EnumMessage> err = validateActiveness(company, account);
|
||||
if (err.isEmpty()) {
|
||||
Optional<Registry> reg = findReg(stmt);
|
||||
|
|
@ -158,10 +160,9 @@ public class Sdf08Executor extends AbstractExecutor<SDf08> {
|
|||
return req;
|
||||
}
|
||||
|
||||
private Statement createSdf08Statement(SDf08 sdf08, Company company, Account account) {
|
||||
private Statement createSdf08Statement(SDf08 sdf08, Account account) {
|
||||
Statement stmt = new Statement();
|
||||
stmt.setAddresseeId(company.getId());
|
||||
stmt.setAddresseeId(company.getId());
|
||||
stmt.setAddresseeId(account.getCompanyId());
|
||||
stmt.setSenderId(Sender.Rdc.getId());
|
||||
stmt.setStatementType(StatementType.incr.getKey());
|
||||
stmt.setAccountId(account.getId());
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue