This commit is contained in:
parent
715328e4c9
commit
df63b37e3c
2 changed files with 8 additions and 4 deletions
|
|
@ -24,6 +24,10 @@ public enum TaskType {
|
|||
* Step 6: forming Registry on Obligations and Settlement requirements
|
||||
*/
|
||||
FormingRegistersOnOS,
|
||||
/**
|
||||
* step 7
|
||||
*/
|
||||
FormingPaymentInstruction,
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@ public class FormingPaymentInstruction implements ISessionStage {
|
|||
public StageResult submit(Task<?> task) {
|
||||
InspectionPoolPayload payload = (InspectionPoolPayload) task.getData();
|
||||
switch (task.getTaskType()) {
|
||||
case InclusionToPool -> {
|
||||
return inspectionPool(payload.getProcessedCompanyId());
|
||||
case FormingPaymentInstruction -> {
|
||||
return formingPaymentInstruction(payload.getProcessedCompanyId());
|
||||
}
|
||||
default -> {
|
||||
throw new IllegalStateException("Unknown task type: " + task.getTaskType());
|
||||
|
|
@ -60,7 +60,7 @@ public class FormingPaymentInstruction implements ISessionStage {
|
|||
}
|
||||
|
||||
|
||||
private StageResult inspectionPool(Long processedCompanyId) {
|
||||
private StageResult formingPaymentInstruction(Long processedCompanyId) {
|
||||
RegistryTradingParams registryTradingParamsL = new RegistryTradingParams(RegistryDesignation.L,
|
||||
RegistryInstrumentType.S, null, RegistryUnit.T);
|
||||
RegistryTradingParams registryTradingParamsC = new RegistryTradingParams(RegistryDesignation.C,
|
||||
|
|
@ -172,7 +172,7 @@ public class FormingPaymentInstruction implements ISessionStage {
|
|||
registryCodeCondition = RegistryCodeSqlBuilder.getInstance(registryTradingParamsLT).build();
|
||||
String sqlCondition = String.format("(%s) and securityId = %s and tradingClearingRegistryId = %s and companyId = %s and counterPartyId = %s",
|
||||
registryCodeCondition, obligation.getSecurityId(), obligation.getTradingClearingRegistryId(), obligation.getCompanyId(), obligation.getCounterPartyId());
|
||||
Collection<Registry> registries = registryImdg.getCollectionObjectsBySQL(registryCodeCondition);
|
||||
Collection<Registry> registries = registryImdg.getCollectionObjectsBySQL(sqlCondition);
|
||||
|
||||
BigDecimal sumBalance = registries.stream().map(Registry::getBalance).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
PaymentInstruction paymentInstruction = createPaymentInstruction(obligation, sumBalance);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue