SDF57 processing

This commit is contained in:
etreschenkov 2023-05-24 18:49:18 +03:00
parent 93f2a6ecc9
commit be2d9aa234

View file

@ -133,6 +133,7 @@ public class Sdf57Executor extends AbstractExecutor<SDf57> {
Consumer<StmtCmpAcc> createRegistryIfNeeded = stmtCmpAcc -> {
Statement stmt = stmtCmpAcc.statement();
Statement counterStmt = stmtCmpAcc.counterStatement();
Company company = stmtCmpAcc.company();
Account account = stmtCmpAcc.account();
Optional<EnumMessage> err = validateActiveness(company, account, stmt);
@ -145,6 +146,8 @@ public class Sdf57Executor extends AbstractExecutor<SDf57> {
Registry registry = createRegistryByStatement(stmt, company, account, dsgn);
registryImdg.insert(registry);
};
//todo понять что происходит со инициатором/контрагентом, особенно если у нас только один Statement
findReg(stmt, RegistryDesignation.A).ifPresentOrElse(update, () -> create.accept(RegistryDesignation.A));
findReg(stmt, RegistryDesignation.D).ifPresentOrElse(update, () -> create.accept(RegistryDesignation.D));
stmt.setOperationStatus(OperationStatus.Executed.getKey());
@ -154,13 +157,14 @@ public class Sdf57Executor extends AbstractExecutor<SDf57> {
statementImdg.update(stmt);
}
};
statementDeb.ifPresent(stmt -> createRegistryIfNeeded.accept(new StmtCmpAcc(stmt, companyDeb, accountDeb)));
statementCred.ifPresent(stmt -> createRegistryIfNeeded.accept(new StmtCmpAcc(stmt, companyCred, accountCred)));
statementDeb.ifPresent(stmt -> createRegistryIfNeeded.accept(new StmtCmpAcc(stmt, statementCred.orElse(null), companyDeb, accountDeb)));
statementCred.ifPresent(stmt -> createRegistryIfNeeded.accept(new StmtCmpAcc(stmt, statementDeb.orElse(null), companyCred, accountCred)));
}
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) {