правка 7 шага для МКР и промежуточной сессии
This commit is contained in:
parent
7174024333
commit
c8fa6e052e
4 changed files with 111 additions and 76 deletions
|
|
@ -43,7 +43,7 @@ public class FinalMkrSession extends AbstractSession implements InitializingBean
|
|||
private final InspectionObligations inspectionObligations;
|
||||
private final FormingRegistersOnOS formingRegistersOnOS;
|
||||
private final FormingPaymentInstructionReturnMkr formingPaymentInstructionReturn;
|
||||
private final FormingPaymentInstructionDealsFinalMkr formingPaymentInstructionDeals;
|
||||
private final FormingPaymentInstructionAssets formingPaymentInstructionDeals;
|
||||
private final UnlockResources unlockResources;
|
||||
private final FinishingSession finishingSession;
|
||||
private final EndStageNotification endStageNotification;
|
||||
|
|
@ -61,7 +61,7 @@ public class FinalMkrSession extends AbstractSession implements InitializingBean
|
|||
ObligationAdmission obligationsAdmission,
|
||||
InclusionObligations inclusionObligations,
|
||||
InspectionObligations inspectionObligations, FormingRegistersOnOS formingRegistersOnOS,
|
||||
FormingPaymentInstructionReturnMkr formingPaymentInstructionReturn, FormingPaymentInstructionDealsFinalMkr formingPaymentInstructionDeals,
|
||||
FormingPaymentInstructionReturnMkr formingPaymentInstructionReturn, FormingPaymentInstructionAssets formingPaymentInstructionDeals,
|
||||
UnlockResources unlockResources,
|
||||
FinishingSession finishingSession,
|
||||
EndStageNotification endStageNotification,
|
||||
|
|
@ -104,6 +104,7 @@ public class FinalMkrSession extends AbstractSession implements InitializingBean
|
|||
inclusionObligations.setSessionType(sessionType());
|
||||
inspectionObligationsReturn.setSessionType(sessionType());
|
||||
inspectionObligations.setSessionType(sessionType());
|
||||
formingPaymentInstructionDeals.setSection(section());
|
||||
imdgProvider.waitAvailable();
|
||||
initSessionIfPresent();
|
||||
}
|
||||
|
|
@ -197,7 +198,7 @@ public class FinalMkrSession extends AbstractSession implements InitializingBean
|
|||
|
||||
StageResult<Collection<PaymentInstruction>> paymentResult = null;
|
||||
{
|
||||
FormingPaymentInstructionDealsMkrPayload payload = new FormingPaymentInstructionDealsMkrPayload();
|
||||
FormingPaymentInstructionPayload payload = new FormingPaymentInstructionPayload();
|
||||
payload.setSessionId(currSession.getId());
|
||||
payload.setPaymentInstructionReturns(returnsPayment.getStageResult());
|
||||
//stage 7
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class IntermediateMkrSession extends AbstractSession implements Initializ
|
|||
private final InspectionObligations inspectionObligations;
|
||||
private final FormingRegistersOnOS formingRegistersOnOS;
|
||||
private final FormingPaymentInstructionReturnMkr formingPaymentInstructionReturn;
|
||||
private final FormingPaymentInstructionDealsFinalMkr formingPaymentInstructionDeals;
|
||||
private final FormingPaymentInstructionAssets formingPaymentInstructionDeals;
|
||||
private final UnlockResources unlockResources;
|
||||
private final FinishingSession finishingSession;
|
||||
private final EndStageNotification endStageNotification;
|
||||
|
|
@ -61,7 +61,7 @@ public class IntermediateMkrSession extends AbstractSession implements Initializ
|
|||
ObligationAdmission obligationsAdmission,
|
||||
InclusionObligations inclusionObligations,
|
||||
InspectionObligations inspectionObligations, FormingRegistersOnOS formingRegistersOnOS,
|
||||
FormingPaymentInstructionReturnMkr formingPaymentInstructionReturn, FormingPaymentInstructionDealsFinalMkr formingPaymentInstructionDeals,
|
||||
FormingPaymentInstructionReturnMkr formingPaymentInstructionReturn, FormingPaymentInstructionAssets formingPaymentInstructionDeals,
|
||||
UnlockResources unlockResources,
|
||||
FinishingSession finishingSession,
|
||||
EndStageNotification endStageNotification,
|
||||
|
|
@ -104,6 +104,7 @@ public class IntermediateMkrSession extends AbstractSession implements Initializ
|
|||
inclusionObligations.setSessionType(sessionType());
|
||||
inspectionObligationsReturn.setSessionType(sessionType());
|
||||
inspectionObligations.setSessionType(sessionType());
|
||||
formingPaymentInstructionDeals.setSection(section());
|
||||
imdgProvider.waitAvailable();
|
||||
initSessionIfPresent();
|
||||
}
|
||||
|
|
@ -184,7 +185,7 @@ public class IntermediateMkrSession extends AbstractSession implements Initializ
|
|||
|
||||
StageResult<Collection<PaymentInstruction>> paymentResult = null;
|
||||
{
|
||||
FormingPaymentInstructionDealsMkrPayload payload = new FormingPaymentInstructionDealsMkrPayload();
|
||||
FormingPaymentInstructionPayload payload = new FormingPaymentInstructionPayload();
|
||||
payload.setSessionId(currSession.getId());
|
||||
payload.setPaymentInstructionReturns(returnsPayment.getStageResult());
|
||||
//stage 7
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ import ru.spcex.platform.utils.number.BigDecimalUtil;
|
|||
import java.math.BigDecimal;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static ru.spcex.platform.enumeration.RegistryTradingParams.*;
|
||||
import static ru.spcex.platform.utils.number.BigDecimalUtil.safeBD;
|
||||
|
|
@ -66,6 +67,7 @@ public class FormingPaymentInstructionAssets implements ISessionStage {
|
|||
private final IMessageResolver msgResolver = new SimpleMessageResolver();
|
||||
private final SecuritySelector<Security> securitySelector;
|
||||
private final RegistryManager rgsMng;
|
||||
private Section section;
|
||||
|
||||
@Autowired
|
||||
public FormingPaymentInstructionAssets(ImdgProvider imdgProvider,
|
||||
|
|
@ -90,7 +92,7 @@ public class FormingPaymentInstructionAssets implements ISessionStage {
|
|||
FormingPaymentInstructionPayload payload = (FormingPaymentInstructionPayload) task.getData();
|
||||
switch (task.getTaskType()) {
|
||||
case FormingPaymentInstruction -> {
|
||||
return formingPaymentInstructions(payload.getSessionId());
|
||||
return formingPaymentInstructions(payload);
|
||||
}
|
||||
default -> {
|
||||
throw new IllegalStateException("Unknown task type: " + task.getTaskType());
|
||||
|
|
@ -98,12 +100,15 @@ public class FormingPaymentInstructionAssets implements ISessionStage {
|
|||
}
|
||||
}
|
||||
|
||||
private Collection<Registry> selectAMBRegistries() {
|
||||
private Collection<Registry> selectAMBRegistries(Long sessionId) {
|
||||
ImdgPredicateBuilder rgsPb = registryImdg.predicateBuilder();
|
||||
RegistryCodeSqlBuilder registryCodeSqlBuilder = RegistryCodeSqlBuilder.getInstance(
|
||||
AM_B
|
||||
);
|
||||
ImdgPredicate rgsCodePrdct = rgsPb.sql(registryCodeSqlBuilder.build());
|
||||
ImdgPredicate rgsCodePrdct = rgsPb.and(
|
||||
rgsPb.sql(registryCodeSqlBuilder.build()),
|
||||
rgsPb.equals("sessionId", sessionId)
|
||||
);
|
||||
return registryImdg.getCollectionObjectsByPredicate(rgsCodePrdct);
|
||||
}
|
||||
|
||||
|
|
@ -116,8 +121,9 @@ public class FormingPaymentInstructionAssets implements ISessionStage {
|
|||
return registryImdg.getCollectionObjectsByPredicate(rgsCodePrdct);
|
||||
}
|
||||
|
||||
private StageResult<?> formingPaymentInstructions(Long sessionId) {
|
||||
Collection<Registry> AMBregistries = selectAMBRegistries();
|
||||
private StageResult<?> formingPaymentInstructions(FormingPaymentInstructionPayload payload) {
|
||||
Long sessionId = payload.getSessionId();
|
||||
Collection<Registry> AMBregistries = selectAMBRegistries(sessionId);
|
||||
log.debug("found AMB registries.size() = {}", AMBregistries.size());
|
||||
Instant now = Instant.now();
|
||||
Account tranAcc = accountImdg.getFirstObjectBySQL("accountType = '%s' and status = '%s' and processingSign = '%s'"
|
||||
|
|
@ -210,7 +216,7 @@ public class FormingPaymentInstructionAssets implements ISessionStage {
|
|||
registryImdg.update(registry);
|
||||
paymentInstructions.add(paymentInstruction);
|
||||
}
|
||||
|
||||
if (section == null || !section.equals(Section.MKR)) {
|
||||
Collection<Registry> ASBregistries = selectASBRegistries();
|
||||
log.debug("found ASB registries.size() = {}", ASBregistries.size());
|
||||
|
||||
|
|
@ -279,6 +285,15 @@ public class FormingPaymentInstructionAssets implements ISessionStage {
|
|||
registryImdg.update(registry);
|
||||
paymentInstructions.add(paymentInstruction);
|
||||
}
|
||||
}
|
||||
if (payload.getPaymentInstructionReturns().size() > 0) {
|
||||
log.debug("PaymentInstructions return size {}, PaymentInstructions deals size {}. sending SDF03",
|
||||
payload.getPaymentInstructionReturns().size(),
|
||||
paymentInstructions.size());
|
||||
paymentInstructions = Stream.concat(payload.getPaymentInstructionReturns().stream(),
|
||||
paymentInstructions.stream()).toList();
|
||||
}
|
||||
|
||||
|
||||
sendSdfs(paymentInstructions);
|
||||
StageResult<Collection<PaymentInstruction>> stageResult = new StageResult<>(null, true);
|
||||
|
|
@ -364,4 +379,8 @@ public class FormingPaymentInstructionAssets implements ISessionStage {
|
|||
sDf12.setGenerationTime(Instant.now());
|
||||
return sDf12;
|
||||
}
|
||||
|
||||
public void setSection(Section section) {
|
||||
this.section = section;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,13 @@
|
|||
package ru.spcex.clearing.session.stage.task;
|
||||
|
||||
import ru.clearing.classes.statics.data.payment.PaymentInstruction;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
public class FormingPaymentInstructionPayload {
|
||||
private Long sessionId;
|
||||
private Collection<PaymentInstruction> paymentInstructionReturns;
|
||||
|
||||
public Long getSessionId() {
|
||||
return sessionId;
|
||||
|
|
@ -10,4 +16,12 @@ public class FormingPaymentInstructionPayload {
|
|||
public void setSessionId(Long sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
public Collection<PaymentInstruction> getPaymentInstructionReturns() {
|
||||
return paymentInstructionReturns != null ? paymentInstructionReturns : Collections.emptyList();
|
||||
}
|
||||
|
||||
public void setPaymentInstructionReturns(Collection<PaymentInstruction> paymentInstructionReturns) {
|
||||
this.paymentInstructionReturns = paymentInstructionReturns;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue