SDF57 processing
This commit is contained in:
parent
93f2a6ecc9
commit
be2d9aa234
1 changed files with 7 additions and 3 deletions
|
|
@ -133,6 +133,7 @@ public class Sdf57Executor extends AbstractExecutor<SDf57> {
|
||||||
|
|
||||||
Consumer<StmtCmpAcc> createRegistryIfNeeded = stmtCmpAcc -> {
|
Consumer<StmtCmpAcc> createRegistryIfNeeded = stmtCmpAcc -> {
|
||||||
Statement stmt = stmtCmpAcc.statement();
|
Statement stmt = stmtCmpAcc.statement();
|
||||||
|
Statement counterStmt = stmtCmpAcc.counterStatement();
|
||||||
Company company = stmtCmpAcc.company();
|
Company company = stmtCmpAcc.company();
|
||||||
Account account = stmtCmpAcc.account();
|
Account account = stmtCmpAcc.account();
|
||||||
Optional<EnumMessage> err = validateActiveness(company, account, stmt);
|
Optional<EnumMessage> err = validateActiveness(company, account, stmt);
|
||||||
|
|
@ -145,6 +146,8 @@ public class Sdf57Executor extends AbstractExecutor<SDf57> {
|
||||||
Registry registry = createRegistryByStatement(stmt, company, account, dsgn);
|
Registry registry = createRegistryByStatement(stmt, company, account, dsgn);
|
||||||
registryImdg.insert(registry);
|
registryImdg.insert(registry);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//todo понять что происходит со инициатором/контрагентом, особенно если у нас только один Statement
|
||||||
findReg(stmt, RegistryDesignation.A).ifPresentOrElse(update, () -> create.accept(RegistryDesignation.A));
|
findReg(stmt, RegistryDesignation.A).ifPresentOrElse(update, () -> create.accept(RegistryDesignation.A));
|
||||||
findReg(stmt, RegistryDesignation.D).ifPresentOrElse(update, () -> create.accept(RegistryDesignation.D));
|
findReg(stmt, RegistryDesignation.D).ifPresentOrElse(update, () -> create.accept(RegistryDesignation.D));
|
||||||
stmt.setOperationStatus(OperationStatus.Executed.getKey());
|
stmt.setOperationStatus(OperationStatus.Executed.getKey());
|
||||||
|
|
@ -154,13 +157,14 @@ public class Sdf57Executor extends AbstractExecutor<SDf57> {
|
||||||
statementImdg.update(stmt);
|
statementImdg.update(stmt);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
statementDeb.ifPresent(stmt -> createRegistryIfNeeded.accept(new StmtCmpAcc(stmt, companyDeb, accountDeb)));
|
statementDeb.ifPresent(stmt -> createRegistryIfNeeded.accept(new StmtCmpAcc(stmt, statementCred.orElse(null), companyDeb, accountDeb)));
|
||||||
statementCred.ifPresent(stmt -> createRegistryIfNeeded.accept(new StmtCmpAcc(stmt, companyCred, accountCred)));
|
statementCred.ifPresent(stmt -> createRegistryIfNeeded.accept(new StmtCmpAcc(stmt, statementDeb.orElse(null), companyCred, accountCred)));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static record StmtCmpAcc(Statement statement, Company company, Account account) {
|
private static record StmtCmpAcc(Statement statement, Statement counterStatement, Company company,
|
||||||
|
Account account) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Optional<EnumMessage> validateActiveness(Company company, Account account, Statement statement) {
|
private Optional<EnumMessage> validateActiveness(Company company, Account account, Statement statement) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue