финальная сессия МКР часть 5 шага по сделкам
This commit is contained in:
parent
679b5cc01b
commit
d91383b4e5
3 changed files with 16 additions and 12 deletions
|
|
@ -38,7 +38,8 @@ public class FinalMkrSession extends AbstractSession implements InitializingBean
|
|||
private final ObligationAdmission obligationsAdmission;
|
||||
|
||||
private final InclusionObligations inclusionObligations;
|
||||
private final InspectionObligationsDepositReturn inspectionObligations;
|
||||
private final InspectionObligationsDepositReturn inspectionObligationsReturn;
|
||||
private final InspectionObligations inspectionObligations;
|
||||
private final FormingRegistersOnOS formingRegistersOnOS;
|
||||
private final FormingPaymentInstructionReturnMkr formingPaymentInstructionReturn;
|
||||
private final FormingPaymentInstructionDealsFinalMkr formingPaymentInstructionDeals;
|
||||
|
|
@ -58,13 +59,13 @@ public class FinalMkrSession extends AbstractSession implements InitializingBean
|
|||
RequirementsAndObligationCreation requirementsAndObligationCreation,
|
||||
ObligationAdmission obligationsAdmission,
|
||||
InclusionObligations inclusionObligations,
|
||||
FormingRegistersOnOS formingRegistersOnOS,
|
||||
InspectionObligations inspectionObligations, FormingRegistersOnOS formingRegistersOnOS,
|
||||
FormingPaymentInstructionReturnMkr formingPaymentInstructionReturn, FormingPaymentInstructionDealsFinalMkr formingPaymentInstructionDeals,
|
||||
UnlockResources unlockResources,
|
||||
FinishingSession finishingSession,
|
||||
EndStageNotification endStageNotification,
|
||||
IMessageResolver messageResolver,
|
||||
InspectionObligationsDepositReturn inspectionObligations,
|
||||
InspectionObligationsDepositReturn inspectionObligationsReturn,
|
||||
@Qualifier("marketCodesForBn") Supplier<List<String>> marketCodes) {
|
||||
super(imdgProvider, messageResolver);
|
||||
this.balanceRevise = balanceRevise;
|
||||
|
|
@ -72,6 +73,7 @@ public class FinalMkrSession extends AbstractSession implements InitializingBean
|
|||
this.requirementsAndObligationCreation = requirementsAndObligationCreation;
|
||||
this.obligationsAdmission = obligationsAdmission;
|
||||
this.inclusionObligations = inclusionObligations;
|
||||
this.inspectionObligations = inspectionObligations;
|
||||
this.formingRegistersOnOS = formingRegistersOnOS;
|
||||
this.formingPaymentInstructionReturn = formingPaymentInstructionReturn;
|
||||
this.formingPaymentInstructionDeals = formingPaymentInstructionDeals;
|
||||
|
|
@ -79,7 +81,7 @@ public class FinalMkrSession extends AbstractSession implements InitializingBean
|
|||
this.finishingSession = finishingSession;
|
||||
this.endStageNotification = endStageNotification;
|
||||
this.executionDepositImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_ExecutionDeposit, ExecutionDeposit.class);
|
||||
this.inspectionObligations = inspectionObligations;
|
||||
this.inspectionObligationsReturn = inspectionObligationsReturn;
|
||||
this.marketCodes = marketCodes;
|
||||
this.registryImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Registry, Registry.class);
|
||||
}
|
||||
|
|
@ -98,6 +100,7 @@ public class FinalMkrSession extends AbstractSession implements InitializingBean
|
|||
rgsPrctBuilder.lessEqual("valueDate", LocalDate.now())
|
||||
)
|
||||
);
|
||||
inspectionObligationsReturn.setSessionType(sessionType());
|
||||
inspectionObligations.setSessionType(sessionType());
|
||||
imdgProvider.waitAvailable();
|
||||
initSessionIfPresent();
|
||||
|
|
@ -170,6 +173,7 @@ public class FinalMkrSession extends AbstractSession implements InitializingBean
|
|||
{
|
||||
InspectionPoolPayload companyIdPayload = new InspectionPoolPayload();
|
||||
companyIdPayload.setProcessedCompanyId(currSession.getCompanyId());
|
||||
runStage(TaskType.InspectionObligations, companyIdPayload, inspectionObligationsReturn);
|
||||
runStage(TaskType.InspectionObligations, companyIdPayload, inspectionObligations);
|
||||
}
|
||||
//stage 6
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ public class FormingPaymentInstructionDealsFinalMkr implements ISessionStage {
|
|||
.stream()
|
||||
.collect(Collectors.groupingBy(Registry::getGroupId));
|
||||
log.debug("groups.size = {}", groups.size());
|
||||
List<PaymentInstruction> allPaymentInstructions = new ArrayList<>();
|
||||
List<PaymentInstruction> paymentInstructionDeals = new ArrayList<>();
|
||||
for (Map.Entry<Long, List<Registry>> group : groups.entrySet()) {
|
||||
Long groupId = group.getKey();
|
||||
Function<RegistryTradingParams, Registry> findByCode = rgsCode -> group.getValue()
|
||||
|
|
@ -192,7 +192,7 @@ public class FormingPaymentInstructionDealsFinalMkr implements ISessionStage {
|
|||
.build();
|
||||
Pair.forEach(pmtInstrs, pmtInstr -> {
|
||||
paymentInstructionImdg.insert(pmtInstr);
|
||||
allPaymentInstructions.add(pmtInstr);
|
||||
paymentInstructionDeals.add(pmtInstr);
|
||||
});
|
||||
log.trace("generated PaymentInstructions for groupId {}: pmtInstr1.id={} pmtInstr2.id={}",
|
||||
groupId,
|
||||
|
|
@ -202,8 +202,8 @@ public class FormingPaymentInstructionDealsFinalMkr implements ISessionStage {
|
|||
|
||||
log.debug("PaymentInstructions return size {}, PaymentInstructions deals size {}. sending SDF03",
|
||||
paymentInstructionReturns.size(),
|
||||
allPaymentInstructions.size());
|
||||
List<PaymentInstruction> returnsAndDeals = Stream.concat(paymentInstructionReturns.stream(), allPaymentInstructions.stream()).toList();
|
||||
paymentInstructionDeals.size());
|
||||
List<PaymentInstruction> returnsAndDeals = Stream.concat(paymentInstructionReturns.stream(), paymentInstructionDeals.stream()).toList();
|
||||
sendSdfs(returnsAndDeals);
|
||||
StageResult<Collection<PaymentInstruction>> stageResult = new StageResult<>(null, true);
|
||||
stageResult.setStageResult(returnsAndDeals);
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ public class InspectionObligationsDepositReturn implements ISessionStage {
|
|||
Optional<Registry> omtInGroupO = group.stream().filter(registry -> equalByRgs(OM_T, registry)).findFirst();
|
||||
if (omtInGroupO.isEmpty()) {
|
||||
log.error("groupId {} failed to find OM*T registry", entry.getKey());
|
||||
group.forEach(rgs -> updateStatus(rgs, RegistryStatus.MNG));
|
||||
group.forEach(rgs -> updateStatus(rgs, registryStatusForDmxCheckFailed()));
|
||||
continue;
|
||||
}
|
||||
Registry omtRgs = omtInGroupO.get();
|
||||
|
|
@ -139,7 +139,7 @@ public class InspectionObligationsDepositReturn implements ISessionStage {
|
|||
Optional<Registry> amfAssetO = searchAssetByOMT(omtRgs);
|
||||
if (amfAssetO.isEmpty()) {
|
||||
log.error("OM*T register.id={} groupId={} failed to find AM*F asset", omtRgs.getId(), entry.getKey());
|
||||
group.forEach(rgs -> updateStatus(rgs, RegistryStatus.MNG));
|
||||
group.forEach(rgs -> updateStatus(rgs, registryStatusForDmxCheckFailed()));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -157,7 +157,7 @@ public class InspectionObligationsDepositReturn implements ISessionStage {
|
|||
if (dmtBalance.compareTo(omtBalance) >= 0 && amfBalance.compareTo(omtBalance) >=0) {
|
||||
group.forEach(rgs -> updateStatus(rgs, RegistryStatus.OK));
|
||||
} else {
|
||||
group.forEach(rgs -> updateStatus(rgs, RegistryStatus.MNG));
|
||||
group.forEach(rgs -> updateStatus(rgs, registryStatusForDmxCheckFailed()));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
|
@ -172,7 +172,7 @@ public class InspectionObligationsDepositReturn implements ISessionStage {
|
|||
if (dmtBalance.compareTo(omtBalance) >= 0 && amfBalance.compareTo(omtBalance) >= 0) {
|
||||
group.forEach(rgs -> updateStatus(rgs, RegistryStatus.OK));
|
||||
} else {
|
||||
group.forEach(rgs -> updateStatus(rgs, RegistryStatus.MNG));
|
||||
group.forEach(rgs -> updateStatus(rgs, registryStatusForDmxCheckFailed()));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue