SDF57 processing
This commit is contained in:
parent
3619329137
commit
0bb9990a6e
1 changed files with 14 additions and 7 deletions
|
|
@ -30,6 +30,7 @@ import java.time.LocalDate;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.function.BiFunction;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
|
@ -103,16 +104,22 @@ public class Sdf57Executor extends AbstractExecutor<SDf57> {
|
||||||
log.error("error while validating sdf57.id={} - {}", sdf57.getId(), messageResolver.resolve(error.get()));
|
log.error("error while validating sdf57.id={} - {}", sdf57.getId(), messageResolver.resolve(error.get()));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
BiFunction<Company, Account, Optional<Statement>> createStatementIfNeeded = (company, account) -> {
|
||||||
|
if (company == null || account == null) {
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
Statement statement = create(sdf57, company, account);
|
||||||
|
statementImdg.insert(statement);
|
||||||
|
return Optional.of(statement);
|
||||||
|
};
|
||||||
//create by companyDeb
|
//create by companyDeb
|
||||||
Company companyDeb = validator.getStored(ValidationStored.Sdf57CompanyDeb);
|
Company companyDeb = validator.getStored(ValidationStored.Sdf57CompanyDeb);
|
||||||
Account accountDeb = validator.getStored(ValidationStored.Sdf57AccountDeb);
|
Account accountDeb = validator.getStored(ValidationStored.Sdf57AccountDeb);
|
||||||
Statement statementDeb = create(sdf57, companyDeb, accountDeb);
|
Optional<Statement> statementDeb = createStatementIfNeeded.apply(companyDeb, accountDeb);
|
||||||
statementImdg.insert(statementDeb);
|
|
||||||
//create by companyCred
|
//create by companyCred
|
||||||
Company companyCred = validator.getStored(ValidationStored.Sdf57CompanyCred);
|
Company companyCred = validator.getStored(ValidationStored.Sdf57CompanyCred);
|
||||||
Account accountCred = validator.getStored(ValidationStored.Sdf57AccountCred);
|
Account accountCred = validator.getStored(ValidationStored.Sdf57AccountCred);
|
||||||
Statement statementCred = create(sdf57, companyCred, accountCred);
|
Optional<Statement> statementCred = createStatementIfNeeded.apply(companyCred, accountCred);
|
||||||
statementImdg.insert(statementCred);
|
|
||||||
|
|
||||||
Consumer<StmtCmpAcc> createRegistryIfNeeded = stmtCmpAcc -> {
|
Consumer<StmtCmpAcc> createRegistryIfNeeded = stmtCmpAcc -> {
|
||||||
Statement stmt = stmtCmpAcc.statement();
|
Statement stmt = stmtCmpAcc.statement();
|
||||||
|
|
@ -135,8 +142,8 @@ public class Sdf57Executor extends AbstractExecutor<SDf57> {
|
||||||
statementImdg.update(stmt);
|
statementImdg.update(stmt);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
createRegistryIfNeeded.accept(new StmtCmpAcc(statementDeb, companyDeb, accountDeb));
|
statementDeb.ifPresent(stmt -> createRegistryIfNeeded.accept(new StmtCmpAcc(stmt, companyDeb, accountDeb)));
|
||||||
createRegistryIfNeeded.accept(new StmtCmpAcc(statementCred, companyCred, accountCred));
|
statementCred.ifPresent(stmt -> createRegistryIfNeeded.accept(new StmtCmpAcc(stmt, companyCred, accountCred)));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -195,7 +202,7 @@ public class Sdf57Executor extends AbstractExecutor<SDf57> {
|
||||||
// rgstrPredicate = pb.and(rgstrPredicate, pb.equals("contract", s.getContract()));
|
// rgstrPredicate = pb.and(rgstrPredicate, pb.equals("contract", s.getContract()));
|
||||||
// }
|
// }
|
||||||
// return Optional.ofNullable(registryImdg.getSingleObjectByPredicate(rgstrPredicate));
|
// return Optional.ofNullable(registryImdg.getSingleObjectByPredicate(rgstrPredicate));
|
||||||
return null;
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
DateTimeFormatter payDateFormatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
DateTimeFormatter payDateFormatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue